{"version":3,"file":"index-9a1f3016.js","sources":["../../../../node_modules/react/cjs/react.production.min.js","../../../../node_modules/react/index.js","../../../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../../../node_modules/react/jsx-runtime.js","../../../../node_modules/scheduler/cjs/scheduler.production.min.js","../../../../node_modules/scheduler/index.js","../../../../node_modules/react-dom/cjs/react-dom.production.min.js","../../../../node_modules/react-dom/index.js","../../../../node_modules/react-dom/client.js","../../../../apps/vivli-webapp/src/init.ts","../../../../node_modules/@azure/msal-browser/dist/_virtual/_tslib.js","../../../../node_modules/@azure/msal-common/dist/_virtual/_tslib.js","../../../../node_modules/@azure/msal-common/dist/utils/Constants.js","../../../../node_modules/@azure/msal-common/dist/error/AuthError.js","../../../../node_modules/@azure/msal-common/dist/crypto/ICrypto.js","../../../../node_modules/@azure/msal-common/dist/error/ClientAuthError.js","../../../../node_modules/@azure/msal-common/dist/utils/StringUtils.js","../../../../node_modules/@azure/msal-common/dist/logger/Logger.js","../../../../node_modules/@azure/msal-common/dist/packageMetadata.js","../../../../node_modules/@azure/msal-common/dist/authority/AuthorityOptions.js","../../../../node_modules/@azure/msal-common/dist/error/ClientConfigurationError.js","../../../../node_modules/@azure/msal-common/dist/request/ScopeSet.js","../../../../node_modules/@azure/msal-common/dist/account/ClientInfo.js","../../../../node_modules/@azure/msal-common/dist/authority/AuthorityType.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.js","../../../../node_modules/@azure/msal-common/dist/account/AuthToken.js","../../../../node_modules/@azure/msal-common/dist/cache/CacheManager.js","../../../../node_modules/@azure/msal-common/dist/config/ClientConfiguration.js","../../../../node_modules/@azure/msal-common/dist/error/ServerError.js","../../../../node_modules/@azure/msal-common/dist/network/ThrottlingUtils.js","../../../../node_modules/@azure/msal-common/dist/network/NetworkManager.js","../../../../node_modules/@azure/msal-common/dist/account/CcsCredential.js","../../../../node_modules/@azure/msal-common/dist/request/RequestValidator.js","../../../../node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.js","../../../../node_modules/@azure/msal-common/dist/client/BaseClient.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.js","../../../../node_modules/@azure/msal-common/dist/utils/TimeUtils.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.js","../../../../node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.js","../../../../node_modules/@azure/msal-common/dist/utils/ProtocolUtils.js","../../../../node_modules/@azure/msal-common/dist/url/UrlString.js","../../../../node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.js","../../../../node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.js","../../../../node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.js","../../../../node_modules/@azure/msal-common/dist/response/ResponseHandler.js","../../../../node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.js","../../../../node_modules/@azure/msal-common/dist/client/RefreshTokenClient.js","../../../../node_modules/@azure/msal-common/dist/client/SilentFlowClient.js","../../../../node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.js","../../../../node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.js","../../../../node_modules/@azure/msal-common/dist/authority/ProtocolMode.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.js","../../../../node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.js","../../../../node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.js","../../../../node_modules/@azure/msal-common/dist/authority/RegionDiscovery.js","../../../../node_modules/@azure/msal-common/dist/authority/Authority.js","../../../../node_modules/@azure/msal-common/dist/authority/AuthorityFactory.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.js","../../../../node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.js","../../../../node_modules/@azure/msal-common/dist/network/INetworkModule.js","../../../../node_modules/@azure/msal-common/dist/error/JoseHeaderError.js","../../../../node_modules/@azure/msal-common/dist/crypto/JoseHeader.js","../../../../node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.js","../../../../node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.js","../../../../node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.js","../../../../node_modules/@azure/msal-browser/dist/error/BrowserAuthError.js","../../../../node_modules/@azure/msal-browser/dist/utils/BrowserConstants.js","../../../../node_modules/@azure/msal-browser/dist/error/BrowserConfigurationAuthError.js","../../../../node_modules/@azure/msal-browser/dist/cache/BrowserStorage.js","../../../../node_modules/@azure/msal-browser/dist/cache/MemoryStorage.js","../../../../node_modules/@azure/msal-browser/dist/utils/BrowserProtocolUtils.js","../../../../node_modules/@azure/msal-browser/dist/cache/BrowserCacheManager.js","../../../../node_modules/@azure/msal-browser/dist/packageMetadata.js","../../../../node_modules/@azure/msal-browser/dist/network/FetchClient.js","../../../../node_modules/@azure/msal-browser/dist/network/XhrClient.js","../../../../node_modules/@azure/msal-browser/dist/utils/BrowserUtils.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.js","../../../../node_modules/@azure/msal-browser/dist/interaction_handler/InteractionHandler.js","../../../../node_modules/@azure/msal-browser/dist/interaction_handler/RedirectHandler.js","../../../../node_modules/@azure/msal-browser/dist/event/EventType.js","../../../../node_modules/@azure/msal-browser/dist/error/NativeAuthError.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.js","../../../../node_modules/@azure/msal-browser/dist/broker/nativeBroker/NativeMessageHandler.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.js","../../../../node_modules/@azure/msal-browser/dist/navigation/NavigationClient.js","../../../../node_modules/@azure/msal-browser/dist/config/Configuration.js","../../../../node_modules/@azure/msal-browser/dist/interaction_handler/SilentHandler.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.js","../../../../node_modules/@azure/msal-browser/dist/event/EventHandler.js","../../../../node_modules/@azure/msal-browser/dist/utils/MathUtils.js","../../../../node_modules/@azure/msal-browser/dist/crypto/GuidGenerator.js","../../../../node_modules/@azure/msal-browser/dist/utils/BrowserStringUtils.js","../../../../node_modules/@azure/msal-browser/dist/encode/Base64Encode.js","../../../../node_modules/@azure/msal-browser/dist/encode/Base64Decode.js","../../../../node_modules/@azure/msal-browser/dist/crypto/PkceGenerator.js","../../../../node_modules/@azure/msal-browser/dist/crypto/ModernBrowserCrypto.js","../../../../node_modules/@azure/msal-browser/dist/crypto/MsrBrowserCrypto.js","../../../../node_modules/@azure/msal-browser/dist/crypto/MsBrowserCrypto.js","../../../../node_modules/@azure/msal-browser/dist/crypto/BrowserCrypto.js","../../../../node_modules/@azure/msal-browser/dist/cache/DatabaseStorage.js","../../../../node_modules/@azure/msal-browser/dist/cache/AsyncMemoryStorage.js","../../../../node_modules/@azure/msal-browser/dist/cache/CryptoKeyStore.js","../../../../node_modules/@azure/msal-browser/dist/crypto/CryptoOps.js","../../../../node_modules/@azure/msal-browser/dist/telemetry/BrowserPerformanceMeasurement.js","../../../../node_modules/@azure/msal-browser/dist/telemetry/BrowserPerformanceClient.js","../../../../node_modules/@azure/msal-browser/dist/cache/TokenCache.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.js","../../../../node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.js","../../../../node_modules/@azure/msal-browser/dist/app/ClientApplication.js","../../../../node_modules/@azure/msal-browser/dist/app/PublicClientApplication.js","../../../../libs/core/infrastructure/context/src/lib/vivli-configuration-service.context.tsx","../../../../libs/core/infrastructure/context/src/lib/anonymous-api-service.context.tsx","../../../../libs/core/infrastructure/context/src/lib/config-service.context.tsx","../../../../libs/core/infrastructure/context/src/lib/user.context.tsx","../../../../libs/core/authentication/src/lib/msal-2.context.tsx","../../../../libs/core/authentication/src/lib/interface/msal-2-event-type.enum.ts","../../../../libs/core/authentication/src/lib/interface/msal-2-events.module.ts","../../../../node_modules/rxjs/node_modules/tslib/tslib.es6.js","../../../../node_modules/rxjs/_esm5/internal/util/isFunction.js","../../../../node_modules/rxjs/_esm5/internal/config.js","../../../../node_modules/rxjs/_esm5/internal/util/hostReportError.js","../../../../node_modules/rxjs/_esm5/internal/Observer.js","../../../../node_modules/rxjs/_esm5/internal/util/isArray.js","../../../../node_modules/rxjs/_esm5/internal/util/isObject.js","../../../../node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js","../../../../node_modules/rxjs/_esm5/internal/Subscription.js","../../../../node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js","../../../../node_modules/rxjs/_esm5/internal/Subscriber.js","../../../../node_modules/rxjs/_esm5/internal/util/canReportError.js","../../../../node_modules/rxjs/_esm5/internal/util/toSubscriber.js","../../../../node_modules/rxjs/_esm5/internal/symbol/observable.js","../../../../node_modules/rxjs/_esm5/internal/util/identity.js","../../../../node_modules/rxjs/_esm5/internal/util/pipe.js","../../../../node_modules/rxjs/_esm5/internal/Observable.js","../../../../node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js","../../../../node_modules/rxjs/_esm5/internal/SubjectSubscription.js","../../../../node_modules/rxjs/_esm5/internal/Subject.js","../../../../node_modules/rxjs/_esm5/internal/operators/refCount.js","../../../../node_modules/rxjs/_esm5/internal/observable/ConnectableObservable.js","../../../../node_modules/rxjs/_esm5/internal/operators/groupBy.js","../../../../node_modules/rxjs/_esm5/internal/BehaviorSubject.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/Action.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/QueueAction.js","../../../../node_modules/rxjs/_esm5/internal/Scheduler.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/QueueScheduler.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/queue.js","../../../../node_modules/rxjs/_esm5/internal/observable/empty.js","../../../../node_modules/rxjs/_esm5/internal/util/isScheduler.js","../../../../node_modules/rxjs/_esm5/internal/util/subscribeToArray.js","../../../../node_modules/rxjs/_esm5/internal/scheduled/scheduleArray.js","../../../../node_modules/rxjs/_esm5/internal/observable/fromArray.js","../../../../node_modules/rxjs/_esm5/internal/observable/of.js","../../../../node_modules/rxjs/_esm5/internal/observable/throwError.js","../../../../node_modules/rxjs/_esm5/internal/Notification.js","../../../../node_modules/rxjs/_esm5/internal/operators/observeOn.js","../../../../node_modules/rxjs/_esm5/internal/ReplaySubject.js","../../../../node_modules/rxjs/_esm5/internal/AsyncSubject.js","../../../../node_modules/rxjs/_esm5/internal/util/Immediate.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/AsapAction.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/AsapScheduler.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/asap.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/async.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/AnimationFrameAction.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/AnimationFrameScheduler.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/animationFrame.js","../../../../node_modules/rxjs/_esm5/internal/scheduler/VirtualTimeScheduler.js","../../../../node_modules/rxjs/_esm5/internal/util/noop.js","../../../../node_modules/rxjs/_esm5/internal/util/isObservable.js","../../../../node_modules/rxjs/_esm5/internal/util/ArgumentOutOfRangeError.js","../../../../node_modules/rxjs/_esm5/internal/util/EmptyError.js","../../../../node_modules/rxjs/_esm5/internal/util/TimeoutError.js","../../../../node_modules/rxjs/_esm5/internal/operators/map.js","../../../../node_modules/rxjs/_esm5/internal/observable/bindCallback.js","../../../../node_modules/rxjs/_esm5/internal/observable/bindNodeCallback.js","../../../../node_modules/rxjs/_esm5/internal/OuterSubscriber.js","../../../../node_modules/rxjs/_esm5/internal/InnerSubscriber.js","../../../../node_modules/rxjs/_esm5/internal/util/subscribeToPromise.js","../../../../node_modules/rxjs/_esm5/internal/symbol/iterator.js","../../../../node_modules/rxjs/_esm5/internal/util/subscribeToIterable.js","../../../../node_modules/rxjs/_esm5/internal/util/subscribeToObservable.js","../../../../node_modules/rxjs/_esm5/internal/util/isArrayLike.js","../../../../node_modules/rxjs/_esm5/internal/util/isPromise.js","../../../../node_modules/rxjs/_esm5/internal/util/subscribeTo.js","../../../../node_modules/rxjs/_esm5/internal/util/subscribeToResult.js","../../../../node_modules/rxjs/_esm5/internal/observable/combineLatest.js","../../../../node_modules/rxjs/_esm5/internal/scheduled/scheduleObservable.js","../../../../node_modules/rxjs/_esm5/internal/scheduled/schedulePromise.js","../../../../node_modules/rxjs/_esm5/internal/scheduled/scheduleIterable.js","../../../../node_modules/rxjs/_esm5/internal/util/isInteropObservable.js","../../../../node_modules/rxjs/_esm5/internal/util/isIterable.js","../../../../node_modules/rxjs/_esm5/internal/scheduled/scheduled.js","../../../../node_modules/rxjs/_esm5/internal/observable/from.js","../../../../node_modules/rxjs/_esm5/internal/innerSubscribe.js","../../../../node_modules/rxjs/_esm5/internal/operators/mergeMap.js","../../../../node_modules/rxjs/_esm5/internal/operators/mergeAll.js","../../../../node_modules/rxjs/_esm5/internal/operators/concatAll.js","../../../../node_modules/rxjs/_esm5/internal/observable/concat.js","../../../../node_modules/rxjs/_esm5/internal/observable/defer.js","../../../../node_modules/rxjs/_esm5/internal/observable/forkJoin.js","../../../../node_modules/rxjs/_esm5/internal/observable/fromEvent.js","../../../../node_modules/rxjs/_esm5/internal/observable/fromEventPattern.js","../../../../node_modules/rxjs/_esm5/internal/observable/generate.js","../../../../node_modules/rxjs/_esm5/internal/observable/iif.js","../../../../node_modules/rxjs/_esm5/internal/util/isNumeric.js","../../../../node_modules/rxjs/_esm5/internal/observable/interval.js","../../../../node_modules/rxjs/_esm5/internal/observable/merge.js","../../../../node_modules/rxjs/_esm5/internal/observable/never.js","../../../../node_modules/rxjs/_esm5/internal/observable/onErrorResumeNext.js","../../../../node_modules/rxjs/_esm5/internal/observable/pairs.js","../../../../node_modules/rxjs/_esm5/internal/util/not.js","../../../../node_modules/rxjs/_esm5/internal/operators/filter.js","../../../../node_modules/rxjs/_esm5/internal/observable/partition.js","../../../../node_modules/rxjs/_esm5/internal/observable/race.js","../../../../node_modules/rxjs/_esm5/internal/observable/range.js","../../../../node_modules/rxjs/_esm5/internal/observable/timer.js","../../../../node_modules/rxjs/_esm5/internal/observable/using.js","../../../../node_modules/rxjs/_esm5/internal/observable/zip.js","../../../../libs/core/authentication/src/lib/msal-2-fake.service.ts","../../../../node_modules/moment/dist/moment.js","../../../../libs/features/studies/infrastructure/enum/src/lib/available-ipd-content-type.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/recruitment-status.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/intervention-model.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/assignment-to-intervention.interface.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/study-status.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/phase.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/bulk-upload-content-type.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/bulk-update-content-type.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/study-request-behavior.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/data-package-status.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/data-package-type.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/data-package-validation-mode.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/study-tab.enum.ts","../../../../libs/features/studies/infrastructure/enum/src/lib/study-dataset-admin-ct-amr-tab.enum.ts","../../../../node_modules/uuid/dist/esm-browser/rng.js","../../../../node_modules/uuid/dist/esm-browser/regex.js","../../../../node_modules/uuid/dist/esm-browser/validate.js","../../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../../node_modules/uuid/dist/esm-browser/v4.js","../../../../libs/shared/infrastructure/service/src/lib/data-transformation.service.ts","../../../../libs/shared/infrastructure/service/src/lib/storage.service.ts","../../../../libs/shared/infrastructure/enum/src/lib/pico-type.enum.ts","../../../../libs/shared/infrastructure/enum/src/lib/grid-cell-renderer.enum.ts","../../../../libs/shared/infrastructure/enum/src/lib/form-field-type.enum.ts","../../../../libs/shared/infrastructure/enum/src/lib/assigned-app-type.enum.ts","../../../../libs/shared/infrastructure/enum/src/lib/translation-key.enum.ts","../../../../libs/shared/infrastructure/enum/src/lib/local-storage-key.enum.ts","../../../../libs/shared/infrastructure/enum/src/lib/load-indicator-size.enum.ts","../../../../libs/shared/infrastructure/enum/src/lib/load-indicator-color.enum.ts","../../../../libs/shared/infrastructure/enum/src/lib/report-data-type.enum.ts","../../../../libs/core/environments/src/lib/environment.ts","../../../../libs/shared/infrastructure/service/src/lib/logger.service.ts","../../../../node_modules/ably/build/ably-commonjs.js","../../../../libs/shared/infrastructure/service/src/lib/pub-sub.service.ts","../../../../libs/core/authentication/src/lib/msal-2-auth.service.ts","../../../../libs/core/authentication/src/lib/msal-2-auth.factory.ts","../../../../libs/core/authentication/src/lib/msal-2.wrapper.tsx","../../../../libs/core/authentication/src/lib/hook/login-expiration.hook.ts","../../../../libs/core/authentication/src/lib/hook/logout-on-close.hook.ts","../../../../libs/core/wrapper/src/lib/auth.wrapper.tsx","../../../../node_modules/axios-observable/dist/axios-observable.interface.js","../../../../node_modules/axios/lib/helpers/bind.js","../../../../node_modules/axios/lib/utils.js","../../../../node_modules/axios/lib/helpers/buildURL.js","../../../../node_modules/axios/lib/core/InterceptorManager.js","../../../../node_modules/axios/lib/helpers/normalizeHeaderName.js","../../../../node_modules/axios/lib/core/enhanceError.js","../../../../node_modules/axios/lib/core/createError.js","../../../../node_modules/axios/lib/core/settle.js","../../../../node_modules/axios/lib/helpers/cookies.js","../../../../node_modules/axios/lib/helpers/isAbsoluteURL.js","../../../../node_modules/axios/lib/helpers/combineURLs.js","../../../../node_modules/axios/lib/core/buildFullPath.js","../../../../node_modules/axios/lib/helpers/parseHeaders.js","../../../../node_modules/axios/lib/helpers/isURLSameOrigin.js","../../../../node_modules/axios/lib/adapters/xhr.js","../../../../node_modules/axios/lib/defaults.js","../../../../node_modules/axios/lib/core/transformData.js","../../../../node_modules/axios/lib/cancel/isCancel.js","../../../../node_modules/axios/lib/core/dispatchRequest.js","../../../../node_modules/axios/lib/core/mergeConfig.js","../../../../node_modules/axios/lib/helpers/validator.js","../../../../node_modules/axios/lib/core/Axios.js","../../../../node_modules/axios/lib/cancel/Cancel.js","../../../../node_modules/axios/lib/cancel/CancelToken.js","../../../../node_modules/axios/lib/helpers/spread.js","../../../../node_modules/axios/lib/helpers/isAxiosError.js","../../../../node_modules/axios/lib/axios.js","../../../../node_modules/axios/index.js","../../../../node_modules/axios-observable/dist/create-observable.js","../../../../node_modules/axios-observable/dist/axios.js","../../../../node_modules/axios-observable/dist/index.js","../../../../node_modules/rxjs/_esm5/internal/operators/catchError.js","../../../../node_modules/rxjs/_esm5/internal/operators/concatMap.js","../../../../node_modules/rxjs/_esm5/internal/operators/debounceTime.js","../../../../node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js","../../../../node_modules/rxjs/_esm5/internal/util/isDate.js","../../../../node_modules/rxjs/_esm5/internal/operators/throwIfEmpty.js","../../../../node_modules/rxjs/_esm5/internal/operators/take.js","../../../../node_modules/rxjs/_esm5/internal/operators/finalize.js","../../../../node_modules/rxjs/_esm5/internal/operators/first.js","../../../../node_modules/rxjs/_esm5/internal/operators/takeLast.js","../../../../node_modules/rxjs/_esm5/internal/operators/scan.js","../../../../node_modules/rxjs/_esm5/internal/operators/reduce.js","../../../../node_modules/rxjs/_esm5/internal/operators/timeoutWith.js","../../../../node_modules/rxjs/_esm5/internal/operators/timeout.js","../../../../node_modules/rxjs/_esm5/internal/operators/toArray.js","../../../../libs/core/infrastructure/rest/src/lib/rest.api.tsx","../../../../libs/core/infrastructure/rest/src/lib/rest-default-headers.constant.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/countries.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/rejection-reasons.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/allowed-file-upload-extensions.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/disallowed-public-email-domains.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/therapeutic-area-items.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/partners.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/accessible-rights.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/virtual-machine-types.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/workflow-step-norms.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/report-specs.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/workflow-status-descriptor-details.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/external-menu-items.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/file-extensions.intercept.ts","../../../../libs/shared/intercepts/src/lib/data/vivli-config/vivli-config.intercept.ts","../../../../libs/shared/intercepts/src/lib/intercepts.ts","../../../../libs/core/infrastructure/service/src/lib/vivli-configuration-api.service.ts","../../../../libs/shared/infrastructure/constants/src/lib/study-metadata-package-files.constant.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/approval-status.enum.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/data-request-status.enum.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/study-request-status.enum.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/requested-study-type.enum.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/analysis-purpose.enum.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/amr-analysis-purpose.enum.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/research-team-member-role.enum.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/vm-admin-approval-status.enum.ts","../../../../libs/features/data-requests/infrastructure/enum/src/lib/dua-document-status.enum.ts","../../../../libs/shared/infrastructure/constants/src/lib/admin-approval.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/data-request-hints.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/joi-validation-options.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/amr-translations.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/default-translations.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/amr-facets.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/clinical-trials-facets.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/interventional-study-options.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/observational-study-options.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/admin-console.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/assets.constant.ts","../../../../libs/shared/infrastructure/constants/src/lib/data-test-id.constants.ts","../../../../libs/shared/infrastructure/constants/src/lib/amr-data-test-id.constants.ts","../../../../libs/core/infrastructure/service/src/lib/anonmyous.api.service.ts","../../../../libs/core/infrastructure/wrappers/src/lib/anonymous-api-service-context.wrapper.tsx","../../../../libs/core/infrastructure/hook/src/lib/use-vivli-config.hook.ts","../../../../libs/core/infrastructure/hook/src/lib/use-assigned-app-type.hook.ts","../../../../libs/core/infrastructure/hook/src/lib/use-app-environment.hook.ts","../../../../libs/core/infrastructure/hook/src/lib/use-assigned-app-type-initialization.hook.ts","../../../../libs/core/infrastructure/hook/src/lib/use-external-menu-items.hook.ts","../../../../node_modules/@remix-run/router/dist/router.js","../../../../node_modules/react-router/dist/index.js","../../../../node_modules/react-ga4/dist/gtag.js","../../../../node_modules/react-ga4/dist/format.js","../../../../node_modules/react-ga4/dist/ga4.js","../../../../node_modules/react-ga4/dist/index.js","../../../../libs/core/infrastructure/hook/src/lib/use-ga-page-tracking.hook.ts","../../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../../../node_modules/@babel/runtime/helpers/esm/createClass.js","../../../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../../../node_modules/@babel/runtime/helpers/esm/inherits.js","../../../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../../../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../../../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../../../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../../../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../../../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../../../../node_modules/@babel/runtime/helpers/esm/toArray.js","../../../../node_modules/i18next/dist/esm/i18next.js","../../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../../../node_modules/void-elements/index.js","../../../../node_modules/html-parse-stringify/dist/html-parse-stringify.module.js","../../../../node_modules/react-i18next/dist/es/unescape.js","../../../../node_modules/react-i18next/dist/es/context.js","../../../../node_modules/react-i18next/dist/es/utils.js","../../../../node_modules/react-i18next/dist/es/Trans.js","../../../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../../../../node_modules/react-i18next/dist/es/useTranslation.js","../../../../node_modules/@microsoft/applicationinsights-shims/dist-esm/Constants.js","../../../../node_modules/@microsoft/applicationinsights-shims/dist-esm/Helpers.js","../../../../node_modules/@microsoft/applicationinsights-shims/dist-esm/TsLibShims.js","../../../../node_modules/@microsoft/dynamicproto-js/lib/dist/esm/dynamicproto-js.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/__DynamicConstants.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/InternalConstants.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/HelperFuncs.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EnvUtils.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DbgExtensionUtils.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DiagnosticLogger.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/PerfManager.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/RandomHelper.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DataCacheHelper.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CookieMgr.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EventHelpers.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CoreUtils.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/W3cTraceParent.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/TelemetryHelpers.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ChannelController.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/BaseCore.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/NotificationManager.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/AppInsightsCore.js","../../../../node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/InstrumentHooks.js","../../../../node_modules/@microsoft/applicationinsights-react-js/dist-esm/ReactPlugin.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Constants.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/DomHelperFuncs.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/__DynamicConstants.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/HelperFuncs.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/RequestResponseHeaders.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Enums.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/StorageHelperFuncs.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/DataSanitizer.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/UrlHelperFuncs.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Util.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/ConnectionStringParser.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/Envelope.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Event.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Exception.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/DataPoint.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Metric.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/PageView.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/RemoteDependencyData.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Trace.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/PageViewPerformance.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Telemetry/Common/Data.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/SeverityLevel.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/Contracts/ContextTagKeys.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/TelemetryItemCreator.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/Interfaces/PartAExtensions.js","../../../../node_modules/@microsoft/applicationinsights-common/dist-esm/applicationinsights-common.js","../../../../node_modules/@microsoft/applicationinsights-react-js/dist-esm/AppInsightsErrorBoundary.js","../../../../node_modules/@microsoft/applicationinsights-react-js/dist-esm/AppInsightsContext.js","../../../../libs/shared/infrastructure/hook/src/lib/use-default-api-options.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-chat-api-options.hook.ts","../../../../libs/shared/infrastructure/context/src/lib/modal.context.tsx","../../../../libs/shared/infrastructure/context/src/lib/toast.context.tsx","../../../../libs/shared/infrastructure/context/src/lib/integration.context.tsx","../../../../libs/shared/infrastructure/hook/src/lib/use-cleanup.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-priority-sort.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-ref-state.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-export.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-query-params.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-input-validation.hook.ts","../../../../node_modules/react-hook-form/dist/index.esm.mjs","../../../../libs/shared/infrastructure/hook/src/lib/use-map-list-to-form.hook.ts","../../../../node_modules/react-router-dom/dist/index.js","../../../../libs/shared/infrastructure/hook/src/lib/use-portal-config.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/copy-to-clipboard.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-path-ending.hook.ts","../../../../libs/features/virtual-machine/infrastructure/enum/src/lib/vm-size.enum.ts","../../../../libs/features/virtual-machine/infrastructure/enum/src/lib/vm-status.enum.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-vm-pub-sub.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-dr-pub-sub.hook.ts","../../../../libs/shared/infrastructure/hook/src/lib/use-tab-focus.hook.ts","../../../../libs/features/data-requests/infrastructure/context/src/lib/data-requests-service.context.tsx","../../../../libs/features/data-requests/infrastructure/context/src/lib/data-request.context.tsx","../../../../libs/features/data-requests/infrastructure/context/src/lib/safety-concerns.context.tsx","../../../../libs/features/data-requests/infrastructure/context/src/lib/shared-data.context.tsx","../../../../libs/features/data-requests/infrastructure/context/src/lib/research-environment.context.tsx","../../../../libs/features/data-requests/infrastructure/context/src/lib/status-update.context.tsx","../../../../libs/shared/infrastructure/hook/src/lib/use-dua-document-table-data.hook.ts","../../../../libs/core/infrastructure/wrappers/src/lib/config-service-context.wrapper.tsx","../../../../libs/features/users/infrastructure/context/src/lib/users-service.context.tsx","../../../../libs/features/users/infrastructure/context/src/lib/user-info.context.tsx","../../../../libs/core/infrastructure/wrappers/src/lib/user-context.wrapper.tsx","../../../../libs/core/infrastructure/wrappers/src/lib/vivli-configuration-service-context.wrapper.tsx","../../../../libs/features/organizations/infrastructure/context/src/lib/organizations-service.context.tsx","../../../../libs/features/organizations/infrastructure/context/src/lib/organization-details.context.tsx","../../../../node_modules/tinycolor2/esm/tinycolor.js","../../../../libs/shared/theme/src/lib/constants/colors.ts","../../../../libs/shared/theme/src/lib/constants/size.ts","../../../../libs/shared/theme/src/lib/constants/styles.ts","../../../../libs/shared/components/src/lib/common.styles.ts","../../../../libs/shared/components/src/lib/load-indicator/load-indicator.component.tsx","../../../../libs/shared/components/src/lib/link-button.component.tsx","../../../../node_modules/react-tiny-popover/dist/PopoverPortal.js","../../../../node_modules/react-tiny-popover/dist/util.js","../../../../node_modules/react-tiny-popover/dist/useElementRef.js","../../../../node_modules/react-tiny-popover/dist/usePopover.js","../../../../node_modules/react-tiny-popover/dist/useMemoizedArray.js","../../../../node_modules/react-tiny-popover/dist/useArrowContainer.js","../../../../node_modules/react-tiny-popover/dist/ArrowContainer.js","../../../../node_modules/react-tiny-popover/dist/Popover.js","../../../../libs/shared/components/src/lib/buttons/button.component.tsx","../../../../libs/shared/components/src/lib/header/admin-header-button.component.tsx","../../../../libs/shared/components/src/lib/ellipsis-text.component.tsx","../../../../libs/shared/components/src/lib/header/admin-header-title.component.tsx","../../../../node_modules/@popperjs/core/lib/enums.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../../../node_modules/@popperjs/core/lib/utils/math.js","../../../../node_modules/@popperjs/core/lib/utils/userAgent.js","../../../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../../../node_modules/@popperjs/core/lib/utils/within.js","../../../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../../../node_modules/@popperjs/core/lib/utils/debounce.js","../../../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../../../node_modules/@popperjs/core/lib/createPopper.js","../../../../node_modules/@popperjs/core/lib/popper.js","../../../../node_modules/tippy.js/dist/tippy.esm.js","../../../../node_modules/@tippyjs/react/dist/tippy-react.esm.js","../../../../libs/shared/components/src/lib/header/admin-header-detail-title.component.tsx","../../../../libs/shared/components/src/lib/header/admin-header.component.tsx","../../../../libs/shared/components/src/lib/export-csv-button.component.tsx","../../../../libs/shared/components/src/lib/hint-popover.component.tsx","../../../../node_modules/prop-types/lib/ReactPropTypesSecret.js","../../../../node_modules/prop-types/factoryWithThrowingShims.js","../../../../node_modules/prop-types/index.js","../../../../node_modules/ag-grid-community/dist/ag-grid-community.cjs.js","../../../../node_modules/ag-grid-react/lib/agGridColumn.js","../../../../node_modules/ag-grid-react/lib/changeDetectionService.js","../../../../node_modules/ag-grid-react/lib/utils.js","../../../../node_modules/ag-grid-react/lib/reactComponent.js","../../../../node_modules/ag-grid-react/lib/keyGenerator.js","../../../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../../../../node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../../../../node_modules/react-dom/server.browser.js","../../../../node_modules/ag-grid-react/lib/legacyReactComponent.js","../../../../node_modules/ag-grid-react/lib/newReactComponent.js","../../../../node_modules/ag-grid-react/lib/agGridReact.js","../../../../node_modules/ag-grid-react/main.js","../../../../libs/shared/components/src/lib/grid/grid-cell-list.component.tsx","../../../../libs/shared/components/src/lib/grid/grid-checkbox.component.tsx","../../../../libs/shared/components/src/lib/grid/grid-cell-large-text.component.tsx","../../../../libs/shared/components/src/lib/grid/grid-cell-date-time.component.tsx","../../../../libs/shared/components/src/lib/grid/grid.component.tsx","../../../../libs/shared/components/src/lib/grid/grid-page.component.tsx","../../../../libs/shared/components/src/lib/field-header.component.tsx","../../../../libs/shared/components/src/lib/question-mark.component.tsx","../../../../libs/shared/components/src/lib/menu-item.component.tsx","../../../../node_modules/react-slidedown/node_modules/tslib/tslib.js","../../../../node_modules/react-lifecycles-compat/react-lifecycles-compat.es.js","../../../../node_modules/chain-function/index.js","../../../../node_modules/react-slidedown/lib/TransitionGroup/ChildMapping.js","../../../../node_modules/react-slidedown/lib/TransitionGroup/TransitionGroup.js","../../../../node_modules/react-slidedown/lib/slidedown.js","../../../../libs/shared/components/src/lib/tabs/tab-buttons.component.tsx","../../../../libs/shared/components/src/lib/badge.component.tsx","../../../../libs/shared/components/src/lib/tabs/tab-button.component.tsx","../../../../libs/shared/components/src/lib/tabs/tab-button-container.component.tsx","../../../../libs/shared/components/src/lib/tabs/tabs.component.tsx","../../../../libs/shared/components/src/lib/tabs/tab.component.tsx","../../../../node_modules/react-merge-refs/dist/react-merge-refs.esm.js","../../../../libs/shared/components/src/lib/info-popover.component.tsx","../../../../libs/shared/components/src/lib/input/base-input-field.component.tsx","../../../../libs/shared/components/src/lib/input/text-field.component.tsx","../../../../libs/shared/components/src/lib/input/text-field-read-only-form.component.tsx","../../../../libs/shared/components/src/lib/input/text-area.component.tsx","../../../../libs/shared/components/src/lib/input/text-area-read-only-form.component.tsx","../../../../libs/shared/components/src/lib/input/checkbox.component.tsx","../../../../node_modules/classnames/index.js","../../../../node_modules/date-fns/esm/_lib/requiredArgs/index.js","../../../../node_modules/date-fns/esm/isDate/index.js","../../../../node_modules/date-fns/esm/toDate/index.js","../../../../node_modules/date-fns/esm/isValid/index.js","../../../../node_modules/date-fns/esm/_lib/toInteger/index.js","../../../../node_modules/date-fns/esm/addMilliseconds/index.js","../../../../node_modules/date-fns/esm/subMilliseconds/index.js","../../../../node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js","../../../../node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js","../../../../node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js","../../../../node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js","../../../../node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js","../../../../node_modules/date-fns/esm/_lib/defaultOptions/index.js","../../../../node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js","../../../../node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js","../../../../node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js","../../../../node_modules/date-fns/esm/_lib/getUTCWeek/index.js","../../../../node_modules/date-fns/esm/_lib/addLeadingZeros/index.js","../../../../node_modules/date-fns/esm/_lib/format/lightFormatters/index.js","../../../../node_modules/date-fns/esm/_lib/format/formatters/index.js","../../../../node_modules/date-fns/esm/_lib/format/longFormatters/index.js","../../../../node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js","../../../../node_modules/date-fns/esm/_lib/protectedTokens/index.js","../../../../node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js","../../../../node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js","../../../../node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js","../../../../node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js","../../../../node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js","../../../../node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js","../../../../node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js","../../../../node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js","../../../../node_modules/date-fns/esm/locale/en-US/_lib/match/index.js","../../../../node_modules/date-fns/esm/locale/en-US/index.js","../../../../node_modules/date-fns/esm/format/index.js","../../../../node_modules/date-fns/esm/addMinutes/index.js","../../../../node_modules/date-fns/esm/addHours/index.js","../../../../node_modules/date-fns/esm/addDays/index.js","../../../../node_modules/date-fns/esm/addWeeks/index.js","../../../../node_modules/date-fns/esm/addMonths/index.js","../../../../node_modules/date-fns/esm/addQuarters/index.js","../../../../node_modules/date-fns/esm/addYears/index.js","../../../../node_modules/date-fns/esm/subDays/index.js","../../../../node_modules/date-fns/esm/subWeeks/index.js","../../../../node_modules/date-fns/esm/subMonths/index.js","../../../../node_modules/date-fns/esm/subQuarters/index.js","../../../../node_modules/date-fns/esm/subYears/index.js","../../../../node_modules/date-fns/esm/getSeconds/index.js","../../../../node_modules/date-fns/esm/getMinutes/index.js","../../../../node_modules/date-fns/esm/getHours/index.js","../../../../node_modules/date-fns/esm/getDay/index.js","../../../../node_modules/date-fns/esm/getDate/index.js","../../../../node_modules/date-fns/esm/startOfWeek/index.js","../../../../node_modules/date-fns/esm/startOfISOWeek/index.js","../../../../node_modules/date-fns/esm/getISOWeekYear/index.js","../../../../node_modules/date-fns/esm/startOfISOWeekYear/index.js","../../../../node_modules/date-fns/esm/getISOWeek/index.js","../../../../node_modules/date-fns/esm/getMonth/index.js","../../../../node_modules/date-fns/esm/getQuarter/index.js","../../../../node_modules/date-fns/esm/getYear/index.js","../../../../node_modules/date-fns/esm/getTime/index.js","../../../../node_modules/date-fns/esm/setSeconds/index.js","../../../../node_modules/date-fns/esm/setMinutes/index.js","../../../../node_modules/date-fns/esm/setHours/index.js","../../../../node_modules/date-fns/esm/getDaysInMonth/index.js","../../../../node_modules/date-fns/esm/setMonth/index.js","../../../../node_modules/date-fns/esm/setQuarter/index.js","../../../../node_modules/date-fns/esm/setYear/index.js","../../../../node_modules/date-fns/esm/min/index.js","../../../../node_modules/date-fns/esm/max/index.js","../../../../node_modules/date-fns/esm/startOfDay/index.js","../../../../node_modules/date-fns/esm/differenceInCalendarDays/index.js","../../../../node_modules/date-fns/esm/differenceInCalendarMonths/index.js","../../../../node_modules/date-fns/esm/differenceInCalendarYears/index.js","../../../../node_modules/date-fns/esm/startOfMonth/index.js","../../../../node_modules/date-fns/esm/startOfQuarter/index.js","../../../../node_modules/date-fns/esm/startOfYear/index.js","../../../../node_modules/date-fns/esm/endOfDay/index.js","../../../../node_modules/date-fns/esm/endOfMonth/index.js","../../../../node_modules/date-fns/esm/endOfYear/index.js","../../../../node_modules/date-fns/esm/isEqual/index.js","../../../../node_modules/date-fns/esm/isSameDay/index.js","../../../../node_modules/date-fns/esm/isSameMonth/index.js","../../../../node_modules/date-fns/esm/isSameYear/index.js","../../../../node_modules/date-fns/esm/isSameQuarter/index.js","../../../../node_modules/date-fns/esm/isAfter/index.js","../../../../node_modules/date-fns/esm/isBefore/index.js","../../../../node_modules/date-fns/esm/isWithinInterval/index.js","../../../../node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js","../../../../node_modules/date-fns/esm/_lib/assign/index.js","../../../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js","../../../../node_modules/@babel/runtime/helpers/esm/createSuper.js","../../../../node_modules/date-fns/esm/parse/_lib/Setter.js","../../../../node_modules/date-fns/esm/parse/_lib/Parser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js","../../../../node_modules/date-fns/esm/constants/index.js","../../../../node_modules/date-fns/esm/parse/_lib/constants.js","../../../../node_modules/date-fns/esm/parse/_lib/utils.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js","../../../../node_modules/date-fns/esm/_lib/setUTCWeek/index.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js","../../../../node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js","../../../../node_modules/date-fns/esm/_lib/setUTCDay/index.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js","../../../../node_modules/date-fns/esm/_lib/setUTCISODay/index.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js","../../../../node_modules/date-fns/esm/parse/_lib/parsers/index.js","../../../../node_modules/date-fns/esm/parse/index.js","../../../../node_modules/date-fns/esm/parseISO/index.js","../../../../node_modules/react-onclickoutside/dist/react-onclickoutside.es.js","../../../../node_modules/react-popper/lib/esm/Manager.js","../../../../node_modules/react-popper/lib/esm/utils.js","../../../../node_modules/react-fast-compare/index.js","../../../../node_modules/react-popper/lib/esm/usePopper.js","../../../../node_modules/react-popper/lib/esm/Popper.js","../../../../node_modules/react-popper/node_modules/warning/warning.js","../../../../node_modules/react-popper/lib/esm/Reference.js","../../../../node_modules/date-fns/esm/set/index.js","../../../../node_modules/react-datepicker/dist/es/index.js","../../../../libs/shared/components/src/lib/input/date-picker.component.tsx","../../../../libs/shared/components/src/lib/input/link-field.component.tsx","../../../../libs/shared/components/src/lib/input/radio.component.tsx","../../../../libs/shared/components/src/lib/input/radio-group.component.tsx","../../../../libs/shared/components/src/lib/input/yes-no-radio.component.tsx","../../../../node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../../../../node_modules/react-select/dist/useStateManager-7e1e8489.esm.js","../../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../../../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../../../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../../../../node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js","../../../../node_modules/stylis/src/Enum.js","../../../../node_modules/stylis/src/Utility.js","../../../../node_modules/stylis/src/Tokenizer.js","../../../../node_modules/stylis/src/Parser.js","../../../../node_modules/stylis/src/Serializer.js","../../../../node_modules/stylis/src/Middleware.js","../../../../node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../../../node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js","../../../../node_modules/react-is/cjs/react-is.production.min.js","../../../../node_modules/react-is/index.js","../../../../node_modules/@emotion/react/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../../../node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js","../../../../node_modules/@emotion/hash/dist/emotion-hash.esm.js","../../../../node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../../../node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js","../../../../node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js","../../../../node_modules/@emotion/react/dist/emotion-element-c39617d8.browser.esm.js","../../../../node_modules/@emotion/react/dist/emotion-react.browser.esm.js","../../../../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../../../../node_modules/react-select/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs","../../../../node_modules/react-select/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs","../../../../node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js","../../../../node_modules/react-select/dist/index-6ea50319.esm.js","../../../../node_modules/memoize-one/dist/memoize-one.esm.js","../../../../node_modules/react-select/dist/Select-ce3716e1.esm.js","../../../../node_modules/react-select/dist/react-select.esm.js","../../../../libs/shared/components/src/lib/input/multi-select-dropdown-field.component.tsx","../../../../libs/shared/components/src/lib/dropdown-menu/dropdown-menu-item.component.tsx","../../../../libs/shared/components/src/lib/dropdown-menu/dropdown-menu-content.component.tsx","../../../../libs/shared/components/src/lib/dropdown-menu/dropdown-menu.component.tsx","../../../../libs/shared/components/src/lib/input/dropdown-field.component.tsx","../../../../libs/shared/components/src/lib/input/checkbox-list.component.tsx","../../../../libs/shared/components/src/lib/form-field/base-controlled-form-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/text-area-form-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/dropdown-form-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/multi-select-dropdown-form-field.component.tsx","../../../../libs/shared/components/src/lib/multi-entry-bubble.component.tsx","../../../../libs/features/dashboard/infrastructure/constants/src/lib/metrics.constant.ts","../../../../libs/shared/components/src/lib/multi-entry-text-field.component.tsx","../../../../libs/shared/components/src/lib/input/multi-entry-input-text-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/multi-entry-input-text-form-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/checkbox-form-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/date-picker-form-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/text-form-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/checkbox-list-form-field.component.tsx","../../../../libs/shared/components/src/lib/form-field/yes-no-radio-form-field.component.tsx","../../../../libs/shared/components/src/lib/copyright.component.tsx","../../../../libs/shared/components/src/lib/hierarchical-dropdown-menu/hierarchical-dropdown-menu-content.component.tsx","../../../../libs/shared/components/src/lib/hierarchical-dropdown-menu/hierarchical-dropdown-menu.component.tsx","../../../../libs/shared/components/src/lib/input/hierarchical-dropdown-field.component.tsx","../../../../libs/shared/components/src/lib/go-back-header-button.component.tsx","../../../../libs/shared/components/src/lib/white-background-logo.component.tsx","../../../../libs/shared/components/src/lib/modal/message-modal.component.tsx","../../../../libs/shared/components/src/lib/modal/modal.component.tsx","../../../../libs/shared/components/src/lib/modal/confirm-dialog-modal.component.tsx","../../../../node_modules/@fortawesome/fontawesome-svg-core/index.mjs","../../../../node_modules/@fortawesome/react-fontawesome/index.es.js","../../../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs","../../../../libs/shared/components/src/lib/ellipsis-dropdown-menu.component.tsx","../../../../libs/shared/components/src/lib/load-indicator/load-indicator-centered.component.tsx","../../../../libs/shared/components/src/lib/error.component.tsx","../../../../libs/shared/components/src/lib/go-back-link.component.tsx","../../../../libs/shared/components/src/lib/empty-list-placeholder.component.tsx","../../../../libs/shared/components/src/lib/translation.component.tsx","../../../../libs/shared/components/src/lib/welcome-popup.component.tsx","../../../../libs/shared/components/src/lib/team-member.component.tsx","../../../../libs/shared/components/src/lib/modal/welcome-modal.component.tsx","../../../../libs/shared/components/src/lib/modal/no-search-results-found-modal.component.tsx","../../../../libs/shared/components/src/lib/terms-of-use.component.tsx","../../../../libs/shared/components/src/lib/advanced-header.component.tsx","../../../../libs/shared/components/src/lib/advanced-select.component.tsx","../../../../libs/shared/components/src/lib/not-found.component.tsx","../../../../libs/shared/components/src/lib/history-list-item.component.tsx","../../../../libs/shared/components/src/lib/history-list.component.tsx","../../../../libs/shared/components/src/lib/advanced-sub-header.component.tsx","../../../../libs/shared/components/src/lib/date-range.component.tsx","../../../../node_modules/nouislider/dist/nouislider.js","../../../../libs/shared/components/src/lib/range-slider/range-slider.component.tsx","../../../../libs/shared/components/src/lib/basic-checkbox.component.tsx","../../../../libs/shared/components/src/lib/context-injector.component.tsx","../../../../libs/shared/components/src/lib/cookie-warning.component.tsx","../../../../libs/shared/components/src/lib/popout/popout-menu.component.tsx","../../../../libs/features/listing-request/infrastructure/constants/src/lib/hints.constant.tsx","../../../../libs/shared/components/src/lib/study-research-team/research-member-row.component.tsx","../../../../libs/features/studies/infrastructure/service/src/lib/studies-api.service.ts","../../../../libs/features/studies/infrastructure/service/src/lib/azure-search.service.ts","../../../../libs/features/studies/infrastructure/service/src/lib/studies-search-api.service.ts","../../../../libs/features/studies/infrastructure/service/src/lib/orcid-api.service.ts","../../../../libs/shared/components/src/lib/study-research-team/study-research-team-member-rows.component.tsx","../../../../libs/shared/components/src/lib/buttons/delete-button.component.tsx","../../../../libs/shared/components/src/lib/buttons/edit-button.component.tsx","../../../../libs/shared/components/src/lib/external-links/external-link-renderer.component.tsx","../../../../node_modules/@hookform/resolvers/dist/resolvers.mjs","../../../../node_modules/@hookform/resolvers/joi/dist/joi.mjs","../../../../node_modules/joi/dist/joi-browser.min.js","../../../../libs/shared/components/src/lib/external-links/external-link.component.tsx","../../../../libs/shared/components/src/lib/external-links/external-links.component.tsx","../../../../libs/features/studies/infrastructure/context/src/lib/studies-service.context.tsx","../../../../libs/features/studies/infrastructure/context/src/lib/studies-search-service.context.tsx","../../../../libs/features/studies/infrastructure/context/src/lib/study.context.tsx","../../../../libs/shared/components/src/lib/external-links/study-external-links.component.tsx","../../../../libs/shared/components/src/lib/table/planning-table-component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-date-renderer.component.tsx","../../../../libs/features/data-requests/infrastructure/service/src/lib/data-request-permissions.service.ts","../../../../libs/features/data-requests/infrastructure/service/src/lib/data-request-filter.service.ts","../../../../libs/features/data-requests/infrastructure/service/src/lib/data-requests-api.service.ts","../../../../libs/features/data-requests/infrastructure/service/src/lib/data-request-format.service.ts","../../../../libs/features/data-requests/components/src/lib/shared/cancel-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-status-renderer.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-title-renderer.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/my-data-request-title-renderer.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-requests-grid.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-requests-page.component.tsx","../../../../libs/shared/infrastructure/schema/src/lib/orcid.schema.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-research-team-member-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-research-team-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-awaiting-user-action-data-requests.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request-filters.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-my-data-requests.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-research-team-create.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-initialize-research-team.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request.hook.ts","../../../../libs/features/virtual-machine/infrastructure/context/src/lib/virtual-machine-service.context.tsx","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request-virtual-machine.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-researcher-subtitle.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request-providers.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-research-team-member-id.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request-permissions.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-research-team-permissions.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-analysis-purpose-text-map.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-amr-analysis-purpose-text-map.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-research-proposal-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-statistical-analysis-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-funding-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-data-request-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-unlisted-study.form.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-status-update-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-safety-concern-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-antimicrobial-detail-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/form-hooks/use-amr-data-request-form.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request-admin-path.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request-default-tab.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request-summaries.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-data-request-anonymously.hook.ts","../../../../node_modules/moment/moment.js","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-status-update-hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-vm-status-map.hook.ts","../../../../libs/features/organizations/infrastructure/hook/src/lib/use-organizations.hook.ts","../../../../libs/features/organizations/infrastructure/hook/src/lib/use-org-details-form.hook.ts","../../../../libs/features/organizations/infrastructure/hook/src/lib/use-current-members.hook.ts","../../../../libs/features/organizations/infrastructure/hook/src/lib/use-ror-organizations.hook.ts","../../../../libs/shared/features/citations/infrastructure/context/src/lib/citations-service.context.tsx","../../../../libs/shared/features/citations/infrastructure/context/src/lib/citations.context.tsx","../../../../libs/features/organizations/infrastructure/hook/src/lib/use-ror-search.hook.ts","../../../../libs/features/data-requests/infrastructure/hook/src/lib/use-dua-data.hook.ts","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-tab.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-tabs.component.tsx","../../../../libs/features/admin-console/infrastructure/context/src/lib/admin-console-service.context.tsx","../../../../libs/features/admin-console/infrastructure/context/src/lib/admin-console.context.tsx","../../../../libs/features/admin-console/infrastructure/context/src/lib/admin-console-look-id.context.tsx","../../../../libs/features/admin-console/components/src/lib/tabs/admin-template-study.component.tsx","../../../../libs/features/admin-console/components/src/lib/tabs/admin-audit-trail.component.tsx","../../../../libs/features/admin-console/components/src/lib/tabs/admin-config-settings.component.tsx","../../../../libs/features/admin-console/components/src/lib/tabs/admin-data-request/request-studies-button-renderer.component.tsx","../../../../libs/features/admin-console/components/src/lib/tabs/admin-data-request/request-data-studies-grid.component.tsx","../../../../libs/features/admin-console/components/src/lib/tabs/admin-data-request/admin-data-request.component.tsx","../../../../libs/features/admin-console/components/src/lib/tabs/vm-user-details.component.tsx","../../../../libs/features/admin-console/components/src/lib/tabs/admin-virtual-machine.component.tsx","../../../../libs/features/admin-console/components/src/lib/admin-console-tabs.component.tsx","../../../../libs/features/admin-console/components/src/lib/admin-console.component.tsx","../../../../libs/features/admin-console/infrastructure/service/src/lib/admin-console-api.service.ts","../../../../libs/features/admin-console/components/src/lib/audit-trail-contextual.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/data-request-history/data-request-history.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/team-member-details-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/team-member-controls-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/team-member-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/team-member-modal-buttons.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/team-member-modal.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/team-member-row.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/team-member-list-item.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/draft-team-member-modal.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/draft-team-member-list-item.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/draft-research-team.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/narrative-summary-help.component.tsx","../../../../libs/features/data-requests/components/src/lib/purpose-of-analysis.component.tsx","../../../../libs/features/data-requests/infrastructure/constants/src/lib/outcomes.constant.ts","../../../../libs/features/data-requests/components/src/lib/outcomes.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/research-proposal-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/statistical-analysis-plan-help.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/statistical-analysis-plan-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/funding-form.component.tsx","../../../../node_modules/@babel/runtime/helpers/interopRequireDefault.js","../../../../node_modules/dom-helpers/class/hasClass.js","../../../../node_modules/dom-helpers/class/addClass.js","../../../../node_modules/dom-helpers/class/removeClass.js","../../../../node_modules/react-fine-uploader/node_modules/react-transition-group/Transition.js","../../../../node_modules/react-fine-uploader/node_modules/react-transition-group/CSSTransition.js","../../../../node_modules/react-fine-uploader/node_modules/react-transition-group/utils/ChildMapping.js","../../../../node_modules/react-fine-uploader/node_modules/react-transition-group/TransitionGroup.js","../../../../node_modules/react-fine-uploader/node_modules/react-transition-group/ReplaceTransition.js","../../../../node_modules/react-fine-uploader/node_modules/react-transition-group/index.js","../../../../node_modules/react-fine-uploader/cancel-button.js","../../../../node_modules/react-fine-uploader/delete-button.js","../../../../node_modules/fine-uploader/dnd/dnd.js","../../../../node_modules/fine-uploader/lib/dnd.js","../../../../node_modules/react-fine-uploader/dropzone.js","../../../../node_modules/react-fine-uploader/file-input/styleable-element.js","../../../../node_modules/react-fine-uploader/file-input/index.js","../../../../node_modules/react-fine-uploader/filename.js","../../../../node_modules/react-fine-uploader/filesize.js","../../../../node_modules/react-fine-uploader/retry-button.js","../../../../node_modules/react-fine-uploader/pause-resume-button.js","../../../../node_modules/react-fine-uploader/progress-bar.js","../../../../node_modules/object-assign/index.js","../../../../node_modules/react-fine-uploader/status.js","../../../../node_modules/react-fine-uploader/thumbnail/placeholder.js","../../../../node_modules/react-fine-uploader/thumbnail/not-available-placeholder.js","../../../../node_modules/react-fine-uploader/thumbnail/waiting-placeholder.js","../../../../node_modules/react-fine-uploader/thumbnail/index.js","../../../../node_modules/react-fine-uploader/gallery/pause-icon.js","../../../../node_modules/react-fine-uploader/gallery/play-icon.js","../../../../node_modules/react-fine-uploader/gallery/upload-icon.js","../../../../node_modules/react-fine-uploader/gallery/upload-failed-icon.js","../../../../node_modules/react-fine-uploader/gallery/upload-success-icon.js","../../../../node_modules/react-fine-uploader/gallery/x-icon.js","../../../../node_modules/react-fine-uploader/gallery/index.js","../../../../node_modules/fine-uploader-wrappers/node_modules/object-assign/index.js","../../../../node_modules/fine-uploader-wrappers/callback-names.js","../../../../node_modules/fine-uploader-wrappers/callback-proxy.js","../../../../node_modules/fine-uploader-wrappers/base-wrapper.js","../../../../node_modules/fine-uploader/fine-uploader/fine-uploader.core.js","../../../../node_modules/fine-uploader/lib/core/index.js","../../../../node_modules/fine-uploader-wrappers/traditional.js","../../../../libs/shared/features/data-package/components/src/lib/uploader/uploader.component.tsx","../../../../node_modules/truncate-utf8-bytes/lib/truncate.js","../../../../node_modules/utf8-byte-length/browser.js","../../../../node_modules/truncate-utf8-bytes/browser.js","../../../../node_modules/sanitize-filename/index.js","../../../../libs/shared/features/data-package/components/src/lib/data-package-validation-message.component.tsx","../../../../libs/shared/features/data-package/infrastructure/context/src/lib/data-package-service.context.tsx","../../../../libs/shared/features/data-package/infrastructure/context/src/lib/data-package-file-service.context.tsx","../../../../libs/shared/features/data-package/components/src/lib/data-package-file.component.tsx","../../../../libs/shared/features/data-package/components/src/lib/data-package-validate-button.component.tsx","../../../../libs/shared/features/data-package/components/src/lib/file-upload-warning.component.tsx","../../../../libs/shared/features/data-package/components/src/lib/file-upload-warning-chat.component.tsx","../../../../libs/features/users/infrastructure/hook/src/lib/use-user-permissions.hook.ts","../../../../libs/features/users/infrastructure/hook/src/lib/use-users.hook.ts","../../../../libs/features/users/infrastructure/hook/src/lib/use-vivli-admins.hook.ts","../../../../libs/features/users/infrastructure/hook/src/lib/use-user-info-form.hook.ts","../../../../libs/shared/features/data-package/components/src/lib/data-package.component.tsx","../../../../libs/shared/features/data-package/components/src/lib/data-package-loader.component.tsx","../../../../libs/shared/features/data-package/components/src/lib/data-package-base.component.tsx","../../../../libs/shared/features/data-package/feature/src/lib/result-request-data-package.feature.tsx","../../../../libs/shared/features/data-package/feature/src/lib/download-only-data-package.feature.tsx","../../../../libs/features/studies/infrastructure/hook/src/lib/use-requested-study-filters.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-requested-studies.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-studies-awaiting-upload.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-studies.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-requested-study-permissions.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-study.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-study-with-user-check.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/form-hooks/use-study-pi-form.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/form-hooks/use-admin-ct-study-form.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-admin-study-permissions.hook.ts","../../../../libs/features/studies/infrastructure/constants/src/lib/annotate-study-options.constant.ts","../../../../libs/features/studies/infrastructure/constants/src/lib/study-status.constant.ts","../../../../libs/features/studies/infrastructure/constants/src/lib/general-study-hints.constant.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-admin-study-status-change.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/form-hooks/use-annotate-study-form.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/form-hooks/use-bulk-upload-form.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/form-hooks/use-submit-study-form.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-requested-study-behavior.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-study-primary-registry-url.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-external-link-permissions.hook.ts","../../../../libs/features/studies/infrastructure/hook/src/lib/use-doi-transform.hook.ts","../../../../libs/shared/infrastructure/utilities/src/lib/utility-api/utility-api.service.ts","../../../../libs/shared/infrastructure/utilities/src/lib/utility-api/utility-api-service.context.tsx","../../../../libs/shared/infrastructure/utilities/src/lib/utility-api/utility-api-service-context.wrapper.tsx","../../../../libs/shared/features/data-package/feature/src/lib/study-ipd-data-package.feature.tsx","../../../../libs/shared/features/data-package/feature/src/lib/attachments-data-package.feature.tsx","../../../../libs/features/chat/infrastructure/context/src/lib/chat-service.context.tsx","../../../../libs/shared/features/data-package/feature/src/lib/chat-data-package.feature.tsx","../../../../libs/shared/features/data-package/feature/src/lib/signed-documents-data-package.feature.tsx","../../../../libs/shared/features/data-package/feature/src/lib/other-information-data-package.feature.tsx","../../../../libs/shared/features/data-package/feature/src/lib/documents-data-package.feature.tsx","../../../../libs/features/data-requests/components/src/lib/forms/other-information-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/attestations-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/data-request-form/data-request-form.styles.ts","../../../../libs/features/studies/components/src/lib/studies-grid.component.tsx","../../../../node_modules/react-ellipsis-text/lib/components/EllipsisText.js","../../../../node_modules/react-ellipsis-text/index.js","../../../../libs/features/studies/components/src/lib/requested-study-row/requested-study-row-detail.component.tsx","../../../../libs/features/studies/components/src/lib/requested-study-row/default-basic-data-package-list.component.tsx","../../../../libs/features/studies/components/src/lib/requested-study-row/default-full-data-package-list.component.tsx","../../../../libs/features/studies/components/src/lib/requested-study-row/amr-basic-data-package-list.component.tsx","../../../../libs/features/studies/components/src/lib/requested-study-row/edit-advanced-options-button.component.tsx","../../../../libs/features/studies/components/src/lib/requested-study-row/requested-study-row.styles.ts","../../../../libs/features/studies/components/src/lib/requested-study-row/advanced-options-detail.component.tsx","../../../../libs/features/studies/components/src/lib/requested-study-row/requested-study-row.component.tsx","../../../../libs/features/studies/components/src/lib/data-request-requested-study-row.component.tsx","../../../../libs/features/studies/components/src/lib/requested-studies-row-renderer.component.tsx","../../../../libs/features/studies/components/src/lib/requested-studies-grid.component.tsx","../../../../libs/features/studies/components/src/lib/requested-studies.component.tsx","../../../../libs/features/studies/components/src/lib/add-unlisted-study-form.component.tsx","../../../../libs/features/studies/components/src/lib/add-unlisted-study-modal.component.tsx","../../../../libs/features/datasets/infrastructure/enum/src/lib/dataset-tab.enum.tsx","../../../../libs/features/datasets/infrastructure/context/src/lib/dataset.context.tsx","../../../../libs/features/datasets/infrastructure/service/src/lib/dataset-format.service.ts","../../../../libs/features/datasets/components/src/lib/admin-details/about-data-grid.component.tsx","../../../../libs/features/datasets/components/src/lib/amr-dataset-details.component.tsx","../../../../libs/features/datasets/components/src/lib/dataset-attached-documents.component.tsx","../../../../libs/features/datasets/components/src/lib/design-history/study-design-grid.component.tsx","../../../../libs/features/datasets/components/src/lib/design-history/design-history.component.tsx","../../../../libs/features/datasets/components/src/lib/pico/pico-population.component.tsx","../../../../libs/features/datasets/components/src/lib/pico/pico-arms.component.tsx","../../../../libs/features/datasets/components/src/lib/pico/pico-outcomes.component.tsx","../../../../libs/features/datasets/components/src/lib/pico/pico-search-terms.component.tsx","../../../../libs/features/datasets/components/src/lib/pico/pico.component.tsx","../../../../libs/features/datasets/components/src/lib/trials-dataset-details.component.tsx","../../../../libs/features/datasets/components/src/lib/dataset-download.component.tsx","../../../../libs/features/datasets/components/src/lib/dataset-view.component.tsx","../../../../libs/features/datasets/components/src/lib/admin-details/amr-dataset-admin-details.component.tsx","../../../../libs/features/datasets/components/src/lib/admin-details/downloadable-status-change.component.tsx","../../../../libs/features/search/infrastructure/hook/src/lib/use-display-banner.hook.ts","../../../../libs/features/search/infrastructure/hook/src/lib/use-dropdown-filter.hook.ts","../../../../libs/features/search/infrastructure/hook/src/lib/use-date-range-filter.hook.ts","../../../../libs/features/search/infrastructure/hook/src/lib/use-sample-size-filter.hook.ts","../../../../libs/features/search/infrastructure/hook/src/lib/use-year-range-filter.hook.ts","../../../../libs/features/search/infrastructure/hook/src/lib/use-boolean-filter.hook.ts","../../../../libs/features/search/infrastructure/hook/src/lib/use-facets.hook.ts","../../../../libs/features/search/components/src/lib/search-banner.component.tsx","../../../../libs/features/search/components/src/lib/search-tab.component.tsx","../../../../libs/features/search/infrastructure/context/src/lib/search.context.tsx","../../../../libs/features/search/infrastructure/context/src/lib/azure-search.context.tsx","../../../../libs/features/search/infrastructure/context/src/lib/ct-search-options.context.tsx","../../../../libs/features/search/infrastructure/context/src/lib/amr-search-options.context.tsx","../../../../libs/features/search/infrastructure/context/src/lib/pico-search-options.context.tsx","../../../../libs/features/search/infrastructure/context/src/lib/quick-search.context.tsx","../../../../libs/features/search/infrastructure/enum/src/lib/filter-operator.enum.ts","../../../../libs/features/search/infrastructure/enum/src/lib/pico-color.enum.ts","../../../../libs/features/search/infrastructure/enum/src/lib/search-tab.enum.ts","../../../../libs/features/search/components/src/lib/search-tabs.component.tsx","../../../../libs/features/search/components/src/lib/search-results-bar.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-filters.styles.ts","../../../../libs/features/search/components/src/lib/search-filters/filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/amr/amr-filter-groups/first-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/amr/amr-filter-groups/second-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/amr/amr-filter-groups/third-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/amr/year-advanced-select.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/amr/amr-filter-groups/fourth-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/amr/amr-filter-groups/fifth-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/amr/amr-search-filters-vertical.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-filter-groups/study-design-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-filter-groups/study-phase-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-filter-groups/sponsor-info-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-filter-groups/location-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-filter-groups/dates-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-filter-groups/sample-size-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-search-filters-vertical.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-filters-vertical.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-buttons/button.styles.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-buttons/info-button.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-buttons/search-button.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-input-buttons.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-input.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/pico/pico-color-block.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/pico/pico-type-modal.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/pico/multi-value-container.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-select.component.tsx","../../../../node_modules/react-cool-inview/dist/index.esm.js","../../../../libs/features/search/components/src/lib/search-result-row/partner-platform-modal.component.tsx","../../../../libs/features/search/components/src/lib/search-result-row/advanced-dropdown-menu.component.tsx","../../../../libs/features/search/components/src/lib/search-result-row/search-result-row-info.component.tsx","../../../../libs/features/search/components/src/lib/search-result-row/search-result-row.component.tsx","../../../../libs/features/search/components/src/lib/search-result-row/search-result-rows.component.tsx","../../../../libs/features/search/components/src/lib/search-results.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/amr/amr-search-filters.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-filter-group.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-search-filters.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/pico/pico-tab.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/pico/term-box.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/pico/terms-selector.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/pico/pico-tabs.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/pico/pico-search-filters.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-filters-container.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/search-filters.component.tsx","../../../../libs/features/search/components/src/lib/quick-search/quick-search.component.tsx","../../../../libs/features/search/components/src/lib/quick-search/quick-search-results.component.tsx","../../../../libs/features/search/components/src/lib/quick-search/embedded-quick-search.component.tsx","../../../../libs/features/search/components/src/lib/quick-search/embedded-quick-search-results.component.tsx","../../../../libs/features/search/components/src/lib/search-filters/ct/ct-filter-groups/funder-info-filter-group.component.tsx","../../../../libs/features/datasets/components/src/lib/admin-details/dataset-admin-details.component.tsx","../../../../libs/features/datasets/components/src/lib/admin-details/dataset-admin-details-container.component.tsx","../../../../libs/features/datasets/components/src/lib/research-team/dataset-research-team.component.tsx","../../../../libs/features/datasets/components/src/lib/dataset-tabs.component.tsx","../../../../libs/features/datasets/infrastructure/hook/src/lib/use-dataset-usage.hook.ts","../../../../libs/features/datasets/components/src/lib/dataset-usage.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-study-dataset-attached-documents-component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-common-submission-details.component.tsx","../../../../libs/features/studies/components/src/lib/study-dataset-request-type.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/study-dataset-ipd-options-component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-amr-administrative-shared.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-amr-administrative-details.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/pi-details.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/collaborators-and-secondary-ids.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/publishing-and-contacting.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-ct-administrative-shared.component.tsx","../../../../libs/features/organizations/components/src/lib/modals/accepted-org-invite.component.tsx","../../../../libs/features/organizations/components/src/lib/modals/accept-org-invite.modal.tsx","../../../../libs/features/organizations/components/src/lib/name-row-renderer.component.tsx","../../../../libs/features/organizations/components/src/lib/org-member-row-render.component.tsx","../../../../libs/features/organizations/components/src/lib/org-member-checkBox-renderer.component.tsx","../../../../libs/features/organizations/components/src/lib/org-members-grid.component.tsx","../../../../libs/features/organizations/components/src/lib/org-admin-header.component.tsx","../../../../libs/features/organizations/components/src/lib/modals/org-resources-link.component.tsx","../../../../libs/features/organizations/components/src/lib/invite-members-with-rights.component.tsx","../../../../libs/features/organizations/components/src/lib/org-invite-row.component.tsx","../../../../libs/features/organizations/components/src/lib/pending-invites.component.tsx","../../../../libs/features/organizations/components/src/lib/org-members-tab.component.tsx","../../../../libs/features/organizations/components/src/lib/org-details-basic-information.component.tsx","../../../../libs/features/organizations/components/src/lib/org-details-section.component.tsx","../../../../libs/features/organizations/components/src/lib/organization-policies.component.tsx","../../../../libs/features/organizations/components/src/lib/org-details-tab.component.tsx","../../../../libs/features/organizations/components/src/lib/org-tabs.component.tsx","../../../../libs/features/organizations/components/src/lib/org-details-form.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/ror-org-search.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/ror-funders-search.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/ror-search.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/ror.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/org-ror-container.component.tsx","../../../../libs/features/organizations/components/src/lib/org-ror-tab.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/funding-org-row-container.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/funding-orgs-row-renderer.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/funding-orgs-grid.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/funding-orgs-container.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/funders-ror-container.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/lr-funders-ror-container.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/study-funders-ror-container.component.tsx","../../../../libs/features/organizations/components/src/lib/ror/ror-search-container.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-ct-administrative-details.component.tsx","../../../../libs/features/studies/components/src/lib/study-dataset-json.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-ct-study-detail.component.tsx","../../../../node_modules/@microsoft/signalr/dist/esm/Errors.js","../../../../node_modules/@microsoft/signalr/dist/esm/HttpClient.js","../../../../node_modules/@microsoft/signalr/dist/esm/ILogger.js","../../../../node_modules/@microsoft/signalr/dist/esm/Loggers.js","../../../../node_modules/@microsoft/signalr/dist/esm/Utils.js","../../../../node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js","../../../../node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js","../../../../node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js","../../../../node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js","../../../../node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js","../../../../node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js","../../../../node_modules/@microsoft/signalr/dist/esm/Subject.js","../../../../node_modules/@microsoft/signalr/dist/esm/HubConnection.js","../../../../node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js","../../../../node_modules/@microsoft/signalr/dist/esm/HeaderNames.js","../../../../node_modules/@microsoft/signalr/dist/esm/ITransport.js","../../../../node_modules/@microsoft/signalr/dist/esm/AbortController.js","../../../../node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js","../../../../node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js","../../../../node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js","../../../../node_modules/@microsoft/signalr/dist/esm/HttpConnection.js","../../../../node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","../../../../node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js","../../../../libs/features/chat/infrastructure/hook/src/lib/use-signalr.hook.ts","../../../../libs/features/chat/infrastructure/hook/src/lib/use-channel.hook.ts","../../../../libs/features/chat/components/src/lib/chat-message.component.tsx","../../../../libs/features/chat/components/src/lib/chat-description.component.tsx","../../../../libs/features/chat/feature/src/lib/chat.feature.tsx","../../../../libs/features/chat/feature/src/lib/channel-display.feature.tsx","../../../../libs/features/chat/components/src/lib/chat-hint-text.component.tsx","../../../../libs/features/chat/feature/src/lib/chat-rollup.feature.tsx","../../../../libs/features/studies/components/src/lib/study-dataset-chat.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-study-dataset-datapackage.component.tsx","../../../../libs/features/studies/components/src/lib/study-dataset-history.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-study-dataset-usedin.component.tsx","../../../../libs/shared/features/citations/infrastructure/service/src/lib/citations-api.service.ts","../../../../libs/shared/features/citations/infrastructure/wrappers/src/lib/citations-service-context.wrapper.tsx","../../../../libs/shared/features/citations/infrastructure/wrappers/src/lib/citations-context.wrapper.tsx","../../../../libs/shared/features/citations/components/src/lib/edit-citation-form.component.tsx","../../../../libs/shared/features/citations/components/src/lib/citation-container.component.tsx","../../../../libs/shared/features/citations/components/src/lib/citation-row-renderer.component.tsx","../../../../libs/shared/features/citations/components/src/lib/citations-grid.component.tsx","../../../../libs/shared/features/citations/components/src/lib/add-citation.component.tsx","../../../../libs/shared/features/citations/components/src/lib/citation-add-buttons.component.tsx","../../../../libs/shared/features/citations/components/src/lib/citations-container.component.tsx","../../../../libs/shared/features/citations/infrastructure/hook/src/lib/use-citation.hook.ts","../../../../libs/shared/features/citations/components/src/lib/citation.component.tsx","../../../../libs/shared/features/citations/components/src/lib/citation-authors.component.tsx","../../../../libs/shared/features/citations/feature/src/lib/citations.feature.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/usage-citations-container.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-study-dataset-status-display.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-study-dataset-tabs.component.tsx","../../../../libs/features/studies/components/src/lib/study-approve-reject-button.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-study-header-container.component.tsx","../../../../libs/features/studies/components/src/lib/admin-studies-datasets/admin-study-form.component.tsx","../../../../libs/features/studies/components/src/lib/view-data-package-row.component.tsx","../../../../libs/features/studies/components/src/lib/view-data-package-study-reference.component.tsx","../../../../libs/features/studies/components/src/lib/view-data-package.component.tsx","../../../../libs/features/studies/components/src/lib/annotate-study/study-workflow-buttons.component.tsx","../../../../libs/features/studies/components/src/lib/annotate-study/annotate-study-header.component.tsx","../../../../libs/features/studies/components/src/lib/annotate-study/annotate-study-design.component.tsx","../../../../libs/features/studies/components/src/lib/annotate-study/annotate-study-blinding.component.tsx","../../../../node_modules/load-script/index.js","../../../../libs/features/studies/components/src/lib/annotate-study/annotator.tsx","../../../../libs/features/studies/components/src/lib/annotate-study/annotate-study-annotation.component.tsx","../../../../libs/features/studies/components/src/lib/annotate-study/annotate-study-json-tab.component.tsx","../../../../libs/features/studies/components/src/lib/annotate-study/annotate-study-tabs.component.tsx","../../../../libs/features/studies/components/src/lib/annotate-study/annotate-study-form.component.tsx","../../../../libs/features/studies/components/src/lib/bulk-upload-studies/bulk-upload-studies-selectors.component.tsx","../../../../libs/features/studies/components/src/lib/bulk-upload-studies/bulk-upload-studies-form.component.tsx","../../../../libs/features/studies/components/src/lib/bulk-update-studies/bulk-update-studies-selectors.component.tsx","../../../../libs/features/studies/components/src/lib/submit-study/submit-study-header.component.tsx","../../../../libs/features/studies/components/src/lib/submit-study/study-details.component.tsx","../../../../libs/features/studies/components/src/lib/submit-study/vivli-details.component.tsx","../../../../libs/features/studies/components/src/lib/submit-study/submit-study-tabs.component.tsx","../../../../libs/features/studies/components/src/lib/submit-study/submit-study-form.component.tsx","../../../../libs/features/studies/components/src/lib/submit-study/study-lookup.component.tsx","../../../../libs/features/studies/components/src/lib/submit-study/study-sample.component.tsx","../../../../libs/features/studies/components/src/lib/submit-study/submit-new-study.component.tsx","../../../../libs/features/listing-request/infrastructure/context/src/lib/listing-request.context.tsx","../../../../libs/features/listing-request/infrastructure/context/src/lib/listing-request-service.context.tsx","../../../../libs/features/listing-request/infrastructure/enum/src/lib/listing-request-status.enum.ts","../../../../libs/features/listing-request/components/src/lib/header/listing-request-admin-header-buttons.component.tsx","../../../../libs/features/listing-request/components/src/lib/header/listing-request-header-buttons.component.tsx","../../../../libs/features/listing-request/components/src/lib/header/listing-request-left-header.component.tsx","../../../../libs/features/listing-request/components/src/lib/header/listing-request-header.component.tsx","../../../../libs/features/listing-request/infrastructure/hook/src/lib/use-listing-request-form.hook.ts","../../../../libs/features/listing-request/infrastructure/hook/src/lib/use-listing-requests.hook.ts","../../../../libs/features/listing-request/components/src/lib/shared/styles.ts","../../../../libs/features/listing-request/components/src/lib/tabs/your-organization.component.tsx","../../../../libs/features/listing-request/components/src/lib/listing-request-study-sample.component.tsx","../../../../libs/features/listing-request/components/src/lib/listing-request-study-nonNct.component.tsx","../../../../libs/features/listing-request/components/src/lib/tabs/your-study.component.tsx","../../../../libs/features/listing-request/components/src/lib/tabs/data-sharing-settings.component.tsx","../../../../libs/features/listing-request/components/src/lib/tabs/agreements.component.tsx","../../../../libs/features/listing-request/components/src/lib/tabs/upload-data.component.tsx","../../../../libs/features/listing-request/components/src/lib/tabs/listing-request-chat.component.tsx","../../../../libs/features/listing-request/components/src/lib/tabs/information-about-your-team.component.tsx","../../../../libs/features/listing-request/components/src/lib/tabs/listing-request-history.component.tsx","../../../../libs/shared/features/notification/infrastructure/context/src/lib/notification-service.context.ts","../../../../libs/shared/features/notification/infrastructure/context/src/lib/notification.context.ts","../../../../libs/shared/features/notification/infrastructure/enum/src/lib/notification-topic.enum.ts","../../../../libs/shared/features/notification/infrastructure/enum/src/lib/notification-type.enum.ts","../../../../libs/shared/features/notification/infrastructure/wrappers/src/lib/notification-context.wrapper.tsx","../../../../libs/shared/features/notification/infrastructure/service/src/lib/notification-api.service.ts","../../../../libs/shared/features/notification/infrastructure/wrappers/src/lib/notification-service-context.wrapper.tsx","../../../../libs/shared/features/notification/infrastructure/hook/src/lib/form-hook/use-notification-form.hook.ts","../../../../libs/shared/features/notification/components/src/lib/notification-form.component.tsx","../../../../libs/shared/features/notification/infrastructure/wrappers/src/lib/notification-form.wrapper.tsx","../../../../libs/shared/features/notification/feature/src/lib/notification.feature.tsx","../../../../libs/features/listing-request/components/src/lib/listing-request-status-update.form.tsx","../../../../libs/features/listing-request/components/src/lib/tabs/listing-status-update.component.tsx","../../../../libs/features/listing-request/components/src/lib/nav/listing-request-routes.component.tsx","../../../../libs/features/listing-request/components/src/lib/nav/listing-request-tab.component.tsx","../../../../libs/features/listing-request/components/src/lib/nav/listing-request-tabs.component.tsx","../../../../libs/features/listing-request/components/src/lib/listing-request-form.component.tsx","../../../../libs/features/listing-request/components/src/lib/listing-landing-view.component.tsx","../../../../libs/features/listing-request/components/src/lib/listing-requests-grid.component.tsx","../../../../libs/features/listing-request/components/src/lib/listing-requests-page.component.tsx","../../../../libs/features/listing-request/components/src/lib/listing-request-portal.component.tsx","../../../../libs/features/studies/components/src/lib/research-member-orcid-accept.component.tsx","../../../../libs/features/studies/components/src/lib/add-study-in-process.component.tsx","../../../../libs/features/studies/feature/src/lib/studies/studies.feature.tsx","../../../../libs/features/studies/feature/src/lib/awaiting-upload-studies.feature.tsx","../../../../apps/vivli-e2e/src/fixtures/data-test-id.constants.ts","../../../../libs/features/studies/feature/src/lib/requested-studies.feature.tsx","../../../../libs/features/studies/infrastructure/wrappers/src/lib/studies-search-service-context.wrapper.tsx","../../../../libs/features/studies/infrastructure/wrappers/src/lib/studies-service-context.wrapper.tsx","../../../../libs/features/studies/infrastructure/wrappers/src/lib/study-context.wrapper.tsx","../../../../libs/features/studies/feature/src/lib/study/admin-study.feature.tsx","../../../../libs/features/studies/feature/src/lib/annotate-study/annotate-study.feature.tsx","../../../../libs/features/studies/feature/src/lib/bulk-upload-studies.feature.tsx","../../../../libs/features/studies/feature/src/lib/bulk-update-studies.feature.tsx","../../../../libs/features/studies/feature/src/lib/submit-study.feature.tsx","../../../../libs/features/results-request/components/src/lib/select-virtual-machine-modal.component.tsx","../../../../libs/features/results-request/infrastructure/enum/src/lib/results-request-status.enum.ts","../../../../libs/features/results-request/infrastructure/enum/src/lib/result-request-routes.enum.ts","../../../../libs/features/results-request/infrastructure/service/src/lib/result-request-api.service.ts","../../../../libs/features/results-request/infrastructure/service/src/lib/result-request-format.service.ts","../../../../libs/features/results-request/infrastructure/service/src/lib/result-request-permission.service.ts","../../../../libs/features/results-request/components/src/lib/result-requests-grid.component.tsx","../../../../libs/features/results-request/infrastructure/context/src/lib/result-request-service.context.tsx","../../../../libs/features/results-request/components/src/lib/result-request-approval.component.tsx","../../../../libs/features/results-request/components/src/lib/result-request.component.tsx","../../../../libs/features/results-request/components/src/lib/new-result-request.component.tsx","../../../../libs/features/results-request/components/src/lib/create-result-request-button.component.tsx","../../../../libs/features/results-request/infrastructure/hook/src/lib/use-result-requests.hook.ts","../../../../libs/features/authentication/components/src/lib/login-prompt.component.tsx","../../../../libs/features/results-request/feature/src/lib/result-requests.feature.tsx","../../../../libs/features/results-request/feature/src/lib/result-request.feature.tsx","../../../../libs/features/data-requests/components/src/lib/forms/data-request-form/data-request-form-routes.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/approve-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/reject-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/soft-reject-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/badge.style.ts","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/dua-validation-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/reset-to-draft-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/reset-to-draft-with-title.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/approve-reject-buttons.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/edit-data-request-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/set-tracking-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/show-approval-buttons.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/request-title.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/left-header.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-view/vivli-admin-comments.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-view/study-row-detail.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-view/data-request-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/print-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-publication-text.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-print-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-print-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/print-button-container.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/request-header/request-header.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/request-header/data-request-admin-header.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/request-header/data-request-header.component.tsx","../../../../libs/features/data-requests/components/src/lib/shared/request-header/request-header-container.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/data-request-form/data-request-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/status-update-form/shared-status-update-fields.component.tsx","../../../../libs/features/data-requests/components/src/lib/forms/status-update-form/status-update-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/signed-documents-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/data-request-signed-documents.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/data-request-studies.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/studies-provided.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/block-message.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/sign-document.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/esign.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/guard/vm-status-guard.component.tsx","../../../../libs/features/virtual-machine/components/src/lib/provision-view/components/vm-table-header.component.tsx","../../../../libs/features/virtual-machine/components/src/lib/provision-view/components/vm-table-column.component.tsx","../../../../libs/features/virtual-machine/components/src/lib/provision-view/provision-view.component.tsx","../../../../libs/features/virtual-machine/components/src/lib/manage-vm.styles.ts","../../../../libs/features/virtual-machine/components/src/lib/manage-vm-modal-buttons.component.tsx","../../../../libs/features/virtual-machine/components/src/lib/manage-vm-modal.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/research-help-link.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/provision-virtual-machine.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/waiting-message.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/provision-views/vm-provisioning-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/provision-views/vm-deprovisioned-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/vm-failure.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/failed-views/vm-provisioning-failed-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/failed-views/vm-deprovisioning-failed-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/failed-views/vm-adding-data-packages-failed-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/failed-views/vm-starting-failed-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/failed-views/vm-stopping-failed-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/provision-views/vm-provisioned-button.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/provision-views/vm-provisioned-buttons.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/provision-views/vm-provisioned-connect.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/provision-views/vm-provisioned-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/research-environment.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/retrying.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/research-environment/guard/vm-access-guard.component.tsx","../../../../libs/features/data-requests/infrastructure/wrappers/src/lib/data-request-context.wrapper.tsx","../../../../libs/features/data-requests/infrastructure/wrappers/src/lib/data-requests-service-context.wrapper.tsx","../../../../libs/features/data-requests/infrastructure/wrappers/src/lib/shared-data-context.wrapper.tsx","../../../../libs/features/data-requests/infrastructure/wrappers/src/lib/research-environment-context.wrapper.tsx","../../../../libs/features/data-requests/infrastructure/wrappers/src/lib/safety-concerns-context.wrapper.tsx","../../../../libs/features/data-requests/infrastructure/wrappers/src/lib/status-update-context.wrapper.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/data-request-research-environment.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/data-request-attachments.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/data-request-print-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/research-team/research-team-list.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/data-request-research-team.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/dua-execution.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/dua.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-status-update.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/report-safety-concern/report-safety-concern-list-item.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/report-safety-concern/report-safety-concern-list.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/report-safety-concern/report-safety-concern-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/report-safety-concern/report-safety-concern.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/public-disclosures/disclosures-container.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-routes/data-request-routes.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-datasets.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-fields/amr-purpose-of-analysis.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-fields/amr-researcher-location.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-request-form.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-view.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-routes.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-tabs/amr-data-request-tab.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-tabs/amr-data-request-tabs.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-tabs/amr-data-request-admin-tabs.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-tabs/amr-data-request-requester-tabs.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-tabs/amr-data-request-dc-tabs.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request-tabs/amr-data-request-tabs-container.component.tsx","../../../../libs/features/data-requests/components/src/lib/amr-data-request/amr-data-request.component.tsx","../../../../libs/features/data-requests/components/src/lib/modals/accepted-data-request-invite.component.tsx","../../../../libs/features/data-requests/components/src/lib/modals/accept-data-request-invite.modal.tsx","../../../../libs/features/data-requests/components/src/lib/view-secondary-analysis-row.component.tsx","../../../../libs/features/data-requests/components/src/lib/view-secondary-analysis.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-notifications-sub-tab.component.tsx","../../../../libs/features/data-requests/components/src/lib/data-request/data-request-header/components/enter-institution.component.tsx","../../../../libs/shared/components/src/lib/table/individual-dua-documents-table-component.tsx","../../../../libs/features/organizations/infrastructure/wrappers/src/lib/organization-details-context.wrapper.tsx","../../../../libs/features/organizations/infrastructure/service/src/lib/organizations-api.service.ts","../../../../libs/features/organizations/infrastructure/wrappers/src/lib/organizations-service-context.wrapper.tsx","../../../../libs/features/users/infrastructure/service/src/lib/users-api.service.ts","../../../../libs/features/users/infrastructure/wrappers/src/lib/users-service-context.wrapper.tsx","../../../../libs/features/users/infrastructure/wrappers/src/lib/user-info-context.wrapper.tsx","../../../../libs/features/chat/infrastructure/service/src/lib/chat-api.service.ts","../../../../libs/features/chat/infrastructure/service/src/lib/chat-organization-api.service.ts","../../../../libs/features/chat/infrastructure/wrappers/src/lib/chat-service-context.wrapper.tsx","../../../../libs/features/results-request/infrastructure/wrappers/src/lib/result-request-service-context.wrapper.tsx","../../../../libs/features/virtual-machine/infrastructure/service/src/lib/virtual-machine-api.service.ts","../../../../libs/features/virtual-machine/infrastructure/wrappers/src/lib/virtual-machine-service-context.wrapper.tsx","../../../../libs/shared/features/data-package/infrastructure/service/src/lib/data-package-api.service.ts","../../../../libs/shared/features/data-package/infrastructure/service/src/lib/data-package-file-api.service.ts","../../../../libs/shared/features/data-package/infrastructure/wrappers/src/lib/data-package-file-service-context.wrapper.tsx","../../../../libs/shared/features/data-package/infrastructure/wrappers/src/lib/data-package-service-context.wrapper.tsx","../../../../libs/features/search/infrastructure/wrappers/src/lib/amr-search-options-context.wrapper.tsx","../../../../libs/features/search/infrastructure/interface/src/lib/sample-size.interface.ts","../../../../libs/shared/infrastructure/interface/src/lib/date-range.interface.ts","../../../../libs/features/search/infrastructure/service/src/lib/azure-search-api.service.ts","../../../../libs/features/search/infrastructure/service/src/lib/azure-search-base.service.ts","../../../../libs/features/search/infrastructure/service/src/lib/azure-search.service.ts","../../../../libs/features/search/infrastructure/service/src/lib/azure-filters-search.service.ts","../../../../libs/features/search/infrastructure/wrappers/src/lib/azure-search-service-context.wrapper.tsx","../../../../libs/features/search/infrastructure/wrappers/src/lib/ct-search-options-context.wrapper.tsx","../../../../libs/features/search/infrastructure/wrappers/src/lib/pico-search-options-context.wrapper.tsx","../../../../libs/features/search/infrastructure/wrappers/src/lib/quick-search-context.wrapper.tsx","../../../../node_modules/rxjs/internal/util/isFunction.js","../../../../node_modules/rxjs/internal/config.js","../../../../node_modules/rxjs/internal/util/hostReportError.js","../../../../node_modules/rxjs/internal/Observer.js","../../../../node_modules/rxjs/internal/util/isArray.js","../../../../node_modules/rxjs/internal/util/isObject.js","../../../../node_modules/rxjs/internal/util/UnsubscriptionError.js","../../../../node_modules/rxjs/internal/Subscription.js","../../../../node_modules/rxjs/internal/symbol/rxSubscriber.js","../../../../node_modules/rxjs/internal/Subscriber.js","../../../../node_modules/rxjs/internal/util/canReportError.js","../../../../node_modules/rxjs/internal/util/toSubscriber.js","../../../../node_modules/rxjs/internal/symbol/observable.js","../../../../node_modules/rxjs/internal/util/identity.js","../../../../node_modules/rxjs/internal/util/pipe.js","../../../../node_modules/rxjs/internal/Observable.js","../../../../node_modules/rxjs/internal/util/subscribeToArray.js","../../../../node_modules/rxjs/internal/scheduled/scheduleArray.js","../../../../node_modules/rxjs/internal/observable/fromArray.js","../../../../libs/features/search/infrastructure/wrappers/src/lib/search-context.wrapper.tsx","../../../../libs/features/dashboard/infrastructure/service/src/lib/metrics-api.service.ts","../../../../libs/features/dashboard/infrastructure/context/src/lib/metrics-service.context.tsx","../../../../libs/features/dashboard/infrastructure/wrappers/src/lib/metrics-service-context.wrapper.tsx","../../../../libs/features/dashboard/infrastructure/hook/src/lib/use-report-items.hook.ts","../../../../libs/features/dashboard/infrastructure/hook/src/lib/use-metrics-report-form.hook.ts","../../../../libs/features/dashboard/components/src/lib/organization-memberships-list.component.tsx","../../../../libs/features/dashboard/infrastructure/enum/src/lib/metrics-report.enum.ts","../../../../node_modules/lodash/lodash.js","../../../../libs/features/dashboard/components/src/lib/metrics-report/metrics-report-header.component.tsx","../../../../node_modules/react-motion/lib/mapToZero.js","../../../../node_modules/react-motion/lib/stripStyle.js","../../../../node_modules/react-motion/lib/stepper.js","../../../../node_modules/react-motion/node_modules/performance-now/lib/performance-now.js","../../../../node_modules/performance-now/lib/performance-now.js","../../../../node_modules/raf/index.js","../../../../node_modules/react-motion/lib/shouldStopAnimation.js","../../../../node_modules/react-motion/lib/Motion.js","../../../../node_modules/react-motion/lib/StaggeredMotion.js","../../../../node_modules/react-motion/lib/mergeDiff.js","../../../../node_modules/react-motion/lib/TransitionMotion.js","../../../../node_modules/react-motion/lib/presets.js","../../../../node_modules/react-motion/lib/spring.js","../../../../node_modules/react-motion/lib/reorderKeys.js","../../../../node_modules/react-motion/lib/react-motion.js","../../../../node_modules/react-layout-effect/dist/esm/useLayoutEffect.js","../../../../node_modules/@react-spring/shared/esm/FrameLoop.js","../../../../node_modules/@react-spring/shared/esm/helpers.js","../../../../node_modules/@react-spring/shared/esm/globals.js","../../../../node_modules/@react-spring/shared/esm/hooks.js","../../../../node_modules/@react-spring/shared/esm/createInterpolator.js","../../../../node_modules/fluids/dist/esm/index.js","../../../../node_modules/@react-spring/animated/index.js","../../../../node_modules/use-memo-one/dist/use-memo-one.esm.js","../../../../node_modules/@react-spring/shared/esm/deprecations.js","../../../../node_modules/@react-spring/shared/node_modules/tslib/tslib.es6.js","../../../../node_modules/@react-spring/shared/esm/colorMatchers.js","../../../../node_modules/@react-spring/shared/esm/normalizeColor.js","../../../../node_modules/@react-spring/shared/esm/colorToRgba.js","../../../../node_modules/@react-spring/shared/esm/stringInterpolation.js","../../../../node_modules/@react-spring/core/index.js","../../../../node_modules/@react-spring/shared/esm/colors.js","../../../../node_modules/@react-spring/web/index.js","../../../../node_modules/@nivo/tooltip/dist/nivo-tooltip.es.js","../../../../node_modules/lodash/_listCacheClear.js","../../../../node_modules/lodash/eq.js","../../../../node_modules/lodash/_assocIndexOf.js","../../../../node_modules/lodash/_listCacheDelete.js","../../../../node_modules/lodash/_listCacheGet.js","../../../../node_modules/lodash/_listCacheHas.js","../../../../node_modules/lodash/_listCacheSet.js","../../../../node_modules/lodash/_ListCache.js","../../../../node_modules/lodash/_stackClear.js","../../../../node_modules/lodash/_stackDelete.js","../../../../node_modules/lodash/_stackGet.js","../../../../node_modules/lodash/_stackHas.js","../../../../node_modules/lodash/_freeGlobal.js","../../../../node_modules/lodash/_root.js","../../../../node_modules/lodash/_Symbol.js","../../../../node_modules/lodash/_getRawTag.js","../../../../node_modules/lodash/_objectToString.js","../../../../node_modules/lodash/_baseGetTag.js","../../../../node_modules/lodash/isObject.js","../../../../node_modules/lodash/isFunction.js","../../../../node_modules/lodash/_coreJsData.js","../../../../node_modules/lodash/_isMasked.js","../../../../node_modules/lodash/_toSource.js","../../../../node_modules/lodash/_baseIsNative.js","../../../../node_modules/lodash/_getValue.js","../../../../node_modules/lodash/_getNative.js","../../../../node_modules/lodash/_Map.js","../../../../node_modules/lodash/_nativeCreate.js","../../../../node_modules/lodash/_hashClear.js","../../../../node_modules/lodash/_hashDelete.js","../../../../node_modules/lodash/_hashGet.js","../../../../node_modules/lodash/_hashHas.js","../../../../node_modules/lodash/_hashSet.js","../../../../node_modules/lodash/_Hash.js","../../../../node_modules/lodash/_mapCacheClear.js","../../../../node_modules/lodash/_isKeyable.js","../../../../node_modules/lodash/_getMapData.js","../../../../node_modules/lodash/_mapCacheDelete.js","../../../../node_modules/lodash/_mapCacheGet.js","../../../../node_modules/lodash/_mapCacheHas.js","../../../../node_modules/lodash/_mapCacheSet.js","../../../../node_modules/lodash/_MapCache.js","../../../../node_modules/lodash/_stackSet.js","../../../../node_modules/lodash/_Stack.js","../../../../node_modules/lodash/_defineProperty.js","../../../../node_modules/lodash/_baseAssignValue.js","../../../../node_modules/lodash/_assignMergeValue.js","../../../../node_modules/lodash/_createBaseFor.js","../../../../node_modules/lodash/_baseFor.js","../../../../node_modules/lodash/_cloneBuffer.js","../../../../node_modules/lodash/_Uint8Array.js","../../../../node_modules/lodash/_cloneArrayBuffer.js","../../../../node_modules/lodash/_cloneTypedArray.js","../../../../node_modules/lodash/_copyArray.js","../../../../node_modules/lodash/_baseCreate.js","../../../../node_modules/lodash/_overArg.js","../../../../node_modules/lodash/_getPrototype.js","../../../../node_modules/lodash/_isPrototype.js","../../../../node_modules/lodash/_initCloneObject.js","../../../../node_modules/lodash/isObjectLike.js","../../../../node_modules/lodash/_baseIsArguments.js","../../../../node_modules/lodash/isArguments.js","../../../../node_modules/lodash/isArray.js","../../../../node_modules/lodash/isLength.js","../../../../node_modules/lodash/isArrayLike.js","../../../../node_modules/lodash/isArrayLikeObject.js","../../../../node_modules/lodash/stubFalse.js","../../../../node_modules/lodash/isBuffer.js","../../../../node_modules/lodash/isPlainObject.js","../../../../node_modules/lodash/_baseIsTypedArray.js","../../../../node_modules/lodash/_baseUnary.js","../../../../node_modules/lodash/_nodeUtil.js","../../../../node_modules/lodash/isTypedArray.js","../../../../node_modules/lodash/_safeGet.js","../../../../node_modules/lodash/_assignValue.js","../../../../node_modules/lodash/_copyObject.js","../../../../node_modules/lodash/_baseTimes.js","../../../../node_modules/lodash/_isIndex.js","../../../../node_modules/lodash/_arrayLikeKeys.js","../../../../node_modules/lodash/_nativeKeysIn.js","../../../../node_modules/lodash/_baseKeysIn.js","../../../../node_modules/lodash/keysIn.js","../../../../node_modules/lodash/toPlainObject.js","../../../../node_modules/lodash/_baseMergeDeep.js","../../../../node_modules/lodash/_baseMerge.js","../../../../node_modules/lodash/identity.js","../../../../node_modules/lodash/_apply.js","../../../../node_modules/lodash/_overRest.js","../../../../node_modules/lodash/constant.js","../../../../node_modules/lodash/_baseSetToString.js","../../../../node_modules/lodash/_shortOut.js","../../../../node_modules/lodash/_setToString.js","../../../../node_modules/lodash/_baseRest.js","../../../../node_modules/lodash/_isIterateeCall.js","../../../../node_modules/lodash/_createAssigner.js","../../../../node_modules/lodash/merge.js","../../../../node_modules/lodash/isSymbol.js","../../../../node_modules/lodash/_isKey.js","../../../../node_modules/lodash/memoize.js","../../../../node_modules/lodash/_memoizeCapped.js","../../../../node_modules/lodash/_stringToPath.js","../../../../node_modules/lodash/_arrayMap.js","../../../../node_modules/lodash/_baseToString.js","../../../../node_modules/lodash/toString.js","../../../../node_modules/lodash/_castPath.js","../../../../node_modules/lodash/_toKey.js","../../../../node_modules/lodash/_baseGet.js","../../../../node_modules/lodash/get.js","../../../../node_modules/lodash/_baseSet.js","../../../../node_modules/lodash/set.js","../../../../node_modules/d3-color/src/define.js","../../../../node_modules/d3-color/src/color.js","../../../../node_modules/d3-color/src/math.js","../../../../node_modules/d3-color/src/cubehelix.js","../../../../node_modules/d3-interpolate/src/basis.js","../../../../node_modules/d3-interpolate/src/constant.js","../../../../node_modules/d3-interpolate/src/color.js","../../../../node_modules/d3-interpolate/src/rgb.js","../../../../node_modules/d3-interpolate/src/numberArray.js","../../../../node_modules/d3-interpolate/src/array.js","../../../../node_modules/d3-interpolate/src/date.js","../../../../node_modules/d3-interpolate/src/number.js","../../../../node_modules/d3-interpolate/src/object.js","../../../../node_modules/d3-interpolate/src/string.js","../../../../node_modules/d3-interpolate/src/value.js","../../../../node_modules/d3-interpolate/src/round.js","../../../../node_modules/d3-interpolate/src/cubehelix.js","../../../../node_modules/lodash/isString.js","../../../../node_modules/lodash/last.js","../../../../node_modules/d3-array/src/ascending.js","../../../../node_modules/d3-array/src/bisector.js","../../../../node_modules/d3-array/src/number.js","../../../../node_modules/d3-array/src/bisect.js","../../../../node_modules/d3-array/src/ticks.js","../../../../node_modules/d3-array/src/range.js","../../../../node_modules/d3-scale/src/init.js","../../../../node_modules/d3-scale/src/ordinal.js","../../../../node_modules/d3-scale/src/band.js","../../../../node_modules/d3-scale/src/constant.js","../../../../node_modules/d3-scale/src/number.js","../../../../node_modules/d3-scale/src/continuous.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/formatDecimal.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/exponent.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/formatGroup.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/formatNumerals.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/formatSpecifier.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/formatTrim.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/formatPrefixAuto.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/formatRounded.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/formatTypes.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/identity.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/locale.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/defaultLocale.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/precisionFixed.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/precisionPrefix.js","../../../../node_modules/d3-scale/node_modules/d3-format/src/precisionRound.js","../../../../node_modules/d3-scale/src/tickFormat.js","../../../../node_modules/d3-scale/src/linear.js","../../../../node_modules/d3-scale/src/nice.js","../../../../node_modules/d3-scale/src/log.js","../../../../node_modules/d3-scale/src/symlog.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/interval.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/millisecond.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/duration.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/second.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/minute.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/hour.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/day.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/week.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/month.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/year.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/utcMinute.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/utcHour.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/utcDay.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/utcWeek.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/utcMonth.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/utcYear.js","../../../../node_modules/d3-scale/node_modules/d3-time/src/ticks.js","../../../../node_modules/d3-scale/node_modules/d3-time-format/src/locale.js","../../../../node_modules/d3-scale/node_modules/d3-time-format/src/defaultLocale.js","../../../../node_modules/d3-scale/src/time.js","../../../../node_modules/d3-scale/src/utcTime.js","../../../../node_modules/d3-scale-chromatic/src/colors.js","../../../../node_modules/d3-scale-chromatic/src/categorical/category10.js","../../../../node_modules/d3-scale-chromatic/src/categorical/Accent.js","../../../../node_modules/d3-scale-chromatic/src/categorical/Dark2.js","../../../../node_modules/d3-scale-chromatic/src/categorical/Paired.js","../../../../node_modules/d3-scale-chromatic/src/categorical/Pastel1.js","../../../../node_modules/d3-scale-chromatic/src/categorical/Pastel2.js","../../../../node_modules/d3-scale-chromatic/src/categorical/Set1.js","../../../../node_modules/d3-scale-chromatic/src/categorical/Set2.js","../../../../node_modules/d3-scale-chromatic/src/categorical/Set3.js","../../../../node_modules/d3-scale-chromatic/src/ramp.js","../../../../node_modules/d3-scale-chromatic/src/diverging/BrBG.js","../../../../node_modules/d3-scale-chromatic/src/diverging/PRGn.js","../../../../node_modules/d3-scale-chromatic/src/diverging/PiYG.js","../../../../node_modules/d3-scale-chromatic/src/diverging/PuOr.js","../../../../node_modules/d3-scale-chromatic/src/diverging/RdBu.js","../../../../node_modules/d3-scale-chromatic/src/diverging/RdGy.js","../../../../node_modules/d3-scale-chromatic/src/diverging/RdYlBu.js","../../../../node_modules/d3-scale-chromatic/src/diverging/RdYlGn.js","../../../../node_modules/d3-scale-chromatic/src/diverging/Spectral.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/BuGn.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/BuPu.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/GnBu.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/OrRd.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/PuBuGn.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/PuBu.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/PuRd.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/RdPu.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/YlGnBu.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/YlGn.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/YlOrBr.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/YlOrRd.js","../../../../node_modules/d3-scale-chromatic/src/sequential-single/Blues.js","../../../../node_modules/d3-scale-chromatic/src/sequential-single/Greens.js","../../../../node_modules/d3-scale-chromatic/src/sequential-single/Greys.js","../../../../node_modules/d3-scale-chromatic/src/sequential-single/Purples.js","../../../../node_modules/d3-scale-chromatic/src/sequential-single/Reds.js","../../../../node_modules/d3-scale-chromatic/src/sequential-single/Oranges.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/cividis.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/cubehelix.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/rainbow.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/sinebow.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/turbo.js","../../../../node_modules/d3-scale-chromatic/src/sequential-multi/viridis.js","../../../../node_modules/lodash/_setCacheAdd.js","../../../../node_modules/lodash/_setCacheHas.js","../../../../node_modules/lodash/_SetCache.js","../../../../node_modules/lodash/_baseFindIndex.js","../../../../node_modules/lodash/_baseIsNaN.js","../../../../node_modules/lodash/_strictIndexOf.js","../../../../node_modules/lodash/_baseIndexOf.js","../../../../node_modules/lodash/_arrayIncludes.js","../../../../node_modules/lodash/_arrayIncludesWith.js","../../../../node_modules/lodash/_cacheHas.js","../../../../node_modules/lodash/_baseDifference.js","../../../../node_modules/lodash/without.js","../../../../node_modules/d3-shape/src/constant.js","../../../../node_modules/d3-shape/src/math.js","../../../../node_modules/d3-shape/src/curve/linear.js","../../../../node_modules/d3-shape/src/array.js","../../../../node_modules/d3-shape/src/noop.js","../../../../node_modules/d3-shape/src/curve/basis.js","../../../../node_modules/d3-shape/src/curve/basisClosed.js","../../../../node_modules/d3-shape/src/curve/basisOpen.js","../../../../node_modules/d3-shape/src/curve/bundle.js","../../../../node_modules/d3-shape/src/curve/cardinal.js","../../../../node_modules/d3-shape/src/curve/cardinalClosed.js","../../../../node_modules/d3-shape/src/curve/cardinalOpen.js","../../../../node_modules/d3-shape/src/curve/catmullRom.js","../../../../node_modules/d3-shape/src/curve/catmullRomClosed.js","../../../../node_modules/d3-shape/src/curve/catmullRomOpen.js","../../../../node_modules/d3-shape/src/curve/linearClosed.js","../../../../node_modules/d3-shape/src/curve/monotone.js","../../../../node_modules/d3-shape/src/curve/natural.js","../../../../node_modules/d3-shape/src/curve/step.js","../../../../node_modules/d3-shape/src/offset/none.js","../../../../node_modules/d3-shape/src/order/none.js","../../../../node_modules/d3-shape/src/stack.js","../../../../node_modules/d3-shape/src/offset/expand.js","../../../../node_modules/d3-shape/src/offset/diverging.js","../../../../node_modules/d3-shape/src/offset/silhouette.js","../../../../node_modules/d3-shape/src/offset/wiggle.js","../../../../node_modules/d3-shape/src/order/appearance.js","../../../../node_modules/d3-shape/src/order/ascending.js","../../../../node_modules/d3-shape/src/order/descending.js","../../../../node_modules/d3-shape/src/order/insideOut.js","../../../../node_modules/d3-shape/src/order/reverse.js","../../../../node_modules/d3-hierarchy/src/treemap/dice.js","../../../../node_modules/d3-hierarchy/src/treemap/slice.js","../../../../node_modules/d3-hierarchy/src/treemap/squarify.js","../../../../node_modules/d3-hierarchy/src/treemap/binary.js","../../../../node_modules/d3-hierarchy/src/treemap/sliceDice.js","../../../../node_modules/d3-hierarchy/src/treemap/resquarify.js","../../../../node_modules/d3-format/src/formatDecimal.js","../../../../node_modules/d3-format/src/exponent.js","../../../../node_modules/d3-format/src/formatGroup.js","../../../../node_modules/d3-format/src/formatNumerals.js","../../../../node_modules/d3-format/src/formatSpecifier.js","../../../../node_modules/d3-format/src/formatTrim.js","../../../../node_modules/d3-format/src/formatPrefixAuto.js","../../../../node_modules/d3-format/src/formatRounded.js","../../../../node_modules/d3-format/src/formatTypes.js","../../../../node_modules/d3-format/src/identity.js","../../../../node_modules/d3-format/src/locale.js","../../../../node_modules/d3-format/src/defaultLocale.js","../../../../node_modules/d3-time/src/interval.js","../../../../node_modules/d3-time/src/millisecond.js","../../../../node_modules/d3-time/src/duration.js","../../../../node_modules/d3-time/src/second.js","../../../../node_modules/d3-time/src/minute.js","../../../../node_modules/d3-time/src/hour.js","../../../../node_modules/d3-time/src/day.js","../../../../node_modules/d3-time/src/week.js","../../../../node_modules/d3-time/src/month.js","../../../../node_modules/d3-time/src/year.js","../../../../node_modules/d3-time/src/utcMinute.js","../../../../node_modules/d3-time/src/utcHour.js","../../../../node_modules/d3-time/src/utcDay.js","../../../../node_modules/d3-time/src/utcWeek.js","../../../../node_modules/d3-time/src/utcMonth.js","../../../../node_modules/d3-time/src/utcYear.js","../../../../node_modules/d3-time-format/src/locale.js","../../../../node_modules/d3-time-format/src/defaultLocale.js","../../../../node_modules/recompose/getDisplayName.js","../../../../node_modules/recompose/wrapDisplayName.js","../../../../node_modules/recompose/setStatic.js","../../../../node_modules/recompose/setDisplayName.js","../../../../node_modules/recompose/mapProps.js","../../../../node_modules/recompose/withProps.js","../../../../node_modules/lodash/_arraySome.js","../../../../node_modules/lodash/_equalArrays.js","../../../../node_modules/lodash/_mapToArray.js","../../../../node_modules/lodash/_setToArray.js","../../../../node_modules/lodash/_equalByTag.js","../../../../node_modules/lodash/_arrayPush.js","../../../../node_modules/lodash/_baseGetAllKeys.js","../../../../node_modules/lodash/_arrayFilter.js","../../../../node_modules/lodash/stubArray.js","../../../../node_modules/lodash/_getSymbols.js","../../../../node_modules/lodash/_nativeKeys.js","../../../../node_modules/lodash/_baseKeys.js","../../../../node_modules/lodash/keys.js","../../../../node_modules/lodash/_getAllKeys.js","../../../../node_modules/lodash/_equalObjects.js","../../../../node_modules/lodash/_DataView.js","../../../../node_modules/lodash/_Promise.js","../../../../node_modules/lodash/_Set.js","../../../../node_modules/lodash/_WeakMap.js","../../../../node_modules/lodash/_getTag.js","../../../../node_modules/lodash/_baseIsEqualDeep.js","../../../../node_modules/lodash/_baseIsEqual.js","../../../../node_modules/lodash/isEqual.js","../../../../node_modules/recompose/compose.js","../../../../node_modules/recompose/setPropTypes.js","../../../../node_modules/recompose/defaultProps.js","../../../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../../../node_modules/@babel/runtime/helpers/inheritsLoose.js","../../../../node_modules/recompose/utils/pick.js","../../../../node_modules/fbjs/lib/shallowEqual.js","../../../../node_modules/recompose/shallowEqual.js","../../../../node_modules/recompose/withPropsOnChange.js","../../../../node_modules/lodash/_basePickBy.js","../../../../node_modules/lodash/_baseHasIn.js","../../../../node_modules/lodash/_hasPath.js","../../../../node_modules/lodash/hasIn.js","../../../../node_modules/lodash/_basePick.js","../../../../node_modules/lodash/_isFlattenable.js","../../../../node_modules/lodash/_baseFlatten.js","../../../../node_modules/lodash/flatten.js","../../../../node_modules/lodash/_flatRest.js","../../../../node_modules/lodash/pick.js","../../../../node_modules/@nivo/core/dist/nivo-core.es.js","../../../../node_modules/@nivo/axes/dist/nivo-axes.es.js","../../../../node_modules/lodash/isNumber.js","../../../../node_modules/@nivo/legends/dist/nivo-legends.es.js","../../../../node_modules/lodash/noop.js","../../../../node_modules/lodash/_createSet.js","../../../../node_modules/lodash/_baseUniq.js","../../../../node_modules/lodash/_baseIsMatch.js","../../../../node_modules/lodash/_isStrictComparable.js","../../../../node_modules/lodash/_getMatchData.js","../../../../node_modules/lodash/_matchesStrictComparable.js","../../../../node_modules/lodash/_baseMatches.js","../../../../node_modules/lodash/_baseMatchesProperty.js","../../../../node_modules/lodash/_baseProperty.js","../../../../node_modules/lodash/_basePropertyDeep.js","../../../../node_modules/lodash/property.js","../../../../node_modules/lodash/_baseIteratee.js","../../../../node_modules/lodash/uniqBy.js","../../../../node_modules/lodash/_baseForOwn.js","../../../../node_modules/lodash/_createBaseEach.js","../../../../node_modules/lodash/_baseEach.js","../../../../node_modules/lodash/_baseMap.js","../../../../node_modules/lodash/_baseSortBy.js","../../../../node_modules/lodash/_compareAscending.js","../../../../node_modules/lodash/_compareMultiple.js","../../../../node_modules/lodash/_baseOrderBy.js","../../../../node_modules/lodash/sortBy.js","../../../../node_modules/lodash/isDate.js","../../../../node_modules/@nivo/scales/dist/nivo-scales.es.js","../../../../node_modules/change-emitter/lib/index.js","../../../../node_modules/symbol-observable/es/ponyfill.js","../../../../node_modules/symbol-observable/es/index.js","../../../../node_modules/recompose/dist/Recompose.esm.js","../../../../node_modules/recompose/shouldUpdate.js","../../../../node_modules/recompose/pure.js","../../../../node_modules/@nivo/colors/dist/nivo-colors.es.js","../../../../node_modules/lodash/_baseFilter.js","../../../../node_modules/lodash/filter.js","../../../../node_modules/lodash/_arrayEach.js","../../../../node_modules/lodash/_baseAssign.js","../../../../node_modules/lodash/_baseAssignIn.js","../../../../node_modules/lodash/_copySymbols.js","../../../../node_modules/lodash/_getSymbolsIn.js","../../../../node_modules/lodash/_copySymbolsIn.js","../../../../node_modules/lodash/_getAllKeysIn.js","../../../../node_modules/lodash/_initCloneArray.js","../../../../node_modules/lodash/_cloneDataView.js","../../../../node_modules/lodash/_cloneRegExp.js","../../../../node_modules/lodash/_cloneSymbol.js","../../../../node_modules/lodash/_initCloneByTag.js","../../../../node_modules/lodash/_baseIsMap.js","../../../../node_modules/lodash/isMap.js","../../../../node_modules/lodash/_baseIsSet.js","../../../../node_modules/lodash/isSet.js","../../../../node_modules/lodash/_baseClone.js","../../../../node_modules/lodash/_baseSlice.js","../../../../node_modules/lodash/_parent.js","../../../../node_modules/lodash/_baseUnset.js","../../../../node_modules/lodash/_customOmitClone.js","../../../../node_modules/lodash/omit.js","../../../../node_modules/@nivo/annotations/dist/nivo-annotations.es.js","../../../../node_modules/@nivo/bar/dist/nivo-bar.es.js","../../../../libs/features/dashboard/components/src/lib/metrics-report/bar-and-tick.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report/average-time-chart.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report/average-time-list.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report/averages-summary.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report/metrics-header.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report/averages-wrapper.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report/simple-metrics-list.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report/metrics-report.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report/metrics-dashboard.component.tsx","../../../../libs/features/dashboard/components/src/lib/admin-statistics-summary/admin-statistics-summary-table.component.tsx","../../../../libs/features/dashboard/components/src/lib/admin-statistics-summary/admin-statistics-summary-dashboard.component.tsx","../../../../libs/features/dashboard/components/src/lib/metrics-report-filter.component.tsx","../../../../libs/features/dashboard/feature/src/lib/report.feature.tsx","../../../../libs/features/dashboard/feature/src/lib/dashboard.feature.tsx","../../../../libs/features/dashboard/feature/src/lib/dashboard-researcher-feature.tsx","../../../../libs/features/dashboard/infrastructure/wrappers/src/lib/dashboard-feature-route.wrapper.tsx","../../../../libs/features/listing-request/infrastructure/service/src/lib/listing-request-api.service.ts","../../../../libs/features/listing-request/infrastructure/wrappers/src/lib/listing-request-service-context.wrapper.tsx","../../../../libs/features/listing-request/infrastructure/wrappers/src/lib/listing-request-context.wrapper.tsx","../../../../libs/features/admin-console/infrastructure/wrappers/src/lib/admin-console-service-context.wrapper.tsx","../../../../libs/features/admin-console/infrastructure/wrappers/src/lib/admin-console-context.wrapper.tsx","../../../../libs/features/admin-console/infrastructure/wrappers/src/lib/admin-console-lookupID-context.wrapper.tsx","../../../../libs/features/enquiry/infastructure/context/src/lib/enquiry-service.context.tsx","../../../../libs/features/enquiry/infastructure/context/src/lib/enquiry.context.tsx","../../../../libs/features/enquiry/infastructure/service/src/lib/enquiry-api.service.tsx","../../../../libs/features/enquiry/infastructure/wrappers/src/lib/enquiry-service-context.wrapper.tsx","../../../../libs/features/enquiry/infastructure/hook/src/lib/use-enquiry-form.hook.ts","../../../../libs/features/enquiry/infastructure/hook/src/lib/use-enquiry-list.hook.ts","../../../../libs/features/enquiry/infastructure/enum/src/lib/dir-status.enum.ts","../../../../libs/features/enquiry/infastructure/enum/src/lib/enquires-tab.enum.ts","../../../../libs/features/enquiry/infastructure/enum/src/lib/enquiry-status.enum.ts","../../../../libs/features/enquiry/infastructure/enum/src/lib/dir-data-type.enum.ts","../../../../libs/features/enquiry/infastructure/enum/src/lib/dir-study-not-available.response.enum.ts","../../../../libs/features/enquiry/infastructure/wrappers/src/lib/enquiry-context.wrapper.tsx","../../../../libs/core/wrapper/src/lib/services.wrapper.tsx","../../../../libs/shared/infrastructure/wrappers/src/lib/integration-context.wrapper.tsx","../../../../libs/shared/infrastructure/wrappers/src/lib/modal-context.wrapper.tsx","../../../../node_modules/clsx/dist/clsx.m.js","../../../../node_modules/react-toastify/dist/react-toastify.esm.js","../../../../libs/shared/infrastructure/wrappers/src/lib/toast-context.wrapper.tsx","../../../../libs/core/wrapper/src/lib/modules.wrapper.tsx","../../../../libs/core/wrapper/src/lib/auth-events.wrapper.tsx","../../../../libs/core/wrapper/src/lib/accept-invite-popup.wrapper.tsx","../../../../libs/core/wrapper/src/lib/login-expiration.wrapper.tsx","../../../../libs/core/wrapper/src/lib/global-styles.wrapper.tsx","../../../../libs/core/wrapper/src/lib/initialization.wrapper.tsx","../../../../libs/core/wrapper/src/lib/vm-app-routes.wrapper.tsx","../../../../libs/features/data-requests/feature/src/lib/data-requests.feature.tsx","../../../../libs/features/data-requests/feature/src/lib/data-request.feature.tsx","../../../../libs/features/data-requests/feature/src/lib/my-data-requests.feature.tsx","../../../../libs/features/data-requests/feature/src/lib/amr-data-request.feature.tsx","../../../../libs/features/data-requests/feature/src/lib/data-request-draft.feature.tsx","../../../../libs/features/datasets/infrastructure/wrappers/src/lib/dataset-context.wrapper.tsx","../../../../libs/features/datasets/feature/src/lib/dataset.feature.tsx","../../../../libs/features/search/feature/src/lib/search.feature.tsx","../../../../libs/features/portal/infrastructure/hook/src/lib/use-user-route-mapper.hook.ts","../../../../libs/features/portal/components/src/lib/nav-panel.component.tsx","../../../../libs/features/portal/components/src/lib/nav-tabs.component.tsx","../../../../libs/features/organizations/feature/src/lib/organizations.feature.tsx","../../../../libs/features/organizations/feature/src/lib/organization-details.feature.tsx","../../../../libs/features/users/components/src/lib/member-row-renderer.component.tsx","../../../../libs/features/users/components/src/lib/confirm-button.component.tsx","../../../../libs/features/users/components/src/lib/user-grid-page.component.tsx","../../../../libs/features/users/feature/src/lib/users.feature.tsx","../../../../libs/features/users/feature/src/lib/org-memberships-grid.component.tsx","../../../../libs/features/users/feature/src/lib/associated-data-requests-grid.component.tsx","../../../../libs/features/users/feature/src/lib/user-details.component.tsx","../../../../libs/features/users/feature/src/lib/user-details.feature.tsx","../../../../libs/features/virtual-machine/feature/src/lib/manage-vms.feature.tsx","../../../../node_modules/guacamole-common-js/dist/esm/guacamole-common.js","../../../../libs/features/virtual-machine/feature/src/lib/virtual-machine-portal.feature.tsx","../../../../libs/features/listing-request/feature/src/lib/listing-request.feature.tsx","../../../../libs/features/listing-request/feature/src/lib/listing-requests.feature.tsx","../../../../libs/features/admin-console/feature/src/lib/admin-console-requests.feature.tsx","../../../../libs/features/enquiry/components/src/lib/enquiry-header.component.tsx","../../../../libs/features/enquiry/components/src/lib/enquiry-main-container.component.tsx","../../../../libs/features/enquiry/components/src/lib/enquiry-discussion-grid.component.tsx","../../../../libs/features/enquiry/infastructure/constants/src/lib/dir-enquiry-dropdowns.constant.ts","../../../../libs/features/enquiry/components/src/lib/response-hint.tsx","../../../../libs/features/enquiry/components/src/lib/reason-hint.tsx","../../../../libs/features/enquiry/components/src/lib/enquiry-data-info-request.component.tsx","../../../../libs/features/enquiry/components/src/lib/enquiry-data-info-requests.component.tsx","../../../../libs/features/enquiry/components/src/lib/enquiry.component.tsx","../../../../libs/features/enquiry/components/src/lib/enquires-grid.component.tsx","../../../../libs/features/enquiry/components/src/lib/enquiry-landing-view.component.tsx","../../../../libs/features/enquiry/components/src/lib/enquiry-portal.component.tsx","../../../../libs/features/enquiry/feature/src/lib/enquiry.feature.tsx","../../../../libs/features/enquiry/feature/src/lib/enquires.feature.tsx","../../../../libs/features/portal/components/src/lib/portal-routes.component.tsx","../../../../libs/features/portal/feature/src/lib/portal.feature.tsx","../../../../libs/core/wrapper/src/lib/app-routes/protected.route.tsx","../../../../libs/core/wrapper/src/lib/app-routes/app-routes.wrapper.tsx","../../../../node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/__DynamicConstants.js","../../../../node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js","../../../../node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js","../../../../node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js","../../../../node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/Timing.js","../../../../node_modules/@microsoft/applicationinsights-analytics-js/dist-esm/JavaScriptSDK/AnalyticsPlugin.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/InternalConstants.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/__DynamicConstants.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/EnvelopeCreator.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Offline.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/SendBuffer.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Serializer.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/TelemetryProcessors/Sample.js","../../../../node_modules/@microsoft/applicationinsights-channel-js/dist-esm/Sender.js","../../../../node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/InternalConstants.js","../../../../node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/__DynamicConstants.js","../../../../node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/ajaxRecord.js","../../../../node_modules/@microsoft/applicationinsights-dependencies-js/dist-esm/ajax.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Application.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Device.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/__DynamicConstants.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Internal.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Location.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/Session.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/TelemetryTrace.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/Context/User.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/TelemetryContext.js","../../../../node_modules/@microsoft/applicationinsights-properties-js/dist-esm/PropertiesPlugin.js","../../../../node_modules/@microsoft/applicationinsights-web/dist-esm/InternalConstants.js","../../../../node_modules/@microsoft/applicationinsights-web/dist-esm/__DynamicConstants.js","../../../../node_modules/@microsoft/applicationinsights-web/dist-esm/Initialization.js","../../../../node_modules/history/index.js","../../../../libs/core/wrapper/src/lib/error-boundary.wrapper.tsx","../../../../apps/vivli-webapp/src/app/app-result-request.module.tsx","../../../../apps/vivli-webapp/src/app/app-default.module.tsx","../../../../apps/vivli-webapp/src/app/app-init.component.tsx","../../../../libs/core/layout/src/lib/footer.component.tsx","../../../../libs/core/layout/src/lib/external-link-menu/link-menu.component.tsx","../../../../libs/core/layout/src/lib/external-link-menu/external-link-menu.component.tsx","../../../../libs/core/layout/src/lib/hooks/use-user-menu-routes.hook.ts","../../../../libs/core/layout/src/lib/internal-link-menu/active-user-menu.component.tsx","../../../../libs/core/layout/src/lib/internal-link-menu/signup-login-button.component.tsx","../../../../libs/core/layout/src/lib/internal-link-menu/quick-study-lookup-button.component.tsx","../../../../libs/core/layout/src/lib/internal-link-menu/internal-link-menu-styles.ts","../../../../libs/core/layout/src/lib/internal-link-menu/my-data-requests-button.component.tsx","../../../../libs/core/layout/src/lib/internal-link-menu/enquiry-link.component.tsx","../../../../libs/core/layout/src/lib/internal-link-menu/sub-header.component.tsx","../../../../libs/core/layout/src/lib/internal-link-menu/internal-link-menu.component.tsx","../../../../libs/core/layout/src/lib/environment-banner.component.tsx","../../../../libs/core/layout/src/lib/logo.component.tsx","../../../../libs/core/layout/src/lib/portal-title.component.tsx","../../../../libs/core/layout/src/lib/header.component.tsx","../../../../libs/core/layout/src/lib/layout.wrapper.tsx","../../../../apps/vivli-webapp/src/app/app.tsx","../../../../apps/vivli-webapp/src/main.tsx"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"\";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,\nzoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a]})});function rb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(\"\"+b).trim():b+\"px\"}\nfunction sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=rb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if(\"object\"!==typeof b.dangerouslySetInnerHTML||!(\"__html\"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(p(62));}}\nfunction vb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;\nfunction tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)))}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}\nfunction Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Je(c)}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nfunction Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),\"selectionStart\"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c,\nd);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});\"function\"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H)}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c)}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||\"Unknown\",e));return A({},c,d)}\nfunction cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return!0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c)}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a)}function ig(a){fg=!0;hg(a)}\nfunction jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x}if(n.done)return c(e,\nm),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k=\nf.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===Ha&&uh(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=sh(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ya?(d=Ah(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=yh(f.type,f.key,f.props,null,a.mode,h),h.ref=sh(a,d,f),h.return=a,a=h)}return g(a);case wa:a:{for(l=f.key;null!==\nd;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=zh(f,a.mode,h);d.return=a;a=d}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);th(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):\n(c(a,d),d=xh(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Bh=vh(!0),Ch=vh(!1),Dh={},Eh=Uf(Dh),Fh=Uf(Dh),Gh=Uf(Dh);function Hh(a){if(a===Dh)throw Error(p(174));return a}function Ih(a,b){G(Gh,b);G(Fh,a);G(Eh,Dh);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:lb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=lb(b,a)}E(Eh);G(Eh,b)}function Jh(){E(Eh);E(Fh);E(Gh)}\nfunction Kh(a){Hh(Gh.current);var b=Hh(Eh.current);var c=lb(b,a.type);b!==c&&(G(Fh,a),G(Eh,c))}function Lh(a){Fh.current===a&&(E(Eh),E(Fh))}var M=Uf(0);\nfunction Mh(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&128))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var Nh=[];\nfunction Oh(){for(var a=0;ac?c:4;a(!0);var d=Qh.transition;Qh.transition={};try{a(!1),b()}finally{C=c,Qh.transition=d}}function Fi(){return di().memoizedState}\nfunction Gi(a,b,c){var d=lh(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(b,c);else if(c=Yg(a,b,c,d),null!==c){var e=L();mh(c,a,d,e);Ji(c,b,d)}}\nfunction ri(a,b,c){var d=lh(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,Xg(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=Yg(a,b,e,d);null!==c&&(e=L(),mh(c,a,d,e),Ji(c,b,d))}}\nfunction Hi(a){var b=a.alternate;return a===N||null!==b&&b===N}function Ii(a,b){Th=Sh=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function Ji(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nvar ai={readContext:Vg,useCallback:Q,useContext:Q,useEffect:Q,useImperativeHandle:Q,useInsertionEffect:Q,useLayoutEffect:Q,useMemo:Q,useReducer:Q,useRef:Q,useState:Q,useDebugValue:Q,useDeferredValue:Q,useTransition:Q,useMutableSource:Q,useSyncExternalStore:Q,useId:Q,unstable_isNewReconciler:!1},Yh={readContext:Vg,useCallback:function(a,b){ci().memoizedState=[a,void 0===b?null:b];return a},useContext:Vg,useEffect:vi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ti(4194308,\n4,yi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ti(4194308,4,a,b)},useInsertionEffect:function(a,b){return ti(4,2,a,b)},useMemo:function(a,b){var c=ci();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=ci();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=Gi.bind(null,N,a);return[d.memoizedState,a]},useRef:function(a){var b=\nci();a={current:a};return b.memoizedState=a},useState:qi,useDebugValue:Ai,useDeferredValue:function(a){return ci().memoizedState=a},useTransition:function(){var a=qi(!1),b=a[0];a=Ei.bind(null,a[1]);ci().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=N,e=ci();if(I){if(void 0===c)throw Error(p(407));c=c()}else{c=b();if(null===R)throw Error(p(349));0!==(Rh&30)||ni(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;vi(ki.bind(null,d,\nf,a),[a]);d.flags|=2048;li(9,mi.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=ci(),b=R.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=Uh++;0\\x3c/script>\",a=a.removeChild(a.firstChild)):\n\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;Aj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case \"dialog\":D(\"cancel\",a);D(\"close\",a);e=d;break;case \"iframe\":case \"object\":case \"embed\":D(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eHj&&(b.flags|=128,d=!0,Ej(f,!1),b.lanes=4194304)}else{if(!d)if(a=Mh(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Ej(f,!0),null===f.tail&&\"hidden\"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Hj&&1073741824!==c&&(b.flags|=128,d=!0,Ej(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=\nb,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=M.current,G(M,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Ij(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(gj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));}\nfunction Jj(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return Jh(),E(Wf),E(H),Oh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Lh(b),null;case 13:E(M);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(M),null;case 4:return Jh(),null;case 10:return Rg(b.type._context),null;case 22:case 23:return Ij(),\nnull;case 24:return null;default:return null}}var Kj=!1,U=!1,Lj=\"function\"===typeof WeakSet?WeakSet:Set,V=null;function Mj(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){W(a,b,d)}else c.current=null}function Nj(a,b,c){try{c()}catch(d){W(a,b,d)}}var Oj=!1;\nfunction Pj(a,b){Cf=dd;a=Me();if(Ne(a)){if(\"selectionStart\"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+=\nq.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode}q=y}c=-1===h||-1===k?null:{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;\ncase 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Lg(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent=\"\":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F)}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return}n=Oj;Oj=!1;return n}\nfunction Qj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Nj(b,c,f)}e=e.next}while(e!==d)}}function Rj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Sj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Tj(a){var b=a.alternate;null!==b&&(a.alternate=null,Tj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Uj(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Vj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Uj(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling}\nfunction Xj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Xj(a,b,c),a=a.sibling;null!==a;)Xj(a,b,c),a=a.sibling}var X=null,Yj=!1;function Zj(a,b,c){for(c=c.child;null!==c;)ak(a,b,c),c=c.sibling}\nfunction ak(a,b,c){if(lc&&\"function\"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c)}catch(h){}switch(c.tag){case 5:U||Mj(c,b);case 6:var d=X,e=Yj;X=null;Zj(a,b,c);X=d;Yj=e;null!==X&&(Yj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Yj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Yj;X=c.stateNode.containerInfo;Yj=!0;\nZj(a,b,c);X=d;Yj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Nj(c,b,g):0!==(f&4)&&Nj(c,b,g));e=e.next}while(e!==d)}Zj(a,b,c);break;case 1:if(!U&&(Mj(c,b),d=c.stateNode,\"function\"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){W(c,b,h)}Zj(a,b,c);break;case 21:Zj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!==\nc.memoizedState,Zj(a,b,c),U=d):Zj(a,b,c);break;default:Zj(a,b,c)}}function bk(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Lj);b.forEach(function(b){var d=ck.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction dk(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*mk(d/1960))-d;if(10a?16:a;if(null===xk)var d=!1;else{a=xk;xk=null;yk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-gk?Lk(a,0):sk|=c);Ek(a,b)}function Zk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=L();a=Zg(a,b);null!==a&&(Ac(a,b,c),Ek(a,c))}function vj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Zk(a,c)}\nfunction ck(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Zk(a,c)}var Wk;\nWk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)Ug=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return Ug=!1,zj(a,b,c);Ug=0!==(a.flags&131072)?!0:!1}else Ug=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;jj(a,b);a=b.pendingProps;var e=Yf(b,H.current);Tg(b,c);e=Xh(null,b,d,a,e,c);var f=bi();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=\nnull,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,ah(b),e.updater=nh,b.stateNode=e,e._reactInternals=b,rh(b,d,a,c),b=kj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Yi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{jj(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=$k(d);a=Lg(d,a);switch(e){case 0:b=dj(null,b,d,a,c);break a;case 1:b=ij(null,b,d,a,c);break a;case 11:b=Zi(null,b,d,a,c);break a;case 14:b=aj(null,b,d,Lg(d.type,a),c);break a}throw Error(p(306,\nd,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),dj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),ij(a,b,d,e,c);case 3:a:{lj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;bh(a,b);gh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState=\nf,b.memoizedState=f,b.flags&256){e=Ki(Error(p(423)),b);b=mj(a,b,d,c,e);break a}else if(d!==e){e=Ki(Error(p(424)),b);b=mj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Ch(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{Ig();if(d===e){b=$i(a,b,c);break a}Yi(a,b,d,c)}b=b.child}return b;case 5:return Kh(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32),\nhj(a,b),Yi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return pj(a,b,c);case 4:return Ih(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Bh(b,null,d,c):Yi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),Zi(a,b,d,e,c);case 7:return Yi(a,b,b.pendingProps,c),b.child;case 8:return Yi(a,b,b.pendingProps.children,c),b.child;case 12:return Yi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps;\ng=e.value;G(Mg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=$i(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=ch(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);Sg(f.return,\nc,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);Sg(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}Yi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,Tg(b,c),e=Vg(e),d=d(e),b.flags|=1,Yi(a,b,d,c),\nb.child;case 14:return d=b.type,e=Lg(d,b.pendingProps),e=Lg(d.type,e),aj(a,b,d,e,c);case 15:return cj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),jj(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,Tg(b,c),ph(b,d,e),rh(b,d,e,c),kj(null,b,d,!0,a,c);case 19:return yj(a,b,c);case 22:return ej(a,b,c)}throw Error(p(156,b.tag));};function Gk(a,b){return ac(a,b)}\nfunction al(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Bg(a,b,c,d){return new al(a,b,c,d)}function bj(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction $k(a){if(\"function\"===typeof a)return bj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2}\nfunction wh(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction yh(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)bj(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ya:return Ah(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return qj(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11;\nbreak a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,\"\"));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Ah(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function qj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function xh(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a}\nfunction zh(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction bl(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=\nnull}function cl(a,b,c,d,e,f,g,h,k){a=new bl(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};ah(f);return a}function dl(a,b,c){var d=3 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\n\nexport { __assign, __awaiter, __extends, __generator, __read, __rest, __spread };\n//# sourceMappingURL=_tslib.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nfunction __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\n\nexport { __assign, __awaiter, __extends, __generator, __spreadArrays };\n//# sourceMappingURL=_tslib.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __spreadArrays } from '../_virtual/_tslib.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar Constants = {\r\n LIBRARY_NAME: \"MSAL.JS\",\r\n SKU: \"msal.js.common\",\r\n // Prefix for all library cache entries\r\n CACHE_PREFIX: \"msal\",\r\n // default authority\r\n DEFAULT_AUTHORITY: \"https://login.microsoftonline.com/common/\",\r\n DEFAULT_AUTHORITY_HOST: \"login.microsoftonline.com\",\r\n DEFAULT_COMMON_TENANT: \"common\",\r\n // ADFS String\r\n ADFS: \"adfs\",\r\n DSTS: \"dstsv2\",\r\n // Default AAD Instance Discovery Endpoint\r\n AAD_INSTANCE_DISCOVERY_ENDPT: \"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=\",\r\n // CIAM URL\r\n CIAM_AUTH_URL: \".ciamlogin.com\",\r\n AAD_TENANT_DOMAIN_SUFFIX: \".onmicrosoft.com\",\r\n // Resource delimiter - used for certain cache entries\r\n RESOURCE_DELIM: \"|\",\r\n // Placeholder for non-existent account ids/objects\r\n NO_ACCOUNT: \"NO_ACCOUNT\",\r\n // Claims\r\n CLAIMS: \"claims\",\r\n // Consumer UTID\r\n CONSUMER_UTID: \"9188040d-6c67-4c5b-b112-36a304b66dad\",\r\n // Default scopes\r\n OPENID_SCOPE: \"openid\",\r\n PROFILE_SCOPE: \"profile\",\r\n OFFLINE_ACCESS_SCOPE: \"offline_access\",\r\n EMAIL_SCOPE: \"email\",\r\n // Default response type for authorization code flow\r\n CODE_RESPONSE_TYPE: \"code\",\r\n CODE_GRANT_TYPE: \"authorization_code\",\r\n RT_GRANT_TYPE: \"refresh_token\",\r\n FRAGMENT_RESPONSE_MODE: \"fragment\",\r\n S256_CODE_CHALLENGE_METHOD: \"S256\",\r\n URL_FORM_CONTENT_TYPE: \"application/x-www-form-urlencoded;charset=utf-8\",\r\n AUTHORIZATION_PENDING: \"authorization_pending\",\r\n NOT_DEFINED: \"not_defined\",\r\n EMPTY_STRING: \"\",\r\n NOT_APPLICABLE: \"N/A\",\r\n FORWARD_SLASH: \"/\",\r\n IMDS_ENDPOINT: \"http://169.254.169.254/metadata/instance/compute/location\",\r\n IMDS_VERSION: \"2020-06-01\",\r\n IMDS_TIMEOUT: 2000,\r\n AZURE_REGION_AUTO_DISCOVER_FLAG: \"TryAutoDetect\",\r\n REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: \"login.microsoft.com\",\r\n REGIONAL_AUTH_NON_MSI_QUERY_STRING: \"allowestsrnonmsi=true\",\r\n KNOWN_PUBLIC_CLOUDS: [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"],\r\n TOKEN_RESPONSE_TYPE: \"token\",\r\n ID_TOKEN_RESPONSE_TYPE: \"id_token\",\r\n SHR_NONCE_VALIDITY: 240,\r\n INVALID_INSTANCE: \"invalid_instance\",\r\n};\r\nvar OIDC_DEFAULT_SCOPES = [\r\n Constants.OPENID_SCOPE,\r\n Constants.PROFILE_SCOPE,\r\n Constants.OFFLINE_ACCESS_SCOPE\r\n];\r\nvar OIDC_SCOPES = __spreadArrays(OIDC_DEFAULT_SCOPES, [\r\n Constants.EMAIL_SCOPE\r\n]);\r\n/**\r\n * Request header names\r\n */\r\nvar HeaderNames;\r\n(function (HeaderNames) {\r\n HeaderNames[\"CONTENT_TYPE\"] = \"Content-Type\";\r\n HeaderNames[\"RETRY_AFTER\"] = \"Retry-After\";\r\n HeaderNames[\"CCS_HEADER\"] = \"X-AnchorMailbox\";\r\n HeaderNames[\"WWWAuthenticate\"] = \"WWW-Authenticate\";\r\n HeaderNames[\"AuthenticationInfo\"] = \"Authentication-Info\";\r\n HeaderNames[\"X_MS_REQUEST_ID\"] = \"x-ms-request-id\";\r\n HeaderNames[\"X_MS_HTTP_VERSION\"] = \"x-ms-httpver\";\r\n})(HeaderNames || (HeaderNames = {}));\r\n/**\r\n * Persistent cache keys MSAL which stay while user is logged in.\r\n */\r\nvar PersistentCacheKeys;\r\n(function (PersistentCacheKeys) {\r\n PersistentCacheKeys[\"ID_TOKEN\"] = \"idtoken\";\r\n PersistentCacheKeys[\"CLIENT_INFO\"] = \"client.info\";\r\n PersistentCacheKeys[\"ADAL_ID_TOKEN\"] = \"adal.idtoken\";\r\n PersistentCacheKeys[\"ERROR\"] = \"error\";\r\n PersistentCacheKeys[\"ERROR_DESC\"] = \"error.description\";\r\n PersistentCacheKeys[\"ACTIVE_ACCOUNT\"] = \"active-account\";\r\n PersistentCacheKeys[\"ACTIVE_ACCOUNT_FILTERS\"] = \"active-account-filters\"; // new cache entry for active_account for a more robust version for browser\r\n})(PersistentCacheKeys || (PersistentCacheKeys = {}));\r\n/**\r\n * String constants related to AAD Authority\r\n */\r\nvar AADAuthorityConstants;\r\n(function (AADAuthorityConstants) {\r\n AADAuthorityConstants[\"COMMON\"] = \"common\";\r\n AADAuthorityConstants[\"ORGANIZATIONS\"] = \"organizations\";\r\n AADAuthorityConstants[\"CONSUMERS\"] = \"consumers\";\r\n})(AADAuthorityConstants || (AADAuthorityConstants = {}));\r\n/**\r\n * Keys in the hashParams sent by AAD Server\r\n */\r\nvar AADServerParamKeys;\r\n(function (AADServerParamKeys) {\r\n AADServerParamKeys[\"CLIENT_ID\"] = \"client_id\";\r\n AADServerParamKeys[\"REDIRECT_URI\"] = \"redirect_uri\";\r\n AADServerParamKeys[\"RESPONSE_TYPE\"] = \"response_type\";\r\n AADServerParamKeys[\"RESPONSE_MODE\"] = \"response_mode\";\r\n AADServerParamKeys[\"GRANT_TYPE\"] = \"grant_type\";\r\n AADServerParamKeys[\"CLAIMS\"] = \"claims\";\r\n AADServerParamKeys[\"SCOPE\"] = \"scope\";\r\n AADServerParamKeys[\"ERROR\"] = \"error\";\r\n AADServerParamKeys[\"ERROR_DESCRIPTION\"] = \"error_description\";\r\n AADServerParamKeys[\"ACCESS_TOKEN\"] = \"access_token\";\r\n AADServerParamKeys[\"ID_TOKEN\"] = \"id_token\";\r\n AADServerParamKeys[\"REFRESH_TOKEN\"] = \"refresh_token\";\r\n AADServerParamKeys[\"EXPIRES_IN\"] = \"expires_in\";\r\n AADServerParamKeys[\"STATE\"] = \"state\";\r\n AADServerParamKeys[\"NONCE\"] = \"nonce\";\r\n AADServerParamKeys[\"PROMPT\"] = \"prompt\";\r\n AADServerParamKeys[\"SESSION_STATE\"] = \"session_state\";\r\n AADServerParamKeys[\"CLIENT_INFO\"] = \"client_info\";\r\n AADServerParamKeys[\"CODE\"] = \"code\";\r\n AADServerParamKeys[\"CODE_CHALLENGE\"] = \"code_challenge\";\r\n AADServerParamKeys[\"CODE_CHALLENGE_METHOD\"] = \"code_challenge_method\";\r\n AADServerParamKeys[\"CODE_VERIFIER\"] = \"code_verifier\";\r\n AADServerParamKeys[\"CLIENT_REQUEST_ID\"] = \"client-request-id\";\r\n AADServerParamKeys[\"X_CLIENT_SKU\"] = \"x-client-SKU\";\r\n AADServerParamKeys[\"X_CLIENT_VER\"] = \"x-client-VER\";\r\n AADServerParamKeys[\"X_CLIENT_OS\"] = \"x-client-OS\";\r\n AADServerParamKeys[\"X_CLIENT_CPU\"] = \"x-client-CPU\";\r\n AADServerParamKeys[\"X_CLIENT_CURR_TELEM\"] = \"x-client-current-telemetry\";\r\n AADServerParamKeys[\"X_CLIENT_LAST_TELEM\"] = \"x-client-last-telemetry\";\r\n AADServerParamKeys[\"X_MS_LIB_CAPABILITY\"] = \"x-ms-lib-capability\";\r\n AADServerParamKeys[\"X_APP_NAME\"] = \"x-app-name\";\r\n AADServerParamKeys[\"X_APP_VER\"] = \"x-app-ver\";\r\n AADServerParamKeys[\"POST_LOGOUT_URI\"] = \"post_logout_redirect_uri\";\r\n AADServerParamKeys[\"ID_TOKEN_HINT\"] = \"id_token_hint\";\r\n AADServerParamKeys[\"DEVICE_CODE\"] = \"device_code\";\r\n AADServerParamKeys[\"CLIENT_SECRET\"] = \"client_secret\";\r\n AADServerParamKeys[\"CLIENT_ASSERTION\"] = \"client_assertion\";\r\n AADServerParamKeys[\"CLIENT_ASSERTION_TYPE\"] = \"client_assertion_type\";\r\n AADServerParamKeys[\"TOKEN_TYPE\"] = \"token_type\";\r\n AADServerParamKeys[\"REQ_CNF\"] = \"req_cnf\";\r\n AADServerParamKeys[\"OBO_ASSERTION\"] = \"assertion\";\r\n AADServerParamKeys[\"REQUESTED_TOKEN_USE\"] = \"requested_token_use\";\r\n AADServerParamKeys[\"ON_BEHALF_OF\"] = \"on_behalf_of\";\r\n AADServerParamKeys[\"FOCI\"] = \"foci\";\r\n AADServerParamKeys[\"CCS_HEADER\"] = \"X-AnchorMailbox\";\r\n AADServerParamKeys[\"RETURN_SPA_CODE\"] = \"return_spa_code\";\r\n AADServerParamKeys[\"NATIVE_BROKER\"] = \"nativebroker\";\r\n AADServerParamKeys[\"LOGOUT_HINT\"] = \"logout_hint\";\r\n})(AADServerParamKeys || (AADServerParamKeys = {}));\r\n/**\r\n * Claims request keys\r\n */\r\nvar ClaimsRequestKeys;\r\n(function (ClaimsRequestKeys) {\r\n ClaimsRequestKeys[\"ACCESS_TOKEN\"] = \"access_token\";\r\n ClaimsRequestKeys[\"XMS_CC\"] = \"xms_cc\";\r\n})(ClaimsRequestKeys || (ClaimsRequestKeys = {}));\r\n/**\r\n * we considered making this \"enum\" in the request instead of string, however it looks like the allowed list of\r\n * prompt values kept changing over past couple of years. There are some undocumented prompt values for some\r\n * internal partners too, hence the choice of generic \"string\" type instead of the \"enum\"\r\n */\r\nvar PromptValue = {\r\n LOGIN: \"login\",\r\n SELECT_ACCOUNT: \"select_account\",\r\n CONSENT: \"consent\",\r\n NONE: \"none\",\r\n CREATE: \"create\",\r\n NO_SESSION: \"no_session\"\r\n};\r\n/**\r\n * SSO Types - generated to populate hints\r\n */\r\nvar SSOTypes;\r\n(function (SSOTypes) {\r\n SSOTypes[\"ACCOUNT\"] = \"account\";\r\n SSOTypes[\"SID\"] = \"sid\";\r\n SSOTypes[\"LOGIN_HINT\"] = \"login_hint\";\r\n SSOTypes[\"ID_TOKEN\"] = \"id_token\";\r\n SSOTypes[\"DOMAIN_HINT\"] = \"domain_hint\";\r\n SSOTypes[\"ORGANIZATIONS\"] = \"organizations\";\r\n SSOTypes[\"CONSUMERS\"] = \"consumers\";\r\n SSOTypes[\"ACCOUNT_ID\"] = \"accountIdentifier\";\r\n SSOTypes[\"HOMEACCOUNT_ID\"] = \"homeAccountIdentifier\";\r\n})(SSOTypes || (SSOTypes = {}));\r\n/**\r\n * allowed values for codeVerifier\r\n */\r\nvar CodeChallengeMethodValues = {\r\n PLAIN: \"plain\",\r\n S256: \"S256\"\r\n};\r\n/**\r\n * allowed values for response_mode\r\n */\r\nvar ResponseMode;\r\n(function (ResponseMode) {\r\n ResponseMode[\"QUERY\"] = \"query\";\r\n ResponseMode[\"FRAGMENT\"] = \"fragment\";\r\n ResponseMode[\"FORM_POST\"] = \"form_post\";\r\n})(ResponseMode || (ResponseMode = {}));\r\n/**\r\n * allowed grant_type\r\n */\r\nvar GrantType;\r\n(function (GrantType) {\r\n GrantType[\"IMPLICIT_GRANT\"] = \"implicit\";\r\n GrantType[\"AUTHORIZATION_CODE_GRANT\"] = \"authorization_code\";\r\n GrantType[\"CLIENT_CREDENTIALS_GRANT\"] = \"client_credentials\";\r\n GrantType[\"RESOURCE_OWNER_PASSWORD_GRANT\"] = \"password\";\r\n GrantType[\"REFRESH_TOKEN_GRANT\"] = \"refresh_token\";\r\n GrantType[\"DEVICE_CODE_GRANT\"] = \"device_code\";\r\n GrantType[\"JWT_BEARER\"] = \"urn:ietf:params:oauth:grant-type:jwt-bearer\";\r\n})(GrantType || (GrantType = {}));\r\n/**\r\n * Account types in Cache\r\n */\r\nvar CacheAccountType;\r\n(function (CacheAccountType) {\r\n CacheAccountType[\"MSSTS_ACCOUNT_TYPE\"] = \"MSSTS\";\r\n CacheAccountType[\"ADFS_ACCOUNT_TYPE\"] = \"ADFS\";\r\n CacheAccountType[\"MSAV1_ACCOUNT_TYPE\"] = \"MSA\";\r\n CacheAccountType[\"GENERIC_ACCOUNT_TYPE\"] = \"Generic\"; // NTLM, Kerberos, FBA, Basic etc\r\n})(CacheAccountType || (CacheAccountType = {}));\r\n/**\r\n * Separators used in cache\r\n */\r\nvar Separators;\r\n(function (Separators) {\r\n Separators[\"CACHE_KEY_SEPARATOR\"] = \"-\";\r\n Separators[\"CLIENT_INFO_SEPARATOR\"] = \".\";\r\n})(Separators || (Separators = {}));\r\n/**\r\n * Credential Type stored in the cache\r\n */\r\nvar CredentialType;\r\n(function (CredentialType) {\r\n CredentialType[\"ID_TOKEN\"] = \"IdToken\";\r\n CredentialType[\"ACCESS_TOKEN\"] = \"AccessToken\";\r\n CredentialType[\"ACCESS_TOKEN_WITH_AUTH_SCHEME\"] = \"AccessToken_With_AuthScheme\";\r\n CredentialType[\"REFRESH_TOKEN\"] = \"RefreshToken\";\r\n})(CredentialType || (CredentialType = {}));\r\n/**\r\n * Combine all cache types\r\n */\r\nvar CacheType;\r\n(function (CacheType) {\r\n CacheType[CacheType[\"ADFS\"] = 1001] = \"ADFS\";\r\n CacheType[CacheType[\"MSA\"] = 1002] = \"MSA\";\r\n CacheType[CacheType[\"MSSTS\"] = 1003] = \"MSSTS\";\r\n CacheType[CacheType[\"GENERIC\"] = 1004] = \"GENERIC\";\r\n CacheType[CacheType[\"ACCESS_TOKEN\"] = 2001] = \"ACCESS_TOKEN\";\r\n CacheType[CacheType[\"REFRESH_TOKEN\"] = 2002] = \"REFRESH_TOKEN\";\r\n CacheType[CacheType[\"ID_TOKEN\"] = 2003] = \"ID_TOKEN\";\r\n CacheType[CacheType[\"APP_METADATA\"] = 3001] = \"APP_METADATA\";\r\n CacheType[CacheType[\"UNDEFINED\"] = 9999] = \"UNDEFINED\";\r\n})(CacheType || (CacheType = {}));\r\n/**\r\n * More Cache related constants\r\n */\r\nvar APP_METADATA = \"appmetadata\";\r\nvar CLIENT_INFO = \"client_info\";\r\nvar THE_FAMILY_ID = \"1\";\r\nvar AUTHORITY_METADATA_CONSTANTS = {\r\n CACHE_KEY: \"authority-metadata\",\r\n REFRESH_TIME_SECONDS: 3600 * 24 // 24 Hours\r\n};\r\nvar AuthorityMetadataSource;\r\n(function (AuthorityMetadataSource) {\r\n AuthorityMetadataSource[\"CONFIG\"] = \"config\";\r\n AuthorityMetadataSource[\"CACHE\"] = \"cache\";\r\n AuthorityMetadataSource[\"NETWORK\"] = \"network\";\r\n AuthorityMetadataSource[\"HARDCODED_VALUES\"] = \"hardcoded_values\";\r\n})(AuthorityMetadataSource || (AuthorityMetadataSource = {}));\r\nvar SERVER_TELEM_CONSTANTS = {\r\n SCHEMA_VERSION: 5,\r\n MAX_CUR_HEADER_BYTES: 80,\r\n MAX_LAST_HEADER_BYTES: 330,\r\n MAX_CACHED_ERRORS: 50,\r\n CACHE_KEY: \"server-telemetry\",\r\n CATEGORY_SEPARATOR: \"|\",\r\n VALUE_SEPARATOR: \",\",\r\n OVERFLOW_TRUE: \"1\",\r\n OVERFLOW_FALSE: \"0\",\r\n UNKNOWN_ERROR: \"unknown_error\"\r\n};\r\n/**\r\n * Type of the authentication request\r\n */\r\nvar AuthenticationScheme;\r\n(function (AuthenticationScheme) {\r\n AuthenticationScheme[\"BEARER\"] = \"Bearer\";\r\n AuthenticationScheme[\"POP\"] = \"pop\";\r\n AuthenticationScheme[\"SSH\"] = \"ssh-cert\";\r\n})(AuthenticationScheme || (AuthenticationScheme = {}));\r\n/**\r\n * Constants related to throttling\r\n */\r\nvar ThrottlingConstants = {\r\n // Default time to throttle RequestThumbprint in seconds\r\n DEFAULT_THROTTLE_TIME_SECONDS: 60,\r\n // Default maximum time to throttle in seconds, overrides what the server sends back\r\n DEFAULT_MAX_THROTTLE_TIME_SECONDS: 3600,\r\n // Prefix for storing throttling entries\r\n THROTTLING_PREFIX: \"throttling\",\r\n // Value assigned to the x-ms-lib-capability header to indicate to the server the library supports throttling\r\n X_MS_LIB_CAPABILITY_VALUE: \"retry-after, h429\"\r\n};\r\nvar Errors = {\r\n INVALID_GRANT_ERROR: \"invalid_grant\",\r\n CLIENT_MISMATCH_ERROR: \"client_mismatch\",\r\n};\r\n/**\r\n * Password grant parameters\r\n */\r\nvar PasswordGrantConstants;\r\n(function (PasswordGrantConstants) {\r\n PasswordGrantConstants[\"username\"] = \"username\";\r\n PasswordGrantConstants[\"password\"] = \"password\";\r\n})(PasswordGrantConstants || (PasswordGrantConstants = {}));\r\n/**\r\n * Response codes\r\n */\r\nvar ResponseCodes;\r\n(function (ResponseCodes) {\r\n ResponseCodes[ResponseCodes[\"httpSuccess\"] = 200] = \"httpSuccess\";\r\n ResponseCodes[ResponseCodes[\"httpBadRequest\"] = 400] = \"httpBadRequest\";\r\n})(ResponseCodes || (ResponseCodes = {}));\r\n/**\r\n * Region Discovery Sources\r\n */\r\nvar RegionDiscoverySources;\r\n(function (RegionDiscoverySources) {\r\n RegionDiscoverySources[\"FAILED_AUTO_DETECTION\"] = \"1\";\r\n RegionDiscoverySources[\"INTERNAL_CACHE\"] = \"2\";\r\n RegionDiscoverySources[\"ENVIRONMENT_VARIABLE\"] = \"3\";\r\n RegionDiscoverySources[\"IMDS\"] = \"4\";\r\n})(RegionDiscoverySources || (RegionDiscoverySources = {}));\r\n/**\r\n * Region Discovery Outcomes\r\n */\r\nvar RegionDiscoveryOutcomes;\r\n(function (RegionDiscoveryOutcomes) {\r\n RegionDiscoveryOutcomes[\"CONFIGURED_MATCHES_DETECTED\"] = \"1\";\r\n RegionDiscoveryOutcomes[\"CONFIGURED_NO_AUTO_DETECTION\"] = \"2\";\r\n RegionDiscoveryOutcomes[\"CONFIGURED_NOT_DETECTED\"] = \"3\";\r\n RegionDiscoveryOutcomes[\"AUTO_DETECTION_REQUESTED_SUCCESSFUL\"] = \"4\";\r\n RegionDiscoveryOutcomes[\"AUTO_DETECTION_REQUESTED_FAILED\"] = \"5\";\r\n})(RegionDiscoveryOutcomes || (RegionDiscoveryOutcomes = {}));\r\nvar CacheOutcome;\r\n(function (CacheOutcome) {\r\n CacheOutcome[\"NO_CACHE_HIT\"] = \"0\";\r\n CacheOutcome[\"FORCE_REFRESH\"] = \"1\";\r\n CacheOutcome[\"NO_CACHED_ACCESS_TOKEN\"] = \"2\";\r\n CacheOutcome[\"CACHED_ACCESS_TOKEN_EXPIRED\"] = \"3\";\r\n CacheOutcome[\"REFRESH_CACHED_ACCESS_TOKEN\"] = \"4\";\r\n})(CacheOutcome || (CacheOutcome = {}));\r\nvar JsonTypes;\r\n(function (JsonTypes) {\r\n JsonTypes[\"Jwt\"] = \"JWT\";\r\n JsonTypes[\"Jwk\"] = \"JWK\";\r\n JsonTypes[\"Pop\"] = \"pop\";\r\n})(JsonTypes || (JsonTypes = {}));\r\nvar ONE_DAY_IN_MS = 86400000;\n\nexport { AADAuthorityConstants, AADServerParamKeys, APP_METADATA, AUTHORITY_METADATA_CONSTANTS, AuthenticationScheme, AuthorityMetadataSource, CLIENT_INFO, CacheAccountType, CacheOutcome, CacheType, ClaimsRequestKeys, CodeChallengeMethodValues, Constants, CredentialType, Errors, GrantType, HeaderNames, JsonTypes, OIDC_DEFAULT_SCOPES, OIDC_SCOPES, ONE_DAY_IN_MS, PasswordGrantConstants, PersistentCacheKeys, PromptValue, RegionDiscoveryOutcomes, RegionDiscoverySources, ResponseCodes, ResponseMode, SERVER_TELEM_CONSTANTS, SSOTypes, Separators, THE_FAMILY_ID, ThrottlingConstants };\n//# sourceMappingURL=Constants.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { Constants } from '../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * AuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar AuthErrorMessage = {\r\n unexpectedError: {\r\n code: \"unexpected_error\",\r\n desc: \"Unexpected error in authentication.\"\r\n },\r\n postRequestFailed: {\r\n code: \"post_request_failed\",\r\n desc: \"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details.\"\r\n }\r\n};\r\n/**\r\n * General error class thrown by the MSAL.js library.\r\n */\r\nvar AuthError = /** @class */ (function (_super) {\r\n __extends(AuthError, _super);\r\n function AuthError(errorCode, errorMessage, suberror) {\r\n var _this = this;\r\n var errorString = errorMessage ? errorCode + \": \" + errorMessage : errorCode;\r\n _this = _super.call(this, errorString) || this;\r\n Object.setPrototypeOf(_this, AuthError.prototype);\r\n _this.errorCode = errorCode || Constants.EMPTY_STRING;\r\n _this.errorMessage = errorMessage || Constants.EMPTY_STRING;\r\n _this.subError = suberror || Constants.EMPTY_STRING;\r\n _this.name = \"AuthError\";\r\n return _this;\r\n }\r\n AuthError.prototype.setCorrelationId = function (correlationId) {\r\n this.correlationId = correlationId;\r\n };\r\n /**\r\n * Creates an error that is thrown when something unexpected happens in the library.\r\n * @param errDesc\r\n */\r\n AuthError.createUnexpectedError = function (errDesc) {\r\n return new AuthError(AuthErrorMessage.unexpectedError.code, AuthErrorMessage.unexpectedError.desc + \": \" + errDesc);\r\n };\r\n /**\r\n * Creates an error for post request failures.\r\n * @param errDesc\r\n * @returns\r\n */\r\n AuthError.createPostRequestFailed = function (errDesc) {\r\n return new AuthError(AuthErrorMessage.postRequestFailed.code, AuthErrorMessage.postRequestFailed.desc + \": \" + errDesc);\r\n };\r\n return AuthError;\r\n}(Error));\n\nexport { AuthError, AuthErrorMessage };\n//# sourceMappingURL=AuthError.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { AuthError } from '../error/AuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar DEFAULT_CRYPTO_IMPLEMENTATION = {\r\n createNewGuid: function () {\r\n var notImplErr = \"Crypto interface - createNewGuid() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n base64Decode: function () {\r\n var notImplErr = \"Crypto interface - base64Decode() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n base64Encode: function () {\r\n var notImplErr = \"Crypto interface - base64Encode() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n generatePkceCodes: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Crypto interface - generatePkceCodes() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n getPublicKeyThumbprint: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Crypto interface - getPublicKeyThumbprint() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n removeTokenBindingKey: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Crypto interface - removeTokenBindingKey() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n clearKeystore: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Crypto interface - clearKeystore() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n signJwt: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Crypto interface - signJwt() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n hashString: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Crypto interface - hashString() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n }\r\n};\n\nexport { DEFAULT_CRYPTO_IMPLEMENTATION };\n//# sourceMappingURL=ICrypto.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { AuthError } from './AuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ClientAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar ClientAuthErrorMessage = {\r\n clientInfoDecodingError: {\r\n code: \"client_info_decoding_error\",\r\n desc: \"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause.\"\r\n },\r\n clientInfoEmptyError: {\r\n code: \"client_info_empty_error\",\r\n desc: \"The client info was empty. Please review the trace to determine the root cause.\"\r\n },\r\n tokenParsingError: {\r\n code: \"token_parsing_error\",\r\n desc: \"Token cannot be parsed. Please review stack trace to determine root cause.\"\r\n },\r\n nullOrEmptyToken: {\r\n code: \"null_or_empty_token\",\r\n desc: \"The token is null or empty. Please review the trace to determine the root cause.\"\r\n },\r\n endpointResolutionError: {\r\n code: \"endpoints_resolution_error\",\r\n desc: \"Error: could not resolve endpoints. Please check network and try again.\"\r\n },\r\n networkError: {\r\n code: \"network_error\",\r\n desc: \"Network request failed. Please check network trace to determine root cause.\"\r\n },\r\n unableToGetOpenidConfigError: {\r\n code: \"openid_config_error\",\r\n desc: \"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.\"\r\n },\r\n hashNotDeserialized: {\r\n code: \"hash_not_deserialized\",\r\n desc: \"The hash parameters could not be deserialized. Please review the trace to determine the root cause.\"\r\n },\r\n blankGuidGenerated: {\r\n code: \"blank_guid_generated\",\r\n desc: \"The guid generated was blank. Please review the trace to determine the root cause.\"\r\n },\r\n invalidStateError: {\r\n code: \"invalid_state\",\r\n desc: \"State was not the expected format. Please check the logs to determine whether the request was sent using ProtocolUtils.setRequestState().\"\r\n },\r\n stateMismatchError: {\r\n code: \"state_mismatch\",\r\n desc: \"State mismatch error. Please check your network. Continued requests may cause cache overflow.\"\r\n },\r\n stateNotFoundError: {\r\n code: \"state_not_found\",\r\n desc: \"State not found\"\r\n },\r\n nonceMismatchError: {\r\n code: \"nonce_mismatch\",\r\n desc: \"Nonce mismatch error. This may be caused by a race condition in concurrent requests.\"\r\n },\r\n nonceNotFoundError: {\r\n code: \"nonce_not_found\",\r\n desc: \"nonce not found\"\r\n },\r\n authTimeNotFoundError: {\r\n code: \"auth_time_not_found\",\r\n desc: \"Max Age was requested and the ID token is missing the auth_time variable.\" +\r\n \" auth_time is an optional claim and is not enabled by default - it must be enabled.\" +\r\n \" See https://aka.ms/msaljs/optional-claims for more information.\"\r\n },\r\n maxAgeTranspiredError: {\r\n code: \"max_age_transpired\",\r\n desc: \"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.\"\r\n },\r\n noTokensFoundError: {\r\n code: \"no_tokens_found\",\r\n desc: \"No tokens were found for the given scopes, and no authorization code was passed to acquireToken. You must retrieve an authorization code before making a call to acquireToken().\"\r\n },\r\n multipleMatchingTokens: {\r\n code: \"multiple_matching_tokens\",\r\n desc: \"The cache contains multiple tokens satisfying the requirements. \" +\r\n \"Call AcquireToken again providing more requirements such as authority or account.\"\r\n },\r\n multipleMatchingAccounts: {\r\n code: \"multiple_matching_accounts\",\r\n desc: \"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account\"\r\n },\r\n multipleMatchingAppMetadata: {\r\n code: \"multiple_matching_appMetadata\",\r\n desc: \"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata\"\r\n },\r\n tokenRequestCannotBeMade: {\r\n code: \"request_cannot_be_made\",\r\n desc: \"Token request cannot be made without authorization code or refresh token.\"\r\n },\r\n appendEmptyScopeError: {\r\n code: \"cannot_append_empty_scope\",\r\n desc: \"Cannot append null or empty scope to ScopeSet. Please check the stack trace for more info.\"\r\n },\r\n removeEmptyScopeError: {\r\n code: \"cannot_remove_empty_scope\",\r\n desc: \"Cannot remove null or empty scope from ScopeSet. Please check the stack trace for more info.\"\r\n },\r\n appendScopeSetError: {\r\n code: \"cannot_append_scopeset\",\r\n desc: \"Cannot append ScopeSet due to error.\"\r\n },\r\n emptyInputScopeSetError: {\r\n code: \"empty_input_scopeset\",\r\n desc: \"Empty input ScopeSet cannot be processed.\"\r\n },\r\n DeviceCodePollingCancelled: {\r\n code: \"device_code_polling_cancelled\",\r\n desc: \"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.\"\r\n },\r\n DeviceCodeExpired: {\r\n code: \"device_code_expired\",\r\n desc: \"Device code is expired.\"\r\n },\r\n DeviceCodeUnknownError: {\r\n code: \"device_code_unknown_error\",\r\n desc: \"Device code stopped polling for unknown reasons.\"\r\n },\r\n NoAccountInSilentRequest: {\r\n code: \"no_account_in_silent_request\",\r\n desc: \"Please pass an account object, silent flow is not supported without account information\"\r\n },\r\n invalidCacheRecord: {\r\n code: \"invalid_cache_record\",\r\n desc: \"Cache record object was null or undefined.\"\r\n },\r\n invalidCacheEnvironment: {\r\n code: \"invalid_cache_environment\",\r\n desc: \"Invalid environment when attempting to create cache entry\"\r\n },\r\n noAccountFound: {\r\n code: \"no_account_found\",\r\n desc: \"No account found in cache for given key.\"\r\n },\r\n CachePluginError: {\r\n code: \"no cache plugin set on CacheManager\",\r\n desc: \"ICachePlugin needs to be set before using readFromStorage or writeFromStorage\"\r\n },\r\n noCryptoObj: {\r\n code: \"no_crypto_object\",\r\n desc: \"No crypto object detected. This is required for the following operation: \"\r\n },\r\n invalidCacheType: {\r\n code: \"invalid_cache_type\",\r\n desc: \"Invalid cache type\"\r\n },\r\n unexpectedAccountType: {\r\n code: \"unexpected_account_type\",\r\n desc: \"Unexpected account type.\"\r\n },\r\n unexpectedCredentialType: {\r\n code: \"unexpected_credential_type\",\r\n desc: \"Unexpected credential type.\"\r\n },\r\n invalidAssertion: {\r\n code: \"invalid_assertion\",\r\n desc: \"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515\"\r\n },\r\n invalidClientCredential: {\r\n code: \"invalid_client_credential\",\r\n desc: \"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential\"\r\n },\r\n tokenRefreshRequired: {\r\n code: \"token_refresh_required\",\r\n desc: \"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.\"\r\n },\r\n userTimeoutReached: {\r\n code: \"user_timeout_reached\",\r\n desc: \"User defined timeout for device code polling reached\",\r\n },\r\n tokenClaimsRequired: {\r\n code: \"token_claims_cnf_required_for_signedjwt\",\r\n desc: \"Cannot generate a POP jwt if the token_claims are not populated\"\r\n },\r\n noAuthorizationCodeFromServer: {\r\n code: \"authorization_code_missing_from_server_response\",\r\n desc: \"Server response does not contain an authorization code to proceed\"\r\n },\r\n noAzureRegionDetected: {\r\n code: \"no_azure_region_detected\",\r\n desc: \"No azure region was detected and no fallback was made available\"\r\n },\r\n accessTokenEntityNullError: {\r\n code: \"access_token_entity_null\",\r\n desc: \"Access token entity is null, please check logs and cache to ensure a valid access token is present.\"\r\n },\r\n bindingKeyNotRemovedError: {\r\n code: \"binding_key_not_removed\",\r\n desc: \"Could not remove the credential's binding key from storage.\"\r\n },\r\n logoutNotSupported: {\r\n code: \"end_session_endpoint_not_supported\",\r\n desc: \"Provided authority does not support logout.\"\r\n },\r\n keyIdMissing: {\r\n code: \"key_id_missing\",\r\n desc: \"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.\"\r\n },\r\n noNetworkConnectivity: {\r\n code: \"no_network_connectivity\",\r\n desc: \"No network connectivity. Check your internet connection.\"\r\n },\r\n userCanceledError: {\r\n code: \"user_canceled\",\r\n desc: \"User canceled the flow.\"\r\n }\r\n};\r\n/**\r\n * Error thrown when there is an error in the client code running on the browser.\r\n */\r\nvar ClientAuthError = /** @class */ (function (_super) {\r\n __extends(ClientAuthError, _super);\r\n function ClientAuthError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n _this.name = \"ClientAuthError\";\r\n Object.setPrototypeOf(_this, ClientAuthError.prototype);\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when client info object doesn't decode correctly.\r\n * @param caughtError\r\n */\r\n ClientAuthError.createClientInfoDecodingError = function (caughtError) {\r\n return new ClientAuthError(ClientAuthErrorMessage.clientInfoDecodingError.code, ClientAuthErrorMessage.clientInfoDecodingError.desc + \" Failed with error: \" + caughtError);\r\n };\r\n /**\r\n * Creates an error thrown if the client info is empty.\r\n * @param rawClientInfo\r\n */\r\n ClientAuthError.createClientInfoEmptyError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.clientInfoEmptyError.code, \"\" + ClientAuthErrorMessage.clientInfoEmptyError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the id token extraction errors out.\r\n * @param err\r\n */\r\n ClientAuthError.createTokenParsingError = function (caughtExtractionError) {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenParsingError.code, ClientAuthErrorMessage.tokenParsingError.desc + \" Failed with error: \" + caughtExtractionError);\r\n };\r\n /**\r\n * Creates an error thrown when the id token string is null or empty.\r\n * @param invalidRawTokenString\r\n */\r\n ClientAuthError.createTokenNullOrEmptyError = function (invalidRawTokenString) {\r\n return new ClientAuthError(ClientAuthErrorMessage.nullOrEmptyToken.code, ClientAuthErrorMessage.nullOrEmptyToken.desc + \" Raw Token Value: \" + invalidRawTokenString);\r\n };\r\n /**\r\n * Creates an error thrown when the endpoint discovery doesn't complete correctly.\r\n */\r\n ClientAuthError.createEndpointDiscoveryIncompleteError = function (errDetail) {\r\n return new ClientAuthError(ClientAuthErrorMessage.endpointResolutionError.code, ClientAuthErrorMessage.endpointResolutionError.desc + \" Detail: \" + errDetail);\r\n };\r\n /**\r\n * Creates an error thrown when the fetch client throws\r\n */\r\n ClientAuthError.createNetworkError = function (endpoint, errDetail) {\r\n return new ClientAuthError(ClientAuthErrorMessage.networkError.code, ClientAuthErrorMessage.networkError.desc + \" | Fetch client threw: \" + errDetail + \" | Attempted to reach: \" + endpoint.split(\"?\")[0]);\r\n };\r\n /**\r\n * Creates an error thrown when the openid-configuration endpoint cannot be reached or does not contain the required data\r\n */\r\n ClientAuthError.createUnableToGetOpenidConfigError = function (errDetail) {\r\n return new ClientAuthError(ClientAuthErrorMessage.unableToGetOpenidConfigError.code, ClientAuthErrorMessage.unableToGetOpenidConfigError.desc + \" Attempted to retrieve endpoints from: \" + errDetail);\r\n };\r\n /**\r\n * Creates an error thrown when the hash cannot be deserialized.\r\n * @param hashParamObj\r\n */\r\n ClientAuthError.createHashNotDeserializedError = function (hashParamObj) {\r\n return new ClientAuthError(ClientAuthErrorMessage.hashNotDeserialized.code, ClientAuthErrorMessage.hashNotDeserialized.desc + \" Given Object: \" + hashParamObj);\r\n };\r\n /**\r\n * Creates an error thrown when the state cannot be parsed.\r\n * @param invalidState\r\n */\r\n ClientAuthError.createInvalidStateError = function (invalidState, errorString) {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidStateError.code, ClientAuthErrorMessage.invalidStateError.desc + \" Invalid State: \" + invalidState + \", Root Err: \" + errorString);\r\n };\r\n /**\r\n * Creates an error thrown when two states do not match.\r\n */\r\n ClientAuthError.createStateMismatchError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.stateMismatchError.code, ClientAuthErrorMessage.stateMismatchError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the state is not present\r\n * @param missingState\r\n */\r\n ClientAuthError.createStateNotFoundError = function (missingState) {\r\n return new ClientAuthError(ClientAuthErrorMessage.stateNotFoundError.code, ClientAuthErrorMessage.stateNotFoundError.desc + \": \" + missingState);\r\n };\r\n /**\r\n * Creates an error thrown when the nonce does not match.\r\n */\r\n ClientAuthError.createNonceMismatchError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.nonceMismatchError.code, ClientAuthErrorMessage.nonceMismatchError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when max_age was provided in the request, but auth_time is not in the token claims\r\n * @param missingNonce\r\n */\r\n ClientAuthError.createAuthTimeNotFoundError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.authTimeNotFoundError.code, ClientAuthErrorMessage.authTimeNotFoundError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when too much time has elapsed since the last end-user authentication\r\n */\r\n ClientAuthError.createMaxAgeTranspiredError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.maxAgeTranspiredError.code, ClientAuthErrorMessage.maxAgeTranspiredError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the mnonce is not present\r\n * @param missingNonce\r\n */\r\n ClientAuthError.createNonceNotFoundError = function (missingNonce) {\r\n return new ClientAuthError(ClientAuthErrorMessage.nonceNotFoundError.code, ClientAuthErrorMessage.nonceNotFoundError.desc + \": \" + missingNonce);\r\n };\r\n /**\r\n * Throws error when multiple tokens are in cache.\r\n */\r\n ClientAuthError.createMultipleMatchingTokensInCacheError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingTokens.code, ClientAuthErrorMessage.multipleMatchingTokens.desc + \".\");\r\n };\r\n /**\r\n * Throws error when multiple accounts are in cache for the given params\r\n */\r\n ClientAuthError.createMultipleMatchingAccountsInCacheError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingAccounts.code, ClientAuthErrorMessage.multipleMatchingAccounts.desc);\r\n };\r\n /**\r\n * Throws error when multiple appMetada are in cache for the given clientId.\r\n */\r\n ClientAuthError.createMultipleMatchingAppMetadataInCacheError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingAppMetadata.code, ClientAuthErrorMessage.multipleMatchingAppMetadata.desc);\r\n };\r\n /**\r\n * Throws error when no auth code or refresh token is given to ServerTokenRequestParameters.\r\n */\r\n ClientAuthError.createTokenRequestCannotBeMadeError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenRequestCannotBeMade.code, ClientAuthErrorMessage.tokenRequestCannotBeMade.desc);\r\n };\r\n /**\r\n * Throws error when attempting to append a null, undefined or empty scope to a set\r\n * @param givenScope\r\n */\r\n ClientAuthError.createAppendEmptyScopeToSetError = function (givenScope) {\r\n return new ClientAuthError(ClientAuthErrorMessage.appendEmptyScopeError.code, ClientAuthErrorMessage.appendEmptyScopeError.desc + \" Given Scope: \" + givenScope);\r\n };\r\n /**\r\n * Throws error when attempting to append a null, undefined or empty scope to a set\r\n * @param givenScope\r\n */\r\n ClientAuthError.createRemoveEmptyScopeFromSetError = function (givenScope) {\r\n return new ClientAuthError(ClientAuthErrorMessage.removeEmptyScopeError.code, ClientAuthErrorMessage.removeEmptyScopeError.desc + \" Given Scope: \" + givenScope);\r\n };\r\n /**\r\n * Throws error when attempting to append null or empty ScopeSet.\r\n * @param appendError\r\n */\r\n ClientAuthError.createAppendScopeSetError = function (appendError) {\r\n return new ClientAuthError(ClientAuthErrorMessage.appendScopeSetError.code, ClientAuthErrorMessage.appendScopeSetError.desc + \" Detail Error: \" + appendError);\r\n };\r\n /**\r\n * Throws error if ScopeSet is null or undefined.\r\n * @param givenScopeSet\r\n */\r\n ClientAuthError.createEmptyInputScopeSetError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.emptyInputScopeSetError.code, \"\" + ClientAuthErrorMessage.emptyInputScopeSetError.desc);\r\n };\r\n /**\r\n * Throws error if user sets CancellationToken.cancel = true during polling of token endpoint during device code flow\r\n */\r\n ClientAuthError.createDeviceCodeCancelledError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.DeviceCodePollingCancelled.code, \"\" + ClientAuthErrorMessage.DeviceCodePollingCancelled.desc);\r\n };\r\n /**\r\n * Throws error if device code is expired\r\n */\r\n ClientAuthError.createDeviceCodeExpiredError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.DeviceCodeExpired.code, \"\" + ClientAuthErrorMessage.DeviceCodeExpired.desc);\r\n };\r\n /**\r\n * Throws error if device code is expired\r\n */\r\n ClientAuthError.createDeviceCodeUnknownError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.DeviceCodeUnknownError.code, \"\" + ClientAuthErrorMessage.DeviceCodeUnknownError.desc);\r\n };\r\n /**\r\n * Throws error when silent requests are made without an account object\r\n */\r\n ClientAuthError.createNoAccountInSilentRequestError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.NoAccountInSilentRequest.code, \"\" + ClientAuthErrorMessage.NoAccountInSilentRequest.desc);\r\n };\r\n /**\r\n * Throws error when cache record is null or undefined.\r\n */\r\n ClientAuthError.createNullOrUndefinedCacheRecord = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheRecord.code, ClientAuthErrorMessage.invalidCacheRecord.desc);\r\n };\r\n /**\r\n * Throws error when provided environment is not part of the CloudDiscoveryMetadata object\r\n */\r\n ClientAuthError.createInvalidCacheEnvironmentError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheEnvironment.code, ClientAuthErrorMessage.invalidCacheEnvironment.desc);\r\n };\r\n /**\r\n * Throws error when account is not found in cache.\r\n */\r\n ClientAuthError.createNoAccountFoundError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.noAccountFound.code, ClientAuthErrorMessage.noAccountFound.desc);\r\n };\r\n /**\r\n * Throws error if ICachePlugin not set on CacheManager.\r\n */\r\n ClientAuthError.createCachePluginError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.CachePluginError.code, \"\" + ClientAuthErrorMessage.CachePluginError.desc);\r\n };\r\n /**\r\n * Throws error if crypto object not found.\r\n * @param operationName\r\n */\r\n ClientAuthError.createNoCryptoObjectError = function (operationName) {\r\n return new ClientAuthError(ClientAuthErrorMessage.noCryptoObj.code, \"\" + ClientAuthErrorMessage.noCryptoObj.desc + operationName);\r\n };\r\n /**\r\n * Throws error if cache type is invalid.\r\n */\r\n ClientAuthError.createInvalidCacheTypeError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheType.code, \"\" + ClientAuthErrorMessage.invalidCacheType.desc);\r\n };\r\n /**\r\n * Throws error if unexpected account type.\r\n */\r\n ClientAuthError.createUnexpectedAccountTypeError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.unexpectedAccountType.code, \"\" + ClientAuthErrorMessage.unexpectedAccountType.desc);\r\n };\r\n /**\r\n * Throws error if unexpected credential type.\r\n */\r\n ClientAuthError.createUnexpectedCredentialTypeError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.unexpectedCredentialType.code, \"\" + ClientAuthErrorMessage.unexpectedCredentialType.desc);\r\n };\r\n /**\r\n * Throws error if client assertion is not valid.\r\n */\r\n ClientAuthError.createInvalidAssertionError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidAssertion.code, \"\" + ClientAuthErrorMessage.invalidAssertion.desc);\r\n };\r\n /**\r\n * Throws error if client assertion is not valid.\r\n */\r\n ClientAuthError.createInvalidCredentialError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidClientCredential.code, \"\" + ClientAuthErrorMessage.invalidClientCredential.desc);\r\n };\r\n /**\r\n * Throws error if token cannot be retrieved from cache due to refresh being required.\r\n */\r\n ClientAuthError.createRefreshRequiredError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenRefreshRequired.code, ClientAuthErrorMessage.tokenRefreshRequired.desc);\r\n };\r\n /**\r\n * Throws error if the user defined timeout is reached.\r\n */\r\n ClientAuthError.createUserTimeoutReachedError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.userTimeoutReached.code, ClientAuthErrorMessage.userTimeoutReached.desc);\r\n };\r\n /*\r\n * Throws error if token claims are not populated for a signed jwt generation\r\n */\r\n ClientAuthError.createTokenClaimsRequiredError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenClaimsRequired.code, ClientAuthErrorMessage.tokenClaimsRequired.desc);\r\n };\r\n /**\r\n * Throws error when the authorization code is missing from the server response\r\n */\r\n ClientAuthError.createNoAuthCodeInServerResponseError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.noAuthorizationCodeFromServer.code, ClientAuthErrorMessage.noAuthorizationCodeFromServer.desc);\r\n };\r\n ClientAuthError.createBindingKeyNotRemovedError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.bindingKeyNotRemovedError.code, ClientAuthErrorMessage.bindingKeyNotRemovedError.desc);\r\n };\r\n /**\r\n * Thrown when logout is attempted for an authority that doesnt have an end_session_endpoint\r\n */\r\n ClientAuthError.createLogoutNotSupportedError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.logoutNotSupported.code, ClientAuthErrorMessage.logoutNotSupported.desc);\r\n };\r\n /**\r\n * Create an error when kid attribute is missing from a PoP token's cache record\r\n */\r\n ClientAuthError.createKeyIdMissingError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.keyIdMissing.code, ClientAuthErrorMessage.keyIdMissing.desc);\r\n };\r\n /**\r\n * Create an error when the client does not have network connectivity\r\n */\r\n ClientAuthError.createNoNetworkConnectivityError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.noNetworkConnectivity.code, ClientAuthErrorMessage.noNetworkConnectivity.desc);\r\n };\r\n /**\r\n * Create an error when the user cancels the flow\r\n */\r\n ClientAuthError.createUserCanceledError = function () {\r\n return new ClientAuthError(ClientAuthErrorMessage.userCanceledError.code, ClientAuthErrorMessage.userCanceledError.desc);\r\n };\r\n return ClientAuthError;\r\n}(AuthError));\n\nexport { ClientAuthError, ClientAuthErrorMessage };\n//# sourceMappingURL=ClientAuthError.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * @hidden\r\n */\r\nvar StringUtils = /** @class */ (function () {\r\n function StringUtils() {\r\n }\r\n /**\r\n * decode a JWT\r\n *\r\n * @param authToken\r\n */\r\n StringUtils.decodeAuthToken = function (authToken) {\r\n if (StringUtils.isEmpty(authToken)) {\r\n throw ClientAuthError.createTokenNullOrEmptyError(authToken);\r\n }\r\n var tokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n var matches = tokenPartsRegex.exec(authToken);\r\n if (!matches || matches.length < 4) {\r\n throw ClientAuthError.createTokenParsingError(\"Given token is malformed: \" + JSON.stringify(authToken));\r\n }\r\n var crackedToken = {\r\n header: matches[1],\r\n JWSPayload: matches[2],\r\n JWSSig: matches[3]\r\n };\r\n return crackedToken;\r\n };\r\n /**\r\n * Check if a string is empty.\r\n *\r\n * @param str\r\n */\r\n StringUtils.isEmpty = function (str) {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n };\r\n /**\r\n * Check if stringified object is empty\r\n * @param strObj\r\n */\r\n StringUtils.isEmptyObj = function (strObj) {\r\n if (strObj && !StringUtils.isEmpty(strObj)) {\r\n try {\r\n var obj = JSON.parse(strObj);\r\n return Object.keys(obj).length === 0;\r\n }\r\n catch (e) { }\r\n }\r\n return true;\r\n };\r\n StringUtils.startsWith = function (str, search) {\r\n return str.indexOf(search) === 0;\r\n };\r\n StringUtils.endsWith = function (str, search) {\r\n return (str.length >= search.length) && (str.lastIndexOf(search) === (str.length - search.length));\r\n };\r\n /**\r\n * Parses string into an object.\r\n *\r\n * @param query\r\n */\r\n StringUtils.queryStringToObject = function (query) {\r\n var obj = {};\r\n var params = query.split(\"&\");\r\n var decode = function (s) { return decodeURIComponent(s.replace(/\\+/g, \" \")); };\r\n params.forEach(function (pair) {\r\n if (pair.trim()) {\r\n var _a = pair.split(/=(.+)/g, 2), key = _a[0], value = _a[1]; // Split on the first occurence of the '=' character\r\n if (key && value) {\r\n obj[decode(key)] = decode(value);\r\n }\r\n }\r\n });\r\n return obj;\r\n };\r\n /**\r\n * Trims entries in an array.\r\n *\r\n * @param arr\r\n */\r\n StringUtils.trimArrayEntries = function (arr) {\r\n return arr.map(function (entry) { return entry.trim(); });\r\n };\r\n /**\r\n * Removes empty strings from array\r\n * @param arr\r\n */\r\n StringUtils.removeEmptyStringsFromArray = function (arr) {\r\n return arr.filter(function (entry) {\r\n return !StringUtils.isEmpty(entry);\r\n });\r\n };\r\n /**\r\n * Attempts to parse a string into JSON\r\n * @param str\r\n */\r\n StringUtils.jsonParseHelper = function (str) {\r\n try {\r\n return JSON.parse(str);\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n };\r\n /**\r\n * Tests if a given string matches a given pattern, with support for wildcards and queries.\r\n * @param pattern Wildcard pattern to string match. Supports \"*\" for wildcards and \"?\" for queries\r\n * @param input String to match against\r\n */\r\n StringUtils.matchPattern = function (pattern, input) {\r\n /**\r\n * Wildcard support: https://stackoverflow.com/a/3117248/4888559\r\n * Queries: replaces \"?\" in string with escaped \"\\?\" for regex test\r\n */\r\n var regex = new RegExp(pattern.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\*/g, \"[^ ]*\").replace(/\\?/g, \"\\\\\\?\")); // eslint-disable-line security/detect-non-literal-regexp\r\n return regex.test(input);\r\n };\r\n return StringUtils;\r\n}());\n\nexport { StringUtils };\n//# sourceMappingURL=StringUtils.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { Constants } from '../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Log message level.\r\n */\r\nvar LogLevel;\r\n(function (LogLevel) {\r\n LogLevel[LogLevel[\"Error\"] = 0] = \"Error\";\r\n LogLevel[LogLevel[\"Warning\"] = 1] = \"Warning\";\r\n LogLevel[LogLevel[\"Info\"] = 2] = \"Info\";\r\n LogLevel[LogLevel[\"Verbose\"] = 3] = \"Verbose\";\r\n LogLevel[LogLevel[\"Trace\"] = 4] = \"Trace\";\r\n})(LogLevel || (LogLevel = {}));\r\n/**\r\n * Class which facilitates logging of messages to a specific place.\r\n */\r\nvar Logger = /** @class */ (function () {\r\n function Logger(loggerOptions, packageName, packageVersion) {\r\n // Current log level, defaults to info.\r\n this.level = LogLevel.Info;\r\n var defaultLoggerCallback = function () {\r\n return;\r\n };\r\n var setLoggerOptions = loggerOptions || Logger.createDefaultLoggerOptions();\r\n this.localCallback = setLoggerOptions.loggerCallback || defaultLoggerCallback;\r\n this.piiLoggingEnabled = setLoggerOptions.piiLoggingEnabled || false;\r\n this.level = typeof (setLoggerOptions.logLevel) === \"number\" ? setLoggerOptions.logLevel : LogLevel.Info;\r\n this.correlationId = setLoggerOptions.correlationId || Constants.EMPTY_STRING;\r\n this.packageName = packageName || Constants.EMPTY_STRING;\r\n this.packageVersion = packageVersion || Constants.EMPTY_STRING;\r\n }\r\n Logger.createDefaultLoggerOptions = function () {\r\n return {\r\n loggerCallback: function () {\r\n // allow users to not set loggerCallback\r\n },\r\n piiLoggingEnabled: false,\r\n logLevel: LogLevel.Info\r\n };\r\n };\r\n /**\r\n * Create new Logger with existing configurations.\r\n */\r\n Logger.prototype.clone = function (packageName, packageVersion, correlationId) {\r\n return new Logger({ loggerCallback: this.localCallback, piiLoggingEnabled: this.piiLoggingEnabled, logLevel: this.level, correlationId: correlationId || this.correlationId }, packageName, packageVersion);\r\n };\r\n /**\r\n * Log message with required options.\r\n */\r\n Logger.prototype.logMessage = function (logMessage, options) {\r\n if ((options.logLevel > this.level) || (!this.piiLoggingEnabled && options.containsPii)) {\r\n return;\r\n }\r\n var timestamp = new Date().toUTCString();\r\n // Add correlationId to logs if set, correlationId provided on log messages take precedence\r\n var logHeader;\r\n if (!StringUtils.isEmpty(options.correlationId)) {\r\n logHeader = \"[\" + timestamp + \"] : [\" + options.correlationId + \"]\";\r\n }\r\n else if (!StringUtils.isEmpty(this.correlationId)) {\r\n logHeader = \"[\" + timestamp + \"] : [\" + this.correlationId + \"]\";\r\n }\r\n else {\r\n logHeader = \"[\" + timestamp + \"]\";\r\n }\r\n var log = logHeader + \" : \" + this.packageName + \"@\" + this.packageVersion + \" : \" + LogLevel[options.logLevel] + \" - \" + logMessage;\r\n // debug(`msal:${LogLevel[options.logLevel]}${options.containsPii ? \"-Pii\": Constants.EMPTY_STRING}${options.context ? `:${options.context}` : Constants.EMPTY_STRING}`)(logMessage);\r\n this.executeCallback(options.logLevel, log, options.containsPii || false);\r\n };\r\n /**\r\n * Execute callback with message.\r\n */\r\n Logger.prototype.executeCallback = function (level, message, containsPii) {\r\n if (this.localCallback) {\r\n this.localCallback(level, message, containsPii);\r\n }\r\n };\r\n /**\r\n * Logs error messages.\r\n */\r\n Logger.prototype.error = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Error,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs error messages with PII.\r\n */\r\n Logger.prototype.errorPii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Error,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs warning messages.\r\n */\r\n Logger.prototype.warning = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Warning,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs warning messages with PII.\r\n */\r\n Logger.prototype.warningPii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Warning,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs info messages.\r\n */\r\n Logger.prototype.info = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Info,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs info messages with PII.\r\n */\r\n Logger.prototype.infoPii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Info,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs verbose messages.\r\n */\r\n Logger.prototype.verbose = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Verbose,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs verbose messages with PII.\r\n */\r\n Logger.prototype.verbosePii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Verbose,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs trace messages.\r\n */\r\n Logger.prototype.trace = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Trace,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Logs trace messages with PII.\r\n */\r\n Logger.prototype.tracePii = function (message, correlationId) {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Trace,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n };\r\n /**\r\n * Returns whether PII Logging is enabled or not.\r\n */\r\n Logger.prototype.isPiiLoggingEnabled = function () {\r\n return this.piiLoggingEnabled || false;\r\n };\r\n return Logger;\r\n}());\n\nexport { LogLevel, Logger };\n//# sourceMappingURL=Logger.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/* eslint-disable header/header */\r\nvar name = \"@azure/msal-common\";\r\nvar version = \"13.1.0\";\n\nexport { name, version };\n//# sourceMappingURL=packageMetadata.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar AzureCloudInstance;\r\n(function (AzureCloudInstance) {\r\n // AzureCloudInstance is not specified.\r\n AzureCloudInstance[AzureCloudInstance[\"None\"] = 0] = \"None\";\r\n // Microsoft Azure public cloud\r\n AzureCloudInstance[\"AzurePublic\"] = \"https://login.microsoftonline.com\";\r\n // Microsoft PPE\r\n AzureCloudInstance[\"AzurePpe\"] = \"https://login.windows-ppe.net\";\r\n // Microsoft Chinese national cloud\r\n AzureCloudInstance[\"AzureChina\"] = \"https://login.chinacloudapi.cn\";\r\n // Microsoft German national cloud (\"Black Forest\")\r\n AzureCloudInstance[\"AzureGermany\"] = \"https://login.microsoftonline.de\";\r\n // US Government cloud\r\n AzureCloudInstance[\"AzureUsGovernment\"] = \"https://login.microsoftonline.us\";\r\n})(AzureCloudInstance || (AzureCloudInstance = {}));\n\nexport { AzureCloudInstance };\n//# sourceMappingURL=AuthorityOptions.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { ClientAuthError } from './ClientAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ClientConfigurationErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar ClientConfigurationErrorMessage = {\r\n redirectUriNotSet: {\r\n code: \"redirect_uri_empty\",\r\n desc: \"A redirect URI is required for all calls, and none has been set.\"\r\n },\r\n postLogoutUriNotSet: {\r\n code: \"post_logout_uri_empty\",\r\n desc: \"A post logout redirect has not been set.\"\r\n },\r\n claimsRequestParsingError: {\r\n code: \"claims_request_parsing_error\",\r\n desc: \"Could not parse the given claims request object.\"\r\n },\r\n authorityUriInsecure: {\r\n code: \"authority_uri_insecure\",\r\n desc: \"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options\"\r\n },\r\n urlParseError: {\r\n code: \"url_parse_error\",\r\n desc: \"URL could not be parsed into appropriate segments.\"\r\n },\r\n urlEmptyError: {\r\n code: \"empty_url_error\",\r\n desc: \"URL was empty or null.\"\r\n },\r\n emptyScopesError: {\r\n code: \"empty_input_scopes_error\",\r\n desc: \"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.\"\r\n },\r\n nonArrayScopesError: {\r\n code: \"nonarray_input_scopes_error\",\r\n desc: \"Scopes cannot be passed as non-array.\"\r\n },\r\n clientIdSingleScopeError: {\r\n code: \"clientid_input_scopes_error\",\r\n desc: \"Client ID can only be provided as a single scope.\"\r\n },\r\n invalidPrompt: {\r\n code: \"invalid_prompt_value\",\r\n desc: \"Supported prompt values are 'login', 'select_account', 'consent', 'create', 'none' and 'no_session'. Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest\",\r\n },\r\n invalidClaimsRequest: {\r\n code: \"invalid_claims\",\r\n desc: \"Given claims parameter must be a stringified JSON object.\"\r\n },\r\n tokenRequestEmptyError: {\r\n code: \"token_request_empty\",\r\n desc: \"Token request was empty and not found in cache.\"\r\n },\r\n logoutRequestEmptyError: {\r\n code: \"logout_request_empty\",\r\n desc: \"The logout request was null or undefined.\"\r\n },\r\n invalidCodeChallengeMethod: {\r\n code: \"invalid_code_challenge_method\",\r\n desc: \"code_challenge_method passed is invalid. Valid values are \\\"plain\\\" and \\\"S256\\\".\"\r\n },\r\n invalidCodeChallengeParams: {\r\n code: \"pkce_params_missing\",\r\n desc: \"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request\"\r\n },\r\n invalidCloudDiscoveryMetadata: {\r\n code: \"invalid_cloud_discovery_metadata\",\r\n desc: \"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields\"\r\n },\r\n invalidAuthorityMetadata: {\r\n code: \"invalid_authority_metadata\",\r\n desc: \"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.\"\r\n },\r\n untrustedAuthority: {\r\n code: \"untrusted_authority\",\r\n desc: \"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.\"\r\n },\r\n invalidAzureCloudInstance: {\r\n code: \"invalid_azure_cloud_instance\",\r\n desc: \"Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values\"\r\n },\r\n missingSshJwk: {\r\n code: \"missing_ssh_jwk\",\r\n desc: \"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.\"\r\n },\r\n missingSshKid: {\r\n code: \"missing_ssh_kid\",\r\n desc: \"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.\"\r\n },\r\n missingNonceAuthenticationHeader: {\r\n code: \"missing_nonce_authentication_header\",\r\n desc: \"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.\"\r\n },\r\n invalidAuthenticationHeader: {\r\n code: \"invalid_authentication_header\",\r\n desc: \"Invalid authentication header provided\"\r\n },\r\n authorityMismatch: {\r\n code: \"authority_mismatch\",\r\n desc: \"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.\"\r\n }\r\n};\r\n/**\r\n * Error thrown when there is an error in configuration of the MSAL.js library.\r\n */\r\nvar ClientConfigurationError = /** @class */ (function (_super) {\r\n __extends(ClientConfigurationError, _super);\r\n function ClientConfigurationError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n _this.name = \"ClientConfigurationError\";\r\n Object.setPrototypeOf(_this, ClientConfigurationError.prototype);\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when the redirect uri is empty (not set by caller)\r\n */\r\n ClientConfigurationError.createRedirectUriEmptyError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.redirectUriNotSet.code, ClientConfigurationErrorMessage.redirectUriNotSet.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the post-logout redirect uri is empty (not set by caller)\r\n */\r\n ClientConfigurationError.createPostLogoutRedirectUriEmptyError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.postLogoutUriNotSet.code, ClientConfigurationErrorMessage.postLogoutUriNotSet.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the claims request could not be successfully parsed\r\n */\r\n ClientConfigurationError.createClaimsRequestParsingError = function (claimsRequestParseError) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.claimsRequestParsingError.code, ClientConfigurationErrorMessage.claimsRequestParsingError.desc + \" Given value: \" + claimsRequestParseError);\r\n };\r\n /**\r\n * Creates an error thrown if authority uri is given an insecure protocol.\r\n * @param urlString\r\n */\r\n ClientConfigurationError.createInsecureAuthorityUriError = function (urlString) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityUriInsecure.code, ClientConfigurationErrorMessage.authorityUriInsecure.desc + \" Given URI: \" + urlString);\r\n };\r\n /**\r\n * Creates an error thrown if URL string does not parse into separate segments.\r\n * @param urlString\r\n */\r\n ClientConfigurationError.createUrlParseError = function (urlParseError) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.urlParseError.code, ClientConfigurationErrorMessage.urlParseError.desc + \" Given Error: \" + urlParseError);\r\n };\r\n /**\r\n * Creates an error thrown if URL string is empty or null.\r\n * @param urlString\r\n */\r\n ClientConfigurationError.createUrlEmptyError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.urlEmptyError.code, ClientConfigurationErrorMessage.urlEmptyError.desc);\r\n };\r\n /**\r\n * Error thrown when scopes are empty.\r\n * @param scopesValue\r\n */\r\n ClientConfigurationError.createEmptyScopesArrayError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.emptyScopesError.code, \"\" + ClientConfigurationErrorMessage.emptyScopesError.desc);\r\n };\r\n /**\r\n * Error thrown when client id scope is not provided as single scope.\r\n * @param inputScopes\r\n */\r\n ClientConfigurationError.createClientIdSingleScopeError = function (inputScopes) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.clientIdSingleScopeError.code, ClientConfigurationErrorMessage.clientIdSingleScopeError.desc + \" Given Scopes: \" + inputScopes);\r\n };\r\n /**\r\n * Error thrown when prompt is not an allowed type.\r\n * @param promptValue\r\n */\r\n ClientConfigurationError.createInvalidPromptError = function (promptValue) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidPrompt.code, ClientConfigurationErrorMessage.invalidPrompt.desc + \" Given value: \" + promptValue);\r\n };\r\n /**\r\n * Creates error thrown when claims parameter is not a stringified JSON object\r\n */\r\n ClientConfigurationError.createInvalidClaimsRequestError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidClaimsRequest.code, ClientConfigurationErrorMessage.invalidClaimsRequest.desc);\r\n };\r\n /**\r\n * Throws error when token request is empty and nothing cached in storage.\r\n */\r\n ClientConfigurationError.createEmptyLogoutRequestError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.logoutRequestEmptyError.code, ClientConfigurationErrorMessage.logoutRequestEmptyError.desc);\r\n };\r\n /**\r\n * Throws error when token request is empty and nothing cached in storage.\r\n */\r\n ClientConfigurationError.createEmptyTokenRequestError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.tokenRequestEmptyError.code, ClientConfigurationErrorMessage.tokenRequestEmptyError.desc);\r\n };\r\n /**\r\n * Throws error when an invalid code_challenge_method is passed by the user\r\n */\r\n ClientConfigurationError.createInvalidCodeChallengeMethodError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidCodeChallengeMethod.code, ClientConfigurationErrorMessage.invalidCodeChallengeMethod.desc);\r\n };\r\n /**\r\n * Throws error when both params: code_challenge and code_challenge_method are not passed together\r\n */\r\n ClientConfigurationError.createInvalidCodeChallengeParamsError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidCodeChallengeParams.code, ClientConfigurationErrorMessage.invalidCodeChallengeParams.desc);\r\n };\r\n /**\r\n * Throws an error when the user passes invalid cloudDiscoveryMetadata\r\n */\r\n ClientConfigurationError.createInvalidCloudDiscoveryMetadataError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidCloudDiscoveryMetadata.code, ClientConfigurationErrorMessage.invalidCloudDiscoveryMetadata.desc);\r\n };\r\n /**\r\n * Throws an error when the user passes invalid cloudDiscoveryMetadata\r\n */\r\n ClientConfigurationError.createInvalidAuthorityMetadataError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthorityMetadata.code, ClientConfigurationErrorMessage.invalidAuthorityMetadata.desc);\r\n };\r\n /**\r\n * Throws error when provided authority is not a member of the trusted host list\r\n */\r\n ClientConfigurationError.createUntrustedAuthorityError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.untrustedAuthority.code, ClientConfigurationErrorMessage.untrustedAuthority.desc);\r\n };\r\n /**\r\n * Throws error when the AzureCloudInstance is set to an invalid value\r\n */\r\n ClientConfigurationError.createInvalidAzureCloudInstanceError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAzureCloudInstance.code, ClientConfigurationErrorMessage.invalidAzureCloudInstance.desc);\r\n };\r\n /**\r\n * Throws an error when the authentication scheme is set to SSH but the SSH public key is omitted from the request\r\n */\r\n ClientConfigurationError.createMissingSshJwkError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.missingSshJwk.code, ClientConfigurationErrorMessage.missingSshJwk.desc);\r\n };\r\n /**\r\n * Throws an error when the authentication scheme is set to SSH but the SSH public key ID is omitted from the request\r\n */\r\n ClientConfigurationError.createMissingSshKidError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.missingSshKid.code, ClientConfigurationErrorMessage.missingSshKid.desc);\r\n };\r\n /**\r\n * Throws error when provided headers don't contain a header that a server nonce can be extracted from\r\n */\r\n ClientConfigurationError.createMissingNonceAuthenticationHeadersError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.missingNonceAuthenticationHeader.code, ClientConfigurationErrorMessage.missingNonceAuthenticationHeader.desc);\r\n };\r\n /**\r\n * Throws error when a provided header is invalid in any way\r\n */\r\n ClientConfigurationError.createInvalidAuthenticationHeaderError = function (invalidHeaderName, details) {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc + \". Invalid header: \" + invalidHeaderName + \". Details: \" + details);\r\n };\r\n /**\r\n * Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.\r\n */\r\n ClientConfigurationError.createAuthorityMismatchError = function () {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityMismatch.code, ClientConfigurationErrorMessage.authorityMismatch.desc);\r\n };\r\n return ClientConfigurationError;\r\n}(ClientAuthError));\n\nexport { ClientConfigurationError, ClientConfigurationErrorMessage };\n//# sourceMappingURL=ClientConfigurationError.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __spreadArrays } from '../_virtual/_tslib.js';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { Constants, OIDC_SCOPES } from '../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes\r\n * the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions\r\n * to ensure uniqueness of strings.\r\n */\r\nvar ScopeSet = /** @class */ (function () {\r\n function ScopeSet(inputScopes) {\r\n var _this = this;\r\n // Filter empty string and null/undefined array items\r\n var scopeArr = inputScopes ? StringUtils.trimArrayEntries(__spreadArrays(inputScopes)) : [];\r\n var filteredInput = scopeArr ? StringUtils.removeEmptyStringsFromArray(scopeArr) : [];\r\n // Validate and filter scopes (validate function throws if validation fails)\r\n this.validateInputScopes(filteredInput);\r\n this.scopes = new Set(); // Iterator in constructor not supported by IE11\r\n filteredInput.forEach(function (scope) { return _this.scopes.add(scope); });\r\n }\r\n /**\r\n * Factory method to create ScopeSet from space-delimited string\r\n * @param inputScopeString\r\n * @param appClientId\r\n * @param scopesRequired\r\n */\r\n ScopeSet.fromString = function (inputScopeString) {\r\n var scopeString = inputScopeString || Constants.EMPTY_STRING;\r\n var inputScopes = scopeString.split(\" \");\r\n return new ScopeSet(inputScopes);\r\n };\r\n /**\r\n * Creates the set of scopes to search for in cache lookups\r\n * @param inputScopeString\r\n * @returns\r\n */\r\n ScopeSet.createSearchScopes = function (inputScopeString) {\r\n var scopeSet = new ScopeSet(inputScopeString);\r\n if (!scopeSet.containsOnlyOIDCScopes()) {\r\n scopeSet.removeOIDCScopes();\r\n }\r\n else {\r\n scopeSet.removeScope(Constants.OFFLINE_ACCESS_SCOPE);\r\n }\r\n return scopeSet;\r\n };\r\n /**\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not\r\n */\r\n ScopeSet.prototype.validateInputScopes = function (inputScopes) {\r\n // Check if scopes are required but not given or is an empty array\r\n if (!inputScopes || inputScopes.length < 1) {\r\n throw ClientConfigurationError.createEmptyScopesArrayError();\r\n }\r\n };\r\n /**\r\n * Check if a given scope is present in this set of scopes.\r\n * @param scope\r\n */\r\n ScopeSet.prototype.containsScope = function (scope) {\r\n var lowerCaseScopes = this.printScopesLowerCase().split(\" \");\r\n var lowerCaseScopesSet = new ScopeSet(lowerCaseScopes);\r\n // compare lowercase scopes\r\n return !StringUtils.isEmpty(scope) ? lowerCaseScopesSet.scopes.has(scope.toLowerCase()) : false;\r\n };\r\n /**\r\n * Check if a set of scopes is present in this set of scopes.\r\n * @param scopeSet\r\n */\r\n ScopeSet.prototype.containsScopeSet = function (scopeSet) {\r\n var _this = this;\r\n if (!scopeSet || scopeSet.scopes.size <= 0) {\r\n return false;\r\n }\r\n return (this.scopes.size >= scopeSet.scopes.size && scopeSet.asArray().every(function (scope) { return _this.containsScope(scope); }));\r\n };\r\n /**\r\n * Check if set of scopes contains only the defaults\r\n */\r\n ScopeSet.prototype.containsOnlyOIDCScopes = function () {\r\n var _this = this;\r\n var defaultScopeCount = 0;\r\n OIDC_SCOPES.forEach(function (defaultScope) {\r\n if (_this.containsScope(defaultScope)) {\r\n defaultScopeCount += 1;\r\n }\r\n });\r\n return this.scopes.size === defaultScopeCount;\r\n };\r\n /**\r\n * Appends single scope if passed\r\n * @param newScope\r\n */\r\n ScopeSet.prototype.appendScope = function (newScope) {\r\n if (!StringUtils.isEmpty(newScope)) {\r\n this.scopes.add(newScope.trim());\r\n }\r\n };\r\n /**\r\n * Appends multiple scopes if passed\r\n * @param newScopes\r\n */\r\n ScopeSet.prototype.appendScopes = function (newScopes) {\r\n var _this = this;\r\n try {\r\n newScopes.forEach(function (newScope) { return _this.appendScope(newScope); });\r\n }\r\n catch (e) {\r\n throw ClientAuthError.createAppendScopeSetError(e);\r\n }\r\n };\r\n /**\r\n * Removes element from set of scopes.\r\n * @param scope\r\n */\r\n ScopeSet.prototype.removeScope = function (scope) {\r\n if (StringUtils.isEmpty(scope)) {\r\n throw ClientAuthError.createRemoveEmptyScopeFromSetError(scope);\r\n }\r\n this.scopes.delete(scope.trim());\r\n };\r\n /**\r\n * Removes default scopes from set of scopes\r\n * Primarily used to prevent cache misses if the default scopes are not returned from the server\r\n */\r\n ScopeSet.prototype.removeOIDCScopes = function () {\r\n var _this = this;\r\n OIDC_SCOPES.forEach(function (defaultScope) {\r\n _this.scopes.delete(defaultScope);\r\n });\r\n };\r\n /**\r\n * Combines an array of scopes with the current set of scopes.\r\n * @param otherScopes\r\n */\r\n ScopeSet.prototype.unionScopeSets = function (otherScopes) {\r\n if (!otherScopes) {\r\n throw ClientAuthError.createEmptyInputScopeSetError();\r\n }\r\n var unionScopes = new Set(); // Iterator in constructor not supported in IE11\r\n otherScopes.scopes.forEach(function (scope) { return unionScopes.add(scope.toLowerCase()); });\r\n this.scopes.forEach(function (scope) { return unionScopes.add(scope.toLowerCase()); });\r\n return unionScopes;\r\n };\r\n /**\r\n * Check if scopes intersect between this set and another.\r\n * @param otherScopes\r\n */\r\n ScopeSet.prototype.intersectingScopeSets = function (otherScopes) {\r\n if (!otherScopes) {\r\n throw ClientAuthError.createEmptyInputScopeSetError();\r\n }\r\n // Do not allow OIDC scopes to be the only intersecting scopes\r\n if (!otherScopes.containsOnlyOIDCScopes()) {\r\n otherScopes.removeOIDCScopes();\r\n }\r\n var unionScopes = this.unionScopeSets(otherScopes);\r\n var sizeOtherScopes = otherScopes.getScopeCount();\r\n var sizeThisScopes = this.getScopeCount();\r\n var sizeUnionScopes = unionScopes.size;\r\n return sizeUnionScopes < (sizeThisScopes + sizeOtherScopes);\r\n };\r\n /**\r\n * Returns size of set of scopes.\r\n */\r\n ScopeSet.prototype.getScopeCount = function () {\r\n return this.scopes.size;\r\n };\r\n /**\r\n * Returns the scopes as an array of string values\r\n */\r\n ScopeSet.prototype.asArray = function () {\r\n var array = [];\r\n this.scopes.forEach(function (val) { return array.push(val); });\r\n return array;\r\n };\r\n /**\r\n * Prints scopes into a space-delimited string\r\n */\r\n ScopeSet.prototype.printScopes = function () {\r\n if (this.scopes) {\r\n var scopeArr = this.asArray();\r\n return scopeArr.join(\" \");\r\n }\r\n return Constants.EMPTY_STRING;\r\n };\r\n /**\r\n * Prints scopes into a space-delimited lower-case string (used for caching)\r\n */\r\n ScopeSet.prototype.printScopesLowerCase = function () {\r\n return this.printScopes().toLowerCase();\r\n };\r\n return ScopeSet;\r\n}());\n\nexport { ScopeSet };\n//# sourceMappingURL=ScopeSet.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { Separators, Constants } from '../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Function to build a client info object from server clientInfo string\r\n * @param rawClientInfo\r\n * @param crypto\r\n */\r\nfunction buildClientInfo(rawClientInfo, crypto) {\r\n if (StringUtils.isEmpty(rawClientInfo)) {\r\n throw ClientAuthError.createClientInfoEmptyError();\r\n }\r\n try {\r\n var decodedClientInfo = crypto.base64Decode(rawClientInfo);\r\n return JSON.parse(decodedClientInfo);\r\n }\r\n catch (e) {\r\n throw ClientAuthError.createClientInfoDecodingError(e.message);\r\n }\r\n}\r\n/**\r\n * Function to build a client info object from cached homeAccountId string\r\n * @param homeAccountId\r\n */\r\nfunction buildClientInfoFromHomeAccountId(homeAccountId) {\r\n if (StringUtils.isEmpty(homeAccountId)) {\r\n throw ClientAuthError.createClientInfoDecodingError(\"Home account ID was empty.\");\r\n }\r\n var clientInfoParts = homeAccountId.split(Separators.CLIENT_INFO_SEPARATOR, 2);\r\n return {\r\n uid: clientInfoParts[0],\r\n utid: clientInfoParts.length < 2 ? Constants.EMPTY_STRING : clientInfoParts[1]\r\n };\r\n}\n\nexport { buildClientInfo, buildClientInfoFromHomeAccountId };\n//# sourceMappingURL=ClientInfo.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Authority types supported by MSAL.\r\n */\r\nvar AuthorityType;\r\n(function (AuthorityType) {\r\n AuthorityType[AuthorityType[\"Default\"] = 0] = \"Default\";\r\n AuthorityType[AuthorityType[\"Adfs\"] = 1] = \"Adfs\";\r\n AuthorityType[AuthorityType[\"Dsts\"] = 2] = \"Dsts\";\r\n AuthorityType[AuthorityType[\"Ciam\"] = 3] = \"Ciam\";\r\n})(AuthorityType || (AuthorityType = {}));\n\nexport { AuthorityType };\n//# sourceMappingURL=AuthorityType.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { Separators, CacheAccountType, CacheType, Constants } from '../../utils/Constants.js';\nimport { buildClientInfo } from '../../account/ClientInfo.js';\nimport { StringUtils } from '../../utils/StringUtils.js';\nimport { ClientAuthError } from '../../error/ClientAuthError.js';\nimport { AuthorityType } from '../../authority/AuthorityType.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).\r\n *\r\n * Key : Value Schema\r\n *\r\n * Key: --\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * localAccountId: Original tenant-specific accountID, usually used for legacy cases\r\n * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt\r\n * authorityType: Accounts authority type as a string\r\n * name: Full name for the account, including given name and family name,\r\n * clientInfo: Full base64 encoded client info received from ESTS\r\n * lastModificationTime: last time this entity was modified in the cache\r\n * lastModificationApp:\r\n * idTokenClaims: Object containing claims parsed from ID token\r\n * nativeAccountId: Account identifier on the native device\r\n * }\r\n */\r\nvar AccountEntity = /** @class */ (function () {\r\n function AccountEntity() {\r\n }\r\n /**\r\n * Generate Account Id key component as per the schema: -\r\n */\r\n AccountEntity.prototype.generateAccountId = function () {\r\n var accountId = [this.homeAccountId, this.environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Generate Account Cache Key as per the schema: --\r\n */\r\n AccountEntity.prototype.generateAccountKey = function () {\r\n return AccountEntity.generateAccountCacheKey({\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId\r\n });\r\n };\r\n /**\r\n * returns the type of the cache (in this case account)\r\n */\r\n AccountEntity.prototype.generateType = function () {\r\n switch (this.authorityType) {\r\n case CacheAccountType.ADFS_ACCOUNT_TYPE:\r\n return CacheType.ADFS;\r\n case CacheAccountType.MSAV1_ACCOUNT_TYPE:\r\n return CacheType.MSA;\r\n case CacheAccountType.MSSTS_ACCOUNT_TYPE:\r\n return CacheType.MSSTS;\r\n case CacheAccountType.GENERIC_ACCOUNT_TYPE:\r\n return CacheType.GENERIC;\r\n default: {\r\n throw ClientAuthError.createUnexpectedAccountTypeError();\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the AccountInfo interface for this account.\r\n */\r\n AccountEntity.prototype.getAccountInfo = function () {\r\n return {\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId,\r\n name: this.name,\r\n idTokenClaims: this.idTokenClaims,\r\n nativeAccountId: this.nativeAccountId\r\n };\r\n };\r\n /**\r\n * Generates account key from interface\r\n * @param accountInterface\r\n */\r\n AccountEntity.generateAccountCacheKey = function (accountInterface) {\r\n var accountKey = [\r\n accountInterface.homeAccountId,\r\n accountInterface.environment || Constants.EMPTY_STRING,\r\n accountInterface.tenantId || Constants.EMPTY_STRING,\r\n ];\r\n return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.\r\n * @param clientInfo\r\n * @param authority\r\n * @param idToken\r\n * @param policy\r\n */\r\n AccountEntity.createAccount = function (clientInfo, homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment, nativeAccountId) {\r\n var _a, _b, _c, _d, _e, _f;\r\n var account = new AccountEntity();\r\n account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;\r\n account.clientInfo = clientInfo;\r\n account.homeAccountId = homeAccountId;\r\n account.nativeAccountId = nativeAccountId;\r\n var env = environment || (authority && authority.getPreferredCache());\r\n if (!env) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n account.environment = env;\r\n // non AAD scenarios can have empty realm\r\n account.realm = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.tid) || Constants.EMPTY_STRING;\r\n if (idToken) {\r\n account.idTokenClaims = idToken.claims;\r\n // How do you account for MSA CID here?\r\n account.localAccountId = ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.oid) || ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.sub) || Constants.EMPTY_STRING;\r\n /*\r\n * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.\r\n * In most cases it will contain a single email. This field should not be relied upon if a custom\r\n * policy is configured to return more than 1 email.\r\n */\r\n var preferredUsername = (_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.preferred_username;\r\n var email = ((_e = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _e === void 0 ? void 0 : _e.emails) ? idToken.claims.emails[0] : null;\r\n account.username = preferredUsername || email || Constants.EMPTY_STRING;\r\n account.name = (_f = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _f === void 0 ? void 0 : _f.name;\r\n }\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n return account;\r\n };\r\n /**\r\n * Builds non-AAD/ADFS account.\r\n * @param authority\r\n * @param idToken\r\n */\r\n AccountEntity.createGenericAccount = function (homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment) {\r\n var _a, _b, _c, _d;\r\n var account = new AccountEntity();\r\n account.authorityType = (authority &&\r\n authority.authorityType === AuthorityType.Adfs) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;\r\n account.homeAccountId = homeAccountId;\r\n // non AAD scenarios can have empty realm\r\n account.realm = Constants.EMPTY_STRING;\r\n var env = environment || authority && authority.getPreferredCache();\r\n if (!env) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n if (idToken) {\r\n // How do you account for MSA CID here?\r\n account.localAccountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.oid) || ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.sub) || Constants.EMPTY_STRING;\r\n // upn claim for most ADFS scenarios\r\n account.username = ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.upn) || Constants.EMPTY_STRING;\r\n account.name = ((_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.name) || Constants.EMPTY_STRING;\r\n account.idTokenClaims = idToken === null || idToken === void 0 ? void 0 : idToken.claims;\r\n }\r\n account.environment = env;\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n /*\r\n * add uniqueName to claims\r\n * account.name = idToken.claims.uniqueName;\r\n */\r\n return account;\r\n };\r\n /**\r\n * Generate HomeAccountId from server response\r\n * @param serverClientInfo\r\n * @param authType\r\n */\r\n AccountEntity.generateHomeAccountId = function (serverClientInfo, authType, logger, cryptoObj, idToken) {\r\n var _a;\r\n var accountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.sub) ? idToken.claims.sub : Constants.EMPTY_STRING;\r\n // since ADFS does not have tid and does not set client_info\r\n if (authType === AuthorityType.Adfs || authType === AuthorityType.Dsts) {\r\n return accountId;\r\n }\r\n // for cases where there is clientInfo\r\n if (serverClientInfo) {\r\n try {\r\n var clientInfo = buildClientInfo(serverClientInfo, cryptoObj);\r\n if (!StringUtils.isEmpty(clientInfo.uid) && !StringUtils.isEmpty(clientInfo.utid)) {\r\n return \"\" + clientInfo.uid + Separators.CLIENT_INFO_SEPARATOR + clientInfo.utid;\r\n }\r\n }\r\n catch (e) { }\r\n }\r\n // default to \"sub\" claim\r\n logger.verbose(\"No client info in response\");\r\n return accountId;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n AccountEntity.isAccountEntity = function (entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"localAccountId\") &&\r\n entity.hasOwnProperty(\"username\") &&\r\n entity.hasOwnProperty(\"authorityType\"));\r\n };\r\n /**\r\n * Helper function to determine whether 2 accountInfo objects represent the same account\r\n * @param accountA\r\n * @param accountB\r\n * @param compareClaims - If set to true idTokenClaims will also be compared to determine account equality\r\n */\r\n AccountEntity.accountInfoIsEqual = function (accountA, accountB, compareClaims) {\r\n if (!accountA || !accountB) {\r\n return false;\r\n }\r\n var claimsMatch = true; // default to true so as to not fail comparison below if compareClaims: false\r\n if (compareClaims) {\r\n var accountAClaims = (accountA.idTokenClaims || {});\r\n var accountBClaims = (accountB.idTokenClaims || {});\r\n // issued at timestamp and nonce are expected to change each time a new id token is acquired\r\n claimsMatch = (accountAClaims.iat === accountBClaims.iat) &&\r\n (accountAClaims.nonce === accountBClaims.nonce);\r\n }\r\n return (accountA.homeAccountId === accountB.homeAccountId) &&\r\n (accountA.localAccountId === accountB.localAccountId) &&\r\n (accountA.username === accountB.username) &&\r\n (accountA.tenantId === accountB.tenantId) &&\r\n (accountA.environment === accountB.environment) &&\r\n (accountA.nativeAccountId === accountB.nativeAccountId) &&\r\n claimsMatch;\r\n };\r\n return AccountEntity;\r\n}());\n\nexport { AccountEntity };\n//# sourceMappingURL=AccountEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { StringUtils } from '../utils/StringUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * JWT Token representation class. Parses token string and generates claims object.\r\n */\r\nvar AuthToken = /** @class */ (function () {\r\n function AuthToken(rawToken, crypto) {\r\n if (StringUtils.isEmpty(rawToken)) {\r\n throw ClientAuthError.createTokenNullOrEmptyError(rawToken);\r\n }\r\n this.rawToken = rawToken;\r\n this.claims = AuthToken.extractTokenClaims(rawToken, crypto);\r\n }\r\n /**\r\n * Extract token by decoding the rawToken\r\n *\r\n * @param encodedToken\r\n */\r\n AuthToken.extractTokenClaims = function (encodedToken, crypto) {\r\n var decodedToken = StringUtils.decodeAuthToken(encodedToken);\r\n // token will be decoded to get the username\r\n try {\r\n var base64TokenPayload = decodedToken.JWSPayload;\r\n // base64Decode() should throw an error if there is an issue\r\n var base64Decoded = crypto.base64Decode(base64TokenPayload);\r\n return JSON.parse(base64Decoded);\r\n }\r\n catch (err) {\r\n throw ClientAuthError.createTokenParsingError(err);\r\n }\r\n };\r\n /**\r\n * Determine if the token's max_age has transpired\r\n */\r\n AuthToken.checkMaxAge = function (authTime, maxAge) {\r\n /*\r\n * per https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest\r\n * To force an immediate re-authentication: If an app requires that a user re-authenticate prior to access,\r\n * provide a value of 0 for the max_age parameter and the AS will force a fresh login.\r\n */\r\n var fiveMinuteSkew = 300000; // five minutes in milliseconds\r\n if ((maxAge === 0) || ((Date.now() - fiveMinuteSkew) > (authTime + maxAge))) {\r\n throw ClientAuthError.createMaxAgeTranspiredError();\r\n }\r\n };\r\n return AuthToken;\r\n}());\n\nexport { AuthToken };\n//# sourceMappingURL=AuthToken.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator, __assign, __extends } from '../_virtual/_tslib.js';\nimport { Separators, CredentialType, AuthenticationScheme, THE_FAMILY_ID, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../utils/Constants.js';\nimport { ScopeSet } from '../request/ScopeSet.js';\nimport { AccountEntity } from './entities/AccountEntity.js';\nimport { AuthError } from '../error/AuthError.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { AuthToken } from '../account/AuthToken.js';\nimport { name, version } from '../packageMetadata.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.\r\n */\r\nvar CacheManager = /** @class */ (function () {\r\n function CacheManager(clientId, cryptoImpl, logger) {\r\n this.clientId = clientId;\r\n this.cryptoImpl = cryptoImpl;\r\n this.commonLogger = logger.clone(name, version);\r\n }\r\n /**\r\n * Returns all accounts in cache\r\n */\r\n CacheManager.prototype.getAllAccounts = function () {\r\n var _this = this;\r\n var allAccountKeys = this.getAccountKeys();\r\n if (allAccountKeys.length < 1) {\r\n return [];\r\n }\r\n var accountEntities = allAccountKeys.reduce(function (accounts, key) {\r\n var entity = _this.getAccount(key);\r\n if (!entity) {\r\n return accounts;\r\n }\r\n accounts.push(entity);\r\n return accounts;\r\n }, []);\r\n if (accountEntities.length < 1) {\r\n return [];\r\n }\r\n else {\r\n var allAccounts = accountEntities.map(function (accountEntity) {\r\n return _this.getAccountInfoFromEntity(accountEntity);\r\n });\r\n return allAccounts;\r\n }\r\n };\r\n /**\r\n * Gets accountInfo object based on provided filters\r\n */\r\n CacheManager.prototype.getAccountInfoFilteredBy = function (accountFilter) {\r\n var allAccounts = this.getAccountsFilteredBy(accountFilter);\r\n if (allAccounts.length > 0) {\r\n return this.getAccountInfoFromEntity(allAccounts[0]);\r\n }\r\n else {\r\n return null;\r\n }\r\n };\r\n CacheManager.prototype.getAccountInfoFromEntity = function (accountEntity) {\r\n var accountInfo = accountEntity.getAccountInfo();\r\n var idToken = this.getIdToken(accountInfo);\r\n if (idToken) {\r\n accountInfo.idToken = idToken.secret;\r\n accountInfo.idTokenClaims = new AuthToken(idToken.secret, this.cryptoImpl).claims;\r\n }\r\n return accountInfo;\r\n };\r\n /**\r\n * saves a cache record\r\n * @param cacheRecord\r\n */\r\n CacheManager.prototype.saveCacheRecord = function (cacheRecord) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!cacheRecord) {\r\n throw ClientAuthError.createNullOrUndefinedCacheRecord();\r\n }\r\n if (!!cacheRecord.account) {\r\n this.setAccount(cacheRecord.account);\r\n }\r\n if (!!cacheRecord.idToken) {\r\n this.setIdTokenCredential(cacheRecord.idToken);\r\n }\r\n if (!!!cacheRecord.accessToken) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.saveAccessToken(cacheRecord.accessToken)];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n if (!!cacheRecord.refreshToken) {\r\n this.setRefreshTokenCredential(cacheRecord.refreshToken);\r\n }\r\n if (!!cacheRecord.appMetadata) {\r\n this.setAppMetadata(cacheRecord.appMetadata);\r\n }\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * saves access token credential\r\n * @param credential\r\n */\r\n CacheManager.prototype.saveAccessToken = function (credential) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var accessTokenFilter, tokenKeys, currentScopes, removedAccessTokens;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n accessTokenFilter = {\r\n clientId: credential.clientId,\r\n credentialType: credential.credentialType,\r\n environment: credential.environment,\r\n homeAccountId: credential.homeAccountId,\r\n realm: credential.realm,\r\n tokenType: credential.tokenType,\r\n requestedClaimsHash: credential.requestedClaimsHash\r\n };\r\n tokenKeys = this.getTokenKeys();\r\n currentScopes = ScopeSet.fromString(credential.target);\r\n removedAccessTokens = [];\r\n tokenKeys.accessToken.forEach(function (key) {\r\n if (!_this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {\r\n return;\r\n }\r\n var tokenEntity = _this.getAccessTokenCredential(key);\r\n if (tokenEntity && _this.credentialMatchesFilter(tokenEntity, accessTokenFilter)) {\r\n var tokenScopeSet = ScopeSet.fromString(tokenEntity.target);\r\n if (tokenScopeSet.intersectingScopeSets(currentScopes)) {\r\n removedAccessTokens.push(_this.removeAccessToken(key));\r\n }\r\n }\r\n });\r\n return [4 /*yield*/, Promise.all(removedAccessTokens)];\r\n case 1:\r\n _a.sent();\r\n this.setAccessTokenCredential(credential);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\r\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\r\n * @param homeAccountId\r\n * @param environment\r\n * @param realm\r\n */\r\n CacheManager.prototype.getAccountsFilteredBy = function (accountFilter) {\r\n var _this = this;\r\n var allAccountKeys = this.getAccountKeys();\r\n var matchingAccounts = [];\r\n allAccountKeys.forEach(function (cacheKey) {\r\n if (!_this.isAccountKey(cacheKey, accountFilter.homeAccountId, accountFilter.realm)) {\r\n // Don't parse value if the key doesn't match the account filters\r\n return;\r\n }\r\n var entity = _this.getAccount(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n if (!!accountFilter.homeAccountId && !_this.matchHomeAccountId(entity, accountFilter.homeAccountId)) {\r\n return;\r\n }\r\n if (!!accountFilter.localAccountId && !_this.matchLocalAccountId(entity, accountFilter.localAccountId)) {\r\n return;\r\n }\r\n if (!!accountFilter.username && !_this.matchUsername(entity, accountFilter.username)) {\r\n return;\r\n }\r\n if (!!accountFilter.environment && !_this.matchEnvironment(entity, accountFilter.environment)) {\r\n return;\r\n }\r\n if (!!accountFilter.realm && !_this.matchRealm(entity, accountFilter.realm)) {\r\n return;\r\n }\r\n if (!!accountFilter.nativeAccountId && !_this.matchNativeAccountId(entity, accountFilter.nativeAccountId)) {\r\n return;\r\n }\r\n matchingAccounts.push(entity);\r\n });\r\n return matchingAccounts;\r\n };\r\n /**\r\n * Returns true if the given key matches our account key schema. Also matches homeAccountId and/or tenantId if provided\r\n * @param key\r\n * @param homeAccountId\r\n * @param tenantId\r\n * @returns\r\n */\r\n CacheManager.prototype.isAccountKey = function (key, homeAccountId, tenantId) {\r\n if (key.split(Separators.CACHE_KEY_SEPARATOR).length < 3) {\r\n // Account cache keys contain 3 items separated by '-' (each item may also contain '-')\r\n return false;\r\n }\r\n if (homeAccountId && !key.toLowerCase().includes(homeAccountId.toLowerCase())) {\r\n return false;\r\n }\r\n if (tenantId && !key.toLowerCase().includes(tenantId.toLowerCase())) {\r\n return false;\r\n }\r\n // Do not check environment as aliasing can cause false negatives\r\n return true;\r\n };\r\n /**\r\n * Returns true if the given key matches our credential key schema.\r\n * @param key\r\n */\r\n CacheManager.prototype.isCredentialKey = function (key) {\r\n if (key.split(Separators.CACHE_KEY_SEPARATOR).length < 6) {\r\n // Credential cache keys contain 6 items separated by '-' (each item may also contain '-')\r\n return false;\r\n }\r\n var lowerCaseKey = key.toLowerCase();\r\n // Credential keys must indicate what credential type they represent\r\n if (lowerCaseKey.indexOf(CredentialType.ID_TOKEN.toLowerCase()) === -1 &&\r\n lowerCaseKey.indexOf(CredentialType.ACCESS_TOKEN.toLowerCase()) === -1 &&\r\n lowerCaseKey.indexOf(CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) === -1 &&\r\n lowerCaseKey.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (lowerCaseKey.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) > -1) {\r\n // Refresh tokens must contain the client id or family id\r\n var clientIdValidation = \"\" + CredentialType.REFRESH_TOKEN + Separators.CACHE_KEY_SEPARATOR + this.clientId + Separators.CACHE_KEY_SEPARATOR;\r\n var familyIdValidation = \"\" + CredentialType.REFRESH_TOKEN + Separators.CACHE_KEY_SEPARATOR + THE_FAMILY_ID + Separators.CACHE_KEY_SEPARATOR;\r\n if (lowerCaseKey.indexOf(clientIdValidation.toLowerCase()) === -1 && lowerCaseKey.indexOf(familyIdValidation.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n }\r\n else if (lowerCaseKey.indexOf(this.clientId.toLowerCase()) === -1) {\r\n // Tokens must contain the clientId\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Returns whether or not the given credential entity matches the filter\r\n * @param entity\r\n * @param filter\r\n * @returns\r\n */\r\n CacheManager.prototype.credentialMatchesFilter = function (entity, filter) {\r\n if (!!filter.clientId && !this.matchClientId(entity, filter.clientId)) {\r\n return false;\r\n }\r\n if (!!filter.userAssertionHash && !this.matchUserAssertionHash(entity, filter.userAssertionHash)) {\r\n return false;\r\n }\r\n /*\r\n * homeAccountId can be undefined, and we want to filter out cached items that have a homeAccountId of \"\"\r\n * because we don't want a client_credential request to return a cached token that has a homeAccountId\r\n */\r\n if ((typeof filter.homeAccountId === \"string\") && !this.matchHomeAccountId(entity, filter.homeAccountId)) {\r\n return false;\r\n }\r\n if (!!filter.environment && !this.matchEnvironment(entity, filter.environment)) {\r\n return false;\r\n }\r\n if (!!filter.realm && !this.matchRealm(entity, filter.realm)) {\r\n return false;\r\n }\r\n if (!!filter.credentialType && !this.matchCredentialType(entity, filter.credentialType)) {\r\n return false;\r\n }\r\n if (!!filter.familyId && !this.matchFamilyId(entity, filter.familyId)) {\r\n return false;\r\n }\r\n /*\r\n * idTokens do not have \"target\", target specific refreshTokens do exist for some types of authentication\r\n * Resource specific refresh tokens case will be added when the support is deemed necessary\r\n */\r\n if (!!filter.target && !this.matchTarget(entity, filter.target)) {\r\n return false;\r\n }\r\n // If request OR cached entity has requested Claims Hash, check if they match\r\n if (filter.requestedClaimsHash || entity.requestedClaimsHash) {\r\n // Don't match if either is undefined or they are different\r\n if (entity.requestedClaimsHash !== filter.requestedClaimsHash) {\r\n return false;\r\n }\r\n }\r\n // Access Token with Auth Scheme specific matching\r\n if (entity.credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {\r\n if (!!filter.tokenType && !this.matchTokenType(entity, filter.tokenType)) {\r\n return false;\r\n }\r\n // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key\r\n if (filter.tokenType === AuthenticationScheme.SSH) {\r\n if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * retrieve appMetadata matching all provided filters; if no filter is set, get all appMetadata\r\n * @param filter\r\n */\r\n CacheManager.prototype.getAppMetadataFilteredBy = function (filter) {\r\n return this.getAppMetadataFilteredByInternal(filter.environment, filter.clientId);\r\n };\r\n /**\r\n * Support function to help match appMetadata\r\n * @param environment\r\n * @param clientId\r\n */\r\n CacheManager.prototype.getAppMetadataFilteredByInternal = function (environment, clientId) {\r\n var _this = this;\r\n var allCacheKeys = this.getKeys();\r\n var matchingAppMetadata = {};\r\n allCacheKeys.forEach(function (cacheKey) {\r\n // don't parse any non-appMetadata type cache entities\r\n if (!_this.isAppMetadata(cacheKey)) {\r\n return;\r\n }\r\n // Attempt retrieval\r\n var entity = _this.getAppMetadata(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n if (!!environment && !_this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n if (!!clientId && !_this.matchClientId(entity, clientId)) {\r\n return;\r\n }\r\n matchingAppMetadata[cacheKey] = entity;\r\n });\r\n return matchingAppMetadata;\r\n };\r\n /**\r\n * retrieve authorityMetadata that contains a matching alias\r\n * @param filter\r\n */\r\n CacheManager.prototype.getAuthorityMetadataByAlias = function (host) {\r\n var _this = this;\r\n var allCacheKeys = this.getAuthorityMetadataKeys();\r\n var matchedEntity = null;\r\n allCacheKeys.forEach(function (cacheKey) {\r\n // don't parse any non-authorityMetadata type cache entities\r\n if (!_this.isAuthorityMetadata(cacheKey) || cacheKey.indexOf(_this.clientId) === -1) {\r\n return;\r\n }\r\n // Attempt retrieval\r\n var entity = _this.getAuthorityMetadata(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n if (entity.aliases.indexOf(host) === -1) {\r\n return;\r\n }\r\n matchedEntity = entity;\r\n });\r\n return matchedEntity;\r\n };\r\n /**\r\n * Removes all accounts and related tokens from cache.\r\n */\r\n CacheManager.prototype.removeAllAccounts = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var allAccountKeys, removedAccounts;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n allAccountKeys = this.getAccountKeys();\r\n removedAccounts = [];\r\n allAccountKeys.forEach(function (cacheKey) {\r\n removedAccounts.push(_this.removeAccount(cacheKey));\r\n });\r\n return [4 /*yield*/, Promise.all(removedAccounts)];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Removes the account and related tokens for a given account key\r\n * @param account\r\n */\r\n CacheManager.prototype.removeAccount = function (accountKey) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var account;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n account = this.getAccount(accountKey);\r\n if (!account) {\r\n throw ClientAuthError.createNoAccountFoundError();\r\n }\r\n return [4 /*yield*/, this.removeAccountContext(account)];\r\n case 1:\r\n _a.sent();\r\n this.removeItem(accountKey);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Removes credentials associated with the provided account\r\n * @param account\r\n */\r\n CacheManager.prototype.removeAccountContext = function (account) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var allTokenKeys, accountId, removedCredentials;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n allTokenKeys = this.getTokenKeys();\r\n accountId = account.generateAccountId();\r\n removedCredentials = [];\r\n allTokenKeys.idToken.forEach(function (key) {\r\n if (key.indexOf(accountId) === 0) {\r\n _this.removeIdToken(key);\r\n }\r\n });\r\n allTokenKeys.accessToken.forEach(function (key) {\r\n if (key.indexOf(accountId) === 0) {\r\n removedCredentials.push(_this.removeAccessToken(key));\r\n }\r\n });\r\n allTokenKeys.refreshToken.forEach(function (key) {\r\n if (key.indexOf(accountId) === 0) {\r\n _this.removeRefreshToken(key);\r\n }\r\n });\r\n return [4 /*yield*/, Promise.all(removedCredentials)];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * returns a boolean if the given credential is removed\r\n * @param credential\r\n */\r\n CacheManager.prototype.removeAccessToken = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var credential, accessTokenWithAuthSchemeEntity, kid;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n credential = this.getAccessTokenCredential(key);\r\n if (!credential) {\r\n return [2 /*return*/];\r\n }\r\n if (!(credential.credentialType.toLowerCase() === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())) return [3 /*break*/, 4];\r\n if (!(credential.tokenType === AuthenticationScheme.POP)) return [3 /*break*/, 4];\r\n accessTokenWithAuthSchemeEntity = credential;\r\n kid = accessTokenWithAuthSchemeEntity.keyId;\r\n if (!kid) return [3 /*break*/, 4];\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.cryptoImpl.removeTokenBindingKey(kid)];\r\n case 2:\r\n _a.sent();\r\n return [3 /*break*/, 4];\r\n case 3:\r\n _a.sent();\r\n throw ClientAuthError.createBindingKeyNotRemovedError();\r\n case 4: return [2 /*return*/, this.removeItem(key)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Removes all app metadata objects from cache.\r\n */\r\n CacheManager.prototype.removeAppMetadata = function () {\r\n var _this = this;\r\n var allCacheKeys = this.getKeys();\r\n allCacheKeys.forEach(function (cacheKey) {\r\n if (_this.isAppMetadata(cacheKey)) {\r\n _this.removeItem(cacheKey);\r\n }\r\n });\r\n return true;\r\n };\r\n /**\r\n * Retrieve the cached credentials into a cacherecord\r\n * @param account\r\n * @param clientId\r\n * @param scopes\r\n * @param environment\r\n * @param authScheme\r\n */\r\n CacheManager.prototype.readCacheRecord = function (account, request, environment) {\r\n var tokenKeys = this.getTokenKeys();\r\n var cachedAccount = this.readAccountFromCache(account);\r\n var cachedIdToken = this.getIdToken(account, tokenKeys);\r\n var cachedAccessToken = this.getAccessToken(account, request, tokenKeys);\r\n var cachedRefreshToken = this.getRefreshToken(account, false, tokenKeys);\r\n var cachedAppMetadata = this.readAppMetadataFromCache(environment);\r\n if (cachedAccount && cachedIdToken) {\r\n cachedAccount.idTokenClaims = new AuthToken(cachedIdToken.secret, this.cryptoImpl).claims;\r\n }\r\n return {\r\n account: cachedAccount,\r\n idToken: cachedIdToken,\r\n accessToken: cachedAccessToken,\r\n refreshToken: cachedRefreshToken,\r\n appMetadata: cachedAppMetadata,\r\n };\r\n };\r\n /**\r\n * Retrieve AccountEntity from cache\r\n * @param account\r\n */\r\n CacheManager.prototype.readAccountFromCache = function (account) {\r\n var accountKey = AccountEntity.generateAccountCacheKey(account);\r\n return this.getAccount(accountKey);\r\n };\r\n /**\r\n * Retrieve IdTokenEntity from cache\r\n * @param clientId\r\n * @param account\r\n * @param inputRealm\r\n */\r\n CacheManager.prototype.getIdToken = function (account, tokenKeys) {\r\n this.commonLogger.trace(\"CacheManager - getIdToken called\");\r\n var idTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.ID_TOKEN,\r\n clientId: this.clientId,\r\n realm: account.tenantId,\r\n };\r\n var idTokens = this.getIdTokensByFilter(idTokenFilter, tokenKeys);\r\n var numIdTokens = idTokens.length;\r\n if (numIdTokens < 1) {\r\n this.commonLogger.info(\"CacheManager:getIdToken - No token found\");\r\n return null;\r\n }\r\n else if (numIdTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n this.commonLogger.info(\"CacheManager:getIdToken - Returning id token\");\r\n return idTokens[0];\r\n };\r\n /**\r\n * Gets all idTokens matching the given filter\r\n * @param filter\r\n * @returns\r\n */\r\n CacheManager.prototype.getIdTokensByFilter = function (filter, tokenKeys) {\r\n var _this = this;\r\n var idTokenKeys = tokenKeys && tokenKeys.idToken || this.getTokenKeys().idToken;\r\n var idTokens = [];\r\n idTokenKeys.forEach(function (key) {\r\n if (!_this.idTokenKeyMatchesFilter(key, __assign({ clientId: _this.clientId }, filter))) {\r\n return;\r\n }\r\n var idToken = _this.getIdTokenCredential(key);\r\n if (idToken && _this.credentialMatchesFilter(idToken, filter)) {\r\n idTokens.push(idToken);\r\n }\r\n });\r\n return idTokens;\r\n };\r\n /**\r\n * Validate the cache key against filter before retrieving and parsing cache value\r\n * @param key\r\n * @param filter\r\n * @returns\r\n */\r\n CacheManager.prototype.idTokenKeyMatchesFilter = function (inputKey, filter) {\r\n var key = inputKey.toLowerCase();\r\n if (filter.clientId && key.indexOf(filter.clientId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.homeAccountId && key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Removes idToken from the cache\r\n * @param key\r\n */\r\n CacheManager.prototype.removeIdToken = function (key) {\r\n this.removeItem(key);\r\n };\r\n /**\r\n * Removes refresh token from the cache\r\n * @param key\r\n */\r\n CacheManager.prototype.removeRefreshToken = function (key) {\r\n this.removeItem(key);\r\n };\r\n /**\r\n * Retrieve AccessTokenEntity from cache\r\n * @param clientId\r\n * @param account\r\n * @param scopes\r\n * @param authScheme\r\n */\r\n CacheManager.prototype.getAccessToken = function (account, request, tokenKeys) {\r\n var _this = this;\r\n this.commonLogger.trace(\"CacheManager - getAccessToken called\");\r\n var scopes = ScopeSet.createSearchScopes(request.scopes);\r\n var authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\r\n /*\r\n * Distinguish between Bearer and PoP/SSH token cache types\r\n * Cast to lowercase to handle \"bearer\" from ADFS\r\n */\r\n var credentialType = (authScheme && authScheme.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;\r\n var accessTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: credentialType,\r\n clientId: this.clientId,\r\n realm: account.tenantId,\r\n target: scopes,\r\n tokenType: authScheme,\r\n keyId: request.sshKid,\r\n requestedClaimsHash: request.requestedClaimsHash,\r\n };\r\n var accessTokenKeys = tokenKeys && tokenKeys.accessToken || this.getTokenKeys().accessToken;\r\n var accessTokens = [];\r\n accessTokenKeys.forEach(function (key) {\r\n // Validate key\r\n if (_this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {\r\n var accessToken = _this.getAccessTokenCredential(key);\r\n // Validate value\r\n if (accessToken && _this.credentialMatchesFilter(accessToken, accessTokenFilter)) {\r\n accessTokens.push(accessToken);\r\n }\r\n }\r\n });\r\n var numAccessTokens = accessTokens.length;\r\n if (numAccessTokens < 1) {\r\n this.commonLogger.info(\"CacheManager:getAccessToken - No token found\");\r\n return null;\r\n }\r\n else if (numAccessTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n this.commonLogger.info(\"CacheManager:getAccessToken - Returning access token\");\r\n return accessTokens[0];\r\n };\r\n /**\r\n * Validate the cache key against filter before retrieving and parsing cache value\r\n * @param key\r\n * @param filter\r\n * @param keyMustContainAllScopes\r\n * @returns\r\n */\r\n CacheManager.prototype.accessTokenKeyMatchesFilter = function (inputKey, filter, keyMustContainAllScopes) {\r\n var key = inputKey.toLowerCase();\r\n if (filter.clientId && key.indexOf(filter.clientId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.homeAccountId && key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.realm && key.indexOf(filter.realm.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.requestedClaimsHash && key.indexOf(filter.requestedClaimsHash.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.target) {\r\n var scopes = filter.target.asArray();\r\n for (var i = 0; i < scopes.length; i++) {\r\n if (keyMustContainAllScopes && !key.includes(scopes[i].toLowerCase())) {\r\n // When performing a cache lookup a missing scope would be a cache miss\r\n return false;\r\n }\r\n else if (!keyMustContainAllScopes && key.includes(scopes[i].toLowerCase())) {\r\n // When performing a cache write, any token with a subset of requested scopes should be replaced\r\n return true;\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n /**\r\n * Gets all access tokens matching the filter\r\n * @param filter\r\n * @returns\r\n */\r\n CacheManager.prototype.getAccessTokensByFilter = function (filter) {\r\n var _this = this;\r\n var tokenKeys = this.getTokenKeys();\r\n var accessTokens = [];\r\n tokenKeys.accessToken.forEach(function (key) {\r\n if (!_this.accessTokenKeyMatchesFilter(key, filter, true)) {\r\n return;\r\n }\r\n var accessToken = _this.getAccessTokenCredential(key);\r\n if (accessToken && _this.credentialMatchesFilter(accessToken, filter)) {\r\n accessTokens.push(accessToken);\r\n }\r\n });\r\n return accessTokens;\r\n };\r\n /**\r\n * Helper to retrieve the appropriate refresh token from cache\r\n * @param clientId\r\n * @param account\r\n * @param familyRT\r\n */\r\n CacheManager.prototype.getRefreshToken = function (account, familyRT, tokenKeys) {\r\n var _this = this;\r\n this.commonLogger.trace(\"CacheManager - getRefreshToken called\");\r\n var id = familyRT ? THE_FAMILY_ID : undefined;\r\n var refreshTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.REFRESH_TOKEN,\r\n clientId: this.clientId,\r\n familyId: id,\r\n };\r\n var refreshTokenKeys = tokenKeys && tokenKeys.refreshToken || this.getTokenKeys().refreshToken;\r\n var refreshTokens = [];\r\n refreshTokenKeys.forEach(function (key) {\r\n // Validate key\r\n if (_this.refreshTokenKeyMatchesFilter(key, refreshTokenFilter)) {\r\n var refreshToken = _this.getRefreshTokenCredential(key);\r\n // Validate value\r\n if (refreshToken && _this.credentialMatchesFilter(refreshToken, refreshTokenFilter)) {\r\n refreshTokens.push(refreshToken);\r\n }\r\n }\r\n });\r\n var numRefreshTokens = refreshTokens.length;\r\n if (numRefreshTokens < 1) {\r\n this.commonLogger.info(\"CacheManager:getRefreshToken - No refresh token found.\");\r\n return null;\r\n }\r\n // address the else case after remove functions address environment aliases\r\n this.commonLogger.info(\"CacheManager:getRefreshToken - returning refresh token\");\r\n return refreshTokens[0];\r\n };\r\n /**\r\n * Validate the cache key against filter before retrieving and parsing cache value\r\n * @param key\r\n * @param filter\r\n */\r\n CacheManager.prototype.refreshTokenKeyMatchesFilter = function (inputKey, filter) {\r\n var key = inputKey.toLowerCase();\r\n if (filter.familyId && key.indexOf(filter.familyId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n // If familyId is used, clientId is not in the key\r\n if (!filter.familyId && filter.clientId && key.indexOf(filter.clientId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.homeAccountId && key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Retrieve AppMetadataEntity from cache\r\n */\r\n CacheManager.prototype.readAppMetadataFromCache = function (environment) {\r\n var appMetadataFilter = {\r\n environment: environment,\r\n clientId: this.clientId,\r\n };\r\n var appMetadata = this.getAppMetadataFilteredBy(appMetadataFilter);\r\n var appMetadataEntries = Object.keys(appMetadata).map(function (key) { return appMetadata[key]; });\r\n var numAppMetadata = appMetadataEntries.length;\r\n if (numAppMetadata < 1) {\r\n return null;\r\n }\r\n else if (numAppMetadata > 1) {\r\n throw ClientAuthError.createMultipleMatchingAppMetadataInCacheError();\r\n }\r\n return appMetadataEntries[0];\r\n };\r\n /**\r\n * Return the family_id value associated with FOCI\r\n * @param environment\r\n * @param clientId\r\n */\r\n CacheManager.prototype.isAppMetadataFOCI = function (environment) {\r\n var appMetadata = this.readAppMetadataFromCache(environment);\r\n return !!(appMetadata && appMetadata.familyId === THE_FAMILY_ID);\r\n };\r\n /**\r\n * helper to match account ids\r\n * @param value\r\n * @param homeAccountId\r\n */\r\n CacheManager.prototype.matchHomeAccountId = function (entity, homeAccountId) {\r\n return !!((typeof entity.homeAccountId === \"string\") && (homeAccountId === entity.homeAccountId));\r\n };\r\n /**\r\n * helper to match account ids\r\n * @param entity\r\n * @param localAccountId\r\n * @returns\r\n */\r\n CacheManager.prototype.matchLocalAccountId = function (entity, localAccountId) {\r\n return !!((typeof entity.localAccountId === \"string\") && (localAccountId === entity.localAccountId));\r\n };\r\n /**\r\n * helper to match usernames\r\n * @param entity\r\n * @param username\r\n * @returns\r\n */\r\n CacheManager.prototype.matchUsername = function (entity, username) {\r\n return !!((typeof entity.username === \"string\") && (username.toLowerCase() === entity.username.toLowerCase()));\r\n };\r\n /**\r\n * helper to match assertion\r\n * @param value\r\n * @param oboAssertion\r\n */\r\n CacheManager.prototype.matchUserAssertionHash = function (entity, userAssertionHash) {\r\n return !!(entity.userAssertionHash && userAssertionHash === entity.userAssertionHash);\r\n };\r\n /**\r\n * helper to match environment\r\n * @param value\r\n * @param environment\r\n */\r\n CacheManager.prototype.matchEnvironment = function (entity, environment) {\r\n var cloudMetadata = this.getAuthorityMetadataByAlias(environment);\r\n if (cloudMetadata && cloudMetadata.aliases.indexOf(entity.environment) > -1) {\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * helper to match credential type\r\n * @param entity\r\n * @param credentialType\r\n */\r\n CacheManager.prototype.matchCredentialType = function (entity, credentialType) {\r\n return (entity.credentialType && credentialType.toLowerCase() === entity.credentialType.toLowerCase());\r\n };\r\n /**\r\n * helper to match client ids\r\n * @param entity\r\n * @param clientId\r\n */\r\n CacheManager.prototype.matchClientId = function (entity, clientId) {\r\n return !!(entity.clientId && clientId === entity.clientId);\r\n };\r\n /**\r\n * helper to match family ids\r\n * @param entity\r\n * @param familyId\r\n */\r\n CacheManager.prototype.matchFamilyId = function (entity, familyId) {\r\n return !!(entity.familyId && familyId === entity.familyId);\r\n };\r\n /**\r\n * helper to match realm\r\n * @param entity\r\n * @param realm\r\n */\r\n CacheManager.prototype.matchRealm = function (entity, realm) {\r\n return !!(entity.realm && realm === entity.realm);\r\n };\r\n /**\r\n * helper to match nativeAccountId\r\n * @param entity\r\n * @param nativeAccountId\r\n * @returns boolean indicating the match result\r\n */\r\n CacheManager.prototype.matchNativeAccountId = function (entity, nativeAccountId) {\r\n return !!(entity.nativeAccountId && nativeAccountId === entity.nativeAccountId);\r\n };\r\n /**\r\n * Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.\r\n * @param entity\r\n * @param target\r\n */\r\n CacheManager.prototype.matchTarget = function (entity, target) {\r\n var isNotAccessTokenCredential = (entity.credentialType !== CredentialType.ACCESS_TOKEN && entity.credentialType !== CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME);\r\n if (isNotAccessTokenCredential || !entity.target) {\r\n return false;\r\n }\r\n var entityScopeSet = ScopeSet.fromString(entity.target);\r\n return entityScopeSet.containsScopeSet(target);\r\n };\r\n /**\r\n * Returns true if the credential's tokenType or Authentication Scheme matches the one in the request, false otherwise\r\n * @param entity\r\n * @param tokenType\r\n */\r\n CacheManager.prototype.matchTokenType = function (entity, tokenType) {\r\n return !!(entity.tokenType && entity.tokenType === tokenType);\r\n };\r\n /**\r\n * Returns true if the credential's keyId matches the one in the request, false otherwise\r\n * @param entity\r\n * @param tokenType\r\n */\r\n CacheManager.prototype.matchKeyId = function (entity, keyId) {\r\n return !!(entity.keyId && entity.keyId === keyId);\r\n };\r\n /**\r\n * returns if a given cache entity is of the type appmetadata\r\n * @param key\r\n */\r\n CacheManager.prototype.isAppMetadata = function (key) {\r\n return key.indexOf(APP_METADATA) !== -1;\r\n };\r\n /**\r\n * returns if a given cache entity is of the type authoritymetadata\r\n * @param key\r\n */\r\n CacheManager.prototype.isAuthorityMetadata = function (key) {\r\n return key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) !== -1;\r\n };\r\n /**\r\n * returns cache key used for cloud instance metadata\r\n */\r\n CacheManager.prototype.generateAuthorityMetadataCacheKey = function (authority) {\r\n return AUTHORITY_METADATA_CONSTANTS.CACHE_KEY + \"-\" + this.clientId + \"-\" + authority;\r\n };\r\n /**\r\n * Helper to convert serialized data to object\r\n * @param obj\r\n * @param json\r\n */\r\n CacheManager.toObject = function (obj, json) {\r\n for (var propertyName in json) {\r\n obj[propertyName] = json[propertyName];\r\n }\r\n return obj;\r\n };\r\n return CacheManager;\r\n}());\r\nvar DefaultStorageClass = /** @class */ (function (_super) {\r\n __extends(DefaultStorageClass, _super);\r\n function DefaultStorageClass() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n DefaultStorageClass.prototype.setAccount = function () {\r\n var notImplErr = \"Storage interface - setAccount() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAccount = function () {\r\n var notImplErr = \"Storage interface - getAccount() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setIdTokenCredential = function () {\r\n var notImplErr = \"Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getIdTokenCredential = function () {\r\n var notImplErr = \"Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setAccessTokenCredential = function () {\r\n var notImplErr = \"Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAccessTokenCredential = function () {\r\n var notImplErr = \"Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setRefreshTokenCredential = function () {\r\n var notImplErr = \"Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getRefreshTokenCredential = function () {\r\n var notImplErr = \"Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setAppMetadata = function () {\r\n var notImplErr = \"Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAppMetadata = function () {\r\n var notImplErr = \"Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setServerTelemetry = function () {\r\n var notImplErr = \"Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getServerTelemetry = function () {\r\n var notImplErr = \"Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setAuthorityMetadata = function () {\r\n var notImplErr = \"Storage interface - setAuthorityMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAuthorityMetadata = function () {\r\n var notImplErr = \"Storage interface - getAuthorityMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAuthorityMetadataKeys = function () {\r\n var notImplErr = \"Storage interface - getAuthorityMetadataKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.setThrottlingCache = function () {\r\n var notImplErr = \"Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getThrottlingCache = function () {\r\n var notImplErr = \"Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.removeItem = function () {\r\n var notImplErr = \"Storage interface - removeItem() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.containsKey = function () {\r\n var notImplErr = \"Storage interface - containsKey() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getKeys = function () {\r\n var notImplErr = \"Storage interface - getKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getAccountKeys = function () {\r\n var notImplErr = \"Storage interface - getAccountKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.getTokenKeys = function () {\r\n var notImplErr = \"Storage interface - getTokenKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n DefaultStorageClass.prototype.clear = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Storage interface - clear() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n };\r\n DefaultStorageClass.prototype.updateCredentialCacheKey = function () {\r\n var notImplErr = \"Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n };\r\n return DefaultStorageClass;\r\n}(CacheManager));\n\nexport { CacheManager, DefaultStorageClass };\n//# sourceMappingURL=CacheManager.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { DEFAULT_CRYPTO_IMPLEMENTATION } from '../crypto/ICrypto.js';\nimport { AuthError } from '../error/AuthError.js';\nimport { Logger, LogLevel } from '../logger/Logger.js';\nimport { Constants } from '../utils/Constants.js';\nimport { version } from '../packageMetadata.js';\nimport { AzureCloudInstance } from '../authority/AuthorityOptions.js';\nimport { DefaultStorageClass } from '../cache/CacheManager.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n// Token renewal offset default in seconds\r\nvar DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;\r\nvar DEFAULT_SYSTEM_OPTIONS = {\r\n tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,\r\n preventCorsPreflight: false\r\n};\r\nvar DEFAULT_LOGGER_IMPLEMENTATION = {\r\n loggerCallback: function () {\r\n // allow users to not set loggerCallback\r\n },\r\n piiLoggingEnabled: false,\r\n logLevel: LogLevel.Info,\r\n correlationId: Constants.EMPTY_STRING\r\n};\r\nvar DEFAULT_NETWORK_IMPLEMENTATION = {\r\n sendGetRequestAsync: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Network interface - sendGetRequestAsync() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n },\r\n sendPostRequestAsync: function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var notImplErr;\r\n return __generator(this, function (_a) {\r\n notImplErr = \"Network interface - sendPostRequestAsync() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n });\r\n });\r\n }\r\n};\r\nvar DEFAULT_LIBRARY_INFO = {\r\n sku: Constants.SKU,\r\n version: version,\r\n cpu: Constants.EMPTY_STRING,\r\n os: Constants.EMPTY_STRING\r\n};\r\nvar DEFAULT_CLIENT_CREDENTIALS = {\r\n clientSecret: Constants.EMPTY_STRING,\r\n clientAssertion: undefined\r\n};\r\nvar DEFAULT_AZURE_CLOUD_OPTIONS = {\r\n azureCloudInstance: AzureCloudInstance.None,\r\n tenant: \"\" + Constants.DEFAULT_COMMON_TENANT\r\n};\r\nvar DEFAULT_TELEMETRY_OPTIONS = {\r\n application: {\r\n appName: \"\",\r\n appVersion: \"\"\r\n }\r\n};\r\n/**\r\n * Function that sets the default options when not explicitly configured from app developer\r\n *\r\n * @param Configuration\r\n *\r\n * @returns Configuration\r\n */\r\nfunction buildClientConfiguration(_a) {\r\n var userAuthOptions = _a.authOptions, userSystemOptions = _a.systemOptions, userLoggerOption = _a.loggerOptions, storageImplementation = _a.storageInterface, networkImplementation = _a.networkInterface, cryptoImplementation = _a.cryptoInterface, clientCredentials = _a.clientCredentials, libraryInfo = _a.libraryInfo, telemetry = _a.telemetry, serverTelemetryManager = _a.serverTelemetryManager, persistencePlugin = _a.persistencePlugin, serializableCache = _a.serializableCache;\r\n var loggerOptions = __assign(__assign({}, DEFAULT_LOGGER_IMPLEMENTATION), userLoggerOption);\r\n return {\r\n authOptions: buildAuthOptions(userAuthOptions),\r\n systemOptions: __assign(__assign({}, DEFAULT_SYSTEM_OPTIONS), userSystemOptions),\r\n loggerOptions: loggerOptions,\r\n storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions)),\r\n networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,\r\n cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,\r\n clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,\r\n libraryInfo: __assign(__assign({}, DEFAULT_LIBRARY_INFO), libraryInfo),\r\n telemetry: __assign(__assign({}, DEFAULT_TELEMETRY_OPTIONS), telemetry),\r\n serverTelemetryManager: serverTelemetryManager || null,\r\n persistencePlugin: persistencePlugin || null,\r\n serializableCache: serializableCache || null,\r\n };\r\n}\r\n/**\r\n * Construct authoptions from the client and platform passed values\r\n * @param authOptions\r\n */\r\nfunction buildAuthOptions(authOptions) {\r\n return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);\r\n}\n\nexport { DEFAULT_SYSTEM_OPTIONS, buildClientConfiguration };\n//# sourceMappingURL=ClientConfiguration.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { AuthError } from './AuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Error thrown when there is an error with the server code, for example, unavailability.\r\n */\r\nvar ServerError = /** @class */ (function (_super) {\r\n __extends(ServerError, _super);\r\n function ServerError(errorCode, errorMessage, subError) {\r\n var _this = _super.call(this, errorCode, errorMessage, subError) || this;\r\n _this.name = \"ServerError\";\r\n Object.setPrototypeOf(_this, ServerError.prototype);\r\n return _this;\r\n }\r\n return ServerError;\r\n}(AuthError));\n\nexport { ServerError };\n//# sourceMappingURL=ServerError.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { ThrottlingConstants, Constants, HeaderNames } from '../utils/Constants.js';\nimport { ServerError } from '../error/ServerError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ThrottlingUtils = /** @class */ (function () {\r\n function ThrottlingUtils() {\r\n }\r\n /**\r\n * Prepares a RequestThumbprint to be stored as a key.\r\n * @param thumbprint\r\n */\r\n ThrottlingUtils.generateThrottlingStorageKey = function (thumbprint) {\r\n return ThrottlingConstants.THROTTLING_PREFIX + \".\" + JSON.stringify(thumbprint);\r\n };\r\n /**\r\n * Performs necessary throttling checks before a network request.\r\n * @param cacheManager\r\n * @param thumbprint\r\n */\r\n ThrottlingUtils.preProcess = function (cacheManager, thumbprint) {\r\n var _a;\r\n var key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);\r\n var value = cacheManager.getThrottlingCache(key);\r\n if (value) {\r\n if (value.throttleTime < Date.now()) {\r\n cacheManager.removeItem(key);\r\n return;\r\n }\r\n throw new ServerError(((_a = value.errorCodes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || Constants.EMPTY_STRING, value.errorMessage, value.subError);\r\n }\r\n };\r\n /**\r\n * Performs necessary throttling checks after a network request.\r\n * @param cacheManager\r\n * @param thumbprint\r\n * @param response\r\n */\r\n ThrottlingUtils.postProcess = function (cacheManager, thumbprint, response) {\r\n if (ThrottlingUtils.checkResponseStatus(response) || ThrottlingUtils.checkResponseForRetryAfter(response)) {\r\n var thumbprintValue = {\r\n throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),\r\n error: response.body.error,\r\n errorCodes: response.body.error_codes,\r\n errorMessage: response.body.error_description,\r\n subError: response.body.suberror\r\n };\r\n cacheManager.setThrottlingCache(ThrottlingUtils.generateThrottlingStorageKey(thumbprint), thumbprintValue);\r\n }\r\n };\r\n /**\r\n * Checks a NetworkResponse object's status codes against 429 or 5xx\r\n * @param response\r\n */\r\n ThrottlingUtils.checkResponseStatus = function (response) {\r\n return response.status === 429 || response.status >= 500 && response.status < 600;\r\n };\r\n /**\r\n * Checks a NetworkResponse object's RetryAfter header\r\n * @param response\r\n */\r\n ThrottlingUtils.checkResponseForRetryAfter = function (response) {\r\n if (response.headers) {\r\n return response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) && (response.status < 200 || response.status >= 300);\r\n }\r\n return false;\r\n };\r\n /**\r\n * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.\r\n * @param throttleTime\r\n */\r\n ThrottlingUtils.calculateThrottleTime = function (throttleTime) {\r\n var time = throttleTime <= 0 ? 0 : throttleTime;\r\n var currentSeconds = Date.now() / 1000;\r\n return Math.floor(Math.min(currentSeconds + (time || ThrottlingConstants.DEFAULT_THROTTLE_TIME_SECONDS), currentSeconds + ThrottlingConstants.DEFAULT_MAX_THROTTLE_TIME_SECONDS) * 1000);\r\n };\r\n ThrottlingUtils.removeThrottle = function (cacheManager, clientId, request, homeAccountIdentifier) {\r\n var thumbprint = {\r\n clientId: clientId,\r\n authority: request.authority,\r\n scopes: request.scopes,\r\n homeAccountIdentifier: homeAccountIdentifier,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n var key = this.generateThrottlingStorageKey(thumbprint);\r\n cacheManager.removeItem(key);\r\n };\r\n return ThrottlingUtils;\r\n}());\n\nexport { ThrottlingUtils };\n//# sourceMappingURL=ThrottlingUtils.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { ThrottlingUtils } from './ThrottlingUtils.js';\nimport { AuthError } from '../error/AuthError.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar NetworkManager = /** @class */ (function () {\r\n function NetworkManager(networkClient, cacheManager) {\r\n this.networkClient = networkClient;\r\n this.cacheManager = cacheManager;\r\n }\r\n /**\r\n * Wraps sendPostRequestAsync with necessary preflight and postflight logic\r\n * @param thumbprint\r\n * @param tokenEndpoint\r\n * @param options\r\n */\r\n NetworkManager.prototype.sendPostRequest = function (thumbprint, tokenEndpoint, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var response, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n ThrottlingUtils.preProcess(this.cacheManager, thumbprint);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.networkClient.sendPostRequestAsync(tokenEndpoint, options)];\r\n case 2:\r\n response = _a.sent();\r\n return [3 /*break*/, 4];\r\n case 3:\r\n e_1 = _a.sent();\r\n if (e_1 instanceof AuthError) {\r\n throw e_1;\r\n }\r\n else {\r\n throw ClientAuthError.createNetworkError(tokenEndpoint, e_1);\r\n }\r\n case 4:\r\n ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);\r\n return [2 /*return*/, response];\r\n }\r\n });\r\n });\r\n };\r\n return NetworkManager;\r\n}());\n\nexport { NetworkManager };\n//# sourceMappingURL=NetworkManager.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar CcsCredentialType;\r\n(function (CcsCredentialType) {\r\n CcsCredentialType[\"HOME_ACCOUNT_ID\"] = \"home_account_id\";\r\n CcsCredentialType[\"UPN\"] = \"UPN\";\r\n})(CcsCredentialType || (CcsCredentialType = {}));\n\nexport { CcsCredentialType };\n//# sourceMappingURL=CcsCredential.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { CodeChallengeMethodValues, PromptValue } from '../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Validates server consumable params from the \"request\" objects\r\n */\r\nvar RequestValidator = /** @class */ (function () {\r\n function RequestValidator() {\r\n }\r\n /**\r\n * Utility to check if the `redirectUri` in the request is a non-null value\r\n * @param redirectUri\r\n */\r\n RequestValidator.validateRedirectUri = function (redirectUri) {\r\n if (StringUtils.isEmpty(redirectUri)) {\r\n throw ClientConfigurationError.createRedirectUriEmptyError();\r\n }\r\n };\r\n /**\r\n * Utility to validate prompt sent by the user in the request\r\n * @param prompt\r\n */\r\n RequestValidator.validatePrompt = function (prompt) {\r\n var promptValues = [];\r\n for (var value in PromptValue) {\r\n promptValues.push(PromptValue[value]);\r\n }\r\n if (promptValues.indexOf(prompt) < 0) {\r\n throw ClientConfigurationError.createInvalidPromptError(prompt);\r\n }\r\n };\r\n RequestValidator.validateClaims = function (claims) {\r\n try {\r\n JSON.parse(claims);\r\n }\r\n catch (e) {\r\n throw ClientConfigurationError.createInvalidClaimsRequestError();\r\n }\r\n };\r\n /**\r\n * Utility to validate code_challenge and code_challenge_method\r\n * @param codeChallenge\r\n * @param codeChallengeMethod\r\n */\r\n RequestValidator.validateCodeChallengeParams = function (codeChallenge, codeChallengeMethod) {\r\n if (StringUtils.isEmpty(codeChallenge) || StringUtils.isEmpty(codeChallengeMethod)) {\r\n throw ClientConfigurationError.createInvalidCodeChallengeParamsError();\r\n }\r\n else {\r\n this.validateCodeChallengeMethod(codeChallengeMethod);\r\n }\r\n };\r\n /**\r\n * Utility to validate code_challenge_method\r\n * @param codeChallengeMethod\r\n */\r\n RequestValidator.validateCodeChallengeMethod = function (codeChallengeMethod) {\r\n if ([\r\n CodeChallengeMethodValues.PLAIN,\r\n CodeChallengeMethodValues.S256\r\n ].indexOf(codeChallengeMethod) < 0) {\r\n throw ClientConfigurationError.createInvalidCodeChallengeMethodError();\r\n }\r\n };\r\n /**\r\n * Removes unnecessary, duplicate, and empty string query parameters from extraQueryParameters\r\n * @param request\r\n */\r\n RequestValidator.sanitizeEQParams = function (eQParams, queryParams) {\r\n if (!eQParams) {\r\n return {};\r\n }\r\n // Remove any query parameters already included in SSO params\r\n queryParams.forEach(function (value, key) {\r\n if (eQParams[key]) {\r\n delete eQParams[key];\r\n }\r\n });\r\n // remove empty string parameters\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n return Object.fromEntries(Object.entries(eQParams).filter(function (_a) {\r\n var value = _a[1];\r\n return value !== \"\";\r\n }));\r\n };\r\n return RequestValidator;\r\n}());\n\nexport { RequestValidator };\n//# sourceMappingURL=RequestValidator.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __spreadArrays } from '../_virtual/_tslib.js';\nimport { AADServerParamKeys, Constants, ResponseMode, OIDC_DEFAULT_SCOPES, SSOTypes, HeaderNames, CLIENT_INFO, ClaimsRequestKeys, PasswordGrantConstants, AuthenticationScheme, ThrottlingConstants } from '../utils/Constants.js';\nimport { ScopeSet } from './ScopeSet.js';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { RequestValidator } from './RequestValidator.js';\nimport { StringUtils } from '../utils/StringUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar RequestParameterBuilder = /** @class */ (function () {\r\n function RequestParameterBuilder() {\r\n this.parameters = new Map();\r\n }\r\n /**\r\n * add response_type = code\r\n */\r\n RequestParameterBuilder.prototype.addResponseTypeCode = function () {\r\n this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.CODE_RESPONSE_TYPE));\r\n };\r\n /**\r\n * add response_type = token id_token\r\n */\r\n RequestParameterBuilder.prototype.addResponseTypeForTokenAndIdToken = function () {\r\n this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.TOKEN_RESPONSE_TYPE + \" \" + Constants.ID_TOKEN_RESPONSE_TYPE));\r\n };\r\n /**\r\n * add response_mode. defaults to query.\r\n * @param responseMode\r\n */\r\n RequestParameterBuilder.prototype.addResponseMode = function (responseMode) {\r\n this.parameters.set(AADServerParamKeys.RESPONSE_MODE, encodeURIComponent((responseMode) ? responseMode : ResponseMode.QUERY));\r\n };\r\n /**\r\n * Add flag to indicate STS should attempt to use WAM if available\r\n */\r\n RequestParameterBuilder.prototype.addNativeBroker = function () {\r\n this.parameters.set(AADServerParamKeys.NATIVE_BROKER, encodeURIComponent(\"1\"));\r\n };\r\n /**\r\n * add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios\r\n * @param scopeSet\r\n * @param addOidcScopes\r\n */\r\n RequestParameterBuilder.prototype.addScopes = function (scopes, addOidcScopes) {\r\n if (addOidcScopes === void 0) { addOidcScopes = true; }\r\n var requestScopes = addOidcScopes ? __spreadArrays(scopes || [], OIDC_DEFAULT_SCOPES) : scopes || [];\r\n var scopeSet = new ScopeSet(requestScopes);\r\n this.parameters.set(AADServerParamKeys.SCOPE, encodeURIComponent(scopeSet.printScopes()));\r\n };\r\n /**\r\n * add clientId\r\n * @param clientId\r\n */\r\n RequestParameterBuilder.prototype.addClientId = function (clientId) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ID, encodeURIComponent(clientId));\r\n };\r\n /**\r\n * add redirect_uri\r\n * @param redirectUri\r\n */\r\n RequestParameterBuilder.prototype.addRedirectUri = function (redirectUri) {\r\n RequestValidator.validateRedirectUri(redirectUri);\r\n this.parameters.set(AADServerParamKeys.REDIRECT_URI, encodeURIComponent(redirectUri));\r\n };\r\n /**\r\n * add post logout redirectUri\r\n * @param redirectUri\r\n */\r\n RequestParameterBuilder.prototype.addPostLogoutRedirectUri = function (redirectUri) {\r\n RequestValidator.validateRedirectUri(redirectUri);\r\n this.parameters.set(AADServerParamKeys.POST_LOGOUT_URI, encodeURIComponent(redirectUri));\r\n };\r\n /**\r\n * add id_token_hint to logout request\r\n * @param idTokenHint\r\n */\r\n RequestParameterBuilder.prototype.addIdTokenHint = function (idTokenHint) {\r\n this.parameters.set(AADServerParamKeys.ID_TOKEN_HINT, encodeURIComponent(idTokenHint));\r\n };\r\n /**\r\n * add domain_hint\r\n * @param domainHint\r\n */\r\n RequestParameterBuilder.prototype.addDomainHint = function (domainHint) {\r\n this.parameters.set(SSOTypes.DOMAIN_HINT, encodeURIComponent(domainHint));\r\n };\r\n /**\r\n * add login_hint\r\n * @param loginHint\r\n */\r\n RequestParameterBuilder.prototype.addLoginHint = function (loginHint) {\r\n this.parameters.set(SSOTypes.LOGIN_HINT, encodeURIComponent(loginHint));\r\n };\r\n /**\r\n * Adds the CCS (Cache Credential Service) query parameter for login_hint\r\n * @param loginHint\r\n */\r\n RequestParameterBuilder.prototype.addCcsUpn = function (loginHint) {\r\n this.parameters.set(HeaderNames.CCS_HEADER, encodeURIComponent(\"UPN:\" + loginHint));\r\n };\r\n /**\r\n * Adds the CCS (Cache Credential Service) query parameter for account object\r\n * @param loginHint\r\n */\r\n RequestParameterBuilder.prototype.addCcsOid = function (clientInfo) {\r\n this.parameters.set(HeaderNames.CCS_HEADER, encodeURIComponent(\"Oid:\" + clientInfo.uid + \"@\" + clientInfo.utid));\r\n };\r\n /**\r\n * add sid\r\n * @param sid\r\n */\r\n RequestParameterBuilder.prototype.addSid = function (sid) {\r\n this.parameters.set(SSOTypes.SID, encodeURIComponent(sid));\r\n };\r\n /**\r\n * add claims\r\n * @param claims\r\n */\r\n RequestParameterBuilder.prototype.addClaims = function (claims, clientCapabilities) {\r\n var mergedClaims = this.addClientCapabilitiesToClaims(claims, clientCapabilities);\r\n RequestValidator.validateClaims(mergedClaims);\r\n this.parameters.set(AADServerParamKeys.CLAIMS, encodeURIComponent(mergedClaims));\r\n };\r\n /**\r\n * add correlationId\r\n * @param correlationId\r\n */\r\n RequestParameterBuilder.prototype.addCorrelationId = function (correlationId) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_REQUEST_ID, encodeURIComponent(correlationId));\r\n };\r\n /**\r\n * add library info query params\r\n * @param libraryInfo\r\n */\r\n RequestParameterBuilder.prototype.addLibraryInfo = function (libraryInfo) {\r\n // Telemetry Info\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);\r\n if (libraryInfo.os) {\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_OS, libraryInfo.os);\r\n }\r\n if (libraryInfo.cpu) {\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_CPU, libraryInfo.cpu);\r\n }\r\n };\r\n /**\r\n * Add client telemetry parameters\r\n * @param appTelemetry\r\n */\r\n RequestParameterBuilder.prototype.addApplicationTelemetry = function (appTelemetry) {\r\n if (appTelemetry === null || appTelemetry === void 0 ? void 0 : appTelemetry.appName) {\r\n this.parameters.set(AADServerParamKeys.X_APP_NAME, appTelemetry.appName);\r\n }\r\n if (appTelemetry === null || appTelemetry === void 0 ? void 0 : appTelemetry.appVersion) {\r\n this.parameters.set(AADServerParamKeys.X_APP_VER, appTelemetry.appVersion);\r\n }\r\n };\r\n /**\r\n * add prompt\r\n * @param prompt\r\n */\r\n RequestParameterBuilder.prototype.addPrompt = function (prompt) {\r\n RequestValidator.validatePrompt(prompt);\r\n this.parameters.set(\"\" + AADServerParamKeys.PROMPT, encodeURIComponent(prompt));\r\n };\r\n /**\r\n * add state\r\n * @param state\r\n */\r\n RequestParameterBuilder.prototype.addState = function (state) {\r\n if (!StringUtils.isEmpty(state)) {\r\n this.parameters.set(AADServerParamKeys.STATE, encodeURIComponent(state));\r\n }\r\n };\r\n /**\r\n * add nonce\r\n * @param nonce\r\n */\r\n RequestParameterBuilder.prototype.addNonce = function (nonce) {\r\n this.parameters.set(AADServerParamKeys.NONCE, encodeURIComponent(nonce));\r\n };\r\n /**\r\n * add code_challenge and code_challenge_method\r\n * - throw if either of them are not passed\r\n * @param codeChallenge\r\n * @param codeChallengeMethod\r\n */\r\n RequestParameterBuilder.prototype.addCodeChallengeParams = function (codeChallenge, codeChallengeMethod) {\r\n RequestValidator.validateCodeChallengeParams(codeChallenge, codeChallengeMethod);\r\n if (codeChallenge && codeChallengeMethod) {\r\n this.parameters.set(AADServerParamKeys.CODE_CHALLENGE, encodeURIComponent(codeChallenge));\r\n this.parameters.set(AADServerParamKeys.CODE_CHALLENGE_METHOD, encodeURIComponent(codeChallengeMethod));\r\n }\r\n else {\r\n throw ClientConfigurationError.createInvalidCodeChallengeParamsError();\r\n }\r\n };\r\n /**\r\n * add the `authorization_code` passed by the user to exchange for a token\r\n * @param code\r\n */\r\n RequestParameterBuilder.prototype.addAuthorizationCode = function (code) {\r\n this.parameters.set(AADServerParamKeys.CODE, encodeURIComponent(code));\r\n };\r\n /**\r\n * add the `authorization_code` passed by the user to exchange for a token\r\n * @param code\r\n */\r\n RequestParameterBuilder.prototype.addDeviceCode = function (code) {\r\n this.parameters.set(AADServerParamKeys.DEVICE_CODE, encodeURIComponent(code));\r\n };\r\n /**\r\n * add the `refreshToken` passed by the user\r\n * @param refreshToken\r\n */\r\n RequestParameterBuilder.prototype.addRefreshToken = function (refreshToken) {\r\n this.parameters.set(AADServerParamKeys.REFRESH_TOKEN, encodeURIComponent(refreshToken));\r\n };\r\n /**\r\n * add the `code_verifier` passed by the user to exchange for a token\r\n * @param codeVerifier\r\n */\r\n RequestParameterBuilder.prototype.addCodeVerifier = function (codeVerifier) {\r\n this.parameters.set(AADServerParamKeys.CODE_VERIFIER, encodeURIComponent(codeVerifier));\r\n };\r\n /**\r\n * add client_secret\r\n * @param clientSecret\r\n */\r\n RequestParameterBuilder.prototype.addClientSecret = function (clientSecret) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_SECRET, encodeURIComponent(clientSecret));\r\n };\r\n /**\r\n * add clientAssertion for confidential client flows\r\n * @param clientAssertion\r\n */\r\n RequestParameterBuilder.prototype.addClientAssertion = function (clientAssertion) {\r\n if (!StringUtils.isEmpty(clientAssertion)) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION, encodeURIComponent(clientAssertion));\r\n }\r\n };\r\n /**\r\n * add clientAssertionType for confidential client flows\r\n * @param clientAssertionType\r\n */\r\n RequestParameterBuilder.prototype.addClientAssertionType = function (clientAssertionType) {\r\n if (!StringUtils.isEmpty(clientAssertionType)) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION_TYPE, encodeURIComponent(clientAssertionType));\r\n }\r\n };\r\n /**\r\n * add OBO assertion for confidential client flows\r\n * @param clientAssertion\r\n */\r\n RequestParameterBuilder.prototype.addOboAssertion = function (oboAssertion) {\r\n this.parameters.set(AADServerParamKeys.OBO_ASSERTION, encodeURIComponent(oboAssertion));\r\n };\r\n /**\r\n * add grant type\r\n * @param grantType\r\n */\r\n RequestParameterBuilder.prototype.addRequestTokenUse = function (tokenUse) {\r\n this.parameters.set(AADServerParamKeys.REQUESTED_TOKEN_USE, encodeURIComponent(tokenUse));\r\n };\r\n /**\r\n * add grant type\r\n * @param grantType\r\n */\r\n RequestParameterBuilder.prototype.addGrantType = function (grantType) {\r\n this.parameters.set(AADServerParamKeys.GRANT_TYPE, encodeURIComponent(grantType));\r\n };\r\n /**\r\n * add client info\r\n *\r\n */\r\n RequestParameterBuilder.prototype.addClientInfo = function () {\r\n this.parameters.set(CLIENT_INFO, \"1\");\r\n };\r\n /**\r\n * add extraQueryParams\r\n * @param eQParams\r\n */\r\n RequestParameterBuilder.prototype.addExtraQueryParameters = function (eQParams) {\r\n var _this = this;\r\n var sanitizedEQParams = RequestValidator.sanitizeEQParams(eQParams, this.parameters);\r\n Object.keys(sanitizedEQParams).forEach(function (key) {\r\n _this.parameters.set(key, eQParams[key]);\r\n });\r\n };\r\n RequestParameterBuilder.prototype.addClientCapabilitiesToClaims = function (claims, clientCapabilities) {\r\n var mergedClaims;\r\n // Parse provided claims into JSON object or initialize empty object\r\n if (!claims) {\r\n mergedClaims = {};\r\n }\r\n else {\r\n try {\r\n mergedClaims = JSON.parse(claims);\r\n }\r\n catch (e) {\r\n throw ClientConfigurationError.createInvalidClaimsRequestError();\r\n }\r\n }\r\n if (clientCapabilities && clientCapabilities.length > 0) {\r\n if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {\r\n // Add access_token key to claims object\r\n mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};\r\n }\r\n // Add xms_cc claim with provided clientCapabilities to access_token key\r\n mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] = {\r\n values: clientCapabilities\r\n };\r\n }\r\n return JSON.stringify(mergedClaims);\r\n };\r\n /**\r\n * adds `username` for Password Grant flow\r\n * @param username\r\n */\r\n RequestParameterBuilder.prototype.addUsername = function (username) {\r\n this.parameters.set(PasswordGrantConstants.username, encodeURIComponent(username));\r\n };\r\n /**\r\n * adds `password` for Password Grant flow\r\n * @param password\r\n */\r\n RequestParameterBuilder.prototype.addPassword = function (password) {\r\n this.parameters.set(PasswordGrantConstants.password, encodeURIComponent(password));\r\n };\r\n /**\r\n * add pop_jwk to query params\r\n * @param cnfString\r\n */\r\n RequestParameterBuilder.prototype.addPopToken = function (cnfString) {\r\n if (!StringUtils.isEmpty(cnfString)) {\r\n this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.POP);\r\n this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));\r\n }\r\n };\r\n /**\r\n * add SSH JWK and key ID to query params\r\n */\r\n RequestParameterBuilder.prototype.addSshJwk = function (sshJwkString) {\r\n if (!StringUtils.isEmpty(sshJwkString)) {\r\n this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.SSH);\r\n this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(sshJwkString));\r\n }\r\n };\r\n /**\r\n * add server telemetry fields\r\n * @param serverTelemetryManager\r\n */\r\n RequestParameterBuilder.prototype.addServerTelemetry = function (serverTelemetryManager) {\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());\r\n };\r\n /**\r\n * Adds parameter that indicates to the server that throttling is supported\r\n */\r\n RequestParameterBuilder.prototype.addThrottling = function () {\r\n this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);\r\n };\r\n /**\r\n * Adds logout_hint parameter for \"silent\" logout which prevent server account picker\r\n */\r\n RequestParameterBuilder.prototype.addLogoutHint = function (logoutHint) {\r\n this.parameters.set(AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));\r\n };\r\n /**\r\n * Utility to create a URL from the params map\r\n */\r\n RequestParameterBuilder.prototype.createQueryString = function () {\r\n var queryParameterArray = new Array();\r\n this.parameters.forEach(function (value, key) {\r\n queryParameterArray.push(key + \"=\" + value);\r\n });\r\n return queryParameterArray.join(\"&\");\r\n };\r\n return RequestParameterBuilder;\r\n}());\n\nexport { RequestParameterBuilder };\n//# sourceMappingURL=RequestParameterBuilder.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { buildClientConfiguration } from '../config/ClientConfiguration.js';\nimport { NetworkManager } from '../network/NetworkManager.js';\nimport { Logger } from '../logger/Logger.js';\nimport { HeaderNames, Constants } from '../utils/Constants.js';\nimport { name, version } from '../packageMetadata.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { CcsCredentialType } from '../account/CcsCredential.js';\nimport { buildClientInfoFromHomeAccountId } from '../account/ClientInfo.js';\nimport { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.\r\n */\r\nvar BaseClient = /** @class */ (function () {\r\n function BaseClient(configuration, performanceClient) {\r\n // Set the configuration\r\n this.config = buildClientConfiguration(configuration);\r\n // Initialize the logger\r\n this.logger = new Logger(this.config.loggerOptions, name, version);\r\n // Initialize crypto\r\n this.cryptoUtils = this.config.cryptoInterface;\r\n // Initialize storage interface\r\n this.cacheManager = this.config.storageInterface;\r\n // Set the network interface\r\n this.networkClient = this.config.networkInterface;\r\n // Set the NetworkManager\r\n this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);\r\n // Set TelemetryManager\r\n this.serverTelemetryManager = this.config.serverTelemetryManager;\r\n // set Authority\r\n this.authority = this.config.authOptions.authority;\r\n // set performance telemetry client\r\n this.performanceClient = performanceClient;\r\n }\r\n /**\r\n * Creates default headers for requests to token endpoint\r\n */\r\n BaseClient.prototype.createTokenRequestHeaders = function (ccsCred) {\r\n var headers = {};\r\n headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;\r\n if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {\r\n switch (ccsCred.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n var clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);\r\n headers[HeaderNames.CCS_HEADER] = \"Oid:\" + clientInfo.uid + \"@\" + clientInfo.utid;\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n headers[HeaderNames.CCS_HEADER] = \"UPN: \" + ccsCred.credential;\r\n break;\r\n }\r\n }\r\n return headers;\r\n };\r\n /**\r\n * Http post to token endpoint\r\n * @param tokenEndpoint\r\n * @param queryString\r\n * @param headers\r\n * @param thumbprint\r\n */\r\n BaseClient.prototype.executePostToTokenEndpoint = function (tokenEndpoint, queryString, headers, thumbprint) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var response;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers })];\r\n case 1:\r\n response = _a.sent();\r\n if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {\r\n // Telemetry data successfully logged by server, clear Telemetry cache\r\n this.config.serverTelemetryManager.clearTelemetryCache();\r\n }\r\n return [2 /*return*/, response];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Updates the authority object of the client. Endpoint discovery must be completed.\r\n * @param updatedAuthority\r\n */\r\n BaseClient.prototype.updateAuthority = function (updatedAuthority) {\r\n if (!updatedAuthority.discoveryComplete()) {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Updated authority has not completed endpoint discovery.\");\r\n }\r\n this.authority = updatedAuthority;\r\n };\r\n /**\r\n * Creates query string for the /token request\r\n * @param request\r\n */\r\n BaseClient.prototype.createTokenQueryParameters = function (request) {\r\n var parameterBuilder = new RequestParameterBuilder();\r\n if (request.tokenQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);\r\n }\r\n return parameterBuilder.createQueryString();\r\n };\r\n return BaseClient;\r\n}());\n\nexport { BaseClient };\n//# sourceMappingURL=BaseClient.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { CredentialType, CacheType, Separators, Constants, AuthenticationScheme } from '../../utils/Constants.js';\nimport { ClientAuthError } from '../../error/ClientAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Base type for credentials to be stored in the cache: eg: ACCESS_TOKEN, ID_TOKEN etc\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key: -------\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, usually only used for refresh tokens\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)\r\n * requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request\r\n * userAssertionHash: Matches the SHA 256 hash of the obo_assertion for the OBO flow\r\n * }\r\n */\r\nvar CredentialEntity = /** @class */ (function () {\r\n function CredentialEntity() {\r\n }\r\n /**\r\n * Generate Account Id key component as per the schema: -\r\n */\r\n CredentialEntity.prototype.generateAccountId = function () {\r\n return CredentialEntity.generateAccountIdForCacheKey(this.homeAccountId, this.environment);\r\n };\r\n /**\r\n * Generate Credential Id key component as per the schema: --\r\n */\r\n CredentialEntity.prototype.generateCredentialId = function () {\r\n return CredentialEntity.generateCredentialIdForCacheKey(this.credentialType, this.clientId, this.realm, this.familyId);\r\n };\r\n /**\r\n * Generate target key component as per schema: \r\n */\r\n CredentialEntity.prototype.generateTarget = function () {\r\n return CredentialEntity.generateTargetForCacheKey(this.target);\r\n };\r\n /**\r\n * generates credential key\r\n */\r\n CredentialEntity.prototype.generateCredentialKey = function () {\r\n return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId, this.tokenType, this.requestedClaimsHash);\r\n };\r\n /**\r\n * returns the type of the cache (in this case credential)\r\n */\r\n CredentialEntity.prototype.generateType = function () {\r\n switch (this.credentialType) {\r\n case CredentialType.ID_TOKEN:\r\n return CacheType.ID_TOKEN;\r\n case CredentialType.ACCESS_TOKEN:\r\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:\r\n return CacheType.ACCESS_TOKEN;\r\n case CredentialType.REFRESH_TOKEN:\r\n return CacheType.REFRESH_TOKEN;\r\n default: {\r\n throw ClientAuthError.createUnexpectedCredentialTypeError();\r\n }\r\n }\r\n };\r\n /**\r\n * generates credential key\r\n * -\\-----\r\n */\r\n CredentialEntity.generateCredentialCacheKey = function (homeAccountId, environment, credentialType, clientId, realm, target, familyId, tokenType, requestedClaimsHash) {\r\n var credentialKey = [\r\n this.generateAccountIdForCacheKey(homeAccountId, environment),\r\n this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),\r\n this.generateTargetForCacheKey(target),\r\n this.generateClaimsHashForCacheKey(requestedClaimsHash),\r\n this.generateSchemeForCacheKey(tokenType)\r\n ];\r\n return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * generates Account Id for keys\r\n * @param homeAccountId\r\n * @param environment\r\n */\r\n CredentialEntity.generateAccountIdForCacheKey = function (homeAccountId, environment) {\r\n var accountId = [homeAccountId, environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Generates Credential Id for keys\r\n * @param credentialType\r\n * @param realm\r\n * @param clientId\r\n * @param familyId\r\n */\r\n CredentialEntity.generateCredentialIdForCacheKey = function (credentialType, clientId, realm, familyId) {\r\n var clientOrFamilyId = credentialType === CredentialType.REFRESH_TOKEN\r\n ? familyId || clientId\r\n : clientId;\r\n var credentialId = [\r\n credentialType,\r\n clientOrFamilyId,\r\n realm || Constants.EMPTY_STRING,\r\n ];\r\n return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Generate target key component as per schema: \r\n */\r\n CredentialEntity.generateTargetForCacheKey = function (scopes) {\r\n return (scopes || Constants.EMPTY_STRING).toLowerCase();\r\n };\r\n /**\r\n * Generate requested claims key component as per schema: \r\n */\r\n CredentialEntity.generateClaimsHashForCacheKey = function (requestedClaimsHash) {\r\n return (requestedClaimsHash || Constants.EMPTY_STRING).toLowerCase();\r\n };\r\n /**\r\n * Generate scheme key componenet as per schema: \r\n */\r\n CredentialEntity.generateSchemeForCacheKey = function (tokenType) {\r\n /*\r\n * PoP Tokens and SSH certs include scheme in cache key\r\n * Cast to lowercase to handle \"bearer\" from ADFS\r\n */\r\n return (tokenType && tokenType.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;\r\n };\r\n return CredentialEntity;\r\n}());\n\nexport { CredentialEntity };\n//# sourceMappingURL=CredentialEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../../_virtual/_tslib.js';\nimport { CredentialEntity } from './CredentialEntity.js';\nimport { CredentialType } from '../../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ID_TOKEN Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-idtoken-clientId-contoso.com-\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * }\r\n */\r\nvar IdTokenEntity = /** @class */ (function (_super) {\r\n __extends(IdTokenEntity, _super);\r\n function IdTokenEntity() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Create IdTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\n IdTokenEntity.createIdTokenEntity = function (homeAccountId, environment, idToken, clientId, tenantId) {\r\n var idTokenEntity = new IdTokenEntity();\r\n idTokenEntity.credentialType = CredentialType.ID_TOKEN;\r\n idTokenEntity.homeAccountId = homeAccountId;\r\n idTokenEntity.environment = environment;\r\n idTokenEntity.clientId = clientId;\r\n idTokenEntity.secret = idToken;\r\n idTokenEntity.realm = tenantId;\r\n return idTokenEntity;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n IdTokenEntity.isIdTokenEntity = function (entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity[\"credentialType\"] === CredentialType.ID_TOKEN);\r\n };\r\n return IdTokenEntity;\r\n}(CredentialEntity));\n\nexport { IdTokenEntity };\n//# sourceMappingURL=IdTokenEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Utility class which exposes functions for managing date and time operations.\r\n */\r\nvar TimeUtils = /** @class */ (function () {\r\n function TimeUtils() {\r\n }\r\n /**\r\n * return the current time in Unix time (seconds).\r\n */\r\n TimeUtils.nowSeconds = function () {\r\n // Date.getTime() returns in milliseconds.\r\n return Math.round(new Date().getTime() / 1000.0);\r\n };\r\n /**\r\n * check if a token is expired based on given UTC time in seconds.\r\n * @param expiresOn\r\n */\r\n TimeUtils.isTokenExpired = function (expiresOn, offset) {\r\n // check for access token expiry\r\n var expirationSec = Number(expiresOn) || 0;\r\n var offsetCurrentTimeSec = TimeUtils.nowSeconds() + offset;\r\n // If current time + offset is greater than token expiration time, then token is expired.\r\n return (offsetCurrentTimeSec > expirationSec);\r\n };\r\n /**\r\n * If the current time is earlier than the time that a token was cached at, we must discard the token\r\n * i.e. The system clock was turned back after acquiring the cached token\r\n * @param cachedAt\r\n * @param offset\r\n */\r\n TimeUtils.wasClockTurnedBack = function (cachedAt) {\r\n var cachedAtSec = Number(cachedAt);\r\n return cachedAtSec > TimeUtils.nowSeconds();\r\n };\r\n /**\r\n * Waits for t number of milliseconds\r\n * @param t number\r\n * @param value T\r\n */\r\n TimeUtils.delay = function (t, value) {\r\n return new Promise(function (resolve) { return setTimeout(function () { return resolve(value); }, t); });\r\n };\r\n return TimeUtils;\r\n}());\n\nexport { TimeUtils };\n//# sourceMappingURL=TimeUtils.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../../_virtual/_tslib.js';\nimport { CredentialEntity } from './CredentialEntity.js';\nimport { CredentialType, AuthenticationScheme } from '../../utils/Constants.js';\nimport { TimeUtils } from '../../utils/TimeUtils.js';\nimport { StringUtils } from '../../utils/StringUtils.js';\nimport { AuthToken } from '../../account/AuthToken.js';\nimport { ClientAuthError } from '../../error/ClientAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ACCESS_TOKEN Credential Type\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-accesstoken-clientId-contoso.com-user.read\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, usually only used for refresh tokens\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * cachedAt: Absolute device time when entry was created in the cache.\r\n * expiresOn: Token expiry time, calculated based on current UTC time in seconds. Represented as a string.\r\n * extendedExpiresOn: Additional extended expiry time until when token is valid in case of server-side outage. Represented as string in UTC seconds.\r\n * keyId: used for POP and SSH tokenTypes\r\n * tokenType: Type of the token issued. Usually \"Bearer\"\r\n * }\r\n */\r\nvar AccessTokenEntity = /** @class */ (function (_super) {\r\n __extends(AccessTokenEntity, _super);\r\n function AccessTokenEntity() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Create AccessTokenEntity\r\n * @param homeAccountId\r\n * @param environment\r\n * @param accessToken\r\n * @param clientId\r\n * @param tenantId\r\n * @param scopes\r\n * @param expiresOn\r\n * @param extExpiresOn\r\n */\r\n AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, userAssertionHash, keyId, requestedClaims, requestedClaimsHash) {\r\n var _a, _b;\r\n var atEntity = new AccessTokenEntity();\r\n atEntity.homeAccountId = homeAccountId;\r\n atEntity.credentialType = CredentialType.ACCESS_TOKEN;\r\n atEntity.secret = accessToken;\r\n var currentTime = TimeUtils.nowSeconds();\r\n atEntity.cachedAt = currentTime.toString();\r\n /*\r\n * Token expiry time.\r\n * This value should be  calculated based on the current UTC time measured locally and the value  expires_in Represented as a string in JSON.\r\n */\r\n atEntity.expiresOn = expiresOn.toString();\r\n atEntity.extendedExpiresOn = extExpiresOn.toString();\r\n if (refreshOn) {\r\n atEntity.refreshOn = refreshOn.toString();\r\n }\r\n atEntity.environment = environment;\r\n atEntity.clientId = clientId;\r\n atEntity.realm = tenantId;\r\n atEntity.target = scopes;\r\n atEntity.userAssertionHash = userAssertionHash;\r\n atEntity.tokenType = StringUtils.isEmpty(tokenType) ? AuthenticationScheme.BEARER : tokenType;\r\n if (requestedClaims) {\r\n atEntity.requestedClaims = requestedClaims;\r\n atEntity.requestedClaimsHash = requestedClaimsHash;\r\n }\r\n /*\r\n * Create Access Token With Auth Scheme instead of regular access token\r\n * Cast to lower to handle \"bearer\" from ADFS\r\n */\r\n if (((_a = atEntity.tokenType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== AuthenticationScheme.BEARER.toLowerCase()) {\r\n atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;\r\n switch (atEntity.tokenType) {\r\n case AuthenticationScheme.POP:\r\n // Make sure keyId is present and add it to credential\r\n var tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);\r\n if (!((_b = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _b === void 0 ? void 0 : _b.kid)) {\r\n throw ClientAuthError.createTokenClaimsRequiredError();\r\n }\r\n atEntity.keyId = tokenClaims.cnf.kid;\r\n break;\r\n case AuthenticationScheme.SSH:\r\n atEntity.keyId = keyId;\r\n }\r\n }\r\n return atEntity;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n AccessTokenEntity.isAccessTokenEntity = function (entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity.hasOwnProperty(\"target\") &&\r\n (entity[\"credentialType\"] === CredentialType.ACCESS_TOKEN || entity[\"credentialType\"] === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));\r\n };\r\n return AccessTokenEntity;\r\n}(CredentialEntity));\n\nexport { AccessTokenEntity };\n//# sourceMappingURL=AccessTokenEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../../_virtual/_tslib.js';\nimport { CredentialEntity } from './CredentialEntity.js';\nimport { CredentialType } from '../../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * REFRESH_TOKEN Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-refreshtoken-clientId--\r\n *\r\n * Value:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, '1' represents Microsoft Family\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * }\r\n */\r\nvar RefreshTokenEntity = /** @class */ (function (_super) {\r\n __extends(RefreshTokenEntity, _super);\r\n function RefreshTokenEntity() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Create RefreshTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\n RefreshTokenEntity.createRefreshTokenEntity = function (homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash) {\r\n var rtEntity = new RefreshTokenEntity();\r\n rtEntity.clientId = clientId;\r\n rtEntity.credentialType = CredentialType.REFRESH_TOKEN;\r\n rtEntity.environment = environment;\r\n rtEntity.homeAccountId = homeAccountId;\r\n rtEntity.secret = refreshToken;\r\n rtEntity.userAssertionHash = userAssertionHash;\r\n if (familyId)\r\n rtEntity.familyId = familyId;\r\n return rtEntity;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n RefreshTokenEntity.isRefreshTokenEntity = function (entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity[\"credentialType\"] === CredentialType.REFRESH_TOKEN);\r\n };\r\n return RefreshTokenEntity;\r\n}(CredentialEntity));\n\nexport { RefreshTokenEntity };\n//# sourceMappingURL=RefreshTokenEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { Constants } from '../utils/Constants.js';\nimport { AuthError } from './AuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * InteractionRequiredServerErrorMessage contains string constants used by error codes and messages returned by the server indicating interaction is required\r\n */\r\nvar InteractionRequiredServerErrorMessage = [\r\n \"interaction_required\",\r\n \"consent_required\",\r\n \"login_required\"\r\n];\r\nvar InteractionRequiredAuthSubErrorMessage = [\r\n \"message_only\",\r\n \"additional_action\",\r\n \"basic_action\",\r\n \"user_password_expired\",\r\n \"consent_required\"\r\n];\r\n/**\r\n * Interaction required errors defined by the SDK\r\n */\r\nvar InteractionRequiredAuthErrorMessage = {\r\n noTokensFoundError: {\r\n code: \"no_tokens_found\",\r\n desc: \"No refresh token found in the cache. Please sign-in.\"\r\n },\r\n native_account_unavailable: {\r\n code: \"native_account_unavailable\",\r\n desc: \"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.\"\r\n }\r\n};\r\n/**\r\n * Error thrown when user interaction is required.\r\n */\r\nvar InteractionRequiredAuthError = /** @class */ (function (_super) {\r\n __extends(InteractionRequiredAuthError, _super);\r\n function InteractionRequiredAuthError(errorCode, errorMessage, subError, timestamp, traceId, correlationId, claims) {\r\n var _this = _super.call(this, errorCode, errorMessage, subError) || this;\r\n Object.setPrototypeOf(_this, InteractionRequiredAuthError.prototype);\r\n _this.timestamp = timestamp || Constants.EMPTY_STRING;\r\n _this.traceId = traceId || Constants.EMPTY_STRING;\r\n _this.correlationId = correlationId || Constants.EMPTY_STRING;\r\n _this.claims = claims || Constants.EMPTY_STRING;\r\n _this.name = \"InteractionRequiredAuthError\";\r\n return _this;\r\n }\r\n /**\r\n * Helper function used to determine if an error thrown by the server requires interaction to resolve\r\n * @param errorCode\r\n * @param errorString\r\n * @param subError\r\n */\r\n InteractionRequiredAuthError.isInteractionRequiredError = function (errorCode, errorString, subError) {\r\n var isInteractionRequiredErrorCode = !!errorCode && InteractionRequiredServerErrorMessage.indexOf(errorCode) > -1;\r\n var isInteractionRequiredSubError = !!subError && InteractionRequiredAuthSubErrorMessage.indexOf(subError) > -1;\r\n var isInteractionRequiredErrorDesc = !!errorString && InteractionRequiredServerErrorMessage.some(function (irErrorCode) {\r\n return errorString.indexOf(irErrorCode) > -1;\r\n });\r\n return isInteractionRequiredErrorCode || isInteractionRequiredErrorDesc || isInteractionRequiredSubError;\r\n };\r\n /**\r\n * Creates an error thrown when the authorization code required for a token request is null or empty.\r\n */\r\n InteractionRequiredAuthError.createNoTokensFoundError = function () {\r\n return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.noTokensFoundError.code, InteractionRequiredAuthErrorMessage.noTokensFoundError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the native broker returns ACCOUNT_UNAVAILABLE status, indicating that the account was removed and interactive sign-in is required\r\n * @returns\r\n */\r\n InteractionRequiredAuthError.createNativeAccountUnavailableError = function () {\r\n return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.native_account_unavailable.code, InteractionRequiredAuthErrorMessage.native_account_unavailable.desc);\r\n };\r\n return InteractionRequiredAuthError;\r\n}(AuthError));\n\nexport { InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, InteractionRequiredAuthSubErrorMessage, InteractionRequiredServerErrorMessage };\n//# sourceMappingURL=InteractionRequiredAuthError.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar CacheRecord = /** @class */ (function () {\r\n function CacheRecord(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {\r\n this.account = accountEntity || null;\r\n this.idToken = idTokenEntity || null;\r\n this.accessToken = accessTokenEntity || null;\r\n this.refreshToken = refreshTokenEntity || null;\r\n this.appMetadata = appMetadataEntity || null;\r\n }\r\n return CacheRecord;\r\n}());\n\nexport { CacheRecord };\n//# sourceMappingURL=CacheRecord.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { StringUtils } from './StringUtils.js';\nimport { Constants } from './Constants.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Class which provides helpers for OAuth 2.0 protocol specific values\r\n */\r\nvar ProtocolUtils = /** @class */ (function () {\r\n function ProtocolUtils() {\r\n }\r\n /**\r\n * Appends user state with random guid, or returns random guid.\r\n * @param userState\r\n * @param randomGuid\r\n */\r\n ProtocolUtils.setRequestState = function (cryptoObj, userState, meta) {\r\n var libraryState = ProtocolUtils.generateLibraryState(cryptoObj, meta);\r\n return !StringUtils.isEmpty(userState) ? \"\" + libraryState + Constants.RESOURCE_DELIM + userState : libraryState;\r\n };\r\n /**\r\n * Generates the state value used by the common library.\r\n * @param randomGuid\r\n * @param cryptoObj\r\n */\r\n ProtocolUtils.generateLibraryState = function (cryptoObj, meta) {\r\n if (!cryptoObj) {\r\n throw ClientAuthError.createNoCryptoObjectError(\"generateLibraryState\");\r\n }\r\n // Create a state object containing a unique id and the timestamp of the request creation\r\n var stateObj = {\r\n id: cryptoObj.createNewGuid()\r\n };\r\n if (meta) {\r\n stateObj.meta = meta;\r\n }\r\n var stateString = JSON.stringify(stateObj);\r\n return cryptoObj.base64Encode(stateString);\r\n };\r\n /**\r\n * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.\r\n * @param state\r\n * @param cryptoObj\r\n */\r\n ProtocolUtils.parseRequestState = function (cryptoObj, state) {\r\n if (!cryptoObj) {\r\n throw ClientAuthError.createNoCryptoObjectError(\"parseRequestState\");\r\n }\r\n if (StringUtils.isEmpty(state)) {\r\n throw ClientAuthError.createInvalidStateError(state, \"Null, undefined or empty state\");\r\n }\r\n try {\r\n // Split the state between library state and user passed state and decode them separately\r\n var splitState = state.split(Constants.RESOURCE_DELIM);\r\n var libraryState = splitState[0];\r\n var userState = splitState.length > 1 ? splitState.slice(1).join(Constants.RESOURCE_DELIM) : Constants.EMPTY_STRING;\r\n var libraryStateString = cryptoObj.base64Decode(libraryState);\r\n var libraryStateObj = JSON.parse(libraryStateString);\r\n return {\r\n userRequestState: !StringUtils.isEmpty(userState) ? userState : Constants.EMPTY_STRING,\r\n libraryState: libraryStateObj\r\n };\r\n }\r\n catch (e) {\r\n throw ClientAuthError.createInvalidStateError(state, e);\r\n }\r\n };\r\n return ProtocolUtils;\r\n}());\n\nexport { ProtocolUtils };\n//# sourceMappingURL=ProtocolUtils.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { AADAuthorityConstants, Constants } from '../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Url object class which can perform various transformations on url strings.\r\n */\r\nvar UrlString = /** @class */ (function () {\r\n function UrlString(url) {\r\n this._urlString = url;\r\n if (StringUtils.isEmpty(this._urlString)) {\r\n // Throws error if url is empty\r\n throw ClientConfigurationError.createUrlEmptyError();\r\n }\r\n if (StringUtils.isEmpty(this.getHash())) {\r\n this._urlString = UrlString.canonicalizeUri(url);\r\n }\r\n }\r\n Object.defineProperty(UrlString.prototype, \"urlString\", {\r\n get: function () {\r\n return this._urlString;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Ensure urls are lower case and end with a / character.\r\n * @param url\r\n */\r\n UrlString.canonicalizeUri = function (url) {\r\n if (url) {\r\n var lowerCaseUrl = url.toLowerCase();\r\n if (StringUtils.endsWith(lowerCaseUrl, \"?\")) {\r\n lowerCaseUrl = lowerCaseUrl.slice(0, -1);\r\n }\r\n else if (StringUtils.endsWith(lowerCaseUrl, \"?/\")) {\r\n lowerCaseUrl = lowerCaseUrl.slice(0, -2);\r\n }\r\n if (!StringUtils.endsWith(lowerCaseUrl, \"/\")) {\r\n lowerCaseUrl += \"/\";\r\n }\r\n return lowerCaseUrl;\r\n }\r\n return url;\r\n };\r\n /**\r\n * Throws if urlString passed is not a valid authority URI string.\r\n */\r\n UrlString.prototype.validateAsUri = function () {\r\n // Attempts to parse url for uri components\r\n var components;\r\n try {\r\n components = this.getUrlComponents();\r\n }\r\n catch (e) {\r\n throw ClientConfigurationError.createUrlParseError(e);\r\n }\r\n // Throw error if URI or path segments are not parseable.\r\n if (!components.HostNameAndPort || !components.PathSegments) {\r\n throw ClientConfigurationError.createUrlParseError(\"Given url string: \" + this.urlString);\r\n }\r\n // Throw error if uri is insecure.\r\n if (!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ClientConfigurationError.createInsecureAuthorityUriError(this.urlString);\r\n }\r\n };\r\n /**\r\n * Given a url and a query string return the url with provided query string appended\r\n * @param url\r\n * @param queryString\r\n */\r\n UrlString.appendQueryString = function (url, queryString) {\r\n if (StringUtils.isEmpty(queryString)) {\r\n return url;\r\n }\r\n return url.indexOf(\"?\") < 0 ? url + \"?\" + queryString : url + \"&\" + queryString;\r\n };\r\n /**\r\n * Returns a url with the hash removed\r\n * @param url\r\n */\r\n UrlString.removeHashFromUrl = function (url) {\r\n return UrlString.canonicalizeUri(url.split(\"#\")[0]);\r\n };\r\n /**\r\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\r\n * @param href The url\r\n * @param tenantId The tenant id to replace\r\n */\r\n UrlString.prototype.replaceTenantPath = function (tenantId) {\r\n var urlObject = this.getUrlComponents();\r\n var pathArray = urlObject.PathSegments;\r\n if (tenantId && (pathArray.length !== 0 && (pathArray[0] === AADAuthorityConstants.COMMON || pathArray[0] === AADAuthorityConstants.ORGANIZATIONS))) {\r\n pathArray[0] = tenantId;\r\n }\r\n return UrlString.constructAuthorityUriFromObject(urlObject);\r\n };\r\n /**\r\n * Returns the anchor part(#) of the URL\r\n */\r\n UrlString.prototype.getHash = function () {\r\n return UrlString.parseHash(this.urlString);\r\n };\r\n /**\r\n * Parses out the components from a url string.\r\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\r\n */\r\n UrlString.prototype.getUrlComponents = function () {\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n var regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n // If url string does not match regEx, we throw an error\r\n var match = this.urlString.match(regEx);\r\n if (!match) {\r\n throw ClientConfigurationError.createUrlParseError(\"Given url string: \" + this.urlString);\r\n }\r\n // Url component object\r\n var urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5],\r\n QueryString: match[7]\r\n };\r\n var pathSegments = urlComponents.AbsolutePath.split(\"/\");\r\n pathSegments = pathSegments.filter(function (val) { return val && val.length > 0; }); // remove empty elements\r\n urlComponents.PathSegments = pathSegments;\r\n if (!StringUtils.isEmpty(urlComponents.QueryString) && urlComponents.QueryString.endsWith(\"/\")) {\r\n urlComponents.QueryString = urlComponents.QueryString.substring(0, urlComponents.QueryString.length - 1);\r\n }\r\n return urlComponents;\r\n };\r\n UrlString.getDomainFromUrl = function (url) {\r\n var regEx = RegExp(\"^([^:/?#]+://)?([^/?#]*)\");\r\n var match = url.match(regEx);\r\n if (!match) {\r\n throw ClientConfigurationError.createUrlParseError(\"Given url string: \" + url);\r\n }\r\n return match[2];\r\n };\r\n UrlString.getAbsoluteUrl = function (relativeUrl, baseUrl) {\r\n if (relativeUrl[0] === Constants.FORWARD_SLASH) {\r\n var url = new UrlString(baseUrl);\r\n var baseComponents = url.getUrlComponents();\r\n return baseComponents.Protocol + \"//\" + baseComponents.HostNameAndPort + relativeUrl;\r\n }\r\n return relativeUrl;\r\n };\r\n /**\r\n * Parses hash string from given string. Returns empty string if no hash symbol is found.\r\n * @param hashString\r\n */\r\n UrlString.parseHash = function (hashString) {\r\n var hashIndex1 = hashString.indexOf(\"#\");\r\n var hashIndex2 = hashString.indexOf(\"#/\");\r\n if (hashIndex2 > -1) {\r\n return hashString.substring(hashIndex2 + 2);\r\n }\r\n else if (hashIndex1 > -1) {\r\n return hashString.substring(hashIndex1 + 1);\r\n }\r\n return Constants.EMPTY_STRING;\r\n };\r\n /**\r\n * Parses query string from given string. Returns empty string if no query symbol is found.\r\n * @param queryString\r\n */\r\n UrlString.parseQueryString = function (queryString) {\r\n var queryIndex1 = queryString.indexOf(\"?\");\r\n var queryIndex2 = queryString.indexOf(\"/?\");\r\n if (queryIndex2 > -1) {\r\n return queryString.substring(queryIndex2 + 2);\r\n }\r\n else if (queryIndex1 > -1) {\r\n return queryString.substring(queryIndex1 + 1);\r\n }\r\n return Constants.EMPTY_STRING;\r\n };\r\n UrlString.constructAuthorityUriFromObject = function (urlObject) {\r\n return new UrlString(urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + urlObject.PathSegments.join(\"/\"));\r\n };\r\n /**\r\n * Returns URL hash as server auth code response object.\r\n */\r\n UrlString.getDeserializedHash = function (hash) {\r\n // Check if given hash is empty\r\n if (StringUtils.isEmpty(hash)) {\r\n return {};\r\n }\r\n // Strip the # symbol if present\r\n var parsedHash = UrlString.parseHash(hash);\r\n // If # symbol was not present, above will return empty string, so give original hash value\r\n var deserializedHash = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedHash) ? hash : parsedHash);\r\n // Check if deserialization didn't work\r\n if (!deserializedHash) {\r\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedHash));\r\n }\r\n return deserializedHash;\r\n };\r\n /**\r\n * Returns URL query string as server auth code response object.\r\n */\r\n UrlString.getDeserializedQueryString = function (query) {\r\n // Check if given query is empty\r\n if (StringUtils.isEmpty(query)) {\r\n return {};\r\n }\r\n // Strip the ? symbol if present\r\n var parsedQueryString = UrlString.parseQueryString(query);\r\n // If ? symbol was not present, above will return empty string, so give original query value\r\n var deserializedQueryString = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedQueryString) ? query : parsedQueryString);\r\n // Check if deserialization didn't work\r\n if (!deserializedQueryString) {\r\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedQueryString));\r\n }\r\n return deserializedQueryString;\r\n };\r\n /**\r\n * Check if the hash of the URL string contains known properties\r\n */\r\n UrlString.hashContainsKnownProperties = function (hash) {\r\n if (StringUtils.isEmpty(hash) || hash.indexOf(\"=\") < 0) {\r\n // Hash doesn't contain key/value pairs\r\n return false;\r\n }\r\n var parameters = UrlString.getDeserializedHash(hash);\r\n return !!(parameters.code ||\r\n parameters.error_description ||\r\n parameters.error ||\r\n parameters.state);\r\n };\r\n return UrlString;\r\n}());\n\nexport { UrlString };\n//# sourceMappingURL=UrlString.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.\r\n *\r\n * @export\r\n * @enum {number}\r\n */\r\nvar PerformanceEvents;\r\n(function (PerformanceEvents) {\r\n /**\r\n * acquireTokenByCode API (msal-browser and msal-node).\r\n * Used to acquire tokens by trading an authorization code against the token endpoint.\r\n */\r\n PerformanceEvents[\"AcquireTokenByCode\"] = \"acquireTokenByCode\";\r\n /**\r\n * acquireTokenByRefreshToken API (msal-browser and msal-node).\r\n * Used to renew an access token using a refresh token against the token endpoint.\r\n */\r\n PerformanceEvents[\"AcquireTokenByRefreshToken\"] = \"acquireTokenByRefreshToken\";\r\n /**\r\n * acquireTokenSilent API (msal-browser and msal-node).\r\n * Used to silently acquire a new access token (from the cache or the network).\r\n */\r\n PerformanceEvents[\"AcquireTokenSilent\"] = \"acquireTokenSilent\";\r\n /**\r\n * acquireTokenSilentAsync (msal-browser).\r\n * Internal API for acquireTokenSilent.\r\n */\r\n PerformanceEvents[\"AcquireTokenSilentAsync\"] = \"acquireTokenSilentAsync\";\r\n /**\r\n * acquireTokenPopup (msal-browser).\r\n * Used to acquire a new access token interactively through pop ups\r\n */\r\n PerformanceEvents[\"AcquireTokenPopup\"] = \"acquireTokenPopup\";\r\n /**\r\n * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).\r\n * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.\r\n */\r\n PerformanceEvents[\"CryptoOptsGetPublicKeyThumbprint\"] = \"cryptoOptsGetPublicKeyThumbprint\";\r\n /**\r\n * signJwt API in CryptoOpts class (msal-browser).\r\n * Used to signed a pop token.\r\n */\r\n PerformanceEvents[\"CryptoOptsSignJwt\"] = \"cryptoOptsSignJwt\";\r\n /**\r\n * acquireToken API in the SilentCacheClient class (msal-browser).\r\n * Used to read access tokens from the cache.\r\n */\r\n PerformanceEvents[\"SilentCacheClientAcquireToken\"] = \"silentCacheClientAcquireToken\";\r\n /**\r\n * acquireToken API in the SilentIframeClient class (msal-browser).\r\n * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.\r\n */\r\n PerformanceEvents[\"SilentIframeClientAcquireToken\"] = \"silentIframeClientAcquireToken\";\r\n /**\r\n * acquireToken API in SilentRereshClient (msal-browser).\r\n * Used to acquire a new set of tokens from the token endpoint using a refresh token.\r\n */\r\n PerformanceEvents[\"SilentRefreshClientAcquireToken\"] = \"silentRefreshClientAcquireToken\";\r\n /**\r\n * ssoSilent API (msal-browser).\r\n * Used to silently acquire an authorization code and set of tokens using a hidden iframe.\r\n */\r\n PerformanceEvents[\"SsoSilent\"] = \"ssoSilent\";\r\n /**\r\n * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).\r\n * Used to load authority metadata for a request.\r\n */\r\n PerformanceEvents[\"StandardInteractionClientGetDiscoveredAuthority\"] = \"standardInteractionClientGetDiscoveredAuthority\";\r\n /**\r\n * acquireToken APIs in msal-browser.\r\n * Used to make an /authorize endpoint call with native brokering enabled.\r\n */\r\n PerformanceEvents[\"FetchAccountIdWithNativeBroker\"] = \"fetchAccountIdWithNativeBroker\";\r\n /**\r\n * acquireToken API in NativeInteractionClient class (msal-browser).\r\n * Used to acquire a token from Native component when native brokering is enabled.\r\n */\r\n PerformanceEvents[\"NativeInteractionClientAcquireToken\"] = \"nativeInteractionClientAcquireToken\";\r\n /**\r\n * Time spent creating default headers for requests to token endpoint\r\n */\r\n PerformanceEvents[\"BaseClientCreateTokenRequestHeaders\"] = \"baseClientCreateTokenRequestHeaders\";\r\n /**\r\n * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).\r\n */\r\n PerformanceEvents[\"BrokerHandhshake\"] = \"brokerHandshake\";\r\n /**\r\n * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .\r\n */\r\n PerformanceEvents[\"AcquireTokenByRefreshTokenInBroker\"] = \"acquireTokenByRefreshTokenInBroker\";\r\n /**\r\n * Time taken for token acquisition by broker\r\n */\r\n PerformanceEvents[\"AcquireTokenByBroker\"] = \"acquireTokenByBroker\";\r\n /**\r\n * Time spent on the network for refresh token acquisition\r\n */\r\n PerformanceEvents[\"RefreshTokenClientExecuteTokenRequest\"] = \"refreshTokenClientExecuteTokenRequest\";\r\n /**\r\n * Time taken for acquiring refresh token , records RT size\r\n */\r\n PerformanceEvents[\"RefreshTokenClientAcquireToken\"] = \"refreshTokenClientAcquireToken\";\r\n /**\r\n * Time taken for acquiring cached refresh token\r\n */\r\n PerformanceEvents[\"RefreshTokenClientAcquireTokenWithCachedRefreshToken\"] = \"refreshTokenClientAcquireTokenWithCachedRefreshToken\";\r\n /**\r\n * acquireTokenByRefreshToken API in RefreshTokenClient (msal-common).\r\n */\r\n PerformanceEvents[\"RefreshTokenClientAcquireTokenByRefreshToken\"] = \"refreshTokenClientAcquireTokenByRefreshToken\";\r\n /**\r\n * Helper function to create token request body in RefreshTokenClient (msal-common).\r\n */\r\n PerformanceEvents[\"RefreshTokenClientCreateTokenRequestBody\"] = \"refreshTokenClientCreateTokenRequestBody\";\r\n /**\r\n * acquireTokenFromCache (msal-browser).\r\n * Internal API for acquiring token from cache\r\n */\r\n PerformanceEvents[\"AcquireTokenFromCache\"] = \"acquireTokenFromCache\";\r\n /**\r\n * acquireTokenBySilentIframe (msal-browser).\r\n * Internal API for acquiring token by silent Iframe\r\n */\r\n PerformanceEvents[\"AcquireTokenBySilentIframe\"] = \"acquireTokenBySilentIframe\";\r\n /**\r\n * Internal API for initializing base request in BaseInteractionClient (msal-browser)\r\n */\r\n PerformanceEvents[\"InitializeBaseRequest\"] = \"initializeBaseRequest\";\r\n /**\r\n * Internal API for initializing silent request in SilentCacheClient (msal-browser)\r\n */\r\n PerformanceEvents[\"InitializeSilentRequest\"] = \"initializeSilentRequest\";\r\n PerformanceEvents[\"InitializeClientApplication\"] = \"initializeClientApplication\";\r\n /**\r\n * Helper function in SilentIframeClient class (msal-browser).\r\n */\r\n PerformanceEvents[\"SilentIframeClientTokenHelper\"] = \"silentIframeClientTokenHelper\";\r\n /**\r\n * SilentHandler\r\n */\r\n PerformanceEvents[\"SilentHandlerInitiateAuthRequest\"] = \"silentHandlerInitiateAuthRequest\";\r\n PerformanceEvents[\"SilentHandlerMonitorIframeForHash\"] = \"silentHandlerMonitorIframeForHash\";\r\n PerformanceEvents[\"SilentHandlerLoadFrame\"] = \"silentHandlerLoadFrame\";\r\n /**\r\n * Helper functions in StandardInteractionClient class (msal-browser)\r\n */\r\n PerformanceEvents[\"StandardInteractionClientCreateAuthCodeClient\"] = \"standardInteractionClientCreateAuthCodeClient\";\r\n PerformanceEvents[\"StandardInteractionClientGetClientConfiguration\"] = \"standardInteractionClientGetClientConfiguration\";\r\n PerformanceEvents[\"StandardInteractionClientInitializeAuthorizationRequest\"] = \"standardInteractionClientInitializeAuthorizationRequest\";\r\n PerformanceEvents[\"StandardInteractionClientInitializeAuthorizationCodeRequest\"] = \"standardInteractionClientInitializeAuthorizationCodeRequest\";\r\n /**\r\n * getAuthCodeUrl API (msal-browser and msal-node).\r\n */\r\n PerformanceEvents[\"GetAuthCodeUrl\"] = \"getAuthCodeUrl\";\r\n /**\r\n * Functions from InteractionHandler (msal-browser)\r\n */\r\n PerformanceEvents[\"HandleCodeResponseFromServer\"] = \"handleCodeResponseFromServer\";\r\n PerformanceEvents[\"HandleCodeResponseFromHash\"] = \"handleCodeResponseFromHash\";\r\n PerformanceEvents[\"UpdateTokenEndpointAuthority\"] = \"updateTokenEndpointAuthority\";\r\n /**\r\n * APIs in Authorization Code Client (msal-common)\r\n */\r\n PerformanceEvents[\"AuthClientAcquireToken\"] = \"authClientAcquireToken\";\r\n PerformanceEvents[\"AuthClientExecuteTokenRequest\"] = \"authClientExecuteTokenRequest\";\r\n PerformanceEvents[\"AuthClientCreateTokenRequestBody\"] = \"authClientCreateTokenRequestBody\";\r\n PerformanceEvents[\"AuthClientCreateQueryString\"] = \"authClientCreateQueryString\";\r\n /**\r\n * Generate functions in PopTokenGenerator (msal-common)\r\n */\r\n PerformanceEvents[\"PopTokenGenerateCnf\"] = \"popTokenGenerateCnf\";\r\n PerformanceEvents[\"PopTokenGenerateKid\"] = \"popTokenGenerateKid\";\r\n /**\r\n * handleServerTokenResponse API in ResponseHandler (msal-common)\r\n */\r\n PerformanceEvents[\"HandleServerTokenResponse\"] = \"handleServerTokenResponse\";\r\n /**\r\n * Authority functions\r\n */\r\n PerformanceEvents[\"AuthorityFactoryCreateDiscoveredInstance\"] = \"authorityFactoryCreateDiscoveredInstance\";\r\n PerformanceEvents[\"AuthorityResolveEndpointsAsync\"] = \"authorityResolveEndpointsAsync\";\r\n PerformanceEvents[\"AuthorityGetCloudDiscoveryMetadataFromNetwork\"] = \"authorityGetCloudDiscoveryMetadataFromNetwork\";\r\n PerformanceEvents[\"AuthorityUpdateCloudDiscoveryMetadata\"] = \"authorityUpdateCloudDiscoveryMetadata\";\r\n PerformanceEvents[\"AuthorityGetEndpointMetadataFromNetwork\"] = \"authorityGetEndpointMetadataFromNetwork\";\r\n PerformanceEvents[\"AuthorityUpdateEndpointMetadata\"] = \"authorityUpdateEndpointMetadata\";\r\n PerformanceEvents[\"AuthorityUpdateMetadataWithRegionalInformation\"] = \"authorityUpdateMetadataWithRegionalInformation\";\r\n /**\r\n * Region Discovery functions\r\n */\r\n PerformanceEvents[\"RegionDiscoveryDetectRegion\"] = \"regionDiscoveryDetectRegion\";\r\n PerformanceEvents[\"RegionDiscoveryGetRegionFromIMDS\"] = \"regionDiscoveryGetRegionFromIMDS\";\r\n PerformanceEvents[\"RegionDiscoveryGetCurrentVersion\"] = \"regionDiscoveryGetCurrentVersion\";\r\n PerformanceEvents[\"AcquireTokenByCodeAsync\"] = \"acquireTokenByCodeAsync\";\r\n PerformanceEvents[\"GetEndpointMetadataFromNetwork\"] = \"getEndpointMetadataFromNetwork\";\r\n PerformanceEvents[\"GetCloudDiscoveryMetadataFromNetworkMeasurement\"] = \"getCloudDiscoveryMetadataFromNetworkMeasurement\";\r\n PerformanceEvents[\"HandleRedirectPromiseMeasurement\"] = \"handleRedirectPromiseMeasurement\";\r\n PerformanceEvents[\"UpdateCloudDiscoveryMetadataMeasurement\"] = \"updateCloudDiscoveryMetadataMeasurement\";\r\n PerformanceEvents[\"UsernamePasswordClientAcquireToken\"] = \"usernamePasswordClientAcquireToken\";\r\n PerformanceEvents[\"NativeMessageHandlerHandshake\"] = \"nativeMessageHandlerHandshake\";\r\n})(PerformanceEvents || (PerformanceEvents = {}));\r\n/**\r\n * State of the performance event.\r\n *\r\n * @export\r\n * @enum {number}\r\n */\r\nvar PerformanceEventStatus;\r\n(function (PerformanceEventStatus) {\r\n PerformanceEventStatus[PerformanceEventStatus[\"NotStarted\"] = 0] = \"NotStarted\";\r\n PerformanceEventStatus[PerformanceEventStatus[\"InProgress\"] = 1] = \"InProgress\";\r\n PerformanceEventStatus[PerformanceEventStatus[\"Completed\"] = 2] = \"Completed\";\r\n})(PerformanceEventStatus || (PerformanceEventStatus = {}));\r\nvar IntFields = new Set([\r\n \"accessTokenSize\",\r\n \"durationMs\",\r\n \"idTokenSize\",\r\n \"matsSilentStatus\",\r\n \"matsHttpStatus\",\r\n \"refreshTokenSize\",\r\n \"queuedTimeMs\",\r\n \"startTimeMs\",\r\n \"status\",\r\n]);\n\nexport { IntFields, PerformanceEventStatus, PerformanceEvents };\n//# sourceMappingURL=PerformanceEvent.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { TimeUtils } from '../utils/TimeUtils.js';\nimport { UrlString } from '../url/UrlString.js';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar KeyLocation;\r\n(function (KeyLocation) {\r\n KeyLocation[\"SW\"] = \"sw\";\r\n KeyLocation[\"UHW\"] = \"uhw\";\r\n})(KeyLocation || (KeyLocation = {}));\r\nvar PopTokenGenerator = /** @class */ (function () {\r\n function PopTokenGenerator(cryptoUtils, performanceClient) {\r\n this.cryptoUtils = cryptoUtils;\r\n this.performanceClient = performanceClient;\r\n }\r\n /**\r\n * Generates the req_cnf validated at the RP in the POP protocol for SHR parameters\r\n * and returns an object containing the keyid, the full req_cnf string and the req_cnf string hash\r\n * @param request\r\n * @returns\r\n */\r\n PopTokenGenerator.prototype.generateCnf = function (request) {\r\n var _a, _b;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var reqCnf, reqCnfString, _c;\r\n return __generator(this, function (_d) {\r\n switch (_d.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.PopTokenGenerateKid, request.correlationId);\r\n return [4 /*yield*/, this.generateKid(request)];\r\n case 1:\r\n reqCnf = _d.sent();\r\n reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));\r\n _c = {\r\n kid: reqCnf.kid,\r\n reqCnfString: reqCnfString\r\n };\r\n return [4 /*yield*/, this.cryptoUtils.hashString(reqCnfString)];\r\n case 2: return [2 /*return*/, (_c.reqCnfHash = _d.sent(),\r\n _c)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Generates key_id for a SHR token request\r\n * @param request\r\n * @returns\r\n */\r\n PopTokenGenerator.prototype.generateKid = function (request) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var kidThumbprint;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.PopTokenGenerateKid, request.correlationId);\r\n return [4 /*yield*/, this.cryptoUtils.getPublicKeyThumbprint(request)];\r\n case 1:\r\n kidThumbprint = _b.sent();\r\n return [2 /*return*/, {\r\n kid: kidThumbprint,\r\n xms_ksl: KeyLocation.SW\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Signs the POP access_token with the local generated key-pair\r\n * @param accessToken\r\n * @param request\r\n * @returns\r\n */\r\n PopTokenGenerator.prototype.signPopToken = function (accessToken, keyId, request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.signPayload(accessToken, keyId, request)];\r\n });\r\n });\r\n };\r\n /**\r\n * Utility function to generate the signed JWT for an access_token\r\n * @param payload\r\n * @param kid\r\n * @param request\r\n * @param claims\r\n * @returns\r\n */\r\n PopTokenGenerator.prototype.signPayload = function (payload, keyId, request, claims) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, resourceUrlString, resourceUrlComponents;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n resourceRequestMethod = request.resourceRequestMethod, resourceRequestUri = request.resourceRequestUri, shrClaims = request.shrClaims, shrNonce = request.shrNonce;\r\n resourceUrlString = (resourceRequestUri) ? new UrlString(resourceRequestUri) : undefined;\r\n resourceUrlComponents = resourceUrlString === null || resourceUrlString === void 0 ? void 0 : resourceUrlString.getUrlComponents();\r\n return [4 /*yield*/, this.cryptoUtils.signJwt(__assign({ at: payload, ts: TimeUtils.nowSeconds(), m: resourceRequestMethod === null || resourceRequestMethod === void 0 ? void 0 : resourceRequestMethod.toUpperCase(), u: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.HostNameAndPort, nonce: shrNonce || this.cryptoUtils.createNewGuid(), p: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.AbsolutePath, q: (resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined, client_claims: shrClaims || undefined }, claims), keyId, request.correlationId)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n return PopTokenGenerator;\r\n}());\n\nexport { PopTokenGenerator };\n//# sourceMappingURL=PopTokenGenerator.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { Separators, APP_METADATA } from '../../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * APP_METADATA Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key: appmetadata--\r\n *\r\n * Value:\r\n * {\r\n * clientId: client ID of the application\r\n * environment: entity that issued the token, represented as a full host\r\n * familyId: Family ID identifier, '1' represents Microsoft Family\r\n * }\r\n */\r\nvar AppMetadataEntity = /** @class */ (function () {\r\n function AppMetadataEntity() {\r\n }\r\n /**\r\n * Generate AppMetadata Cache Key as per the schema: appmetadata--\r\n */\r\n AppMetadataEntity.prototype.generateAppMetadataKey = function () {\r\n return AppMetadataEntity.generateAppMetadataCacheKey(this.environment, this.clientId);\r\n };\r\n /**\r\n * Generate AppMetadata Cache Key\r\n */\r\n AppMetadataEntity.generateAppMetadataCacheKey = function (environment, clientId) {\r\n var appMetaDataKeyArray = [\r\n APP_METADATA,\r\n environment,\r\n clientId,\r\n ];\r\n return appMetaDataKeyArray.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n };\r\n /**\r\n * Creates AppMetadataEntity\r\n * @param clientId\r\n * @param environment\r\n * @param familyId\r\n */\r\n AppMetadataEntity.createAppMetadataEntity = function (clientId, environment, familyId) {\r\n var appMetadata = new AppMetadataEntity();\r\n appMetadata.clientId = clientId;\r\n appMetadata.environment = environment;\r\n if (familyId) {\r\n appMetadata.familyId = familyId;\r\n }\r\n return appMetadata;\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n AppMetadataEntity.isAppMetadataEntity = function (key, entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (key.indexOf(APP_METADATA) === 0 &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"environment\"));\r\n };\r\n return AppMetadataEntity;\r\n}());\n\nexport { AppMetadataEntity };\n//# sourceMappingURL=AppMetadataEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class instance helps track the memory changes facilitating\r\n * decisions to read from and write to the persistent cache\r\n */ var TokenCacheContext = /** @class */ (function () {\r\n function TokenCacheContext(tokenCache, hasChanged) {\r\n this.cache = tokenCache;\r\n this.hasChanged = hasChanged;\r\n }\r\n Object.defineProperty(TokenCacheContext.prototype, \"cacheHasChanged\", {\r\n /**\r\n * boolean which indicates the changes in cache\r\n */\r\n get: function () {\r\n return this.hasChanged;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(TokenCacheContext.prototype, \"tokenCache\", {\r\n /**\r\n * function to retrieve the token cache\r\n */\r\n get: function () {\r\n return this.cache;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return TokenCacheContext;\r\n}());\n\nexport { TokenCacheContext };\n//# sourceMappingURL=TokenCacheContext.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { buildClientInfo } from '../account/ClientInfo.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { ServerError } from '../error/ServerError.js';\nimport { AuthToken } from '../account/AuthToken.js';\nimport { ScopeSet } from '../request/ScopeSet.js';\nimport { AccountEntity } from '../cache/entities/AccountEntity.js';\nimport { AuthorityType } from '../authority/AuthorityType.js';\nimport { IdTokenEntity } from '../cache/entities/IdTokenEntity.js';\nimport { AccessTokenEntity } from '../cache/entities/AccessTokenEntity.js';\nimport { RefreshTokenEntity } from '../cache/entities/RefreshTokenEntity.js';\nimport { InteractionRequiredAuthError } from '../error/InteractionRequiredAuthError.js';\nimport { CacheRecord } from '../cache/entities/CacheRecord.js';\nimport { ProtocolUtils } from '../utils/ProtocolUtils.js';\nimport { Constants, AuthenticationScheme, THE_FAMILY_ID } from '../utils/Constants.js';\nimport { PopTokenGenerator } from '../crypto/PopTokenGenerator.js';\nimport { AppMetadataEntity } from '../cache/entities/AppMetadataEntity.js';\nimport { TokenCacheContext } from '../cache/persistence/TokenCacheContext.js';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Class that handles response parsing.\r\n */\r\nvar ResponseHandler = /** @class */ (function () {\r\n function ResponseHandler(clientId, cacheStorage, cryptoObj, logger, serializableCache, persistencePlugin, performanceClient) {\r\n this.clientId = clientId;\r\n this.cacheStorage = cacheStorage;\r\n this.cryptoObj = cryptoObj;\r\n this.logger = logger;\r\n this.serializableCache = serializableCache;\r\n this.persistencePlugin = persistencePlugin;\r\n this.performanceClient = performanceClient;\r\n }\r\n /**\r\n * Function which validates server authorization code response.\r\n * @param serverResponseHash\r\n * @param cachedState\r\n * @param cryptoObj\r\n */\r\n ResponseHandler.prototype.validateServerAuthorizationCodeResponse = function (serverResponseHash, cachedState, cryptoObj) {\r\n if (!serverResponseHash.state || !cachedState) {\r\n throw !serverResponseHash.state ? ClientAuthError.createStateNotFoundError(\"Server State\") : ClientAuthError.createStateNotFoundError(\"Cached State\");\r\n }\r\n if (decodeURIComponent(serverResponseHash.state) !== decodeURIComponent(cachedState)) {\r\n throw ClientAuthError.createStateMismatchError();\r\n }\r\n // Check for error\r\n if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {\r\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {\r\n throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror, serverResponseHash.timestamp || Constants.EMPTY_STRING, serverResponseHash.trace_id || Constants.EMPTY_STRING, serverResponseHash.correlation_id || Constants.EMPTY_STRING, serverResponseHash.claims || Constants.EMPTY_STRING);\r\n }\r\n throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\r\n }\r\n if (serverResponseHash.client_info) {\r\n buildClientInfo(serverResponseHash.client_info, cryptoObj);\r\n }\r\n };\r\n /**\r\n * Function which validates server authorization token response.\r\n * @param serverResponse\r\n */\r\n ResponseHandler.prototype.validateTokenResponse = function (serverResponse) {\r\n // Check for error\r\n if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {\r\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {\r\n throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror, serverResponse.timestamp || Constants.EMPTY_STRING, serverResponse.trace_id || Constants.EMPTY_STRING, serverResponse.correlation_id || Constants.EMPTY_STRING, serverResponse.claims || Constants.EMPTY_STRING);\r\n }\r\n var errString = serverResponse.error_codes + \" - [\" + serverResponse.timestamp + \"]: \" + serverResponse.error_description + \" - Correlation ID: \" + serverResponse.correlation_id + \" - Trace ID: \" + serverResponse.trace_id;\r\n throw new ServerError(serverResponse.error, errString, serverResponse.suberror);\r\n }\r\n };\r\n /**\r\n * Returns a constructed token response based on given string. Also manages the cache updates and cleanups.\r\n * @param serverTokenResponse\r\n * @param authority\r\n */\r\n ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var idTokenObj, authTime, requestStateObj, cacheRecord, cacheContext, key, account;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.HandleServerTokenResponse, serverTokenResponse.correlation_id);\r\n if (serverTokenResponse.id_token) {\r\n idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);\r\n // token nonce check (TODO: Add a warning if no nonce is given?)\r\n if (authCodePayload && !StringUtils.isEmpty(authCodePayload.nonce)) {\r\n if (idTokenObj.claims.nonce !== authCodePayload.nonce) {\r\n throw ClientAuthError.createNonceMismatchError();\r\n }\r\n }\r\n // token max_age check\r\n if (request.maxAge || (request.maxAge === 0)) {\r\n authTime = idTokenObj.claims.auth_time;\r\n if (!authTime) {\r\n throw ClientAuthError.createAuthTimeNotFoundError();\r\n }\r\n AuthToken.checkMaxAge(authTime, request.maxAge);\r\n }\r\n }\r\n // generate homeAccountId\r\n this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);\r\n if (!!authCodePayload && !!authCodePayload.state) {\r\n requestStateObj = ProtocolUtils.parseRequestState(this.cryptoObj, authCodePayload.state);\r\n }\r\n // Add keyId from request to serverTokenResponse if defined\r\n serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;\r\n cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload);\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, , 5, 8]);\r\n if (!(this.persistencePlugin && this.serializableCache)) return [3 /*break*/, 3];\r\n this.logger.verbose(\"Persistence enabled, calling beforeCacheAccess\");\r\n cacheContext = new TokenCacheContext(this.serializableCache, true);\r\n return [4 /*yield*/, this.persistencePlugin.beforeCacheAccess(cacheContext)];\r\n case 2:\r\n _b.sent();\r\n _b.label = 3;\r\n case 3:\r\n /*\r\n * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.\r\n * If not present, we should return null, as it's the case that another application called removeAccount in between\r\n * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal, unless explicitly flagged by\r\n * the developer, as in the case of refresh token flow used in ADAL Node to MSAL Node migration.\r\n */\r\n if (handlingRefreshTokenResponse && !forceCacheRefreshTokenResponse && cacheRecord.account) {\r\n key = cacheRecord.account.generateAccountKey();\r\n account = this.cacheStorage.getAccount(key);\r\n if (!account) {\r\n this.logger.warning(\"Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache\");\r\n return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, undefined, serverRequestId)];\r\n }\r\n }\r\n return [4 /*yield*/, this.cacheStorage.saveCacheRecord(cacheRecord)];\r\n case 4:\r\n _b.sent();\r\n return [3 /*break*/, 8];\r\n case 5:\r\n if (!(this.persistencePlugin && this.serializableCache && cacheContext)) return [3 /*break*/, 7];\r\n this.logger.verbose(\"Persistence enabled, calling afterCacheAccess\");\r\n return [4 /*yield*/, this.persistencePlugin.afterCacheAccess(cacheContext)];\r\n case 6:\r\n _b.sent();\r\n _b.label = 7;\r\n case 7: return [7 /*endfinally*/];\r\n case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse, serverRequestId)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Generates CacheRecord\r\n * @param serverTokenResponse\r\n * @param idTokenObj\r\n * @param authority\r\n */\r\n ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload) {\r\n var env = authority.getPreferredCache();\r\n if (StringUtils.isEmpty(env)) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n // IdToken: non AAD scenarios can have empty realm\r\n var cachedIdToken;\r\n var cachedAccount;\r\n if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {\r\n cachedIdToken = IdTokenEntity.createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token || Constants.EMPTY_STRING, this.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);\r\n cachedAccount = this.generateAccountEntity(serverTokenResponse, idTokenObj, authority, authCodePayload);\r\n }\r\n // AccessToken\r\n var cachedAccessToken = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {\r\n // If scopes not returned in server response, use request scopes\r\n var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(request.scopes || []);\r\n /*\r\n * Use timestamp calculated before request\r\n * Server may return timestamps as strings, parse to numbers if so.\r\n */\r\n var expiresIn = (typeof serverTokenResponse.expires_in === \"string\" ? parseInt(serverTokenResponse.expires_in, 10) : serverTokenResponse.expires_in) || 0;\r\n var extExpiresIn = (typeof serverTokenResponse.ext_expires_in === \"string\" ? parseInt(serverTokenResponse.ext_expires_in, 10) : serverTokenResponse.ext_expires_in) || 0;\r\n var refreshIn = (typeof serverTokenResponse.refresh_in === \"string\" ? parseInt(serverTokenResponse.refresh_in, 10) : serverTokenResponse.refresh_in) || undefined;\r\n var tokenExpirationSeconds = reqTimestamp + expiresIn;\r\n var extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;\r\n var refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;\r\n // non AAD scenarios can have empty realm\r\n cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token || Constants.EMPTY_STRING, this.clientId, idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id, request.claims, request.requestedClaimsHash);\r\n }\r\n // refreshToken\r\n var cachedRefreshToken = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.refresh_token)) {\r\n cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.refresh_token || Constants.EMPTY_STRING, this.clientId, serverTokenResponse.foci, userAssertionHash);\r\n }\r\n // appMetadata\r\n var cachedAppMetadata = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.foci)) {\r\n cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);\r\n }\r\n return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);\r\n };\r\n /**\r\n * Generate Account\r\n * @param serverTokenResponse\r\n * @param idToken\r\n * @param authority\r\n */\r\n ResponseHandler.prototype.generateAccountEntity = function (serverTokenResponse, idToken, authority, authCodePayload) {\r\n var authorityType = authority.authorityType;\r\n var cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : Constants.EMPTY_STRING;\r\n var msGraphhost = authCodePayload ? authCodePayload.msgraph_host : Constants.EMPTY_STRING;\r\n // ADFS does not require client_info in the response\r\n if (authorityType === AuthorityType.Adfs) {\r\n this.logger.verbose(\"Authority type is ADFS, creating ADFS account\");\r\n return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);\r\n }\r\n // This fallback applies to B2C as well as they fall under an AAD account type.\r\n if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === \"AAD\") {\r\n throw ClientAuthError.createClientInfoEmptyError();\r\n }\r\n return serverTokenResponse.client_info ?\r\n AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost) :\r\n AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);\r\n };\r\n /**\r\n * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.\r\n *\r\n * Optionally takes a state string that is set as-is in the response.\r\n *\r\n * @param cacheRecord\r\n * @param idTokenObj\r\n * @param fromTokenCache\r\n * @param stateString\r\n */\r\n ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState, serverTokenResponse, requestId) {\r\n var _a, _b, _c;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, _d, secret, keyId, uid, tid;\r\n return __generator(this, function (_e) {\r\n switch (_e.label) {\r\n case 0:\r\n accessToken = Constants.EMPTY_STRING;\r\n responseScopes = [];\r\n expiresOn = null;\r\n familyId = Constants.EMPTY_STRING;\r\n if (!cacheRecord.accessToken) return [3 /*break*/, 4];\r\n if (!(cacheRecord.accessToken.tokenType === AuthenticationScheme.POP)) return [3 /*break*/, 2];\r\n popTokenGenerator = new PopTokenGenerator(cryptoObj);\r\n _d = cacheRecord.accessToken, secret = _d.secret, keyId = _d.keyId;\r\n if (!keyId) {\r\n throw ClientAuthError.createKeyIdMissingError();\r\n }\r\n return [4 /*yield*/, popTokenGenerator.signPopToken(secret, keyId, request)];\r\n case 1:\r\n accessToken = _e.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n accessToken = cacheRecord.accessToken.secret;\r\n _e.label = 3;\r\n case 3:\r\n responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();\r\n expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);\r\n extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);\r\n _e.label = 4;\r\n case 4:\r\n if (cacheRecord.appMetadata) {\r\n familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;\r\n }\r\n uid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.oid) || (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.sub) || Constants.EMPTY_STRING;\r\n tid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.tid) || Constants.EMPTY_STRING;\r\n // for hybrid + native bridge enablement, send back the native account Id\r\n if ((serverTokenResponse === null || serverTokenResponse === void 0 ? void 0 : serverTokenResponse.spa_accountid) && !!cacheRecord.account) {\r\n cacheRecord.account.nativeAccountId = serverTokenResponse === null || serverTokenResponse === void 0 ? void 0 : serverTokenResponse.spa_accountid;\r\n }\r\n return [2 /*return*/, {\r\n authority: authority.canonicalAuthority,\r\n uniqueId: uid,\r\n tenantId: tid,\r\n scopes: responseScopes,\r\n account: cacheRecord.account ? cacheRecord.account.getAccountInfo() : null,\r\n idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,\r\n idTokenClaims: idTokenObj ? idTokenObj.claims : {},\r\n accessToken: accessToken,\r\n fromCache: fromTokenCache,\r\n expiresOn: expiresOn,\r\n correlationId: request.correlationId,\r\n requestId: requestId || Constants.EMPTY_STRING,\r\n extExpiresOn: extExpiresOn,\r\n familyId: familyId,\r\n tokenType: ((_a = cacheRecord.accessToken) === null || _a === void 0 ? void 0 : _a.tokenType) || Constants.EMPTY_STRING,\r\n state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,\r\n cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,\r\n msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,\r\n code: serverTokenResponse === null || serverTokenResponse === void 0 ? void 0 : serverTokenResponse.spa_code,\r\n fromNativeBroker: false,\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n return ResponseHandler;\r\n}());\n\nexport { ResponseHandler };\n//# sourceMappingURL=ResponseHandler.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign, __spreadArrays } from '../_virtual/_tslib.js';\nimport { BaseClient } from './BaseClient.js';\nimport { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';\nimport { Separators, AADServerParamKeys, AuthenticationScheme, GrantType, PromptValue, HeaderNames } from '../utils/Constants.js';\nimport { ResponseHandler } from '../response/ResponseHandler.js';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { UrlString } from '../url/UrlString.js';\nimport { PopTokenGenerator } from '../crypto/PopTokenGenerator.js';\nimport { TimeUtils } from '../utils/TimeUtils.js';\nimport { buildClientInfo, buildClientInfoFromHomeAccountId } from '../account/ClientInfo.js';\nimport { CcsCredentialType } from '../account/CcsCredential.js';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { RequestValidator } from '../request/RequestValidator.js';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Oauth2.0 Authorization Code client\r\n */\r\nvar AuthorizationCodeClient = /** @class */ (function (_super) {\r\n __extends(AuthorizationCodeClient, _super);\r\n function AuthorizationCodeClient(configuration, performanceClient) {\r\n var _this = _super.call(this, configuration, performanceClient) || this;\r\n // Flag to indicate if client is for hybrid spa auth code redemption\r\n _this.includeRedirectUri = true;\r\n return _this;\r\n }\r\n /**\r\n * Creates the URL of the authorization request letting the user input credentials and consent to the\r\n * application. The URL target the /authorize endpoint of the authority configured in the\r\n * application object.\r\n *\r\n * Once the user inputs their credentials and consents, the authority will send a response to the redirect URI\r\n * sent in the request and should contain an authorization code, which can then be used to acquire tokens via\r\n * acquireToken(AuthorizationCodeRequest)\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.getAuthCodeUrl = function (request) {\r\n var _a, _b;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var queryString;\r\n return __generator(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.GetAuthCodeUrl, request.correlationId);\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);\r\n return [4 /*yield*/, this.createAuthCodeUrlQueryString(request)];\r\n case 1:\r\n queryString = _c.sent();\r\n return [2 /*return*/, UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * API to acquire a token in exchange of 'authorization_code` acquired by the user in the first leg of the\r\n * authorization_code_grant\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.acquireToken = function (request, authCodePayload) {\r\n var _a, _b, _c, _d, _e, _f;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var atsMeasurement, reqTimestamp, response, requestId, httpVerAuthority, responseHandler;\r\n var _this = this;\r\n return __generator(this, function (_g) {\r\n switch (_g.label) {\r\n case 0:\r\n if (!request || !request.code) {\r\n throw ClientAuthError.createTokenRequestCannotBeMadeError();\r\n }\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthClientAcquireToken, request.correlationId);\r\n atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(\"AuthCodeClientAcquireToken\", request.correlationId);\r\n this.logger.info(\"in acquireToken call in auth-code client\");\r\n reqTimestamp = TimeUtils.nowSeconds();\r\n (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);\r\n return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];\r\n case 1:\r\n response = _g.sent();\r\n requestId = (_d = response.headers) === null || _d === void 0 ? void 0 : _d[HeaderNames.X_MS_REQUEST_ID];\r\n httpVerAuthority = (_e = response.headers) === null || _e === void 0 ? void 0 : _e[HeaderNames.X_MS_HTTP_VERSION];\r\n if (httpVerAuthority) {\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({\r\n httpVerAuthority: httpVerAuthority\r\n });\r\n }\r\n responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin, this.performanceClient);\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response.body);\r\n (_f = this.performanceClient) === null || _f === void 0 ? void 0 : _f.setPreQueueTime(PerformanceEvents.HandleServerTokenResponse, request.correlationId);\r\n return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId).then(function (result) {\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({\r\n success: true\r\n });\r\n return result;\r\n })\r\n .catch(function (error) {\r\n _this.logger.verbose(\"Error in fetching token in ACC\", request.correlationId);\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({\r\n errorCode: error.errorCode,\r\n subErrorCode: error.subError,\r\n success: false\r\n });\r\n throw error;\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Handles the hash fragment response from public client code request. Returns a code response used by\r\n * the client to exchange for a token in acquireToken.\r\n * @param hashFragment\r\n */\r\n AuthorizationCodeClient.prototype.handleFragmentResponse = function (hashFragment, cachedState) {\r\n // Handle responses.\r\n var responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);\r\n // Deserialize hash fragment response parameters.\r\n var hashUrlString = new UrlString(hashFragment);\r\n // Deserialize hash fragment response parameters.\r\n var serverParams = UrlString.getDeserializedHash(hashUrlString.getHash());\r\n // Get code response\r\n responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState, this.cryptoUtils);\r\n // throw when there is no auth code in the response\r\n if (!serverParams.code) {\r\n throw ClientAuthError.createNoAuthCodeInServerResponseError();\r\n }\r\n return __assign(__assign({}, serverParams), { \r\n // Code param is optional in ServerAuthorizationCodeResponse but required in AuthorizationCodePaylod\r\n code: serverParams.code });\r\n };\r\n /**\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Default behaviour is to redirect the user to `window.location.href`.\r\n * @param authorityUri\r\n */\r\n AuthorizationCodeClient.prototype.getLogoutUri = function (logoutRequest) {\r\n // Throw error if logoutRequest is null/undefined\r\n if (!logoutRequest) {\r\n throw ClientConfigurationError.createEmptyLogoutRequestError();\r\n }\r\n var queryString = this.createLogoutUrlQueryString(logoutRequest);\r\n // Construct logout URI\r\n return UrlString.appendQueryString(this.authority.endSessionEndpoint, queryString);\r\n };\r\n /**\r\n * Executes POST request to token endpoint\r\n * @param authority\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.executeTokenRequest = function (authority, request) {\r\n var _a, _b;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var queryParametersString, endpoint, requestBody, ccsCredential, clientInfo, headers, thumbprint;\r\n return __generator(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);\r\n queryParametersString = this.createTokenQueryParameters(request);\r\n endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);\r\n return [4 /*yield*/, this.createTokenRequestBody(request)];\r\n case 1:\r\n requestBody = _c.sent();\r\n ccsCredential = undefined;\r\n if (request.clientInfo) {\r\n try {\r\n clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);\r\n ccsCredential = {\r\n credential: \"\" + clientInfo.uid + Separators.CLIENT_INFO_SEPARATOR + clientInfo.utid,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID\r\n };\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\r\n }\r\n }\r\n headers = this.createTokenRequestHeaders(ccsCredential || request.ccsCredential);\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Generates a map for all the params to be sent to the service\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {\r\n var _a, _b;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, correlationId, ccsCred, clientInfo, clientInfo;\r\n var _c;\r\n return __generator(this, function (_d) {\r\n switch (_d.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);\r\n parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n /*\r\n * For hybrid spa flow, there will be a code but no verifier\r\n * In this scenario, don't include redirect uri as auth code will not be bound to redirect URI\r\n */\r\n if (!this.includeRedirectUri) {\r\n // Just validate\r\n RequestValidator.validateRedirectUri(request.redirectUri);\r\n }\r\n else {\r\n // Validate and include redirect uri\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n }\r\n // Add scope array, parameter builder will add default scopes and dedupe\r\n parameterBuilder.addScopes(request.scopes);\r\n // add code: user set, not validated\r\n parameterBuilder.addAuthorizationCode(request.code);\r\n // Add library metadata\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n parameterBuilder.addThrottling();\r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n // add code_verifier if passed\r\n if (request.codeVerifier) {\r\n parameterBuilder.addCodeVerifier(request.codeVerifier);\r\n }\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n if (this.config.clientCredentials.clientAssertion) {\r\n clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);\r\n parameterBuilder.addClientInfo();\r\n if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/, 2];\r\n popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);\r\n return [4 /*yield*/, popTokenGenerator.generateCnf(request)];\r\n case 1:\r\n reqCnfData = _d.sent();\r\n // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)\r\n parameterBuilder.addPopToken(reqCnfData.reqCnfString);\r\n return [3 /*break*/, 3];\r\n case 2:\r\n if (request.authenticationScheme === AuthenticationScheme.SSH) {\r\n if (request.sshJwk) {\r\n parameterBuilder.addSshJwk(request.sshJwk);\r\n }\r\n else {\r\n throw ClientConfigurationError.createMissingSshJwkError();\r\n }\r\n }\r\n _d.label = 3;\r\n case 3:\r\n correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n ccsCred = undefined;\r\n if (request.clientInfo) {\r\n try {\r\n clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);\r\n ccsCred = {\r\n credential: \"\" + clientInfo.uid + Separators.CLIENT_INFO_SEPARATOR + clientInfo.utid,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID\r\n };\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\r\n }\r\n }\r\n else {\r\n ccsCred = request.ccsCredential;\r\n }\r\n // Adds these as parameters in the request instead of headers to prevent CORS preflight request\r\n if (this.config.systemOptions.preventCorsPreflight && ccsCred) {\r\n switch (ccsCred.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n parameterBuilder.addCcsUpn(ccsCred.credential);\r\n break;\r\n }\r\n }\r\n if (request.tokenBodyParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);\r\n }\r\n // Add hybrid spa parameters if not already provided\r\n if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {\r\n parameterBuilder.addExtraQueryParameters((_c = {},\r\n _c[AADServerParamKeys.RETURN_SPA_CODE] = \"1\",\r\n _c));\r\n }\r\n return [2 /*return*/, parameterBuilder.createQueryString()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This API validates the `AuthorizationCodeUrlRequest` and creates a URL\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var parameterBuilder, requestScopes, correlationId, accountSid, accountLoginHintClaim, clientInfo, clientInfo, clientInfo, popTokenGenerator, reqCnfData;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);\r\n parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n requestScopes = __spreadArrays(request.scopes || [], request.extraScopesToConsent || []);\r\n parameterBuilder.addScopes(requestScopes);\r\n // validate the redirectUri (to be a non null value)\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n // add response_mode. If not passed in it defaults to query.\r\n parameterBuilder.addResponseMode(request.responseMode);\r\n // add response_type = code\r\n parameterBuilder.addResponseTypeCode();\r\n // add library info parameters\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n // add client_info=1\r\n parameterBuilder.addClientInfo();\r\n if (request.codeChallenge && request.codeChallengeMethod) {\r\n parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);\r\n }\r\n if (request.prompt) {\r\n parameterBuilder.addPrompt(request.prompt);\r\n }\r\n if (request.domainHint) {\r\n parameterBuilder.addDomainHint(request.domainHint);\r\n }\r\n // Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object\r\n if (request.prompt !== PromptValue.SELECT_ACCOUNT) {\r\n // AAD will throw if prompt=select_account is passed with an account hint\r\n if (request.sid && request.prompt === PromptValue.NONE) {\r\n // SessionID is only used in silent calls\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from request\");\r\n parameterBuilder.addSid(request.sid);\r\n }\r\n else if (request.account) {\r\n accountSid = this.extractAccountSid(request.account);\r\n accountLoginHintClaim = this.extractLoginHint(request.account);\r\n // If login_hint claim is present, use it over sid/username\r\n if (accountLoginHintClaim) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: login_hint claim present on account\");\r\n parameterBuilder.addLoginHint(accountLoginHintClaim);\r\n try {\r\n clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n }\r\n else if (accountSid && request.prompt === PromptValue.NONE) {\r\n /*\r\n * If account and loginHint are provided, we will check account first for sid before adding loginHint\r\n * SessionId is only used in silent calls\r\n */\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from account\");\r\n parameterBuilder.addSid(accountSid);\r\n try {\r\n clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n }\r\n else if (request.loginHint) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from request\");\r\n parameterBuilder.addLoginHint(request.loginHint);\r\n parameterBuilder.addCcsUpn(request.loginHint);\r\n }\r\n else if (request.account.username) {\r\n // Fallback to account username if provided\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from account\");\r\n parameterBuilder.addLoginHint(request.account.username);\r\n try {\r\n clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n }\r\n }\r\n else if (request.loginHint) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: No account, adding login_hint from request\");\r\n parameterBuilder.addLoginHint(request.loginHint);\r\n parameterBuilder.addCcsUpn(request.loginHint);\r\n }\r\n }\r\n else {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints\");\r\n }\r\n if (request.nonce) {\r\n parameterBuilder.addNonce(request.nonce);\r\n }\r\n if (request.state) {\r\n parameterBuilder.addState(request.state);\r\n }\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n if (request.extraQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\r\n }\r\n if (!request.nativeBroker) return [3 /*break*/, 2];\r\n // signal ests that this is a WAM call\r\n parameterBuilder.addNativeBroker();\r\n if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/, 2];\r\n popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\r\n return [4 /*yield*/, popTokenGenerator.generateCnf(request)];\r\n case 1:\r\n reqCnfData = _b.sent();\r\n parameterBuilder.addPopToken(reqCnfData.reqCnfString);\r\n _b.label = 2;\r\n case 2: return [2 /*return*/, parameterBuilder.createQueryString()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * This API validates the `EndSessionRequest` and creates a URL\r\n * @param request\r\n */\r\n AuthorizationCodeClient.prototype.createLogoutUrlQueryString = function (request) {\r\n var parameterBuilder = new RequestParameterBuilder();\r\n if (request.postLogoutRedirectUri) {\r\n parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);\r\n }\r\n if (request.correlationId) {\r\n parameterBuilder.addCorrelationId(request.correlationId);\r\n }\r\n if (request.idTokenHint) {\r\n parameterBuilder.addIdTokenHint(request.idTokenHint);\r\n }\r\n if (request.state) {\r\n parameterBuilder.addState(request.state);\r\n }\r\n if (request.logoutHint) {\r\n parameterBuilder.addLogoutHint(request.logoutHint);\r\n }\r\n if (request.extraQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\r\n }\r\n return parameterBuilder.createQueryString();\r\n };\r\n /**\r\n * Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.\r\n * @param account\r\n */\r\n AuthorizationCodeClient.prototype.extractAccountSid = function (account) {\r\n var _a;\r\n return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.sid) || null;\r\n };\r\n AuthorizationCodeClient.prototype.extractLoginHint = function (account) {\r\n var _a;\r\n return ((_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.login_hint) || null;\r\n };\r\n return AuthorizationCodeClient;\r\n}(BaseClient));\n\nexport { AuthorizationCodeClient };\n//# sourceMappingURL=AuthorizationCodeClient.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { BaseClient } from './BaseClient.js';\nimport { RequestParameterBuilder } from '../request/RequestParameterBuilder.js';\nimport { AuthenticationScheme, GrantType, HeaderNames, Errors } from '../utils/Constants.js';\nimport { ResponseHandler } from '../response/ResponseHandler.js';\nimport { PopTokenGenerator } from '../crypto/PopTokenGenerator.js';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { ServerError } from '../error/ServerError.js';\nimport { TimeUtils } from '../utils/TimeUtils.js';\nimport { UrlString } from '../url/UrlString.js';\nimport { CcsCredentialType } from '../account/CcsCredential.js';\nimport { buildClientInfoFromHomeAccountId } from '../account/ClientInfo.js';\nimport { InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage } from '../error/InteractionRequiredAuthError.js';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * OAuth2.0 refresh token client\r\n */\r\nvar RefreshTokenClient = /** @class */ (function (_super) {\r\n __extends(RefreshTokenClient, _super);\r\n function RefreshTokenClient(configuration, performanceClient) {\r\n return _super.call(this, configuration, performanceClient) || this;\r\n }\r\n RefreshTokenClient.prototype.acquireToken = function (request) {\r\n var _a, _b, _c, _d, _e, _f, _g;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var atsMeasurement, reqTimestamp, response, httpVerToken, requestId, responseHandler;\r\n var _this = this;\r\n return __generator(this, function (_h) {\r\n switch (_h.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);\r\n atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);\r\n this.logger.verbose(\"RefreshTokenClientAcquireToken called\", request.correlationId);\r\n reqTimestamp = TimeUtils.nowSeconds();\r\n (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);\r\n return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];\r\n case 1:\r\n response = _h.sent();\r\n httpVerToken = (_d = response.headers) === null || _d === void 0 ? void 0 : _d[HeaderNames.X_MS_HTTP_VERSION];\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({\r\n refreshTokenSize: ((_e = response.body.refresh_token) === null || _e === void 0 ? void 0 : _e.length) || 0,\r\n });\r\n if (httpVerToken) {\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.addStaticFields({\r\n httpVerToken: httpVerToken,\r\n });\r\n }\r\n requestId = (_f = response.headers) === null || _f === void 0 ? void 0 : _f[HeaderNames.X_MS_REQUEST_ID];\r\n responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);\r\n responseHandler.validateTokenResponse(response.body);\r\n (_g = this.performanceClient) === null || _g === void 0 ? void 0 : _g.setPreQueueTime(PerformanceEvents.HandleServerTokenResponse, request.correlationId);\r\n return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId).then(function (result) {\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({\r\n success: true\r\n });\r\n return result;\r\n })\r\n .catch(function (error) {\r\n _this.logger.verbose(\"Error in fetching refresh token\", request.correlationId);\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({\r\n errorCode: error.errorCode,\r\n subErrorCode: error.subError,\r\n success: false\r\n });\r\n throw error;\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Gets cached refresh token and attaches to request, then calls acquireToken API\r\n * @param request\r\n */\r\n RefreshTokenClient.prototype.acquireTokenByRefreshToken = function (request) {\r\n var _a, _b, _c, _d;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var isFOCI, noFamilyRTInCache, clientMismatchErrorWithFamilyRT;\r\n return __generator(this, function (_e) {\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw ClientConfigurationError.createEmptyTokenRequestError();\r\n }\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw ClientAuthError.createNoAccountInSilentRequestError();\r\n }\r\n isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment);\r\n // if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest\r\n if (isFOCI) {\r\n try {\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);\r\n return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, true)];\r\n }\r\n catch (e) {\r\n noFamilyRTInCache = e instanceof InteractionRequiredAuthError && e.errorCode === InteractionRequiredAuthErrorMessage.noTokensFoundError.code;\r\n clientMismatchErrorWithFamilyRT = e instanceof ServerError && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;\r\n // if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)\r\n if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {\r\n (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);\r\n return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];\r\n // throw in all other cases\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n }\r\n // fall back to application refresh token acquisition\r\n (_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);\r\n return [2 /*return*/, this.acquireTokenWithCachedRefreshToken(request, false)];\r\n });\r\n });\r\n };\r\n /**\r\n * makes a network call to acquire tokens by exchanging RefreshToken available in userCache; throws if refresh token is not cached\r\n * @param request\r\n */\r\n RefreshTokenClient.prototype.acquireTokenWithCachedRefreshToken = function (request, foci) {\r\n var _a, _b, _c;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var atsMeasurement, refreshToken, refreshTokenRequest;\r\n return __generator(this, function (_d) {\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);\r\n atsMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);\r\n this.logger.verbose(\"RefreshTokenClientAcquireTokenWithCachedRefreshToken called\", request.correlationId);\r\n refreshToken = this.cacheManager.getRefreshToken(request.account, foci);\r\n if (!refreshToken) {\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.discardMeasurement();\r\n throw InteractionRequiredAuthError.createNoTokensFoundError();\r\n }\r\n // attach cached RT size to the current measurement\r\n atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({\r\n success: true\r\n });\r\n refreshTokenRequest = __assign(__assign({}, request), { refreshToken: refreshToken.secret, authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER, ccsCredential: {\r\n credential: request.account.homeAccountId,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID\r\n } });\r\n (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);\r\n return [2 /*return*/, this.acquireToken(refreshTokenRequest)];\r\n });\r\n });\r\n };\r\n /**\r\n * Constructs the network message and makes a NW call to the underlying secure token service\r\n * @param request\r\n * @param authority\r\n */\r\n RefreshTokenClient.prototype.executeTokenRequest = function (request, authority) {\r\n var _a, _b, _c;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var acquireTokenMeasurement, queryParametersString, endpoint, requestBody, headers, thumbprint;\r\n return __generator(this, function (_d) {\r\n switch (_d.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);\r\n acquireTokenMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);\r\n (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);\r\n queryParametersString = this.createTokenQueryParameters(request);\r\n endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);\r\n return [4 /*yield*/, this.createTokenRequestBody(request)];\r\n case 1:\r\n requestBody = _d.sent();\r\n headers = this.createTokenRequestHeaders(request.ccsCredential);\r\n thumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n return [2 /*return*/, this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)\r\n .then(function (result) {\r\n acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({\r\n success: true\r\n });\r\n return result;\r\n })\r\n .catch(function (error) {\r\n acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({\r\n success: false\r\n });\r\n throw error;\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Helper function to create the token request body\r\n * @param request\r\n */\r\n RefreshTokenClient.prototype.createTokenRequestBody = function (request) {\r\n var _a, _b, _c;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var correlationId, acquireTokenMeasurement, parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;\r\n return __generator(this, function (_d) {\r\n switch (_d.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);\r\n correlationId = request.correlationId;\r\n acquireTokenMeasurement = (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.startMeasurement(PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);\r\n parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n parameterBuilder.addScopes(request.scopes);\r\n parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);\r\n parameterBuilder.addClientInfo();\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n parameterBuilder.addThrottling();\r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n parameterBuilder.addCorrelationId(correlationId);\r\n parameterBuilder.addRefreshToken(request.refreshToken);\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n if (this.config.clientCredentials.clientAssertion) {\r\n clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/, 2];\r\n popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);\r\n (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);\r\n return [4 /*yield*/, popTokenGenerator.generateCnf(request)];\r\n case 1:\r\n reqCnfData = _d.sent();\r\n // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)\r\n parameterBuilder.addPopToken(reqCnfData.reqCnfString);\r\n return [3 /*break*/, 3];\r\n case 2:\r\n if (request.authenticationScheme === AuthenticationScheme.SSH) {\r\n if (request.sshJwk) {\r\n parameterBuilder.addSshJwk(request.sshJwk);\r\n }\r\n else {\r\n acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({\r\n success: false\r\n });\r\n throw ClientConfigurationError.createMissingSshJwkError();\r\n }\r\n }\r\n _d.label = 3;\r\n case 3:\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n if (this.config.systemOptions.preventCorsPreflight && request.ccsCredential) {\r\n switch (request.ccsCredential.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n clientInfo = buildClientInfoFromHomeAccountId(request.ccsCredential.credential);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n parameterBuilder.addCcsUpn(request.ccsCredential.credential);\r\n break;\r\n }\r\n }\r\n acquireTokenMeasurement === null || acquireTokenMeasurement === void 0 ? void 0 : acquireTokenMeasurement.endMeasurement({\r\n success: true\r\n });\r\n return [2 /*return*/, parameterBuilder.createQueryString()];\r\n }\r\n });\r\n });\r\n };\r\n return RefreshTokenClient;\r\n}(BaseClient));\n\nexport { RefreshTokenClient };\n//# sourceMappingURL=RefreshTokenClient.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { BaseClient } from './BaseClient.js';\nimport { AuthToken } from '../account/AuthToken.js';\nimport { TimeUtils } from '../utils/TimeUtils.js';\nimport { RefreshTokenClient } from './RefreshTokenClient.js';\nimport { ClientAuthError, ClientAuthErrorMessage } from '../error/ClientAuthError.js';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { ResponseHandler } from '../response/ResponseHandler.js';\nimport { CacheOutcome } from '../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar SilentFlowClient = /** @class */ (function (_super) {\r\n __extends(SilentFlowClient, _super);\r\n function SilentFlowClient(configuration, performanceClient) {\r\n return _super.call(this, configuration, performanceClient) || this;\r\n }\r\n /**\r\n * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew\r\n * the given token and returns the renewed token\r\n * @param request\r\n */\r\n SilentFlowClient.prototype.acquireToken = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var e_1, refreshTokenClient;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 2, , 3]);\r\n return [4 /*yield*/, this.acquireCachedToken(request)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n case 2:\r\n e_1 = _a.sent();\r\n if (e_1 instanceof ClientAuthError && e_1.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {\r\n refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);\r\n return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(request)];\r\n }\r\n else {\r\n throw e_1;\r\n }\r\n case 3: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Retrieves token from cache or throws an error if it must be refreshed.\r\n * @param request\r\n */\r\n SilentFlowClient.prototype.acquireCachedToken = function (request) {\r\n var _a, _b, _c, _d;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var environment, cacheRecord;\r\n return __generator(this, function (_e) {\r\n switch (_e.label) {\r\n case 0:\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw ClientConfigurationError.createEmptyTokenRequestError();\r\n }\r\n if (request.forceRefresh) {\r\n // Must refresh due to present force_refresh flag.\r\n (_a = this.serverTelemetryManager) === null || _a === void 0 ? void 0 : _a.setCacheOutcome(CacheOutcome.FORCE_REFRESH);\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.\");\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw ClientAuthError.createNoAccountInSilentRequestError();\r\n }\r\n environment = request.authority || this.authority.getPreferredCache();\r\n cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment);\r\n if (!cacheRecord.accessToken) {\r\n // Must refresh due to non-existent access_token.\r\n (_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.\");\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n else if (TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||\r\n TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\r\n // Must refresh due to expired access_token.\r\n (_c = this.serverTelemetryManager) === null || _c === void 0 ? void 0 : _c.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within \" + this.config.systemOptions.tokenRenewalOffsetSeconds + \" seconds.\");\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n else if (cacheRecord.accessToken.refreshOn && TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {\r\n // Must refresh due to the refresh_in value.\r\n (_d = this.serverTelemetryManager) === null || _d === void 0 ? void 0 : _d.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'.\");\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n if (this.config.serverTelemetryManager) {\r\n this.config.serverTelemetryManager.incrementCacheHits();\r\n }\r\n return [4 /*yield*/, this.generateResultFromCacheRecord(cacheRecord, request)];\r\n case 1: return [2 /*return*/, _e.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Helper function to build response object from the CacheRecord\r\n * @param cacheRecord\r\n */\r\n SilentFlowClient.prototype.generateResultFromCacheRecord = function (cacheRecord, request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var idTokenObj, authTime;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (cacheRecord.idToken) {\r\n idTokenObj = new AuthToken(cacheRecord.idToken.secret, this.config.cryptoInterface);\r\n }\r\n // token max_age check\r\n if (request.maxAge || (request.maxAge === 0)) {\r\n authTime = idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.auth_time;\r\n if (!authTime) {\r\n throw ClientAuthError.createAuthTimeNotFoundError();\r\n }\r\n AuthToken.checkMaxAge(authTime, request.maxAge);\r\n }\r\n return [4 /*yield*/, ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, idTokenObj)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n return SilentFlowClient;\r\n}(BaseClient));\n\nexport { SilentFlowClient };\n//# sourceMappingURL=SilentFlowClient.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nfunction isOpenIdConfigResponse(response) {\r\n return (response.hasOwnProperty(\"authorization_endpoint\") &&\r\n response.hasOwnProperty(\"token_endpoint\") &&\r\n response.hasOwnProperty(\"issuer\") &&\r\n response.hasOwnProperty(\"jwks_uri\"));\r\n}\n\nexport { isOpenIdConfigResponse };\n//# sourceMappingURL=OpenIdConfigResponse.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar rawMetdataJSON = { \"endpointMetadata\": { \"https://login.microsoftonline.com/common/\": { \"token_endpoint\": \"https://login.microsoftonline.com/common/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.microsoftonline.com/common/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.microsoftonline.com/{tenantid}/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://graph.microsoft.com/oidc/userinfo\", \"authorization_endpoint\": \"https://login.microsoftonline.com/common/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.microsoftonline.com/common/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.microsoftonline.com/common/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.microsoftonline.com/common/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"microsoftonline.com\", \"cloud_graph_host_name\": \"graph.windows.net\", \"msgraph_host\": \"graph.microsoft.com\", \"rbac_url\": \"https://pas.windows.net\" }, \"https://login.chinacloudapi.cn/common/\": { \"token_endpoint\": \"https://login.chinacloudapi.cn/common/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.chinacloudapi.cn/common/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.partner.microsoftonline.cn/{tenantid}/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo\", \"authorization_endpoint\": \"https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.chinacloudapi.cn/common/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.chinacloudapi.cn/common/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.chinacloudapi.cn/common/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"partner.microsoftonline.cn\", \"cloud_graph_host_name\": \"graph.chinacloudapi.cn\", \"msgraph_host\": \"microsoftgraph.chinacloudapi.cn\", \"rbac_url\": \"https://pas.chinacloudapi.cn\" }, \"https://login.microsoftonline.us/common/\": { \"token_endpoint\": \"https://login.microsoftonline.us/common/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.microsoftonline.us/common/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.microsoftonline.us/{tenantid}/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://graph.microsoft.com/oidc/userinfo\", \"authorization_endpoint\": \"https://login.microsoftonline.us/common/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.microsoftonline.us/common/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.microsoftonline.us/common/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.microsoftonline.us/common/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"microsoftonline.us\", \"cloud_graph_host_name\": \"graph.windows.net\", \"msgraph_host\": \"graph.microsoft.com\", \"rbac_url\": \"https://pasff.usgovcloudapi.net\" }, \"https://login.microsoftonline.com/consumers/\": { \"token_endpoint\": \"https://login.microsoftonline.com/consumers/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.microsoftonline.com/consumers/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://graph.microsoft.com/oidc/userinfo\", \"authorization_endpoint\": \"https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.microsoftonline.com/consumers/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.microsoftonline.com/consumers/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"microsoftonline.com\", \"cloud_graph_host_name\": \"graph.windows.net\", \"msgraph_host\": \"graph.microsoft.com\", \"rbac_url\": \"https://pas.windows.net\" }, \"https://login.chinacloudapi.cn/consumers/\": { \"token_endpoint\": \"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.chinacloudapi.cn/consumers/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.partner.microsoftonline.cn/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo\", \"authorization_endpoint\": \"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.chinacloudapi.cn/consumers/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"partner.microsoftonline.cn\", \"cloud_graph_host_name\": \"graph.chinacloudapi.cn\", \"msgraph_host\": \"microsoftgraph.chinacloudapi.cn\", \"rbac_url\": \"https://pas.chinacloudapi.cn\" }, \"https://login.microsoftonline.us/consumers/\": { \"token_endpoint\": \"https://login.microsoftonline.us/consumers/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.microsoftonline.us/consumers/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.microsoftonline.us/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://graph.microsoft.com/oidc/userinfo\", \"authorization_endpoint\": \"https://login.microsoftonline.us/consumers/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.microsoftonline.us/consumers/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.microsoftonline.us/consumers/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.microsoftonline.us/consumers/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"microsoftonline.us\", \"cloud_graph_host_name\": \"graph.windows.net\", \"msgraph_host\": \"graph.microsoft.com\", \"rbac_url\": \"https://pasff.usgovcloudapi.net\" }, \"https://login.microsoftonline.com/organizations/\": { \"token_endpoint\": \"https://login.microsoftonline.com/organizations/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.microsoftonline.com/organizations/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.microsoftonline.com/{tenantid}/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://graph.microsoft.com/oidc/userinfo\", \"authorization_endpoint\": \"https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.microsoftonline.com/organizations/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.microsoftonline.com/organizations/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"microsoftonline.com\", \"cloud_graph_host_name\": \"graph.windows.net\", \"msgraph_host\": \"graph.microsoft.com\", \"rbac_url\": \"https://pas.windows.net\" }, \"https://login.chinacloudapi.cn/organizations/\": { \"token_endpoint\": \"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.chinacloudapi.cn/organizations/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.partner.microsoftonline.cn/{tenantid}/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo\", \"authorization_endpoint\": \"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.chinacloudapi.cn/organizations/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"partner.microsoftonline.cn\", \"cloud_graph_host_name\": \"graph.chinacloudapi.cn\", \"msgraph_host\": \"microsoftgraph.chinacloudapi.cn\", \"rbac_url\": \"https://pas.chinacloudapi.cn\" }, \"https://login.microsoftonline.us/organizations/\": { \"token_endpoint\": \"https://login.microsoftonline.us/organizations/oauth2/v2.0/token\", \"token_endpoint_auth_methods_supported\": [\"client_secret_post\", \"private_key_jwt\", \"client_secret_basic\"], \"jwks_uri\": \"https://login.microsoftonline.us/organizations/discovery/v2.0/keys\", \"response_modes_supported\": [\"query\", \"fragment\", \"form_post\"], \"subject_types_supported\": [\"pairwise\"], \"id_token_signing_alg_values_supported\": [\"RS256\"], \"response_types_supported\": [\"code\", \"id_token\", \"code id_token\", \"id_token token\"], \"scopes_supported\": [\"openid\", \"profile\", \"email\", \"offline_access\"], \"issuer\": \"https://login.microsoftonline.us/{tenantid}/v2.0\", \"request_uri_parameter_supported\": false, \"userinfo_endpoint\": \"https://graph.microsoft.com/oidc/userinfo\", \"authorization_endpoint\": \"https://login.microsoftonline.us/organizations/oauth2/v2.0/authorize\", \"device_authorization_endpoint\": \"https://login.microsoftonline.us/organizations/oauth2/v2.0/devicecode\", \"http_logout_supported\": true, \"frontchannel_logout_supported\": true, \"end_session_endpoint\": \"https://login.microsoftonline.us/organizations/oauth2/v2.0/logout\", \"claims_supported\": [\"sub\", \"iss\", \"cloud_instance_name\", \"cloud_instance_host_name\", \"cloud_graph_host_name\", \"msgraph_host\", \"aud\", \"exp\", \"iat\", \"auth_time\", \"acr\", \"nonce\", \"preferred_username\", \"name\", \"tid\", \"ver\", \"at_hash\", \"c_hash\", \"email\"], \"kerberos_endpoint\": \"https://login.microsoftonline.us/organizations/kerberos\", \"tenant_region_scope\": null, \"cloud_instance_name\": \"microsoftonline.us\", \"cloud_graph_host_name\": \"graph.windows.net\", \"msgraph_host\": \"graph.microsoft.com\", \"rbac_url\": \"https://pasff.usgovcloudapi.net\" } }, \"instanceDiscoveryMetadata\": { \"https://login.microsoftonline.com/common/\": { \"tenant_discovery_endpoint\": \"https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] }, \"https://login.chinacloudapi.cn/common/\": { \"tenant_discovery_endpoint\": \"https://login.chinacloudapi.cn/common/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] }, \"https://login.microsoftonline.us/common/\": { \"tenant_discovery_endpoint\": \"https://login.microsoftonline.us/common/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] }, \"https://login.microsoftonline.com/consumers/\": { \"tenant_discovery_endpoint\": \"https://login.microsoftonline.com/consumers/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] }, \"https://login.chinacloudapi.cn/consumers/\": { \"tenant_discovery_endpoint\": \"https://login.chinacloudapi.cn/consumers/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] }, \"https://login.microsoftonline.us/consumers/\": { \"tenant_discovery_endpoint\": \"https://login.microsoftonline.us/consumers/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] }, \"https://login.microsoftonline.com/organizations/\": { \"tenant_discovery_endpoint\": \"https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] }, \"https://login.chinacloudapi.cn/organizations/\": { \"tenant_discovery_endpoint\": \"https://login.chinacloudapi.cn/organizations/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] }, \"https://login.microsoftonline.us/organizations/\": { \"tenant_discovery_endpoint\": \"https://login.microsoftonline.us/organizations/v2.0/.well-known/openid-configuration\", \"api-version\": \"1.1\", \"metadata\": [{ \"preferred_network\": \"login.microsoftonline.com\", \"preferred_cache\": \"login.windows.net\", \"aliases\": [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"] }, { \"preferred_network\": \"login.partner.microsoftonline.cn\", \"preferred_cache\": \"login.partner.microsoftonline.cn\", \"aliases\": [\"login.partner.microsoftonline.cn\", \"login.chinacloudapi.cn\"] }, { \"preferred_network\": \"login.microsoftonline.de\", \"preferred_cache\": \"login.microsoftonline.de\", \"aliases\": [\"login.microsoftonline.de\"] }, { \"preferred_network\": \"login.microsoftonline.us\", \"preferred_cache\": \"login.microsoftonline.us\", \"aliases\": [\"login.microsoftonline.us\", \"login.usgovcloudapi.net\"] }, { \"preferred_network\": \"login-us.microsoftonline.com\", \"preferred_cache\": \"login-us.microsoftonline.com\", \"aliases\": [\"login-us.microsoftonline.com\"] }] } } };\r\nvar EndpointMetadata = rawMetdataJSON.endpointMetadata;\r\nvar InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;\n\nexport { EndpointMetadata, InstanceDiscoveryMetadata, rawMetdataJSON };\n//# sourceMappingURL=AuthorityMetadata.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Protocol modes supported by MSAL.\r\n */\r\nvar ProtocolMode;\r\n(function (ProtocolMode) {\r\n ProtocolMode[\"AAD\"] = \"AAD\";\r\n ProtocolMode[\"OIDC\"] = \"OIDC\";\r\n})(ProtocolMode || (ProtocolMode = {}));\n\nexport { ProtocolMode };\n//# sourceMappingURL=ProtocolMode.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { AUTHORITY_METADATA_CONSTANTS } from '../../utils/Constants.js';\nimport { TimeUtils } from '../../utils/TimeUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar AuthorityMetadataEntity = /** @class */ (function () {\r\n function AuthorityMetadataEntity() {\r\n this.expiresAt = TimeUtils.nowSeconds() + AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS;\r\n }\r\n /**\r\n * Update the entity with new aliases, preferred_cache and preferred_network values\r\n * @param metadata\r\n * @param fromNetwork\r\n */\r\n AuthorityMetadataEntity.prototype.updateCloudDiscoveryMetadata = function (metadata, fromNetwork) {\r\n this.aliases = metadata.aliases;\r\n this.preferred_cache = metadata.preferred_cache;\r\n this.preferred_network = metadata.preferred_network;\r\n this.aliasesFromNetwork = fromNetwork;\r\n };\r\n /**\r\n * Update the entity with new endpoints\r\n * @param metadata\r\n * @param fromNetwork\r\n */\r\n AuthorityMetadataEntity.prototype.updateEndpointMetadata = function (metadata, fromNetwork) {\r\n this.authorization_endpoint = metadata.authorization_endpoint;\r\n this.token_endpoint = metadata.token_endpoint;\r\n this.end_session_endpoint = metadata.end_session_endpoint;\r\n this.issuer = metadata.issuer;\r\n this.endpointsFromNetwork = fromNetwork;\r\n this.jwks_uri = metadata.jwks_uri;\r\n };\r\n /**\r\n * Save the authority that was used to create this cache entry\r\n * @param authority\r\n */\r\n AuthorityMetadataEntity.prototype.updateCanonicalAuthority = function (authority) {\r\n this.canonical_authority = authority;\r\n };\r\n /**\r\n * Reset the exiresAt value\r\n */\r\n AuthorityMetadataEntity.prototype.resetExpiresAt = function () {\r\n this.expiresAt = TimeUtils.nowSeconds() + AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS;\r\n };\r\n /**\r\n * Returns whether or not the data needs to be refreshed\r\n */\r\n AuthorityMetadataEntity.prototype.isExpired = function () {\r\n return this.expiresAt <= TimeUtils.nowSeconds();\r\n };\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n AuthorityMetadataEntity.isAuthorityMetadataEntity = function (key, entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) === 0 &&\r\n entity.hasOwnProperty(\"aliases\") &&\r\n entity.hasOwnProperty(\"preferred_cache\") &&\r\n entity.hasOwnProperty(\"preferred_network\") &&\r\n entity.hasOwnProperty(\"canonical_authority\") &&\r\n entity.hasOwnProperty(\"authorization_endpoint\") &&\r\n entity.hasOwnProperty(\"token_endpoint\") &&\r\n entity.hasOwnProperty(\"issuer\") &&\r\n entity.hasOwnProperty(\"aliasesFromNetwork\") &&\r\n entity.hasOwnProperty(\"endpointsFromNetwork\") &&\r\n entity.hasOwnProperty(\"expiresAt\") &&\r\n entity.hasOwnProperty(\"jwks_uri\"));\r\n };\r\n return AuthorityMetadataEntity;\r\n}());\n\nexport { AuthorityMetadataEntity };\n//# sourceMappingURL=AuthorityMetadataEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nfunction isCloudInstanceDiscoveryResponse(response) {\r\n return (response.hasOwnProperty(\"tenant_discovery_endpoint\") &&\r\n response.hasOwnProperty(\"metadata\"));\r\n}\n\nexport { isCloudInstanceDiscoveryResponse };\n//# sourceMappingURL=CloudInstanceDiscoveryResponse.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nfunction isCloudInstanceDiscoveryErrorResponse(response) {\r\n return (response.hasOwnProperty(\"error\") &&\r\n response.hasOwnProperty(\"error_description\"));\r\n}\n\nexport { isCloudInstanceDiscoveryErrorResponse };\n//# sourceMappingURL=CloudInstanceDiscoveryErrorResponse.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { RegionDiscoverySources, ResponseCodes, Constants } from '../utils/Constants.js';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar RegionDiscovery = /** @class */ (function () {\r\n function RegionDiscovery(networkInterface, performanceClient, correlationId) {\r\n this.networkInterface = networkInterface;\r\n this.performanceClient = performanceClient;\r\n this.correlationId = correlationId;\r\n }\r\n /**\r\n * Detect the region from the application's environment.\r\n *\r\n * @returns Promise\r\n */\r\n RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata) {\r\n var _a, _b, _c, _d;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var autodetectedRegionName, options, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;\r\n return __generator(this, function (_e) {\r\n switch (_e.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);\r\n autodetectedRegionName = environmentRegion;\r\n if (!!autodetectedRegionName) return [3 /*break*/, 8];\r\n options = RegionDiscovery.IMDS_OPTIONS;\r\n _e.label = 1;\r\n case 1:\r\n _e.trys.push([1, 6, , 7]);\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);\r\n return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION, options)];\r\n case 2:\r\n localIMDSVersionResponse = _e.sent();\r\n if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {\r\n autodetectedRegionName = localIMDSVersionResponse.body;\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;\r\n }\r\n if (!(localIMDSVersionResponse.status === ResponseCodes.httpBadRequest)) return [3 /*break*/, 5];\r\n (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);\r\n return [4 /*yield*/, this.getCurrentVersion(options)];\r\n case 3:\r\n currentIMDSVersion = _e.sent();\r\n if (!currentIMDSVersion) {\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;\r\n return [2 /*return*/, null];\r\n }\r\n (_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);\r\n return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion, options)];\r\n case 4:\r\n currentIMDSVersionResponse = _e.sent();\r\n if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {\r\n autodetectedRegionName = currentIMDSVersionResponse.body;\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;\r\n }\r\n _e.label = 5;\r\n case 5: return [3 /*break*/, 7];\r\n case 6:\r\n _e.sent();\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;\r\n return [2 /*return*/, null];\r\n case 7: return [3 /*break*/, 9];\r\n case 8:\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.ENVIRONMENT_VARIABLE;\r\n _e.label = 9;\r\n case 9:\r\n // If no region was auto detected from the environment or from the IMDS endpoint, mark the attempt as a FAILED_AUTO_DETECTION\r\n if (!autodetectedRegionName) {\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;\r\n }\r\n return [2 /*return*/, autodetectedRegionName || null];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Make the call to the IMDS endpoint\r\n *\r\n * @param imdsEndpointUrl\r\n * @returns Promise>\r\n */\r\n RegionDiscovery.prototype.getRegionFromIMDS = function (version, options) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_b) {\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);\r\n return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + \"?api-version=\" + version + \"&format=text\", options, Constants.IMDS_TIMEOUT)];\r\n });\r\n });\r\n };\r\n /**\r\n * Get the most recent version of the IMDS endpoint available\r\n *\r\n * @returns Promise\r\n */\r\n RegionDiscovery.prototype.getCurrentVersion = function (options) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var response;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + \"?format=json\", options)];\r\n case 2:\r\n response = _b.sent();\r\n // When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.\r\n if (response.status === ResponseCodes.httpBadRequest && response.body && response.body[\"newest-versions\"] && response.body[\"newest-versions\"].length > 0) {\r\n return [2 /*return*/, response.body[\"newest-versions\"][0]];\r\n }\r\n return [2 /*return*/, null];\r\n case 3:\r\n _b.sent();\r\n return [2 /*return*/, null];\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n // Options for the IMDS endpoint request\r\n RegionDiscovery.IMDS_OPTIONS = {\r\n headers: {\r\n Metadata: \"true\",\r\n },\r\n };\r\n return RegionDiscovery;\r\n}());\n\nexport { RegionDiscovery };\n//# sourceMappingURL=RegionDiscovery.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { AuthorityType } from './AuthorityType.js';\nimport { isOpenIdConfigResponse } from './OpenIdConfigResponse.js';\nimport { UrlString } from '../url/UrlString.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { Constants, AADAuthorityConstants, AuthorityMetadataSource, RegionDiscoveryOutcomes } from '../utils/Constants.js';\nimport { EndpointMetadata, InstanceDiscoveryMetadata } from './AuthorityMetadata.js';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { ProtocolMode } from './ProtocolMode.js';\nimport { AuthorityMetadataEntity } from '../cache/entities/AuthorityMetadataEntity.js';\nimport { AzureCloudInstance } from './AuthorityOptions.js';\nimport { isCloudInstanceDiscoveryResponse } from './CloudInstanceDiscoveryResponse.js';\nimport { isCloudInstanceDiscoveryErrorResponse } from './CloudInstanceDiscoveryErrorResponse.js';\nimport { RegionDiscovery } from './RegionDiscovery.js';\nimport { AuthError } from '../error/AuthError.js';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the\r\n * endpoint. It will store the pertinent config data in this object for use during token calls.\r\n */\r\nvar Authority = /** @class */ (function () {\r\n function Authority(authority, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId) {\r\n this.canonicalAuthority = authority;\r\n this._canonicalAuthority.validateAsUri();\r\n this.networkInterface = networkInterface;\r\n this.cacheManager = cacheManager;\r\n this.authorityOptions = authorityOptions;\r\n this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };\r\n this.logger = logger;\r\n this.performanceClient = performanceClient;\r\n this.correlationId = correlationId;\r\n this.regionDiscovery = new RegionDiscovery(networkInterface, this.performanceClient, this.correlationId);\r\n }\r\n /**\r\n * Get {@link AuthorityType}\r\n * @param authorityUri {@link IUri}\r\n * @private\r\n */\r\n Authority.prototype.getAuthorityType = function (authorityUri) {\r\n // CIAM auth url pattern is being standardized as: .ciamlogin.com\r\n if (authorityUri.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {\r\n return AuthorityType.Ciam;\r\n }\r\n var pathSegments = authorityUri.PathSegments;\r\n if (pathSegments.length) {\r\n switch (pathSegments[0].toLowerCase()) {\r\n case Constants.ADFS:\r\n return AuthorityType.Adfs;\r\n case Constants.DSTS:\r\n return AuthorityType.Dsts;\r\n }\r\n }\r\n return AuthorityType.Default;\r\n };\r\n Object.defineProperty(Authority.prototype, \"authorityType\", {\r\n // See above for AuthorityType\r\n get: function () {\r\n return this.getAuthorityType(this.canonicalAuthorityUrlComponents);\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"protocolMode\", {\r\n /**\r\n * ProtocolMode enum representing the way endpoints are constructed.\r\n */\r\n get: function () {\r\n return this.authorityOptions.protocolMode;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"options\", {\r\n /**\r\n * Returns authorityOptions which can be used to reinstantiate a new authority instance\r\n */\r\n get: function () {\r\n return this.authorityOptions;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"canonicalAuthority\", {\r\n /**\r\n * A URL that is the authority set by the developer\r\n */\r\n get: function () {\r\n return this._canonicalAuthority.urlString;\r\n },\r\n /**\r\n * Sets canonical authority.\r\n */\r\n set: function (url) {\r\n this._canonicalAuthority = new UrlString(url);\r\n this._canonicalAuthority.validateAsUri();\r\n this._canonicalAuthorityUrlComponents = null;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"canonicalAuthorityUrlComponents\", {\r\n /**\r\n * Get authority components.\r\n */\r\n get: function () {\r\n if (!this._canonicalAuthorityUrlComponents) {\r\n this._canonicalAuthorityUrlComponents = this._canonicalAuthority.getUrlComponents();\r\n }\r\n return this._canonicalAuthorityUrlComponents;\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"hostnameAndPort\", {\r\n /**\r\n * Get hostname and port i.e. login.microsoftonline.com\r\n */\r\n get: function () {\r\n return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase();\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"tenant\", {\r\n /**\r\n * Get tenant for authority.\r\n */\r\n get: function () {\r\n return this.canonicalAuthorityUrlComponents.PathSegments[0];\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"authorizationEndpoint\", {\r\n /**\r\n * OAuth /authorize endpoint for requests\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replacePath(this.metadata.authorization_endpoint);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"tokenEndpoint\", {\r\n /**\r\n * OAuth /token endpoint for requests\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replacePath(this.metadata.token_endpoint);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"deviceCodeEndpoint\", {\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replacePath(this.metadata.token_endpoint.replace(\"/token\", \"/devicecode\"));\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"endSessionEndpoint\", {\r\n /**\r\n * OAuth logout endpoint for requests\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n // ROPC policies may not have end_session_endpoint set\r\n if (!this.metadata.end_session_endpoint) {\r\n throw ClientAuthError.createLogoutNotSupportedError();\r\n }\r\n return this.replacePath(this.metadata.end_session_endpoint);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"selfSignedJwtAudience\", {\r\n /**\r\n * OAuth issuer for requests\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replacePath(this.metadata.issuer);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Authority.prototype, \"jwksUri\", {\r\n /**\r\n * Jwks_uri for token signing keys\r\n */\r\n get: function () {\r\n if (this.discoveryComplete()) {\r\n return this.replacePath(this.metadata.jwks_uri);\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Returns a flag indicating that tenant name can be replaced in authority {@link IUri}\r\n * @param authorityUri {@link IUri}\r\n * @private\r\n */\r\n Authority.prototype.canReplaceTenant = function (authorityUri) {\r\n return authorityUri.PathSegments.length === 1\r\n && !Authority.reservedTenantDomains.has(authorityUri.PathSegments[0])\r\n && this.getAuthorityType(authorityUri) === AuthorityType.Default\r\n && this.protocolMode === ProtocolMode.AAD;\r\n };\r\n /**\r\n * Replaces tenant in url path with current tenant. Defaults to common.\r\n * @param urlString\r\n */\r\n Authority.prototype.replaceTenant = function (urlString) {\r\n return urlString.replace(/{tenant}|{tenantid}/g, this.tenant);\r\n };\r\n /**\r\n * Replaces path such as tenant or policy with the current tenant or policy.\r\n * @param urlString\r\n */\r\n Authority.prototype.replacePath = function (urlString) {\r\n var _this = this;\r\n var endpoint = urlString;\r\n var cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);\r\n var cachedAuthorityUrlComponents = cachedAuthorityUrl.getUrlComponents();\r\n var cachedAuthorityParts = cachedAuthorityUrlComponents.PathSegments;\r\n var currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;\r\n currentAuthorityParts.forEach(function (currentPart, index) {\r\n var cachedPart = cachedAuthorityParts[index];\r\n if (index === 0 && _this.canReplaceTenant(cachedAuthorityUrlComponents)) {\r\n var tenantId = (new UrlString(_this.metadata.authorization_endpoint)).getUrlComponents().PathSegments[0];\r\n /**\r\n * Check if AAD canonical authority contains tenant domain name, for example \"testdomain.onmicrosoft.com\",\r\n * by comparing its first path segment to the corresponding authorization endpoint path segment, which is\r\n * always resolved with tenant id by OIDC.\r\n */\r\n if (cachedPart !== tenantId) {\r\n _this.logger.verbose(\"Replacing tenant domain name \" + cachedPart + \" with id \" + tenantId);\r\n cachedPart = tenantId;\r\n }\r\n }\r\n if (currentPart !== cachedPart) {\r\n endpoint = endpoint.replace(\"/\" + cachedPart + \"/\", \"/\" + currentPart + \"/\");\r\n }\r\n });\r\n return this.replaceTenant(endpoint);\r\n };\r\n Object.defineProperty(Authority.prototype, \"defaultOpenIdConfigurationEndpoint\", {\r\n /**\r\n * The default open id configuration endpoint for any canonical authority.\r\n */\r\n get: function () {\r\n if (this.authorityType === AuthorityType.Adfs ||\r\n this.authorityType === AuthorityType.Dsts ||\r\n this.protocolMode === ProtocolMode.OIDC) {\r\n return this.canonicalAuthority + \".well-known/openid-configuration\";\r\n }\r\n return this.canonicalAuthority + \"v2.0/.well-known/openid-configuration\";\r\n },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Boolean that returns whethr or not tenant discovery has been completed.\r\n */\r\n Authority.prototype.discoveryComplete = function () {\r\n return !!this.metadata;\r\n };\r\n /**\r\n * Perform endpoint discovery to discover aliases, preferred_cache, preferred_network\r\n * and the /authorize, /token and logout endpoints.\r\n */\r\n Authority.prototype.resolveEndpointsAsync = function () {\r\n var _a, _b, _c;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var metadataEntity, cloudDiscoverySource, endpointSource, cacheKey;\r\n return __generator(this, function (_d) {\r\n switch (_d.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthorityResolveEndpointsAsync, this.correlationId);\r\n metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);\r\n if (!metadataEntity) {\r\n metadataEntity = new AuthorityMetadataEntity();\r\n metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);\r\n }\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);\r\n return [4 /*yield*/, this.updateCloudDiscoveryMetadata(metadataEntity)];\r\n case 1:\r\n cloudDiscoverySource = _d.sent();\r\n this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);\r\n (_c = this.performanceClient) === null || _c === void 0 ? void 0 : _c.setPreQueueTime(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);\r\n return [4 /*yield*/, this.updateEndpointMetadata(metadataEntity)];\r\n case 2:\r\n endpointSource = _d.sent();\r\n if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE && endpointSource !== AuthorityMetadataSource.CACHE) {\r\n // Reset the expiration time unless both values came from a successful cache lookup\r\n metadataEntity.resetExpiresAt();\r\n metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);\r\n }\r\n cacheKey = this.cacheManager.generateAuthorityMetadataCacheKey(metadataEntity.preferred_cache);\r\n this.cacheManager.setAuthorityMetadata(cacheKey, metadataEntity);\r\n this.metadata = metadataEntity;\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Update AuthorityMetadataEntity with new endpoints and return where the information came from\r\n * @param metadataEntity\r\n */\r\n Authority.prototype.updateEndpointMetadata = function (metadataEntity) {\r\n var _a, _b, _c, _d, _e, _f;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var metadata, harcodedMetadata;\r\n return __generator(this, function (_g) {\r\n switch (_g.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);\r\n metadata = this.getEndpointMetadataFromConfig();\r\n if (metadata) {\r\n metadataEntity.updateEndpointMetadata(metadata, false);\r\n return [2 /*return*/, AuthorityMetadataSource.CONFIG];\r\n }\r\n if (this.isAuthoritySameType(metadataEntity) && metadataEntity.endpointsFromNetwork && !metadataEntity.isExpired()) {\r\n // No need to update\r\n return [2 /*return*/, AuthorityMetadataSource.CACHE];\r\n }\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);\r\n return [4 /*yield*/, this.getEndpointMetadataFromNetwork()];\r\n case 1:\r\n metadata = _g.sent();\r\n if (!metadata) return [3 /*break*/, 4];\r\n if (!((_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.azureRegion)) return [3 /*break*/, 3];\r\n (_d = this.performanceClient) === null || _d === void 0 ? void 0 : _d.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);\r\n return [4 /*yield*/, this.updateMetadataWithRegionalInformation(metadata)];\r\n case 2:\r\n metadata = _g.sent();\r\n _g.label = 3;\r\n case 3:\r\n metadataEntity.updateEndpointMetadata(metadata, true);\r\n return [2 /*return*/, AuthorityMetadataSource.NETWORK];\r\n case 4:\r\n harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();\r\n if (!(harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache)) return [3 /*break*/, 7];\r\n if (!((_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion)) return [3 /*break*/, 6];\r\n (_f = this.performanceClient) === null || _f === void 0 ? void 0 : _f.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);\r\n return [4 /*yield*/, this.updateMetadataWithRegionalInformation(harcodedMetadata)];\r\n case 5:\r\n harcodedMetadata = _g.sent();\r\n _g.label = 6;\r\n case 6:\r\n metadataEntity.updateEndpointMetadata(harcodedMetadata, false);\r\n return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];\r\n case 7: throw ClientAuthError.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint);\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Compares the number of url components after the domain to determine if the cached\r\n * authority metadata can be used for the requested authority. Protects against same domain different\r\n * authority such as login.microsoftonline.com/tenant and login.microsoftonline.com/tfp/tenant/policy\r\n * @param metadataEntity\r\n */\r\n Authority.prototype.isAuthoritySameType = function (metadataEntity) {\r\n var cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority);\r\n var cachedParts = cachedAuthorityUrl.getUrlComponents().PathSegments;\r\n return cachedParts.length === this.canonicalAuthorityUrlComponents.PathSegments.length;\r\n };\r\n /**\r\n * Parse authorityMetadata config option\r\n */\r\n Authority.prototype.getEndpointMetadataFromConfig = function () {\r\n if (this.authorityOptions.authorityMetadata) {\r\n try {\r\n return JSON.parse(this.authorityOptions.authorityMetadata);\r\n }\r\n catch (e) {\r\n throw ClientConfigurationError.createInvalidAuthorityMetadataError();\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Gets OAuth endpoints from the given OpenID configuration endpoint.\r\n *\r\n * @param hasHardcodedMetadata boolean\r\n */\r\n Authority.prototype.getEndpointMetadataFromNetwork = function () {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var options, response;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);\r\n options = {};\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.networkInterface.\r\n sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];\r\n case 2:\r\n response = _b.sent();\r\n return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];\r\n case 3:\r\n _b.sent();\r\n return [2 /*return*/, null];\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Get OAuth endpoints for common authorities.\r\n */\r\n Authority.prototype.getEndpointMetadataFromHardcodedValues = function () {\r\n if (this.canonicalAuthority in EndpointMetadata) {\r\n return EndpointMetadata[this.canonicalAuthority];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Update the retrieved metadata with regional information.\r\n */\r\n Authority.prototype.updateMetadataWithRegionalInformation = function (metadata) {\r\n var _a, _b, _c, _d, _e, _f, _g;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var autodetectedRegionName, azureRegion;\r\n return __generator(this, function (_h) {\r\n switch (_h.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);\r\n return [4 /*yield*/, this.regionDiscovery.detectRegion((_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.environmentRegion, this.regionDiscoveryMetadata)];\r\n case 1:\r\n autodetectedRegionName = _h.sent();\r\n azureRegion = ((_d = this.authorityOptions.azureRegionConfiguration) === null || _d === void 0 ? void 0 : _d.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG\r\n ? autodetectedRegionName\r\n : (_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion;\r\n if (((_f = this.authorityOptions.azureRegionConfiguration) === null || _f === void 0 ? void 0 : _f.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {\r\n this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?\r\n RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :\r\n RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;\r\n }\r\n else {\r\n if (autodetectedRegionName) {\r\n this.regionDiscoveryMetadata.region_outcome = (((_g = this.authorityOptions.azureRegionConfiguration) === null || _g === void 0 ? void 0 : _g.azureRegion) === autodetectedRegionName) ?\r\n RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :\r\n RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;\r\n }\r\n else {\r\n this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;\r\n }\r\n }\r\n if (azureRegion) {\r\n this.regionDiscoveryMetadata.region_used = azureRegion;\r\n return [2 /*return*/, Authority.replaceWithRegionalInformation(metadata, azureRegion)];\r\n }\r\n return [2 /*return*/, metadata];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache\r\n * and returns where the information was retrieved from\r\n * @param metadataEntity\r\n * @returns AuthorityMetadataSource\r\n */\r\n Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {\r\n var _a, _b;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var metadata, metadataEntityExpired, harcodedMetadata;\r\n return __generator(this, function (_c) {\r\n switch (_c.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);\r\n // attempt to read metadata from the config\r\n this.logger.verbose(\"Attempting to get cloud discovery metadata in the config\");\r\n this.logger.verbosePii(\"Known Authorities: \" + (this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE));\r\n this.logger.verbosePii(\"Authority Metadata: \" + (this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE));\r\n this.logger.verbosePii(\"Canonical Authority: \" + (metadataEntity.canonical_authority || Constants.NOT_APPLICABLE));\r\n metadata = this.getCloudDiscoveryMetadataFromConfig();\r\n if (metadata) {\r\n this.logger.verbose(\"Found cloud discovery metadata in the config.\");\r\n metadataEntity.updateCloudDiscoveryMetadata(metadata, false);\r\n return [2 /*return*/, AuthorityMetadataSource.CONFIG];\r\n }\r\n // If the cached metadata came from config but that config was not passed to this instance, we must go to the network\r\n this.logger.verbose(\"Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache.\");\r\n metadataEntityExpired = metadataEntity.isExpired();\r\n if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntityExpired) {\r\n this.logger.verbose(\"Found metadata in the cache.\");\r\n // No need to update\r\n return [2 /*return*/, AuthorityMetadataSource.CACHE];\r\n }\r\n else if (metadataEntityExpired) {\r\n this.logger.verbose(\"The metadata entity is expired.\");\r\n }\r\n this.logger.verbose(\"Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.\");\r\n (_b = this.performanceClient) === null || _b === void 0 ? void 0 : _b.setPreQueueTime(PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);\r\n return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];\r\n case 1:\r\n metadata = _c.sent();\r\n if (metadata) {\r\n this.logger.verbose(\"cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()\");\r\n metadataEntity.updateCloudDiscoveryMetadata(metadata, true);\r\n return [2 /*return*/, AuthorityMetadataSource.NETWORK];\r\n }\r\n this.logger.verbose(\"Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values.\");\r\n harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();\r\n if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {\r\n this.logger.verbose(\"Found cloud discovery metadata from hardcoded values.\");\r\n metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);\r\n return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];\r\n }\r\n // Metadata could not be obtained from the config, cache, network or hardcoded values\r\n this.logger.error(\"Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error.\");\r\n throw ClientConfigurationError.createUntrustedAuthorityError();\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Parse cloudDiscoveryMetadata config or check knownAuthorities\r\n */\r\n Authority.prototype.getCloudDiscoveryMetadataFromConfig = function () {\r\n // CIAM does not support cloud discovery metadata\r\n if (this.authorityType === AuthorityType.Ciam) {\r\n this.logger.verbose(\"CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host.\");\r\n return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);\r\n }\r\n // Check if network response was provided in config\r\n if (this.authorityOptions.cloudDiscoveryMetadata) {\r\n this.logger.verbose(\"The cloud discovery metadata has been provided as a network response, in the config.\");\r\n try {\r\n this.logger.verbose(\"Attempting to parse the cloud discovery metadata.\");\r\n var parsedResponse = JSON.parse(this.authorityOptions.cloudDiscoveryMetadata);\r\n var metadata = Authority.getCloudDiscoveryMetadataFromNetworkResponse(parsedResponse.metadata, this.hostnameAndPort);\r\n this.logger.verbose(\"Parsed the cloud discovery metadata.\");\r\n if (metadata) {\r\n this.logger.verbose(\"There is returnable metadata attached to the parsed cloud discovery metadata.\");\r\n return metadata;\r\n }\r\n else {\r\n this.logger.verbose(\"There is no metadata attached to the parsed cloud discovery metadata.\");\r\n }\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.\");\r\n throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();\r\n }\r\n }\r\n // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities\r\n if (this.isInKnownAuthorities()) {\r\n this.logger.verbose(\"The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.\");\r\n return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);\r\n }\r\n return null;\r\n };\r\n /**\r\n * Called to get metadata from network if CloudDiscoveryMetadata was not populated by config\r\n *\r\n * @param hasHardcodedMetadata boolean\r\n */\r\n Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var instanceDiscoveryEndpoint, options, match, response, typedResponseBody, metadata, error_1, typedError;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.addQueueMeasurement(PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);\r\n instanceDiscoveryEndpoint = \"\" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + \"oauth2/v2.0/authorize\";\r\n options = {};\r\n match = null;\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];\r\n case 2:\r\n response = _b.sent();\r\n typedResponseBody = void 0;\r\n metadata = void 0;\r\n if (isCloudInstanceDiscoveryResponse(response.body)) {\r\n typedResponseBody = response.body;\r\n metadata = typedResponseBody.metadata;\r\n this.logger.verbosePii(\"tenant_discovery_endpoint is: \" + typedResponseBody.tenant_discovery_endpoint);\r\n }\r\n else if (isCloudInstanceDiscoveryErrorResponse(response.body)) {\r\n this.logger.warning(\"A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: \" + response.status);\r\n typedResponseBody = response.body;\r\n if (typedResponseBody.error === Constants.INVALID_INSTANCE) {\r\n this.logger.error(\"The CloudInstanceDiscoveryErrorResponse error is invalid_instance.\");\r\n return [2 /*return*/, null];\r\n }\r\n this.logger.warning(\"The CloudInstanceDiscoveryErrorResponse error is \" + typedResponseBody.error);\r\n this.logger.warning(\"The CloudInstanceDiscoveryErrorResponse error description is \" + typedResponseBody.error_description);\r\n this.logger.warning(\"Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []\");\r\n metadata = [];\r\n }\r\n else {\r\n this.logger.error(\"AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse\");\r\n return [2 /*return*/, null];\r\n }\r\n this.logger.verbose(\"Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.\");\r\n match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(metadata, this.hostnameAndPort);\r\n return [3 /*break*/, 4];\r\n case 3:\r\n error_1 = _b.sent();\r\n if (error_1 instanceof AuthError) {\r\n this.logger.error(\"There was a network error while attempting to get the cloud discovery instance metadata.\\nError: \" + error_1.errorCode + \"\\nError Description: \" + error_1.errorMessage);\r\n }\r\n else {\r\n typedError = error_1;\r\n this.logger.error(\"A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\\nError: \" + typedError.name + \"\\nError Description: \" + typedError.message);\r\n }\r\n return [2 /*return*/, null];\r\n case 4:\r\n // Custom Domain scenario, host is trusted because Instance Discovery call succeeded\r\n if (!match) {\r\n this.logger.warning(\"The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request.\");\r\n this.logger.verbose(\"Creating custom Authority for custom domain scenario.\");\r\n match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);\r\n }\r\n return [2 /*return*/, match];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Get cloud discovery metadata for common authorities\r\n */\r\n Authority.prototype.getCloudDiscoveryMetadataFromHarcodedValues = function () {\r\n if (this.canonicalAuthority in InstanceDiscoveryMetadata) {\r\n return InstanceDiscoveryMetadata[this.canonicalAuthority];\r\n }\r\n return null;\r\n };\r\n /**\r\n * Helper function to determine if this host is included in the knownAuthorities config option\r\n */\r\n Authority.prototype.isInKnownAuthorities = function () {\r\n var _this = this;\r\n var matches = this.authorityOptions.knownAuthorities.filter(function (authority) {\r\n return UrlString.getDomainFromUrl(authority).toLowerCase() === _this.hostnameAndPort;\r\n });\r\n return matches.length > 0;\r\n };\r\n /**\r\n * helper function to populate the authority based on azureCloudOptions\r\n * @param authorityString\r\n * @param azureCloudOptions\r\n */\r\n Authority.generateAuthority = function (authorityString, azureCloudOptions) {\r\n var authorityAzureCloudInstance;\r\n if (azureCloudOptions && azureCloudOptions.azureCloudInstance !== AzureCloudInstance.None) {\r\n var tenant = azureCloudOptions.tenant ? azureCloudOptions.tenant : Constants.DEFAULT_COMMON_TENANT;\r\n authorityAzureCloudInstance = azureCloudOptions.azureCloudInstance + \"/\" + tenant + \"/\";\r\n }\r\n return authorityAzureCloudInstance ? authorityAzureCloudInstance : authorityString;\r\n };\r\n /**\r\n * Creates cloud discovery metadata object from a given host\r\n * @param host\r\n */\r\n Authority.createCloudDiscoveryMetadataFromHost = function (host) {\r\n return {\r\n preferred_network: host,\r\n preferred_cache: host,\r\n aliases: [host]\r\n };\r\n };\r\n /**\r\n * Searches instance discovery network response for the entry that contains the host in the aliases list\r\n * @param response\r\n * @param authority\r\n */\r\n Authority.getCloudDiscoveryMetadataFromNetworkResponse = function (response, authority) {\r\n for (var i = 0; i < response.length; i++) {\r\n var metadata = response[i];\r\n if (metadata.aliases.indexOf(authority) > -1) {\r\n return metadata;\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * helper function to generate environment from authority object\r\n */\r\n Authority.prototype.getPreferredCache = function () {\r\n if (this.discoveryComplete()) {\r\n return this.metadata.preferred_cache;\r\n }\r\n else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n };\r\n /**\r\n * Returns whether or not the provided host is an alias of this authority instance\r\n * @param host\r\n */\r\n Authority.prototype.isAlias = function (host) {\r\n return this.metadata.aliases.indexOf(host) > -1;\r\n };\r\n /**\r\n * Checks whether the provided host is that of a public cloud authority\r\n *\r\n * @param authority string\r\n * @returns bool\r\n */\r\n Authority.isPublicCloudAuthority = function (host) {\r\n return Constants.KNOWN_PUBLIC_CLOUDS.indexOf(host) >= 0;\r\n };\r\n /**\r\n * Rebuild the authority string with the region\r\n *\r\n * @param host string\r\n * @param region string\r\n */\r\n Authority.buildRegionalAuthorityString = function (host, region, queryString) {\r\n // Create and validate a Url string object with the initial authority string\r\n var authorityUrlInstance = new UrlString(host);\r\n authorityUrlInstance.validateAsUri();\r\n var authorityUrlParts = authorityUrlInstance.getUrlComponents();\r\n var hostNameAndPort = region + \".\" + authorityUrlParts.HostNameAndPort;\r\n if (this.isPublicCloudAuthority(authorityUrlParts.HostNameAndPort)) {\r\n hostNameAndPort = region + \".\" + Constants.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX;\r\n }\r\n // Include the query string portion of the url\r\n var url = UrlString.constructAuthorityUriFromObject(__assign(__assign({}, authorityUrlInstance.getUrlComponents()), { HostNameAndPort: hostNameAndPort })).urlString;\r\n // Add the query string if a query string was provided\r\n if (queryString)\r\n return url + \"?\" + queryString;\r\n return url;\r\n };\r\n /**\r\n * Replace the endpoints in the metadata object with their regional equivalents.\r\n *\r\n * @param metadata OpenIdConfigResponse\r\n * @param azureRegion string\r\n */\r\n Authority.replaceWithRegionalInformation = function (metadata, azureRegion) {\r\n metadata.authorization_endpoint = Authority.buildRegionalAuthorityString(metadata.authorization_endpoint, azureRegion);\r\n // TODO: Enquire on whether we should leave the query string or remove it before releasing the feature\r\n metadata.token_endpoint = Authority.buildRegionalAuthorityString(metadata.token_endpoint, azureRegion, Constants.REGIONAL_AUTH_NON_MSI_QUERY_STRING);\r\n if (metadata.end_session_endpoint) {\r\n metadata.end_session_endpoint = Authority.buildRegionalAuthorityString(metadata.end_session_endpoint, azureRegion);\r\n }\r\n return metadata;\r\n };\r\n /**\r\n * Transform CIAM_AUTHORIY as per the below rules:\r\n * If no path segments found and it is a CIAM authority (hostname ends with .ciamlogin.com), then transform it\r\n *\r\n * NOTE: The transformation path should go away once STS supports CIAM with the format: `tenantIdorDomain.ciamlogin.com`\r\n * `ciamlogin.com` can also change in the future and we should accommodate the same\r\n *\r\n * @param authority\r\n */\r\n Authority.transformCIAMAuthority = function (authority) {\r\n var ciamAuthority = authority.endsWith(Constants.FORWARD_SLASH) ? authority : \"\" + authority + Constants.FORWARD_SLASH;\r\n var authorityUrl = new UrlString(authority);\r\n var authorityUrlComponents = authorityUrl.getUrlComponents();\r\n // check if transformation is needed\r\n if (authorityUrlComponents.PathSegments.length === 0 && (authorityUrlComponents.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL))) {\r\n var tenantIdOrDomain = authorityUrlComponents.HostNameAndPort.split(\".\")[0];\r\n ciamAuthority = \"\" + ciamAuthority + tenantIdOrDomain + Constants.AAD_TENANT_DOMAIN_SUFFIX;\r\n }\r\n return ciamAuthority;\r\n };\r\n // Reserved tenant domain names that will not be replaced with tenant id\r\n Authority.reservedTenantDomains = (new Set([\r\n \"{tenant}\",\r\n \"{tenantid}\",\r\n AADAuthorityConstants.COMMON,\r\n AADAuthorityConstants.CONSUMERS,\r\n AADAuthorityConstants.ORGANIZATIONS\r\n ]));\r\n return Authority;\r\n}());\n\nexport { Authority };\n//# sourceMappingURL=Authority.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { Authority } from './Authority.js';\nimport { ClientConfigurationError } from '../error/ClientConfigurationError.js';\nimport { StringUtils } from '../utils/StringUtils.js';\nimport { ClientAuthError } from '../error/ClientAuthError.js';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar AuthorityFactory = /** @class */ (function () {\r\n function AuthorityFactory() {\r\n }\r\n /**\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)\r\n *\r\n * Also performs endpoint discovery.\r\n *\r\n * @param authorityUri\r\n * @param networkClient\r\n * @param protocolMode\r\n */\r\n AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var authorityUriFinal, acquireTokenAuthority, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n performanceClient === null || performanceClient === void 0 ? void 0 : performanceClient.addQueueMeasurement(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);\r\n authorityUriFinal = Authority.transformCIAMAuthority(authorityUri);\r\n acquireTokenAuthority = AuthorityFactory.createInstance(authorityUriFinal, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n performanceClient === null || performanceClient === void 0 ? void 0 : performanceClient.setPreQueueTime(PerformanceEvents.AuthorityResolveEndpointsAsync, correlationId);\r\n return [4 /*yield*/, acquireTokenAuthority.resolveEndpointsAsync()];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/, acquireTokenAuthority];\r\n case 3:\r\n e_1 = _a.sent();\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(e_1);\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)\r\n *\r\n * Does not perform endpoint discovery.\r\n *\r\n * @param authorityUrl\r\n * @param networkInterface\r\n * @param protocolMode\r\n */\r\n AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId) {\r\n // Throw error if authority url is empty\r\n if (StringUtils.isEmpty(authorityUrl)) {\r\n throw ClientConfigurationError.createUrlEmptyError();\r\n }\r\n return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId);\r\n };\r\n return AuthorityFactory;\r\n}());\n\nexport { AuthorityFactory };\n//# sourceMappingURL=AuthorityFactory.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { SERVER_TELEM_CONSTANTS } from '../../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ServerTelemetryEntity = /** @class */ (function () {\r\n function ServerTelemetryEntity() {\r\n this.failedRequests = [];\r\n this.errors = [];\r\n this.cacheHits = 0;\r\n }\r\n /**\r\n * validates if a given cache entry is \"Telemetry\", parses \r\n * @param key\r\n * @param entity\r\n */\r\n ServerTelemetryEntity.isServerTelemetryEntity = function (key, entity) {\r\n var validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;\r\n var validateEntity = true;\r\n if (entity) {\r\n validateEntity =\r\n entity.hasOwnProperty(\"failedRequests\") &&\r\n entity.hasOwnProperty(\"errors\") &&\r\n entity.hasOwnProperty(\"cacheHits\");\r\n }\r\n return validateKey && validateEntity;\r\n };\r\n return ServerTelemetryEntity;\r\n}());\n\nexport { ServerTelemetryEntity };\n//# sourceMappingURL=ServerTelemetryEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { ThrottlingConstants } from '../../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ThrottlingEntity = /** @class */ (function () {\r\n function ThrottlingEntity() {\r\n }\r\n /**\r\n * validates if a given cache entry is \"Throttling\", parses \r\n * @param key\r\n * @param entity\r\n */\r\n ThrottlingEntity.isThrottlingEntity = function (key, entity) {\r\n var validateKey = false;\r\n if (key) {\r\n validateKey = key.indexOf(ThrottlingConstants.THROTTLING_PREFIX) === 0;\r\n }\r\n var validateEntity = true;\r\n if (entity) {\r\n validateEntity = entity.hasOwnProperty(\"throttleTime\");\r\n }\r\n return validateKey && validateEntity;\r\n };\r\n return ThrottlingEntity;\r\n}());\n\nexport { ThrottlingEntity };\n//# sourceMappingURL=ThrottlingEntity.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { AuthError } from '../error/AuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar StubbedNetworkModule = {\r\n sendGetRequestAsync: function () {\r\n var notImplErr = \"Network interface - sendGetRequestAsync() has not been implemented for the Network interface.\";\r\n return Promise.reject(AuthError.createUnexpectedError(notImplErr));\r\n },\r\n sendPostRequestAsync: function () {\r\n var notImplErr = \"Network interface - sendPostRequestAsync() has not been implemented for the Network interface.\";\r\n return Promise.reject(AuthError.createUnexpectedError(notImplErr));\r\n }\r\n};\n\nexport { StubbedNetworkModule };\n//# sourceMappingURL=INetworkModule.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { AuthError } from './AuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * ClientAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar JoseHeaderErrorMessage = {\r\n missingKidError: {\r\n code: \"missing_kid_error\",\r\n 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.\"\r\n },\r\n missingAlgError: {\r\n code: \"missing_alg_error\",\r\n 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.\"\r\n },\r\n};\r\n/**\r\n * Error thrown when there is an error in the client code running on the browser.\r\n */\r\nvar JoseHeaderError = /** @class */ (function (_super) {\r\n __extends(JoseHeaderError, _super);\r\n function JoseHeaderError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n _this.name = \"JoseHeaderError\";\r\n Object.setPrototypeOf(_this, JoseHeaderError.prototype);\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when keyId isn't set on JOSE header.\r\n */\r\n JoseHeaderError.createMissingKidError = function () {\r\n return new JoseHeaderError(JoseHeaderErrorMessage.missingKidError.code, JoseHeaderErrorMessage.missingKidError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when algorithm isn't set on JOSE header.\r\n */\r\n JoseHeaderError.createMissingAlgError = function () {\r\n return new JoseHeaderError(JoseHeaderErrorMessage.missingAlgError.code, JoseHeaderErrorMessage.missingAlgError.desc);\r\n };\r\n return JoseHeaderError;\r\n}(AuthError));\n\nexport { JoseHeaderError, JoseHeaderErrorMessage };\n//# sourceMappingURL=JoseHeaderError.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { JoseHeaderError } from '../error/JoseHeaderError.js';\nimport { JsonTypes } from '../utils/Constants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar JoseHeader = /** @class */ (function () {\r\n function JoseHeader(options) {\r\n this.typ = options.typ;\r\n this.alg = options.alg;\r\n this.kid = options.kid;\r\n }\r\n /**\r\n * Builds SignedHttpRequest formatted JOSE Header from the\r\n * JOSE Header options provided or previously set on the object and returns\r\n * the stringified header object.\r\n * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.\r\n * @param shrHeaderOptions\r\n * @returns\r\n */\r\n JoseHeader.getShrHeaderString = function (shrHeaderOptions) {\r\n // KeyID is required on the SHR header\r\n if (!shrHeaderOptions.kid) {\r\n throw JoseHeaderError.createMissingKidError();\r\n }\r\n // Alg is required on the SHR header\r\n if (!shrHeaderOptions.alg) {\r\n throw JoseHeaderError.createMissingAlgError();\r\n }\r\n var shrHeader = new JoseHeader({\r\n // Access Token PoP headers must have type pop, but the type header can be overriden for special cases\r\n typ: shrHeaderOptions.typ || JsonTypes.Pop,\r\n kid: shrHeaderOptions.kid,\r\n alg: shrHeaderOptions.alg\r\n });\r\n return JSON.stringify(shrHeader);\r\n };\r\n return JoseHeader;\r\n}());\n\nexport { JoseHeader };\n//# sourceMappingURL=JoseHeader.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { SERVER_TELEM_CONSTANTS, CacheOutcome, Constants, Separators } from '../../utils/Constants.js';\nimport { ServerTelemetryEntity } from '../../cache/entities/ServerTelemetryEntity.js';\nimport { StringUtils } from '../../utils/StringUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ServerTelemetryManager = /** @class */ (function () {\r\n function ServerTelemetryManager(telemetryRequest, cacheManager) {\r\n this.cacheOutcome = CacheOutcome.NO_CACHE_HIT;\r\n this.cacheManager = cacheManager;\r\n this.apiId = telemetryRequest.apiId;\r\n this.correlationId = telemetryRequest.correlationId;\r\n this.wrapperSKU = telemetryRequest.wrapperSKU || Constants.EMPTY_STRING;\r\n this.wrapperVer = telemetryRequest.wrapperVer || Constants.EMPTY_STRING;\r\n this.telemetryCacheKey = SERVER_TELEM_CONSTANTS.CACHE_KEY + Separators.CACHE_KEY_SEPARATOR + telemetryRequest.clientId;\r\n }\r\n /**\r\n * API to add MSER Telemetry to request\r\n */\r\n ServerTelemetryManager.prototype.generateCurrentRequestHeaderValue = function () {\r\n var request = \"\" + this.apiId + SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR + this.cacheOutcome;\r\n var platformFields = [this.wrapperSKU, this.wrapperVer].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n var regionDiscoveryFields = this.getRegionDiscoveryFields();\r\n var requestWithRegionDiscoveryFields = [request, regionDiscoveryFields].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, requestWithRegionDiscoveryFields, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\r\n };\r\n /**\r\n * API to add MSER Telemetry for the last failed request\r\n */\r\n ServerTelemetryManager.prototype.generateLastRequestHeaderValue = function () {\r\n var lastRequests = this.getLastRequests();\r\n var maxErrors = ServerTelemetryManager.maxErrorsToSend(lastRequests);\r\n var failedRequests = lastRequests.failedRequests.slice(0, 2 * maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n var errors = lastRequests.errors.slice(0, maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n var errorCount = lastRequests.errors.length;\r\n // Indicate whether this header contains all data or partial data\r\n var overflow = maxErrors < errorCount ? SERVER_TELEM_CONSTANTS.OVERFLOW_TRUE : SERVER_TELEM_CONSTANTS.OVERFLOW_FALSE;\r\n var platformFields = [errorCount, overflow].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, lastRequests.cacheHits, failedRequests, errors, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\r\n };\r\n /**\r\n * API to cache token failures for MSER data capture\r\n * @param error\r\n */\r\n ServerTelemetryManager.prototype.cacheFailedRequest = function (error) {\r\n var lastRequests = this.getLastRequests();\r\n if (lastRequests.errors.length >= SERVER_TELEM_CONSTANTS.MAX_CACHED_ERRORS) {\r\n // Remove a cached error to make room, first in first out\r\n lastRequests.failedRequests.shift(); // apiId\r\n lastRequests.failedRequests.shift(); // correlationId\r\n lastRequests.errors.shift();\r\n }\r\n lastRequests.failedRequests.push(this.apiId, this.correlationId);\r\n if (!StringUtils.isEmpty(error.subError)) {\r\n lastRequests.errors.push(error.subError);\r\n }\r\n else if (!StringUtils.isEmpty(error.errorCode)) {\r\n lastRequests.errors.push(error.errorCode);\r\n }\r\n else if (!!error && error.toString()) {\r\n lastRequests.errors.push(error.toString());\r\n }\r\n else {\r\n lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);\r\n }\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\r\n return;\r\n };\r\n /**\r\n * Update server telemetry cache entry by incrementing cache hit counter\r\n */\r\n ServerTelemetryManager.prototype.incrementCacheHits = function () {\r\n var lastRequests = this.getLastRequests();\r\n lastRequests.cacheHits += 1;\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\r\n return lastRequests.cacheHits;\r\n };\r\n /**\r\n * Get the server telemetry entity from cache or initialize a new one\r\n */\r\n ServerTelemetryManager.prototype.getLastRequests = function () {\r\n var initialValue = new ServerTelemetryEntity();\r\n var lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey);\r\n return lastRequests || initialValue;\r\n };\r\n /**\r\n * Remove server telemetry cache entry\r\n */\r\n ServerTelemetryManager.prototype.clearTelemetryCache = function () {\r\n var lastRequests = this.getLastRequests();\r\n var numErrorsFlushed = ServerTelemetryManager.maxErrorsToSend(lastRequests);\r\n var errorCount = lastRequests.errors.length;\r\n if (numErrorsFlushed === errorCount) {\r\n // All errors were sent on last request, clear Telemetry cache\r\n this.cacheManager.removeItem(this.telemetryCacheKey);\r\n }\r\n else {\r\n // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed\r\n var serverTelemEntity = new ServerTelemetryEntity();\r\n serverTelemEntity.failedRequests = lastRequests.failedRequests.slice(numErrorsFlushed * 2); // failedRequests contains 2 items for each error\r\n serverTelemEntity.errors = lastRequests.errors.slice(numErrorsFlushed);\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);\r\n }\r\n };\r\n /**\r\n * Returns the maximum number of errors that can be flushed to the server in the next network request\r\n * @param serverTelemetryEntity\r\n */\r\n ServerTelemetryManager.maxErrorsToSend = function (serverTelemetryEntity) {\r\n var i;\r\n var maxErrors = 0;\r\n var dataSize = 0;\r\n var errorCount = serverTelemetryEntity.errors.length;\r\n for (i = 0; i < errorCount; i++) {\r\n // failedRequests parameter contains pairs of apiId and correlationId, multiply index by 2 to preserve pairs\r\n var apiId = serverTelemetryEntity.failedRequests[2 * i] || Constants.EMPTY_STRING;\r\n var correlationId = serverTelemetryEntity.failedRequests[2 * i + 1] || Constants.EMPTY_STRING;\r\n var errorCode = serverTelemetryEntity.errors[i] || Constants.EMPTY_STRING;\r\n // Count number of characters that would be added to header, each character is 1 byte. Add 3 at the end to account for separators\r\n dataSize += apiId.toString().length + correlationId.toString().length + errorCode.length + 3;\r\n if (dataSize < SERVER_TELEM_CONSTANTS.MAX_LAST_HEADER_BYTES) {\r\n // Adding this entry to the header would still keep header size below the limit\r\n maxErrors += 1;\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n return maxErrors;\r\n };\r\n /**\r\n * Get the region discovery fields\r\n *\r\n * @returns string\r\n */\r\n ServerTelemetryManager.prototype.getRegionDiscoveryFields = function () {\r\n var regionDiscoveryFields = [];\r\n regionDiscoveryFields.push(this.regionUsed || Constants.EMPTY_STRING);\r\n regionDiscoveryFields.push(this.regionSource || Constants.EMPTY_STRING);\r\n regionDiscoveryFields.push(this.regionOutcome || Constants.EMPTY_STRING);\r\n return regionDiscoveryFields.join(\",\");\r\n };\r\n /**\r\n * Update the region discovery metadata\r\n *\r\n * @param regionDiscoveryMetadata\r\n * @returns void\r\n */\r\n ServerTelemetryManager.prototype.updateRegionDiscoveryMetadata = function (regionDiscoveryMetadata) {\r\n this.regionUsed = regionDiscoveryMetadata.region_used;\r\n this.regionSource = regionDiscoveryMetadata.region_source;\r\n this.regionOutcome = regionDiscoveryMetadata.region_outcome;\r\n };\r\n /**\r\n * Set cache outcome\r\n */\r\n ServerTelemetryManager.prototype.setCacheOutcome = function (cacheOutcome) {\r\n this.cacheOutcome = cacheOutcome;\r\n };\r\n return ServerTelemetryManager;\r\n}());\n\nexport { ServerTelemetryManager };\n//# sourceMappingURL=ServerTelemetryManager.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __assign } from '../../_virtual/_tslib.js';\nimport { IntFields, PerformanceEventStatus } from './PerformanceEvent.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar PerformanceClient = /** @class */ (function () {\r\n /**\r\n * Creates an instance of PerformanceClient,\r\n * an abstract class containing core performance telemetry logic.\r\n *\r\n * @constructor\r\n * @param {string} clientId Client ID of the application\r\n * @param {string} authority Authority used by the application\r\n * @param {Logger} logger Logger used by the application\r\n * @param {string} libraryName Name of the library\r\n * @param {string} libraryVersion Version of the library\r\n */\r\n function PerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {\r\n this.authority = authority;\r\n this.libraryName = libraryName;\r\n this.libraryVersion = libraryVersion;\r\n this.applicationTelemetry = applicationTelemetry;\r\n this.clientId = clientId;\r\n this.logger = logger;\r\n this.callbacks = new Map();\r\n this.eventsByCorrelationId = new Map();\r\n this.queueMeasurements = new Map();\r\n this.preQueueTimeByCorrelationId = new Map();\r\n }\r\n /**\r\n * Starts and returns an platform-specific implementation of IPerformanceMeasurement.\r\n * Note: this function can be changed to abstract at the next major version bump.\r\n *\r\n * @param {string} measureName\r\n * @param {string} correlationId\r\n * @returns {IPerformanceMeasurement}\r\n */\r\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n PerformanceClient.prototype.startPerformanceMeasurement = function (measureName, correlationId) {\r\n return {};\r\n };\r\n /**\r\n * Starts and returns an platform-specific implementation of IPerformanceMeasurement.\r\n * Note: this incorrectly-named function will be removed at the next major version bump.\r\n *\r\n * @param {string} measureName\r\n * @param {string} correlationId\r\n * @returns {IPerformanceMeasurement}\r\n */\r\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n PerformanceClient.prototype.startPerformanceMeasuremeant = function (measureName, correlationId) {\r\n return {};\r\n };\r\n /**\r\n * Get integral fields.\r\n * Override to change the set.\r\n */\r\n PerformanceClient.prototype.getIntFields = function () {\r\n return IntFields;\r\n };\r\n /**\r\n * Gets map of pre-queue times by correlation Id\r\n *\r\n * @param {PerformanceEvents} eventName\r\n * @param {string} correlationId\r\n * @returns {number}\r\n */\r\n PerformanceClient.prototype.getPreQueueTime = function (eventName, correlationId) {\r\n var preQueueEvent = this.preQueueTimeByCorrelationId.get(correlationId);\r\n if (!preQueueEvent) {\r\n this.logger.trace(\"PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: \" + correlationId + \", unable to add queue measurement\");\r\n return;\r\n }\r\n else if (preQueueEvent.name !== eventName) {\r\n this.logger.trace(\"PerformanceClient.getPreQueueTime: no pre-queue time found for \" + eventName + \", unable to add queue measurement\");\r\n return;\r\n }\r\n return preQueueEvent.time;\r\n };\r\n /**\r\n * Calculates the difference between current time and time when function was queued.\r\n * Note: It is possible to have 0 as the queue time if the current time and the queued time was the same.\r\n *\r\n * @param {number} preQueueTime\r\n * @param {number} currentTime\r\n * @returns {number}\r\n */\r\n PerformanceClient.prototype.calculateQueuedTime = function (preQueueTime, currentTime) {\r\n if (preQueueTime < 1) {\r\n this.logger.trace(\"PerformanceClient: preQueueTime should be a positive integer and not \" + preQueueTime);\r\n return 0;\r\n }\r\n if (currentTime < 1) {\r\n this.logger.trace(\"PerformanceClient: currentTime should be a positive integer and not \" + currentTime);\r\n return 0;\r\n }\r\n if (currentTime < preQueueTime) {\r\n this.logger.trace(\"PerformanceClient: currentTime is less than preQueueTime, check how time is being retrieved\");\r\n return 0;\r\n }\r\n return currentTime - preQueueTime;\r\n };\r\n /**\r\n * Adds queue measurement time to QueueMeasurements array for given correlation ID.\r\n *\r\n * @param {PerformanceEvents} eventName\r\n * @param {?string} correlationId\r\n * @param {?number} queueTime\r\n * @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements\r\n * @returns\r\n */\r\n PerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime, manuallyCompleted) {\r\n if (!correlationId) {\r\n this.logger.trace(\"PerformanceClient.addQueueMeasurement: correlationId not provided for \" + eventName + \", cannot add queue measurement\");\r\n return;\r\n }\r\n if (queueTime === 0) {\r\n // Possible for there to be no queue time after calculation\r\n this.logger.trace(\"PerformanceClient.addQueueMeasurement: queue time provided for \" + eventName + \" is \" + queueTime);\r\n }\r\n else if (!queueTime) {\r\n this.logger.trace(\"PerformanceClient.addQueueMeasurement: no queue time provided for \" + eventName);\r\n return;\r\n }\r\n var queueMeasurement = { eventName: eventName, queueTime: queueTime, manuallyCompleted: manuallyCompleted };\r\n // Adds to existing correlation Id if present in queueMeasurements\r\n var existingMeasurements = this.queueMeasurements.get(correlationId);\r\n if (existingMeasurements) {\r\n existingMeasurements.push(queueMeasurement);\r\n this.queueMeasurements.set(correlationId, existingMeasurements);\r\n }\r\n else {\r\n // Sets new correlation Id if not present in queueMeasurements\r\n this.logger.trace(\"PerformanceClient.addQueueMeasurement: adding correlationId \" + correlationId + \" to queue measurements\");\r\n var measurementArray = [queueMeasurement];\r\n this.queueMeasurements.set(correlationId, measurementArray);\r\n }\r\n // Delete processed pre-queue event.\r\n this.preQueueTimeByCorrelationId.delete(correlationId);\r\n };\r\n /**\r\n * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.\r\n *\r\n * @param {PerformanceEvents} measureName\r\n * @param {?string} [correlationId]\r\n * @returns {InProgressPerformanceEvent}\r\n */\r\n PerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {\r\n var _this = this;\r\n var _a, _b;\r\n // Generate a placeholder correlation if the request does not provide one\r\n var eventCorrelationId = correlationId || this.generateId();\r\n if (!correlationId) {\r\n this.logger.info(\"PerformanceClient: No correlation id provided for \" + measureName + \", generating\", eventCorrelationId);\r\n }\r\n // Duplicate code to address spelling error will be removed at the next major version bump.\r\n this.logger.trace(\"PerformanceClient: Performance measurement started for \" + measureName, eventCorrelationId);\r\n var performanceMeasurement = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);\r\n performanceMeasurement.startMeasurement();\r\n var inProgressEvent = {\r\n eventId: this.generateId(),\r\n status: PerformanceEventStatus.InProgress,\r\n authority: this.authority,\r\n libraryName: this.libraryName,\r\n libraryVersion: this.libraryVersion,\r\n clientId: this.clientId,\r\n name: measureName,\r\n startTimeMs: Date.now(),\r\n correlationId: eventCorrelationId,\r\n appName: (_a = this.applicationTelemetry) === null || _a === void 0 ? void 0 : _a.appName,\r\n appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,\r\n };\r\n // Store in progress events so they can be discarded if not ended properly\r\n this.cacheEventByCorrelationId(inProgressEvent);\r\n // Return the event and functions the caller can use to properly end/flush the measurement\r\n return {\r\n endMeasurement: function (event) {\r\n return _this.endMeasurement(__assign(__assign({}, inProgressEvent), event), performanceMeasurement);\r\n },\r\n discardMeasurement: function () {\r\n return _this.discardMeasurements(inProgressEvent.correlationId);\r\n },\r\n addStaticFields: function (fields) {\r\n return _this.addStaticFields(fields, inProgressEvent.correlationId);\r\n },\r\n increment: function (counters) {\r\n return _this.increment(counters, inProgressEvent.correlationId);\r\n },\r\n measurement: performanceMeasurement,\r\n event: inProgressEvent\r\n };\r\n };\r\n /**\r\n * Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,\r\n * as consumers should instead use the function returned by startMeasurement.\r\n * Adds a new field named as \"[event name]DurationMs\" for sub-measurements, completes and emits an event\r\n * otherwise.\r\n *\r\n * @param {PerformanceEvent} event\r\n * @param {IPerformanceMeasurement} measurement\r\n * @returns {(PerformanceEvent | null)}\r\n */\r\n PerformanceClient.prototype.endMeasurement = function (event, measurement) {\r\n var _this = this;\r\n var _a, _b;\r\n var rootEvent = this.eventsByCorrelationId.get(event.correlationId);\r\n if (!rootEvent) {\r\n this.logger.trace(\"PerformanceClient: Measurement not found for \" + event.eventId, event.correlationId);\r\n return null;\r\n }\r\n var isRoot = event.eventId === rootEvent.eventId;\r\n var queueInfo = {\r\n totalQueueTime: 0,\r\n totalQueueCount: 0,\r\n manuallyCompletedCount: 0\r\n };\r\n if (isRoot) {\r\n queueInfo = this.getQueueInfo(event.correlationId);\r\n this.discardCache(rootEvent.correlationId);\r\n }\r\n else {\r\n (_a = rootEvent.incompleteSubMeasurements) === null || _a === void 0 ? void 0 : _a.delete(event.eventId);\r\n }\r\n measurement === null || measurement === void 0 ? void 0 : measurement.endMeasurement();\r\n var durationMs = measurement === null || measurement === void 0 ? void 0 : measurement.flushMeasurement();\r\n // null indicates no measurement was taken (e.g. needed performance APIs not present)\r\n if (!durationMs) {\r\n this.logger.trace(\"PerformanceClient: Performance measurement not taken\", rootEvent.correlationId);\r\n return null;\r\n }\r\n this.logger.trace(\"PerformanceClient: Performance measurement ended for \" + event.name + \": \" + durationMs + \" ms\", event.correlationId);\r\n // Add sub-measurement attribute to root event.\r\n if (!isRoot) {\r\n rootEvent[event.name + \"DurationMs\"] = Math.floor(durationMs);\r\n return __assign({}, rootEvent);\r\n }\r\n var finalEvent = __assign(__assign({}, rootEvent), event);\r\n var incompleteSubsCount = 0;\r\n // Incomplete sub-measurements are discarded. They are likely an instrumentation bug that should be fixed.\r\n (_b = finalEvent.incompleteSubMeasurements) === null || _b === void 0 ? void 0 : _b.forEach(function (subMeasurement) {\r\n _this.logger.trace(\"PerformanceClient: Incomplete submeasurement \" + subMeasurement.name + \" found for \" + event.name, finalEvent.correlationId);\r\n incompleteSubsCount++;\r\n });\r\n finalEvent.incompleteSubMeasurements = undefined;\r\n finalEvent = __assign(__assign({}, finalEvent), { durationMs: Math.round(durationMs), queuedTimeMs: queueInfo.totalQueueTime, queuedCount: queueInfo.totalQueueCount, queuedManuallyCompletedCount: queueInfo.manuallyCompletedCount, status: PerformanceEventStatus.Completed, incompleteSubsCount: incompleteSubsCount });\r\n this.truncateIntegralFields(finalEvent, this.getIntFields());\r\n this.emitEvents([finalEvent], event.correlationId);\r\n return finalEvent;\r\n };\r\n /**\r\n * Saves extra information to be emitted when the measurements are flushed\r\n * @param fields\r\n * @param correlationId\r\n */\r\n PerformanceClient.prototype.addStaticFields = function (fields, correlationId) {\r\n this.logger.trace(\"PerformanceClient: Updating static fields\");\r\n var event = this.eventsByCorrelationId.get(correlationId);\r\n if (event) {\r\n this.eventsByCorrelationId.set(correlationId, __assign(__assign({}, event), fields));\r\n }\r\n else {\r\n this.logger.trace(\"PerformanceClient: Event not found for\", correlationId);\r\n }\r\n };\r\n /**\r\n * Increment counters to be emitted when the measurements are flushed\r\n * @param counters {Counters}\r\n * @param correlationId {string} correlation identifier\r\n */\r\n PerformanceClient.prototype.increment = function (counters, correlationId) {\r\n this.logger.trace(\"PerformanceClient: Updating counters\");\r\n var event = this.eventsByCorrelationId.get(correlationId);\r\n if (event) {\r\n for (var counter in counters) {\r\n if (!event.hasOwnProperty(counter)) {\r\n event[counter] = 0;\r\n }\r\n event[counter] += counters[counter];\r\n }\r\n }\r\n else {\r\n this.logger.trace(\"PerformanceClient: Event not found for\", correlationId);\r\n }\r\n };\r\n /**\r\n * Upserts event into event cache.\r\n * First key is the correlation id, second key is the event id.\r\n * Allows for events to be grouped by correlation id,\r\n * and to easily allow for properties on them to be updated.\r\n *\r\n * @private\r\n * @param {PerformanceEvent} event\r\n */\r\n PerformanceClient.prototype.cacheEventByCorrelationId = function (event) {\r\n var rootEvent = this.eventsByCorrelationId.get(event.correlationId);\r\n if (rootEvent) {\r\n this.logger.trace(\"PerformanceClient: Performance measurement for \" + event.name + \" added/updated\", event.correlationId);\r\n rootEvent.incompleteSubMeasurements = rootEvent.incompleteSubMeasurements || new Map();\r\n rootEvent.incompleteSubMeasurements.set(event.eventId, { name: event.name, startTimeMs: event.startTimeMs });\r\n }\r\n else {\r\n this.logger.trace(\"PerformanceClient: Performance measurement for \" + event.name + \" started\", event.correlationId);\r\n this.eventsByCorrelationId.set(event.correlationId, __assign({}, event));\r\n }\r\n };\r\n PerformanceClient.prototype.getQueueInfo = function (correlationId) {\r\n var queueMeasurementForCorrelationId = this.queueMeasurements.get(correlationId);\r\n if (!queueMeasurementForCorrelationId) {\r\n this.logger.trace(\"PerformanceClient: no queue measurements found for for correlationId: \" + correlationId);\r\n }\r\n var totalQueueTime = 0;\r\n var totalQueueCount = 0;\r\n var manuallyCompletedCount = 0;\r\n queueMeasurementForCorrelationId === null || queueMeasurementForCorrelationId === void 0 ? void 0 : queueMeasurementForCorrelationId.forEach(function (measurement) {\r\n totalQueueTime += measurement.queueTime;\r\n totalQueueCount++;\r\n manuallyCompletedCount += measurement.manuallyCompleted ? 1 : 0;\r\n });\r\n return {\r\n totalQueueTime: totalQueueTime,\r\n totalQueueCount: totalQueueCount,\r\n manuallyCompletedCount: manuallyCompletedCount\r\n };\r\n };\r\n /**\r\n * Removes measurements for a given correlation id.\r\n *\r\n * @param {string} correlationId\r\n */\r\n PerformanceClient.prototype.discardMeasurements = function (correlationId) {\r\n this.logger.trace(\"PerformanceClient: Performance measurements discarded\", correlationId);\r\n this.eventsByCorrelationId.delete(correlationId);\r\n };\r\n /**\r\n * Removes cache for a given correlation id.\r\n *\r\n * @param {string} correlationId correlation identifier\r\n */\r\n PerformanceClient.prototype.discardCache = function (correlationId) {\r\n this.discardMeasurements(correlationId);\r\n this.logger.trace(\"PerformanceClient: QueueMeasurements discarded\", correlationId);\r\n this.queueMeasurements.delete(correlationId);\r\n this.logger.trace(\"PerformanceClient: Pre-queue times discarded\", correlationId);\r\n this.preQueueTimeByCorrelationId.delete(correlationId);\r\n };\r\n /**\r\n * Registers a callback function to receive performance events.\r\n *\r\n * @param {PerformanceCallbackFunction} callback\r\n * @returns {string}\r\n */\r\n PerformanceClient.prototype.addPerformanceCallback = function (callback) {\r\n var callbackId = this.generateId();\r\n this.callbacks.set(callbackId, callback);\r\n this.logger.verbose(\"PerformanceClient: Performance callback registered with id: \" + callbackId);\r\n return callbackId;\r\n };\r\n /**\r\n * Removes a callback registered with addPerformanceCallback.\r\n *\r\n * @param {string} callbackId\r\n * @returns {boolean}\r\n */\r\n PerformanceClient.prototype.removePerformanceCallback = function (callbackId) {\r\n var result = this.callbacks.delete(callbackId);\r\n if (result) {\r\n this.logger.verbose(\"PerformanceClient: Performance callback \" + callbackId + \" removed.\");\r\n }\r\n else {\r\n this.logger.verbose(\"PerformanceClient: Performance callback \" + callbackId + \" not removed.\");\r\n }\r\n return result;\r\n };\r\n /**\r\n * Emits events to all registered callbacks.\r\n *\r\n * @param {PerformanceEvent[]} events\r\n * @param {?string} [correlationId]\r\n */\r\n PerformanceClient.prototype.emitEvents = function (events, correlationId) {\r\n var _this = this;\r\n this.logger.verbose(\"PerformanceClient: Emitting performance events\", correlationId);\r\n this.callbacks.forEach(function (callback, callbackId) {\r\n _this.logger.trace(\"PerformanceClient: Emitting event to callback \" + callbackId, correlationId);\r\n callback.apply(null, [events]);\r\n });\r\n };\r\n /**\r\n * Enforce truncation of integral fields in performance event.\r\n * @param {PerformanceEvent} event performance event to update.\r\n * @param {Set} intFields integral fields.\r\n */\r\n PerformanceClient.prototype.truncateIntegralFields = function (event, intFields) {\r\n intFields.forEach(function (key) {\r\n if (key in event && typeof event[key] === \"number\") {\r\n event[key] = Math.floor(event[key]);\r\n }\r\n });\r\n };\r\n return PerformanceClient;\r\n}());\n\nexport { PerformanceClient };\n//# sourceMappingURL=PerformanceClient.js.map\n","/*! @azure/msal-common v13.1.0 2023-06-07 */\n'use strict';\nimport { __extends } from '../../_virtual/_tslib.js';\nimport { PerformanceClient } from './PerformanceClient.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar StubPerformanceMeasurement = /** @class */ (function () {\r\n function StubPerformanceMeasurement() {\r\n }\r\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\r\n StubPerformanceMeasurement.prototype.startMeasurement = function () { };\r\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\r\n StubPerformanceMeasurement.prototype.endMeasurement = function () { };\r\n StubPerformanceMeasurement.prototype.flushMeasurement = function () {\r\n return null;\r\n };\r\n return StubPerformanceMeasurement;\r\n}());\r\nvar StubPerformanceClient = /** @class */ (function (_super) {\r\n __extends(StubPerformanceClient, _super);\r\n function StubPerformanceClient() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n StubPerformanceClient.prototype.generateId = function () {\r\n return \"callback-id\";\r\n };\r\n StubPerformanceClient.prototype.startPerformanceMeasuremeant = function () {\r\n return new StubPerformanceMeasurement();\r\n };\r\n StubPerformanceClient.prototype.startPerformanceMeasurement = function () {\r\n return new StubPerformanceMeasurement();\r\n };\r\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n StubPerformanceClient.prototype.calculateQueuedTime = function (preQueueTime, currentTime) {\r\n return 0;\r\n };\r\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n StubPerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime) {\r\n return;\r\n };\r\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n StubPerformanceClient.prototype.setPreQueueTime = function (eventName, correlationId) {\r\n return;\r\n };\r\n return StubPerformanceClient;\r\n}(PerformanceClient));\n\nexport { StubPerformanceClient, StubPerformanceMeasurement };\n//# sourceMappingURL=StubPerformanceClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { StringUtils, AuthError } from '@azure/msal-common';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * BrowserAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar BrowserAuthErrorMessage = {\r\n pkceNotGenerated: {\r\n code: \"pkce_not_created\",\r\n desc: \"The PKCE code challenge and verifier could not be generated.\"\r\n },\r\n cryptoDoesNotExist: {\r\n code: \"crypto_nonexistent\",\r\n desc: \"The crypto object or function is not available.\"\r\n },\r\n httpMethodNotImplementedError: {\r\n code: \"http_method_not_implemented\",\r\n desc: \"The HTTP method given has not been implemented in this library.\"\r\n },\r\n emptyNavigateUriError: {\r\n code: \"empty_navigate_uri\",\r\n desc: \"Navigation URI is empty. Please check stack trace for more info.\"\r\n },\r\n hashEmptyError: {\r\n code: \"hash_empty_error\",\r\n 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.\"\r\n },\r\n hashDoesNotContainStateError: {\r\n code: \"no_state_in_hash\",\r\n desc: \"Hash does not contain state. Please verify that the request originated from msal.\"\r\n },\r\n hashDoesNotContainKnownPropertiesError: {\r\n code: \"hash_does_not_contain_known_properties\",\r\n 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.\"\r\n },\r\n unableToParseStateError: {\r\n code: \"unable_to_parse_state\",\r\n desc: \"Unable to parse state. Please verify that the request originated from msal.\"\r\n },\r\n stateInteractionTypeMismatchError: {\r\n code: \"state_interaction_type_mismatch\",\r\n desc: \"Hash contains state but the interaction type does not match the caller.\"\r\n },\r\n interactionInProgress: {\r\n code: \"interaction_in_progress\",\r\n 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.\"\r\n },\r\n popupWindowError: {\r\n code: \"popup_window_error\",\r\n desc: \"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.\"\r\n },\r\n emptyWindowError: {\r\n code: \"empty_window_error\",\r\n desc: \"window.open returned null or undefined window object.\"\r\n },\r\n userCancelledError: {\r\n code: \"user_cancelled\",\r\n desc: \"User cancelled the flow.\"\r\n },\r\n monitorPopupTimeoutError: {\r\n code: \"monitor_window_timeout\",\r\n desc: \"Token acquisition in popup failed due to timeout. For more visit: aka.ms/msaljs/browser-errors.\"\r\n },\r\n monitorIframeTimeoutError: {\r\n code: \"monitor_window_timeout\",\r\n desc: \"Token acquisition in iframe failed due to timeout. For more visit: aka.ms/msaljs/browser-errors.\"\r\n },\r\n redirectInIframeError: {\r\n code: \"redirect_in_iframe\",\r\n 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.\"\r\n },\r\n blockTokenRequestsInHiddenIframeError: {\r\n code: \"block_iframe_reload\",\r\n desc: \"Request was blocked inside an iframe because MSAL detected an authentication response. For more visit: aka.ms/msaljs/browser-errors\"\r\n },\r\n blockAcquireTokenInPopupsError: {\r\n code: \"block_nested_popups\",\r\n desc: \"Request was blocked inside a popup because MSAL detected it was running in a popup.\"\r\n },\r\n iframeClosedPrematurelyError: {\r\n code: \"iframe_closed_prematurely\",\r\n desc: \"The iframe being monitored was closed prematurely.\"\r\n },\r\n silentLogoutUnsupportedError: {\r\n code: \"silent_logout_unsupported\",\r\n desc: \"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.\"\r\n },\r\n noAccountError: {\r\n code: \"no_account_error\",\r\n desc: \"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.\"\r\n },\r\n silentPromptValueError: {\r\n code: \"silent_prompt_value_error\",\r\n desc: \"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.\"\r\n },\r\n noTokenRequestCacheError: {\r\n code: \"no_token_request_cache_error\",\r\n desc: \"No token request found in cache.\"\r\n },\r\n unableToParseTokenRequestCacheError: {\r\n code: \"unable_to_parse_token_request_cache_error\",\r\n desc: \"The cached token request could not be parsed.\"\r\n },\r\n noCachedAuthorityError: {\r\n code: \"no_cached_authority_error\",\r\n desc: \"No cached authority found.\"\r\n },\r\n authRequestNotSet: {\r\n code: \"auth_request_not_set_error\",\r\n desc: \"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler\"\r\n },\r\n invalidCacheType: {\r\n code: \"invalid_cache_type\",\r\n desc: \"Invalid cache type\"\r\n },\r\n notInBrowserEnvironment: {\r\n code: \"non_browser_environment\",\r\n desc: \"Login and token requests are not supported in non-browser environments.\"\r\n },\r\n databaseNotOpen: {\r\n code: \"database_not_open\",\r\n desc: \"Database is not open!\"\r\n },\r\n noNetworkConnectivity: {\r\n code: \"no_network_connectivity\",\r\n desc: \"No network connectivity. Check your internet connection.\"\r\n },\r\n postRequestFailed: {\r\n code: \"post_request_failed\",\r\n 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'\"\r\n },\r\n getRequestFailed: {\r\n code: \"get_request_failed\",\r\n desc: \"Network request failed. Please check the network trace to determine root cause.\"\r\n },\r\n failedToParseNetworkResponse: {\r\n code: \"failed_to_parse_response\",\r\n desc: \"Failed to parse network response. Check network trace.\"\r\n },\r\n unableToLoadTokenError: {\r\n code: \"unable_to_load_token\",\r\n desc: \"Error loading token to cache.\"\r\n },\r\n signingKeyNotFoundInStorage: {\r\n code: \"crypto_key_not_found\",\r\n desc: \"Cryptographic Key or Keypair not found in browser storage.\"\r\n },\r\n authCodeRequired: {\r\n code: \"auth_code_required\",\r\n desc: \"An authorization code must be provided (as the `code` property on the request) to this flow.\"\r\n },\r\n authCodeOrNativeAccountRequired: {\r\n code: \"auth_code_or_nativeAccountId_required\",\r\n desc: \"An authorization code or nativeAccountId must be provided to this flow.\"\r\n },\r\n spaCodeAndNativeAccountPresent: {\r\n code: \"spa_code_and_nativeAccountId_present\",\r\n desc: \"Request cannot contain both spa code and native account id.\"\r\n },\r\n databaseUnavailable: {\r\n code: \"database_unavailable\",\r\n 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.\"\r\n },\r\n unableToAcquireTokenFromNativePlatform: {\r\n code: \"unable_to_acquire_token_from_native_platform\",\r\n desc: \"Unable to acquire token from native platform. For a list of possible reasons visit aka.ms/msaljs/browser-errors.\"\r\n },\r\n nativeHandshakeTimeout: {\r\n code: \"native_handshake_timeout\",\r\n desc: \"Timed out while attempting to establish connection to browser extension\"\r\n },\r\n nativeExtensionNotInstalled: {\r\n code: \"native_extension_not_installed\",\r\n desc: \"Native extension is not installed. If you think this is a mistake call the initialize function.\"\r\n },\r\n nativeConnectionNotEstablished: {\r\n code: \"native_connection_not_established\",\r\n 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.\"\r\n },\r\n nativeBrokerCalledBeforeInitialize: {\r\n code: \"native_broker_called_before_initialize\",\r\n 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.\"\r\n },\r\n nativePromptNotSupported: {\r\n code: \"native_prompt_not_supported\",\r\n desc: \"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.\"\r\n }\r\n};\r\n/**\r\n * Browser library error class thrown by the MSAL.js library for SPAs\r\n */\r\nvar BrowserAuthError = /** @class */ (function (_super) {\r\n __extends(BrowserAuthError, _super);\r\n function BrowserAuthError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n Object.setPrototypeOf(_this, BrowserAuthError.prototype);\r\n _this.name = \"BrowserAuthError\";\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when PKCE is not implemented.\r\n * @param errDetail\r\n */\r\n BrowserAuthError.createPkceNotGeneratedError = function (errDetail) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.pkceNotGenerated.code, BrowserAuthErrorMessage.pkceNotGenerated.desc + \" Detail:\" + errDetail);\r\n };\r\n /**\r\n * Creates an error thrown when the crypto object is unavailable.\r\n * @param errDetail\r\n */\r\n BrowserAuthError.createCryptoNotAvailableError = function (errDetail) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.cryptoDoesNotExist.code, BrowserAuthErrorMessage.cryptoDoesNotExist.desc + \" Detail:\" + errDetail);\r\n };\r\n /**\r\n * Creates an error thrown when an HTTP method hasn't been implemented by the browser class.\r\n * @param method\r\n */\r\n BrowserAuthError.createHttpMethodNotImplementedError = function (method) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.httpMethodNotImplementedError.code, BrowserAuthErrorMessage.httpMethodNotImplementedError.desc + \" Given Method: \" + method);\r\n };\r\n /**\r\n * Creates an error thrown when the navigation URI is empty.\r\n */\r\n BrowserAuthError.createEmptyNavigationUriError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.emptyNavigateUriError.code, BrowserAuthErrorMessage.emptyNavigateUriError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the hash string value is unexpectedly empty.\r\n * @param hashValue\r\n */\r\n BrowserAuthError.createEmptyHashError = function (hashValue) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.hashEmptyError.code, BrowserAuthErrorMessage.hashEmptyError.desc + \" Given Url: \" + hashValue);\r\n };\r\n /**\r\n * Creates an error thrown when the hash string value is unexpectedly empty.\r\n */\r\n BrowserAuthError.createHashDoesNotContainStateError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.hashDoesNotContainStateError.code, BrowserAuthErrorMessage.hashDoesNotContainStateError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the hash string value does not contain known properties\r\n */\r\n BrowserAuthError.createHashDoesNotContainKnownPropertiesError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.hashDoesNotContainKnownPropertiesError.code, BrowserAuthErrorMessage.hashDoesNotContainKnownPropertiesError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the hash string value is unexpectedly empty.\r\n */\r\n BrowserAuthError.createUnableToParseStateError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.unableToParseStateError.code, BrowserAuthErrorMessage.unableToParseStateError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the state value in the hash does not match the interaction type of the API attempting to consume it.\r\n */\r\n BrowserAuthError.createStateInteractionTypeMismatchError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.stateInteractionTypeMismatchError.code, BrowserAuthErrorMessage.stateInteractionTypeMismatchError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when a browser interaction (redirect or popup) is in progress.\r\n */\r\n BrowserAuthError.createInteractionInProgressError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.interactionInProgress.code, BrowserAuthErrorMessage.interactionInProgress.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the popup window could not be opened.\r\n * @param errDetail\r\n */\r\n BrowserAuthError.createPopupWindowError = function (errDetail) {\r\n var errorMessage = BrowserAuthErrorMessage.popupWindowError.desc;\r\n errorMessage = !StringUtils.isEmpty(errDetail) ? errorMessage + \" Details: \" + errDetail : errorMessage;\r\n return new BrowserAuthError(BrowserAuthErrorMessage.popupWindowError.code, errorMessage);\r\n };\r\n /**\r\n * Creates an error thrown when window.open returns an empty window object.\r\n * @param errDetail\r\n */\r\n BrowserAuthError.createEmptyWindowCreatedError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.emptyWindowError.code, BrowserAuthErrorMessage.emptyWindowError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the user closes a popup.\r\n */\r\n BrowserAuthError.createUserCancelledError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.userCancelledError.code, BrowserAuthErrorMessage.userCancelledError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when monitorPopupFromHash times out for a given popup.\r\n */\r\n BrowserAuthError.createMonitorPopupTimeoutError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.monitorPopupTimeoutError.code, BrowserAuthErrorMessage.monitorPopupTimeoutError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when monitorIframeFromHash times out for a given iframe.\r\n */\r\n BrowserAuthError.createMonitorIframeTimeoutError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.monitorIframeTimeoutError.code, BrowserAuthErrorMessage.monitorIframeTimeoutError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when navigateWindow is called inside an iframe or brokered applications.\r\n * @param windowParentCheck\r\n */\r\n BrowserAuthError.createRedirectInIframeError = function (windowParentCheck) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.redirectInIframeError.code, BrowserAuthErrorMessage.redirectInIframeError.desc + \" (window.parent !== window) => \" + windowParentCheck);\r\n };\r\n /**\r\n * Creates an error thrown when an auth reload is done inside an iframe.\r\n */\r\n BrowserAuthError.createBlockReloadInHiddenIframeError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.blockTokenRequestsInHiddenIframeError.code, BrowserAuthErrorMessage.blockTokenRequestsInHiddenIframeError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when a popup attempts to call an acquireToken API\r\n * @returns\r\n */\r\n BrowserAuthError.createBlockAcquireTokenInPopupsError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.blockAcquireTokenInPopupsError.code, BrowserAuthErrorMessage.blockAcquireTokenInPopupsError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when an iframe is found to be closed before the timeout is reached.\r\n */\r\n BrowserAuthError.createIframeClosedPrematurelyError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.iframeClosedPrematurelyError.code, BrowserAuthErrorMessage.iframeClosedPrematurelyError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the logout API is called on any of the silent interaction clients\r\n */\r\n BrowserAuthError.createSilentLogoutUnsupportedError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.silentLogoutUnsupportedError.code, BrowserAuthErrorMessage.silentLogoutUnsupportedError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the account object is not provided in the acquireTokenSilent API.\r\n */\r\n BrowserAuthError.createNoAccountError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.noAccountError.code, BrowserAuthErrorMessage.noAccountError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when a given prompt value is invalid for silent requests.\r\n */\r\n BrowserAuthError.createSilentPromptValueError = function (givenPrompt) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.silentPromptValueError.code, BrowserAuthErrorMessage.silentPromptValueError.desc + \" Given value: \" + givenPrompt);\r\n };\r\n /**\r\n * Creates an error thrown when the cached token request could not be retrieved from the cache\r\n */\r\n BrowserAuthError.createUnableToParseTokenRequestCacheError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.unableToParseTokenRequestCacheError.code, BrowserAuthErrorMessage.unableToParseTokenRequestCacheError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the token request could not be retrieved from the cache\r\n */\r\n BrowserAuthError.createNoTokenRequestCacheError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.noTokenRequestCacheError.code, BrowserAuthErrorMessage.noTokenRequestCacheError.desc);\r\n };\r\n /**\r\n * Creates an error thrown when handleCodeResponse is called before initiateAuthRequest (InteractionHandler)\r\n */\r\n BrowserAuthError.createAuthRequestNotSetError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.authRequestNotSet.code, BrowserAuthErrorMessage.authRequestNotSet.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the authority could not be retrieved from the cache\r\n */\r\n BrowserAuthError.createNoCachedAuthorityError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.noCachedAuthorityError.code, BrowserAuthErrorMessage.noCachedAuthorityError.desc);\r\n };\r\n /**\r\n * Creates an error thrown if cache type is invalid.\r\n */\r\n BrowserAuthError.createInvalidCacheTypeError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.invalidCacheType.code, \"\" + BrowserAuthErrorMessage.invalidCacheType.desc);\r\n };\r\n /**\r\n * Create an error thrown when login and token requests are made from a non-browser environment\r\n */\r\n BrowserAuthError.createNonBrowserEnvironmentError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.notInBrowserEnvironment.code, BrowserAuthErrorMessage.notInBrowserEnvironment.desc);\r\n };\r\n /**\r\n * Create an error thrown when indexDB database is not open\r\n */\r\n BrowserAuthError.createDatabaseNotOpenError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.databaseNotOpen.code, BrowserAuthErrorMessage.databaseNotOpen.desc);\r\n };\r\n /**\r\n * Create an error thrown when token fetch fails due to no internet\r\n */\r\n BrowserAuthError.createNoNetworkConnectivityError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.noNetworkConnectivity.code, BrowserAuthErrorMessage.noNetworkConnectivity.desc);\r\n };\r\n /**\r\n * Create an error thrown when token fetch fails due to reasons other than internet connectivity\r\n */\r\n BrowserAuthError.createPostRequestFailedError = function (errorDesc, endpoint) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.postRequestFailed.code, BrowserAuthErrorMessage.postRequestFailed.desc + \" | Network client threw: \" + errorDesc + \" | Attempted to reach: \" + endpoint.split(\"?\")[0]);\r\n };\r\n /**\r\n * Create an error thrown when get request fails due to reasons other than internet connectivity\r\n */\r\n BrowserAuthError.createGetRequestFailedError = function (errorDesc, endpoint) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.getRequestFailed.code, BrowserAuthErrorMessage.getRequestFailed.desc + \" | Network client threw: \" + errorDesc + \" | Attempted to reach: \" + endpoint.split(\"?\")[0]);\r\n };\r\n /**\r\n * Create an error thrown when network client fails to parse network response\r\n */\r\n BrowserAuthError.createFailedToParseNetworkResponseError = function (endpoint) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.failedToParseNetworkResponse.code, BrowserAuthErrorMessage.failedToParseNetworkResponse.desc + \" | Attempted to reach: \" + endpoint.split(\"?\")[0]);\r\n };\r\n /**\r\n * Create an error thrown when the necessary information is not available to sideload tokens\r\n */\r\n BrowserAuthError.createUnableToLoadTokenError = function (errorDetail) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.unableToLoadTokenError.code, BrowserAuthErrorMessage.unableToLoadTokenError.desc + \" | \" + errorDetail);\r\n };\r\n /**\r\n * Create an error thrown when the queried cryptographic key is not found in IndexedDB\r\n */\r\n BrowserAuthError.createSigningKeyNotFoundInStorageError = function (keyId) {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code, BrowserAuthErrorMessage.signingKeyNotFoundInStorage.desc + \" | No match found for KeyId: \" + keyId);\r\n };\r\n /**\r\n * Create an error when an authorization code is required but not provided\r\n */\r\n BrowserAuthError.createAuthCodeRequiredError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.authCodeRequired.code, BrowserAuthErrorMessage.authCodeRequired.desc);\r\n };\r\n /**\r\n * Create an error when an authorization code or native account ID is required but not provided\r\n */\r\n BrowserAuthError.createAuthCodeOrNativeAccountIdRequiredError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.authCodeOrNativeAccountRequired.code, BrowserAuthErrorMessage.authCodeOrNativeAccountRequired.desc);\r\n };\r\n /**\r\n * Create an error when both authorization code and native account ID are provided\r\n */\r\n BrowserAuthError.createSpaCodeAndNativeAccountIdPresentError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.spaCodeAndNativeAccountPresent.code, BrowserAuthErrorMessage.spaCodeAndNativeAccountPresent.desc);\r\n };\r\n /**\r\n * Create an error when IndexedDB is unavailable\r\n */\r\n BrowserAuthError.createDatabaseUnavailableError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.databaseUnavailable.code, BrowserAuthErrorMessage.databaseUnavailable.desc);\r\n };\r\n /**\r\n * Create an error when native token acquisition is not possible\r\n */\r\n BrowserAuthError.createUnableToAcquireTokenFromNativePlatformError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.unableToAcquireTokenFromNativePlatform.code, BrowserAuthErrorMessage.unableToAcquireTokenFromNativePlatform.desc);\r\n };\r\n /**\r\n * Create an error thrown when Handshake with browser extension times out\r\n */\r\n BrowserAuthError.createNativeHandshakeTimeoutError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.nativeHandshakeTimeout.code, BrowserAuthErrorMessage.nativeHandshakeTimeout.desc);\r\n };\r\n /**\r\n * Create an error thrown when browser extension is not installed\r\n */\r\n BrowserAuthError.createNativeExtensionNotInstalledError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.nativeExtensionNotInstalled.code, BrowserAuthErrorMessage.nativeExtensionNotInstalled.desc);\r\n };\r\n /**\r\n * Create an error when native connection has not been established\r\n * @returns\r\n */\r\n BrowserAuthError.createNativeConnectionNotEstablishedError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.nativeConnectionNotEstablished.code, BrowserAuthErrorMessage.nativeConnectionNotEstablished.desc);\r\n };\r\n /**\r\n * Create an error thrown when the initialize function hasn't been called\r\n */\r\n BrowserAuthError.createNativeBrokerCalledBeforeInitialize = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.nativeBrokerCalledBeforeInitialize.code, BrowserAuthErrorMessage.nativeBrokerCalledBeforeInitialize.desc);\r\n };\r\n /**\r\n * Create an error thrown when requesting a token directly from the native platform with an unsupported prompt parameter e.g. select_account, login or create\r\n * These requests must go through eSTS to ensure eSTS is aware of the new account\r\n */\r\n BrowserAuthError.createNativePromptParameterNotSupportedError = function () {\r\n return new BrowserAuthError(BrowserAuthErrorMessage.nativePromptNotSupported.code, BrowserAuthErrorMessage.nativePromptNotSupported.desc);\r\n };\r\n return BrowserAuthError;\r\n}(AuthError));\n\nexport { BrowserAuthError, BrowserAuthErrorMessage };\n//# sourceMappingURL=BrowserAuthError.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { OIDC_DEFAULT_SCOPES } from '@azure/msal-common';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Constants\r\n */\r\nvar BrowserConstants = {\r\n /**\r\n * Interaction in progress cache value\r\n */\r\n INTERACTION_IN_PROGRESS_VALUE: \"interaction_in_progress\",\r\n /**\r\n * Invalid grant error code\r\n */\r\n INVALID_GRANT_ERROR: \"invalid_grant\",\r\n /**\r\n * Default popup window width\r\n */\r\n POPUP_WIDTH: 483,\r\n /**\r\n * Default popup window height\r\n */\r\n POPUP_HEIGHT: 600,\r\n /**\r\n * Name of the popup window starts with\r\n */\r\n POPUP_NAME_PREFIX: \"msal\",\r\n /**\r\n * Default popup monitor poll interval in milliseconds\r\n */\r\n DEFAULT_POLL_INTERVAL_MS: 30,\r\n /**\r\n * Msal-browser SKU\r\n */\r\n MSAL_SKU: \"msal.js.browser\",\r\n};\r\nvar NativeConstants = {\r\n CHANNEL_ID: \"53ee284d-920a-4b59-9d30-a60315b26836\",\r\n PREFERRED_EXTENSION_ID: \"ppnbnpeolgkicgegkbkbjmhlideopiji\",\r\n MATS_TELEMETRY: \"MATS\"\r\n};\r\nvar NativeExtensionMethod;\r\n(function (NativeExtensionMethod) {\r\n NativeExtensionMethod[\"HandshakeRequest\"] = \"Handshake\";\r\n NativeExtensionMethod[\"HandshakeResponse\"] = \"HandshakeResponse\";\r\n NativeExtensionMethod[\"GetToken\"] = \"GetToken\";\r\n NativeExtensionMethod[\"Response\"] = \"Response\";\r\n})(NativeExtensionMethod || (NativeExtensionMethod = {}));\r\nvar BrowserCacheLocation;\r\n(function (BrowserCacheLocation) {\r\n BrowserCacheLocation[\"LocalStorage\"] = \"localStorage\";\r\n BrowserCacheLocation[\"SessionStorage\"] = \"sessionStorage\";\r\n BrowserCacheLocation[\"MemoryStorage\"] = \"memoryStorage\";\r\n})(BrowserCacheLocation || (BrowserCacheLocation = {}));\r\n/**\r\n * HTTP Request types supported by MSAL.\r\n */\r\nvar HTTP_REQUEST_TYPE;\r\n(function (HTTP_REQUEST_TYPE) {\r\n HTTP_REQUEST_TYPE[\"GET\"] = \"GET\";\r\n HTTP_REQUEST_TYPE[\"POST\"] = \"POST\";\r\n})(HTTP_REQUEST_TYPE || (HTTP_REQUEST_TYPE = {}));\r\n/**\r\n * Temporary cache keys for MSAL, deleted after any request.\r\n */\r\nvar TemporaryCacheKeys;\r\n(function (TemporaryCacheKeys) {\r\n TemporaryCacheKeys[\"AUTHORITY\"] = \"authority\";\r\n TemporaryCacheKeys[\"ACQUIRE_TOKEN_ACCOUNT\"] = \"acquireToken.account\";\r\n TemporaryCacheKeys[\"SESSION_STATE\"] = \"session.state\";\r\n TemporaryCacheKeys[\"REQUEST_STATE\"] = \"request.state\";\r\n TemporaryCacheKeys[\"NONCE_IDTOKEN\"] = \"nonce.id_token\";\r\n TemporaryCacheKeys[\"ORIGIN_URI\"] = \"request.origin\";\r\n TemporaryCacheKeys[\"RENEW_STATUS\"] = \"token.renew.status\";\r\n TemporaryCacheKeys[\"URL_HASH\"] = \"urlHash\";\r\n TemporaryCacheKeys[\"REQUEST_PARAMS\"] = \"request.params\";\r\n TemporaryCacheKeys[\"SCOPES\"] = \"scopes\";\r\n TemporaryCacheKeys[\"INTERACTION_STATUS_KEY\"] = \"interaction.status\";\r\n TemporaryCacheKeys[\"CCS_CREDENTIAL\"] = \"ccs.credential\";\r\n TemporaryCacheKeys[\"CORRELATION_ID\"] = \"request.correlationId\";\r\n TemporaryCacheKeys[\"NATIVE_REQUEST\"] = \"request.native\";\r\n TemporaryCacheKeys[\"REDIRECT_CONTEXT\"] = \"request.redirect.context\";\r\n})(TemporaryCacheKeys || (TemporaryCacheKeys = {}));\r\nvar StaticCacheKeys;\r\n(function (StaticCacheKeys) {\r\n StaticCacheKeys[\"ACCOUNT_KEYS\"] = \"msal.account.keys\";\r\n StaticCacheKeys[\"TOKEN_KEYS\"] = \"msal.token.keys\";\r\n})(StaticCacheKeys || (StaticCacheKeys = {}));\r\n/**\r\n * Cache keys stored in-memory\r\n */\r\nvar InMemoryCacheKeys;\r\n(function (InMemoryCacheKeys) {\r\n InMemoryCacheKeys[\"WRAPPER_SKU\"] = \"wrapper.sku\";\r\n InMemoryCacheKeys[\"WRAPPER_VER\"] = \"wrapper.version\";\r\n})(InMemoryCacheKeys || (InMemoryCacheKeys = {}));\r\n/**\r\n * API Codes for Telemetry purposes.\r\n * Before adding a new code you must claim it in the MSAL Telemetry tracker as these number spaces are shared across all MSALs\r\n * 0-99 Silent Flow\r\n * 800-899 Auth Code Flow\r\n */\r\nvar ApiId;\r\n(function (ApiId) {\r\n ApiId[ApiId[\"acquireTokenRedirect\"] = 861] = \"acquireTokenRedirect\";\r\n ApiId[ApiId[\"acquireTokenPopup\"] = 862] = \"acquireTokenPopup\";\r\n ApiId[ApiId[\"ssoSilent\"] = 863] = \"ssoSilent\";\r\n ApiId[ApiId[\"acquireTokenSilent_authCode\"] = 864] = \"acquireTokenSilent_authCode\";\r\n ApiId[ApiId[\"handleRedirectPromise\"] = 865] = \"handleRedirectPromise\";\r\n ApiId[ApiId[\"acquireTokenByCode\"] = 866] = \"acquireTokenByCode\";\r\n ApiId[ApiId[\"acquireTokenSilent_silentFlow\"] = 61] = \"acquireTokenSilent_silentFlow\";\r\n ApiId[ApiId[\"logout\"] = 961] = \"logout\";\r\n ApiId[ApiId[\"logoutPopup\"] = 962] = \"logoutPopup\";\r\n})(ApiId || (ApiId = {}));\r\n/*\r\n * Interaction type of the API - used for state and telemetry\r\n */\r\nvar InteractionType;\r\n(function (InteractionType) {\r\n InteractionType[\"Redirect\"] = \"redirect\";\r\n InteractionType[\"Popup\"] = \"popup\";\r\n InteractionType[\"Silent\"] = \"silent\";\r\n InteractionType[\"None\"] = \"none\";\r\n})(InteractionType || (InteractionType = {}));\r\n/**\r\n * Types of interaction currently in progress.\r\n * Used in events in wrapper libraries to invoke functions when certain interaction is in progress or all interactions are complete.\r\n */\r\nvar InteractionStatus;\r\n(function (InteractionStatus) {\r\n /**\r\n * Initial status before interaction occurs\r\n */\r\n InteractionStatus[\"Startup\"] = \"startup\";\r\n /**\r\n * Status set when all login calls occuring\r\n */\r\n InteractionStatus[\"Login\"] = \"login\";\r\n /**\r\n * Status set when logout call occuring\r\n */\r\n InteractionStatus[\"Logout\"] = \"logout\";\r\n /**\r\n * Status set for acquireToken calls\r\n */\r\n InteractionStatus[\"AcquireToken\"] = \"acquireToken\";\r\n /**\r\n * Status set for ssoSilent calls\r\n */\r\n InteractionStatus[\"SsoSilent\"] = \"ssoSilent\";\r\n /**\r\n * Status set when handleRedirect in progress\r\n */\r\n InteractionStatus[\"HandleRedirect\"] = \"handleRedirect\";\r\n /**\r\n * Status set when interaction is complete\r\n */\r\n InteractionStatus[\"None\"] = \"none\";\r\n})(InteractionStatus || (InteractionStatus = {}));\r\nvar DEFAULT_REQUEST = {\r\n scopes: OIDC_DEFAULT_SCOPES\r\n};\r\n/**\r\n * JWK Key Format string (Type MUST be defined for window crypto APIs)\r\n */\r\nvar KEY_FORMAT_JWK = \"jwk\";\r\n// Supported wrapper SKUs\r\nvar WrapperSKU;\r\n(function (WrapperSKU) {\r\n WrapperSKU[\"React\"] = \"@azure/msal-react\";\r\n WrapperSKU[\"Angular\"] = \"@azure/msal-angular\";\r\n})(WrapperSKU || (WrapperSKU = {}));\r\n// DatabaseStorage Constants\r\nvar DB_NAME = \"msal.db\";\r\nvar DB_VERSION = 1;\r\nvar DB_TABLE_NAME = DB_NAME + \".keys\";\r\nvar CacheLookupPolicy;\r\n(function (CacheLookupPolicy) {\r\n /*\r\n * acquireTokenSilent will attempt to retrieve an access token from the cache. If the access token is expired\r\n * or cannot be found the refresh token will be used to acquire a new one. Finally, if the refresh token\r\n * is expired acquireTokenSilent will attempt to acquire new access and refresh tokens.\r\n */\r\n CacheLookupPolicy[CacheLookupPolicy[\"Default\"] = 0] = \"Default\";\r\n /*\r\n * acquireTokenSilent will only look for access tokens in the cache. It will not attempt to renew access or\r\n * refresh tokens.\r\n */\r\n CacheLookupPolicy[CacheLookupPolicy[\"AccessToken\"] = 1] = \"AccessToken\";\r\n /*\r\n * acquireTokenSilent will attempt to retrieve an access token from the cache. If the access token is expired or\r\n * cannot be found, the refresh token will be used to acquire a new one. If the refresh token is expired, it\r\n * will not be renewed and acquireTokenSilent will fail.\r\n */\r\n CacheLookupPolicy[CacheLookupPolicy[\"AccessTokenAndRefreshToken\"] = 2] = \"AccessTokenAndRefreshToken\";\r\n /*\r\n * acquireTokenSilent will not attempt to retrieve access tokens from the cache and will instead attempt to\r\n * exchange the cached refresh token for a new access token. If the refresh token is expired, it will not be\r\n * renewed and acquireTokenSilent will fail.\r\n */\r\n CacheLookupPolicy[CacheLookupPolicy[\"RefreshToken\"] = 3] = \"RefreshToken\";\r\n /*\r\n * acquireTokenSilent will not look in the cache for the access token. It will go directly to network with the\r\n * cached refresh token. If the refresh token is expired an attempt will be made to renew it. This is equivalent to\r\n * setting \"forceRefresh: true\".\r\n */\r\n CacheLookupPolicy[CacheLookupPolicy[\"RefreshTokenAndNetwork\"] = 4] = \"RefreshTokenAndNetwork\";\r\n /*\r\n * acquireTokenSilent will attempt to renew both access and refresh tokens. It will not look in the cache. This will\r\n * always fail if 3rd party cookies are blocked by the browser.\r\n */\r\n CacheLookupPolicy[CacheLookupPolicy[\"Skip\"] = 5] = \"Skip\";\r\n})(CacheLookupPolicy || (CacheLookupPolicy = {}));\n\nexport { ApiId, BrowserCacheLocation, BrowserConstants, CacheLookupPolicy, DB_NAME, DB_TABLE_NAME, DB_VERSION, DEFAULT_REQUEST, HTTP_REQUEST_TYPE, InMemoryCacheKeys, InteractionStatus, InteractionType, KEY_FORMAT_JWK, NativeConstants, NativeExtensionMethod, StaticCacheKeys, TemporaryCacheKeys, WrapperSKU };\n//# sourceMappingURL=BrowserConstants.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { AuthError } from '@azure/msal-common';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * BrowserAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nvar BrowserConfigurationAuthErrorMessage = {\r\n redirectUriNotSet: {\r\n code: \"redirect_uri_empty\",\r\n desc: \"A redirect URI is required for all calls, and none has been set.\"\r\n },\r\n postLogoutUriNotSet: {\r\n code: \"post_logout_uri_empty\",\r\n desc: \"A post logout redirect has not been set.\"\r\n },\r\n storageNotSupportedError: {\r\n code: \"storage_not_supported\",\r\n desc: \"Given storage configuration option was not supported.\"\r\n },\r\n noRedirectCallbacksSet: {\r\n code: \"no_redirect_callbacks\",\r\n desc: \"No redirect callbacks have been set. Please call setRedirectCallbacks() with the appropriate function arguments before continuing. \" +\r\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\r\n },\r\n invalidCallbackObject: {\r\n code: \"invalid_callback_object\",\r\n desc: \"The object passed for the callback was invalid. \" +\r\n \"More information is available here: https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL-basics.\"\r\n },\r\n stubPcaInstanceCalled: {\r\n code: \"stubbed_public_client_application_called\",\r\n 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\"\r\n },\r\n inMemRedirectUnavailable: {\r\n code: \"in_mem_redirect_unavailable\",\r\n 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.\"\r\n },\r\n entropyNotProvided: {\r\n code: \"entropy_not_provided\",\r\n desc: \"The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option.\"\r\n }\r\n};\r\n/**\r\n * Browser library error class thrown by the MSAL.js library for SPAs\r\n */\r\nvar BrowserConfigurationAuthError = /** @class */ (function (_super) {\r\n __extends(BrowserConfigurationAuthError, _super);\r\n function BrowserConfigurationAuthError(errorCode, errorMessage) {\r\n var _this = _super.call(this, errorCode, errorMessage) || this;\r\n _this.name = \"BrowserConfigurationAuthError\";\r\n Object.setPrototypeOf(_this, BrowserConfigurationAuthError.prototype);\r\n return _this;\r\n }\r\n /**\r\n * Creates an error thrown when the redirect uri is empty (not set by caller)\r\n */\r\n BrowserConfigurationAuthError.createRedirectUriEmptyError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.redirectUriNotSet.code, BrowserConfigurationAuthErrorMessage.redirectUriNotSet.desc);\r\n };\r\n /**\r\n * Creates an error thrown when the post-logout redirect uri is empty (not set by caller)\r\n */\r\n BrowserConfigurationAuthError.createPostLogoutRedirectUriEmptyError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.code, BrowserConfigurationAuthErrorMessage.postLogoutUriNotSet.desc);\r\n };\r\n /**\r\n * Creates error thrown when given storage location is not supported.\r\n * @param givenStorageLocation\r\n */\r\n BrowserConfigurationAuthError.createStorageNotSupportedError = function (givenStorageLocation) {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.storageNotSupportedError.code, BrowserConfigurationAuthErrorMessage.storageNotSupportedError.desc + \" Given Location: \" + givenStorageLocation);\r\n };\r\n /**\r\n * Creates error thrown when redirect callbacks are not set before calling loginRedirect() or acquireTokenRedirect().\r\n */\r\n BrowserConfigurationAuthError.createRedirectCallbacksNotSetError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.code, BrowserConfigurationAuthErrorMessage.noRedirectCallbacksSet.desc);\r\n };\r\n /**\r\n * Creates error thrown when the stub instance of PublicClientApplication is called.\r\n */\r\n BrowserConfigurationAuthError.createStubPcaInstanceCalledError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.code, BrowserConfigurationAuthErrorMessage.stubPcaInstanceCalled.desc);\r\n };\r\n /*\r\n * Create an error thrown when in-memory storage is used and storeAuthStateInCookie=false.\r\n */\r\n BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.code, BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.desc);\r\n };\r\n /**\r\n * Creates an error thrown when a crypto interface that requires entropy is initialized without entropy\r\n */\r\n BrowserConfigurationAuthError.createEntropyNotProvided = function () {\r\n return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.entropyNotProvided.code, BrowserConfigurationAuthErrorMessage.entropyNotProvided.desc);\r\n };\r\n return BrowserConfigurationAuthError;\r\n}(AuthError));\n\nexport { BrowserConfigurationAuthError, BrowserConfigurationAuthErrorMessage };\n//# sourceMappingURL=BrowserConfigurationAuthError.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js';\nimport { BrowserCacheLocation } from '../utils/BrowserConstants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar BrowserStorage = /** @class */ (function () {\r\n function BrowserStorage(cacheLocation) {\r\n this.validateWindowStorage(cacheLocation);\r\n this.windowStorage = window[cacheLocation];\r\n }\r\n BrowserStorage.prototype.validateWindowStorage = function (cacheLocation) {\r\n if (cacheLocation !== BrowserCacheLocation.LocalStorage && cacheLocation !== BrowserCacheLocation.SessionStorage) {\r\n throw BrowserConfigurationAuthError.createStorageNotSupportedError(cacheLocation);\r\n }\r\n var storageSupported = !!window[cacheLocation];\r\n if (!storageSupported) {\r\n throw BrowserConfigurationAuthError.createStorageNotSupportedError(cacheLocation);\r\n }\r\n };\r\n BrowserStorage.prototype.getItem = function (key) {\r\n return this.windowStorage.getItem(key);\r\n };\r\n BrowserStorage.prototype.setItem = function (key, value) {\r\n this.windowStorage.setItem(key, value);\r\n };\r\n BrowserStorage.prototype.removeItem = function (key) {\r\n this.windowStorage.removeItem(key);\r\n };\r\n BrowserStorage.prototype.getKeys = function () {\r\n return Object.keys(this.windowStorage);\r\n };\r\n BrowserStorage.prototype.containsKey = function (key) {\r\n return this.windowStorage.hasOwnProperty(key);\r\n };\r\n return BrowserStorage;\r\n}());\n\nexport { BrowserStorage };\n//# sourceMappingURL=BrowserStorage.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar MemoryStorage = /** @class */ (function () {\r\n function MemoryStorage() {\r\n this.cache = new Map();\r\n }\r\n MemoryStorage.prototype.getItem = function (key) {\r\n return this.cache.get(key) || null;\r\n };\r\n MemoryStorage.prototype.setItem = function (key, value) {\r\n this.cache.set(key, value);\r\n };\r\n MemoryStorage.prototype.removeItem = function (key) {\r\n this.cache.delete(key);\r\n };\r\n MemoryStorage.prototype.getKeys = function () {\r\n var cacheKeys = [];\r\n this.cache.forEach(function (value, key) {\r\n cacheKeys.push(key);\r\n });\r\n return cacheKeys;\r\n };\r\n MemoryStorage.prototype.containsKey = function (key) {\r\n return this.cache.has(key);\r\n };\r\n MemoryStorage.prototype.clear = function () {\r\n this.cache.clear();\r\n };\r\n return MemoryStorage;\r\n}());\n\nexport { MemoryStorage };\n//# sourceMappingURL=MemoryStorage.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { StringUtils, ProtocolUtils, ClientAuthError, UrlString } from '@azure/msal-common';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar BrowserProtocolUtils = /** @class */ (function () {\r\n function BrowserProtocolUtils() {\r\n }\r\n /**\r\n * Extracts the BrowserStateObject from the state string.\r\n * @param browserCrypto\r\n * @param state\r\n */\r\n BrowserProtocolUtils.extractBrowserRequestState = function (browserCrypto, state) {\r\n if (StringUtils.isEmpty(state)) {\r\n return null;\r\n }\r\n try {\r\n var requestStateObj = ProtocolUtils.parseRequestState(browserCrypto, state);\r\n return requestStateObj.libraryState.meta;\r\n }\r\n catch (e) {\r\n throw ClientAuthError.createInvalidStateError(state, e);\r\n }\r\n };\r\n /**\r\n * Parses properties of server response from url hash\r\n * @param locationHash Hash from url\r\n */\r\n BrowserProtocolUtils.parseServerResponseFromHash = function (locationHash) {\r\n if (!locationHash) {\r\n return {};\r\n }\r\n var hashUrlString = new UrlString(locationHash);\r\n return UrlString.getDeserializedHash(hashUrlString.getHash());\r\n };\r\n return BrowserProtocolUtils;\r\n}());\n\nexport { BrowserProtocolUtils };\n//# sourceMappingURL=BrowserProtocolUtils.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __spread } from '../_virtual/_tslib.js';\nimport { CredentialType, RefreshTokenEntity, CacheManager, AccessTokenEntity, IdTokenEntity, AccountEntity, ClientAuthError, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, Constants, PersistentCacheKeys, ThrottlingEntity, StringUtils, ProtocolUtils, CcsCredentialType, IdToken, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { BrowserCacheLocation, StaticCacheKeys, InMemoryCacheKeys, TemporaryCacheKeys } from '../utils/BrowserConstants.js';\nimport { BrowserStorage } from './BrowserStorage.js';\nimport { MemoryStorage } from './MemoryStorage.js';\nimport { BrowserProtocolUtils } from '../utils/BrowserProtocolUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class implements the cache storage interface for MSAL through browser local or session storage.\r\n * Cookies are only used if storeAuthStateInCookie is true, and are only used for\r\n * parameters such as state and nonce, generally.\r\n */\r\nvar BrowserCacheManager = /** @class */ (function (_super) {\r\n __extends(BrowserCacheManager, _super);\r\n function BrowserCacheManager(clientId, cacheConfig, cryptoImpl, logger) {\r\n var _this = _super.call(this, clientId, cryptoImpl, logger) || this;\r\n // Cookie life calculation (hours * minutes * seconds * ms)\r\n _this.COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;\r\n _this.cacheConfig = cacheConfig;\r\n _this.logger = logger;\r\n _this.internalStorage = new MemoryStorage();\r\n _this.browserStorage = _this.setupBrowserStorage(_this.cacheConfig.cacheLocation);\r\n _this.temporaryCacheStorage = _this.setupTemporaryCacheStorage(_this.cacheConfig.temporaryCacheLocation, _this.cacheConfig.cacheLocation);\r\n // Migrate cache entries from older versions of MSAL.\r\n if (cacheConfig.cacheMigrationEnabled) {\r\n _this.migrateCacheEntries();\r\n _this.createKeyMaps();\r\n }\r\n return _this;\r\n }\r\n /**\r\n * Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.\r\n * @param cacheLocation\r\n */\r\n BrowserCacheManager.prototype.setupBrowserStorage = function (cacheLocation) {\r\n switch (cacheLocation) {\r\n case BrowserCacheLocation.LocalStorage:\r\n case BrowserCacheLocation.SessionStorage:\r\n try {\r\n return new BrowserStorage(cacheLocation);\r\n }\r\n catch (e) {\r\n this.logger.verbose(e);\r\n break;\r\n }\r\n }\r\n this.cacheConfig.cacheLocation = BrowserCacheLocation.MemoryStorage;\r\n return new MemoryStorage();\r\n };\r\n /**\r\n * Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured temporaryCacheLocation.\r\n * @param temporaryCacheLocation\r\n * @param cacheLocation\r\n */\r\n BrowserCacheManager.prototype.setupTemporaryCacheStorage = function (temporaryCacheLocation, cacheLocation) {\r\n switch (cacheLocation) {\r\n case BrowserCacheLocation.LocalStorage:\r\n case BrowserCacheLocation.SessionStorage:\r\n try {\r\n /*\r\n * When users do not explicitly choose their own temporaryCacheLocation,\r\n * temporary cache items will always be stored in session storage to mitigate problems caused by multiple tabs\r\n */\r\n return new BrowserStorage(temporaryCacheLocation || BrowserCacheLocation.SessionStorage);\r\n }\r\n catch (e) {\r\n this.logger.verbose(e);\r\n return this.internalStorage;\r\n }\r\n case BrowserCacheLocation.MemoryStorage:\r\n default:\r\n return this.internalStorage;\r\n }\r\n };\r\n /**\r\n * Migrate all old cache entries to new schema. No rollback supported.\r\n * @param storeAuthStateInCookie\r\n */\r\n BrowserCacheManager.prototype.migrateCacheEntries = function () {\r\n var _this = this;\r\n var idTokenKey = Constants.CACHE_PREFIX + \".\" + PersistentCacheKeys.ID_TOKEN;\r\n var clientInfoKey = Constants.CACHE_PREFIX + \".\" + PersistentCacheKeys.CLIENT_INFO;\r\n var errorKey = Constants.CACHE_PREFIX + \".\" + PersistentCacheKeys.ERROR;\r\n var errorDescKey = Constants.CACHE_PREFIX + \".\" + PersistentCacheKeys.ERROR_DESC;\r\n var idTokenValue = this.browserStorage.getItem(idTokenKey);\r\n var clientInfoValue = this.browserStorage.getItem(clientInfoKey);\r\n var errorValue = this.browserStorage.getItem(errorKey);\r\n var errorDescValue = this.browserStorage.getItem(errorDescKey);\r\n var values = [idTokenValue, clientInfoValue, errorValue, errorDescValue];\r\n var keysToMigrate = [PersistentCacheKeys.ID_TOKEN, PersistentCacheKeys.CLIENT_INFO, PersistentCacheKeys.ERROR, PersistentCacheKeys.ERROR_DESC];\r\n keysToMigrate.forEach(function (cacheKey, index) { return _this.migrateCacheEntry(cacheKey, values[index]); });\r\n };\r\n /**\r\n * Utility function to help with migration.\r\n * @param newKey\r\n * @param value\r\n * @param storeAuthStateInCookie\r\n */\r\n BrowserCacheManager.prototype.migrateCacheEntry = function (newKey, value) {\r\n if (value) {\r\n this.setTemporaryCache(newKey, value, true);\r\n }\r\n };\r\n /**\r\n * Searches all cache entries for MSAL accounts and creates the account key map\r\n * This is used to migrate users from older versions of MSAL which did not create the map.\r\n * @returns\r\n */\r\n BrowserCacheManager.prototype.createKeyMaps = function () {\r\n var _this = this;\r\n this.logger.trace(\"BrowserCacheManager - createKeyMaps called.\");\r\n var accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);\r\n var tokenKeys = this.getItem(StaticCacheKeys.TOKEN_KEYS + \".\" + this.clientId);\r\n if (accountKeys && tokenKeys) {\r\n this.logger.verbose(\"BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.\");\r\n // Key maps already exist, no need to iterate through cache\r\n return;\r\n }\r\n var allKeys = this.browserStorage.getKeys();\r\n allKeys.forEach(function (key) {\r\n if (_this.isCredentialKey(key)) {\r\n // Get item, parse, validate and write key to map\r\n var value = _this.getItem(key);\r\n if (value) {\r\n var credObj = _this.validateAndParseJson(value);\r\n if (credObj && credObj.hasOwnProperty(\"credentialType\")) {\r\n switch (credObj[\"credentialType\"]) {\r\n case CredentialType.ID_TOKEN:\r\n if (IdTokenEntity.isIdTokenEntity(credObj)) {\r\n _this.logger.trace(\"BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map\");\r\n _this.logger.tracePii(\"BrowserCacheManager:createKeyMaps - idToken with key: \" + key + \" found, saving key to token key map\");\r\n var idTokenEntity = CacheManager.toObject(new IdTokenEntity(), credObj);\r\n var newKey = _this.updateCredentialCacheKey(key, idTokenEntity);\r\n _this.addTokenKey(newKey, CredentialType.ID_TOKEN);\r\n return;\r\n }\r\n else {\r\n _this.logger.trace(\"BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping.\");\r\n _this.logger.tracePii(\"BrowserCacheManager:createKeyMaps - failed idToken validation on key: \" + key);\r\n }\r\n break;\r\n case CredentialType.ACCESS_TOKEN:\r\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:\r\n if (AccessTokenEntity.isAccessTokenEntity(credObj)) {\r\n _this.logger.trace(\"BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map\");\r\n _this.logger.tracePii(\"BrowserCacheManager:createKeyMaps - accessToken with key: \" + key + \" found, saving key to token key map\");\r\n var accessTokenEntity = CacheManager.toObject(new AccessTokenEntity(), credObj);\r\n var newKey = _this.updateCredentialCacheKey(key, accessTokenEntity);\r\n _this.addTokenKey(newKey, CredentialType.ACCESS_TOKEN);\r\n return;\r\n }\r\n else {\r\n _this.logger.trace(\"BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping.\");\r\n _this.logger.tracePii(\"BrowserCacheManager:createKeyMaps - failed accessToken validation on key: \" + key);\r\n }\r\n break;\r\n case CredentialType.REFRESH_TOKEN:\r\n if (RefreshTokenEntity.isRefreshTokenEntity(credObj)) {\r\n _this.logger.trace(\"BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map\");\r\n _this.logger.tracePii(\"BrowserCacheManager:createKeyMaps - refreshToken with key: \" + key + \" found, saving key to token key map\");\r\n var refreshTokenEntity = CacheManager.toObject(new RefreshTokenEntity(), credObj);\r\n var newKey = _this.updateCredentialCacheKey(key, refreshTokenEntity);\r\n _this.addTokenKey(newKey, CredentialType.REFRESH_TOKEN);\r\n return;\r\n }\r\n else {\r\n _this.logger.trace(\"BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping.\");\r\n _this.logger.tracePii(\"BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: \" + key);\r\n }\r\n break;\r\n // If credentialType isn't one of our predefined ones, it may not be an MSAL cache value. Ignore.\r\n }\r\n }\r\n }\r\n }\r\n if (_this.isAccountKey(key)) {\r\n var value = _this.getItem(key);\r\n if (value) {\r\n var accountObj = _this.validateAndParseJson(value);\r\n if (accountObj && AccountEntity.isAccountEntity(accountObj)) {\r\n _this.logger.trace(\"BrowserCacheManager:createKeyMaps - account found, saving key to account key map\");\r\n _this.logger.tracePii(\"BrowserCacheManager:createKeyMaps - account with key: \" + key + \" found, saving key to account key map\");\r\n _this.addAccountKeyToMap(key);\r\n }\r\n }\r\n }\r\n });\r\n };\r\n /**\r\n * Parses passed value as JSON object, JSON.parse() will throw an error.\r\n * @param input\r\n */\r\n BrowserCacheManager.prototype.validateAndParseJson = function (jsonValue) {\r\n try {\r\n var parsedJson = JSON.parse(jsonValue);\r\n /**\r\n * There are edge cases in which JSON.parse will successfully parse a non-valid JSON object\r\n * (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check\r\n * of the parsed value is necessary in order to be certain that the string represents a valid JSON object.\r\n *\r\n */\r\n return (parsedJson && typeof parsedJson === \"object\") ? parsedJson : null;\r\n }\r\n catch (error) {\r\n return null;\r\n }\r\n };\r\n /**\r\n * fetches the entry from the browser storage based off the key\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.getItem = function (key) {\r\n return this.browserStorage.getItem(key);\r\n };\r\n /**\r\n * sets the entry in the browser storage\r\n * @param key\r\n * @param value\r\n */\r\n BrowserCacheManager.prototype.setItem = function (key, value) {\r\n this.browserStorage.setItem(key, value);\r\n };\r\n /**\r\n * fetch the account entity from the platform cache\r\n * @param accountKey\r\n */\r\n BrowserCacheManager.prototype.getAccount = function (accountKey) {\r\n this.logger.trace(\"BrowserCacheManager.getAccount called\");\r\n var account = this.getItem(accountKey);\r\n if (!account) {\r\n this.removeAccountKeyFromMap(accountKey);\r\n return null;\r\n }\r\n var parsedAccount = this.validateAndParseJson(account);\r\n if (!parsedAccount || !AccountEntity.isAccountEntity(parsedAccount)) {\r\n this.removeAccountKeyFromMap(accountKey);\r\n return null;\r\n }\r\n return CacheManager.toObject(new AccountEntity(), parsedAccount);\r\n };\r\n /**\r\n * set account entity in the platform cache\r\n * @param key\r\n * @param value\r\n */\r\n BrowserCacheManager.prototype.setAccount = function (account) {\r\n this.logger.trace(\"BrowserCacheManager.setAccount called\");\r\n var key = account.generateAccountKey();\r\n this.setItem(key, JSON.stringify(account));\r\n this.addAccountKeyToMap(key);\r\n };\r\n /**\r\n * Returns the array of account keys currently cached\r\n * @returns\r\n */\r\n BrowserCacheManager.prototype.getAccountKeys = function () {\r\n this.logger.trace(\"BrowserCacheManager.getAccountKeys called\");\r\n var accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);\r\n if (accountKeys) {\r\n return JSON.parse(accountKeys);\r\n }\r\n this.logger.verbose(\"BrowserCacheManager.getAccountKeys - No account keys found\");\r\n return [];\r\n };\r\n /**\r\n * Add a new account to the key map\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.addAccountKeyToMap = function (key) {\r\n this.logger.trace(\"BrowserCacheManager.addAccountKeyToMap called\");\r\n this.logger.tracePii(\"BrowserCacheManager.addAccountKeyToMap called with key: \" + key);\r\n var accountKeys = this.getAccountKeys();\r\n if (accountKeys.indexOf(key) === -1) {\r\n // Only add key if it does not already exist in the map\r\n accountKeys.push(key);\r\n this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));\r\n this.logger.verbose(\"BrowserCacheManager.addAccountKeyToMap account key added\");\r\n }\r\n else {\r\n this.logger.verbose(\"BrowserCacheManager.addAccountKeyToMap account key already exists in map\");\r\n }\r\n };\r\n /**\r\n * Remove an account from the key map\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.removeAccountKeyFromMap = function (key) {\r\n this.logger.trace(\"BrowserCacheManager.removeAccountKeyFromMap called\");\r\n this.logger.tracePii(\"BrowserCacheManager.removeAccountKeyFromMap called with key: \" + key);\r\n var accountKeys = this.getAccountKeys();\r\n var removalIndex = accountKeys.indexOf(key);\r\n if (removalIndex > -1) {\r\n accountKeys.splice(removalIndex, 1);\r\n this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));\r\n this.logger.trace(\"BrowserCacheManager.removeAccountKeyFromMap account key removed\");\r\n }\r\n else {\r\n this.logger.trace(\"BrowserCacheManager.removeAccountKeyFromMap key not found in existing map\");\r\n }\r\n };\r\n /**\r\n * Extends inherited removeAccount function to include removal of the account key from the map\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.removeAccount = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n _super.prototype.removeAccount.call(this, key);\r\n this.removeAccountKeyFromMap(key);\r\n return [2 /*return*/];\r\n });\r\n });\r\n };\r\n /**\r\n * Removes given idToken from the cache and from the key map\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.removeIdToken = function (key) {\r\n _super.prototype.removeIdToken.call(this, key);\r\n this.removeTokenKey(key, CredentialType.ID_TOKEN);\r\n };\r\n /**\r\n * Removes given accessToken from the cache and from the key map\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.removeAccessToken = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n _super.prototype.removeAccessToken.call(this, key);\r\n this.removeTokenKey(key, CredentialType.ACCESS_TOKEN);\r\n return [2 /*return*/];\r\n });\r\n });\r\n };\r\n /**\r\n * Removes given refreshToken from the cache and from the key map\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.removeRefreshToken = function (key) {\r\n _super.prototype.removeRefreshToken.call(this, key);\r\n this.removeTokenKey(key, CredentialType.REFRESH_TOKEN);\r\n };\r\n /**\r\n * Gets the keys for the cached tokens associated with this clientId\r\n * @returns\r\n */\r\n BrowserCacheManager.prototype.getTokenKeys = function () {\r\n this.logger.trace(\"BrowserCacheManager.getTokenKeys called\");\r\n var item = this.getItem(StaticCacheKeys.TOKEN_KEYS + \".\" + this.clientId);\r\n if (item) {\r\n var tokenKeys = this.validateAndParseJson(item);\r\n if (tokenKeys &&\r\n tokenKeys.hasOwnProperty(\"idToken\") &&\r\n tokenKeys.hasOwnProperty(\"accessToken\") &&\r\n tokenKeys.hasOwnProperty(\"refreshToken\")) {\r\n return tokenKeys;\r\n }\r\n else {\r\n this.logger.error(\"BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.\");\r\n }\r\n }\r\n else {\r\n this.logger.verbose(\"BrowserCacheManager.getTokenKeys - No token keys found\");\r\n }\r\n return {\r\n idToken: [],\r\n accessToken: [],\r\n refreshToken: []\r\n };\r\n };\r\n /**\r\n * Adds the given key to the token key map\r\n * @param key\r\n * @param type\r\n */\r\n BrowserCacheManager.prototype.addTokenKey = function (key, type) {\r\n this.logger.trace(\"BrowserCacheManager addTokenKey called\");\r\n var tokenKeys = this.getTokenKeys();\r\n switch (type) {\r\n case CredentialType.ID_TOKEN:\r\n if (tokenKeys.idToken.indexOf(key) === -1) {\r\n this.logger.info(\"BrowserCacheManager: addTokenKey - idToken added to map\");\r\n tokenKeys.idToken.push(key);\r\n }\r\n break;\r\n case CredentialType.ACCESS_TOKEN:\r\n if (tokenKeys.accessToken.indexOf(key) === -1) {\r\n this.logger.info(\"BrowserCacheManager: addTokenKey - accessToken added to map\");\r\n tokenKeys.accessToken.push(key);\r\n }\r\n break;\r\n case CredentialType.REFRESH_TOKEN:\r\n if (tokenKeys.refreshToken.indexOf(key) === -1) {\r\n this.logger.info(\"BrowserCacheManager: addTokenKey - refreshToken added to map\");\r\n tokenKeys.refreshToken.push(key);\r\n }\r\n break;\r\n default:\r\n this.logger.error(\"BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: \" + type);\r\n ClientAuthError.createUnexpectedCredentialTypeError();\r\n }\r\n this.setItem(StaticCacheKeys.TOKEN_KEYS + \".\" + this.clientId, JSON.stringify(tokenKeys));\r\n };\r\n /**\r\n * Removes the given key from the token key map\r\n * @param key\r\n * @param type\r\n */\r\n BrowserCacheManager.prototype.removeTokenKey = function (key, type) {\r\n this.logger.trace(\"BrowserCacheManager removeTokenKey called\");\r\n var tokenKeys = this.getTokenKeys();\r\n switch (type) {\r\n case CredentialType.ID_TOKEN:\r\n this.logger.infoPii(\"BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: \" + key + \" from map\");\r\n var idRemoval = tokenKeys.idToken.indexOf(key);\r\n if (idRemoval > -1) {\r\n this.logger.info(\"BrowserCacheManager: removeTokenKey - idToken removed from map\");\r\n tokenKeys.idToken.splice(idRemoval, 1);\r\n }\r\n else {\r\n this.logger.info(\"BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.\");\r\n }\r\n break;\r\n case CredentialType.ACCESS_TOKEN:\r\n this.logger.infoPii(\"BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: \" + key + \" from map\");\r\n var accessRemoval = tokenKeys.accessToken.indexOf(key);\r\n if (accessRemoval > -1) {\r\n this.logger.info(\"BrowserCacheManager: removeTokenKey - accessToken removed from map\");\r\n tokenKeys.accessToken.splice(accessRemoval, 1);\r\n }\r\n else {\r\n this.logger.info(\"BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.\");\r\n }\r\n break;\r\n case CredentialType.REFRESH_TOKEN:\r\n this.logger.infoPii(\"BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: \" + key + \" from map\");\r\n var refreshRemoval = tokenKeys.refreshToken.indexOf(key);\r\n if (refreshRemoval > -1) {\r\n this.logger.info(\"BrowserCacheManager: removeTokenKey - refreshToken removed from map\");\r\n tokenKeys.refreshToken.splice(refreshRemoval, 1);\r\n }\r\n else {\r\n this.logger.info(\"BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.\");\r\n }\r\n break;\r\n default:\r\n this.logger.error(\"BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: \" + type);\r\n ClientAuthError.createUnexpectedCredentialTypeError();\r\n }\r\n this.setItem(StaticCacheKeys.TOKEN_KEYS + \".\" + this.clientId, JSON.stringify(tokenKeys));\r\n };\r\n /**\r\n * generates idToken entity from a string\r\n * @param idTokenKey\r\n */\r\n BrowserCacheManager.prototype.getIdTokenCredential = function (idTokenKey) {\r\n var value = this.getItem(idTokenKey);\r\n if (!value) {\r\n this.logger.trace(\"BrowserCacheManager.getIdTokenCredential: called, no cache hit\");\r\n this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);\r\n return null;\r\n }\r\n var parsedIdToken = this.validateAndParseJson(value);\r\n if (!parsedIdToken || !IdTokenEntity.isIdTokenEntity(parsedIdToken)) {\r\n this.logger.trace(\"BrowserCacheManager.getIdTokenCredential: called, no cache hit\");\r\n this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);\r\n return null;\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getIdTokenCredential: cache hit\");\r\n return CacheManager.toObject(new IdTokenEntity(), parsedIdToken);\r\n };\r\n /**\r\n * set IdToken credential to the platform cache\r\n * @param idToken\r\n */\r\n BrowserCacheManager.prototype.setIdTokenCredential = function (idToken) {\r\n this.logger.trace(\"BrowserCacheManager.setIdTokenCredential called\");\r\n var idTokenKey = idToken.generateCredentialKey();\r\n this.setItem(idTokenKey, JSON.stringify(idToken));\r\n this.addTokenKey(idTokenKey, CredentialType.ID_TOKEN);\r\n };\r\n /**\r\n * generates accessToken entity from a string\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.getAccessTokenCredential = function (accessTokenKey) {\r\n var value = this.getItem(accessTokenKey);\r\n if (!value) {\r\n this.logger.trace(\"BrowserCacheManager.getAccessTokenCredential: called, no cache hit\");\r\n this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);\r\n return null;\r\n }\r\n var parsedAccessToken = this.validateAndParseJson(value);\r\n if (!parsedAccessToken || !AccessTokenEntity.isAccessTokenEntity(parsedAccessToken)) {\r\n this.logger.trace(\"BrowserCacheManager.getAccessTokenCredential: called, no cache hit\");\r\n this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);\r\n return null;\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getAccessTokenCredential: cache hit\");\r\n return CacheManager.toObject(new AccessTokenEntity(), parsedAccessToken);\r\n };\r\n /**\r\n * set accessToken credential to the platform cache\r\n * @param accessToken\r\n */\r\n BrowserCacheManager.prototype.setAccessTokenCredential = function (accessToken) {\r\n this.logger.trace(\"BrowserCacheManager.setAccessTokenCredential called\");\r\n var accessTokenKey = accessToken.generateCredentialKey();\r\n this.setItem(accessTokenKey, JSON.stringify(accessToken));\r\n this.addTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);\r\n };\r\n /**\r\n * generates refreshToken entity from a string\r\n * @param refreshTokenKey\r\n */\r\n BrowserCacheManager.prototype.getRefreshTokenCredential = function (refreshTokenKey) {\r\n var value = this.getItem(refreshTokenKey);\r\n if (!value) {\r\n this.logger.trace(\"BrowserCacheManager.getRefreshTokenCredential: called, no cache hit\");\r\n this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);\r\n return null;\r\n }\r\n var parsedRefreshToken = this.validateAndParseJson(value);\r\n if (!parsedRefreshToken || !RefreshTokenEntity.isRefreshTokenEntity(parsedRefreshToken)) {\r\n this.logger.trace(\"BrowserCacheManager.getRefreshTokenCredential: called, no cache hit\");\r\n this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);\r\n return null;\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getRefreshTokenCredential: cache hit\");\r\n return CacheManager.toObject(new RefreshTokenEntity(), parsedRefreshToken);\r\n };\r\n /**\r\n * set refreshToken credential to the platform cache\r\n * @param refreshToken\r\n */\r\n BrowserCacheManager.prototype.setRefreshTokenCredential = function (refreshToken) {\r\n this.logger.trace(\"BrowserCacheManager.setRefreshTokenCredential called\");\r\n var refreshTokenKey = refreshToken.generateCredentialKey();\r\n this.setItem(refreshTokenKey, JSON.stringify(refreshToken));\r\n this.addTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);\r\n };\r\n /**\r\n * fetch appMetadata entity from the platform cache\r\n * @param appMetadataKey\r\n */\r\n BrowserCacheManager.prototype.getAppMetadata = function (appMetadataKey) {\r\n var value = this.getItem(appMetadataKey);\r\n if (!value) {\r\n this.logger.trace(\"BrowserCacheManager.getAppMetadata: called, no cache hit\");\r\n return null;\r\n }\r\n var parsedMetadata = this.validateAndParseJson(value);\r\n if (!parsedMetadata || !AppMetadataEntity.isAppMetadataEntity(appMetadataKey, parsedMetadata)) {\r\n this.logger.trace(\"BrowserCacheManager.getAppMetadata: called, no cache hit\");\r\n return null;\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getAppMetadata: cache hit\");\r\n return CacheManager.toObject(new AppMetadataEntity(), parsedMetadata);\r\n };\r\n /**\r\n * set appMetadata entity to the platform cache\r\n * @param appMetadata\r\n */\r\n BrowserCacheManager.prototype.setAppMetadata = function (appMetadata) {\r\n this.logger.trace(\"BrowserCacheManager.setAppMetadata called\");\r\n var appMetadataKey = appMetadata.generateAppMetadataKey();\r\n this.setItem(appMetadataKey, JSON.stringify(appMetadata));\r\n };\r\n /**\r\n * fetch server telemetry entity from the platform cache\r\n * @param serverTelemetryKey\r\n */\r\n BrowserCacheManager.prototype.getServerTelemetry = function (serverTelemetryKey) {\r\n var value = this.getItem(serverTelemetryKey);\r\n if (!value) {\r\n this.logger.trace(\"BrowserCacheManager.getServerTelemetry: called, no cache hit\");\r\n return null;\r\n }\r\n var parsedMetadata = this.validateAndParseJson(value);\r\n if (!parsedMetadata || !ServerTelemetryEntity.isServerTelemetryEntity(serverTelemetryKey, parsedMetadata)) {\r\n this.logger.trace(\"BrowserCacheManager.getServerTelemetry: called, no cache hit\");\r\n return null;\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getServerTelemetry: cache hit\");\r\n return CacheManager.toObject(new ServerTelemetryEntity(), parsedMetadata);\r\n };\r\n /**\r\n * set server telemetry entity to the platform cache\r\n * @param serverTelemetryKey\r\n * @param serverTelemetry\r\n */\r\n BrowserCacheManager.prototype.setServerTelemetry = function (serverTelemetryKey, serverTelemetry) {\r\n this.logger.trace(\"BrowserCacheManager.setServerTelemetry called\");\r\n this.setItem(serverTelemetryKey, JSON.stringify(serverTelemetry));\r\n };\r\n /**\r\n *\r\n */\r\n BrowserCacheManager.prototype.getAuthorityMetadata = function (key) {\r\n var value = this.internalStorage.getItem(key);\r\n if (!value) {\r\n this.logger.trace(\"BrowserCacheManager.getAuthorityMetadata: called, no cache hit\");\r\n return null;\r\n }\r\n var parsedMetadata = this.validateAndParseJson(value);\r\n if (parsedMetadata && AuthorityMetadataEntity.isAuthorityMetadataEntity(key, parsedMetadata)) {\r\n this.logger.trace(\"BrowserCacheManager.getAuthorityMetadata: cache hit\");\r\n return CacheManager.toObject(new AuthorityMetadataEntity(), parsedMetadata);\r\n }\r\n return null;\r\n };\r\n /**\r\n *\r\n */\r\n BrowserCacheManager.prototype.getAuthorityMetadataKeys = function () {\r\n var _this = this;\r\n var allKeys = this.internalStorage.getKeys();\r\n return allKeys.filter(function (key) {\r\n return _this.isAuthorityMetadata(key);\r\n });\r\n };\r\n /**\r\n * Sets wrapper metadata in memory\r\n * @param wrapperSKU\r\n * @param wrapperVersion\r\n */\r\n BrowserCacheManager.prototype.setWrapperMetadata = function (wrapperSKU, wrapperVersion) {\r\n this.internalStorage.setItem(InMemoryCacheKeys.WRAPPER_SKU, wrapperSKU);\r\n this.internalStorage.setItem(InMemoryCacheKeys.WRAPPER_VER, wrapperVersion);\r\n };\r\n /**\r\n * Returns wrapper metadata from in-memory storage\r\n */\r\n BrowserCacheManager.prototype.getWrapperMetadata = function () {\r\n var sku = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_SKU) || Constants.EMPTY_STRING;\r\n var version = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_VER) || Constants.EMPTY_STRING;\r\n return [sku, version];\r\n };\r\n /**\r\n *\r\n * @param entity\r\n */\r\n BrowserCacheManager.prototype.setAuthorityMetadata = function (key, entity) {\r\n this.logger.trace(\"BrowserCacheManager.setAuthorityMetadata called\");\r\n this.internalStorage.setItem(key, JSON.stringify(entity));\r\n };\r\n /**\r\n * Gets the active account\r\n */\r\n BrowserCacheManager.prototype.getActiveAccount = function () {\r\n var activeAccountKeyFilters = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);\r\n var activeAccountValueFilters = this.getItem(activeAccountKeyFilters);\r\n if (!activeAccountValueFilters) {\r\n // if new active account cache type isn't found, it's an old version, so look for that instead\r\n this.logger.trace(\"BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema\");\r\n var activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);\r\n var activeAccountValueLocal = this.getItem(activeAccountKeyLocal);\r\n if (!activeAccountValueLocal) {\r\n this.logger.trace(\"BrowserCacheManager.getActiveAccount: No active account found\");\r\n return null;\r\n }\r\n var activeAccount = this.getAccountInfoByFilter({ localAccountId: activeAccountValueLocal })[0] || null;\r\n if (activeAccount) {\r\n this.logger.trace(\"BrowserCacheManager.getActiveAccount: Legacy active account cache schema found\");\r\n this.logger.trace(\"BrowserCacheManager.getActiveAccount: Adding active account filters cache schema\");\r\n this.setActiveAccount(activeAccount);\r\n return activeAccount;\r\n }\r\n return null;\r\n }\r\n var activeAccountValueObj = this.validateAndParseJson(activeAccountValueFilters);\r\n if (activeAccountValueObj) {\r\n this.logger.trace(\"BrowserCacheManager.getActiveAccount: Active account filters schema found\");\r\n return this.getAccountInfoByFilter({\r\n homeAccountId: activeAccountValueObj.homeAccountId,\r\n localAccountId: activeAccountValueObj.localAccountId\r\n })[0] || null;\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getActiveAccount: No active account found\");\r\n return null;\r\n };\r\n /**\r\n * Sets the active account's localAccountId in cache\r\n * @param account\r\n */\r\n BrowserCacheManager.prototype.setActiveAccount = function (account) {\r\n var activeAccountKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);\r\n var activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);\r\n if (account) {\r\n this.logger.verbose(\"setActiveAccount: Active account set\");\r\n var activeAccountValue = {\r\n homeAccountId: account.homeAccountId,\r\n localAccountId: account.localAccountId\r\n };\r\n this.browserStorage.setItem(activeAccountKey, JSON.stringify(activeAccountValue));\r\n this.browserStorage.setItem(activeAccountKeyLocal, account.localAccountId);\r\n }\r\n else {\r\n this.logger.verbose(\"setActiveAccount: No account passed, active account not set\");\r\n this.browserStorage.removeItem(activeAccountKey);\r\n this.browserStorage.removeItem(activeAccountKeyLocal);\r\n }\r\n };\r\n /**\r\n * Gets a list of accounts that match all of the filters provided\r\n * @param account\r\n */\r\n BrowserCacheManager.prototype.getAccountInfoByFilter = function (accountFilter) {\r\n var allAccounts = this.getAllAccounts();\r\n this.logger.trace(\"BrowserCacheManager.getAccountInfoByFilter: total \" + allAccounts.length + \" accounts found\");\r\n return allAccounts.filter(function (accountObj) {\r\n if (accountFilter.username && accountFilter.username.toLowerCase() !== accountObj.username.toLowerCase()) {\r\n return false;\r\n }\r\n if (accountFilter.homeAccountId && accountFilter.homeAccountId !== accountObj.homeAccountId) {\r\n return false;\r\n }\r\n if (accountFilter.localAccountId && accountFilter.localAccountId !== accountObj.localAccountId) {\r\n return false;\r\n }\r\n if (accountFilter.tenantId && accountFilter.tenantId !== accountObj.tenantId) {\r\n return false;\r\n }\r\n if (accountFilter.environment && accountFilter.environment !== accountObj.environment) {\r\n return false;\r\n }\r\n return true;\r\n });\r\n };\r\n /**\r\n * Checks the cache for accounts matching loginHint or SID\r\n * @param loginHint\r\n * @param sid\r\n */\r\n BrowserCacheManager.prototype.getAccountInfoByHints = function (loginHint, sid) {\r\n var matchingAccounts = this.getAllAccounts().filter(function (accountInfo) {\r\n if (sid) {\r\n var accountSid = accountInfo.idTokenClaims && accountInfo.idTokenClaims[\"sid\"];\r\n return sid === accountSid;\r\n }\r\n if (loginHint) {\r\n return loginHint === accountInfo.username;\r\n }\r\n return false;\r\n });\r\n if (matchingAccounts.length === 1) {\r\n return matchingAccounts[0];\r\n }\r\n else if (matchingAccounts.length > 1) {\r\n throw ClientAuthError.createMultipleMatchingAccountsInCacheError();\r\n }\r\n return null;\r\n };\r\n /**\r\n * fetch throttling entity from the platform cache\r\n * @param throttlingCacheKey\r\n */\r\n BrowserCacheManager.prototype.getThrottlingCache = function (throttlingCacheKey) {\r\n var value = this.getItem(throttlingCacheKey);\r\n if (!value) {\r\n this.logger.trace(\"BrowserCacheManager.getThrottlingCache: called, no cache hit\");\r\n return null;\r\n }\r\n var parsedThrottlingCache = this.validateAndParseJson(value);\r\n if (!parsedThrottlingCache || !ThrottlingEntity.isThrottlingEntity(throttlingCacheKey, parsedThrottlingCache)) {\r\n this.logger.trace(\"BrowserCacheManager.getThrottlingCache: called, no cache hit\");\r\n return null;\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getThrottlingCache: cache hit\");\r\n return CacheManager.toObject(new ThrottlingEntity(), parsedThrottlingCache);\r\n };\r\n /**\r\n * set throttling entity to the platform cache\r\n * @param throttlingCacheKey\r\n * @param throttlingCache\r\n */\r\n BrowserCacheManager.prototype.setThrottlingCache = function (throttlingCacheKey, throttlingCache) {\r\n this.logger.trace(\"BrowserCacheManager.setThrottlingCache called\");\r\n this.setItem(throttlingCacheKey, JSON.stringify(throttlingCache));\r\n };\r\n /**\r\n * Gets cache item with given key.\r\n * Will retrieve from cookies if storeAuthStateInCookie is set to true.\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.getTemporaryCache = function (cacheKey, generateKey) {\r\n var key = generateKey ? this.generateCacheKey(cacheKey) : cacheKey;\r\n if (this.cacheConfig.storeAuthStateInCookie) {\r\n var itemCookie = this.getItemCookie(key);\r\n if (itemCookie) {\r\n this.logger.trace(\"BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies\");\r\n return itemCookie;\r\n }\r\n }\r\n var value = this.temporaryCacheStorage.getItem(key);\r\n if (!value) {\r\n // If temp cache item not found in session/memory, check local storage for items set by old versions\r\n if (this.cacheConfig.cacheLocation === BrowserCacheLocation.LocalStorage) {\r\n var item = this.browserStorage.getItem(key);\r\n if (item) {\r\n this.logger.trace(\"BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage\");\r\n return item;\r\n }\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getTemporaryCache: No cache item found in local storage\");\r\n return null;\r\n }\r\n this.logger.trace(\"BrowserCacheManager.getTemporaryCache: Temporary cache item returned\");\r\n return value;\r\n };\r\n /**\r\n * Sets the cache item with the key and value given.\r\n * Stores in cookie if storeAuthStateInCookie is set to true.\r\n * This can cause cookie overflow if used incorrectly.\r\n * @param key\r\n * @param value\r\n */\r\n BrowserCacheManager.prototype.setTemporaryCache = function (cacheKey, value, generateKey) {\r\n var key = generateKey ? this.generateCacheKey(cacheKey) : cacheKey;\r\n this.temporaryCacheStorage.setItem(key, value);\r\n if (this.cacheConfig.storeAuthStateInCookie) {\r\n this.logger.trace(\"BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie\");\r\n this.setItemCookie(key, value);\r\n }\r\n };\r\n /**\r\n * Removes the cache item with the given key.\r\n * Will also clear the cookie item if storeAuthStateInCookie is set to true.\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.removeItem = function (key) {\r\n this.browserStorage.removeItem(key);\r\n this.temporaryCacheStorage.removeItem(key);\r\n if (this.cacheConfig.storeAuthStateInCookie) {\r\n this.logger.trace(\"BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie\");\r\n this.clearItemCookie(key);\r\n }\r\n };\r\n /**\r\n * Checks whether key is in cache.\r\n * @param key\r\n */\r\n BrowserCacheManager.prototype.containsKey = function (key) {\r\n return this.browserStorage.containsKey(key) || this.temporaryCacheStorage.containsKey(key);\r\n };\r\n /**\r\n * Gets all keys in window.\r\n */\r\n BrowserCacheManager.prototype.getKeys = function () {\r\n return __spread(this.browserStorage.getKeys(), this.temporaryCacheStorage.getKeys());\r\n };\r\n /**\r\n * Clears all cache entries created by MSAL.\r\n */\r\n BrowserCacheManager.prototype.clear = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: \r\n // Removes all accounts and their credentials\r\n return [4 /*yield*/, this.removeAllAccounts()];\r\n case 1:\r\n // Removes all accounts and their credentials\r\n _a.sent();\r\n this.removeAppMetadata();\r\n // Removes all remaining MSAL cache items\r\n this.getKeys().forEach(function (cacheKey) {\r\n // Check if key contains msal prefix; For now, we are clearing all the cache items created by MSAL.js\r\n if ((_this.browserStorage.containsKey(cacheKey) || _this.temporaryCacheStorage.containsKey(cacheKey)) && ((cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1) || (cacheKey.indexOf(_this.clientId) !== -1))) {\r\n _this.removeItem(cacheKey);\r\n }\r\n });\r\n this.internalStorage.clear();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Add value to cookies\r\n * @param cookieName\r\n * @param cookieValue\r\n * @param expires\r\n */\r\n BrowserCacheManager.prototype.setItemCookie = function (cookieName, cookieValue, expires) {\r\n var cookieStr = encodeURIComponent(cookieName) + \"=\" + encodeURIComponent(cookieValue) + \";path=/;SameSite=Lax;\";\r\n if (expires) {\r\n var expireTime = this.getCookieExpirationTime(expires);\r\n cookieStr += \"expires=\" + expireTime + \";\";\r\n }\r\n if (this.cacheConfig.secureCookies) {\r\n cookieStr += \"Secure;\";\r\n }\r\n document.cookie = cookieStr;\r\n };\r\n /**\r\n * Get one item by key from cookies\r\n * @param cookieName\r\n */\r\n BrowserCacheManager.prototype.getItemCookie = function (cookieName) {\r\n var name = encodeURIComponent(cookieName) + \"=\";\r\n var cookieList = document.cookie.split(\";\");\r\n for (var i = 0; i < cookieList.length; i++) {\r\n var cookie = cookieList[i];\r\n while (cookie.charAt(0) === \" \") {\r\n cookie = cookie.substring(1);\r\n }\r\n if (cookie.indexOf(name) === 0) {\r\n return decodeURIComponent(cookie.substring(name.length, cookie.length));\r\n }\r\n }\r\n return Constants.EMPTY_STRING;\r\n };\r\n /**\r\n * Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.\r\n */\r\n BrowserCacheManager.prototype.clearMsalCookies = function () {\r\n var _this = this;\r\n var cookiePrefix = Constants.CACHE_PREFIX + \".\" + this.clientId;\r\n var cookieList = document.cookie.split(\";\");\r\n cookieList.forEach(function (cookie) {\r\n while (cookie.charAt(0) === \" \") {\r\n // eslint-disable-next-line no-param-reassign\r\n cookie = cookie.substring(1);\r\n }\r\n if (cookie.indexOf(cookiePrefix) === 0) {\r\n var cookieKey = cookie.split(\"=\")[0];\r\n _this.clearItemCookie(cookieKey);\r\n }\r\n });\r\n };\r\n /**\r\n * Clear an item in the cookies by key\r\n * @param cookieName\r\n */\r\n BrowserCacheManager.prototype.clearItemCookie = function (cookieName) {\r\n this.setItemCookie(cookieName, Constants.EMPTY_STRING, -1);\r\n };\r\n /**\r\n * Get cookie expiration time\r\n * @param cookieLifeDays\r\n */\r\n BrowserCacheManager.prototype.getCookieExpirationTime = function (cookieLifeDays) {\r\n var today = new Date();\r\n var expr = new Date(today.getTime() + cookieLifeDays * this.COOKIE_LIFE_MULTIPLIER);\r\n return expr.toUTCString();\r\n };\r\n /**\r\n * Gets the cache object referenced by the browser\r\n */\r\n BrowserCacheManager.prototype.getCache = function () {\r\n return this.browserStorage;\r\n };\r\n /**\r\n * interface compat, we cannot overwrite browser cache; Functionality is supported by individual entities in browser\r\n */\r\n BrowserCacheManager.prototype.setCache = function () {\r\n // sets nothing\r\n };\r\n /**\r\n * Prepend msal. to each key; Skip for any JSON object as Key (defined schemas do not need the key appended: AccessToken Keys or the upcoming schema)\r\n * @param key\r\n * @param addInstanceId\r\n */\r\n BrowserCacheManager.prototype.generateCacheKey = function (key) {\r\n var generatedKey = this.validateAndParseJson(key);\r\n if (!generatedKey) {\r\n if (StringUtils.startsWith(key, Constants.CACHE_PREFIX) || StringUtils.startsWith(key, PersistentCacheKeys.ADAL_ID_TOKEN)) {\r\n return key;\r\n }\r\n return Constants.CACHE_PREFIX + \".\" + this.clientId + \".\" + key;\r\n }\r\n return JSON.stringify(key);\r\n };\r\n /**\r\n * Create authorityKey to cache authority\r\n * @param state\r\n */\r\n BrowserCacheManager.prototype.generateAuthorityKey = function (stateString) {\r\n var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;\r\n return this.generateCacheKey(TemporaryCacheKeys.AUTHORITY + \".\" + stateId);\r\n };\r\n /**\r\n * Create Nonce key to cache nonce\r\n * @param state\r\n */\r\n BrowserCacheManager.prototype.generateNonceKey = function (stateString) {\r\n var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;\r\n return this.generateCacheKey(TemporaryCacheKeys.NONCE_IDTOKEN + \".\" + stateId);\r\n };\r\n /**\r\n * Creates full cache key for the request state\r\n * @param stateString State string for the request\r\n */\r\n BrowserCacheManager.prototype.generateStateKey = function (stateString) {\r\n // Use the library state id to key temp storage for uniqueness for multiple concurrent requests\r\n var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;\r\n return this.generateCacheKey(TemporaryCacheKeys.REQUEST_STATE + \".\" + stateId);\r\n };\r\n /**\r\n * Gets the cached authority based on the cached state. Returns empty if no cached state found.\r\n */\r\n BrowserCacheManager.prototype.getCachedAuthority = function (cachedState) {\r\n var stateCacheKey = this.generateStateKey(cachedState);\r\n var state = this.getTemporaryCache(stateCacheKey);\r\n if (!state) {\r\n return null;\r\n }\r\n var authorityCacheKey = this.generateAuthorityKey(state);\r\n return this.getTemporaryCache(authorityCacheKey);\r\n };\r\n /**\r\n * Updates account, authority, and state in cache\r\n * @param serverAuthenticationRequest\r\n * @param account\r\n */\r\n BrowserCacheManager.prototype.updateCacheEntries = function (state, nonce, authorityInstance, loginHint, account) {\r\n this.logger.trace(\"BrowserCacheManager.updateCacheEntries called\");\r\n // Cache the request state\r\n var stateCacheKey = this.generateStateKey(state);\r\n this.setTemporaryCache(stateCacheKey, state, false);\r\n // Cache the nonce\r\n var nonceCacheKey = this.generateNonceKey(state);\r\n this.setTemporaryCache(nonceCacheKey, nonce, false);\r\n // Cache authorityKey\r\n var authorityCacheKey = this.generateAuthorityKey(state);\r\n this.setTemporaryCache(authorityCacheKey, authorityInstance, false);\r\n if (account) {\r\n var ccsCredential = {\r\n credential: account.homeAccountId,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID\r\n };\r\n this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);\r\n }\r\n else if (!StringUtils.isEmpty(loginHint)) {\r\n var ccsCredential = {\r\n credential: loginHint,\r\n type: CcsCredentialType.UPN\r\n };\r\n this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);\r\n }\r\n };\r\n /**\r\n * Reset all temporary cache items\r\n * @param state\r\n */\r\n BrowserCacheManager.prototype.resetRequestCache = function (state) {\r\n var _this = this;\r\n this.logger.trace(\"BrowserCacheManager.resetRequestCache called\");\r\n // check state and remove associated cache items\r\n if (!StringUtils.isEmpty(state)) {\r\n this.getKeys().forEach(function (key) {\r\n if (key.indexOf(state) !== -1) {\r\n _this.removeItem(key);\r\n }\r\n });\r\n }\r\n // delete generic interactive request parameters\r\n if (state) {\r\n this.removeItem(this.generateStateKey(state));\r\n this.removeItem(this.generateNonceKey(state));\r\n this.removeItem(this.generateAuthorityKey(state));\r\n }\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.ORIGIN_URI));\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH));\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CORRELATION_ID));\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CCS_CREDENTIAL));\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));\r\n this.setInteractionInProgress(false);\r\n };\r\n /**\r\n * Removes temporary cache for the provided state\r\n * @param stateString\r\n */\r\n BrowserCacheManager.prototype.cleanRequestByState = function (stateString) {\r\n this.logger.trace(\"BrowserCacheManager.cleanRequestByState called\");\r\n // Interaction is completed - remove interaction status.\r\n if (stateString) {\r\n var stateKey = this.generateStateKey(stateString);\r\n var cachedState = this.temporaryCacheStorage.getItem(stateKey);\r\n this.logger.infoPii(\"BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: \" + cachedState);\r\n this.resetRequestCache(cachedState || Constants.EMPTY_STRING);\r\n }\r\n this.clearMsalCookies();\r\n };\r\n /**\r\n * Looks in temporary cache for any state values with the provided interactionType and removes all temporary cache items for that state\r\n * Used in scenarios where temp cache needs to be cleaned but state is not known, such as clicking browser back button.\r\n * @param interactionType\r\n */\r\n BrowserCacheManager.prototype.cleanRequestByInteractionType = function (interactionType) {\r\n var _this = this;\r\n this.logger.trace(\"BrowserCacheManager.cleanRequestByInteractionType called\");\r\n // Loop through all keys to find state key\r\n this.getKeys().forEach(function (key) {\r\n // If this key is not the state key, move on\r\n if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {\r\n return;\r\n }\r\n // Retrieve state value, return if not a valid value\r\n var stateValue = _this.temporaryCacheStorage.getItem(key);\r\n if (!stateValue) {\r\n return;\r\n }\r\n // Extract state and ensure it matches given InteractionType, then clean request cache\r\n var parsedState = BrowserProtocolUtils.extractBrowserRequestState(_this.cryptoImpl, stateValue);\r\n if (parsedState && parsedState.interactionType === interactionType) {\r\n _this.logger.infoPii(\"BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: \" + stateValue);\r\n _this.resetRequestCache(stateValue);\r\n }\r\n });\r\n this.clearMsalCookies();\r\n this.setInteractionInProgress(false);\r\n };\r\n BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {\r\n this.logger.trace(\"BrowserCacheManager.cacheCodeRequest called\");\r\n var encodedValue = browserCrypto.base64Encode(JSON.stringify(authCodeRequest));\r\n this.setTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);\r\n };\r\n /**\r\n * Gets the token exchange parameters from the cache. Throws an error if nothing is found.\r\n */\r\n BrowserCacheManager.prototype.getCachedRequest = function (state, browserCrypto) {\r\n this.logger.trace(\"BrowserCacheManager.getCachedRequest called\");\r\n // Get token request from cache and parse as TokenExchangeParameters.\r\n var encodedTokenRequest = this.getTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, true);\r\n if (!encodedTokenRequest) {\r\n throw BrowserAuthError.createNoTokenRequestCacheError();\r\n }\r\n var parsedRequest = this.validateAndParseJson(browserCrypto.base64Decode(encodedTokenRequest));\r\n if (!parsedRequest) {\r\n throw BrowserAuthError.createUnableToParseTokenRequestCacheError();\r\n }\r\n this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));\r\n // Get cached authority and use if no authority is cached with request.\r\n if (StringUtils.isEmpty(parsedRequest.authority)) {\r\n var authorityCacheKey = this.generateAuthorityKey(state);\r\n var cachedAuthority = this.getTemporaryCache(authorityCacheKey);\r\n if (!cachedAuthority) {\r\n throw BrowserAuthError.createNoCachedAuthorityError();\r\n }\r\n parsedRequest.authority = cachedAuthority;\r\n }\r\n return parsedRequest;\r\n };\r\n /**\r\n * Gets cached native request for redirect flows\r\n */\r\n BrowserCacheManager.prototype.getCachedNativeRequest = function () {\r\n this.logger.trace(\"BrowserCacheManager.getCachedNativeRequest called\");\r\n var cachedRequest = this.getTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, true);\r\n if (!cachedRequest) {\r\n this.logger.trace(\"BrowserCacheManager.getCachedNativeRequest: No cached native request found\");\r\n return null;\r\n }\r\n var parsedRequest = this.validateAndParseJson(cachedRequest);\r\n if (!parsedRequest) {\r\n this.logger.error(\"BrowserCacheManager.getCachedNativeRequest: Unable to parse native request\");\r\n return null;\r\n }\r\n return parsedRequest;\r\n };\r\n BrowserCacheManager.prototype.isInteractionInProgress = function (matchClientId) {\r\n var clientId = this.getInteractionInProgress();\r\n if (matchClientId) {\r\n return clientId === this.clientId;\r\n }\r\n else {\r\n return !!clientId;\r\n }\r\n };\r\n BrowserCacheManager.prototype.getInteractionInProgress = function () {\r\n var key = Constants.CACHE_PREFIX + \".\" + TemporaryCacheKeys.INTERACTION_STATUS_KEY;\r\n return this.getTemporaryCache(key, false);\r\n };\r\n BrowserCacheManager.prototype.setInteractionInProgress = function (inProgress) {\r\n // Ensure we don't overwrite interaction in progress for a different clientId\r\n var key = Constants.CACHE_PREFIX + \".\" + TemporaryCacheKeys.INTERACTION_STATUS_KEY;\r\n if (inProgress) {\r\n if (this.getInteractionInProgress()) {\r\n throw BrowserAuthError.createInteractionInProgressError();\r\n }\r\n else {\r\n // No interaction is in progress\r\n this.setTemporaryCache(key, this.clientId, false);\r\n }\r\n }\r\n else if (!inProgress && this.getInteractionInProgress() === this.clientId) {\r\n this.removeItem(key);\r\n }\r\n };\r\n /**\r\n * Returns username retrieved from ADAL or MSAL v1 idToken\r\n */\r\n BrowserCacheManager.prototype.getLegacyLoginHint = function () {\r\n // Only check for adal/msal token if no SSO params are being used\r\n var adalIdTokenString = this.getTemporaryCache(PersistentCacheKeys.ADAL_ID_TOKEN);\r\n if (adalIdTokenString) {\r\n this.browserStorage.removeItem(PersistentCacheKeys.ADAL_ID_TOKEN);\r\n this.logger.verbose(\"Cached ADAL id token retrieved.\");\r\n }\r\n // Check for cached MSAL v1 id token\r\n var msalIdTokenString = this.getTemporaryCache(PersistentCacheKeys.ID_TOKEN, true);\r\n if (msalIdTokenString) {\r\n this.removeItem(this.generateCacheKey(PersistentCacheKeys.ID_TOKEN));\r\n this.logger.verbose(\"Cached MSAL.js v1 id token retrieved\");\r\n }\r\n var cachedIdTokenString = msalIdTokenString || adalIdTokenString;\r\n if (cachedIdTokenString) {\r\n var cachedIdToken = new IdToken(cachedIdTokenString, this.cryptoImpl);\r\n if (cachedIdToken.claims && cachedIdToken.claims.preferred_username) {\r\n this.logger.verbose(\"No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint\");\r\n return cachedIdToken.claims.preferred_username;\r\n }\r\n else if (cachedIdToken.claims && cachedIdToken.claims.upn) {\r\n this.logger.verbose(\"No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint\");\r\n return cachedIdToken.claims.upn;\r\n }\r\n else {\r\n 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.\");\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Updates a credential's cache key if the current cache key is outdated\r\n */\r\n BrowserCacheManager.prototype.updateCredentialCacheKey = function (currentCacheKey, credential) {\r\n var updatedCacheKey = credential.generateCredentialKey();\r\n if (currentCacheKey !== updatedCacheKey) {\r\n var cacheItem = this.getItem(currentCacheKey);\r\n if (cacheItem) {\r\n this.removeItem(currentCacheKey);\r\n this.setItem(updatedCacheKey, cacheItem);\r\n this.logger.verbose(\"Updated an outdated \" + credential.credentialType + \" cache key\");\r\n return updatedCacheKey;\r\n }\r\n else {\r\n this.logger.error(\"Attempted to update an outdated \" + credential.credentialType + \" cache key but no item matching the outdated key was found in storage\");\r\n }\r\n }\r\n return currentCacheKey;\r\n };\r\n /**\r\n * Returns application id as redirect context during AcquireTokenRedirect flow.\r\n */\r\n BrowserCacheManager.prototype.getRedirectRequestContext = function () {\r\n return this.getTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, true);\r\n };\r\n /**\r\n * Sets application id as the redirect context during AcquireTokenRedirect flow.\r\n * @param value\r\n */\r\n BrowserCacheManager.prototype.setRedirectRequestContext = function (value) {\r\n this.setTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, value, true);\r\n };\r\n return BrowserCacheManager;\r\n}(CacheManager));\r\nvar DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {\r\n var cacheOptions = {\r\n cacheLocation: BrowserCacheLocation.MemoryStorage,\r\n temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,\r\n storeAuthStateInCookie: false,\r\n secureCookies: false,\r\n cacheMigrationEnabled: false\r\n };\r\n return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger);\r\n};\n\nexport { BrowserCacheManager, DEFAULT_BROWSER_CACHE_MANAGER };\n//# sourceMappingURL=BrowserCacheManager.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\n/* eslint-disable header/header */\r\nvar name = \"@azure/msal-browser\";\r\nvar version = \"2.37.1\";\n\nexport { name, version };\n//# sourceMappingURL=packageMetadata.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { Constants } from '@azure/msal-common';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { HTTP_REQUEST_TYPE } from '../utils/BrowserConstants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class implements the Fetch API for GET and POST requests. See more here: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API\r\n */\r\nvar FetchClient = /** @class */ (function () {\r\n function FetchClient() {\r\n }\r\n /**\r\n * Fetch Client for REST endpoints - Get request\r\n * @param url\r\n * @param headers\r\n * @param body\r\n */\r\n FetchClient.prototype.sendGetRequestAsync = function (url, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var response, e_1, _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n _b.trys.push([0, 2, , 3]);\r\n return [4 /*yield*/, fetch(url, {\r\n method: HTTP_REQUEST_TYPE.GET,\r\n headers: this.getFetchHeaders(options)\r\n })];\r\n case 1:\r\n response = _b.sent();\r\n return [3 /*break*/, 3];\r\n case 2:\r\n e_1 = _b.sent();\r\n if (window.navigator.onLine) {\r\n throw BrowserAuthError.createGetRequestFailedError(e_1, url);\r\n }\r\n else {\r\n throw BrowserAuthError.createNoNetworkConnectivityError();\r\n }\r\n case 3:\r\n _b.trys.push([3, 5, , 6]);\r\n _a = {\r\n headers: this.getHeaderDict(response.headers)\r\n };\r\n return [4 /*yield*/, response.json()];\r\n case 4: return [2 /*return*/, (_a.body = (_b.sent()),\r\n _a.status = response.status,\r\n _a)];\r\n case 5:\r\n _b.sent();\r\n throw BrowserAuthError.createFailedToParseNetworkResponseError(url);\r\n case 6: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Fetch Client for REST endpoints - Post request\r\n * @param url\r\n * @param headers\r\n * @param body\r\n */\r\n FetchClient.prototype.sendPostRequestAsync = function (url, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var reqBody, response, e_3, _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n reqBody = (options && options.body) || Constants.EMPTY_STRING;\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, fetch(url, {\r\n method: HTTP_REQUEST_TYPE.POST,\r\n headers: this.getFetchHeaders(options),\r\n body: reqBody\r\n })];\r\n case 2:\r\n response = _b.sent();\r\n return [3 /*break*/, 4];\r\n case 3:\r\n e_3 = _b.sent();\r\n if (window.navigator.onLine) {\r\n throw BrowserAuthError.createPostRequestFailedError(e_3, url);\r\n }\r\n else {\r\n throw BrowserAuthError.createNoNetworkConnectivityError();\r\n }\r\n case 4:\r\n _b.trys.push([4, 6, , 7]);\r\n _a = {\r\n headers: this.getHeaderDict(response.headers)\r\n };\r\n return [4 /*yield*/, response.json()];\r\n case 5: return [2 /*return*/, (_a.body = (_b.sent()),\r\n _a.status = response.status,\r\n _a)];\r\n case 6:\r\n _b.sent();\r\n throw BrowserAuthError.createFailedToParseNetworkResponseError(url);\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Get Fetch API Headers object from string map\r\n * @param inputHeaders\r\n */\r\n FetchClient.prototype.getFetchHeaders = function (options) {\r\n var headers = new Headers();\r\n if (!(options && options.headers)) {\r\n return headers;\r\n }\r\n var optionsHeaders = options.headers;\r\n Object.keys(optionsHeaders).forEach(function (key) {\r\n headers.append(key, optionsHeaders[key]);\r\n });\r\n return headers;\r\n };\r\n FetchClient.prototype.getHeaderDict = function (headers) {\r\n var headerDict = {};\r\n headers.forEach(function (value, key) {\r\n headerDict[key] = value;\r\n });\r\n return headerDict;\r\n };\r\n return FetchClient;\r\n}());\n\nexport { FetchClient };\n//# sourceMappingURL=FetchClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { HTTP_REQUEST_TYPE } from '../utils/BrowserConstants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This client implements the XMLHttpRequest class to send GET and POST requests.\r\n */\r\nvar XhrClient = /** @class */ (function () {\r\n function XhrClient() {\r\n }\r\n /**\r\n * XhrClient for REST endpoints - Get request\r\n * @param url\r\n * @param headers\r\n * @param body\r\n */\r\n XhrClient.prototype.sendGetRequestAsync = function (url, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.sendRequestAsync(url, HTTP_REQUEST_TYPE.GET, options)];\r\n });\r\n });\r\n };\r\n /**\r\n * XhrClient for REST endpoints - Post request\r\n * @param url\r\n * @param headers\r\n * @param body\r\n */\r\n XhrClient.prototype.sendPostRequestAsync = function (url, options) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.sendRequestAsync(url, HTTP_REQUEST_TYPE.POST, options)];\r\n });\r\n });\r\n };\r\n /**\r\n * Helper for XhrClient requests.\r\n * @param url\r\n * @param method\r\n * @param options\r\n */\r\n XhrClient.prototype.sendRequestAsync = function (url, method, options) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n var xhr = new XMLHttpRequest();\r\n xhr.open(method, url, /* async: */ true);\r\n _this.setXhrHeaders(xhr, options);\r\n xhr.onload = function () {\r\n if (xhr.status < 200 || xhr.status >= 300) {\r\n if (method === HTTP_REQUEST_TYPE.POST) {\r\n reject(BrowserAuthError.createPostRequestFailedError(\"Failed with status \" + xhr.status, url));\r\n }\r\n else {\r\n reject(BrowserAuthError.createGetRequestFailedError(\"Failed with status \" + xhr.status, url));\r\n }\r\n }\r\n try {\r\n var jsonResponse = JSON.parse(xhr.responseText);\r\n var networkResponse = {\r\n headers: _this.getHeaderDict(xhr),\r\n body: jsonResponse,\r\n status: xhr.status\r\n };\r\n resolve(networkResponse);\r\n }\r\n catch (e) {\r\n reject(BrowserAuthError.createFailedToParseNetworkResponseError(url));\r\n }\r\n };\r\n xhr.onerror = function () {\r\n if (window.navigator.onLine) {\r\n if (method === HTTP_REQUEST_TYPE.POST) {\r\n reject(BrowserAuthError.createPostRequestFailedError(\"Failed with status \" + xhr.status, url));\r\n }\r\n else {\r\n reject(BrowserAuthError.createGetRequestFailedError(\"Failed with status \" + xhr.status, url));\r\n }\r\n }\r\n else {\r\n reject(BrowserAuthError.createNoNetworkConnectivityError());\r\n }\r\n };\r\n if (method === HTTP_REQUEST_TYPE.POST && options && options.body) {\r\n xhr.send(options.body);\r\n }\r\n else if (method === HTTP_REQUEST_TYPE.GET) {\r\n xhr.send();\r\n }\r\n else {\r\n throw BrowserAuthError.createHttpMethodNotImplementedError(method);\r\n }\r\n });\r\n };\r\n /**\r\n * Helper to set XHR headers for request.\r\n * @param xhr\r\n * @param options\r\n */\r\n XhrClient.prototype.setXhrHeaders = function (xhr, options) {\r\n if (options && options.headers) {\r\n var headers_1 = options.headers;\r\n Object.keys(headers_1).forEach(function (key) {\r\n xhr.setRequestHeader(key, headers_1[key]);\r\n });\r\n }\r\n };\r\n /**\r\n * Gets a string map of the headers received in the response.\r\n *\r\n * Algorithm comes from https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders\r\n * @param xhr\r\n */\r\n XhrClient.prototype.getHeaderDict = function (xhr) {\r\n var headerString = xhr.getAllResponseHeaders();\r\n var headerArr = headerString.trim().split(/[\\r\\n]+/);\r\n var headerDict = {};\r\n headerArr.forEach(function (value) {\r\n var parts = value.split(\": \");\r\n var headerName = parts.shift();\r\n var headerVal = parts.join(\": \");\r\n if (headerName && headerVal) {\r\n headerDict[headerName] = headerVal;\r\n }\r\n });\r\n return headerDict;\r\n };\r\n return XhrClient;\r\n}());\n\nexport { XhrClient };\n//# sourceMappingURL=XhrClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { Constants, UrlString } from '@azure/msal-common';\nimport { FetchClient } from '../network/FetchClient.js';\nimport { XhrClient } from '../network/XhrClient.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { BrowserConstants, InteractionType } from './BrowserConstants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Utility class for browser specific functions\r\n */\r\nvar BrowserUtils = /** @class */ (function () {\r\n function BrowserUtils() {\r\n }\r\n // #region Window Navigation and URL management\r\n /**\r\n * Clears hash from window url.\r\n */\r\n BrowserUtils.clearHash = function (contentWindow) {\r\n // Office.js sets history.replaceState to null\r\n contentWindow.location.hash = Constants.EMPTY_STRING;\r\n if (typeof contentWindow.history.replaceState === \"function\") {\r\n // Full removes \"#\" from url\r\n contentWindow.history.replaceState(null, Constants.EMPTY_STRING, \"\" + contentWindow.location.origin + contentWindow.location.pathname + contentWindow.location.search);\r\n }\r\n };\r\n /**\r\n * Replaces current hash with hash from provided url\r\n */\r\n BrowserUtils.replaceHash = function (url) {\r\n var urlParts = url.split(\"#\");\r\n urlParts.shift(); // Remove part before the hash\r\n window.location.hash = urlParts.length > 0 ? urlParts.join(\"#\") : Constants.EMPTY_STRING;\r\n };\r\n /**\r\n * Returns boolean of whether the current window is in an iframe or not.\r\n */\r\n BrowserUtils.isInIframe = function () {\r\n return window.parent !== window;\r\n };\r\n /**\r\n * Returns boolean of whether or not the current window is a popup opened by msal\r\n */\r\n BrowserUtils.isInPopup = function () {\r\n return typeof window !== \"undefined\" && !!window.opener &&\r\n window.opener !== window &&\r\n typeof window.name === \"string\" &&\r\n window.name.indexOf(BrowserConstants.POPUP_NAME_PREFIX + \".\") === 0;\r\n };\r\n // #endregion\r\n /**\r\n * Returns current window URL as redirect uri\r\n */\r\n BrowserUtils.getCurrentUri = function () {\r\n return window.location.href.split(\"?\")[0].split(\"#\")[0];\r\n };\r\n /**\r\n * Gets the homepage url for the current window location.\r\n */\r\n BrowserUtils.getHomepage = function () {\r\n var currentUrl = new UrlString(window.location.href);\r\n var urlComponents = currentUrl.getUrlComponents();\r\n return urlComponents.Protocol + \"//\" + urlComponents.HostNameAndPort + \"/\";\r\n };\r\n /**\r\n * Returns best compatible network client object.\r\n */\r\n BrowserUtils.getBrowserNetworkClient = function () {\r\n if (window.fetch && window.Headers) {\r\n return new FetchClient();\r\n }\r\n else {\r\n return new XhrClient();\r\n }\r\n };\r\n /**\r\n * Throws error if we have completed an auth and are\r\n * attempting another auth request inside an iframe.\r\n */\r\n BrowserUtils.blockReloadInHiddenIframes = function () {\r\n var isResponseHash = UrlString.hashContainsKnownProperties(window.location.hash);\r\n // return an error if called from the hidden iframe created by the msal js silent calls\r\n if (isResponseHash && BrowserUtils.isInIframe()) {\r\n throw BrowserAuthError.createBlockReloadInHiddenIframeError();\r\n }\r\n };\r\n /**\r\n * Block redirect operations in iframes unless explicitly allowed\r\n * @param interactionType Interaction type for the request\r\n * @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe\r\n */\r\n BrowserUtils.blockRedirectInIframe = function (interactionType, allowRedirectInIframe) {\r\n var isIframedApp = BrowserUtils.isInIframe();\r\n if (interactionType === InteractionType.Redirect && isIframedApp && !allowRedirectInIframe) {\r\n // If we are not in top frame, we shouldn't redirect. This is also handled by the service.\r\n throw BrowserAuthError.createRedirectInIframeError(isIframedApp);\r\n }\r\n };\r\n /**\r\n * Block redirectUri loaded in popup from calling AcquireToken APIs\r\n */\r\n BrowserUtils.blockAcquireTokenInPopups = function () {\r\n // Popups opened by msal popup APIs are given a name that starts with \"msal.\"\r\n if (BrowserUtils.isInPopup()) {\r\n throw BrowserAuthError.createBlockAcquireTokenInPopupsError();\r\n }\r\n };\r\n /**\r\n * Throws error if token requests are made in non-browser environment\r\n * @param isBrowserEnvironment Flag indicating if environment is a browser.\r\n */\r\n BrowserUtils.blockNonBrowserEnvironment = function (isBrowserEnvironment) {\r\n if (!isBrowserEnvironment) {\r\n throw BrowserAuthError.createNonBrowserEnvironmentError();\r\n }\r\n };\r\n /**\r\n * Throws error if native brokering is enabled but initialize hasn't been called\r\n * @param allowNativeBroker\r\n * @param initialized\r\n */\r\n BrowserUtils.blockNativeBrokerCalledBeforeInitialized = function (allowNativeBroker, initialized) {\r\n if (allowNativeBroker && !initialized) {\r\n throw BrowserAuthError.createNativeBrokerCalledBeforeInitialize();\r\n }\r\n };\r\n /**\r\n * Returns boolean of whether current browser is an Internet Explorer or Edge browser.\r\n */\r\n BrowserUtils.detectIEOrEdge = function () {\r\n var ua = window.navigator.userAgent;\r\n var msie = ua.indexOf(\"MSIE \");\r\n var msie11 = ua.indexOf(\"Trident/\");\r\n var msedge = ua.indexOf(\"Edge/\");\r\n var isIE = msie > 0 || msie11 > 0;\r\n var isEdge = msedge > 0;\r\n return isIE || isEdge;\r\n };\r\n return BrowserUtils;\r\n}());\n\nexport { BrowserUtils };\n//# sourceMappingURL=BrowserUtils.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator, __spread, __assign } from '../_virtual/_tslib.js';\nimport { AccountEntity, AuthenticationScheme, ClientConfigurationError, StringUtils, PerformanceEvents, UrlString, ServerTelemetryManager, AuthorityFactory } from '@azure/msal-common';\nimport { version } from '../packageMetadata.js';\nimport { BrowserConstants } from '../utils/BrowserConstants.js';\nimport { BrowserUtils } from '../utils/BrowserUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar BaseInteractionClient = /** @class */ (function () {\r\n function BaseInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) {\r\n this.config = config;\r\n this.browserStorage = storageImpl;\r\n this.browserCrypto = browserCrypto;\r\n this.networkClient = this.config.system.networkClient;\r\n this.eventHandler = eventHandler;\r\n this.navigationClient = navigationClient;\r\n this.nativeMessageHandler = nativeMessageHandler;\r\n this.correlationId = correlationId || this.browserCrypto.createNewGuid();\r\n this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);\r\n this.performanceClient = performanceClient;\r\n }\r\n BaseInteractionClient.prototype.clearCacheOnLogout = function (account) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!account) return [3 /*break*/, 5];\r\n if (AccountEntity.accountInfoIsEqual(account, this.browserStorage.getActiveAccount(), false)) {\r\n this.logger.verbose(\"Setting active account to null\");\r\n this.browserStorage.setActiveAccount(null);\r\n }\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.browserStorage.removeAccount(AccountEntity.generateAccountCacheKey(account))];\r\n case 2:\r\n _a.sent();\r\n this.logger.verbose(\"Cleared cache items belonging to the account provided in the logout request.\");\r\n return [3 /*break*/, 4];\r\n case 3:\r\n _a.sent();\r\n this.logger.error(\"Account provided in logout request was not found. Local cache unchanged.\");\r\n return [3 /*break*/, 4];\r\n case 4: return [3 /*break*/, 9];\r\n case 5:\r\n _a.trys.push([5, 8, , 9]);\r\n this.logger.verbose(\"No account provided in logout request, clearing all cache items.\", this.correlationId);\r\n // Clear all accounts and tokens\r\n return [4 /*yield*/, this.browserStorage.clear()];\r\n case 6:\r\n // Clear all accounts and tokens\r\n _a.sent();\r\n // Clear any stray keys from IndexedDB\r\n return [4 /*yield*/, this.browserCrypto.clearKeystore()];\r\n case 7:\r\n // Clear any stray keys from IndexedDB\r\n _a.sent();\r\n return [3 /*break*/, 9];\r\n case 8:\r\n _a.sent();\r\n this.logger.error(\"Attempted to clear all MSAL cache items and failed. Local cache unchanged.\");\r\n return [3 /*break*/, 9];\r\n case 9: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Initializer function for all request APIs\r\n * @param request\r\n */\r\n BaseInteractionClient.prototype.initializeBaseRequest = function (request, account) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var authority, scopes, validatedRequest, _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);\r\n this.logger.verbose(\"Initializing BaseAuthRequest\");\r\n authority = request.authority || this.config.auth.authority;\r\n if (!account) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.validateRequestAuthority(authority, account)];\r\n case 1:\r\n _b.sent();\r\n _b.label = 2;\r\n case 2:\r\n scopes = __spread(((request && request.scopes) || []));\r\n validatedRequest = __assign(__assign({}, request), { correlationId: this.correlationId, authority: authority,\r\n scopes: scopes });\r\n // Set authenticationScheme to BEARER if not explicitly set in the request\r\n if (!validatedRequest.authenticationScheme) {\r\n validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;\r\n this.logger.verbose(\"Authentication Scheme wasn't explicitly set in request, defaulting to \\\"Bearer\\\" request\");\r\n }\r\n else {\r\n if (validatedRequest.authenticationScheme === AuthenticationScheme.SSH) {\r\n if (!request.sshJwk) {\r\n throw ClientConfigurationError.createMissingSshJwkError();\r\n }\r\n if (!request.sshKid) {\r\n throw ClientConfigurationError.createMissingSshKidError();\r\n }\r\n }\r\n this.logger.verbose(\"Authentication Scheme set to \\\"\" + validatedRequest.authenticationScheme + \"\\\" as configured in Auth request\");\r\n }\r\n if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 4];\r\n _a = validatedRequest;\r\n return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];\r\n case 3:\r\n _a.requestedClaimsHash = _b.sent();\r\n _b.label = 4;\r\n case 4: return [2 /*return*/, validatedRequest];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n *\r\n * Use to get the redirect uri configured in MSAL or null.\r\n * @param requestRedirectUri\r\n * @returns Redirect URL\r\n *\r\n */\r\n BaseInteractionClient.prototype.getRedirectUri = function (requestRedirectUri) {\r\n this.logger.verbose(\"getRedirectUri called\");\r\n var redirectUri = requestRedirectUri || this.config.auth.redirectUri || BrowserUtils.getCurrentUri();\r\n return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());\r\n };\r\n /*\r\n * If authority provided in the request does not match environment/authority specified\r\n * in the account or MSAL config, we throw an error.\r\n */\r\n BaseInteractionClient.prototype.validateRequestAuthority = function (authority, account) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var discoveredAuthority;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.getDiscoveredAuthority(authority)];\r\n case 1:\r\n discoveredAuthority = _a.sent();\r\n if (!discoveredAuthority.isAlias(account.environment)) {\r\n throw ClientConfigurationError.createAuthorityMismatchError();\r\n }\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n *\r\n * @param apiId\r\n * @param correlationId\r\n * @param forceRefresh\r\n */\r\n BaseInteractionClient.prototype.initializeServerTelemetryManager = function (apiId, forceRefresh) {\r\n this.logger.verbose(\"initializeServerTelemetryManager called\");\r\n var telemetryPayload = {\r\n clientId: this.config.auth.clientId,\r\n correlationId: this.correlationId,\r\n apiId: apiId,\r\n forceRefresh: forceRefresh || false,\r\n wrapperSKU: this.browserStorage.getWrapperMetadata()[0],\r\n wrapperVer: this.browserStorage.getWrapperMetadata()[1]\r\n };\r\n return new ServerTelemetryManager(telemetryPayload, this.browserStorage);\r\n };\r\n /**\r\n * Used to get a discovered version of the default authority.\r\n * @param requestAuthority\r\n * @param requestCorrelationId\r\n */\r\n BaseInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var authorityOptions;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.verbose(\"getDiscoveredAuthority called\");\r\n authorityOptions = {\r\n protocolMode: this.config.auth.protocolMode,\r\n knownAuthorities: this.config.auth.knownAuthorities,\r\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\r\n authorityMetadata: this.config.auth.authorityMetadata\r\n };\r\n if (!requestAuthority) return [3 /*break*/, 2];\r\n this.logger.verbose(\"Creating discovered authority with request authority\");\r\n return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(requestAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n case 2:\r\n this.logger.verbose(\"Creating discovered authority with configured authority\");\r\n return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(this.config.auth.authority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger)];\r\n case 3: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n return BaseInteractionClient;\r\n}());\n\nexport { BaseInteractionClient };\n//# sourceMappingURL=BaseInteractionClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { UrlString, Constants, PerformanceEvents, AuthorizationCodeClient, Authority, AuthorityFactory, ResponseMode, StringUtils, ProtocolUtils } from '@azure/msal-common';\nimport { BaseInteractionClient } from './BaseInteractionClient.js';\nimport { BrowserConstants } from '../utils/BrowserConstants.js';\nimport { version } from '../packageMetadata.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { BrowserProtocolUtils } from '../utils/BrowserProtocolUtils.js';\nimport { BrowserUtils } from '../utils/BrowserUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Defines the class structure and helper functions used by the \"standard\", non-brokered auth flows (popup, redirect, silent (RT), silent (iframe))\r\n */\r\nvar StandardInteractionClient = /** @class */ (function (_super) {\r\n __extends(StandardInteractionClient, _super);\r\n function StandardInteractionClient() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Generates an auth code request tied to the url request.\r\n * @param request\r\n */\r\n StandardInteractionClient.prototype.initializeAuthorizationCodeRequest = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var generatedPkceParams, authCodeRequest;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);\r\n this.logger.verbose(\"initializeAuthorizationRequest called\", request.correlationId);\r\n return [4 /*yield*/, this.browserCrypto.generatePkceCodes()];\r\n case 1:\r\n generatedPkceParams = _a.sent();\r\n authCodeRequest = __assign(__assign({}, request), { redirectUri: request.redirectUri, code: Constants.EMPTY_STRING, codeVerifier: generatedPkceParams.verifier });\r\n request.codeChallenge = generatedPkceParams.challenge;\r\n request.codeChallengeMethod = Constants.S256_CODE_CHALLENGE_METHOD;\r\n return [2 /*return*/, authCodeRequest];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Initializer for the logout request.\r\n * @param logoutRequest\r\n */\r\n StandardInteractionClient.prototype.initializeLogoutRequest = function (logoutRequest) {\r\n this.logger.verbose(\"initializeLogoutRequest called\", logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.correlationId);\r\n var validLogoutRequest = __assign({ correlationId: this.correlationId || this.browserCrypto.createNewGuid() }, logoutRequest);\r\n /**\r\n * Set logout_hint to be login_hint from ID Token Claims if present\r\n * and logoutHint attribute wasn't manually set in logout request\r\n */\r\n if (logoutRequest) {\r\n // If logoutHint isn't set and an account was passed in, try to extract logoutHint from ID Token Claims\r\n if (!logoutRequest.logoutHint) {\r\n if (logoutRequest.account) {\r\n var logoutHint = this.getLogoutHintFromIdTokenClaims(logoutRequest.account);\r\n if (logoutHint) {\r\n this.logger.verbose(\"Setting logoutHint to login_hint ID Token Claim value for the account provided\");\r\n validLogoutRequest.logoutHint = logoutHint;\r\n }\r\n }\r\n else {\r\n this.logger.verbose(\"logoutHint was not set and account was not passed into logout request, logoutHint will not be set\");\r\n }\r\n }\r\n else {\r\n this.logger.verbose(\"logoutHint has already been set in logoutRequest\");\r\n }\r\n }\r\n else {\r\n this.logger.verbose(\"logoutHint will not be set since no logout request was configured\");\r\n }\r\n /*\r\n * Only set redirect uri if logout request isn't provided or the set uri isn't null.\r\n * Otherwise, use passed uri, config, or current page.\r\n */\r\n if (!logoutRequest || logoutRequest.postLogoutRedirectUri !== null) {\r\n if (logoutRequest && logoutRequest.postLogoutRedirectUri) {\r\n this.logger.verbose(\"Setting postLogoutRedirectUri to uri set on logout request\", validLogoutRequest.correlationId);\r\n validLogoutRequest.postLogoutRedirectUri = UrlString.getAbsoluteUrl(logoutRequest.postLogoutRedirectUri, BrowserUtils.getCurrentUri());\r\n }\r\n else if (this.config.auth.postLogoutRedirectUri === null) {\r\n this.logger.verbose(\"postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect\", validLogoutRequest.correlationId);\r\n }\r\n else if (this.config.auth.postLogoutRedirectUri) {\r\n this.logger.verbose(\"Setting postLogoutRedirectUri to configured uri\", validLogoutRequest.correlationId);\r\n validLogoutRequest.postLogoutRedirectUri = UrlString.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri, BrowserUtils.getCurrentUri());\r\n }\r\n else {\r\n this.logger.verbose(\"Setting postLogoutRedirectUri to current page\", validLogoutRequest.correlationId);\r\n validLogoutRequest.postLogoutRedirectUri = UrlString.getAbsoluteUrl(BrowserUtils.getCurrentUri(), BrowserUtils.getCurrentUri());\r\n }\r\n }\r\n else {\r\n this.logger.verbose(\"postLogoutRedirectUri passed as null, not setting post logout redirect uri\", validLogoutRequest.correlationId);\r\n }\r\n return validLogoutRequest;\r\n };\r\n /**\r\n * Parses login_hint ID Token Claim out of AccountInfo object to be used as\r\n * logout_hint in end session request.\r\n * @param account\r\n */\r\n StandardInteractionClient.prototype.getLogoutHintFromIdTokenClaims = function (account) {\r\n var idTokenClaims = account.idTokenClaims;\r\n if (idTokenClaims) {\r\n if (idTokenClaims.login_hint) {\r\n return idTokenClaims.login_hint;\r\n }\r\n else {\r\n 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\");\r\n }\r\n }\r\n else {\r\n this.logger.verbose(\"The provided account does not contain ID Token Claims, logoutHint will not be added to logout request\");\r\n }\r\n return null;\r\n };\r\n /**\r\n * Creates an Authorization Code Client with the given authority, or the default authority.\r\n * @param serverTelemetryManager\r\n * @param authorityUrl\r\n */\r\n StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var clientConfig;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.correlationId);\r\n // Create auth module.\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);\r\n return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions)];\r\n case 1:\r\n clientConfig = _a.sent();\r\n return [2 /*return*/, new AuthorizationCodeClient(clientConfig, this.performanceClient)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Creates a Client Configuration object with the given request authority, or the default authority.\r\n * @param serverTelemetryManager\r\n * @param requestAuthority\r\n * @param requestCorrelationId\r\n */\r\n StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var discoveredAuthority, logger;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);\r\n this.logger.verbose(\"getClientConfiguration called\", this.correlationId);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);\r\n return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];\r\n case 1:\r\n discoveredAuthority = _a.sent();\r\n logger = this.config.system.loggerOptions;\r\n return [2 /*return*/, {\r\n authOptions: {\r\n clientId: this.config.auth.clientId,\r\n authority: discoveredAuthority,\r\n clientCapabilities: this.config.auth.clientCapabilities\r\n },\r\n systemOptions: {\r\n tokenRenewalOffsetSeconds: this.config.system.tokenRenewalOffsetSeconds,\r\n preventCorsPreflight: true\r\n },\r\n loggerOptions: {\r\n loggerCallback: logger.loggerCallback,\r\n piiLoggingEnabled: logger.piiLoggingEnabled,\r\n logLevel: logger.logLevel,\r\n correlationId: this.correlationId\r\n },\r\n cryptoInterface: this.browserCrypto,\r\n networkInterface: this.networkClient,\r\n storageInterface: this.browserStorage,\r\n serverTelemetryManager: serverTelemetryManager,\r\n libraryInfo: {\r\n sku: BrowserConstants.MSAL_SKU,\r\n version: version,\r\n cpu: Constants.EMPTY_STRING,\r\n os: Constants.EMPTY_STRING\r\n },\r\n telemetry: this.config.telemetry\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * @param hash\r\n * @param interactionType\r\n */\r\n StandardInteractionClient.prototype.validateAndExtractStateFromHash = function (serverParams, interactionType, requestCorrelationId) {\r\n this.logger.verbose(\"validateAndExtractStateFromHash called\", requestCorrelationId);\r\n if (!serverParams.state) {\r\n throw BrowserAuthError.createHashDoesNotContainStateError();\r\n }\r\n var platformStateObj = BrowserProtocolUtils.extractBrowserRequestState(this.browserCrypto, serverParams.state);\r\n if (!platformStateObj) {\r\n throw BrowserAuthError.createUnableToParseStateError();\r\n }\r\n if (platformStateObj.interactionType !== interactionType) {\r\n throw BrowserAuthError.createStateInteractionTypeMismatchError();\r\n }\r\n this.logger.verbose(\"Returning state from hash\", requestCorrelationId);\r\n return serverParams.state;\r\n };\r\n /**\r\n * Used to get a discovered version of the default authority.\r\n * @param requestAuthority\r\n * @param requestCorrelationId\r\n */\r\n StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority, requestAzureCloudOptions) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var getAuthorityMeasurement, authorityOptions, userAuthority, builtAuthority;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);\r\n this.logger.verbose(\"getDiscoveredAuthority called\", this.correlationId);\r\n getAuthorityMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);\r\n authorityOptions = {\r\n protocolMode: this.config.auth.protocolMode,\r\n knownAuthorities: this.config.auth.knownAuthorities,\r\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\r\n authorityMetadata: this.config.auth.authorityMetadata,\r\n skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache\r\n };\r\n userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;\r\n builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);\r\n this.logger.verbose(\"Creating discovered authority with configured authority\", this.correlationId);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.correlationId);\r\n return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.performanceClient, this.correlationId)\r\n .then(function (result) {\r\n getAuthorityMeasurement.endMeasurement({\r\n success: true,\r\n });\r\n return result;\r\n })\r\n .catch(function (error) {\r\n getAuthorityMeasurement.endMeasurement({\r\n errorCode: error.errorCode,\r\n subErrorCode: error.subError,\r\n success: false\r\n });\r\n throw error;\r\n })];\r\n case 1: return [2 /*return*/, _b.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Helper to initialize required request parameters for interactive APIs and ssoSilent()\r\n * @param request\r\n * @param interactionType\r\n */\r\n StandardInteractionClient.prototype.initializeAuthorizationRequest = function (request, interactionType) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var redirectUri, browserState, state, validatedRequest, _a, account, legacyLoginHint;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.correlationId);\r\n this.logger.verbose(\"initializeAuthorizationRequest called\", this.correlationId);\r\n redirectUri = this.getRedirectUri(request.redirectUri);\r\n browserState = {\r\n interactionType: interactionType\r\n };\r\n state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, this.correlationId);\r\n _a = [{}];\r\n return [4 /*yield*/, this.initializeBaseRequest(request)];\r\n case 1:\r\n validatedRequest = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([_b.sent()])), { redirectUri: redirectUri, state: state, nonce: request.nonce || this.browserCrypto.createNewGuid(), responseMode: ResponseMode.FRAGMENT }]);\r\n account = request.account || this.browserStorage.getActiveAccount();\r\n if (account) {\r\n this.logger.verbose(\"Setting validated request account\", this.correlationId);\r\n this.logger.verbosePii(\"Setting validated request account: \" + account.homeAccountId, this.correlationId);\r\n validatedRequest.account = account;\r\n }\r\n // Check for ADAL/MSAL v1 SSO\r\n if (StringUtils.isEmpty(validatedRequest.loginHint) && !account) {\r\n legacyLoginHint = this.browserStorage.getLegacyLoginHint();\r\n if (legacyLoginHint) {\r\n validatedRequest.loginHint = legacyLoginHint;\r\n }\r\n }\r\n return [2 /*return*/, validatedRequest];\r\n }\r\n });\r\n });\r\n };\r\n return StandardInteractionClient;\r\n}(BaseInteractionClient));\n\nexport { StandardInteractionClient };\n//# sourceMappingURL=StandardInteractionClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { PerformanceEvents, StringUtils, ClientAuthError, ServerError, AuthorityFactory } from '@azure/msal-common';\nimport { BrowserAuthError, BrowserAuthErrorMessage } from '../error/BrowserAuthError.js';\nimport { TemporaryCacheKeys } from '../utils/BrowserConstants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Abstract class which defines operations for a browser interaction handling class.\r\n */\r\nvar InteractionHandler = /** @class */ (function () {\r\n function InteractionHandler(authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) {\r\n this.authModule = authCodeModule;\r\n this.browserStorage = storageImpl;\r\n this.authCodeRequest = authCodeRequest;\r\n this.logger = logger;\r\n this.performanceClient = performanceClient;\r\n }\r\n /**\r\n * Function to handle response parameters from hash.\r\n * @param locationHash\r\n */\r\n InteractionHandler.prototype.handleCodeResponseFromHash = function (locationHash, state, authority, networkModule) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var stateKey, requestState, authCodeResponse;\r\n return __generator(this, function (_a) {\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponseFromHash, this.authCodeRequest.correlationId);\r\n this.logger.verbose(\"InteractionHandler.handleCodeResponse called\");\r\n // Check that location hash isn't empty.\r\n if (StringUtils.isEmpty(locationHash)) {\r\n throw BrowserAuthError.createEmptyHashError(locationHash);\r\n }\r\n stateKey = this.browserStorage.generateStateKey(state);\r\n requestState = this.browserStorage.getTemporaryCache(stateKey);\r\n if (!requestState) {\r\n throw ClientAuthError.createStateNotFoundError(\"Cached State\");\r\n }\r\n try {\r\n authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);\r\n }\r\n catch (e) {\r\n if (e instanceof ServerError && e.subError === BrowserAuthErrorMessage.userCancelledError.code) {\r\n // Translate server error caused by user closing native prompt to corresponding first class MSAL error\r\n throw BrowserAuthError.createUserCancelledError();\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);\r\n return [2 /*return*/, this.handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule)];\r\n });\r\n });\r\n };\r\n /**\r\n * Process auth code response from AAD\r\n * @param authCodeResponse\r\n * @param state\r\n * @param authority\r\n * @param networkModule\r\n * @returns\r\n */\r\n InteractionHandler.prototype.handleCodeResponseFromServer = function (authCodeResponse, state, authority, networkModule, validateNonce) {\r\n if (validateNonce === void 0) { validateNonce = true; }\r\n return __awaiter(this, void 0, void 0, function () {\r\n var stateKey, requestState, nonceKey, cachedNonce, cachedCcsCred, tokenResponse;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);\r\n this.logger.trace(\"InteractionHandler.handleCodeResponseFromServer called\");\r\n stateKey = this.browserStorage.generateStateKey(state);\r\n requestState = this.browserStorage.getTemporaryCache(stateKey);\r\n if (!requestState) {\r\n throw ClientAuthError.createStateNotFoundError(\"Cached State\");\r\n }\r\n nonceKey = this.browserStorage.generateNonceKey(requestState);\r\n cachedNonce = this.browserStorage.getTemporaryCache(nonceKey);\r\n // Assign code to request\r\n this.authCodeRequest.code = authCodeResponse.code;\r\n if (!authCodeResponse.cloud_instance_host_name) return [3 /*break*/, 2];\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);\r\n return [4 /*yield*/, this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule)];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n // Nonce validation not needed when redirect not involved (e.g. hybrid spa, renewing token via rt)\r\n if (validateNonce) {\r\n authCodeResponse.nonce = cachedNonce || undefined;\r\n }\r\n authCodeResponse.state = requestState;\r\n // Add CCS parameters if available\r\n if (authCodeResponse.client_info) {\r\n this.authCodeRequest.clientInfo = authCodeResponse.client_info;\r\n }\r\n else {\r\n cachedCcsCred = this.checkCcsCredentials();\r\n if (cachedCcsCred) {\r\n this.authCodeRequest.ccsCredential = cachedCcsCred;\r\n }\r\n }\r\n // Acquire token with retrieved code.\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.AuthClientAcquireToken, this.authCodeRequest.correlationId);\r\n return [4 /*yield*/, this.authModule.acquireToken(this.authCodeRequest, authCodeResponse)];\r\n case 3:\r\n tokenResponse = _a.sent();\r\n this.browserStorage.cleanRequestByState(state);\r\n return [2 /*return*/, tokenResponse];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Updates authority based on cloudInstanceHostname\r\n * @param cloudInstanceHostname\r\n * @param authority\r\n * @param networkModule\r\n */\r\n InteractionHandler.prototype.updateTokenEndpointAuthority = function (cloudInstanceHostname, authority, networkModule) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var cloudInstanceAuthorityUri, cloudInstanceAuthority;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);\r\n cloudInstanceAuthorityUri = \"https://\" + cloudInstanceHostname + \"/\" + authority.tenant + \"/\";\r\n return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(cloudInstanceAuthorityUri, networkModule, this.browserStorage, authority.options, this.logger, this.performanceClient, this.authCodeRequest.correlationId)];\r\n case 1:\r\n cloudInstanceAuthority = _a.sent();\r\n this.authModule.updateAuthority(cloudInstanceAuthority);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Looks up ccs creds in the cache\r\n */\r\n InteractionHandler.prototype.checkCcsCredentials = function () {\r\n // Look up ccs credential in temp cache\r\n var cachedCcsCred = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, true);\r\n if (cachedCcsCred) {\r\n try {\r\n return JSON.parse(cachedCcsCred);\r\n }\r\n catch (e) {\r\n this.authModule.logger.error(\"Cache credential could not be parsed\");\r\n this.authModule.logger.errorPii(\"Cache credential could not be parsed: \" + cachedCcsCred);\r\n }\r\n }\r\n return null;\r\n };\r\n return InteractionHandler;\r\n}());\n\nexport { InteractionHandler };\n//# sourceMappingURL=InteractionHandler.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { StringUtils, ClientAuthError, ServerError } from '@azure/msal-common';\nimport { BrowserAuthError, BrowserAuthErrorMessage } from '../error/BrowserAuthError.js';\nimport { TemporaryCacheKeys, ApiId } from '../utils/BrowserConstants.js';\nimport { InteractionHandler } from './InteractionHandler.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar RedirectHandler = /** @class */ (function (_super) {\r\n __extends(RedirectHandler, _super);\r\n function RedirectHandler(authCodeModule, storageImpl, authCodeRequest, logger, browserCrypto, performanceClient) {\r\n var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) || this;\r\n _this.browserCrypto = browserCrypto;\r\n return _this;\r\n }\r\n /**\r\n * Redirects window to given URL.\r\n * @param urlNavigate\r\n */\r\n RedirectHandler.prototype.initiateAuthRequest = function (requestUrl, params) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var navigationOptions, navigate;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.verbose(\"RedirectHandler.initiateAuthRequest called\");\r\n if (!!StringUtils.isEmpty(requestUrl)) return [3 /*break*/, 7];\r\n // Cache start page, returns to this page after redirectUri if navigateToLoginRequestUrl is true\r\n if (params.redirectStartPage) {\r\n this.logger.verbose(\"RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page\");\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);\r\n }\r\n // Set interaction status in the library.\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);\r\n this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);\r\n this.logger.infoPii(\"RedirectHandler.initiateAuthRequest: Navigate to: \" + requestUrl);\r\n navigationOptions = {\r\n apiId: ApiId.acquireTokenRedirect,\r\n timeout: params.redirectTimeout,\r\n noHistory: false\r\n };\r\n if (!(typeof params.onRedirectNavigate === \"function\")) return [3 /*break*/, 4];\r\n this.logger.verbose(\"RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback\");\r\n navigate = params.onRedirectNavigate(requestUrl);\r\n if (!(navigate !== false)) return [3 /*break*/, 2];\r\n this.logger.verbose(\"RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating\");\r\n return [4 /*yield*/, params.navigationClient.navigateExternal(requestUrl, navigationOptions)];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/];\r\n case 2:\r\n this.logger.verbose(\"RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation\");\r\n return [2 /*return*/];\r\n case 3: return [3 /*break*/, 6];\r\n case 4:\r\n // Navigate window to request URL\r\n this.logger.verbose(\"RedirectHandler.initiateAuthRequest: Navigating window to navigate url\");\r\n return [4 /*yield*/, params.navigationClient.navigateExternal(requestUrl, navigationOptions)];\r\n case 5:\r\n _a.sent();\r\n return [2 /*return*/];\r\n case 6: return [3 /*break*/, 8];\r\n case 7:\r\n // Throw error if request URL is empty.\r\n this.logger.info(\"RedirectHandler.initiateAuthRequest: Navigate url is empty\");\r\n throw BrowserAuthError.createEmptyNavigationUriError();\r\n case 8: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Handle authorization code response in the window.\r\n * @param hash\r\n */\r\n RedirectHandler.prototype.handleCodeResponseFromHash = function (locationHash, state, authority, networkModule) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var stateKey, requestState, authCodeResponse, nonceKey, cachedNonce, cachedCcsCred, tokenResponse;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.verbose(\"RedirectHandler.handleCodeResponse called\");\r\n // Check that location hash isn't empty.\r\n if (StringUtils.isEmpty(locationHash)) {\r\n throw BrowserAuthError.createEmptyHashError(locationHash);\r\n }\r\n // Interaction is completed - remove interaction status.\r\n this.browserStorage.setInteractionInProgress(false);\r\n stateKey = this.browserStorage.generateStateKey(state);\r\n requestState = this.browserStorage.getTemporaryCache(stateKey);\r\n if (!requestState) {\r\n throw ClientAuthError.createStateNotFoundError(\"Cached State\");\r\n }\r\n try {\r\n authCodeResponse = this.authModule.handleFragmentResponse(locationHash, requestState);\r\n }\r\n catch (e) {\r\n if (e instanceof ServerError && e.subError === BrowserAuthErrorMessage.userCancelledError.code) {\r\n // Translate server error caused by user closing native prompt to corresponding first class MSAL error\r\n throw BrowserAuthError.createUserCancelledError();\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n nonceKey = this.browserStorage.generateNonceKey(requestState);\r\n cachedNonce = this.browserStorage.getTemporaryCache(nonceKey);\r\n // Assign code to request\r\n this.authCodeRequest.code = authCodeResponse.code;\r\n if (!authCodeResponse.cloud_instance_host_name) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule)];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n authCodeResponse.nonce = cachedNonce || undefined;\r\n authCodeResponse.state = requestState;\r\n // Add CCS parameters if available\r\n if (authCodeResponse.client_info) {\r\n this.authCodeRequest.clientInfo = authCodeResponse.client_info;\r\n }\r\n else {\r\n cachedCcsCred = this.checkCcsCredentials();\r\n if (cachedCcsCred) {\r\n this.authCodeRequest.ccsCredential = cachedCcsCred;\r\n }\r\n }\r\n return [4 /*yield*/, this.authModule.acquireToken(this.authCodeRequest, authCodeResponse)];\r\n case 3:\r\n tokenResponse = _a.sent();\r\n this.browserStorage.cleanRequestByState(state);\r\n return [2 /*return*/, tokenResponse];\r\n }\r\n });\r\n });\r\n };\r\n return RedirectHandler;\r\n}(InteractionHandler));\n\nexport { RedirectHandler };\n//# sourceMappingURL=RedirectHandler.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar EventType;\r\n(function (EventType) {\r\n EventType[\"INITIALIZE_START\"] = \"msal:initializeStart\";\r\n EventType[\"INITIALIZE_END\"] = \"msal:initializeEnd\";\r\n EventType[\"ACCOUNT_ADDED\"] = \"msal:accountAdded\";\r\n EventType[\"ACCOUNT_REMOVED\"] = \"msal:accountRemoved\";\r\n EventType[\"LOGIN_START\"] = \"msal:loginStart\";\r\n EventType[\"LOGIN_SUCCESS\"] = \"msal:loginSuccess\";\r\n EventType[\"LOGIN_FAILURE\"] = \"msal:loginFailure\";\r\n EventType[\"ACQUIRE_TOKEN_START\"] = \"msal:acquireTokenStart\";\r\n EventType[\"ACQUIRE_TOKEN_SUCCESS\"] = \"msal:acquireTokenSuccess\";\r\n EventType[\"ACQUIRE_TOKEN_FAILURE\"] = \"msal:acquireTokenFailure\";\r\n EventType[\"ACQUIRE_TOKEN_NETWORK_START\"] = \"msal:acquireTokenFromNetworkStart\";\r\n EventType[\"SSO_SILENT_START\"] = \"msal:ssoSilentStart\";\r\n EventType[\"SSO_SILENT_SUCCESS\"] = \"msal:ssoSilentSuccess\";\r\n EventType[\"SSO_SILENT_FAILURE\"] = \"msal:ssoSilentFailure\";\r\n EventType[\"ACQUIRE_TOKEN_BY_CODE_START\"] = \"msal:acquireTokenByCodeStart\";\r\n EventType[\"ACQUIRE_TOKEN_BY_CODE_SUCCESS\"] = \"msal:acquireTokenByCodeSuccess\";\r\n EventType[\"ACQUIRE_TOKEN_BY_CODE_FAILURE\"] = \"msal:acquireTokenByCodeFailure\";\r\n EventType[\"HANDLE_REDIRECT_START\"] = \"msal:handleRedirectStart\";\r\n EventType[\"HANDLE_REDIRECT_END\"] = \"msal:handleRedirectEnd\";\r\n EventType[\"POPUP_OPENED\"] = \"msal:popupOpened\";\r\n EventType[\"LOGOUT_START\"] = \"msal:logoutStart\";\r\n EventType[\"LOGOUT_SUCCESS\"] = \"msal:logoutSuccess\";\r\n EventType[\"LOGOUT_FAILURE\"] = \"msal:logoutFailure\";\r\n EventType[\"LOGOUT_END\"] = \"msal:logoutEnd\";\r\n EventType[\"RESTORE_FROM_BFCACHE\"] = \"msal:restoreFromBFCache\";\r\n})(EventType || (EventType = {}));\n\nexport { EventType };\n//# sourceMappingURL=EventType.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { InteractionRequiredAuthError, AuthError } from '@azure/msal-common';\nimport { BrowserAuthError } from './BrowserAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar NativeStatusCode;\r\n(function (NativeStatusCode) {\r\n NativeStatusCode[\"USER_INTERACTION_REQUIRED\"] = \"USER_INTERACTION_REQUIRED\";\r\n NativeStatusCode[\"USER_CANCEL\"] = \"USER_CANCEL\";\r\n NativeStatusCode[\"NO_NETWORK\"] = \"NO_NETWORK\";\r\n NativeStatusCode[\"TRANSIENT_ERROR\"] = \"TRANSIENT_ERROR\";\r\n NativeStatusCode[\"PERSISTENT_ERROR\"] = \"PERSISTENT_ERROR\";\r\n NativeStatusCode[\"DISABLED\"] = \"DISABLED\";\r\n NativeStatusCode[\"ACCOUNT_UNAVAILABLE\"] = \"ACCOUNT_UNAVAILABLE\";\r\n})(NativeStatusCode || (NativeStatusCode = {}));\r\nvar NativeAuthErrorMessage = {\r\n extensionError: {\r\n code: \"ContentError\"\r\n },\r\n userSwitch: {\r\n code: \"user_switch\",\r\n 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.\"\r\n },\r\n tokensNotFoundInCache: {\r\n code: \"tokens_not_found_in_internal_memory_cache\",\r\n desc: \"Tokens not cached in MSAL JS internal memory, please make the WAM request\"\r\n }\r\n};\r\nvar NativeAuthError = /** @class */ (function (_super) {\r\n __extends(NativeAuthError, _super);\r\n function NativeAuthError(errorCode, description, ext) {\r\n var _this = _super.call(this, errorCode, description) || this;\r\n Object.setPrototypeOf(_this, NativeAuthError.prototype);\r\n _this.name = \"NativeAuthError\";\r\n _this.ext = ext;\r\n return _this;\r\n }\r\n /**\r\n * These errors should result in a fallback to the 'standard' browser based auth flow.\r\n */\r\n NativeAuthError.prototype.isFatal = function () {\r\n if (this.ext && this.ext.status && (this.ext.status === NativeStatusCode.PERSISTENT_ERROR || this.ext.status === NativeStatusCode.DISABLED)) {\r\n return true;\r\n }\r\n switch (this.errorCode) {\r\n case NativeAuthErrorMessage.extensionError.code:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n };\r\n /**\r\n * Create the appropriate error object based on the WAM status code.\r\n * @param code\r\n * @param description\r\n * @param ext\r\n * @returns\r\n */\r\n NativeAuthError.createError = function (code, description, ext) {\r\n if (ext && ext.status) {\r\n switch (ext.status) {\r\n case NativeStatusCode.ACCOUNT_UNAVAILABLE:\r\n return InteractionRequiredAuthError.createNativeAccountUnavailableError();\r\n case NativeStatusCode.USER_INTERACTION_REQUIRED:\r\n return new InteractionRequiredAuthError(code, description);\r\n case NativeStatusCode.USER_CANCEL:\r\n return BrowserAuthError.createUserCancelledError();\r\n case NativeStatusCode.NO_NETWORK:\r\n return BrowserAuthError.createNoNetworkConnectivityError();\r\n }\r\n }\r\n return new NativeAuthError(code, description, ext);\r\n };\r\n /**\r\n * Creates user switch error when the user chooses a different account in the native broker prompt\r\n * @returns\r\n */\r\n NativeAuthError.createUserSwitchError = function () {\r\n return new NativeAuthError(NativeAuthErrorMessage.userSwitch.code, NativeAuthErrorMessage.userSwitch.desc);\r\n };\r\n /**\r\n * Creates a tokens not found error when the internal cache look up fails\r\n * @returns NativeAuthError: tokensNotFoundInCache\r\n */\r\n NativeAuthError.createTokensNotFoundInCacheError = function () {\r\n return new NativeAuthError(NativeAuthErrorMessage.tokensNotFoundInCache.code, NativeAuthErrorMessage.tokensNotFoundInCache.desc);\r\n };\r\n return NativeAuthError;\r\n}(AuthError));\n\nexport { NativeAuthError, NativeAuthErrorMessage, NativeStatusCode };\n//# sourceMappingURL=NativeAuthError.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { StandardInteractionClient } from './StandardInteractionClient.js';\nimport { AuthError, PerformanceEvents, SilentFlowClient } from '@azure/msal-common';\nimport { ApiId } from '../utils/BrowserConstants.js';\nimport { BrowserAuthError, BrowserAuthErrorMessage } from '../error/BrowserAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar SilentCacheClient = /** @class */ (function (_super) {\r\n __extends(SilentCacheClient, _super);\r\n function SilentCacheClient() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Returns unexpired tokens from the cache, if available\r\n * @param silentRequest\r\n */\r\n SilentCacheClient.prototype.acquireToken = function (silentRequest) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var acquireTokenMeasurement, serverTelemetryManager, silentAuthClient, cachedToken, error_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);\r\n return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];\r\n case 1:\r\n silentAuthClient = _a.sent();\r\n this.logger.verbose(\"Silent auth client created\");\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 4, , 5]);\r\n return [4 /*yield*/, silentAuthClient.acquireCachedToken(silentRequest)];\r\n case 3:\r\n cachedToken = _a.sent();\r\n acquireTokenMeasurement.endMeasurement({\r\n success: true,\r\n fromCache: true\r\n });\r\n return [2 /*return*/, cachedToken];\r\n case 4:\r\n error_1 = _a.sent();\r\n if (error_1 instanceof BrowserAuthError && error_1.errorCode === BrowserAuthErrorMessage.signingKeyNotFoundInStorage.code) {\r\n this.logger.verbose(\"Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.\");\r\n }\r\n acquireTokenMeasurement.endMeasurement({\r\n errorCode: error_1 instanceof AuthError && error_1.errorCode || undefined,\r\n subErrorCode: error_1 instanceof AuthError && error_1.subError || undefined,\r\n success: false\r\n });\r\n throw error_1;\r\n case 5: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Currently Unsupported\r\n */\r\n SilentCacheClient.prototype.logout = function () {\r\n // Synchronous so we must reject\r\n return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());\r\n };\r\n /**\r\n * Creates an Silent Flow Client with the given authority, or the default authority.\r\n * @param serverTelemetryManager\r\n * @param authorityUrl\r\n */\r\n SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var clientConfig;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // Create auth module.\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);\r\n return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];\r\n case 1:\r\n clientConfig = _a.sent();\r\n return [2 /*return*/, new SilentFlowClient(clientConfig, this.performanceClient)];\r\n }\r\n });\r\n });\r\n };\r\n SilentCacheClient.prototype.initializeSilentRequest = function (request, account) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, this.correlationId);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, this.correlationId);\r\n _a = [__assign({}, request)];\r\n return [4 /*yield*/, this.initializeBaseRequest(request, account)];\r\n case 1: return [2 /*return*/, __assign.apply(void 0, [__assign.apply(void 0, _a.concat([_b.sent()])), { account: account, forceRefresh: request.forceRefresh || false }])];\r\n }\r\n });\r\n });\r\n };\r\n return SilentCacheClient;\r\n}(StandardInteractionClient));\n\nexport { SilentCacheClient };\n//# sourceMappingURL=SilentCacheClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __rest, __assign } from '../_virtual/_tslib.js';\nimport { ScopeSet, AuthToken, Constants, AccountEntity, AuthorityType, IdTokenEntity, AccessTokenEntity, CacheRecord, PerformanceEvents, TimeUtils, ClientAuthError, AuthenticationScheme, PopTokenGenerator, UrlString, OIDC_DEFAULT_SCOPES, PromptValue } from '@azure/msal-common';\nimport { BaseInteractionClient } from './BaseInteractionClient.js';\nimport { TemporaryCacheKeys, NativeExtensionMethod, NativeConstants, ApiId } from '../utils/BrowserConstants.js';\nimport { NativeAuthError } from '../error/NativeAuthError.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { SilentCacheClient } from './SilentCacheClient.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar NativeInteractionClient = /** @class */ (function (_super) {\r\n __extends(NativeInteractionClient, _super);\r\n function NativeInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {\r\n var _this = _super.call(this, config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId) || this;\r\n _this.apiId = apiId;\r\n _this.accountId = accountId;\r\n _this.nativeMessageHandler = provider;\r\n _this.nativeStorageManager = nativeStorageImpl;\r\n _this.silentCacheClient = new SilentCacheClient(config, _this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);\r\n return _this;\r\n }\r\n /**\r\n * Acquire token from native platform via browser extension\r\n * @param request\r\n */\r\n NativeInteractionClient.prototype.acquireToken = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var nativeATMeasurement, reqTimestamp, nativeRequest, result, messageBody, response, validatedResponse;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.trace(\"NativeInteractionClient - acquireToken called.\");\r\n nativeATMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);\r\n reqTimestamp = TimeUtils.nowSeconds();\r\n return [4 /*yield*/, this.initializeNativeRequest(request)];\r\n case 1:\r\n nativeRequest = _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 4, , 5]);\r\n return [4 /*yield*/, this.acquireTokensFromCache(this.accountId, nativeRequest)];\r\n case 3:\r\n result = _a.sent();\r\n nativeATMeasurement.endMeasurement({\r\n success: true,\r\n isNativeBroker: false,\r\n fromCache: true\r\n });\r\n return [2 /*return*/, result];\r\n case 4:\r\n _a.sent();\r\n // continue with a native call for any and all errors\r\n this.logger.info(\"MSAL internal Cache does not contain tokens, proceed to make a native call\");\r\n return [3 /*break*/, 5];\r\n case 5:\r\n messageBody = {\r\n method: NativeExtensionMethod.GetToken,\r\n request: nativeRequest\r\n };\r\n return [4 /*yield*/, this.nativeMessageHandler.sendMessage(messageBody)];\r\n case 6:\r\n response = _a.sent();\r\n validatedResponse = this.validateNativeResponse(response);\r\n return [2 /*return*/, this.handleNativeResponse(validatedResponse, nativeRequest, reqTimestamp)\r\n .then(function (result) {\r\n nativeATMeasurement.endMeasurement({\r\n success: true,\r\n isNativeBroker: true,\r\n requestId: result.requestId\r\n });\r\n return result;\r\n })\r\n .catch(function (error) {\r\n nativeATMeasurement.endMeasurement({\r\n success: false,\r\n errorCode: error.errorCode,\r\n subErrorCode: error.subError,\r\n isNativeBroker: true\r\n });\r\n throw error;\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Creates silent flow request\r\n * @param request\r\n * @param cachedAccount\r\n * @returns CommonSilentFlowRequest\r\n */\r\n NativeInteractionClient.prototype.createSilentCacheRequest = function (request, cachedAccount) {\r\n return {\r\n authority: request.authority,\r\n correlationId: this.correlationId,\r\n scopes: ScopeSet.fromString(request.scope).asArray(),\r\n account: cachedAccount,\r\n forceRefresh: false,\r\n };\r\n };\r\n /**\r\n * Fetches the tokens from the cache if un-expired\r\n * @param nativeAccountId\r\n * @param request\r\n * @returns authenticationResult\r\n */\r\n NativeInteractionClient.prototype.acquireTokensFromCache = function (nativeAccountId, request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var account, silentRequest, result, e_2;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!nativeAccountId) {\r\n this.logger.warning(\"NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided\");\r\n throw ClientAuthError.createNoAccountFoundError();\r\n }\r\n account = this.browserStorage.getAccountInfoFilteredBy({ nativeAccountId: nativeAccountId });\r\n if (!account) {\r\n throw ClientAuthError.createNoAccountFoundError();\r\n }\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n silentRequest = this.createSilentCacheRequest(request, account);\r\n return [4 /*yield*/, this.silentCacheClient.acquireToken(silentRequest)];\r\n case 2:\r\n result = _a.sent();\r\n return [2 /*return*/, result];\r\n case 3:\r\n e_2 = _a.sent();\r\n throw e_2;\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Acquires a token from native platform then redirects to the redirectUri instead of returning the response\r\n * @param request\r\n */\r\n NativeInteractionClient.prototype.acquireTokenRedirect = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var nativeRequest, messageBody, response, e_3, navigationOptions, redirectUri;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.trace(\"NativeInteractionClient - acquireTokenRedirect called.\");\r\n return [4 /*yield*/, this.initializeNativeRequest(request)];\r\n case 1:\r\n nativeRequest = _a.sent();\r\n messageBody = {\r\n method: NativeExtensionMethod.GetToken,\r\n request: nativeRequest\r\n };\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 4, , 5]);\r\n return [4 /*yield*/, this.nativeMessageHandler.sendMessage(messageBody)];\r\n case 3:\r\n response = _a.sent();\r\n this.validateNativeResponse(response);\r\n return [3 /*break*/, 5];\r\n case 4:\r\n e_3 = _a.sent();\r\n // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise\r\n if (e_3 instanceof NativeAuthError && e_3.isFatal()) {\r\n throw e_3;\r\n }\r\n return [3 /*break*/, 5];\r\n case 5:\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify(nativeRequest), true);\r\n navigationOptions = {\r\n apiId: ApiId.acquireTokenRedirect,\r\n timeout: this.config.system.redirectNavigationTimeout,\r\n noHistory: false\r\n };\r\n redirectUri = this.config.auth.navigateToLoginRequestUrl ? window.location.href : this.getRedirectUri(request.redirectUri);\r\n return [4 /*yield*/, this.navigationClient.navigateExternal(redirectUri, navigationOptions)];\r\n case 6:\r\n _a.sent(); // Need to treat this as external to ensure handleRedirectPromise is run again\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * If the previous page called native platform for a token using redirect APIs, send the same request again and return the response\r\n */\r\n NativeInteractionClient.prototype.handleRedirectPromise = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var cachedRequest, prompt, request, messageBody, reqTimestamp, response, result, e_4;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.trace(\"NativeInteractionClient - handleRedirectPromise called.\");\r\n if (!this.browserStorage.isInteractionInProgress(true)) {\r\n this.logger.info(\"handleRedirectPromise called but there is no interaction in progress, returning null.\");\r\n return [2 /*return*/, null];\r\n }\r\n cachedRequest = this.browserStorage.getCachedNativeRequest();\r\n if (!cachedRequest) {\r\n this.logger.verbose(\"NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null.\");\r\n return [2 /*return*/, null];\r\n }\r\n prompt = cachedRequest.prompt, request = __rest(cachedRequest, [\"prompt\"]);\r\n if (prompt) {\r\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.\");\r\n }\r\n this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));\r\n messageBody = {\r\n method: NativeExtensionMethod.GetToken,\r\n request: request\r\n };\r\n reqTimestamp = TimeUtils.nowSeconds();\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n this.logger.verbose(\"NativeInteractionClient - handleRedirectPromise sending message to native broker.\");\r\n return [4 /*yield*/, this.nativeMessageHandler.sendMessage(messageBody)];\r\n case 2:\r\n response = _a.sent();\r\n this.validateNativeResponse(response);\r\n result = this.handleNativeResponse(response, request, reqTimestamp);\r\n this.browserStorage.setInteractionInProgress(false);\r\n return [2 /*return*/, result];\r\n case 3:\r\n e_4 = _a.sent();\r\n this.browserStorage.setInteractionInProgress(false);\r\n throw e_4;\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Logout from native platform via browser extension\r\n * @param request\r\n */\r\n NativeInteractionClient.prototype.logout = function () {\r\n this.logger.trace(\"NativeInteractionClient - logout called.\");\r\n return Promise.reject(\"Logout not implemented yet\");\r\n };\r\n /**\r\n * Transform response from native platform into AuthenticationResult object which will be returned to the end user\r\n * @param response\r\n * @param request\r\n * @param reqTimestamp\r\n */\r\n NativeInteractionClient.prototype.handleNativeResponse = function (response, request, reqTimestamp) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var authority, authorityPreferredCache, idTokenObj, homeAccountIdentifier, accountEntity, result;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.trace(\"NativeInteractionClient - handleNativeResponse called.\");\r\n if (response.account.id !== request.accountId) {\r\n // User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync\r\n throw NativeAuthError.createUserSwitchError();\r\n }\r\n return [4 /*yield*/, this.getDiscoveredAuthority(request.authority)];\r\n case 1:\r\n authority = _a.sent();\r\n authorityPreferredCache = authority.getPreferredCache();\r\n idTokenObj = this.createIdTokenObj(response);\r\n homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenObj);\r\n accountEntity = this.createAccountEntity(response, homeAccountIdentifier, idTokenObj, authorityPreferredCache);\r\n return [4 /*yield*/, this.generateAuthenticationResult(response, request, idTokenObj, accountEntity, authority.canonicalAuthority, reqTimestamp)];\r\n case 2:\r\n result = _a.sent();\r\n // cache accounts and tokens in the appropriate storage\r\n this.cacheAccount(accountEntity);\r\n this.cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);\r\n return [2 /*return*/, result];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Create an idToken Object (not entity)\r\n * @param response\r\n * @returns\r\n */\r\n NativeInteractionClient.prototype.createIdTokenObj = function (response) {\r\n return new AuthToken(response.id_token || Constants.EMPTY_STRING, this.browserCrypto);\r\n };\r\n /**\r\n * creates an homeAccountIdentifier for the account\r\n * @param response\r\n * @param idTokenObj\r\n * @returns\r\n */\r\n NativeInteractionClient.prototype.createHomeAccountIdentifier = function (response, idTokenObj) {\r\n // Save account in browser storage\r\n var homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);\r\n return homeAccountIdentifier;\r\n };\r\n /**\r\n * Creates account entity\r\n * @param response\r\n * @param homeAccountIdentifier\r\n * @param idTokenObj\r\n * @param authority\r\n * @returns\r\n */\r\n NativeInteractionClient.prototype.createAccountEntity = function (response, homeAccountIdentifier, idTokenObj, authority) {\r\n return AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authority, response.account.id);\r\n };\r\n /**\r\n * Helper to generate scopes\r\n * @param response\r\n * @param request\r\n * @returns\r\n */\r\n NativeInteractionClient.prototype.generateScopes = function (response, request) {\r\n return response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);\r\n };\r\n /**\r\n * If PoP token is requesred, records the PoP token if returned from the WAM, else generates one in the browser\r\n * @param request\r\n * @param response\r\n */\r\n NativeInteractionClient.prototype.generatePopAccessToken = function (response, request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var popTokenGenerator, shrParameters;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!(request.tokenType === AuthenticationScheme.POP)) return [3 /*break*/, 2];\r\n /**\r\n * This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT\r\n * is still received, SHR is calculated locally\r\n */\r\n // Check if native layer returned an SHR token\r\n if (response.shr) {\r\n this.logger.trace(\"handleNativeServerResponse: SHR is enabled in native layer\");\r\n return [2 /*return*/, response.shr];\r\n }\r\n popTokenGenerator = new PopTokenGenerator(this.browserCrypto);\r\n shrParameters = {\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n shrNonce: request.shrNonce\r\n };\r\n /**\r\n * KeyID must be present in the native request from when the PoP key was generated in order for\r\n * PopTokenGenerator to query the full key for signing\r\n */\r\n if (!request.keyId) {\r\n throw ClientAuthError.createKeyIdMissingError();\r\n }\r\n return [4 /*yield*/, popTokenGenerator.signPopToken(response.access_token, request.keyId, shrParameters)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n case 2: return [2 /*return*/, response.access_token];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Generates authentication result\r\n * @param response\r\n * @param request\r\n * @param idTokenObj\r\n * @param accountEntity\r\n * @param authority\r\n * @param reqTimestamp\r\n * @returns\r\n */\r\n NativeInteractionClient.prototype.generateAuthenticationResult = function (response, request, idTokenObj, accountEntity, authority, reqTimestamp) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var mats, responseScopes, accountProperties, uid, tid, responseAccessToken, tokenType, result;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n mats = this.addTelemetryFromNativeResponse(response);\r\n responseScopes = response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);\r\n accountProperties = response.account.properties || {};\r\n uid = accountProperties[\"UID\"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;\r\n tid = accountProperties[\"TenantId\"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;\r\n return [4 /*yield*/, this.generatePopAccessToken(response, request)];\r\n case 1:\r\n responseAccessToken = _a.sent();\r\n tokenType = (request.tokenType === AuthenticationScheme.POP) ? AuthenticationScheme.POP : AuthenticationScheme.BEARER;\r\n result = {\r\n authority: authority,\r\n uniqueId: uid,\r\n tenantId: tid,\r\n scopes: responseScopes.asArray(),\r\n account: accountEntity.getAccountInfo(),\r\n idToken: response.id_token,\r\n idTokenClaims: idTokenObj.claims,\r\n accessToken: responseAccessToken,\r\n fromCache: mats ? this.isResponseFromCache(mats) : false,\r\n expiresOn: new Date(Number(reqTimestamp + response.expires_in) * 1000),\r\n tokenType: tokenType,\r\n correlationId: this.correlationId,\r\n state: response.state,\r\n fromNativeBroker: true\r\n };\r\n return [2 /*return*/, result];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * cache the account entity in browser storage\r\n * @param accountEntity\r\n */\r\n NativeInteractionClient.prototype.cacheAccount = function (accountEntity) {\r\n var _this = this;\r\n // Store the account info and hence `nativeAccountId` in browser cache\r\n this.browserStorage.setAccount(accountEntity);\r\n // Remove any existing cached tokens for this account in browser storage\r\n this.browserStorage.removeAccountContext(accountEntity).catch(function (e) {\r\n _this.logger.error(\"Error occurred while removing account context from browser storage. \" + e);\r\n });\r\n };\r\n /**\r\n * Stores the access_token and id_token in inmemory storage\r\n * @param response\r\n * @param request\r\n * @param homeAccountIdentifier\r\n * @param idTokenObj\r\n * @param responseAccessToken\r\n * @param tenantId\r\n * @param reqTimestamp\r\n */\r\n NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, accountEntity, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {\r\n var cachedIdToken = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);\r\n // cache accessToken in inmemory storage\r\n var expiresIn = (request.tokenType === AuthenticationScheme.POP)\r\n ? Constants.SHR_NONCE_VALIDITY\r\n : (typeof response.expires_in === \"string\"\r\n ? parseInt(response.expires_in, 10)\r\n : response.expires_in) || 0;\r\n var tokenExpirationSeconds = reqTimestamp + expiresIn;\r\n var responseScopes = this.generateScopes(response, request);\r\n var cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenObj\r\n ? idTokenObj.claims.tid || Constants.EMPTY_STRING\r\n : tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);\r\n var nativeCacheRecord = new CacheRecord(accountEntity, cachedIdToken, cachedAccessToken);\r\n this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);\r\n };\r\n NativeInteractionClient.prototype.addTelemetryFromNativeResponse = function (response) {\r\n var mats = this.getMATSFromResponse(response);\r\n if (!mats) {\r\n return null;\r\n }\r\n this.performanceClient.addStaticFields({\r\n extensionId: this.nativeMessageHandler.getExtensionId(),\r\n extensionVersion: this.nativeMessageHandler.getExtensionVersion(),\r\n matsBrokerVersion: mats.broker_version,\r\n matsAccountJoinOnStart: mats.account_join_on_start,\r\n matsAccountJoinOnEnd: mats.account_join_on_end,\r\n matsDeviceJoin: mats.device_join,\r\n matsPromptBehavior: mats.prompt_behavior,\r\n matsApiErrorCode: mats.api_error_code,\r\n matsUiVisible: mats.ui_visible,\r\n matsSilentCode: mats.silent_code,\r\n matsSilentBiSubCode: mats.silent_bi_sub_code,\r\n matsSilentMessage: mats.silent_message,\r\n matsSilentStatus: mats.silent_status,\r\n matsHttpStatus: mats.http_status,\r\n matsHttpEventCount: mats.http_event_count\r\n }, this.correlationId);\r\n return mats;\r\n };\r\n /**\r\n * Validates native platform response before processing\r\n * @param response\r\n */\r\n NativeInteractionClient.prototype.validateNativeResponse = function (response) {\r\n if (response.hasOwnProperty(\"access_token\") &&\r\n response.hasOwnProperty(\"id_token\") &&\r\n response.hasOwnProperty(\"client_info\") &&\r\n response.hasOwnProperty(\"account\") &&\r\n response.hasOwnProperty(\"scope\") &&\r\n response.hasOwnProperty(\"expires_in\")) {\r\n return response;\r\n }\r\n else {\r\n throw NativeAuthError.createUnexpectedError(\"Response missing expected properties.\");\r\n }\r\n };\r\n /**\r\n * Gets MATS telemetry from native response\r\n * @param response\r\n * @returns\r\n */\r\n NativeInteractionClient.prototype.getMATSFromResponse = function (response) {\r\n if (response.properties.MATS) {\r\n try {\r\n return JSON.parse(response.properties.MATS);\r\n }\r\n catch (e) {\r\n this.logger.error(\"NativeInteractionClient - Error parsing MATS telemetry, returning null instead\");\r\n }\r\n }\r\n return null;\r\n };\r\n /**\r\n * Returns whether or not response came from native cache\r\n * @param response\r\n * @returns\r\n */\r\n NativeInteractionClient.prototype.isResponseFromCache = function (mats) {\r\n if (typeof mats.is_cached === \"undefined\") {\r\n this.logger.verbose(\"NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false.\");\r\n return false;\r\n }\r\n return !!mats.is_cached;\r\n };\r\n /**\r\n * Translates developer provided request object into NativeRequest object\r\n * @param request\r\n */\r\n NativeInteractionClient.prototype.initializeNativeRequest = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var authority, canonicalAuthority, scopes, remainingProperties, scopeSet, getPrompt, validatedRequest, shrParameters, popTokenGenerator, reqCnfData;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.trace(\"NativeInteractionClient - initializeNativeRequest called\");\r\n authority = request.authority || this.config.auth.authority;\r\n if (!request.account) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.validateRequestAuthority(authority, request.account)];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n canonicalAuthority = new UrlString(authority);\r\n canonicalAuthority.validateAsUri();\r\n scopes = request.scopes, remainingProperties = __rest(request, [\"scopes\"]);\r\n scopeSet = new ScopeSet(scopes || []);\r\n scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);\r\n getPrompt = function () {\r\n // If request is silent, prompt is always none\r\n switch (_this.apiId) {\r\n case ApiId.ssoSilent:\r\n case ApiId.acquireTokenSilent_silentFlow:\r\n _this.logger.trace(\"initializeNativeRequest: silent request sets prompt to none\");\r\n return PromptValue.NONE;\r\n }\r\n // Prompt not provided, request may proceed and native broker decides if it needs to prompt\r\n if (!request.prompt) {\r\n _this.logger.trace(\"initializeNativeRequest: prompt was not provided\");\r\n return undefined;\r\n }\r\n // If request is interactive, check if prompt provided is allowed to go directly to native broker\r\n switch (request.prompt) {\r\n case PromptValue.NONE:\r\n case PromptValue.CONSENT:\r\n case PromptValue.LOGIN:\r\n _this.logger.trace(\"initializeNativeRequest: prompt is compatible with native flow\");\r\n return request.prompt;\r\n default:\r\n _this.logger.trace(\"initializeNativeRequest: prompt = \" + request.prompt + \" is not compatible with native flow\");\r\n throw BrowserAuthError.createNativePromptParameterNotSupportedError();\r\n }\r\n };\r\n validatedRequest = __assign(__assign({}, remainingProperties), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scope: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), prompt: getPrompt(), correlationId: this.correlationId, tokenType: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign(__assign(__assign({}, request.extraQueryParameters), request.tokenQueryParameters), { telemetry: NativeConstants.MATS_TELEMETRY }), extendedExpiryToken: false // Make this configurable?\r\n });\r\n if (!(request.authenticationScheme === AuthenticationScheme.POP)) return [3 /*break*/, 4];\r\n shrParameters = {\r\n resourceRequestUri: request.resourceRequestUri,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n shrClaims: request.shrClaims,\r\n shrNonce: request.shrNonce\r\n };\r\n popTokenGenerator = new PopTokenGenerator(this.browserCrypto);\r\n return [4 /*yield*/, popTokenGenerator.generateCnf(shrParameters)];\r\n case 3:\r\n reqCnfData = _a.sent();\r\n // to reduce the URL length, it is recommended to send the short form of the req_cnf \r\n validatedRequest.reqCnf = reqCnfData.reqCnfString;\r\n validatedRequest.keyId = reqCnfData.kid;\r\n _a.label = 4;\r\n case 4: return [2 /*return*/, validatedRequest];\r\n }\r\n });\r\n });\r\n };\r\n return NativeInteractionClient;\r\n}(BaseInteractionClient));\n\nexport { NativeInteractionClient };\n//# sourceMappingURL=NativeInteractionClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../../_virtual/_tslib.js';\nimport { NativeConstants, NativeExtensionMethod } from '../../utils/BrowserConstants.js';\nimport { AuthError, AuthenticationScheme, PerformanceEvents } from '@azure/msal-common';\nimport { NativeAuthError } from '../../error/NativeAuthError.js';\nimport { BrowserAuthError } from '../../error/BrowserAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar NativeMessageHandler = /** @class */ (function () {\r\n function NativeMessageHandler(logger, handshakeTimeoutMs, performanceClient, extensionId) {\r\n this.logger = logger;\r\n this.handshakeTimeoutMs = handshakeTimeoutMs;\r\n this.extensionId = extensionId;\r\n this.resolvers = new Map(); // Used for non-handshake messages\r\n this.handshakeResolvers = new Map(); // Used for handshake messages\r\n this.responseId = 0;\r\n this.messageChannel = new MessageChannel();\r\n this.windowListener = this.onWindowMessage.bind(this); // Window event callback doesn't have access to 'this' unless it's bound\r\n this.performanceClient = performanceClient;\r\n this.handshakeEvent = performanceClient.startMeasurement(PerformanceEvents.NativeMessageHandlerHandshake);\r\n }\r\n /**\r\n * Sends a given message to the extension and resolves with the extension response\r\n * @param body\r\n */\r\n NativeMessageHandler.prototype.sendMessage = function (body) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var req;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n this.logger.trace(\"NativeMessageHandler - sendMessage called.\");\r\n req = {\r\n channel: NativeConstants.CHANNEL_ID,\r\n extensionId: this.extensionId,\r\n responseId: this.responseId++,\r\n body: body\r\n };\r\n this.logger.trace(\"NativeMessageHandler - Sending request to browser extension\");\r\n this.logger.tracePii(\"NativeMessageHandler - Sending request to browser extension: \" + JSON.stringify(req));\r\n this.messageChannel.port1.postMessage(req);\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n _this.resolvers.set(req.responseId, { resolve: resolve, reject: reject });\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Returns an instance of the MessageHandler that has successfully established a connection with an extension\r\n * @param {Logger} logger\r\n * @param {number} handshakeTimeoutMs\r\n * @param {IPerformanceClient} performanceClient\r\n */\r\n NativeMessageHandler.createProvider = function (logger, handshakeTimeoutMs, performanceClient) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var preferredProvider, backupProvider;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n logger.trace(\"NativeMessageHandler - createProvider called.\");\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 5]);\r\n preferredProvider = new NativeMessageHandler(logger, handshakeTimeoutMs, performanceClient, NativeConstants.PREFERRED_EXTENSION_ID);\r\n return [4 /*yield*/, preferredProvider.sendHandshakeRequest()];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/, preferredProvider];\r\n case 3:\r\n _a.sent();\r\n backupProvider = new NativeMessageHandler(logger, handshakeTimeoutMs, performanceClient);\r\n return [4 /*yield*/, backupProvider.sendHandshakeRequest()];\r\n case 4:\r\n _a.sent();\r\n return [2 /*return*/, backupProvider];\r\n case 5: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Send handshake request helper.\r\n */\r\n NativeMessageHandler.prototype.sendHandshakeRequest = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var req;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n this.logger.trace(\"NativeMessageHandler - sendHandshakeRequest called.\");\r\n // Register this event listener before sending handshake\r\n window.addEventListener(\"message\", this.windowListener, false); // false is important, because content script message processing should work first\r\n req = {\r\n channel: NativeConstants.CHANNEL_ID,\r\n extensionId: this.extensionId,\r\n responseId: this.responseId++,\r\n body: {\r\n method: NativeExtensionMethod.HandshakeRequest\r\n }\r\n };\r\n this.handshakeEvent.addStaticFields({\r\n extensionId: this.extensionId,\r\n extensionHandshakeTimeoutMs: this.handshakeTimeoutMs\r\n });\r\n this.messageChannel.port1.onmessage = function (event) {\r\n _this.onChannelMessage(event);\r\n };\r\n window.postMessage(req, window.origin, [this.messageChannel.port2]);\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n _this.handshakeResolvers.set(req.responseId, { resolve: resolve, reject: reject });\r\n _this.timeoutId = window.setTimeout(function () {\r\n /*\r\n * Throw an error if neither HandshakeResponse nor original Handshake request are received in a reasonable timeframe.\r\n * This typically suggests an event handler stopped propagation of the Handshake request but did not respond to it on the MessageChannel port\r\n */\r\n window.removeEventListener(\"message\", _this.windowListener, false);\r\n _this.messageChannel.port1.close();\r\n _this.messageChannel.port2.close();\r\n _this.handshakeEvent.endMeasurement({ extensionHandshakeTimedOut: true, success: false });\r\n reject(BrowserAuthError.createNativeHandshakeTimeoutError());\r\n _this.handshakeResolvers.delete(req.responseId);\r\n }, _this.handshakeTimeoutMs); // Use a reasonable timeout in milliseconds here\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Invoked when a message is posted to the window. If a handshake request is received it means the extension is not installed.\r\n * @param event\r\n */\r\n NativeMessageHandler.prototype.onWindowMessage = function (event) {\r\n this.logger.trace(\"NativeMessageHandler - onWindowMessage called\");\r\n // We only accept messages from ourselves\r\n if (event.source !== window) {\r\n return;\r\n }\r\n var request = event.data;\r\n if (!request.channel || request.channel !== NativeConstants.CHANNEL_ID) {\r\n return;\r\n }\r\n if (request.extensionId && request.extensionId !== this.extensionId) {\r\n return;\r\n }\r\n if (request.body.method === NativeExtensionMethod.HandshakeRequest) {\r\n // If we receive this message back it means no extension intercepted the request, meaning no extension supporting handshake protocol is installed\r\n this.logger.verbose(request.extensionId ? \"Extension with id: \" + request.extensionId + \" not installed\" : \"No extension installed\");\r\n clearTimeout(this.timeoutId);\r\n this.messageChannel.port1.close();\r\n this.messageChannel.port2.close();\r\n window.removeEventListener(\"message\", this.windowListener, false);\r\n var handshakeResolver = this.handshakeResolvers.get(request.responseId);\r\n if (handshakeResolver) {\r\n this.handshakeEvent.endMeasurement({ success: false, extensionInstalled: false });\r\n handshakeResolver.reject(BrowserAuthError.createNativeExtensionNotInstalledError());\r\n }\r\n }\r\n };\r\n /**\r\n * Invoked when a message is received from the extension on the MessageChannel port\r\n * @param event\r\n */\r\n NativeMessageHandler.prototype.onChannelMessage = function (event) {\r\n this.logger.trace(\"NativeMessageHandler - onChannelMessage called.\");\r\n var request = event.data;\r\n var resolver = this.resolvers.get(request.responseId);\r\n var handshakeResolver = this.handshakeResolvers.get(request.responseId);\r\n try {\r\n var method = request.body.method;\r\n if (method === NativeExtensionMethod.Response) {\r\n if (!resolver) {\r\n return;\r\n }\r\n var response = request.body.response;\r\n this.logger.trace(\"NativeMessageHandler - Received response from browser extension\");\r\n this.logger.tracePii(\"NativeMessageHandler - Received response from browser extension: \" + JSON.stringify(response));\r\n if (response.status !== \"Success\") {\r\n resolver.reject(NativeAuthError.createError(response.code, response.description, response.ext));\r\n }\r\n else if (response.result) {\r\n if (response.result[\"code\"] && response.result[\"description\"]) {\r\n resolver.reject(NativeAuthError.createError(response.result[\"code\"], response.result[\"description\"], response.result[\"ext\"]));\r\n }\r\n else {\r\n resolver.resolve(response.result);\r\n }\r\n }\r\n else {\r\n throw AuthError.createUnexpectedError(\"Event does not contain result.\");\r\n }\r\n this.resolvers.delete(request.responseId);\r\n }\r\n else if (method === NativeExtensionMethod.HandshakeResponse) {\r\n if (!handshakeResolver) {\r\n return;\r\n }\r\n clearTimeout(this.timeoutId); // Clear setTimeout\r\n window.removeEventListener(\"message\", this.windowListener, false); // Remove 'No extension' listener\r\n this.extensionId = request.extensionId;\r\n this.extensionVersion = request.body.version;\r\n this.logger.verbose(\"NativeMessageHandler - Received HandshakeResponse from extension: \" + this.extensionId);\r\n this.handshakeEvent.endMeasurement({ extensionInstalled: true, success: true });\r\n handshakeResolver.resolve();\r\n this.handshakeResolvers.delete(request.responseId);\r\n }\r\n // Do nothing if method is not Response or HandshakeResponse\r\n }\r\n catch (err) {\r\n this.logger.error(\"Error parsing response from WAM Extension\");\r\n this.logger.errorPii(\"Error parsing response from WAM Extension: \" + err.toString());\r\n this.logger.errorPii(\"Unable to parse \" + event);\r\n if (resolver) {\r\n resolver.reject(err);\r\n }\r\n else if (handshakeResolver) {\r\n handshakeResolver.reject(err);\r\n }\r\n }\r\n };\r\n /**\r\n * Returns the Id for the browser extension this handler is communicating with\r\n * @returns\r\n */\r\n NativeMessageHandler.prototype.getExtensionId = function () {\r\n return this.extensionId;\r\n };\r\n /**\r\n * Returns the version for the browser extension this handler is communicating with\r\n * @returns\r\n */\r\n NativeMessageHandler.prototype.getExtensionVersion = function () {\r\n return this.extensionVersion;\r\n };\r\n /**\r\n * Returns boolean indicating whether or not the request should attempt to use native broker\r\n * @param logger\r\n * @param config\r\n * @param nativeExtensionProvider\r\n * @param authenticationScheme\r\n */\r\n NativeMessageHandler.isNativeAvailable = function (config, logger, nativeExtensionProvider, authenticationScheme) {\r\n logger.trace(\"isNativeAvailable called\");\r\n if (!config.system.allowNativeBroker) {\r\n logger.trace(\"isNativeAvailable: allowNativeBroker is not enabled, returning false\");\r\n // Developer disabled WAM\r\n return false;\r\n }\r\n if (!nativeExtensionProvider) {\r\n logger.trace(\"isNativeAvailable: WAM extension provider is not initialized, returning false\");\r\n // Extension is not available\r\n return false;\r\n }\r\n if (authenticationScheme) {\r\n switch (authenticationScheme) {\r\n case AuthenticationScheme.BEARER:\r\n case AuthenticationScheme.POP:\r\n logger.trace(\"isNativeAvailable: authenticationScheme is supported, returning true\");\r\n return true;\r\n default:\r\n logger.trace(\"isNativeAvailable: authenticationScheme is not supported, returning false\");\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n return NativeMessageHandler;\r\n}());\n\nexport { NativeMessageHandler };\n//# sourceMappingURL=NativeMessageHandler.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { UrlString, AuthError, PerformanceEvents, Constants, ThrottlingUtils, ProtocolUtils } from '@azure/msal-common';\nimport { StandardInteractionClient } from './StandardInteractionClient.js';\nimport { TemporaryCacheKeys, ApiId, InteractionType } from '../utils/BrowserConstants.js';\nimport { RedirectHandler } from '../interaction_handler/RedirectHandler.js';\nimport { BrowserUtils } from '../utils/BrowserUtils.js';\nimport { EventType } from '../event/EventType.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { NativeInteractionClient } from './NativeInteractionClient.js';\nimport { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar RedirectClient = /** @class */ (function (_super) {\r\n __extends(RedirectClient, _super);\r\n function RedirectClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {\r\n var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;\r\n _this.nativeStorage = nativeStorageImpl;\r\n return _this;\r\n }\r\n /**\r\n * Redirects the page to the /authorize endpoint of the IDP\r\n * @param request\r\n */\r\n RedirectClient.prototype.acquireToken = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var validRequest, serverTelemetryManager, handleBackButton, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);\r\n return [4 /*yield*/, this.initializeAuthorizationRequest(request, InteractionType.Redirect)];\r\n case 1:\r\n validRequest = _a.sent();\r\n this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenRedirect);\r\n handleBackButton = function (event) {\r\n // Clear temporary cache if the back button is clicked during the redirect flow.\r\n if (event.persisted) {\r\n _this.logger.verbose(\"Page was restored from back/forward cache. Clearing temporary cache.\");\r\n _this.browserStorage.cleanRequestByState(validRequest.state);\r\n _this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, InteractionType.Redirect);\r\n }\r\n };\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 7, , 8]);\r\n // Create auth code request and generate PKCE params\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);\r\n return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];\r\n case 3:\r\n authCodeRequest = _a.sent();\r\n // Initialize the client\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];\r\n case 4:\r\n authClient = _a.sent();\r\n this.logger.verbose(\"Auth code client created\");\r\n interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.browserCrypto, this.performanceClient);\r\n return [4 /*yield*/, authClient.getAuthCodeUrl(__assign(__assign({}, validRequest), { nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme) }))];\r\n case 5:\r\n navigateUrl = _a.sent();\r\n redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);\r\n this.logger.verbosePii(\"Redirect start page: \" + redirectStartPage);\r\n // Clear temporary cache if the back button is clicked during the redirect flow.\r\n window.addEventListener(\"pageshow\", handleBackButton);\r\n return [4 /*yield*/, interactionHandler.initiateAuthRequest(navigateUrl, {\r\n navigationClient: this.navigationClient,\r\n redirectTimeout: this.config.system.redirectNavigationTimeout,\r\n redirectStartPage: redirectStartPage,\r\n onRedirectNavigate: request.onRedirectNavigate\r\n })];\r\n case 6: \r\n // Show the UI once the url has been created. Response will come back in the hash, which will be handled in the handleRedirectCallback function.\r\n return [2 /*return*/, _a.sent()];\r\n case 7:\r\n e_1 = _a.sent();\r\n if (e_1 instanceof AuthError) {\r\n e_1.setCorrelationId(this.correlationId);\r\n }\r\n window.removeEventListener(\"pageshow\", handleBackButton);\r\n serverTelemetryManager.cacheFailedRequest(e_1);\r\n this.browserStorage.cleanRequestByState(validRequest.state);\r\n throw e_1;\r\n case 8: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Checks if navigateToLoginRequestUrl is set, and:\r\n * - if true, performs logic to cache and navigate\r\n * - if false, handles hash string and parses response\r\n * @param hash\r\n */\r\n RedirectClient.prototype.handleRedirectPromise = function (hash) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var serverTelemetryManager, responseHash, state, serverParams, loginRequestUrl, loginRequestUrlNormalized, currentUrlNormalized, handleHashResult, navigationOptions, processHashOnRedirect, homepage, e_2;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.handleRedirectPromise);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 10, , 11]);\r\n if (!this.browserStorage.isInteractionInProgress(true)) {\r\n this.logger.info(\"handleRedirectPromise called but there is no interaction in progress, returning null.\");\r\n return [2 /*return*/, null];\r\n }\r\n responseHash = this.getRedirectResponseHash(hash || window.location.hash);\r\n if (!responseHash) {\r\n // Not a recognized server response hash or hash not associated with a redirect request\r\n this.logger.info(\"handleRedirectPromise did not detect a response hash as a result of a redirect. Cleaning temporary cache.\");\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Redirect);\r\n return [2 /*return*/, null];\r\n }\r\n state = void 0;\r\n try {\r\n serverParams = UrlString.getDeserializedHash(responseHash);\r\n state = this.validateAndExtractStateFromHash(serverParams, InteractionType.Redirect);\r\n this.logger.verbose(\"State extracted from hash\");\r\n }\r\n catch (e) {\r\n this.logger.info(\"handleRedirectPromise was unable to extract state due to: \" + e);\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Redirect);\r\n return [2 /*return*/, null];\r\n }\r\n loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) || Constants.EMPTY_STRING;\r\n loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);\r\n currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);\r\n if (!(loginRequestUrlNormalized === currentUrlNormalized && this.config.auth.navigateToLoginRequestUrl)) return [3 /*break*/, 3];\r\n // We are on the page we need to navigate to - handle hash\r\n this.logger.verbose(\"Current page is loginRequestUrl, handling hash\");\r\n return [4 /*yield*/, this.handleHash(responseHash, state, serverTelemetryManager)];\r\n case 2:\r\n handleHashResult = _a.sent();\r\n if (loginRequestUrl.indexOf(\"#\") > -1) {\r\n // Replace current hash with non-msal hash, if present\r\n BrowserUtils.replaceHash(loginRequestUrl);\r\n }\r\n return [2 /*return*/, handleHashResult];\r\n case 3:\r\n if (!!this.config.auth.navigateToLoginRequestUrl) return [3 /*break*/, 4];\r\n this.logger.verbose(\"NavigateToLoginRequestUrl set to false, handling hash\");\r\n return [2 /*return*/, this.handleHash(responseHash, state, serverTelemetryManager)];\r\n case 4:\r\n if (!(!BrowserUtils.isInIframe() || this.config.system.allowRedirectInIframe)) return [3 /*break*/, 9];\r\n /*\r\n * Returned from authority using redirect - need to perform navigation before processing response\r\n * Cache the hash to be retrieved after the next redirect\r\n */\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);\r\n navigationOptions = {\r\n apiId: ApiId.handleRedirectPromise,\r\n timeout: this.config.system.redirectNavigationTimeout,\r\n noHistory: true\r\n };\r\n processHashOnRedirect = true;\r\n if (!(!loginRequestUrl || loginRequestUrl === \"null\")) return [3 /*break*/, 6];\r\n homepage = BrowserUtils.getHomepage();\r\n // Cache the homepage under ORIGIN_URI to ensure cached hash is processed on homepage\r\n this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, homepage, true);\r\n this.logger.warning(\"Unable to get valid login request url from cache, redirecting to home page\");\r\n return [4 /*yield*/, this.navigationClient.navigateInternal(homepage, navigationOptions)];\r\n case 5:\r\n processHashOnRedirect = _a.sent();\r\n return [3 /*break*/, 8];\r\n case 6:\r\n // Navigate to page that initiated the redirect request\r\n this.logger.verbose(\"Navigating to loginRequestUrl: \" + loginRequestUrl);\r\n return [4 /*yield*/, this.navigationClient.navigateInternal(loginRequestUrl, navigationOptions)];\r\n case 7:\r\n processHashOnRedirect = _a.sent();\r\n _a.label = 8;\r\n case 8:\r\n // If navigateInternal implementation returns false, handle the hash now\r\n if (!processHashOnRedirect) {\r\n return [2 /*return*/, this.handleHash(responseHash, state, serverTelemetryManager)];\r\n }\r\n _a.label = 9;\r\n case 9: return [2 /*return*/, null];\r\n case 10:\r\n e_2 = _a.sent();\r\n if (e_2 instanceof AuthError) {\r\n e_2.setCorrelationId(this.correlationId);\r\n }\r\n serverTelemetryManager.cacheFailedRequest(e_2);\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Redirect);\r\n throw e_2;\r\n case 11: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Gets the response hash for a redirect request\r\n * Returns null if interactionType in the state value is not \"redirect\" or the hash does not contain known properties\r\n * @param hash\r\n */\r\n RedirectClient.prototype.getRedirectResponseHash = function (hash) {\r\n this.logger.verbose(\"getRedirectResponseHash called\");\r\n // Get current location hash from window or cache.\r\n var isResponseHash = UrlString.hashContainsKnownProperties(hash);\r\n if (isResponseHash) {\r\n BrowserUtils.clearHash(window);\r\n this.logger.verbose(\"Hash contains known properties, returning response hash\");\r\n return hash;\r\n }\r\n var cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);\r\n this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));\r\n this.logger.verbose(\"Hash does not contain known properties, returning cached hash\");\r\n return cachedHash;\r\n };\r\n /**\r\n * Checks if hash exists and handles in window.\r\n * @param hash\r\n * @param state\r\n */\r\n RedirectClient.prototype.handleHash = function (hash, state, serverTelemetryManager) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var cachedRequest, serverParams, nativeInteractionClient, userRequestState, currentAuthority, authClient, interactionHandler;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n cachedRequest = this.browserStorage.getCachedRequest(state, this.browserCrypto);\r\n this.logger.verbose(\"handleHash called, retrieved cached request\");\r\n serverParams = UrlString.getDeserializedHash(hash);\r\n if (serverParams.accountId) {\r\n this.logger.verbose(\"Account id found in hash, calling WAM for token\");\r\n if (!this.nativeMessageHandler) {\r\n throw BrowserAuthError.createNativeConnectionNotEstablishedError();\r\n }\r\n nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, cachedRequest.correlationId);\r\n userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;\r\n return [2 /*return*/, nativeInteractionClient.acquireToken(__assign(__assign({}, cachedRequest), { state: userRequestState, prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently\r\n })).finally(function () {\r\n _this.browserStorage.cleanRequestByState(state);\r\n })];\r\n }\r\n currentAuthority = this.browserStorage.getCachedAuthority(state);\r\n if (!currentAuthority) {\r\n throw BrowserAuthError.createNoCachedAuthorityError();\r\n }\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, cachedRequest.correlationId);\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, currentAuthority)];\r\n case 1:\r\n authClient = _a.sent();\r\n this.logger.verbose(\"Auth code client created\");\r\n ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, cachedRequest);\r\n interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.browserCrypto, this.performanceClient);\r\n return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];\r\n case 2: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Default behaviour is to redirect the user to `window.location.href`.\r\n * @param logoutRequest\r\n */\r\n RedirectClient.prototype.logout = function (logoutRequest) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var validLogoutRequest, serverTelemetryManager, navigationOptions, authClient, logoutUri, navigate, e_3;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.verbose(\"logoutRedirect called\");\r\n validLogoutRequest = this.initializeLogoutRequest(logoutRequest);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logout);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 10, , 11]);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Redirect, logoutRequest);\r\n // Clear cache on logout\r\n return [4 /*yield*/, this.clearCacheOnLogout(validLogoutRequest.account)];\r\n case 2:\r\n // Clear cache on logout\r\n _a.sent();\r\n navigationOptions = {\r\n apiId: ApiId.logout,\r\n timeout: this.config.system.redirectNavigationTimeout,\r\n noHistory: false\r\n };\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validLogoutRequest.correlationId);\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, logoutRequest && logoutRequest.authority)];\r\n case 3:\r\n authClient = _a.sent();\r\n this.logger.verbose(\"Auth code client created\");\r\n logoutUri = authClient.getLogoutUri(validLogoutRequest);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Redirect, validLogoutRequest);\r\n if (!(logoutRequest && typeof logoutRequest.onRedirectNavigate === \"function\")) return [3 /*break*/, 7];\r\n navigate = logoutRequest.onRedirectNavigate(logoutUri);\r\n if (!(navigate !== false)) return [3 /*break*/, 5];\r\n this.logger.verbose(\"Logout onRedirectNavigate did not return false, navigating\");\r\n // Ensure interaction is in progress\r\n if (!this.browserStorage.getInteractionInProgress()) {\r\n this.browserStorage.setInteractionInProgress(true);\r\n }\r\n return [4 /*yield*/, this.navigationClient.navigateExternal(logoutUri, navigationOptions)];\r\n case 4:\r\n _a.sent();\r\n return [2 /*return*/];\r\n case 5:\r\n // Ensure interaction is not in progress\r\n this.browserStorage.setInteractionInProgress(false);\r\n this.logger.verbose(\"Logout onRedirectNavigate returned false, stopping navigation\");\r\n _a.label = 6;\r\n case 6: return [3 /*break*/, 9];\r\n case 7:\r\n // Ensure interaction is in progress\r\n if (!this.browserStorage.getInteractionInProgress()) {\r\n this.browserStorage.setInteractionInProgress(true);\r\n }\r\n return [4 /*yield*/, this.navigationClient.navigateExternal(logoutUri, navigationOptions)];\r\n case 8:\r\n _a.sent();\r\n return [2 /*return*/];\r\n case 9: return [3 /*break*/, 11];\r\n case 10:\r\n e_3 = _a.sent();\r\n if (e_3 instanceof AuthError) {\r\n e_3.setCorrelationId(this.correlationId);\r\n }\r\n serverTelemetryManager.cacheFailedRequest(e_3);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Redirect, null, e_3);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Redirect);\r\n throw e_3;\r\n case 11:\r\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Redirect);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Use to get the redirectStartPage either from request or use current window\r\n * @param requestStartPage\r\n */\r\n RedirectClient.prototype.getRedirectStartPage = function (requestStartPage) {\r\n var redirectStartPage = requestStartPage || window.location.href;\r\n return UrlString.getAbsoluteUrl(redirectStartPage, BrowserUtils.getCurrentUri());\r\n };\r\n return RedirectClient;\r\n}(StandardInteractionClient));\n\nexport { RedirectClient };\n//# sourceMappingURL=RedirectClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { OIDC_DEFAULT_SCOPES, StringUtils, UrlString, Constants, AuthError, ThrottlingUtils, ProtocolUtils, PerformanceEvents } from '@azure/msal-common';\nimport { StandardInteractionClient } from './StandardInteractionClient.js';\nimport { EventType } from '../event/EventType.js';\nimport { BrowserConstants, InteractionType, ApiId } from '../utils/BrowserConstants.js';\nimport { BrowserUtils } from '../utils/BrowserUtils.js';\nimport { NativeInteractionClient } from './NativeInteractionClient.js';\nimport { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { InteractionHandler } from '../interaction_handler/InteractionHandler.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar PopupClient = /** @class */ (function (_super) {\r\n __extends(PopupClient, _super);\r\n function PopupClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {\r\n var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;\r\n // Properly sets this reference for the unload event.\r\n _this.unloadWindow = _this.unloadWindow.bind(_this);\r\n _this.nativeStorage = nativeStorageImpl;\r\n return _this;\r\n }\r\n /**\r\n * Acquires tokens by opening a popup window to the /authorize endpoint of the authority\r\n * @param request\r\n */\r\n PopupClient.prototype.acquireToken = function (request) {\r\n try {\r\n var popupName = this.generatePopupName(request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority);\r\n var popupWindowAttributes = request.popupWindowAttributes || {};\r\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\r\n if (this.config.system.asyncPopups) {\r\n this.logger.verbose(\"asyncPopups set to true, acquiring token\");\r\n // Passes on popup position and dimensions if in request\r\n return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);\r\n }\r\n else {\r\n // asyncPopups flag is set to false. Opens popup before acquiring token.\r\n this.logger.verbose(\"asyncPopup set to false, opening popup before acquiring token\");\r\n var popup = this.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes);\r\n return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);\r\n }\r\n }\r\n catch (e) {\r\n return Promise.reject(e);\r\n }\r\n };\r\n /**\r\n * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server\r\n * @param logoutRequest\r\n */\r\n PopupClient.prototype.logout = function (logoutRequest) {\r\n try {\r\n this.logger.verbose(\"logoutPopup called\");\r\n var validLogoutRequest = this.initializeLogoutRequest(logoutRequest);\r\n var popupName = this.generateLogoutPopupName(validLogoutRequest);\r\n var authority = logoutRequest && logoutRequest.authority;\r\n var mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;\r\n var popupWindowAttributes = (logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.popupWindowAttributes) || {};\r\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\r\n if (this.config.system.asyncPopups) {\r\n this.logger.verbose(\"asyncPopups set to true\");\r\n // Passes on popup position and dimensions if in request\r\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, undefined, mainWindowRedirectUri);\r\n }\r\n else {\r\n // asyncPopups flag is set to false. Opens popup before logging out.\r\n this.logger.verbose(\"asyncPopup set to false, opening popup\");\r\n var popup = this.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes);\r\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, popup, mainWindowRedirectUri);\r\n }\r\n }\r\n catch (e) {\r\n // Since this function is synchronous we need to reject\r\n return Promise.reject(e);\r\n }\r\n };\r\n /**\r\n * Helper which obtains an access_token for your API via opening a popup window in the user's browser\r\n * @param validRequest\r\n * @param popupName\r\n * @param popup\r\n * @param popupWindowAttributes\r\n *\r\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\r\n */\r\n PopupClient.prototype.acquireTokenPopupAsync = function (request, popupName, popupWindowAttributes, popup) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var serverTelemetryManager, validRequest, authCodeRequest, authClient, isNativeBroker, fetchNativeAccountIdMeasurement, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, serverParams, state_1, nativeInteractionClient, userRequestState, result, e_1;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.verbose(\"acquireTokenPopupAsync called\");\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);\r\n return [4 /*yield*/, this.initializeAuthorizationRequest(request, InteractionType.Popup)];\r\n case 1:\r\n validRequest = _a.sent();\r\n this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 8, , 9]);\r\n // Create auth code request and generate PKCE params\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);\r\n return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];\r\n case 3:\r\n authCodeRequest = _a.sent();\r\n // Initialize the client\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];\r\n case 4:\r\n authClient = _a.sent();\r\n this.logger.verbose(\"Auth code client created\");\r\n isNativeBroker = NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);\r\n fetchNativeAccountIdMeasurement = void 0;\r\n if (isNativeBroker) {\r\n fetchNativeAccountIdMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.FetchAccountIdWithNativeBroker, request.correlationId);\r\n }\r\n return [4 /*yield*/, authClient.getAuthCodeUrl(__assign(__assign({}, validRequest), { nativeBroker: isNativeBroker }))];\r\n case 5:\r\n navigateUrl = _a.sent();\r\n interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);\r\n popupParameters = {\r\n popup: popup,\r\n popupName: popupName,\r\n popupWindowAttributes: popupWindowAttributes\r\n };\r\n popupWindow = this.initiateAuthRequest(navigateUrl, popupParameters);\r\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow: popupWindow }, null);\r\n return [4 /*yield*/, this.monitorPopupForHash(popupWindow)];\r\n case 6:\r\n hash = _a.sent();\r\n serverParams = UrlString.getDeserializedHash(hash);\r\n state_1 = this.validateAndExtractStateFromHash(serverParams, InteractionType.Popup, validRequest.correlationId);\r\n // Remove throttle if it exists\r\n ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);\r\n if (serverParams.accountId) {\r\n this.logger.verbose(\"Account id found in hash, calling WAM for token\");\r\n // end measurement for server call with native brokering enabled\r\n if (fetchNativeAccountIdMeasurement) {\r\n fetchNativeAccountIdMeasurement.endMeasurement({\r\n success: true,\r\n isNativeBroker: true\r\n });\r\n }\r\n if (!this.nativeMessageHandler) {\r\n throw BrowserAuthError.createNativeConnectionNotEstablishedError();\r\n }\r\n nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, validRequest.correlationId);\r\n userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state_1).userRequestState;\r\n return [2 /*return*/, nativeInteractionClient.acquireToken(__assign(__assign({}, validRequest), { state: userRequestState, prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently\r\n })).finally(function () {\r\n _this.browserStorage.cleanRequestByState(state_1);\r\n })];\r\n }\r\n return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state_1, authClient.authority, this.networkClient)];\r\n case 7:\r\n result = _a.sent();\r\n return [2 /*return*/, result];\r\n case 8:\r\n e_1 = _a.sent();\r\n if (popup) {\r\n // Close the synchronous popup if an error is thrown before the window unload event is registered\r\n popup.close();\r\n }\r\n if (e_1 instanceof AuthError) {\r\n e_1.setCorrelationId(this.correlationId);\r\n }\r\n serverTelemetryManager.cacheFailedRequest(e_1);\r\n this.browserStorage.cleanRequestByState(validRequest.state);\r\n throw e_1;\r\n case 9: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n *\r\n * @param validRequest\r\n * @param popupName\r\n * @param requestAuthority\r\n * @param popup\r\n * @param mainWindowRedirectUri\r\n * @param popupWindowAttributes\r\n */\r\n PopupClient.prototype.logoutPopupAsync = function (validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var serverTelemetryManager, authClient, logoutUri, popupWindow, navigationOptions, absoluteUrl, e_2;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.verbose(\"logoutPopupAsync called\");\r\n this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Popup, validRequest);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 5, , 6]);\r\n // Clear cache on logout\r\n return [4 /*yield*/, this.clearCacheOnLogout(validRequest.account)];\r\n case 2:\r\n // Clear cache on logout\r\n _a.sent();\r\n // Initialize the client\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validRequest.correlationId);\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];\r\n case 3:\r\n authClient = _a.sent();\r\n this.logger.verbose(\"Auth code client created\");\r\n logoutUri = authClient.getLogoutUri(validRequest);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);\r\n popupWindow = this.openPopup(logoutUri, { popupName: popupName, popupWindowAttributes: popupWindowAttributes, popup: popup });\r\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow: popupWindow }, null);\r\n return [4 /*yield*/, this.waitForLogoutPopup(popupWindow)];\r\n case 4:\r\n _a.sent();\r\n if (mainWindowRedirectUri) {\r\n navigationOptions = {\r\n apiId: ApiId.logoutPopup,\r\n timeout: this.config.system.redirectNavigationTimeout,\r\n noHistory: false\r\n };\r\n absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());\r\n this.logger.verbose(\"Redirecting main window to url specified in the request\");\r\n this.logger.verbosePii(\"Redirecting main window to: \" + absoluteUrl);\r\n this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);\r\n }\r\n else {\r\n this.logger.verbose(\"No main window navigation requested\");\r\n }\r\n return [3 /*break*/, 6];\r\n case 5:\r\n e_2 = _a.sent();\r\n if (popup) {\r\n // Close the synchronous popup if an error is thrown before the window unload event is registered\r\n popup.close();\r\n }\r\n if (e_2 instanceof AuthError) {\r\n e_2.setCorrelationId(this.correlationId);\r\n }\r\n this.browserStorage.setInteractionInProgress(false);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e_2);\r\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\r\n serverTelemetryManager.cacheFailedRequest(e_2);\r\n throw e_2;\r\n case 6:\r\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Opens a popup window with given request Url.\r\n * @param requestUrl\r\n */\r\n PopupClient.prototype.initiateAuthRequest = function (requestUrl, params) {\r\n // Check that request url is not empty.\r\n if (!StringUtils.isEmpty(requestUrl)) {\r\n this.logger.infoPii(\"Navigate to: \" + requestUrl);\r\n // Open the popup window to requestUrl.\r\n return this.openPopup(requestUrl, params);\r\n }\r\n else {\r\n // Throw error if request URL is empty.\r\n this.logger.error(\"Navigate url is empty\");\r\n throw BrowserAuthError.createEmptyNavigationUriError();\r\n }\r\n };\r\n /**\r\n * Monitors a window until it loads a url with the same origin.\r\n * @param popupWindow - window that is being monitored\r\n * @param timeout - timeout for processing hash once popup is redirected back to application\r\n */\r\n PopupClient.prototype.monitorPopupForHash = function (popupWindow) {\r\n var _this = this;\r\n return new Promise(function (resolve, reject) {\r\n /*\r\n * Polling for popups needs to be tick-based,\r\n * since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).\r\n */\r\n var maxTicks = _this.config.system.windowHashTimeout / _this.config.system.pollIntervalMilliseconds;\r\n var ticks = 0;\r\n _this.logger.verbose(\"PopupHandler.monitorPopupForHash - polling started\");\r\n var intervalId = setInterval(function () {\r\n // Window is closed\r\n if (popupWindow.closed) {\r\n _this.logger.error(\"PopupHandler.monitorPopupForHash - window closed\");\r\n _this.cleanPopup();\r\n clearInterval(intervalId);\r\n reject(BrowserAuthError.createUserCancelledError());\r\n return;\r\n }\r\n var href = Constants.EMPTY_STRING;\r\n var hash = Constants.EMPTY_STRING;\r\n try {\r\n /*\r\n * Will throw if cross origin,\r\n * which should be caught and ignored\r\n * since we need the interval to keep running while on STS UI.\r\n */\r\n href = popupWindow.location.href;\r\n hash = popupWindow.location.hash;\r\n }\r\n catch (e) { }\r\n // Don't process blank pages or cross domain\r\n if (StringUtils.isEmpty(href) || href === \"about:blank\") {\r\n return;\r\n }\r\n _this.logger.verbose(\"PopupHandler.monitorPopupForHash - popup window is on same origin as caller\");\r\n /*\r\n * Only run clock when we are on same domain for popups\r\n * as popup operations can take a long time.\r\n */\r\n ticks++;\r\n if (hash) {\r\n _this.logger.verbose(\"PopupHandler.monitorPopupForHash - found hash in url\");\r\n clearInterval(intervalId);\r\n _this.cleanPopup(popupWindow);\r\n if (UrlString.hashContainsKnownProperties(hash)) {\r\n _this.logger.verbose(\"PopupHandler.monitorPopupForHash - hash contains known properties, returning.\");\r\n resolve(hash);\r\n }\r\n else {\r\n _this.logger.error(\"PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely.\");\r\n _this.logger.errorPii(\"PopupHandler.monitorPopupForHash - hash found: \" + hash);\r\n reject(BrowserAuthError.createHashDoesNotContainKnownPropertiesError());\r\n }\r\n }\r\n else if (ticks > maxTicks) {\r\n _this.logger.error(\"PopupHandler.monitorPopupForHash - unable to find hash in url, timing out\");\r\n clearInterval(intervalId);\r\n reject(BrowserAuthError.createMonitorPopupTimeoutError());\r\n }\r\n }, _this.config.system.pollIntervalMilliseconds);\r\n });\r\n };\r\n /**\r\n * Waits for user interaction in logout popup window\r\n * @param popupWindow\r\n * @returns\r\n */\r\n PopupClient.prototype.waitForLogoutPopup = function (popupWindow) {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n _this.logger.verbose(\"PopupHandler.waitForLogoutPopup - polling started\");\r\n var intervalId = setInterval(function () {\r\n // Window is closed\r\n if (popupWindow.closed) {\r\n _this.logger.error(\"PopupHandler.waitForLogoutPopup - window closed\");\r\n _this.cleanPopup();\r\n clearInterval(intervalId);\r\n resolve();\r\n }\r\n var href = Constants.EMPTY_STRING;\r\n try {\r\n /*\r\n * Will throw if cross origin,\r\n * which should be caught and ignored\r\n * since we need the interval to keep running while on STS UI.\r\n */\r\n href = popupWindow.location.href;\r\n }\r\n catch (e) { }\r\n // Don't process blank pages or cross domain\r\n if (StringUtils.isEmpty(href) || href === \"about:blank\") {\r\n return;\r\n }\r\n _this.logger.verbose(\"PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing.\");\r\n clearInterval(intervalId);\r\n _this.cleanPopup(popupWindow);\r\n resolve();\r\n }, _this.config.system.pollIntervalMilliseconds);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n *\r\n * Configures popup window for login.\r\n *\r\n * @param urlNavigate\r\n * @param title\r\n * @param popUpWidth\r\n * @param popUpHeight\r\n * @param popupWindowAttributes\r\n * @ignore\r\n * @hidden\r\n */\r\n PopupClient.prototype.openPopup = function (urlNavigate, popupParams) {\r\n try {\r\n var popupWindow = void 0;\r\n // Popup window passed in, setting url to navigate to\r\n if (popupParams.popup) {\r\n popupWindow = popupParams.popup;\r\n this.logger.verbosePii(\"Navigating popup window to: \" + urlNavigate);\r\n popupWindow.location.assign(urlNavigate);\r\n }\r\n else if (typeof popupParams.popup === \"undefined\") {\r\n // Popup will be undefined if it was not passed in\r\n this.logger.verbosePii(\"Opening popup window to: \" + urlNavigate);\r\n popupWindow = this.openSizedPopup(urlNavigate, popupParams.popupName, popupParams.popupWindowAttributes);\r\n }\r\n // Popup will be null if popups are blocked\r\n if (!popupWindow) {\r\n throw BrowserAuthError.createEmptyWindowCreatedError();\r\n }\r\n if (popupWindow.focus) {\r\n popupWindow.focus();\r\n }\r\n this.currentWindow = popupWindow;\r\n window.addEventListener(\"beforeunload\", this.unloadWindow);\r\n return popupWindow;\r\n }\r\n catch (e) {\r\n this.logger.error(\"error opening popup \" + e.message);\r\n this.browserStorage.setInteractionInProgress(false);\r\n throw BrowserAuthError.createPopupWindowError(e.toString());\r\n }\r\n };\r\n /**\r\n * Helper function to set popup window dimensions and position\r\n * @param urlNavigate\r\n * @param popupName\r\n * @param popupWindowAttributes\r\n * @returns\r\n */\r\n PopupClient.prototype.openSizedPopup = function (urlNavigate, popupName, popupWindowAttributes) {\r\n var _a, _b, _c, _d;\r\n /**\r\n * adding winLeft and winTop to account for dual monitor\r\n * using screenLeft and screenTop for IE8 and earlier\r\n */\r\n var winLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n var winTop = window.screenTop ? window.screenTop : window.screenY;\r\n /**\r\n * window.innerWidth displays browser window\"s height and width excluding toolbars\r\n * using document.documentElement.clientWidth for IE8 and earlier\r\n */\r\n var winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\r\n var winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\r\n var width = (_a = popupWindowAttributes.popupSize) === null || _a === void 0 ? void 0 : _a.width;\r\n var height = (_b = popupWindowAttributes.popupSize) === null || _b === void 0 ? void 0 : _b.height;\r\n var top = (_c = popupWindowAttributes.popupPosition) === null || _c === void 0 ? void 0 : _c.top;\r\n var left = (_d = popupWindowAttributes.popupPosition) === null || _d === void 0 ? void 0 : _d.left;\r\n if (!width || width < 0 || width > winWidth) {\r\n this.logger.verbose(\"Default popup window width used. Window width not configured or invalid.\");\r\n width = BrowserConstants.POPUP_WIDTH;\r\n }\r\n if (!height || height < 0 || height > winHeight) {\r\n this.logger.verbose(\"Default popup window height used. Window height not configured or invalid.\");\r\n height = BrowserConstants.POPUP_HEIGHT;\r\n }\r\n if (!top || top < 0 || top > winHeight) {\r\n this.logger.verbose(\"Default popup window top position used. Window top not configured or invalid.\");\r\n top = Math.max(0, ((winHeight / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop);\r\n }\r\n if (!left || left < 0 || left > winWidth) {\r\n this.logger.verbose(\"Default popup window left position used. Window left not configured or invalid.\");\r\n left = Math.max(0, ((winWidth / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft);\r\n }\r\n return window.open(urlNavigate, popupName, \"width=\" + width + \", height=\" + height + \", top=\" + top + \", left=\" + left + \", scrollbars=yes\");\r\n };\r\n /**\r\n * Event callback to unload main window.\r\n */\r\n PopupClient.prototype.unloadWindow = function (e) {\r\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Popup);\r\n if (this.currentWindow) {\r\n this.currentWindow.close();\r\n }\r\n // Guarantees browser unload will happen, so no other errors will be thrown.\r\n e.preventDefault();\r\n };\r\n /**\r\n * Closes popup, removes any state vars created during popup calls.\r\n * @param popupWindow\r\n */\r\n PopupClient.prototype.cleanPopup = function (popupWindow) {\r\n if (popupWindow) {\r\n // Close window.\r\n popupWindow.close();\r\n }\r\n // Remove window unload function\r\n window.removeEventListener(\"beforeunload\", this.unloadWindow);\r\n // Interaction is completed - remove interaction status.\r\n this.browserStorage.setInteractionInProgress(false);\r\n };\r\n /**\r\n * Generates the name for the popup based on the client id and request\r\n * @param clientId\r\n * @param request\r\n */\r\n PopupClient.prototype.generatePopupName = function (scopes, authority) {\r\n return BrowserConstants.POPUP_NAME_PREFIX + \".\" + this.config.auth.clientId + \".\" + scopes.join(\"-\") + \".\" + authority + \".\" + this.correlationId;\r\n };\r\n /**\r\n * Generates the name for the popup based on the client id and request for logouts\r\n * @param clientId\r\n * @param request\r\n */\r\n PopupClient.prototype.generateLogoutPopupName = function (request) {\r\n var homeAccountId = request.account && request.account.homeAccountId;\r\n return BrowserConstants.POPUP_NAME_PREFIX + \".\" + this.config.auth.clientId + \".\" + homeAccountId + \".\" + this.correlationId;\r\n };\r\n return PopupClient;\r\n}(StandardInteractionClient));\n\nexport { PopupClient };\n//# sourceMappingURL=PopupClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar NavigationClient = /** @class */ (function () {\r\n function NavigationClient() {\r\n }\r\n /**\r\n * Navigates to other pages within the same web application\r\n * @param url\r\n * @param options\r\n */\r\n NavigationClient.prototype.navigateInternal = function (url, options) {\r\n return NavigationClient.defaultNavigateWindow(url, options);\r\n };\r\n /**\r\n * Navigates to other pages outside the web application i.e. the Identity Provider\r\n * @param url\r\n * @param options\r\n */\r\n NavigationClient.prototype.navigateExternal = function (url, options) {\r\n return NavigationClient.defaultNavigateWindow(url, options);\r\n };\r\n /**\r\n * Default navigation implementation invoked by the internal and external functions\r\n * @param url\r\n * @param options\r\n */\r\n NavigationClient.defaultNavigateWindow = function (url, options) {\r\n if (options.noHistory) {\r\n window.location.replace(url);\r\n }\r\n else {\r\n window.location.assign(url);\r\n }\r\n return new Promise(function (resolve) {\r\n setTimeout(function () {\r\n resolve(true);\r\n }, options.timeout);\r\n });\r\n };\r\n return NavigationClient;\r\n}());\n\nexport { NavigationClient };\n//# sourceMappingURL=NavigationClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __assign } from '../_virtual/_tslib.js';\nimport { DEFAULT_SYSTEM_OPTIONS, StubbedNetworkModule, Constants, ProtocolMode, AzureCloudInstance, LogLevel } from '@azure/msal-common';\nimport { BrowserUtils } from '../utils/BrowserUtils.js';\nimport { BrowserConstants, BrowserCacheLocation } from '../utils/BrowserConstants.js';\nimport { NavigationClient } from '../navigation/NavigationClient.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n// Default timeout for popup windows and iframes in milliseconds\r\nvar DEFAULT_POPUP_TIMEOUT_MS = 60000;\r\nvar DEFAULT_IFRAME_TIMEOUT_MS = 6000;\r\nvar DEFAULT_REDIRECT_TIMEOUT_MS = 30000;\r\nvar DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS = 2000;\r\n/**\r\n * MSAL function that sets the default options when not explicitly configured from app developer\r\n *\r\n * @param auth\r\n * @param cache\r\n * @param system\r\n *\r\n * @returns Configuration object\r\n */\r\nfunction buildConfiguration(_a, isBrowserEnvironment) {\r\n var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system, userInputTelemetry = _a.telemetry;\r\n // Default auth options for browser\r\n var DEFAULT_AUTH_OPTIONS = {\r\n clientId: Constants.EMPTY_STRING,\r\n authority: \"\" + Constants.DEFAULT_AUTHORITY,\r\n knownAuthorities: [],\r\n cloudDiscoveryMetadata: Constants.EMPTY_STRING,\r\n authorityMetadata: Constants.EMPTY_STRING,\r\n redirectUri: Constants.EMPTY_STRING,\r\n postLogoutRedirectUri: Constants.EMPTY_STRING,\r\n navigateToLoginRequestUrl: true,\r\n clientCapabilities: [],\r\n protocolMode: ProtocolMode.AAD,\r\n azureCloudOptions: {\r\n azureCloudInstance: AzureCloudInstance.None,\r\n tenant: Constants.EMPTY_STRING\r\n },\r\n skipAuthorityMetadataCache: false,\r\n };\r\n // Default cache options for browser\r\n var DEFAULT_CACHE_OPTIONS = {\r\n cacheLocation: BrowserCacheLocation.SessionStorage,\r\n temporaryCacheLocation: BrowserCacheLocation.SessionStorage,\r\n storeAuthStateInCookie: false,\r\n secureCookies: false,\r\n // Default cache migration to true if cache location is localStorage since entries are preserved across tabs/windows. Migration has little to no benefit in sessionStorage and memoryStorage\r\n cacheMigrationEnabled: userInputCache && userInputCache.cacheLocation === BrowserCacheLocation.LocalStorage ? true : false\r\n };\r\n // Default logger options for browser\r\n var DEFAULT_LOGGER_OPTIONS = {\r\n // eslint-disable-next-line @typescript-eslint/no-empty-function\r\n loggerCallback: function () {\r\n // allow users to not set logger call back \r\n },\r\n logLevel: LogLevel.Info,\r\n piiLoggingEnabled: false\r\n };\r\n // Default system options for browser\r\n var DEFAULT_BROWSER_SYSTEM_OPTIONS = __assign(__assign({}, DEFAULT_SYSTEM_OPTIONS), { loggerOptions: DEFAULT_LOGGER_OPTIONS, networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule, navigationClient: new NavigationClient(), loadFrameTimeout: 0, \r\n // If loadFrameTimeout is provided, use that as default.\r\n windowHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false, allowNativeBroker: false, nativeBrokerHandshakeTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.nativeBrokerHandshakeTimeout) || DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS, pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS, cryptoOptions: {\r\n useMsrCrypto: false,\r\n entropy: undefined\r\n } });\r\n var providedSystemOptions = __assign(__assign({}, userInputSystem), { loggerOptions: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loggerOptions) || DEFAULT_LOGGER_OPTIONS });\r\n var DEFAULT_TELEMETRY_OPTIONS = {\r\n application: {\r\n appName: Constants.EMPTY_STRING,\r\n appVersion: Constants.EMPTY_STRING\r\n }\r\n };\r\n var overlayedConfig = {\r\n auth: __assign(__assign({}, DEFAULT_AUTH_OPTIONS), userInputAuth),\r\n cache: __assign(__assign({}, DEFAULT_CACHE_OPTIONS), userInputCache),\r\n system: __assign(__assign({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), providedSystemOptions),\r\n telemetry: __assign(__assign({}, DEFAULT_TELEMETRY_OPTIONS), userInputTelemetry)\r\n };\r\n return overlayedConfig;\r\n}\n\nexport { DEFAULT_IFRAME_TIMEOUT_MS, DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS, DEFAULT_POPUP_TIMEOUT_MS, DEFAULT_REDIRECT_TIMEOUT_MS, buildConfiguration };\n//# sourceMappingURL=Configuration.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { PerformanceEvents, StringUtils, Constants, UrlString } from '@azure/msal-common';\nimport { InteractionHandler } from './InteractionHandler.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { DEFAULT_IFRAME_TIMEOUT_MS } from '../config/Configuration.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar SilentHandler = /** @class */ (function (_super) {\r\n __extends(SilentHandler, _super);\r\n function SilentHandler(authCodeModule, storageImpl, authCodeRequest, logger, systemOptions, performanceClient) {\r\n var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger, performanceClient) || this;\r\n _this.navigateFrameWait = systemOptions.navigateFrameWait;\r\n _this.pollIntervalMilliseconds = systemOptions.pollIntervalMilliseconds;\r\n return _this;\r\n }\r\n /**\r\n * Creates a hidden iframe to given URL using user-requested scopes as an id.\r\n * @param urlNavigate\r\n * @param userRequestScopes\r\n */\r\n SilentHandler.prototype.initiateAuthRequest = function (requestUrl) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerInitiateAuthRequest, this.authCodeRequest.correlationId);\r\n if (StringUtils.isEmpty(requestUrl)) {\r\n // Throw error if request URL is empty.\r\n this.logger.info(\"Navigate url is empty\");\r\n throw BrowserAuthError.createEmptyNavigationUriError();\r\n }\r\n if (!this.navigateFrameWait) return [3 /*break*/, 2];\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);\r\n return [4 /*yield*/, this.loadFrame(requestUrl)];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n case 2: return [2 /*return*/, this.loadFrameSync(requestUrl)];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Monitors an iframe content window until it loads a url with a known hash, or hits a specified timeout.\r\n * @param iframe\r\n * @param timeout\r\n */\r\n SilentHandler.prototype.monitorIframeForHash = function (iframe, timeout) {\r\n var _this = this;\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerMonitorIframeForHash, this.authCodeRequest.correlationId);\r\n return new Promise(function (resolve, reject) {\r\n if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {\r\n _this.logger.warning(\"system.loadFrameTimeout or system.iframeHashTimeout set to lower (\" + timeout + \"ms) than the default (\" + DEFAULT_IFRAME_TIMEOUT_MS + \"ms). This may result in timeouts.\");\r\n }\r\n /*\r\n * Polling for iframes can be purely timing based,\r\n * since we don't need to account for interaction.\r\n */\r\n var nowMark = window.performance.now();\r\n var timeoutMark = nowMark + timeout;\r\n var intervalId = setInterval(function () {\r\n if (window.performance.now() > timeoutMark) {\r\n _this.removeHiddenIframe(iframe);\r\n clearInterval(intervalId);\r\n reject(BrowserAuthError.createMonitorIframeTimeoutError());\r\n return;\r\n }\r\n var href = Constants.EMPTY_STRING;\r\n var contentWindow = iframe.contentWindow;\r\n try {\r\n /*\r\n * Will throw if cross origin,\r\n * which should be caught and ignored\r\n * since we need the interval to keep running while on STS UI.\r\n */\r\n href = contentWindow ? contentWindow.location.href : Constants.EMPTY_STRING;\r\n }\r\n catch (e) { }\r\n if (StringUtils.isEmpty(href)) {\r\n return;\r\n }\r\n var contentHash = contentWindow ? contentWindow.location.hash : Constants.EMPTY_STRING;\r\n if (UrlString.hashContainsKnownProperties(contentHash)) {\r\n // Success case\r\n _this.removeHiddenIframe(iframe);\r\n clearInterval(intervalId);\r\n resolve(contentHash);\r\n return;\r\n }\r\n }, _this.pollIntervalMilliseconds);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n * Loads iframe with authorization endpoint URL\r\n * @ignore\r\n */\r\n SilentHandler.prototype.loadFrame = function (urlNavigate) {\r\n var _this = this;\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);\r\n /*\r\n * This trick overcomes iframe navigation in IE\r\n * IE does not load the page consistently in iframe\r\n */\r\n return new Promise(function (resolve, reject) {\r\n var frameHandle = _this.createHiddenIframe();\r\n setTimeout(function () {\r\n if (!frameHandle) {\r\n reject(\"Unable to load iframe\");\r\n return;\r\n }\r\n frameHandle.src = urlNavigate;\r\n resolve(frameHandle);\r\n }, _this.navigateFrameWait);\r\n });\r\n };\r\n /**\r\n * @hidden\r\n * Loads the iframe synchronously when the navigateTimeFrame is set to `0`\r\n * @param urlNavigate\r\n * @param frameName\r\n * @param logger\r\n */\r\n SilentHandler.prototype.loadFrameSync = function (urlNavigate) {\r\n var frameHandle = this.createHiddenIframe();\r\n frameHandle.src = urlNavigate;\r\n return frameHandle;\r\n };\r\n /**\r\n * @hidden\r\n * Creates a new hidden iframe or gets an existing one for silent token renewal.\r\n * @ignore\r\n */\r\n SilentHandler.prototype.createHiddenIframe = function () {\r\n var authFrame = document.createElement(\"iframe\");\r\n authFrame.style.visibility = \"hidden\";\r\n authFrame.style.position = \"absolute\";\r\n authFrame.style.width = authFrame.style.height = \"0\";\r\n authFrame.style.border = \"0\";\r\n authFrame.setAttribute(\"sandbox\", \"allow-scripts allow-same-origin allow-forms\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(authFrame);\r\n return authFrame;\r\n };\r\n /**\r\n * @hidden\r\n * Removes a hidden iframe from the page.\r\n * @ignore\r\n */\r\n SilentHandler.prototype.removeHiddenIframe = function (iframe) {\r\n if (document.body === iframe.parentNode) {\r\n document.body.removeChild(iframe);\r\n }\r\n };\r\n return SilentHandler;\r\n}(InteractionHandler));\n\nexport { SilentHandler };\n//# sourceMappingURL=SilentHandler.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { AuthError, PerformanceEvents, Constants, StringUtils, PromptValue, UrlString, ProtocolUtils } from '@azure/msal-common';\nimport { StandardInteractionClient } from './StandardInteractionClient.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { InteractionType } from '../utils/BrowserConstants.js';\nimport { SilentHandler } from '../interaction_handler/SilentHandler.js';\nimport { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.js';\nimport { NativeInteractionClient } from './NativeInteractionClient.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar SilentIframeClient = /** @class */ (function (_super) {\r\n __extends(SilentIframeClient, _super);\r\n function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {\r\n var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;\r\n _this.apiId = apiId;\r\n _this.nativeStorage = nativeStorageImpl;\r\n return _this;\r\n }\r\n /**\r\n * Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none or prompt=no_session\r\n * @param request\r\n */\r\n SilentIframeClient.prototype.acquireToken = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var acquireTokenMeasurement, silentRequest, serverTelemetryManager, authClient, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);\r\n this.logger.verbose(\"acquireTokenByIframe called\");\r\n acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);\r\n // Check that we have some SSO data\r\n if (StringUtils.isEmpty(request.loginHint) && StringUtils.isEmpty(request.sid) && (!request.account || StringUtils.isEmpty(request.account.username))) {\r\n this.logger.warning(\"No user hint provided. The authorization server may need more information to complete this request.\");\r\n }\r\n // Check that prompt is set to none or no_session, throw error if it is set to anything else.\r\n if (request.prompt && (request.prompt !== PromptValue.NONE) && (request.prompt !== PromptValue.NO_SESSION)) {\r\n acquireTokenMeasurement.endMeasurement({\r\n success: false\r\n });\r\n throw BrowserAuthError.createSilentPromptValueError(request.prompt);\r\n }\r\n // Create silent request\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);\r\n return [4 /*yield*/, this.initializeAuthorizationRequest(__assign(__assign({}, request), { prompt: request.prompt || PromptValue.NONE }), InteractionType.Silent)];\r\n case 1:\r\n silentRequest = _a.sent();\r\n this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 5, , 6]);\r\n // Initialize the client\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);\r\n return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];\r\n case 3:\r\n authClient = _a.sent();\r\n this.logger.verbose(\"Auth code client created\");\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.SilentIframeClientTokenHelper, request.correlationId);\r\n return [4 /*yield*/, this.silentTokenHelper(authClient, silentRequest).then(function (result) {\r\n acquireTokenMeasurement.endMeasurement({\r\n success: true,\r\n fromCache: false,\r\n requestId: result.requestId\r\n });\r\n return result;\r\n })];\r\n case 4: return [2 /*return*/, _a.sent()];\r\n case 5:\r\n e_1 = _a.sent();\r\n if (e_1 instanceof AuthError) {\r\n e_1.setCorrelationId(this.correlationId);\r\n }\r\n serverTelemetryManager.cacheFailedRequest(e_1);\r\n this.browserStorage.cleanRequestByState(silentRequest.state);\r\n acquireTokenMeasurement.endMeasurement({\r\n errorCode: e_1 instanceof AuthError && e_1.errorCode || undefined,\r\n subErrorCode: e_1 instanceof AuthError && e_1.subError || undefined,\r\n success: false\r\n });\r\n throw e_1;\r\n case 6: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Currently Unsupported\r\n */\r\n SilentIframeClient.prototype.logout = function () {\r\n // Synchronous so we must reject\r\n return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());\r\n };\r\n /**\r\n * Helper which acquires an authorization code silently using a hidden iframe from given url\r\n * using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.\r\n * @param navigateUrl\r\n * @param userRequestScopes\r\n */\r\n SilentIframeClient.prototype.silentTokenHelper = function (authClient, silentRequest) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var authCodeRequest, navigateUrl, silentHandler, msalFrame, hash, serverParams, state, nativeInteractionClient, userRequestState;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, silentRequest.correlationId);\r\n // Create auth code request and generate PKCE params\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, silentRequest.correlationId);\r\n return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];\r\n case 1:\r\n authCodeRequest = _a.sent();\r\n // Create authorize request url\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.GetAuthCodeUrl, silentRequest.correlationId);\r\n return [4 /*yield*/, authClient.getAuthCodeUrl(__assign(__assign({}, silentRequest), { nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme) }))];\r\n case 2:\r\n navigateUrl = _a.sent();\r\n silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);\r\n // Get the frame handle for the silent request\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerInitiateAuthRequest, silentRequest.correlationId);\r\n return [4 /*yield*/, silentHandler.initiateAuthRequest(navigateUrl)];\r\n case 3:\r\n msalFrame = _a.sent();\r\n // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerMonitorIframeForHash, silentRequest.correlationId);\r\n return [4 /*yield*/, silentHandler.monitorIframeForHash(msalFrame, this.config.system.iframeHashTimeout)];\r\n case 4:\r\n hash = _a.sent();\r\n serverParams = UrlString.getDeserializedHash(hash);\r\n state = this.validateAndExtractStateFromHash(serverParams, InteractionType.Silent, authCodeRequest.correlationId);\r\n if (serverParams.accountId) {\r\n this.logger.verbose(\"Account id found in hash, calling WAM for token\");\r\n if (!this.nativeMessageHandler) {\r\n throw BrowserAuthError.createNativeConnectionNotEstablishedError();\r\n }\r\n nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.apiId, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.browserStorage, this.correlationId);\r\n userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;\r\n return [2 /*return*/, nativeInteractionClient.acquireToken(__assign(__assign({}, silentRequest), { state: userRequestState, prompt: silentRequest.prompt || PromptValue.NONE })).finally(function () {\r\n _this.browserStorage.cleanRequestByState(state);\r\n })];\r\n }\r\n // Handle response from hash string\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.HandleCodeResponseFromHash, silentRequest.correlationId);\r\n return [2 /*return*/, silentHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];\r\n }\r\n });\r\n });\r\n };\r\n return SilentIframeClient;\r\n}(StandardInteractionClient));\n\nexport { SilentIframeClient };\n//# sourceMappingURL=SilentIframeClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { StandardInteractionClient } from './StandardInteractionClient.js';\nimport { PerformanceEvents, AuthError, RefreshTokenClient } from '@azure/msal-common';\nimport { ApiId } from '../utils/BrowserConstants.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar SilentRefreshClient = /** @class */ (function (_super) {\r\n __extends(SilentRefreshClient, _super);\r\n function SilentRefreshClient() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Exchanges the refresh token for new tokens\r\n * @param request\r\n */\r\n SilentRefreshClient.prototype.acquireToken = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentRequest, _a, acquireTokenMeasurement, serverTelemetryManager, refreshTokenClient;\r\n var _this = this;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, request.correlationId);\r\n _a = [__assign({}, request)];\r\n return [4 /*yield*/, this.initializeBaseRequest(request, request.account)];\r\n case 1:\r\n silentRequest = __assign.apply(void 0, _a.concat([_b.sent()]));\r\n acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);\r\n return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];\r\n case 2:\r\n refreshTokenClient = _b.sent();\r\n this.logger.verbose(\"Refresh token client created\");\r\n // Send request to renew token. Auth module will throw errors if token cannot be renewed.\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);\r\n return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest)\r\n .then(function (result) {\r\n acquireTokenMeasurement.endMeasurement({\r\n success: true,\r\n fromCache: result.fromCache,\r\n requestId: result.requestId\r\n });\r\n return result;\r\n })\r\n .catch(function (e) {\r\n if (e instanceof AuthError) {\r\n e.setCorrelationId(_this.correlationId);\r\n }\r\n serverTelemetryManager.cacheFailedRequest(e);\r\n acquireTokenMeasurement.endMeasurement({\r\n errorCode: e.errorCode,\r\n subErrorCode: e.subError,\r\n success: false\r\n });\r\n throw e;\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Currently Unsupported\r\n */\r\n SilentRefreshClient.prototype.logout = function () {\r\n // Synchronous so we must reject\r\n return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());\r\n };\r\n /**\r\n * Creates a Refresh Client with the given authority, or the default authority.\r\n * @param serverTelemetryManager\r\n * @param authorityUrl\r\n */\r\n SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var clientConfig;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // Create auth module.\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);\r\n return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];\r\n case 1:\r\n clientConfig = _a.sent();\r\n return [2 /*return*/, new RefreshTokenClient(clientConfig, this.performanceClient)];\r\n }\r\n });\r\n });\r\n };\r\n return SilentRefreshClient;\r\n}(StandardInteractionClient));\n\nexport { SilentRefreshClient };\n//# sourceMappingURL=SilentRefreshClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { AccountEntity, CacheManager } from '@azure/msal-common';\nimport { EventType } from './EventType.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar EventHandler = /** @class */ (function () {\r\n function EventHandler(logger, browserCrypto) {\r\n this.eventCallbacks = new Map();\r\n this.logger = logger;\r\n this.browserCrypto = browserCrypto;\r\n this.listeningToStorageEvents = false;\r\n this.handleAccountCacheChange = this.handleAccountCacheChange.bind(this);\r\n }\r\n /**\r\n * Adds event callbacks to array\r\n * @param callback\r\n */\r\n EventHandler.prototype.addEventCallback = function (callback) {\r\n if (typeof window !== \"undefined\") {\r\n var callbackId = this.browserCrypto.createNewGuid();\r\n this.eventCallbacks.set(callbackId, callback);\r\n this.logger.verbose(\"Event callback registered with id: \" + callbackId);\r\n return callbackId;\r\n }\r\n return null;\r\n };\r\n /**\r\n * Removes callback with provided id from callback array\r\n * @param callbackId\r\n */\r\n EventHandler.prototype.removeEventCallback = function (callbackId) {\r\n this.eventCallbacks.delete(callbackId);\r\n this.logger.verbose(\"Event callback \" + callbackId + \" removed.\");\r\n };\r\n /**\r\n * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window\r\n */\r\n EventHandler.prototype.enableAccountStorageEvents = function () {\r\n if (typeof window === \"undefined\") {\r\n return;\r\n }\r\n if (!this.listeningToStorageEvents) {\r\n this.logger.verbose(\"Adding account storage listener.\");\r\n this.listeningToStorageEvents = true;\r\n window.addEventListener(\"storage\", this.handleAccountCacheChange);\r\n }\r\n else {\r\n this.logger.verbose(\"Account storage listener already registered.\");\r\n }\r\n };\r\n /**\r\n * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window\r\n */\r\n EventHandler.prototype.disableAccountStorageEvents = function () {\r\n if (typeof window === \"undefined\") {\r\n return;\r\n }\r\n if (this.listeningToStorageEvents) {\r\n this.logger.verbose(\"Removing account storage listener.\");\r\n window.removeEventListener(\"storage\", this.handleAccountCacheChange);\r\n this.listeningToStorageEvents = false;\r\n }\r\n else {\r\n this.logger.verbose(\"No account storage listener registered.\");\r\n }\r\n };\r\n /**\r\n * Emits events by calling callback with event message\r\n * @param eventType\r\n * @param interactionType\r\n * @param payload\r\n * @param error\r\n */\r\n EventHandler.prototype.emitEvent = function (eventType, interactionType, payload, error) {\r\n var _this = this;\r\n if (typeof window !== \"undefined\") {\r\n var message_1 = {\r\n eventType: eventType,\r\n interactionType: interactionType || null,\r\n payload: payload || null,\r\n error: error || null,\r\n timestamp: Date.now()\r\n };\r\n this.logger.info(\"Emitting event: \" + eventType);\r\n this.eventCallbacks.forEach(function (callback, callbackId) {\r\n _this.logger.verbose(\"Emitting event to callback \" + callbackId + \": \" + eventType);\r\n callback.apply(null, [message_1]);\r\n });\r\n }\r\n };\r\n /**\r\n * Emit account added/removed events when cached accounts are changed in a different tab or frame\r\n */\r\n EventHandler.prototype.handleAccountCacheChange = function (e) {\r\n try {\r\n var cacheValue = e.newValue || e.oldValue;\r\n if (!cacheValue) {\r\n return;\r\n }\r\n var parsedValue = JSON.parse(cacheValue);\r\n if (typeof parsedValue !== \"object\" || !AccountEntity.isAccountEntity(parsedValue)) {\r\n return;\r\n }\r\n var accountEntity = CacheManager.toObject(new AccountEntity(), parsedValue);\r\n var accountInfo = accountEntity.getAccountInfo();\r\n if (!e.oldValue && e.newValue) {\r\n this.logger.info(\"Account was added to cache in a different window\");\r\n this.emitEvent(EventType.ACCOUNT_ADDED, undefined, accountInfo);\r\n }\r\n else if (!e.newValue && e.oldValue) {\r\n this.logger.info(\"Account was removed from cache in a different window\");\r\n this.emitEvent(EventType.ACCOUNT_REMOVED, undefined, accountInfo);\r\n }\r\n }\r\n catch (e) {\r\n return;\r\n }\r\n };\r\n return EventHandler;\r\n}());\n\nexport { EventHandler };\n//# sourceMappingURL=EventHandler.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Utility class for math specific functions in browser.\r\n */\r\nvar MathUtils = /** @class */ (function () {\r\n function MathUtils() {\r\n }\r\n /**\r\n * Decimal to Hex\r\n *\r\n * @param num\r\n */\r\n MathUtils.decimalToHex = function (num) {\r\n var hex = num.toString(16);\r\n while (hex.length < 2) {\r\n hex = \"0\" + hex;\r\n }\r\n return hex;\r\n };\r\n return MathUtils;\r\n}());\n\nexport { MathUtils };\n//# sourceMappingURL=MathUtils.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { Constants } from '@azure/msal-common';\nimport { MathUtils } from '../utils/MathUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar GuidGenerator = /** @class */ (function () {\r\n function GuidGenerator(cryptoObj) {\r\n this.cryptoObj = cryptoObj;\r\n }\r\n /*\r\n * RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or\r\n * pseudo-random numbers.\r\n * The algorithm is as follows:\r\n * Set the two most significant bits (bits 6 and 7) of the\r\n * clock_seq_hi_and_reserved to zero and one, respectively.\r\n * Set the four most significant bits (bits 12 through 15) of the\r\n * time_hi_and_version field to the 4-bit version number from\r\n * Section 4.1.3. Version4\r\n * Set all the other bits to randomly (or pseudo-randomly) chosen\r\n * values.\r\n * UUID = time-low \"-\" time-mid \"-\"time-high-and-version \"-\"clock-seq-reserved and low(2hexOctet)\"-\" node\r\n * time-low = 4hexOctet\r\n * time-mid = 2hexOctet\r\n * time-high-and-version = 2hexOctet\r\n * clock-seq-and-reserved = hexOctet:\r\n * clock-seq-low = hexOctet\r\n * node = 6hexOctet\r\n * Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\r\n * y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10\r\n * y values are 8, 9, A, B\r\n */\r\n GuidGenerator.prototype.generateGuid = function () {\r\n try {\r\n var buffer = new Uint8Array(16);\r\n this.cryptoObj.getRandomValues(buffer);\r\n // buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number).\r\n buffer[6] |= 0x40; // buffer[6] | 01000000 will set the 6 bit to 1.\r\n buffer[6] &= 0x4f; // buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = \"4\".\r\n // buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.\r\n buffer[8] |= 0x80; // buffer[8] | 10000000 will set the 7 bit to 1.\r\n buffer[8] &= 0xbf; // buffer[8] & 10111111 will set the 6 bit to 0.\r\n return MathUtils.decimalToHex(buffer[0]) + MathUtils.decimalToHex(buffer[1])\r\n + MathUtils.decimalToHex(buffer[2]) + MathUtils.decimalToHex(buffer[3])\r\n + \"-\" + MathUtils.decimalToHex(buffer[4]) + MathUtils.decimalToHex(buffer[5])\r\n + \"-\" + MathUtils.decimalToHex(buffer[6]) + MathUtils.decimalToHex(buffer[7])\r\n + \"-\" + MathUtils.decimalToHex(buffer[8]) + MathUtils.decimalToHex(buffer[9])\r\n + \"-\" + MathUtils.decimalToHex(buffer[10]) + MathUtils.decimalToHex(buffer[11])\r\n + MathUtils.decimalToHex(buffer[12]) + MathUtils.decimalToHex(buffer[13])\r\n + MathUtils.decimalToHex(buffer[14]) + MathUtils.decimalToHex(buffer[15]);\r\n }\r\n catch (err) {\r\n var guidHolder = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\";\r\n var hex = \"0123456789abcdef\";\r\n var r = 0;\r\n var guidResponse = Constants.EMPTY_STRING;\r\n for (var i = 0; i < 36; i++) {\r\n if (guidHolder[i] !== \"-\" && guidHolder[i] !== \"4\") {\r\n // each x and y needs to be random\r\n r = Math.random() * 16 | 0;\r\n }\r\n if (guidHolder[i] === \"x\") {\r\n guidResponse += hex[r];\r\n }\r\n else if (guidHolder[i] === \"y\") {\r\n // clock-seq-and-reserved first hex is filtered and remaining hex values are random\r\n r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0??\r\n r |= 0x8; // set pos 3 to 1 as 1???\r\n guidResponse += hex[r];\r\n }\r\n else {\r\n guidResponse += guidHolder[i];\r\n }\r\n }\r\n return guidResponse;\r\n }\r\n };\r\n /**\r\n * verifies if a string is GUID\r\n * @param guid\r\n */\r\n GuidGenerator.prototype.isGuid = function (guid) {\r\n var regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\r\n return regexGuid.test(guid);\r\n };\r\n return GuidGenerator;\r\n}());\n\nexport { GuidGenerator };\n//# sourceMappingURL=GuidGenerator.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { Constants } from '@azure/msal-common';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Utility functions for strings in a browser. See here for implementation details:\r\n * https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_2_%E2%80%93_JavaScript's_UTF-16_%3E_UTF-8_%3E_base64\r\n */\r\nvar BrowserStringUtils = /** @class */ (function () {\r\n function BrowserStringUtils() {\r\n }\r\n /**\r\n * Converts string to Uint8Array\r\n * @param sDOMStr\r\n */\r\n BrowserStringUtils.stringToUtf8Arr = function (sDOMStr) {\r\n var nChr;\r\n var nArrLen = 0;\r\n var nStrLen = sDOMStr.length;\r\n /* mapping... */\r\n for (var nMapIdx = 0; nMapIdx < nStrLen; nMapIdx++) {\r\n nChr = sDOMStr.charCodeAt(nMapIdx);\r\n nArrLen += nChr < 0x80 ? 1 : nChr < 0x800 ? 2 : nChr < 0x10000 ? 3 : nChr < 0x200000 ? 4 : nChr < 0x4000000 ? 5 : 6;\r\n }\r\n var aBytes = new Uint8Array(nArrLen);\r\n /* transcription... */\r\n for (var nIdx = 0, nChrIdx = 0; nIdx < nArrLen; nChrIdx++) {\r\n nChr = sDOMStr.charCodeAt(nChrIdx);\r\n if (nChr < 128) {\r\n /* one byte */\r\n aBytes[nIdx++] = nChr;\r\n }\r\n else if (nChr < 0x800) {\r\n /* two bytes */\r\n aBytes[nIdx++] = 192 + (nChr >>> 6);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n else if (nChr < 0x10000) {\r\n /* three bytes */\r\n aBytes[nIdx++] = 224 + (nChr >>> 12);\r\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n else if (nChr < 0x200000) {\r\n /* four bytes */\r\n aBytes[nIdx++] = 240 + (nChr >>> 18);\r\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n else if (nChr < 0x4000000) {\r\n /* five bytes */\r\n aBytes[nIdx++] = 248 + (nChr >>> 24);\r\n aBytes[nIdx++] = 128 + (nChr >>> 18 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n else /* if (nChr <= 0x7fffffff) */ {\r\n /* six bytes */\r\n aBytes[nIdx++] = 252 + (nChr >>> 30);\r\n aBytes[nIdx++] = 128 + (nChr >>> 24 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 18 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 12 & 63);\r\n aBytes[nIdx++] = 128 + (nChr >>> 6 & 63);\r\n aBytes[nIdx++] = 128 + (nChr & 63);\r\n }\r\n }\r\n return aBytes;\r\n };\r\n /**\r\n * Converst string to ArrayBuffer\r\n * @param dataString\r\n */\r\n BrowserStringUtils.stringToArrayBuffer = function (dataString) {\r\n var data = new ArrayBuffer(dataString.length);\r\n var dataView = new Uint8Array(data);\r\n for (var i = 0; i < dataString.length; i++) {\r\n dataView[i] = dataString.charCodeAt(i);\r\n }\r\n return data;\r\n };\r\n /**\r\n * Converts Uint8Array to a string\r\n * @param aBytes\r\n */\r\n BrowserStringUtils.utf8ArrToString = function (aBytes) {\r\n var sView = Constants.EMPTY_STRING;\r\n for (var nPart = void 0, nLen = aBytes.length, nIdx = 0; nIdx < nLen; nIdx++) {\r\n nPart = aBytes[nIdx];\r\n sView += String.fromCharCode(nPart > 251 && nPart < 254 && nIdx + 5 < nLen ? /* six bytes */\r\n /* (nPart - 252 << 30) may be not so safe in ECMAScript! So...: */\r\n (nPart - 252) * 1073741824 + (aBytes[++nIdx] - 128 << 24) + (aBytes[++nIdx] - 128 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\r\n : nPart > 247 && nPart < 252 && nIdx + 4 < nLen ? /* five bytes */\r\n (nPart - 248 << 24) + (aBytes[++nIdx] - 128 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\r\n : nPart > 239 && nPart < 248 && nIdx + 3 < nLen ? /* four bytes */\r\n (nPart - 240 << 18) + (aBytes[++nIdx] - 128 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\r\n : nPart > 223 && nPart < 240 && nIdx + 2 < nLen ? /* three bytes */\r\n (nPart - 224 << 12) + (aBytes[++nIdx] - 128 << 6) + aBytes[++nIdx] - 128\r\n : nPart > 191 && nPart < 224 && nIdx + 1 < nLen ? /* two bytes */\r\n (nPart - 192 << 6) + aBytes[++nIdx] - 128\r\n : /* nPart < 127 ? */ /* one byte */\r\n nPart);\r\n }\r\n return sView;\r\n };\r\n /**\r\n * Returns stringified jwk.\r\n * @param jwk\r\n */\r\n BrowserStringUtils.getSortedObjectString = function (obj) {\r\n return JSON.stringify(obj, Object.keys(obj).sort());\r\n };\r\n return BrowserStringUtils;\r\n}());\n\nexport { BrowserStringUtils };\n//# sourceMappingURL=BrowserStringUtils.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { Constants } from '@azure/msal-common';\nimport { BrowserStringUtils } from '../utils/BrowserStringUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Class which exposes APIs to encode plaintext to base64 encoded string. See here for implementation details:\r\n * https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_2_%E2%80%93_JavaScript's_UTF-16_%3E_UTF-8_%3E_base64\r\n */\r\nvar Base64Encode = /** @class */ (function () {\r\n function Base64Encode() {\r\n }\r\n /**\r\n * Returns URL Safe b64 encoded string from a plaintext string.\r\n * @param input\r\n */\r\n Base64Encode.prototype.urlEncode = function (input) {\r\n return encodeURIComponent(this.encode(input)\r\n .replace(/=/g, Constants.EMPTY_STRING)\r\n .replace(/\\+/g, \"-\")\r\n .replace(/\\//g, \"_\"));\r\n };\r\n /**\r\n * Returns URL Safe b64 encoded string from an int8Array.\r\n * @param inputArr\r\n */\r\n Base64Encode.prototype.urlEncodeArr = function (inputArr) {\r\n return this.base64EncArr(inputArr)\r\n .replace(/=/g, Constants.EMPTY_STRING)\r\n .replace(/\\+/g, \"-\")\r\n .replace(/\\//g, \"_\");\r\n };\r\n /**\r\n * Returns b64 encoded string from plaintext string.\r\n * @param input\r\n */\r\n Base64Encode.prototype.encode = function (input) {\r\n var inputUtf8Arr = BrowserStringUtils.stringToUtf8Arr(input);\r\n return this.base64EncArr(inputUtf8Arr);\r\n };\r\n /**\r\n * Base64 encode byte array\r\n * @param aBytes\r\n */\r\n Base64Encode.prototype.base64EncArr = function (aBytes) {\r\n var eqLen = (3 - (aBytes.length % 3)) % 3;\r\n var sB64Enc = Constants.EMPTY_STRING;\r\n for (var nMod3 = void 0, nLen = aBytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {\r\n nMod3 = nIdx % 3;\r\n /* Uncomment the following line in order to split the output in lines 76-character long: */\r\n /*\r\n *if (nIdx > 0 && (nIdx * 4 / 3) % 76 === 0) { sB64Enc += \"\\r\\n\"; }\r\n */\r\n nUint24 |= aBytes[nIdx] << (16 >>> nMod3 & 24);\r\n if (nMod3 === 2 || aBytes.length - nIdx === 1) {\r\n sB64Enc += String.fromCharCode(this.uint6ToB64(nUint24 >>> 18 & 63), this.uint6ToB64(nUint24 >>> 12 & 63), this.uint6ToB64(nUint24 >>> 6 & 63), this.uint6ToB64(nUint24 & 63));\r\n nUint24 = 0;\r\n }\r\n }\r\n return eqLen === 0 ? sB64Enc : sB64Enc.substring(0, sB64Enc.length - eqLen) + (eqLen === 1 ? \"=\" : \"==\");\r\n };\r\n /**\r\n * Base64 string to array encoding helper\r\n * @param nUint6\r\n */\r\n Base64Encode.prototype.uint6ToB64 = function (nUint6) {\r\n return nUint6 < 26 ?\r\n nUint6 + 65\r\n : nUint6 < 52 ?\r\n nUint6 + 71\r\n : nUint6 < 62 ?\r\n nUint6 - 4\r\n : nUint6 === 62 ?\r\n 43\r\n : nUint6 === 63 ?\r\n 47\r\n :\r\n 65;\r\n };\r\n return Base64Encode;\r\n}());\n\nexport { Base64Encode };\n//# sourceMappingURL=Base64Encode.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { Constants } from '@azure/msal-common';\nimport { BrowserStringUtils } from '../utils/BrowserStringUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Class which exposes APIs to decode base64 strings to plaintext. See here for implementation details:\r\n * https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#Solution_2_%E2%80%93_JavaScript's_UTF-16_%3E_UTF-8_%3E_base64\r\n */\r\nvar Base64Decode = /** @class */ (function () {\r\n function Base64Decode() {\r\n }\r\n /**\r\n * Returns a URL-safe plaintext decoded string from b64 encoded input.\r\n * @param input\r\n */\r\n Base64Decode.prototype.decode = function (input) {\r\n var encodedString = input.replace(/-/g, \"+\").replace(/_/g, \"/\");\r\n switch (encodedString.length % 4) {\r\n case 0:\r\n break;\r\n case 2:\r\n encodedString += \"==\";\r\n break;\r\n case 3:\r\n encodedString += \"=\";\r\n break;\r\n default:\r\n throw new Error(\"Invalid base64 string\");\r\n }\r\n var inputUtf8Arr = this.base64DecToArr(encodedString);\r\n return BrowserStringUtils.utf8ArrToString(inputUtf8Arr);\r\n };\r\n /**\r\n * Decodes base64 into Uint8Array\r\n * @param base64String\r\n * @param nBlockSize\r\n */\r\n Base64Decode.prototype.base64DecToArr = function (base64String, nBlockSize) {\r\n var sB64Enc = base64String.replace(/[^A-Za-z0-9\\+\\/]/g, Constants.EMPTY_STRING);\r\n var nInLen = sB64Enc.length;\r\n var nOutLen = nBlockSize ? Math.ceil((nInLen * 3 + 1 >>> 2) / nBlockSize) * nBlockSize : nInLen * 3 + 1 >>> 2;\r\n var aBytes = new Uint8Array(nOutLen);\r\n for (var nMod3 = void 0, nMod4 = void 0, nUint24 = 0, nOutIdx = 0, nInIdx = 0; nInIdx < nInLen; nInIdx++) {\r\n nMod4 = nInIdx & 3;\r\n nUint24 |= this.b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << 18 - 6 * nMod4;\r\n if (nMod4 === 3 || nInLen - nInIdx === 1) {\r\n for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) {\r\n aBytes[nOutIdx] = nUint24 >>> (16 >>> nMod3 & 24) & 255;\r\n }\r\n nUint24 = 0;\r\n }\r\n }\r\n return aBytes;\r\n };\r\n /**\r\n * Base64 string to array decoding helper\r\n * @param charNum\r\n */\r\n Base64Decode.prototype.b64ToUint6 = function (charNum) {\r\n return charNum > 64 && charNum < 91 ?\r\n charNum - 65\r\n : charNum > 96 && charNum < 123 ?\r\n charNum - 71\r\n : charNum > 47 && charNum < 58 ?\r\n charNum + 4\r\n : charNum === 43 ?\r\n 62\r\n : charNum === 47 ?\r\n 63\r\n :\r\n 0;\r\n };\r\n return Base64Decode;\r\n}());\n\nexport { Base64Decode };\n//# sourceMappingURL=Base64Decode.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { Base64Encode } from '../encode/Base64Encode.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n// Constant byte array length\r\nvar RANDOM_BYTE_ARR_LENGTH = 32;\r\n/**\r\n * Class which exposes APIs to generate PKCE codes and code verifiers.\r\n */\r\nvar PkceGenerator = /** @class */ (function () {\r\n function PkceGenerator(cryptoObj) {\r\n this.base64Encode = new Base64Encode();\r\n this.cryptoObj = cryptoObj;\r\n }\r\n /**\r\n * Generates PKCE Codes. See the RFC for more information: https://tools.ietf.org/html/rfc7636\r\n */\r\n PkceGenerator.prototype.generateCodes = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var codeVerifier, codeChallenge;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n codeVerifier = this.generateCodeVerifier();\r\n return [4 /*yield*/, this.generateCodeChallengeFromVerifier(codeVerifier)];\r\n case 1:\r\n codeChallenge = _a.sent();\r\n return [2 /*return*/, {\r\n verifier: codeVerifier,\r\n challenge: codeChallenge\r\n }];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Generates a random 32 byte buffer and returns the base64\r\n * encoded string to be used as a PKCE Code Verifier\r\n */\r\n PkceGenerator.prototype.generateCodeVerifier = function () {\r\n try {\r\n // Generate random values as utf-8\r\n var buffer = new Uint8Array(RANDOM_BYTE_ARR_LENGTH);\r\n this.cryptoObj.getRandomValues(buffer);\r\n // encode verifier as base64\r\n var pkceCodeVerifierB64 = this.base64Encode.urlEncodeArr(buffer);\r\n return pkceCodeVerifierB64;\r\n }\r\n catch (e) {\r\n throw BrowserAuthError.createPkceNotGeneratedError(e);\r\n }\r\n };\r\n /**\r\n * Creates a base64 encoded PKCE Code Challenge string from the\r\n * hash created from the PKCE Code Verifier supplied\r\n */\r\n PkceGenerator.prototype.generateCodeChallengeFromVerifier = function (pkceCodeVerifier) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var pkceHashedCodeVerifier, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 2, , 3]);\r\n return [4 /*yield*/, this.cryptoObj.sha256Digest(pkceCodeVerifier)];\r\n case 1:\r\n pkceHashedCodeVerifier = _a.sent();\r\n // encode hash as base64\r\n return [2 /*return*/, this.base64Encode.urlEncodeArr(new Uint8Array(pkceHashedCodeVerifier))];\r\n case 2:\r\n e_1 = _a.sent();\r\n throw BrowserAuthError.createPkceNotGeneratedError(e_1);\r\n case 3: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return PkceGenerator;\r\n}());\n\nexport { PkceGenerator };\n//# sourceMappingURL=PkceGenerator.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ModernBrowserCrypto = /** @class */ (function () {\r\n function ModernBrowserCrypto() {\r\n }\r\n ModernBrowserCrypto.prototype.getRandomValues = function (dataBuffer) {\r\n return window.crypto.getRandomValues(dataBuffer);\r\n };\r\n ModernBrowserCrypto.prototype.generateKey = function (algorithm, extractable, keyUsages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.crypto.subtle.generateKey(algorithm, extractable, keyUsages)];\r\n });\r\n });\r\n };\r\n ModernBrowserCrypto.prototype.exportKey = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key)];\r\n });\r\n });\r\n };\r\n ModernBrowserCrypto.prototype.importKey = function (keyData, algorithm, extractable, keyUsages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.crypto.subtle.importKey(KEY_FORMAT_JWK, keyData, algorithm, extractable, keyUsages)];\r\n });\r\n });\r\n };\r\n ModernBrowserCrypto.prototype.sign = function (algorithm, key, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.crypto.subtle.sign(algorithm, key, data)];\r\n });\r\n });\r\n };\r\n ModernBrowserCrypto.prototype.digest = function (algorithm, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.crypto.subtle.digest(algorithm, data)];\r\n });\r\n });\r\n };\r\n return ModernBrowserCrypto;\r\n}());\n\nexport { ModernBrowserCrypto };\n//# sourceMappingURL=ModernBrowserCrypto.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __spread, __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar MsrBrowserCrypto = /** @class */ (function () {\r\n function MsrBrowserCrypto() {\r\n }\r\n MsrBrowserCrypto.prototype.initPrng = function (entropy) {\r\n // Turn into array, as initPrng seems to not always like Uint8Array (even though it should support both)\r\n return window.msrCrypto.initPrng(__spread(entropy));\r\n };\r\n MsrBrowserCrypto.prototype.getRandomValues = function (dataBuffer) {\r\n return window.msrCrypto.getRandomValues(dataBuffer);\r\n };\r\n MsrBrowserCrypto.prototype.generateKey = function (algorithm, extractable, keyUsages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.msrCrypto.subtle.generateKey(algorithm, extractable, keyUsages)];\r\n });\r\n });\r\n };\r\n MsrBrowserCrypto.prototype.exportKey = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.msrCrypto.subtle.exportKey(KEY_FORMAT_JWK, key)];\r\n });\r\n });\r\n };\r\n MsrBrowserCrypto.prototype.importKey = function (keyData, algorithm, extractable, keyUsages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.msrCrypto.subtle.importKey(KEY_FORMAT_JWK, keyData, algorithm, extractable, keyUsages)];\r\n });\r\n });\r\n };\r\n MsrBrowserCrypto.prototype.sign = function (algorithm, key, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.msrCrypto.subtle.sign(algorithm, key, data)];\r\n });\r\n });\r\n };\r\n MsrBrowserCrypto.prototype.digest = function (algorithm, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, window.msrCrypto.subtle.digest(algorithm, data)];\r\n });\r\n });\r\n };\r\n return MsrBrowserCrypto;\r\n}());\n\nexport { MsrBrowserCrypto };\n//# sourceMappingURL=MsrBrowserCrypto.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { Constants } from '@azure/msal-common';\nimport { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js';\nimport { BrowserStringUtils } from '../utils/BrowserStringUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar MsBrowserCrypto = /** @class */ (function () {\r\n function MsBrowserCrypto() {\r\n }\r\n MsBrowserCrypto.prototype.getRandomValues = function (dataBuffer) {\r\n return window[\"msCrypto\"].getRandomValues(dataBuffer);\r\n };\r\n MsBrowserCrypto.prototype.generateKey = function (algorithm, extractable, keyUsages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var msGenerateKey = window[\"msCrypto\"].subtle.generateKey(algorithm, extractable, keyUsages);\r\n msGenerateKey.addEventListener(\"complete\", function (e) {\r\n resolve(e.target.result);\r\n });\r\n msGenerateKey.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n MsBrowserCrypto.prototype.exportKey = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var msExportKey = window[\"msCrypto\"].subtle.exportKey(KEY_FORMAT_JWK, key);\r\n msExportKey.addEventListener(\"complete\", function (e) {\r\n var resultBuffer = e.target.result;\r\n var resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))\r\n .replace(/\\r/g, Constants.EMPTY_STRING)\r\n .replace(/\\n/g, Constants.EMPTY_STRING)\r\n .replace(/\\t/g, Constants.EMPTY_STRING)\r\n .split(\" \").join(Constants.EMPTY_STRING)\r\n .replace(\"\\u0000\", Constants.EMPTY_STRING);\r\n try {\r\n resolve(JSON.parse(resultString));\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n });\r\n msExportKey.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n MsBrowserCrypto.prototype.importKey = function (keyData, algorithm, extractable, keyUsages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var keyString, keyBuffer;\r\n return __generator(this, function (_a) {\r\n keyString = BrowserStringUtils.getSortedObjectString(keyData);\r\n keyBuffer = BrowserStringUtils.stringToArrayBuffer(keyString);\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var msImportKey = window[\"msCrypto\"].subtle.importKey(KEY_FORMAT_JWK, keyBuffer, algorithm, extractable, keyUsages);\r\n msImportKey.addEventListener(\"complete\", function (e) {\r\n resolve(e.target.result);\r\n });\r\n msImportKey.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n MsBrowserCrypto.prototype.sign = function (algorithm, key, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var msSign = window[\"msCrypto\"].subtle.sign(algorithm, key, data);\r\n msSign.addEventListener(\"complete\", function (e) {\r\n resolve(e.target.result);\r\n });\r\n msSign.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n MsBrowserCrypto.prototype.digest = function (algorithm, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var digestOperation = window[\"msCrypto\"].subtle.digest(algorithm, data.buffer);\r\n digestOperation.addEventListener(\"complete\", function (e) {\r\n resolve(e.target.result);\r\n });\r\n digestOperation.addEventListener(\"error\", function (error) {\r\n reject(error);\r\n });\r\n })];\r\n });\r\n });\r\n };\r\n return MsBrowserCrypto;\r\n}());\n\nexport { MsBrowserCrypto };\n//# sourceMappingURL=MsBrowserCrypto.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { BrowserStringUtils } from '../utils/BrowserStringUtils.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { ModernBrowserCrypto } from './ModernBrowserCrypto.js';\nimport { MsrBrowserCrypto } from './MsrBrowserCrypto.js';\nimport { MsBrowserCrypto } from './MsBrowserCrypto.js';\nimport { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams\r\n */\r\n// RSA KeyGen Algorithm\r\nvar PKCS1_V15_KEYGEN_ALG = \"RSASSA-PKCS1-v1_5\";\r\n// SHA-256 hashing algorithm\r\nvar S256_HASH_ALG = \"SHA-256\";\r\n// MOD length for PoP tokens\r\nvar MODULUS_LENGTH = 2048;\r\n// Public Exponent\r\nvar PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);\r\n/**\r\n * This class implements functions used by the browser library to perform cryptography operations such as\r\n * hashing and encoding. It also has helper functions to validate the availability of specific APIs.\r\n */\r\nvar BrowserCrypto = /** @class */ (function () {\r\n function BrowserCrypto(logger, cryptoOptions) {\r\n var _a, _b;\r\n this.logger = logger;\r\n this.cryptoOptions = cryptoOptions;\r\n if (this.hasBrowserCrypto()) {\r\n // Use standard modern web crypto if available\r\n this.logger.verbose(\"BrowserCrypto: modern crypto interface available\");\r\n this.subtleCrypto = new ModernBrowserCrypto();\r\n }\r\n else if (this.hasIECrypto()) {\r\n // For IE11, use msCrypto interface\r\n this.logger.verbose(\"BrowserCrypto: MS crypto interface available\");\r\n this.subtleCrypto = new MsBrowserCrypto();\r\n }\r\n else if (this.hasMsrCrypto() && ((_a = this.cryptoOptions) === null || _a === void 0 ? void 0 : _a.useMsrCrypto)) {\r\n // For other browsers, use MSR Crypto if found\r\n this.logger.verbose(\"BrowserCrypto: MSR crypto interface available\");\r\n this.subtleCrypto = new MsrBrowserCrypto();\r\n }\r\n else {\r\n if (this.hasMsrCrypto()) {\r\n this.logger.info(\"BrowserCrypto: MSR Crypto interface available but system.cryptoOptions.useMsrCrypto not enabled\");\r\n }\r\n this.logger.error(\"BrowserCrypto: No crypto interfaces available.\");\r\n throw BrowserAuthError.createCryptoNotAvailableError(\"Browser crypto, msCrypto, or msrCrypto interfaces not available.\");\r\n }\r\n // Mainly needed for MSR Crypto: https://github.com/microsoft/MSR-JavaScript-Crypto#random-number-generator-prng\r\n if (this.subtleCrypto.initPrng) {\r\n this.logger.verbose(\"BrowserCrypto: Interface requires entropy\");\r\n if (!((_b = this.cryptoOptions) === null || _b === void 0 ? void 0 : _b.entropy)) {\r\n this.logger.error(\"BrowserCrypto: Interface requires entropy but none provided.\");\r\n throw BrowserConfigurationAuthError.createEntropyNotProvided();\r\n }\r\n this.logger.verbose(\"BrowserCrypto: Entropy provided\");\r\n this.subtleCrypto.initPrng(this.cryptoOptions.entropy);\r\n }\r\n this.keygenAlgorithmOptions = {\r\n name: PKCS1_V15_KEYGEN_ALG,\r\n hash: S256_HASH_ALG,\r\n modulusLength: MODULUS_LENGTH,\r\n publicExponent: PUBLIC_EXPONENT\r\n };\r\n }\r\n /**\r\n * Check whether IE crypto or other browser cryptography is available.\r\n */\r\n BrowserCrypto.prototype.hasIECrypto = function () {\r\n return \"msCrypto\" in window;\r\n };\r\n /**\r\n * Check whether browser crypto is available.\r\n */\r\n BrowserCrypto.prototype.hasBrowserCrypto = function () {\r\n return \"crypto\" in window;\r\n };\r\n /**\r\n * Check whether MSR crypto polyfill is available\r\n */\r\n BrowserCrypto.prototype.hasMsrCrypto = function () {\r\n return \"msrCrypto\" in window;\r\n };\r\n /**\r\n * Returns a sha-256 hash of the given dataString as an ArrayBuffer.\r\n * @param dataString\r\n */\r\n BrowserCrypto.prototype.sha256Digest = function (dataString) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var data;\r\n return __generator(this, function (_a) {\r\n data = BrowserStringUtils.stringToUtf8Arr(dataString);\r\n // MSR Crypto wants object with name property, instead of string\r\n return [2 /*return*/, this.subtleCrypto.digest({ name: S256_HASH_ALG }, data)];\r\n });\r\n });\r\n };\r\n /**\r\n * Populates buffer with cryptographically random values.\r\n * @param dataBuffer\r\n */\r\n BrowserCrypto.prototype.getRandomValues = function (dataBuffer) {\r\n return this.subtleCrypto.getRandomValues(dataBuffer);\r\n };\r\n /**\r\n * Generates a keypair based on current keygen algorithm config.\r\n * @param extractable\r\n * @param usages\r\n */\r\n BrowserCrypto.prototype.generateKeyPair = function (extractable, usages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.subtleCrypto.generateKey(this.keygenAlgorithmOptions, extractable, usages)];\r\n });\r\n });\r\n };\r\n /**\r\n * Export key as Json Web Key (JWK)\r\n * @param key\r\n * @param format\r\n */\r\n BrowserCrypto.prototype.exportJwk = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.subtleCrypto.exportKey(key)];\r\n });\r\n });\r\n };\r\n /**\r\n * Imports key as Json Web Key (JWK), can set extractable and usages.\r\n * @param key\r\n * @param format\r\n * @param extractable\r\n * @param usages\r\n */\r\n BrowserCrypto.prototype.importJwk = function (key, extractable, usages) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.subtleCrypto.importKey(key, this.keygenAlgorithmOptions, extractable, usages)];\r\n });\r\n });\r\n };\r\n /**\r\n * Signs given data with given key\r\n * @param key\r\n * @param data\r\n */\r\n BrowserCrypto.prototype.sign = function (key, data) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.subtleCrypto.sign(this.keygenAlgorithmOptions, key, data)];\r\n });\r\n });\r\n };\r\n return BrowserCrypto;\r\n}());\n\nexport { BrowserCrypto };\n//# sourceMappingURL=BrowserCrypto.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { DB_NAME, DB_VERSION, DB_TABLE_NAME } from '../utils/BrowserConstants.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Storage wrapper for IndexedDB storage in browsers: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API\r\n */\r\nvar DatabaseStorage = /** @class */ (function () {\r\n function DatabaseStorage() {\r\n this.dbName = DB_NAME;\r\n this.version = DB_VERSION;\r\n this.tableName = DB_TABLE_NAME;\r\n this.dbOpen = false;\r\n }\r\n /**\r\n * Opens IndexedDB instance.\r\n */\r\n DatabaseStorage.prototype.open = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var openDB = window.indexedDB.open(_this.dbName, _this.version);\r\n openDB.addEventListener(\"upgradeneeded\", function (e) {\r\n var event = e;\r\n event.target.result.createObjectStore(_this.tableName);\r\n });\r\n openDB.addEventListener(\"success\", function (e) {\r\n var event = e;\r\n _this.db = event.target.result;\r\n _this.dbOpen = true;\r\n resolve();\r\n });\r\n openDB.addEventListener(\"error\", function () { return reject(BrowserAuthError.createDatabaseUnavailableError()); });\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * Closes the connection to IndexedDB database when all pending transactions\r\n * complete.\r\n */\r\n DatabaseStorage.prototype.closeConnection = function () {\r\n var db = this.db;\r\n if (db && this.dbOpen) {\r\n db.close();\r\n this.dbOpen = false;\r\n }\r\n };\r\n /**\r\n * Opens database if it's not already open\r\n */\r\n DatabaseStorage.prototype.validateDbIsOpen = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (!!this.dbOpen) return [3 /*break*/, 2];\r\n return [4 /*yield*/, this.open()];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n case 2: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Retrieves item from IndexedDB instance.\r\n * @param key\r\n */\r\n DatabaseStorage.prototype.getItem = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.validateDbIsOpen()];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n // TODO: Add timeouts?\r\n if (!_this.db) {\r\n return reject(BrowserAuthError.createDatabaseNotOpenError());\r\n }\r\n var transaction = _this.db.transaction([_this.tableName], \"readonly\");\r\n var objectStore = transaction.objectStore(_this.tableName);\r\n var dbGet = objectStore.get(key);\r\n dbGet.addEventListener(\"success\", function (e) {\r\n var event = e;\r\n _this.closeConnection();\r\n resolve(event.target.result);\r\n });\r\n dbGet.addEventListener(\"error\", function (e) {\r\n _this.closeConnection();\r\n reject(e);\r\n });\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Adds item to IndexedDB under given key\r\n * @param key\r\n * @param payload\r\n */\r\n DatabaseStorage.prototype.setItem = function (key, payload) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.validateDbIsOpen()];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n // TODO: Add timeouts?\r\n if (!_this.db) {\r\n return reject(BrowserAuthError.createDatabaseNotOpenError());\r\n }\r\n var transaction = _this.db.transaction([_this.tableName], \"readwrite\");\r\n var objectStore = transaction.objectStore(_this.tableName);\r\n var dbPut = objectStore.put(payload, key);\r\n dbPut.addEventListener(\"success\", function () {\r\n _this.closeConnection();\r\n resolve();\r\n });\r\n dbPut.addEventListener(\"error\", function (e) {\r\n _this.closeConnection();\r\n reject(e);\r\n });\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Removes item from IndexedDB under given key\r\n * @param key\r\n */\r\n DatabaseStorage.prototype.removeItem = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.validateDbIsOpen()];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n if (!_this.db) {\r\n return reject(BrowserAuthError.createDatabaseNotOpenError());\r\n }\r\n var transaction = _this.db.transaction([_this.tableName], \"readwrite\");\r\n var objectStore = transaction.objectStore(_this.tableName);\r\n var dbDelete = objectStore.delete(key);\r\n dbDelete.addEventListener(\"success\", function () {\r\n _this.closeConnection();\r\n resolve();\r\n });\r\n dbDelete.addEventListener(\"error\", function (e) {\r\n _this.closeConnection();\r\n reject(e);\r\n });\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Get all the keys from the storage object as an iterable array of strings.\r\n */\r\n DatabaseStorage.prototype.getKeys = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.validateDbIsOpen()];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n if (!_this.db) {\r\n return reject(BrowserAuthError.createDatabaseNotOpenError());\r\n }\r\n var transaction = _this.db.transaction([_this.tableName], \"readonly\");\r\n var objectStore = transaction.objectStore(_this.tableName);\r\n var dbGetKeys = objectStore.getAllKeys();\r\n dbGetKeys.addEventListener(\"success\", function (e) {\r\n var event = e;\r\n _this.closeConnection();\r\n resolve(event.target.result);\r\n });\r\n dbGetKeys.addEventListener(\"error\", function (e) {\r\n _this.closeConnection();\r\n reject(e);\r\n });\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n *\r\n * Checks whether there is an object under the search key in the object store\r\n */\r\n DatabaseStorage.prototype.containsKey = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.validateDbIsOpen()];\r\n case 1:\r\n _a.sent();\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n if (!_this.db) {\r\n return reject(BrowserAuthError.createDatabaseNotOpenError());\r\n }\r\n var transaction = _this.db.transaction([_this.tableName], \"readonly\");\r\n var objectStore = transaction.objectStore(_this.tableName);\r\n var dbContainsKey = objectStore.count(key);\r\n dbContainsKey.addEventListener(\"success\", function (e) {\r\n var event = e;\r\n _this.closeConnection();\r\n resolve(event.target.result === 1);\r\n });\r\n dbContainsKey.addEventListener(\"error\", function (e) {\r\n _this.closeConnection();\r\n reject(e);\r\n });\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Deletes the MSAL database. The database is deleted rather than cleared to make it possible\r\n * for client applications to downgrade to a previous MSAL version without worrying about forward compatibility issues\r\n * with IndexedDB database versions.\r\n */\r\n DatabaseStorage.prototype.deleteDatabase = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n // Check if database being deleted exists\r\n if (this.db && this.dbOpen) {\r\n this.closeConnection();\r\n }\r\n return [2 /*return*/, new Promise(function (resolve, reject) {\r\n var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);\r\n deleteDbRequest.addEventListener(\"success\", function () { return resolve(true); });\r\n deleteDbRequest.addEventListener(\"blocked\", function () { return resolve(true); });\r\n deleteDbRequest.addEventListener(\"error\", function () { return reject(false); });\r\n })];\r\n });\r\n });\r\n };\r\n return DatabaseStorage;\r\n}());\n\nexport { DatabaseStorage };\n//# sourceMappingURL=DatabaseStorage.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { BrowserAuthError, BrowserAuthErrorMessage } from '../error/BrowserAuthError.js';\nimport { DatabaseStorage } from './DatabaseStorage.js';\nimport { MemoryStorage } from './MemoryStorage.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class allows MSAL to store artifacts asynchronously using the DatabaseStorage IndexedDB wrapper,\r\n * backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.\r\n */\r\nvar AsyncMemoryStorage = /** @class */ (function () {\r\n function AsyncMemoryStorage(logger, storeName) {\r\n this.inMemoryCache = new MemoryStorage();\r\n this.indexedDBCache = new DatabaseStorage();\r\n this.logger = logger;\r\n this.storeName = storeName;\r\n }\r\n AsyncMemoryStorage.prototype.handleDatabaseAccessError = function (error) {\r\n if (error instanceof BrowserAuthError && error.errorCode === BrowserAuthErrorMessage.databaseUnavailable.code) {\r\n this.logger.error(\"Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.\");\r\n }\r\n else {\r\n throw error;\r\n }\r\n };\r\n /**\r\n * Get the item matching the given key. Tries in-memory cache first, then in the asynchronous\r\n * storage object if item isn't found in-memory.\r\n * @param key\r\n */\r\n AsyncMemoryStorage.prototype.getItem = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var item, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n item = this.inMemoryCache.getItem(key);\r\n if (!!item) return [3 /*break*/, 4];\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n this.logger.verbose(\"Queried item not found in in-memory cache, now querying persistent storage.\");\r\n return [4 /*yield*/, this.indexedDBCache.getItem(key)];\r\n case 2: return [2 /*return*/, _a.sent()];\r\n case 3:\r\n e_1 = _a.sent();\r\n this.handleDatabaseAccessError(e_1);\r\n return [3 /*break*/, 4];\r\n case 4: return [2 /*return*/, item];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Sets the item in the in-memory cache and then tries to set it in the asynchronous\r\n * storage object with the given key.\r\n * @param key\r\n * @param value\r\n */\r\n AsyncMemoryStorage.prototype.setItem = function (key, value) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var e_2;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.inMemoryCache.setItem(key, value);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.indexedDBCache.setItem(key, value)];\r\n case 2:\r\n _a.sent();\r\n return [3 /*break*/, 4];\r\n case 3:\r\n e_2 = _a.sent();\r\n this.handleDatabaseAccessError(e_2);\r\n return [3 /*break*/, 4];\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Removes the item matching the key from the in-memory cache, then tries to remove it from the asynchronous storage object.\r\n * @param key\r\n */\r\n AsyncMemoryStorage.prototype.removeItem = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var e_3;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.inMemoryCache.removeItem(key);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.indexedDBCache.removeItem(key)];\r\n case 2:\r\n _a.sent();\r\n return [3 /*break*/, 4];\r\n case 3:\r\n e_3 = _a.sent();\r\n this.handleDatabaseAccessError(e_3);\r\n return [3 /*break*/, 4];\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Get all the keys from the in-memory cache as an iterable array of strings. If no keys are found, query the keys in the\r\n * asynchronous storage object.\r\n */\r\n AsyncMemoryStorage.prototype.getKeys = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var cacheKeys, e_4;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n cacheKeys = this.inMemoryCache.getKeys();\r\n if (!(cacheKeys.length === 0)) return [3 /*break*/, 4];\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n this.logger.verbose(\"In-memory cache is empty, now querying persistent storage.\");\r\n return [4 /*yield*/, this.indexedDBCache.getKeys()];\r\n case 2: return [2 /*return*/, _a.sent()];\r\n case 3:\r\n e_4 = _a.sent();\r\n this.handleDatabaseAccessError(e_4);\r\n return [3 /*break*/, 4];\r\n case 4: return [2 /*return*/, cacheKeys];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Returns true or false if the given key is present in the cache.\r\n * @param key\r\n */\r\n AsyncMemoryStorage.prototype.containsKey = function (key) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var containsKey, e_5;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n containsKey = this.inMemoryCache.containsKey(key);\r\n if (!!containsKey) return [3 /*break*/, 4];\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n this.logger.verbose(\"Key not found in in-memory cache, now querying persistent storage.\");\r\n return [4 /*yield*/, this.indexedDBCache.containsKey(key)];\r\n case 2: return [2 /*return*/, _a.sent()];\r\n case 3:\r\n e_5 = _a.sent();\r\n this.handleDatabaseAccessError(e_5);\r\n return [3 /*break*/, 4];\r\n case 4: return [2 /*return*/, containsKey];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Clears in-memory Map\r\n */\r\n AsyncMemoryStorage.prototype.clearInMemory = function () {\r\n // InMemory cache is a Map instance, clear is straightforward\r\n this.logger.verbose(\"Deleting in-memory keystore \" + this.storeName);\r\n this.inMemoryCache.clear();\r\n this.logger.verbose(\"In-memory keystore \" + this.storeName + \" deleted\");\r\n };\r\n /**\r\n * Tries to delete the IndexedDB database\r\n * @returns\r\n */\r\n AsyncMemoryStorage.prototype.clearPersistent = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var dbDeleted, e_6;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n _a.trys.push([0, 2, , 3]);\r\n this.logger.verbose(\"Deleting persistent keystore\");\r\n return [4 /*yield*/, this.indexedDBCache.deleteDatabase()];\r\n case 1:\r\n dbDeleted = _a.sent();\r\n if (dbDeleted) {\r\n this.logger.verbose(\"Persistent keystore deleted\");\r\n }\r\n return [2 /*return*/, dbDeleted];\r\n case 2:\r\n e_6 = _a.sent();\r\n this.handleDatabaseAccessError(e_6);\r\n return [2 /*return*/, false];\r\n case 3: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return AsyncMemoryStorage;\r\n}());\n\nexport { AsyncMemoryStorage };\n//# sourceMappingURL=AsyncMemoryStorage.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { AsyncMemoryStorage } from './AsyncMemoryStorage.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar CryptoKeyStoreNames;\r\n(function (CryptoKeyStoreNames) {\r\n CryptoKeyStoreNames[\"asymmetricKeys\"] = \"asymmetricKeys\";\r\n CryptoKeyStoreNames[\"symmetricKeys\"] = \"symmetricKeys\";\r\n})(CryptoKeyStoreNames || (CryptoKeyStoreNames = {}));\r\n/**\r\n * MSAL CryptoKeyStore DB Version 2\r\n */\r\nvar CryptoKeyStore = /** @class */ (function () {\r\n function CryptoKeyStore(logger) {\r\n this.logger = logger;\r\n this.asymmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys);\r\n this.symmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys);\r\n }\r\n CryptoKeyStore.prototype.clear = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n // Delete in-memory keystores\r\n this.asymmetricKeys.clearInMemory();\r\n this.symmetricKeys.clearInMemory();\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.asymmetricKeys.clearPersistent()];\r\n case 2:\r\n _a.sent();\r\n return [2 /*return*/, true];\r\n case 3:\r\n e_1 = _a.sent();\r\n if (e_1 instanceof Error) {\r\n this.logger.error(\"Clearing keystore failed with error: \" + e_1.message);\r\n }\r\n else {\r\n this.logger.error(\"Clearing keystore failed with unknown error\");\r\n }\r\n return [2 /*return*/, false];\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return CryptoKeyStore;\r\n}());\n\nexport { CryptoKeyStore, CryptoKeyStoreNames };\n//# sourceMappingURL=CryptoKeyStore.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator } from '../_virtual/_tslib.js';\nimport { PerformanceEvents, JoseHeader } from '@azure/msal-common';\nimport { GuidGenerator } from './GuidGenerator.js';\nimport { Base64Encode } from '../encode/Base64Encode.js';\nimport { Base64Decode } from '../encode/Base64Decode.js';\nimport { PkceGenerator } from './PkceGenerator.js';\nimport { BrowserCrypto } from './BrowserCrypto.js';\nimport { BrowserStringUtils } from '../utils/BrowserStringUtils.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { CryptoKeyStore } from '../cache/CryptoKeyStore.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and\r\n * implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).\r\n */\r\nvar CryptoOps = /** @class */ (function () {\r\n function CryptoOps(logger, performanceClient, cryptoConfig) {\r\n this.logger = logger;\r\n // Browser crypto needs to be validated first before any other classes can be set.\r\n this.browserCrypto = new BrowserCrypto(this.logger, cryptoConfig);\r\n this.b64Encode = new Base64Encode();\r\n this.b64Decode = new Base64Decode();\r\n this.guidGenerator = new GuidGenerator(this.browserCrypto);\r\n this.pkceGenerator = new PkceGenerator(this.browserCrypto);\r\n this.cache = new CryptoKeyStore(this.logger);\r\n this.performanceClient = performanceClient;\r\n }\r\n /**\r\n * Creates a new random GUID - used to populate state and nonce.\r\n * @returns string (GUID)\r\n */\r\n CryptoOps.prototype.createNewGuid = function () {\r\n return this.guidGenerator.generateGuid();\r\n };\r\n /**\r\n * Encodes input string to base64.\r\n * @param input\r\n */\r\n CryptoOps.prototype.base64Encode = function (input) {\r\n return this.b64Encode.encode(input);\r\n };\r\n /**\r\n * Decodes input string from base64.\r\n * @param input\r\n */\r\n CryptoOps.prototype.base64Decode = function (input) {\r\n return this.b64Decode.decode(input);\r\n };\r\n /**\r\n * Generates PKCE codes used in Authorization Code Flow.\r\n */\r\n CryptoOps.prototype.generatePkceCodes = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n return [2 /*return*/, this.pkceGenerator.generateCodes()];\r\n });\r\n });\r\n };\r\n /**\r\n * Generates a keypair, stores it and returns a thumbprint\r\n * @param request\r\n */\r\n CryptoOps.prototype.getPublicKeyThumbprint = function (request) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var publicKeyThumbMeasurement, keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n publicKeyThumbMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);\r\n return [4 /*yield*/, this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES)];\r\n case 1:\r\n keyPair = _b.sent();\r\n return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.publicKey)];\r\n case 2:\r\n publicKeyJwk = _b.sent();\r\n pubKeyThumprintObj = {\r\n e: publicKeyJwk.e,\r\n kty: publicKeyJwk.kty,\r\n n: publicKeyJwk.n\r\n };\r\n publicJwkString = BrowserStringUtils.getSortedObjectString(pubKeyThumprintObj);\r\n return [4 /*yield*/, this.hashString(publicJwkString)];\r\n case 3:\r\n publicJwkHash = _b.sent();\r\n return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.privateKey)];\r\n case 4:\r\n privateKeyJwk = _b.sent();\r\n return [4 /*yield*/, this.browserCrypto.importJwk(privateKeyJwk, false, [\"sign\"])];\r\n case 5:\r\n unextractablePrivateKey = _b.sent();\r\n // Store Keypair data in keystore\r\n return [4 /*yield*/, this.cache.asymmetricKeys.setItem(publicJwkHash, {\r\n privateKey: unextractablePrivateKey,\r\n publicKey: keyPair.publicKey,\r\n requestMethod: request.resourceRequestMethod,\r\n requestUri: request.resourceRequestUri\r\n })];\r\n case 6:\r\n // Store Keypair data in keystore\r\n _b.sent();\r\n if (publicKeyThumbMeasurement) {\r\n publicKeyThumbMeasurement.endMeasurement({\r\n success: true\r\n });\r\n }\r\n return [2 /*return*/, publicJwkHash];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Removes cryptographic keypair from key store matching the keyId passed in\r\n * @param kid\r\n */\r\n CryptoOps.prototype.removeTokenBindingKey = function (kid) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var keyFound;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.cache.asymmetricKeys.removeItem(kid)];\r\n case 1:\r\n _a.sent();\r\n return [4 /*yield*/, this.cache.asymmetricKeys.containsKey(kid)];\r\n case 2:\r\n keyFound = _a.sent();\r\n return [2 /*return*/, !keyFound];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Removes all cryptographic keys from IndexedDB storage\r\n */\r\n CryptoOps.prototype.clearKeystore = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.cache.clear()];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Signs the given object as a jwt payload with private key retrieved by given kid.\r\n * @param payload\r\n * @param kid\r\n */\r\n CryptoOps.prototype.signJwt = function (payload, kid, correlationId) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString, encodedKeyIdThumbprint, shrHeader, encodedShrHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature, signedJwt;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n signJwtMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);\r\n return [4 /*yield*/, this.cache.asymmetricKeys.getItem(kid)];\r\n case 1:\r\n cachedKeyPair = _b.sent();\r\n if (!cachedKeyPair) {\r\n throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);\r\n }\r\n return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)];\r\n case 2:\r\n publicKeyJwk = _b.sent();\r\n publicKeyJwkString = BrowserStringUtils.getSortedObjectString(publicKeyJwk);\r\n encodedKeyIdThumbprint = this.b64Encode.urlEncode(JSON.stringify({ kid: kid }));\r\n shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });\r\n encodedShrHeader = this.b64Encode.urlEncode(shrHeader);\r\n // Generate payload\r\n payload.cnf = {\r\n jwk: JSON.parse(publicKeyJwkString)\r\n };\r\n encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));\r\n tokenString = encodedShrHeader + \".\" + encodedPayload;\r\n tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);\r\n return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];\r\n case 3:\r\n signatureBuffer = _b.sent();\r\n encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));\r\n signedJwt = tokenString + \".\" + encodedSignature;\r\n if (signJwtMeasurement) {\r\n signJwtMeasurement.endMeasurement({\r\n success: true\r\n });\r\n }\r\n return [2 /*return*/, signedJwt];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Returns the SHA-256 hash of an input string\r\n * @param plainText\r\n */\r\n CryptoOps.prototype.hashString = function (plainText) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var hashBuffer, hashBytes;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0: return [4 /*yield*/, this.browserCrypto.sha256Digest(plainText)];\r\n case 1:\r\n hashBuffer = _a.sent();\r\n hashBytes = new Uint8Array(hashBuffer);\r\n return [2 /*return*/, this.b64Encode.urlEncodeArr(hashBytes)];\r\n }\r\n });\r\n });\r\n };\r\n CryptoOps.POP_KEY_USAGES = [\"sign\", \"verify\"];\r\n CryptoOps.EXTRACTABLE = true;\r\n return CryptoOps;\r\n}());\n\nexport { CryptoOps };\n//# sourceMappingURL=CryptoOps.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar BrowserPerformanceMeasurement = /** @class */ (function () {\r\n function BrowserPerformanceMeasurement(name, correlationId) {\r\n this.correlationId = correlationId;\r\n this.measureName = BrowserPerformanceMeasurement.makeMeasureName(name, correlationId);\r\n this.startMark = BrowserPerformanceMeasurement.makeStartMark(name, correlationId);\r\n this.endMark = BrowserPerformanceMeasurement.makeEndMark(name, correlationId);\r\n }\r\n BrowserPerformanceMeasurement.makeMeasureName = function (name, correlationId) {\r\n return \"msal.measure.\" + name + \".\" + correlationId;\r\n };\r\n BrowserPerformanceMeasurement.makeStartMark = function (name, correlationId) {\r\n return \"msal.start.\" + name + \".\" + correlationId;\r\n };\r\n BrowserPerformanceMeasurement.makeEndMark = function (name, correlationId) {\r\n return \"msal.end.\" + name + \".\" + correlationId;\r\n };\r\n BrowserPerformanceMeasurement.supportsBrowserPerformance = function () {\r\n return typeof window !== \"undefined\" &&\r\n typeof window.performance !== \"undefined\" &&\r\n typeof window.performance.mark === \"function\" &&\r\n typeof window.performance.measure === \"function\" &&\r\n typeof window.performance.clearMarks === \"function\" &&\r\n typeof window.performance.clearMeasures === \"function\" &&\r\n typeof window.performance.getEntriesByName === \"function\";\r\n };\r\n /**\r\n * Flush browser marks and measurements.\r\n * @param {string} correlationId\r\n * @param {SubMeasurement} measurements\r\n */\r\n BrowserPerformanceMeasurement.flushMeasurements = function (correlationId, measurements) {\r\n if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {\r\n try {\r\n measurements.forEach(function (measurement) {\r\n var measureName = BrowserPerformanceMeasurement.makeMeasureName(measurement.name, correlationId);\r\n var entriesForMeasurement = window.performance.getEntriesByName(measureName, \"measure\");\r\n if (entriesForMeasurement.length > 0) {\r\n window.performance.clearMeasures(measureName);\r\n window.performance.clearMarks(BrowserPerformanceMeasurement.makeStartMark(measureName, correlationId));\r\n window.performance.clearMarks(BrowserPerformanceMeasurement.makeEndMark(measureName, correlationId));\r\n }\r\n });\r\n }\r\n catch (e) {\r\n // Silently catch and return null\r\n }\r\n }\r\n };\r\n BrowserPerformanceMeasurement.prototype.startMeasurement = function () {\r\n if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {\r\n try {\r\n window.performance.mark(this.startMark);\r\n }\r\n catch (e) {\r\n // Silently catch\r\n }\r\n }\r\n };\r\n BrowserPerformanceMeasurement.prototype.endMeasurement = function () {\r\n if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {\r\n try {\r\n window.performance.mark(this.endMark);\r\n window.performance.measure(this.measureName, this.startMark, this.endMark);\r\n }\r\n catch (e) {\r\n // Silently catch\r\n }\r\n }\r\n };\r\n BrowserPerformanceMeasurement.prototype.flushMeasurement = function () {\r\n if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {\r\n try {\r\n var entriesForMeasurement = window.performance.getEntriesByName(this.measureName, \"measure\");\r\n if (entriesForMeasurement.length > 0) {\r\n var durationMs = entriesForMeasurement[0].duration;\r\n window.performance.clearMeasures(this.measureName);\r\n window.performance.clearMarks(this.startMark);\r\n window.performance.clearMarks(this.endMark);\r\n return durationMs;\r\n }\r\n }\r\n catch (e) {\r\n // Silently catch and return null\r\n }\r\n }\r\n return null;\r\n };\r\n return BrowserPerformanceMeasurement;\r\n}());\n\nexport { BrowserPerformanceMeasurement };\n//# sourceMappingURL=BrowserPerformanceMeasurement.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __assign } from '../_virtual/_tslib.js';\nimport { PerformanceClient } from '@azure/msal-common';\nimport { BrowserCrypto } from '../crypto/BrowserCrypto.js';\nimport { GuidGenerator } from '../crypto/GuidGenerator.js';\nimport { BrowserPerformanceMeasurement } from './BrowserPerformanceMeasurement.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar BrowserPerformanceClient = /** @class */ (function (_super) {\r\n __extends(BrowserPerformanceClient, _super);\r\n function BrowserPerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, cryptoOptions) {\r\n var _this = _super.call(this, clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) || this;\r\n _this.browserCrypto = new BrowserCrypto(_this.logger, cryptoOptions);\r\n _this.guidGenerator = new GuidGenerator(_this.browserCrypto);\r\n return _this;\r\n }\r\n BrowserPerformanceClient.prototype.startPerformanceMeasuremeant = function (measureName, correlationId) {\r\n return new BrowserPerformanceMeasurement(measureName, correlationId);\r\n };\r\n BrowserPerformanceClient.prototype.generateId = function () {\r\n return this.guidGenerator.generateGuid();\r\n };\r\n BrowserPerformanceClient.prototype.getPageVisibility = function () {\r\n var _a;\r\n return ((_a = document.visibilityState) === null || _a === void 0 ? void 0 : _a.toString()) || null;\r\n };\r\n BrowserPerformanceClient.prototype.deleteIncompleteSubMeasurements = function (inProgressEvent) {\r\n var rootEvent = this.eventsByCorrelationId.get(inProgressEvent.event.correlationId);\r\n var isRootEvent = rootEvent && rootEvent.eventId === inProgressEvent.event.eventId;\r\n var incompleteMeasurements = [];\r\n if (isRootEvent && (rootEvent === null || rootEvent === void 0 ? void 0 : rootEvent.incompleteSubMeasurements)) {\r\n rootEvent.incompleteSubMeasurements.forEach(function (subMeasurement) {\r\n incompleteMeasurements.push(__assign({}, subMeasurement));\r\n });\r\n }\r\n // Clean up remaining marks for incomplete sub-measurements\r\n if (incompleteMeasurements.length > 0) {\r\n BrowserPerformanceMeasurement.flushMeasurements(inProgressEvent.event.correlationId, incompleteMeasurements);\r\n }\r\n };\r\n BrowserPerformanceClient.prototype.supportsBrowserPerformanceNow = function () {\r\n return typeof window !== \"undefined\" &&\r\n typeof window.performance !== \"undefined\" &&\r\n typeof window.performance.now === \"function\";\r\n };\r\n /**\r\n * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.\r\n * Also captures browser page visibilityState.\r\n *\r\n * @param {PerformanceEvents} measureName\r\n * @param {?string} [correlationId]\r\n * @returns {((event?: Partial) => PerformanceEvent| null)}\r\n */\r\n BrowserPerformanceClient.prototype.startMeasurement = function (measureName, correlationId) {\r\n var _this = this;\r\n // Capture page visibilityState and then invoke start/end measurement\r\n var startPageVisibility = this.getPageVisibility();\r\n var inProgressEvent = _super.prototype.startMeasurement.call(this, measureName, correlationId);\r\n return __assign(__assign({}, inProgressEvent), { endMeasurement: function (event) {\r\n var res = inProgressEvent.endMeasurement(__assign({ startPageVisibility: startPageVisibility, endPageVisibility: _this.getPageVisibility() }, event));\r\n _this.deleteIncompleteSubMeasurements(inProgressEvent);\r\n return res;\r\n }, discardMeasurement: function () {\r\n inProgressEvent.discardMeasurement();\r\n _this.deleteIncompleteSubMeasurements(inProgressEvent);\r\n inProgressEvent.measurement.flushMeasurement();\r\n } });\r\n };\r\n /**\r\n * Adds pre-queue time to preQueueTimeByCorrelationId map.\r\n * @param {PerformanceEvents} eventName\r\n * @param {?string} correlationId\r\n * @returns\r\n */\r\n BrowserPerformanceClient.prototype.setPreQueueTime = function (eventName, correlationId) {\r\n if (!this.supportsBrowserPerformanceNow()) {\r\n this.logger.trace(\"BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for \" + eventName);\r\n return;\r\n }\r\n if (!correlationId) {\r\n this.logger.trace(\"BrowserPerformanceClient: correlationId for \" + eventName + \" not provided, unable to set telemetry queue time\");\r\n return;\r\n }\r\n var preQueueEvent = this.preQueueTimeByCorrelationId.get(correlationId);\r\n /**\r\n * Manually complete queue measurement if there is an incomplete pre-queue event.\r\n * Incomplete pre-queue events are instrumentation bugs that should be fixed.\r\n */\r\n if (preQueueEvent) {\r\n this.logger.trace(\"BrowserPerformanceClient: Incomplete pre-queue \" + preQueueEvent.name + \" found\", correlationId);\r\n this.addQueueMeasurement(preQueueEvent.name, correlationId, undefined, true);\r\n }\r\n this.preQueueTimeByCorrelationId.set(correlationId, { name: eventName, time: window.performance.now() });\r\n };\r\n /**\r\n * Calculates and adds queue time measurement for given performance event.\r\n *\r\n * @param {PerformanceEvents} eventName\r\n * @param {?string} correlationId\r\n * @param {?number} queueTime\r\n * @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements\r\n * @returns\r\n */\r\n BrowserPerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime, manuallyCompleted) {\r\n if (!this.supportsBrowserPerformanceNow()) {\r\n this.logger.trace(\"BrowserPerformanceClient: window performance API not available, unable to add queue measurement for \" + eventName);\r\n return;\r\n }\r\n if (!correlationId) {\r\n this.logger.trace(\"BrowserPerformanceClient: correlationId for \" + eventName + \" not provided, unable to add queue measurement\");\r\n return;\r\n }\r\n var preQueueTime = _super.prototype.getPreQueueTime.call(this, eventName, correlationId);\r\n if (!preQueueTime) {\r\n return;\r\n }\r\n var currentTime = window.performance.now();\r\n var resQueueTime = queueTime || _super.prototype.calculateQueuedTime.call(this, preQueueTime, currentTime);\r\n return _super.prototype.addQueueMeasurement.call(this, eventName, correlationId, resQueueTime, manuallyCompleted);\r\n };\r\n return BrowserPerformanceClient;\r\n}(PerformanceClient));\n\nexport { BrowserPerformanceClient };\n//# sourceMappingURL=BrowserPerformanceClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { AuthToken, CacheRecord, Authority, AccountEntity, IdTokenEntity, ScopeSet, AccessTokenEntity, RefreshTokenEntity, Constants } from '@azure/msal-common';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Token cache manager\r\n */\r\nvar TokenCache = /** @class */ (function () {\r\n function TokenCache(configuration, storage, logger, cryptoObj) {\r\n this.isBrowserEnvironment = typeof window !== \"undefined\";\r\n this.config = configuration;\r\n this.storage = storage;\r\n this.logger = logger;\r\n this.cryptoObj = cryptoObj;\r\n }\r\n // Move getAllAccounts here and cache utility APIs\r\n /**\r\n * API to load tokens to msal-browser cache.\r\n * @param request\r\n * @param response\r\n * @param options\r\n * @returns `AuthenticationResult` for the response that was loaded.\r\n */\r\n TokenCache.prototype.loadExternalTokens = function (request, response, options) {\r\n this.logger.info(\"TokenCache - loadExternalTokens called\");\r\n if (!response.id_token) {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please ensure server response includes id token.\");\r\n }\r\n var idToken = new AuthToken(response.id_token, this.cryptoObj);\r\n var cacheRecord;\r\n var authority;\r\n if (request.account) {\r\n var cacheRecordAccount = this.loadAccount(idToken, request.account.environment, undefined, undefined, request.account.homeAccountId);\r\n cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment));\r\n }\r\n else if (request.authority) {\r\n var authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);\r\n var authorityOptions = {\r\n protocolMode: this.config.auth.protocolMode,\r\n knownAuthorities: this.config.auth.knownAuthorities,\r\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\r\n authorityMetadata: this.config.auth.authorityMetadata,\r\n skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,\r\n };\r\n authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger);\r\n // \"clientInfo\" from options takes precedence over \"clientInfo\" in response\r\n if (options.clientInfo) {\r\n this.logger.trace(\"TokenCache - homeAccountId from options\");\r\n var cacheRecordAccount = this.loadAccount(idToken, authority.hostnameAndPort, options.clientInfo, authority.authorityType);\r\n cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));\r\n }\r\n else if (response.client_info) {\r\n this.logger.trace(\"TokenCache - homeAccountId from response\");\r\n var cacheRecordAccount = this.loadAccount(idToken, authority.hostnameAndPort, response.client_info, authority.authorityType);\r\n cacheRecord = new CacheRecord(cacheRecordAccount, this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant), this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options), this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort));\r\n }\r\n else {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide clientInfo in the response or options.\");\r\n }\r\n }\r\n else {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide a request with an account or a request with authority.\");\r\n }\r\n return this.generateAuthenticationResult(request, idToken, cacheRecord, authority);\r\n };\r\n /**\r\n * Helper function to load account to msal-browser cache\r\n * @param idToken\r\n * @param environment\r\n * @param clientInfo\r\n * @param authorityType\r\n * @param requestHomeAccountId\r\n * @returns `AccountEntity`\r\n */\r\n TokenCache.prototype.loadAccount = function (idToken, environment, clientInfo, authorityType, requestHomeAccountId) {\r\n var homeAccountId;\r\n if (requestHomeAccountId) {\r\n homeAccountId = requestHomeAccountId;\r\n }\r\n else if (authorityType !== undefined && clientInfo) {\r\n homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authorityType, this.logger, this.cryptoObj, idToken);\r\n }\r\n if (!homeAccountId) {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"Unexpected missing homeAccountId\");\r\n }\r\n var accountEntity = clientInfo ?\r\n AccountEntity.createAccount(clientInfo, homeAccountId, idToken, undefined, undefined, undefined, environment) :\r\n AccountEntity.createGenericAccount(homeAccountId, idToken, undefined, undefined, undefined, environment);\r\n if (this.isBrowserEnvironment) {\r\n this.logger.verbose(\"TokenCache - loading account\");\r\n this.storage.setAccount(accountEntity);\r\n return accountEntity;\r\n }\r\n else {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\r\n }\r\n };\r\n /**\r\n * Helper function to load id tokens to msal-browser cache\r\n * @param idToken\r\n * @param homeAccountId\r\n * @param environment\r\n * @param tenantId\r\n * @returns `IdTokenEntity`\r\n */\r\n TokenCache.prototype.loadIdToken = function (idToken, homeAccountId, environment, tenantId) {\r\n var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountId, environment, idToken.rawToken, this.config.auth.clientId, tenantId);\r\n if (this.isBrowserEnvironment) {\r\n this.logger.verbose(\"TokenCache - loading id token\");\r\n this.storage.setIdTokenCredential(idTokenEntity);\r\n return idTokenEntity;\r\n }\r\n else {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\r\n }\r\n };\r\n /**\r\n * Helper function to load access tokens to msal-browser cache\r\n * @param request\r\n * @param response\r\n * @param homeAccountId\r\n * @param environment\r\n * @param tenantId\r\n * @returns `AccessTokenEntity`\r\n */\r\n TokenCache.prototype.loadAccessToken = function (request, response, homeAccountId, environment, tenantId, options) {\r\n if (!response.access_token) {\r\n this.logger.verbose(\"TokenCache - No access token provided for caching\");\r\n return null;\r\n }\r\n if (!response.expires_in) {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please ensure server response includes expires_in value.\");\r\n }\r\n if (!options.extendedExpiresOn) {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide an extendedExpiresOn value in the options.\");\r\n }\r\n var scopes = new ScopeSet(request.scopes).printScopes();\r\n var expiresOn = options.expiresOn || (response.expires_in + new Date().getTime() / 1000);\r\n var extendedExpiresOn = options.extendedExpiresOn;\r\n var accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, this.cryptoObj);\r\n if (this.isBrowserEnvironment) {\r\n this.logger.verbose(\"TokenCache - loading access token\");\r\n this.storage.setAccessTokenCredential(accessTokenEntity);\r\n return accessTokenEntity;\r\n }\r\n else {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\r\n }\r\n };\r\n /**\r\n * Helper function to load refresh tokens to msal-browser cache\r\n * @param request\r\n * @param response\r\n * @param homeAccountId\r\n * @param environment\r\n * @returns `RefreshTokenEntity`\r\n */\r\n TokenCache.prototype.loadRefreshToken = function (request, response, homeAccountId, environment) {\r\n if (!response.refresh_token) {\r\n this.logger.verbose(\"TokenCache - No refresh token provided for caching\");\r\n return null;\r\n }\r\n var refreshTokenEntity = RefreshTokenEntity.createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId);\r\n if (this.isBrowserEnvironment) {\r\n this.logger.verbose(\"TokenCache - loading refresh token\");\r\n this.storage.setRefreshTokenCredential(refreshTokenEntity);\r\n return refreshTokenEntity;\r\n }\r\n else {\r\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\r\n }\r\n };\r\n /**\r\n * Helper function to generate an `AuthenticationResult` for the result.\r\n * @param request\r\n * @param idTokenObj\r\n * @param cacheRecord\r\n * @param authority\r\n * @returns `AuthenticationResult`\r\n */\r\n TokenCache.prototype.generateAuthenticationResult = function (request, idTokenObj, cacheRecord, authority) {\r\n var _a, _b, _c;\r\n var accessToken = Constants.EMPTY_STRING;\r\n var responseScopes = [];\r\n var expiresOn = null;\r\n var extExpiresOn;\r\n if (cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.accessToken) {\r\n accessToken = cacheRecord.accessToken.secret;\r\n responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();\r\n expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);\r\n extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);\r\n }\r\n var uid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.oid) || (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.sub) || Constants.EMPTY_STRING;\r\n var tid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.tid) || Constants.EMPTY_STRING;\r\n return {\r\n authority: authority ? authority.canonicalAuthority : Constants.EMPTY_STRING,\r\n uniqueId: uid,\r\n tenantId: tid,\r\n scopes: responseScopes,\r\n account: (cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.account) ? cacheRecord.account.getAccountInfo() : null,\r\n idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,\r\n idTokenClaims: idTokenObj ? idTokenObj.claims : {},\r\n accessToken: accessToken,\r\n fromCache: true,\r\n expiresOn: expiresOn,\r\n correlationId: request.correlationId || Constants.EMPTY_STRING,\r\n requestId: Constants.EMPTY_STRING,\r\n extExpiresOn: extExpiresOn,\r\n familyId: Constants.EMPTY_STRING,\r\n tokenType: ((_a = cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.accessToken) === null || _a === void 0 ? void 0 : _a.tokenType) || Constants.EMPTY_STRING,\r\n state: Constants.EMPTY_STRING,\r\n cloudGraphHostName: ((_b = cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,\r\n msGraphHost: ((_c = cacheRecord === null || cacheRecord === void 0 ? void 0 : cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,\r\n code: undefined,\r\n fromNativeBroker: false\r\n };\r\n };\r\n return TokenCache;\r\n}());\n\nexport { TokenCache };\n//# sourceMappingURL=TokenCache.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends } from '../_virtual/_tslib.js';\nimport { AuthorizationCodeClient } from '@azure/msal-common';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar HybridSpaAuthorizationCodeClient = /** @class */ (function (_super) {\r\n __extends(HybridSpaAuthorizationCodeClient, _super);\r\n function HybridSpaAuthorizationCodeClient(config) {\r\n var _this = _super.call(this, config) || this;\r\n _this.includeRedirectUri = false;\r\n return _this;\r\n }\r\n return HybridSpaAuthorizationCodeClient;\r\n}(AuthorizationCodeClient));\n\nexport { HybridSpaAuthorizationCodeClient };\n//# sourceMappingURL=HybridSpaAuthorizationCodeClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { AuthError, PerformanceEvents, Constants } from '@azure/msal-common';\nimport { StandardInteractionClient } from './StandardInteractionClient.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { InteractionType } from '../utils/BrowserConstants.js';\nimport { SilentHandler } from '../interaction_handler/SilentHandler.js';\nimport { HybridSpaAuthorizationCodeClient } from './HybridSpaAuthorizationCodeClient.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar SilentAuthCodeClient = /** @class */ (function (_super) {\r\n __extends(SilentAuthCodeClient, _super);\r\n function SilentAuthCodeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeMessageHandler, correlationId) {\r\n var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;\r\n _this.apiId = apiId;\r\n return _this;\r\n }\r\n /**\r\n * Acquires a token silently by redeeming an authorization code against the /token endpoint\r\n * @param request\r\n */\r\n SilentAuthCodeClient.prototype.acquireToken = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentRequest, serverTelemetryManager, authCodeRequest, clientConfig, authClient, silentHandler, e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.logger.trace(\"SilentAuthCodeClient.acquireToken called\");\r\n // Auth code payload is required\r\n if (!request.code) {\r\n throw BrowserAuthError.createAuthCodeRequiredError();\r\n }\r\n // Create silent request\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);\r\n return [4 /*yield*/, this.initializeAuthorizationRequest(request, InteractionType.Silent)];\r\n case 1:\r\n silentRequest = _a.sent();\r\n this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);\r\n serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 4, , 5]);\r\n authCodeRequest = __assign(__assign({}, silentRequest), { code: request.code });\r\n // Initialize the client\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, request.correlationId);\r\n return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, silentRequest.authority)];\r\n case 3:\r\n clientConfig = _a.sent();\r\n authClient = new HybridSpaAuthorizationCodeClient(clientConfig);\r\n this.logger.verbose(\"Auth code client created\");\r\n silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);\r\n // Handle auth code parameters from request\r\n return [2 /*return*/, silentHandler.handleCodeResponseFromServer({\r\n code: request.code,\r\n msgraph_host: request.msGraphHost,\r\n cloud_graph_host_name: request.cloudGraphHostName,\r\n cloud_instance_host_name: request.cloudInstanceHostName\r\n }, silentRequest.state, authClient.authority, this.networkClient, false)];\r\n case 4:\r\n e_1 = _a.sent();\r\n if (e_1 instanceof AuthError) {\r\n e_1.setCorrelationId(this.correlationId);\r\n }\r\n serverTelemetryManager.cacheFailedRequest(e_1);\r\n this.browserStorage.cleanRequestByState(silentRequest.state);\r\n throw e_1;\r\n case 5: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Currently Unsupported\r\n */\r\n SilentAuthCodeClient.prototype.logout = function () {\r\n // Synchronous so we must reject\r\n return Promise.reject(BrowserAuthError.createSilentLogoutUnsupportedError());\r\n };\r\n return SilentAuthCodeClient;\r\n}(StandardInteractionClient));\n\nexport { SilentAuthCodeClient };\n//# sourceMappingURL=SilentAuthCodeClient.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { CryptoOps } from '../crypto/CryptoOps.js';\nimport { PerformanceEvents, Constants, InteractionRequiredAuthError, AuthError, ClientAuthError, PromptValue, Logger, StubPerformanceClient, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';\nimport { BrowserCacheManager, DEFAULT_BROWSER_CACHE_MANAGER } from '../cache/BrowserCacheManager.js';\nimport { buildConfiguration } from '../config/Configuration.js';\nimport { InteractionType, ApiId, TemporaryCacheKeys, CacheLookupPolicy, BrowserCacheLocation } from '../utils/BrowserConstants.js';\nimport { BrowserUtils } from '../utils/BrowserUtils.js';\nimport { name, version } from '../packageMetadata.js';\nimport { EventType } from '../event/EventType.js';\nimport { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js';\nimport { EventHandler } from '../event/EventHandler.js';\nimport { PopupClient } from '../interaction_client/PopupClient.js';\nimport { RedirectClient } from '../interaction_client/RedirectClient.js';\nimport { SilentIframeClient } from '../interaction_client/SilentIframeClient.js';\nimport { SilentRefreshClient } from '../interaction_client/SilentRefreshClient.js';\nimport { TokenCache } from '../cache/TokenCache.js';\nimport { NativeInteractionClient } from '../interaction_client/NativeInteractionClient.js';\nimport { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.js';\nimport { NativeAuthError } from '../error/NativeAuthError.js';\nimport { SilentCacheClient } from '../interaction_client/SilentCacheClient.js';\nimport { SilentAuthCodeClient } from '../interaction_client/SilentAuthCodeClient.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { BrowserPerformanceClient } from '../telemetry/BrowserPerformanceClient.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nvar ClientApplication = /** @class */ (function () {\r\n /**\r\n * @constructor\r\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\r\n *\r\n * Important attributes in the Configuration object for auth are:\r\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\r\n * - authority: the authority URL for your application.\r\n * - redirect_uri: the uri of your application registered in the portal.\r\n *\r\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\r\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\r\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\r\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\r\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\r\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\r\n *\r\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\r\n * Full B2C functionality will be available in this library in future versions.\r\n *\r\n * @param configuration Object for the MSAL PublicClientApplication instance\r\n */\r\n function ClientApplication(configuration) {\r\n /*\r\n * If loaded in an environment where window is not available,\r\n * set internal flag to false so that further requests fail.\r\n * This is to support server-side rendering environments.\r\n */\r\n this.isBrowserEnvironment = typeof window !== \"undefined\";\r\n // Set the configuration.\r\n this.config = buildConfiguration(configuration, this.isBrowserEnvironment);\r\n this.initialized = false;\r\n // Initialize logger\r\n this.logger = new Logger(this.config.system.loggerOptions, name, version);\r\n // Initialize the network module class.\r\n this.networkClient = this.config.system.networkClient;\r\n // Initialize the navigation client class.\r\n this.navigationClient = this.config.system.navigationClient;\r\n // Initialize redirectResponse Map\r\n this.redirectResponse = new Map();\r\n // Initial hybrid spa map\r\n this.hybridAuthCodeResponses = new Map();\r\n // Initialize performance client\r\n this.performanceClient = this.isBrowserEnvironment ?\r\n new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application, this.config.system.cryptoOptions) :\r\n new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);\r\n // Initialize the crypto class.\r\n this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger, this.performanceClient, this.config.system.cryptoOptions) : DEFAULT_CRYPTO_IMPLEMENTATION;\r\n this.eventHandler = new EventHandler(this.logger, this.browserCrypto);\r\n // Initialize the browser storage class.\r\n this.browserStorage = this.isBrowserEnvironment ?\r\n new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger) :\r\n DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);\r\n // initialize in memory storage for native flows\r\n var nativeCacheOptions = {\r\n cacheLocation: BrowserCacheLocation.MemoryStorage,\r\n temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,\r\n storeAuthStateInCookie: false,\r\n secureCookies: false,\r\n cacheMigrationEnabled: false\r\n };\r\n this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);\r\n // Initialize the token cache\r\n this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);\r\n // Register listener functions\r\n this.trackPageVisibilityWithMeasurement = this.trackPageVisibilityWithMeasurement.bind(this);\r\n }\r\n /**\r\n * Initializer function to perform async startup tasks such as connecting to WAM extension\r\n */\r\n ClientApplication.prototype.initialize = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var allowNativeBroker, initMeasurement, _a, e_1;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n this.logger.trace(\"initialize called\");\r\n if (this.initialized) {\r\n this.logger.info(\"initialize has already been called, exiting early.\");\r\n return [2 /*return*/];\r\n }\r\n allowNativeBroker = this.config.system.allowNativeBroker;\r\n initMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.InitializeClientApplication);\r\n this.eventHandler.emitEvent(EventType.INITIALIZE_START);\r\n if (!allowNativeBroker) return [3 /*break*/, 4];\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n _a = this;\r\n return [4 /*yield*/, NativeMessageHandler.createProvider(this.logger, this.config.system.nativeBrokerHandshakeTimeout, this.performanceClient)];\r\n case 2:\r\n _a.nativeExtensionProvider = _b.sent();\r\n return [3 /*break*/, 4];\r\n case 3:\r\n e_1 = _b.sent();\r\n this.logger.verbose(e_1);\r\n return [3 /*break*/, 4];\r\n case 4:\r\n this.initialized = true;\r\n this.eventHandler.emitEvent(EventType.INITIALIZE_END);\r\n initMeasurement.endMeasurement({ allowNativeBroker: allowNativeBroker, success: true });\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n // #region Redirect Flow\r\n /**\r\n * Event handler function which allows users to fire events after the PublicClientApplication object\r\n * has loaded during redirect flows. This should be invoked on all page loads involved in redirect\r\n * auth flows.\r\n * @param hash Hash to process. Defaults to the current value of window.location.hash. Only needs to be provided explicitly if the response to be handled is not contained in the current value.\r\n * @returns Token response or null. If the return value is null, then no auth redirect was detected.\r\n */\r\n ClientApplication.prototype.handleRedirectPromise = function (hash) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var loggedInAccounts, redirectResponseKey, response, request, redirectResponse, nativeClient, correlationId, redirectClient;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n this.logger.verbose(\"handleRedirectPromise called\");\r\n // Block token acquisition before initialize has been called if native brokering is enabled\r\n BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);\r\n loggedInAccounts = this.getAllAccounts();\r\n if (this.isBrowserEnvironment) {\r\n redirectResponseKey = hash || Constants.EMPTY_STRING;\r\n response = this.redirectResponse.get(redirectResponseKey);\r\n if (typeof response === \"undefined\") {\r\n this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, InteractionType.Redirect);\r\n this.logger.verbose(\"handleRedirectPromise has been called for the first time, storing the promise\");\r\n request = this.browserStorage.getCachedNativeRequest();\r\n redirectResponse = void 0;\r\n if (request && NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) && this.nativeExtensionProvider && !hash) {\r\n this.logger.trace(\"handleRedirectPromise - acquiring token from native platform\");\r\n nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);\r\n redirectResponse = nativeClient.handleRedirectPromise();\r\n }\r\n else {\r\n this.logger.trace(\"handleRedirectPromise - acquiring token from web flow\");\r\n correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;\r\n redirectClient = this.createRedirectClient(correlationId);\r\n redirectResponse = redirectClient.handleRedirectPromise(hash);\r\n }\r\n response = redirectResponse.then(function (result) {\r\n if (result) {\r\n // Emit login event if number of accounts change\r\n var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;\r\n if (isLoggingIn) {\r\n _this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Redirect, result);\r\n _this.logger.verbose(\"handleRedirectResponse returned result, login success\");\r\n }\r\n else {\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Redirect, result);\r\n _this.logger.verbose(\"handleRedirectResponse returned result, acquire token success\");\r\n }\r\n }\r\n _this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);\r\n return result;\r\n }).catch(function (e) {\r\n // Emit login event if there is an account\r\n if (loggedInAccounts.length > 0) {\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e);\r\n }\r\n else {\r\n _this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, e);\r\n }\r\n _this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);\r\n throw e;\r\n });\r\n this.redirectResponse.set(redirectResponseKey, response);\r\n }\r\n else {\r\n this.logger.verbose(\"handleRedirectPromise has been called previously, returning the result from the first call\");\r\n }\r\n return [2 /*return*/, response];\r\n }\r\n this.logger.verbose(\"handleRedirectPromise returns null, not browser environment\");\r\n return [2 /*return*/, null];\r\n });\r\n });\r\n };\r\n /**\r\n * Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects\r\n * the page, so any code that follows this function will not execute.\r\n *\r\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\r\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\r\n *\r\n * @param request\r\n */\r\n ClientApplication.prototype.acquireTokenRedirect = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var correlationId, isLoggedIn, result, nativeClient, redirectClient;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n correlationId = this.getRequestCorrelationId(request);\r\n this.logger.verbose(\"acquireTokenRedirect called\", correlationId);\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);\r\n isLoggedIn = this.getAllAccounts().length > 0;\r\n if (isLoggedIn) {\r\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Redirect, request);\r\n }\r\n else {\r\n this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Redirect, request);\r\n }\r\n if (this.nativeExtensionProvider && this.canUseNative(request)) {\r\n nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);\r\n result = nativeClient.acquireTokenRedirect(request).catch(function (e) {\r\n if (e instanceof NativeAuthError && e.isFatal()) {\r\n _this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt\r\n var redirectClient = _this.createRedirectClient(request.correlationId);\r\n return redirectClient.acquireToken(request);\r\n }\r\n else if (e instanceof InteractionRequiredAuthError) {\r\n _this.logger.verbose(\"acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow\");\r\n var redirectClient = _this.createRedirectClient(request.correlationId);\r\n return redirectClient.acquireToken(request);\r\n }\r\n _this.browserStorage.setInteractionInProgress(false);\r\n throw e;\r\n });\r\n }\r\n else {\r\n redirectClient = this.createRedirectClient(request.correlationId);\r\n result = redirectClient.acquireToken(request);\r\n }\r\n return [2 /*return*/, result.catch(function (e) {\r\n // If logged in, emit acquire token events\r\n if (isLoggedIn) {\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e);\r\n }\r\n else {\r\n _this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, e);\r\n }\r\n throw e;\r\n })];\r\n });\r\n });\r\n };\r\n // #endregion\r\n // #region Popup Flow\r\n /**\r\n * Use when you want to obtain an access_token for your API via opening a popup window in the user's browser\r\n *\r\n * @param request\r\n *\r\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\r\n */\r\n ClientApplication.prototype.acquireTokenPopup = function (request) {\r\n var _this = this;\r\n var correlationId = this.getRequestCorrelationId(request);\r\n var atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);\r\n try {\r\n this.logger.verbose(\"acquireTokenPopup called\", correlationId);\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Popup);\r\n }\r\n catch (e) {\r\n // Since this function is syncronous we need to reject\r\n return Promise.reject(e);\r\n }\r\n // If logged in, emit acquire token events\r\n var loggedInAccounts = this.getAllAccounts();\r\n if (loggedInAccounts.length > 0) {\r\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Popup, request);\r\n }\r\n else {\r\n this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Popup, request);\r\n }\r\n var result;\r\n if (this.canUseNative(request)) {\r\n result = this.acquireTokenNative(request, ApiId.acquireTokenPopup).then(function (response) {\r\n _this.browserStorage.setInteractionInProgress(false);\r\n atPopupMeasurement.endMeasurement({\r\n success: true,\r\n isNativeBroker: true,\r\n requestId: response.requestId\r\n });\r\n return response;\r\n }).catch(function (e) {\r\n if (e instanceof NativeAuthError && e.isFatal()) {\r\n _this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt\r\n var popupClient = _this.createPopupClient(request.correlationId);\r\n return popupClient.acquireToken(request);\r\n }\r\n else if (e instanceof InteractionRequiredAuthError) {\r\n _this.logger.verbose(\"acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow\");\r\n var popupClient = _this.createPopupClient(request.correlationId);\r\n return popupClient.acquireToken(request);\r\n }\r\n _this.browserStorage.setInteractionInProgress(false);\r\n throw e;\r\n });\r\n }\r\n else {\r\n var popupClient = this.createPopupClient(request.correlationId);\r\n result = popupClient.acquireToken(request);\r\n }\r\n return result.then(function (result) {\r\n /*\r\n * If logged in, emit acquire token events\r\n */\r\n var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;\r\n if (isLoggingIn) {\r\n _this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Popup, result);\r\n }\r\n else {\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Popup, result);\r\n }\r\n atPopupMeasurement.addStaticFields({\r\n accessTokenSize: result.accessToken.length,\r\n idTokenSize: result.idToken.length\r\n });\r\n atPopupMeasurement.endMeasurement({\r\n success: true,\r\n requestId: result.requestId\r\n });\r\n return result;\r\n }).catch(function (e) {\r\n if (loggedInAccounts.length > 0) {\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Popup, null, e);\r\n }\r\n else {\r\n _this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Popup, null, e);\r\n }\r\n atPopupMeasurement.endMeasurement({\r\n errorCode: e.errorCode,\r\n subErrorCode: e.subError,\r\n success: false\r\n });\r\n // Since this function is syncronous we need to reject\r\n return Promise.reject(e);\r\n });\r\n };\r\n ClientApplication.prototype.trackPageVisibilityWithMeasurement = function () {\r\n var measurement = this.ssoSilentMeasurement || this.acquireTokenByCodeAsyncMeasurement;\r\n if (!measurement) {\r\n return;\r\n }\r\n this.logger.info(\"Perf: Visibility change detected in \", measurement.event.name);\r\n measurement.increment({\r\n visibilityChangeCount: 1,\r\n });\r\n };\r\n // #endregion\r\n // #region Silent Flow\r\n /**\r\n * This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:\r\n * - Any browser using a form of Intelligent Tracking Prevention\r\n * - If there is not an established session with the service\r\n *\r\n * In these cases, the request must be done inside a popup or full frame redirect.\r\n *\r\n * For the cases where interaction is required, you cannot send a request with prompt=none.\r\n *\r\n * If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as\r\n * you session on the server still exists.\r\n * @param request {@link SsoSilentRequest}\r\n *\r\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\r\n */\r\n ClientApplication.prototype.ssoSilent = function (request) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var correlationId, validRequest, result, silentIframeClient;\r\n var _this = this;\r\n return __generator(this, function (_b) {\r\n correlationId = this.getRequestCorrelationId(request);\r\n validRequest = __assign(__assign({}, request), { \r\n // will be PromptValue.NONE or PromptValue.NO_SESSION\r\n prompt: request.prompt, correlationId: correlationId });\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\r\n this.ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);\r\n (_a = this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.increment({\r\n visibilityChangeCount: 0\r\n });\r\n document.addEventListener(\"visibilitychange\", this.trackPageVisibilityWithMeasurement);\r\n this.logger.verbose(\"ssoSilent called\", correlationId);\r\n this.eventHandler.emitEvent(EventType.SSO_SILENT_START, InteractionType.Silent, validRequest);\r\n if (this.canUseNative(validRequest)) {\r\n result = this.acquireTokenNative(validRequest, ApiId.ssoSilent).catch(function (e) {\r\n // If native token acquisition fails for availability reasons fallback to standard flow\r\n if (e instanceof NativeAuthError && e.isFatal()) {\r\n _this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt\r\n var silentIframeClient = _this.createSilentIframeClient(validRequest.correlationId);\r\n return silentIframeClient.acquireToken(validRequest);\r\n }\r\n throw e;\r\n });\r\n }\r\n else {\r\n silentIframeClient = this.createSilentIframeClient(validRequest.correlationId);\r\n result = silentIframeClient.acquireToken(validRequest);\r\n }\r\n return [2 /*return*/, result.then(function (response) {\r\n var _a, _b;\r\n _this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, InteractionType.Silent, response);\r\n (_a = _this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.addStaticFields({\r\n accessTokenSize: response.accessToken.length,\r\n idTokenSize: response.idToken.length\r\n });\r\n (_b = _this.ssoSilentMeasurement) === null || _b === void 0 ? void 0 : _b.endMeasurement({\r\n success: true,\r\n isNativeBroker: response.fromNativeBroker,\r\n requestId: response.requestId\r\n });\r\n return response;\r\n }).catch(function (e) {\r\n var _a;\r\n _this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, InteractionType.Silent, null, e);\r\n (_a = _this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({\r\n errorCode: e.errorCode,\r\n subErrorCode: e.subError,\r\n success: false\r\n });\r\n throw e;\r\n }).finally(function () {\r\n document.removeEventListener(\"visibilitychange\", _this.trackPageVisibilityWithMeasurement);\r\n })];\r\n });\r\n });\r\n };\r\n /**\r\n * This function redeems an authorization code (passed as code) from the eSTS token endpoint.\r\n * This authorization code should be acquired server-side using a confidential client to acquire a spa_code.\r\n * This API is not indended for normal authorization code acquisition and redemption.\r\n *\r\n * Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.\r\n *\r\n * @param request {@link AuthorizationCodeRequest}\r\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\r\n */\r\n ClientApplication.prototype.acquireTokenByCode = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var correlationId, atbcMeasurement, hybridAuthCode_1, response;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n correlationId = this.getRequestCorrelationId(request);\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\r\n this.logger.trace(\"acquireTokenByCode called\", correlationId);\r\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, InteractionType.Silent, request);\r\n atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, request.correlationId);\r\n try {\r\n if (request.code && request.nativeAccountId) {\r\n // Throw error in case server returns both spa_code and spa_accountid in exchange for auth code.\r\n throw BrowserAuthError.createSpaCodeAndNativeAccountIdPresentError();\r\n }\r\n else if (request.code) {\r\n hybridAuthCode_1 = request.code;\r\n response = this.hybridAuthCodeResponses.get(hybridAuthCode_1);\r\n if (!response) {\r\n this.logger.verbose(\"Initiating new acquireTokenByCode request\", correlationId);\r\n response = this.acquireTokenByCodeAsync(__assign(__assign({}, request), { correlationId: correlationId }))\r\n .then(function (result) {\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, InteractionType.Silent, result);\r\n _this.hybridAuthCodeResponses.delete(hybridAuthCode_1);\r\n atbcMeasurement.addStaticFields({\r\n accessTokenSize: result.accessToken.length,\r\n idTokenSize: result.idToken.length\r\n });\r\n atbcMeasurement.endMeasurement({\r\n success: true,\r\n isNativeBroker: result.fromNativeBroker,\r\n requestId: result.requestId\r\n });\r\n return result;\r\n })\r\n .catch(function (error) {\r\n _this.hybridAuthCodeResponses.delete(hybridAuthCode_1);\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, error);\r\n atbcMeasurement.endMeasurement({\r\n errorCode: error.errorCode,\r\n subErrorCode: error.subError,\r\n success: false\r\n });\r\n throw error;\r\n });\r\n this.hybridAuthCodeResponses.set(hybridAuthCode_1, response);\r\n }\r\n else {\r\n this.logger.verbose(\"Existing acquireTokenByCode request found\", request.correlationId);\r\n atbcMeasurement.discardMeasurement();\r\n }\r\n return [2 /*return*/, response];\r\n }\r\n else if (request.nativeAccountId) {\r\n if (this.canUseNative(request, request.nativeAccountId)) {\r\n return [2 /*return*/, this.acquireTokenNative(request, ApiId.acquireTokenByCode, request.nativeAccountId).catch(function (e) {\r\n // If native token acquisition fails for availability reasons fallback to standard flow\r\n if (e instanceof NativeAuthError && e.isFatal()) {\r\n _this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt\r\n }\r\n throw e;\r\n })];\r\n }\r\n else {\r\n throw BrowserAuthError.createUnableToAcquireTokenFromNativePlatformError();\r\n }\r\n }\r\n else {\r\n throw BrowserAuthError.createAuthCodeOrNativeAccountIdRequiredError();\r\n }\r\n }\r\n catch (e) {\r\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, e);\r\n atbcMeasurement.endMeasurement({\r\n errorCode: e instanceof AuthError && e.errorCode || undefined,\r\n subErrorCode: e instanceof AuthError && e.subError || undefined,\r\n success: false\r\n });\r\n throw e;\r\n }\r\n return [2 /*return*/];\r\n });\r\n });\r\n };\r\n /**\r\n * Creates a SilentAuthCodeClient to redeem an authorization code.\r\n * @param request\r\n * @returns Result of the operation to redeem the authorization code\r\n */\r\n ClientApplication.prototype.acquireTokenByCodeAsync = function (request) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentAuthCodeClient, silentTokenResult;\r\n var _this = this;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n this.logger.trace(\"acquireTokenByCodeAsync called\", request.correlationId);\r\n this.acquireTokenByCodeAsyncMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCodeAsync, request.correlationId);\r\n (_a = this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.increment({\r\n visibilityChangeCount: 0\r\n });\r\n document.addEventListener(\"visibilitychange\", this.trackPageVisibilityWithMeasurement);\r\n silentAuthCodeClient = this.createSilentAuthCodeClient(request.correlationId);\r\n return [4 /*yield*/, silentAuthCodeClient.acquireToken(request).then(function (response) {\r\n var _a;\r\n (_a = _this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({\r\n success: true,\r\n fromCache: response.fromCache,\r\n isNativeBroker: response.fromNativeBroker,\r\n requestId: response.requestId\r\n });\r\n return response;\r\n }).catch(function (tokenRenewalError) {\r\n var _a;\r\n (_a = _this.acquireTokenByCodeAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({\r\n errorCode: tokenRenewalError.errorCode,\r\n subErrorCode: tokenRenewalError.subError,\r\n success: false\r\n });\r\n throw tokenRenewalError;\r\n }).finally(function () {\r\n document.removeEventListener(\"visibilitychange\", _this.trackPageVisibilityWithMeasurement);\r\n })];\r\n case 1:\r\n silentTokenResult = _b.sent();\r\n return [2 /*return*/, silentTokenResult];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Attempt to acquire an access token from the cache\r\n * @param silentCacheClient SilentCacheClient\r\n * @param commonRequest CommonSilentFlowRequest\r\n * @param silentRequest SilentRequest\r\n * @returns A promise that, when resolved, returns the access token\r\n */\r\n ClientApplication.prototype.acquireTokenFromCache = function (silentCacheClient, commonRequest, silentRequest) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n return __generator(this, function (_a) {\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenFromCache, commonRequest.correlationId);\r\n switch (silentRequest.cacheLookupPolicy) {\r\n case CacheLookupPolicy.Default:\r\n case CacheLookupPolicy.AccessToken:\r\n case CacheLookupPolicy.AccessTokenAndRefreshToken:\r\n return [2 /*return*/, silentCacheClient.acquireToken(commonRequest)];\r\n default:\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n return [2 /*return*/];\r\n });\r\n });\r\n };\r\n /**\r\n * Attempt to acquire an access token via a refresh token\r\n * @param commonRequest CommonSilentFlowRequest\r\n * @param silentRequest SilentRequest\r\n * @returns A promise that, when resolved, returns the access token\r\n */\r\n ClientApplication.prototype.acquireTokenByRefreshToken = function (commonRequest, silentRequest) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentRefreshClient;\r\n return __generator(this, function (_a) {\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenByRefreshToken, commonRequest.correlationId);\r\n switch (silentRequest.cacheLookupPolicy) {\r\n case CacheLookupPolicy.Default:\r\n case CacheLookupPolicy.AccessTokenAndRefreshToken:\r\n case CacheLookupPolicy.RefreshToken:\r\n case CacheLookupPolicy.RefreshTokenAndNetwork:\r\n silentRefreshClient = this.createSilentRefreshClient(commonRequest.correlationId);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.SilentRefreshClientAcquireToken, commonRequest.correlationId);\r\n return [2 /*return*/, silentRefreshClient.acquireToken(commonRequest)];\r\n default:\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n return [2 /*return*/];\r\n });\r\n });\r\n };\r\n /**\r\n * Attempt to acquire an access token via an iframe\r\n * @param request CommonSilentFlowRequest\r\n * @returns A promise that, when resolved, returns the access token\r\n */\r\n ClientApplication.prototype.acquireTokenBySilentIframe = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var silentIframeClient;\r\n return __generator(this, function (_a) {\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenBySilentIframe, request.correlationId);\r\n silentIframeClient = this.createSilentIframeClient(request.correlationId);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);\r\n return [2 /*return*/, silentIframeClient.acquireToken(request)];\r\n });\r\n });\r\n };\r\n // #endregion\r\n // #region Logout\r\n /**\r\n * Deprecated logout function. Use logoutRedirect or logoutPopup instead\r\n * @param logoutRequest\r\n * @deprecated\r\n */\r\n ClientApplication.prototype.logout = function (logoutRequest) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var correlationId;\r\n return __generator(this, function (_a) {\r\n correlationId = this.getRequestCorrelationId(logoutRequest);\r\n this.logger.warning(\"logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.\", correlationId);\r\n return [2 /*return*/, this.logoutRedirect(__assign({ correlationId: correlationId }, logoutRequest))];\r\n });\r\n });\r\n };\r\n /**\r\n * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Default behaviour is to redirect the user to `window.location.href`.\r\n * @param logoutRequest\r\n */\r\n ClientApplication.prototype.logoutRedirect = function (logoutRequest) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var correlationId, redirectClient;\r\n return __generator(this, function (_a) {\r\n correlationId = this.getRequestCorrelationId(logoutRequest);\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);\r\n redirectClient = this.createRedirectClient(correlationId);\r\n return [2 /*return*/, redirectClient.logout(logoutRequest)];\r\n });\r\n });\r\n };\r\n /**\r\n * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server\r\n * @param logoutRequest\r\n */\r\n ClientApplication.prototype.logoutPopup = function (logoutRequest) {\r\n try {\r\n var correlationId = this.getRequestCorrelationId(logoutRequest);\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Popup);\r\n var popupClient = this.createPopupClient(correlationId);\r\n return popupClient.logout(logoutRequest);\r\n }\r\n catch (e) {\r\n // Since this function is syncronous we need to reject\r\n return Promise.reject(e);\r\n }\r\n };\r\n // #endregion\r\n // #region Account APIs\r\n /**\r\n * Returns all accounts that MSAL currently has data for.\r\n * (the account object is created at the time of successful login)\r\n * or empty array when no accounts are found\r\n * @returns Array of account objects in cache\r\n */\r\n ClientApplication.prototype.getAllAccounts = function () {\r\n this.logger.verbose(\"getAllAccounts called\");\r\n return this.isBrowserEnvironment ? this.browserStorage.getAllAccounts() : [];\r\n };\r\n /**\r\n * Returns the signed in account matching username.\r\n * (the account object is created at the time of successful login)\r\n * or null when no matching account is found.\r\n * This API is provided for convenience but getAccountById should be used for best reliability\r\n * @param username\r\n * @returns The account object stored in MSAL\r\n */\r\n ClientApplication.prototype.getAccountByUsername = function (username) {\r\n this.logger.trace(\"getAccountByUsername called\");\r\n if (!username) {\r\n this.logger.warning(\"getAccountByUsername: No username provided\");\r\n return null;\r\n }\r\n var account = this.browserStorage.getAccountInfoFilteredBy({ username: username });\r\n if (account) {\r\n this.logger.verbose(\"getAccountByUsername: Account matching username found, returning\");\r\n this.logger.verbosePii(\"getAccountByUsername: Returning signed-in accounts matching username: \" + username);\r\n return account;\r\n }\r\n else {\r\n this.logger.verbose(\"getAccountByUsername: No matching account found, returning null\");\r\n return null;\r\n }\r\n };\r\n /**\r\n * Returns the signed in account matching homeAccountId.\r\n * (the account object is created at the time of successful login)\r\n * or null when no matching account is found\r\n * @param homeAccountId\r\n * @returns The account object stored in MSAL\r\n */\r\n ClientApplication.prototype.getAccountByHomeId = function (homeAccountId) {\r\n this.logger.trace(\"getAccountByHomeId called\");\r\n if (!homeAccountId) {\r\n this.logger.warning(\"getAccountByHomeId: No homeAccountId provided\");\r\n return null;\r\n }\r\n var account = this.browserStorage.getAccountInfoFilteredBy({ homeAccountId: homeAccountId });\r\n if (account) {\r\n this.logger.verbose(\"getAccountByHomeId: Account matching homeAccountId found, returning\");\r\n this.logger.verbosePii(\"getAccountByHomeId: Returning signed-in accounts matching homeAccountId: \" + homeAccountId);\r\n return account;\r\n }\r\n else {\r\n this.logger.verbose(\"getAccountByHomeId: No matching account found, returning null\");\r\n return null;\r\n }\r\n };\r\n /**\r\n * Returns the signed in account matching localAccountId.\r\n * (the account object is created at the time of successful login)\r\n * or null when no matching account is found\r\n * @param localAccountId\r\n * @returns The account object stored in MSAL\r\n */\r\n ClientApplication.prototype.getAccountByLocalId = function (localAccountId) {\r\n this.logger.trace(\"getAccountByLocalId called\");\r\n if (!localAccountId) {\r\n this.logger.warning(\"getAccountByLocalId: No localAccountId provided\");\r\n return null;\r\n }\r\n var account = this.browserStorage.getAccountInfoFilteredBy({ localAccountId: localAccountId });\r\n if (account) {\r\n this.logger.verbose(\"getAccountByLocalId: Account matching localAccountId found, returning\");\r\n this.logger.verbosePii(\"getAccountByLocalId: Returning signed-in accounts matching localAccountId: \" + localAccountId);\r\n return account;\r\n }\r\n else {\r\n this.logger.verbose(\"getAccountByLocalId: No matching account found, returning null\");\r\n return null;\r\n }\r\n };\r\n /**\r\n * Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.\r\n * @param account\r\n */\r\n ClientApplication.prototype.setActiveAccount = function (account) {\r\n this.browserStorage.setActiveAccount(account);\r\n };\r\n /**\r\n * Gets the currently active account\r\n */\r\n ClientApplication.prototype.getActiveAccount = function () {\r\n return this.browserStorage.getActiveAccount();\r\n };\r\n // #endregion\r\n // #region Helpers\r\n /**\r\n * Helper to validate app environment before making an auth request\r\n *\r\n * @protected\r\n * @param {InteractionType} interactionType What kind of interaction is being used\r\n * @param {boolean} [setInteractionInProgress=true] Whether to set interaction in progress temp cache flag\r\n */\r\n ClientApplication.prototype.preflightBrowserEnvironmentCheck = function (interactionType, setInteractionInProgress) {\r\n if (setInteractionInProgress === void 0) { setInteractionInProgress = true; }\r\n this.logger.verbose(\"preflightBrowserEnvironmentCheck started\");\r\n // Block request if not in browser environment\r\n BrowserUtils.blockNonBrowserEnvironment(this.isBrowserEnvironment);\r\n // Block redirects if in an iframe\r\n BrowserUtils.blockRedirectInIframe(interactionType, this.config.system.allowRedirectInIframe);\r\n // Block auth requests inside a hidden iframe\r\n BrowserUtils.blockReloadInHiddenIframes();\r\n // Block redirectUri opened in a popup from calling MSAL APIs\r\n BrowserUtils.blockAcquireTokenInPopups();\r\n // Block token acquisition before initialize has been called if native brokering is enabled\r\n BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);\r\n // Block redirects if memory storage is enabled but storeAuthStateInCookie is not\r\n if (interactionType === InteractionType.Redirect &&\r\n this.config.cache.cacheLocation === BrowserCacheLocation.MemoryStorage &&\r\n !this.config.cache.storeAuthStateInCookie) {\r\n throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();\r\n }\r\n if (interactionType === InteractionType.Redirect || interactionType === InteractionType.Popup) {\r\n this.preflightInteractiveRequest(setInteractionInProgress);\r\n }\r\n };\r\n /**\r\n * Preflight check for interactive requests\r\n *\r\n * @protected\r\n * @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag\r\n */\r\n ClientApplication.prototype.preflightInteractiveRequest = function (setInteractionInProgress) {\r\n this.logger.verbose(\"preflightInteractiveRequest called, validating app environment\");\r\n // block the reload if it occurred inside a hidden iframe\r\n BrowserUtils.blockReloadInHiddenIframes();\r\n // Set interaction in progress temporary cache or throw if alread set.\r\n if (setInteractionInProgress) {\r\n this.browserStorage.setInteractionInProgress(true);\r\n }\r\n };\r\n /**\r\n * Acquire a token from native device (e.g. WAM)\r\n * @param request\r\n */\r\n ClientApplication.prototype.acquireTokenNative = function (request, apiId, accountId) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var nativeClient;\r\n return __generator(this, function (_a) {\r\n this.logger.trace(\"acquireTokenNative called\");\r\n if (!this.nativeExtensionProvider) {\r\n throw BrowserAuthError.createNativeConnectionNotEstablishedError();\r\n }\r\n nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.nativeExtensionProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);\r\n return [2 /*return*/, nativeClient.acquireToken(request)];\r\n });\r\n });\r\n };\r\n /**\r\n * Returns boolean indicating if this request can use the native broker\r\n * @param request\r\n */\r\n ClientApplication.prototype.canUseNative = function (request, accountId) {\r\n this.logger.trace(\"canUseNative called\");\r\n if (!NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme)) {\r\n this.logger.trace(\"canUseNative: isNativeAvailable returned false, returning false\");\r\n return false;\r\n }\r\n if (request.prompt) {\r\n switch (request.prompt) {\r\n case PromptValue.NONE:\r\n case PromptValue.CONSENT:\r\n case PromptValue.LOGIN:\r\n this.logger.trace(\"canUseNative: prompt is compatible with native flow\");\r\n break;\r\n default:\r\n this.logger.trace(\"canUseNative: prompt = \" + request.prompt + \" is not compatible with native flow, returning false\");\r\n return false;\r\n }\r\n }\r\n if (!accountId && !this.getNativeAccountId(request)) {\r\n this.logger.trace(\"canUseNative: nativeAccountId is not available, returning false\");\r\n return false;\r\n }\r\n return true;\r\n };\r\n /**\r\n * Get the native accountId from the account\r\n * @param request\r\n * @returns\r\n */\r\n ClientApplication.prototype.getNativeAccountId = function (request) {\r\n var account = request.account || this.browserStorage.getAccountInfoByHints(request.loginHint, request.sid) || this.getActiveAccount();\r\n return account && account.nativeAccountId || \"\";\r\n };\r\n /**\r\n * Returns new instance of the Popup Interaction Client\r\n * @param correlationId\r\n */\r\n ClientApplication.prototype.createPopupClient = function (correlationId) {\r\n return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);\r\n };\r\n /**\r\n * Returns new instance of the Redirect Interaction Client\r\n * @param correlationId\r\n */\r\n ClientApplication.prototype.createRedirectClient = function (correlationId) {\r\n return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);\r\n };\r\n /**\r\n * Returns new instance of the Silent Iframe Interaction Client\r\n * @param correlationId\r\n */\r\n ClientApplication.prototype.createSilentIframeClient = function (correlationId) {\r\n return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);\r\n };\r\n /**\r\n * Returns new instance of the Silent Cache Interaction Client\r\n */\r\n ClientApplication.prototype.createSilentCacheClient = function (correlationId) {\r\n return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);\r\n };\r\n /**\r\n * Returns new instance of the Silent Refresh Interaction Client\r\n */\r\n ClientApplication.prototype.createSilentRefreshClient = function (correlationId) {\r\n return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);\r\n };\r\n /**\r\n * Returns new instance of the Silent AuthCode Interaction Client\r\n */\r\n ClientApplication.prototype.createSilentAuthCodeClient = function (correlationId) {\r\n return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, this.nativeExtensionProvider, correlationId);\r\n };\r\n /**\r\n * Adds event callbacks to array\r\n * @param callback\r\n */\r\n ClientApplication.prototype.addEventCallback = function (callback) {\r\n return this.eventHandler.addEventCallback(callback);\r\n };\r\n /**\r\n * Removes callback with provided id from callback array\r\n * @param callbackId\r\n */\r\n ClientApplication.prototype.removeEventCallback = function (callbackId) {\r\n this.eventHandler.removeEventCallback(callbackId);\r\n };\r\n /**\r\n * Registers a callback to receive performance events.\r\n *\r\n * @param {PerformanceCallbackFunction} callback\r\n * @returns {string}\r\n */\r\n ClientApplication.prototype.addPerformanceCallback = function (callback) {\r\n return this.performanceClient.addPerformanceCallback(callback);\r\n };\r\n /**\r\n * Removes a callback registered with addPerformanceCallback.\r\n *\r\n * @param {string} callbackId\r\n * @returns {boolean}\r\n */\r\n ClientApplication.prototype.removePerformanceCallback = function (callbackId) {\r\n return this.performanceClient.removePerformanceCallback(callbackId);\r\n };\r\n /**\r\n * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window\r\n */\r\n ClientApplication.prototype.enableAccountStorageEvents = function () {\r\n this.eventHandler.enableAccountStorageEvents();\r\n };\r\n /**\r\n * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window\r\n */\r\n ClientApplication.prototype.disableAccountStorageEvents = function () {\r\n this.eventHandler.disableAccountStorageEvents();\r\n };\r\n /**\r\n * Gets the token cache for the application.\r\n */\r\n ClientApplication.prototype.getTokenCache = function () {\r\n return this.tokenCache;\r\n };\r\n /**\r\n * Returns the logger instance\r\n */\r\n ClientApplication.prototype.getLogger = function () {\r\n return this.logger;\r\n };\r\n /**\r\n * Replaces the default logger set in configurations with new Logger with new configurations\r\n * @param logger Logger instance\r\n */\r\n ClientApplication.prototype.setLogger = function (logger) {\r\n this.logger = logger;\r\n };\r\n /**\r\n * Called by wrapper libraries (Angular & React) to set SKU and Version passed down to telemetry, logger, etc.\r\n * @param sku\r\n * @param version\r\n */\r\n ClientApplication.prototype.initializeWrapperLibrary = function (sku, version) {\r\n // Validate the SKU passed in is one we expect\r\n this.browserStorage.setWrapperMetadata(sku, version);\r\n };\r\n /**\r\n * Sets navigation client\r\n * @param navigationClient\r\n */\r\n ClientApplication.prototype.setNavigationClient = function (navigationClient) {\r\n this.navigationClient = navigationClient;\r\n };\r\n /**\r\n * Returns the configuration object\r\n */\r\n ClientApplication.prototype.getConfiguration = function () {\r\n return this.config;\r\n };\r\n /**\r\n * Generates a correlation id for a request if none is provided.\r\n *\r\n * @protected\r\n * @param {?Partial} [request]\r\n * @returns {string}\r\n */\r\n ClientApplication.prototype.getRequestCorrelationId = function (request) {\r\n if (request === null || request === void 0 ? void 0 : request.correlationId) {\r\n return request.correlationId;\r\n }\r\n if (this.isBrowserEnvironment) {\r\n return this.browserCrypto.createNewGuid();\r\n }\r\n /*\r\n * Included for fallback for non-browser environments,\r\n * and to ensure this method always returns a string.\r\n */\r\n return Constants.EMPTY_STRING;\r\n };\r\n return ClientApplication;\r\n}());\n\nexport { ClientApplication };\n//# sourceMappingURL=ClientApplication.js.map\n","/*! @azure/msal-browser v2.37.1 2023-06-07 */\n'use strict';\nimport { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';\nimport { PerformanceEvents, Constants, ServerError, InteractionRequiredAuthError } from '@azure/msal-common';\nimport { DEFAULT_REQUEST, InteractionType, CacheLookupPolicy, ApiId, BrowserConstants } from '../utils/BrowserConstants.js';\nimport { ClientApplication } from './ClientApplication.js';\nimport { EventType } from '../event/EventType.js';\nimport { BrowserAuthError } from '../error/BrowserAuthError.js';\nimport { NativeAuthError } from '../error/NativeAuthError.js';\nimport { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.js';\nimport { BrowserUtils } from '../utils/BrowserUtils.js';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications\r\n * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.\r\n */\r\nvar PublicClientApplication = /** @class */ (function (_super) {\r\n __extends(PublicClientApplication, _super);\r\n /**\r\n * @constructor\r\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\r\n *\r\n * Important attributes in the Configuration object for auth are:\r\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\r\n * - authority: the authority URL for your application.\r\n * - redirect_uri: the uri of your application registered in the portal.\r\n *\r\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\r\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\r\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\r\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\r\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\r\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\r\n *\r\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\r\n * Full B2C functionality will be available in this library in future versions.\r\n *\r\n * @param configuration object for the MSAL PublicClientApplication instance\r\n */\r\n function PublicClientApplication(configuration) {\r\n var _this = _super.call(this, configuration) || this;\r\n _this.astsAsyncMeasurement = undefined;\r\n _this.activeSilentTokenRequests = new Map();\r\n // Register listener functions\r\n _this.trackPageVisibility = _this.trackPageVisibility.bind(_this);\r\n return _this;\r\n }\r\n /**\r\n * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so\r\n * any code that follows this function will not execute.\r\n *\r\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\r\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\r\n *\r\n * @param request\r\n */\r\n PublicClientApplication.prototype.loginRedirect = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var correlationId;\r\n return __generator(this, function (_a) {\r\n correlationId = this.getRequestCorrelationId(request);\r\n this.logger.verbose(\"loginRedirect called\", correlationId);\r\n return [2 /*return*/, this.acquireTokenRedirect(__assign({ correlationId: correlationId }, (request || DEFAULT_REQUEST)))];\r\n });\r\n });\r\n };\r\n /**\r\n * Use when initiating the login process via opening a popup window in the user's browser\r\n *\r\n * @param request\r\n *\r\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\r\n */\r\n PublicClientApplication.prototype.loginPopup = function (request) {\r\n var correlationId = this.getRequestCorrelationId(request);\r\n this.logger.verbose(\"loginPopup called\", correlationId);\r\n return this.acquireTokenPopup(__assign({ correlationId: correlationId }, (request || DEFAULT_REQUEST)));\r\n };\r\n /**\r\n * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.\r\n *\r\n * @param {@link (SilentRequest:type)}\r\n * @returns {Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\r\n */\r\n PublicClientApplication.prototype.acquireTokenSilent = function (request) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var correlationId, atsMeasurement, account, thumbprint, silentRequestKey, cachedResponse, response;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n correlationId = this.getRequestCorrelationId(request);\r\n atsMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilent, correlationId);\r\n atsMeasurement.addStaticFields({\r\n cacheLookupPolicy: request.cacheLookupPolicy\r\n });\r\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\r\n this.logger.verbose(\"acquireTokenSilent called\", correlationId);\r\n account = request.account || this.getActiveAccount();\r\n if (!account) {\r\n throw BrowserAuthError.createNoAccountError();\r\n }\r\n thumbprint = {\r\n clientId: this.config.auth.clientId,\r\n authority: request.authority || Constants.EMPTY_STRING,\r\n scopes: request.scopes,\r\n homeAccountIdentifier: account.homeAccountId,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n silentRequestKey = JSON.stringify(thumbprint);\r\n cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);\r\n if (typeof cachedResponse === \"undefined\") {\r\n this.logger.verbose(\"acquireTokenSilent called for the first time, storing active request\", correlationId);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenSilentAsync, correlationId);\r\n response = this.acquireTokenSilentAsync(__assign(__assign({}, request), { correlationId: correlationId }), account)\r\n .then(function (result) {\r\n _this.activeSilentTokenRequests.delete(silentRequestKey);\r\n atsMeasurement.addStaticFields({\r\n accessTokenSize: result.accessToken.length,\r\n idTokenSize: result.idToken.length\r\n });\r\n atsMeasurement.endMeasurement({\r\n success: true,\r\n fromCache: result.fromCache,\r\n isNativeBroker: result.fromNativeBroker,\r\n cacheLookupPolicy: request.cacheLookupPolicy,\r\n requestId: result.requestId,\r\n });\r\n return result;\r\n })\r\n .catch(function (error) {\r\n _this.activeSilentTokenRequests.delete(silentRequestKey);\r\n atsMeasurement.endMeasurement({\r\n errorCode: error.errorCode,\r\n subErrorCode: error.subError,\r\n success: false\r\n });\r\n throw error;\r\n });\r\n this.activeSilentTokenRequests.set(silentRequestKey, response);\r\n return [2 /*return*/, response];\r\n }\r\n else {\r\n this.logger.verbose(\"acquireTokenSilent has been called previously, returning the result from the first call\", correlationId);\r\n // Discard measurements for memoized calls, as they are usually only a couple of ms and will artificially deflate metrics\r\n atsMeasurement.discardMeasurement();\r\n return [2 /*return*/, cachedResponse];\r\n }\r\n });\r\n });\r\n };\r\n PublicClientApplication.prototype.trackPageVisibility = function () {\r\n if (!this.astsAsyncMeasurement) {\r\n return;\r\n }\r\n this.logger.info(\"Perf: Visibility change detected\");\r\n this.astsAsyncMeasurement.increment({\r\n visibilityChangeCount: 1,\r\n });\r\n };\r\n /**\r\n * Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.\r\n * @param {@link (SilentRequest:type)}\r\n * @param {@link (AccountInfo:type)}\r\n * @returns {Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}\r\n */\r\n PublicClientApplication.prototype.acquireTokenSilentAsync = function (request, account) {\r\n var _a;\r\n return __awaiter(this, void 0, void 0, function () {\r\n var result, silentRequest, silentCacheClient, silentRequest_1, requestWithCLP_1;\r\n var _this = this;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);\r\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);\r\n this.astsAsyncMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);\r\n (_a = this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.increment({\r\n visibilityChangeCount: 0\r\n });\r\n document.addEventListener(\"visibilitychange\", this.trackPageVisibility);\r\n if (!(NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme) && account.nativeAccountId)) return [3 /*break*/, 1];\r\n this.logger.verbose(\"acquireTokenSilent - attempting to acquire token from native platform\");\r\n silentRequest = __assign(__assign({}, request), { account: account });\r\n result = this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(function (e) { return __awaiter(_this, void 0, void 0, function () {\r\n var silentIframeClient;\r\n return __generator(this, function (_a) {\r\n // If native token acquisition fails for availability reasons fallback to web flow\r\n if (e instanceof NativeAuthError && e.isFatal()) {\r\n this.logger.verbose(\"acquireTokenSilent - native platform unavailable, falling back to web flow\");\r\n this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt\r\n silentIframeClient = this.createSilentIframeClient(request.correlationId);\r\n return [2 /*return*/, silentIframeClient.acquireToken(request)];\r\n }\r\n throw e;\r\n });\r\n }); });\r\n return [3 /*break*/, 3];\r\n case 1:\r\n this.logger.verbose(\"acquireTokenSilent - attempting to acquire token from web flow\");\r\n silentCacheClient = this.createSilentCacheClient(request.correlationId);\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeSilentRequest, request.correlationId);\r\n return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];\r\n case 2:\r\n silentRequest_1 = _b.sent();\r\n requestWithCLP_1 = __assign(__assign({}, request), { \r\n // set the request's CacheLookupPolicy to Default if it was not optionally passed in\r\n cacheLookupPolicy: request.cacheLookupPolicy || CacheLookupPolicy.Default });\r\n this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenFromCache, silentRequest_1.correlationId);\r\n result = this.acquireTokenFromCache(silentCacheClient, silentRequest_1, requestWithCLP_1).catch(function (cacheError) {\r\n if (requestWithCLP_1.cacheLookupPolicy === CacheLookupPolicy.AccessToken) {\r\n throw cacheError;\r\n }\r\n // block the reload if it occurred inside a hidden iframe\r\n BrowserUtils.blockReloadInHiddenIframes();\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, silentRequest_1);\r\n _this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenByRefreshToken, silentRequest_1.correlationId);\r\n return _this.acquireTokenByRefreshToken(silentRequest_1, requestWithCLP_1).catch(function (refreshTokenError) {\r\n var isServerError = refreshTokenError instanceof ServerError;\r\n var isInteractionRequiredError = refreshTokenError instanceof InteractionRequiredAuthError;\r\n var isInvalidGrantError = (refreshTokenError.errorCode === BrowserConstants.INVALID_GRANT_ERROR);\r\n if ((!isServerError ||\r\n !isInvalidGrantError ||\r\n isInteractionRequiredError ||\r\n requestWithCLP_1.cacheLookupPolicy === CacheLookupPolicy.AccessTokenAndRefreshToken ||\r\n requestWithCLP_1.cacheLookupPolicy === CacheLookupPolicy.RefreshToken)\r\n && (requestWithCLP_1.cacheLookupPolicy !== CacheLookupPolicy.Skip)) {\r\n throw refreshTokenError;\r\n }\r\n _this.logger.verbose(\"Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.\", request.correlationId);\r\n _this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenBySilentIframe, silentRequest_1.correlationId);\r\n return _this.acquireTokenBySilentIframe(silentRequest_1);\r\n });\r\n });\r\n _b.label = 3;\r\n case 3: return [2 /*return*/, result.then(function (response) {\r\n var _a;\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, response);\r\n (_a = _this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({\r\n success: true,\r\n fromCache: response.fromCache,\r\n isNativeBroker: response.fromNativeBroker,\r\n requestId: response.requestId\r\n });\r\n return response;\r\n }).catch(function (tokenRenewalError) {\r\n var _a;\r\n _this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError);\r\n (_a = _this.astsAsyncMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({\r\n errorCode: tokenRenewalError.errorCode,\r\n subErrorCode: tokenRenewalError.subError,\r\n success: false\r\n });\r\n throw tokenRenewalError;\r\n }).finally(function () {\r\n document.removeEventListener(\"visibilitychange\", _this.trackPageVisibility);\r\n })];\r\n }\r\n });\r\n });\r\n };\r\n return PublicClientApplication;\r\n}(ClientApplication));\n\nexport { PublicClientApplication };\n//# sourceMappingURL=PublicClientApplication.js.map\n","import React, {createContext, useContext} from \"react\";\r\nimport {IVivliConfigurationApiService} from \"@vivli/shared/infrastructure/interface\";\r\n\r\nexport const VivliConfigurationServiceContext = createContext(null);\r\n\r\nexport const useVivliConfigurationService = () => useContext(VivliConfigurationServiceContext);\r\n\r\n\r\n","import React, { createContext, useContext } from 'react';\r\nimport { IAnonmyousApi } from '@vivli/core/infrastructure/interface';\r\n\r\nexport const AnonymousApiServiceContext = createContext(null);\r\n\r\nexport const useAnonymousApiService = () =>\r\n useContext(AnonymousApiServiceContext);\r\n","import React, {createContext, useContext} from \"react\";\r\nimport {IConfig} from \"@vivli/shared/infrastructure/interface\";\r\n\r\nexport const ConfigServiceContext = createContext(null);\r\n\r\nexport const useConfigService = () => useContext(ConfigServiceContext);\r\n\r\n\r\n","import React, {createContext, useContext} from \"react\";\r\nimport {IUser} from \"@vivli/shared/infrastructure/interface\";\r\n\r\nexport const UserContext = createContext(null);\r\n\r\nexport const useActiveUser = () => useContext(UserContext);\r\n\r\n\r\n\r\n\r\n","import React, {createContext, useContext} from 'react';\r\nimport {IMsal2AuthService} from \"./interface\";\r\n\r\nexport const Msal2AuthContext = createContext(null);\r\n\r\nexport const useAuthService = () => useContext(Msal2AuthContext);\r\n\r\n\r\n","export enum Msal2EventTypeEnum {\r\n UpdatingPasswordEvent = 'UpdatingPasswordEvent',\r\n UpdatingProfileEvent = 'UpdatingProfileEvent',\r\n UpdatedPasswordEvent = 'UpdatedPasswordEvent',\r\n UpdatedProfileEvent = 'UpdatedProfileEvent',\r\n LoggingInEvent = 'LoggingInEvent',\r\n SilentLoggingInEvent = 'SilentLoggingInEvent',\r\n LoginEvent = 'LoginEvent',\r\n UserLoginEvent = 'UserLoginEvent',\r\n SilentLoginEvent = 'SilentLoginEvent',\r\n LogoutEvent = 'LogoutEvent',\r\n UserCancelledLogin = 'UserCancelledLogin',\r\n RefreshAuthExpirationEvent = 'RefreshAuthExpirationEvent',\r\n UnauthorizedEvent = 'UnauthorizedEvent',\r\n FailedToInitialize = 'FailedToInitialize',\r\n TokenUpdateEvent = 'TokenUpdateEvent',\r\n SignUpEvent = 'SignUpEvent',\r\n SignedUpEvent = 'SignedUpEvent',\r\n AuthEventsInitialized = 'AuthEventsInitialized',\r\n LogoutWarning = 'LogoutWarning',\r\n}\r\n","import {AccountInfo} from \"@azure/msal-common\";\r\nimport {Msal2EventTypeEnum} from \"./msal-2-event-type.enum\";\r\n\r\nexport class AuthEventsInitializedEvent {\r\n public readonly type = Msal2EventTypeEnum.AuthEventsInitialized;\r\n}\r\n\r\nexport class UpdatingPasswordEvent {\r\n public readonly type = Msal2EventTypeEnum.UpdatingPasswordEvent;\r\n}\r\n\r\nexport class UpdatingProfileEvent {\r\n public readonly type = Msal2EventTypeEnum.UpdatingProfileEvent;\r\n}\r\n\r\nexport class UpdatedPasswordEvent {\r\n public readonly type = Msal2EventTypeEnum.UpdatedPasswordEvent;\r\n\r\n constructor(public idToken?: string) {\r\n }\r\n}\r\n\r\nexport class UpdatedProfileEvent {\r\n public readonly type = Msal2EventTypeEnum.UpdatedProfileEvent;\r\n\r\n constructor(public idToken?: string) {\r\n }\r\n}\r\n\r\nexport class SignUpEvent {\r\n public readonly type = Msal2EventTypeEnum.SignUpEvent;\r\n}\r\n\r\nexport class SignedUpEvent {\r\n public readonly type = Msal2EventTypeEnum.SignedUpEvent;\r\n\r\n constructor(public idToken?: string) {\r\n }\r\n}\r\n\r\nexport class LoggingInEvent {\r\n public readonly type = Msal2EventTypeEnum.LoggingInEvent;\r\n}\r\n\r\nexport class SilentLoggingInEvent {\r\n public readonly type = Msal2EventTypeEnum.SilentLoggingInEvent;\r\n}\r\n\r\nexport class LoginEvent {\r\n public readonly type = Msal2EventTypeEnum.LoginEvent;\r\n\r\n constructor(public account: AccountInfo, public idToken: string) {\r\n }\r\n}\r\n\r\nexport class UserLoginEvent {\r\n public readonly type = Msal2EventTypeEnum.UserLoginEvent;\r\n}\r\n\r\nexport class SilentLoginEvent {\r\n public readonly type = Msal2EventTypeEnum.SilentLoginEvent;\r\n\r\n constructor(public account: AccountInfo, public idToken?: string) {\r\n }\r\n}\r\n\r\nexport class LogoutEvent {\r\n public readonly type = Msal2EventTypeEnum.LogoutEvent;\r\n}\r\n\r\nexport class UserCancelledLogin {\r\n public readonly type = Msal2EventTypeEnum.UserCancelledLogin;\r\n}\r\n\r\nexport class RefreshAuthExpirationEvent {\r\n public readonly type = Msal2EventTypeEnum.RefreshAuthExpirationEvent;\r\n\r\n constructor(public idToken: string) {\r\n }\r\n}\r\n\r\nexport class UnauthorizedEvent {\r\n public readonly type = Msal2EventTypeEnum.UnauthorizedEvent;\r\n\r\n constructor(public error?: any) {\r\n }\r\n}\r\n\r\nexport class FailedToInitialize {\r\n public readonly type = Msal2EventTypeEnum.FailedToInitialize;\r\n}\r\n\r\nexport class LogoutWarning {\r\n public readonly type = Msal2EventTypeEnum.LogoutWarning;\r\n}\r\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function isFunction(x) {\n return typeof x === 'function';\n}\n//# sourceMappingURL=isFunction.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar _enable_super_gross_mode_that_will_cause_bad_things = false;\nexport var config = {\n Promise: undefined,\n set useDeprecatedSynchronousErrorHandling(value) {\n if (value) {\n var error = /*@__PURE__*/ new Error();\n /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \\n' + error.stack);\n }\n else if (_enable_super_gross_mode_that_will_cause_bad_things) {\n /*@__PURE__*/ console.log('RxJS: Back to a better error behavior. Thank you. <3');\n }\n _enable_super_gross_mode_that_will_cause_bad_things = value;\n },\n get useDeprecatedSynchronousErrorHandling() {\n return _enable_super_gross_mode_that_will_cause_bad_things;\n },\n};\n//# sourceMappingURL=config.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function hostReportError(err) {\n setTimeout(function () { throw err; }, 0);\n}\n//# sourceMappingURL=hostReportError.js.map\n","/** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */\nimport { config } from './config';\nimport { hostReportError } from './util/hostReportError';\nexport var empty = {\n closed: true,\n next: function (value) { },\n error: function (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n throw err;\n }\n else {\n hostReportError(err);\n }\n },\n complete: function () { }\n};\n//# sourceMappingURL=Observer.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();\n//# sourceMappingURL=isArray.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function isObject(x) {\n return x !== null && typeof x === 'object';\n}\n//# sourceMappingURL=isObject.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar UnsubscriptionErrorImpl = /*@__PURE__*/ (function () {\n function UnsubscriptionErrorImpl(errors) {\n Error.call(this);\n this.message = errors ?\n errors.length + \" errors occurred during unsubscription:\\n\" + errors.map(function (err, i) { return i + 1 + \") \" + err.toString(); }).join('\\n ') : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n return this;\n }\n UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);\n return UnsubscriptionErrorImpl;\n})();\nexport var UnsubscriptionError = UnsubscriptionErrorImpl;\n//# sourceMappingURL=UnsubscriptionError.js.map\n","/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */\nimport { isArray } from './util/isArray';\nimport { isObject } from './util/isObject';\nimport { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nvar Subscription = /*@__PURE__*/ (function () {\n function Subscription(unsubscribe) {\n this.closed = false;\n this._parentOrParents = null;\n this._subscriptions = null;\n if (unsubscribe) {\n this._ctorUnsubscribe = true;\n this._unsubscribe = unsubscribe;\n }\n }\n Subscription.prototype.unsubscribe = function () {\n var errors;\n if (this.closed) {\n return;\n }\n var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;\n this.closed = true;\n this._parentOrParents = null;\n this._subscriptions = null;\n if (_parentOrParents instanceof Subscription) {\n _parentOrParents.remove(this);\n }\n else if (_parentOrParents !== null) {\n for (var index = 0; index < _parentOrParents.length; ++index) {\n var parent_1 = _parentOrParents[index];\n parent_1.remove(this);\n }\n }\n if (isFunction(_unsubscribe)) {\n if (_ctorUnsubscribe) {\n this._unsubscribe = undefined;\n }\n try {\n _unsubscribe.call(this);\n }\n catch (e) {\n errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];\n }\n }\n if (isArray(_subscriptions)) {\n var index = -1;\n var len = _subscriptions.length;\n while (++index < len) {\n var sub = _subscriptions[index];\n if (isObject(sub)) {\n try {\n sub.unsubscribe();\n }\n catch (e) {\n errors = errors || [];\n if (e instanceof UnsubscriptionError) {\n errors = errors.concat(flattenUnsubscriptionErrors(e.errors));\n }\n else {\n errors.push(e);\n }\n }\n }\n }\n }\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n };\n Subscription.prototype.add = function (teardown) {\n var subscription = teardown;\n if (!teardown) {\n return Subscription.EMPTY;\n }\n switch (typeof teardown) {\n case 'function':\n subscription = new Subscription(teardown);\n case 'object':\n if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {\n return subscription;\n }\n else if (this.closed) {\n subscription.unsubscribe();\n return subscription;\n }\n else if (!(subscription instanceof Subscription)) {\n var tmp = subscription;\n subscription = new Subscription();\n subscription._subscriptions = [tmp];\n }\n break;\n default: {\n throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');\n }\n }\n var _parentOrParents = subscription._parentOrParents;\n if (_parentOrParents === null) {\n subscription._parentOrParents = this;\n }\n else if (_parentOrParents instanceof Subscription) {\n if (_parentOrParents === this) {\n return subscription;\n }\n subscription._parentOrParents = [_parentOrParents, this];\n }\n else if (_parentOrParents.indexOf(this) === -1) {\n _parentOrParents.push(this);\n }\n else {\n return subscription;\n }\n var subscriptions = this._subscriptions;\n if (subscriptions === null) {\n this._subscriptions = [subscription];\n }\n else {\n subscriptions.push(subscription);\n }\n return subscription;\n };\n Subscription.prototype.remove = function (subscription) {\n var subscriptions = this._subscriptions;\n if (subscriptions) {\n var subscriptionIndex = subscriptions.indexOf(subscription);\n if (subscriptionIndex !== -1) {\n subscriptions.splice(subscriptionIndex, 1);\n }\n }\n };\n Subscription.EMPTY = (function (empty) {\n empty.closed = true;\n return empty;\n }(new Subscription()));\n return Subscription;\n}());\nexport { Subscription };\nfunction flattenUnsubscriptionErrors(errors) {\n return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);\n}\n//# sourceMappingURL=Subscription.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport var rxSubscriber = /*@__PURE__*/ (function () {\n return typeof Symbol === 'function'\n ? /*@__PURE__*/ Symbol('rxSubscriber')\n : '@@rxSubscriber_' + /*@__PURE__*/ Math.random();\n})();\nexport var $$rxSubscriber = rxSubscriber;\n//# sourceMappingURL=rxSubscriber.js.map\n","/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { isFunction } from './util/isFunction';\nimport { empty as emptyObserver } from './Observer';\nimport { Subscription } from './Subscription';\nimport { rxSubscriber as rxSubscriberSymbol } from '../internal/symbol/rxSubscriber';\nimport { config } from './config';\nimport { hostReportError } from './util/hostReportError';\nvar Subscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(Subscriber, _super);\n function Subscriber(destinationOrNext, error, complete) {\n var _this = _super.call(this) || this;\n _this.syncErrorValue = null;\n _this.syncErrorThrown = false;\n _this.syncErrorThrowable = false;\n _this.isStopped = false;\n switch (arguments.length) {\n case 0:\n _this.destination = emptyObserver;\n break;\n case 1:\n if (!destinationOrNext) {\n _this.destination = emptyObserver;\n break;\n }\n if (typeof destinationOrNext === 'object') {\n if (destinationOrNext instanceof Subscriber) {\n _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;\n _this.destination = destinationOrNext;\n destinationOrNext.add(_this);\n }\n else {\n _this.syncErrorThrowable = true;\n _this.destination = new SafeSubscriber(_this, destinationOrNext);\n }\n break;\n }\n default:\n _this.syncErrorThrowable = true;\n _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);\n break;\n }\n return _this;\n }\n Subscriber.prototype[rxSubscriberSymbol] = function () { return this; };\n Subscriber.create = function (next, error, complete) {\n var subscriber = new Subscriber(next, error, complete);\n subscriber.syncErrorThrowable = false;\n return subscriber;\n };\n Subscriber.prototype.next = function (value) {\n if (!this.isStopped) {\n this._next(value);\n }\n };\n Subscriber.prototype.error = function (err) {\n if (!this.isStopped) {\n this.isStopped = true;\n this._error(err);\n }\n };\n Subscriber.prototype.complete = function () {\n if (!this.isStopped) {\n this.isStopped = true;\n this._complete();\n }\n };\n Subscriber.prototype.unsubscribe = function () {\n if (this.closed) {\n return;\n }\n this.isStopped = true;\n _super.prototype.unsubscribe.call(this);\n };\n Subscriber.prototype._next = function (value) {\n this.destination.next(value);\n };\n Subscriber.prototype._error = function (err) {\n this.destination.error(err);\n this.unsubscribe();\n };\n Subscriber.prototype._complete = function () {\n this.destination.complete();\n this.unsubscribe();\n };\n Subscriber.prototype._unsubscribeAndRecycle = function () {\n var _parentOrParents = this._parentOrParents;\n this._parentOrParents = null;\n this.unsubscribe();\n this.closed = false;\n this.isStopped = false;\n this._parentOrParents = _parentOrParents;\n return this;\n };\n return Subscriber;\n}(Subscription));\nexport { Subscriber };\nvar SafeSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(SafeSubscriber, _super);\n function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {\n var _this = _super.call(this) || this;\n _this._parentSubscriber = _parentSubscriber;\n var next;\n var context = _this;\n if (isFunction(observerOrNext)) {\n next = observerOrNext;\n }\n else if (observerOrNext) {\n next = observerOrNext.next;\n error = observerOrNext.error;\n complete = observerOrNext.complete;\n if (observerOrNext !== emptyObserver) {\n context = Object.create(observerOrNext);\n if (isFunction(context.unsubscribe)) {\n _this.add(context.unsubscribe.bind(context));\n }\n context.unsubscribe = _this.unsubscribe.bind(_this);\n }\n }\n _this._context = context;\n _this._next = next;\n _this._error = error;\n _this._complete = complete;\n return _this;\n }\n SafeSubscriber.prototype.next = function (value) {\n if (!this.isStopped && this._next) {\n var _parentSubscriber = this._parentSubscriber;\n if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(this._next, value);\n }\n else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.error = function (err) {\n if (!this.isStopped) {\n var _parentSubscriber = this._parentSubscriber;\n var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;\n if (this._error) {\n if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(this._error, err);\n this.unsubscribe();\n }\n else {\n this.__tryOrSetError(_parentSubscriber, this._error, err);\n this.unsubscribe();\n }\n }\n else if (!_parentSubscriber.syncErrorThrowable) {\n this.unsubscribe();\n if (useDeprecatedSynchronousErrorHandling) {\n throw err;\n }\n hostReportError(err);\n }\n else {\n if (useDeprecatedSynchronousErrorHandling) {\n _parentSubscriber.syncErrorValue = err;\n _parentSubscriber.syncErrorThrown = true;\n }\n else {\n hostReportError(err);\n }\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.complete = function () {\n var _this = this;\n if (!this.isStopped) {\n var _parentSubscriber = this._parentSubscriber;\n if (this._complete) {\n var wrappedComplete = function () { return _this._complete.call(_this._context); };\n if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(wrappedComplete);\n this.unsubscribe();\n }\n else {\n this.__tryOrSetError(_parentSubscriber, wrappedComplete);\n this.unsubscribe();\n }\n }\n else {\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {\n try {\n fn.call(this._context, value);\n }\n catch (err) {\n this.unsubscribe();\n if (config.useDeprecatedSynchronousErrorHandling) {\n throw err;\n }\n else {\n hostReportError(err);\n }\n }\n };\n SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {\n if (!config.useDeprecatedSynchronousErrorHandling) {\n throw new Error('bad call');\n }\n try {\n fn.call(this._context, value);\n }\n catch (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n parent.syncErrorValue = err;\n parent.syncErrorThrown = true;\n return true;\n }\n else {\n hostReportError(err);\n return true;\n }\n }\n return false;\n };\n SafeSubscriber.prototype._unsubscribe = function () {\n var _parentSubscriber = this._parentSubscriber;\n this._context = null;\n this._parentSubscriber = null;\n _parentSubscriber.unsubscribe();\n };\n return SafeSubscriber;\n}(Subscriber));\nexport { SafeSubscriber };\n//# sourceMappingURL=Subscriber.js.map\n","/** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */\nimport { Subscriber } from '../Subscriber';\nexport function canReportError(observer) {\n while (observer) {\n var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;\n if (closed_1 || isStopped) {\n return false;\n }\n else if (destination && destination instanceof Subscriber) {\n observer = destination;\n }\n else {\n observer = null;\n }\n }\n return true;\n}\n//# sourceMappingURL=canReportError.js.map\n","/** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */\nimport { Subscriber } from '../Subscriber';\nimport { rxSubscriber as rxSubscriberSymbol } from '../symbol/rxSubscriber';\nimport { empty as emptyObserver } from '../Observer';\nexport function toSubscriber(nextOrObserver, error, complete) {\n if (nextOrObserver) {\n if (nextOrObserver instanceof Subscriber) {\n return nextOrObserver;\n }\n if (nextOrObserver[rxSubscriberSymbol]) {\n return nextOrObserver[rxSubscriberSymbol]();\n }\n }\n if (!nextOrObserver && !error && !complete) {\n return new Subscriber(emptyObserver);\n }\n return new Subscriber(nextOrObserver, error, complete);\n}\n//# sourceMappingURL=toSubscriber.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();\n//# sourceMappingURL=observable.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function identity(x) {\n return x;\n}\n//# sourceMappingURL=identity.js.map\n","/** PURE_IMPORTS_START _identity PURE_IMPORTS_END */\nimport { identity } from './identity';\nexport function pipe() {\n var fns = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fns[_i] = arguments[_i];\n }\n return pipeFromArray(fns);\n}\nexport function pipeFromArray(fns) {\n if (fns.length === 0) {\n return identity;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return function piped(input) {\n return fns.reduce(function (prev, fn) { return fn(prev); }, input);\n };\n}\n//# sourceMappingURL=pipe.js.map\n","/** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */\nimport { canReportError } from './util/canReportError';\nimport { toSubscriber } from './util/toSubscriber';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nvar Observable = /*@__PURE__*/ (function () {\n function Observable(subscribe) {\n this._isScalar = false;\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n Observable.prototype.lift = function (operator) {\n var observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n };\n Observable.prototype.subscribe = function (observerOrNext, error, complete) {\n var operator = this.operator;\n var sink = toSubscriber(observerOrNext, error, complete);\n if (operator) {\n sink.add(operator.call(sink, this.source));\n }\n else {\n sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?\n this._subscribe(sink) :\n this._trySubscribe(sink));\n }\n if (config.useDeprecatedSynchronousErrorHandling) {\n if (sink.syncErrorThrowable) {\n sink.syncErrorThrowable = false;\n if (sink.syncErrorThrown) {\n throw sink.syncErrorValue;\n }\n }\n }\n return sink;\n };\n Observable.prototype._trySubscribe = function (sink) {\n try {\n return this._subscribe(sink);\n }\n catch (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n sink.syncErrorThrown = true;\n sink.syncErrorValue = err;\n }\n if (canReportError(sink)) {\n sink.error(err);\n }\n else {\n console.warn(err);\n }\n }\n };\n Observable.prototype.forEach = function (next, promiseCtor) {\n var _this = this;\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor(function (resolve, reject) {\n var subscription;\n subscription = _this.subscribe(function (value) {\n try {\n next(value);\n }\n catch (err) {\n reject(err);\n if (subscription) {\n subscription.unsubscribe();\n }\n }\n }, reject, resolve);\n });\n };\n Observable.prototype._subscribe = function (subscriber) {\n var source = this.source;\n return source && source.subscribe(subscriber);\n };\n Observable.prototype[Symbol_observable] = function () {\n return this;\n };\n Observable.prototype.pipe = function () {\n var operations = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n operations[_i] = arguments[_i];\n }\n if (operations.length === 0) {\n return this;\n }\n return pipeFromArray(operations)(this);\n };\n Observable.prototype.toPromise = function (promiseCtor) {\n var _this = this;\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor(function (resolve, reject) {\n var value;\n _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });\n });\n };\n Observable.create = function (subscribe) {\n return new Observable(subscribe);\n };\n return Observable;\n}());\nexport { Observable };\nfunction getPromiseCtor(promiseCtor) {\n if (!promiseCtor) {\n promiseCtor = config.Promise || Promise;\n }\n if (!promiseCtor) {\n throw new Error('no Promise impl found');\n }\n return promiseCtor;\n}\n//# sourceMappingURL=Observable.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () {\n function ObjectUnsubscribedErrorImpl() {\n Error.call(this);\n this.message = 'object unsubscribed';\n this.name = 'ObjectUnsubscribedError';\n return this;\n }\n ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);\n return ObjectUnsubscribedErrorImpl;\n})();\nexport var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;\n//# sourceMappingURL=ObjectUnsubscribedError.js.map\n","/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscription } from './Subscription';\nvar SubjectSubscription = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(SubjectSubscription, _super);\n function SubjectSubscription(subject, subscriber) {\n var _this = _super.call(this) || this;\n _this.subject = subject;\n _this.subscriber = subscriber;\n _this.closed = false;\n return _this;\n }\n SubjectSubscription.prototype.unsubscribe = function () {\n if (this.closed) {\n return;\n }\n this.closed = true;\n var subject = this.subject;\n var observers = subject.observers;\n this.subject = null;\n if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {\n return;\n }\n var subscriberIndex = observers.indexOf(this.subscriber);\n if (subscriberIndex !== -1) {\n observers.splice(subscriberIndex, 1);\n }\n };\n return SubjectSubscription;\n}(Subscription));\nexport { SubjectSubscription };\n//# sourceMappingURL=SubjectSubscription.js.map\n","/** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { SubjectSubscription } from './SubjectSubscription';\nimport { rxSubscriber as rxSubscriberSymbol } from '../internal/symbol/rxSubscriber';\nvar SubjectSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(SubjectSubscriber, _super);\n function SubjectSubscriber(destination) {\n var _this = _super.call(this, destination) || this;\n _this.destination = destination;\n return _this;\n }\n return SubjectSubscriber;\n}(Subscriber));\nexport { SubjectSubscriber };\nvar Subject = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(Subject, _super);\n function Subject() {\n var _this = _super.call(this) || this;\n _this.observers = [];\n _this.closed = false;\n _this.isStopped = false;\n _this.hasError = false;\n _this.thrownError = null;\n return _this;\n }\n Subject.prototype[rxSubscriberSymbol] = function () {\n return new SubjectSubscriber(this);\n };\n Subject.prototype.lift = function (operator) {\n var subject = new AnonymousSubject(this, this);\n subject.operator = operator;\n return subject;\n };\n Subject.prototype.next = function (value) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n if (!this.isStopped) {\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].next(value);\n }\n }\n };\n Subject.prototype.error = function (err) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n this.hasError = true;\n this.thrownError = err;\n this.isStopped = true;\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].error(err);\n }\n this.observers.length = 0;\n };\n Subject.prototype.complete = function () {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n this.isStopped = true;\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].complete();\n }\n this.observers.length = 0;\n };\n Subject.prototype.unsubscribe = function () {\n this.isStopped = true;\n this.closed = true;\n this.observers = null;\n };\n Subject.prototype._trySubscribe = function (subscriber) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n else {\n return _super.prototype._trySubscribe.call(this, subscriber);\n }\n };\n Subject.prototype._subscribe = function (subscriber) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n else if (this.hasError) {\n subscriber.error(this.thrownError);\n return Subscription.EMPTY;\n }\n else if (this.isStopped) {\n subscriber.complete();\n return Subscription.EMPTY;\n }\n else {\n this.observers.push(subscriber);\n return new SubjectSubscription(this, subscriber);\n }\n };\n Subject.prototype.asObservable = function () {\n var observable = new Observable();\n observable.source = this;\n return observable;\n };\n Subject.create = function (destination, source) {\n return new AnonymousSubject(destination, source);\n };\n return Subject;\n}(Observable));\nexport { Subject };\nvar AnonymousSubject = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AnonymousSubject, _super);\n function AnonymousSubject(destination, source) {\n var _this = _super.call(this) || this;\n _this.destination = destination;\n _this.source = source;\n return _this;\n }\n AnonymousSubject.prototype.next = function (value) {\n var destination = this.destination;\n if (destination && destination.next) {\n destination.next(value);\n }\n };\n AnonymousSubject.prototype.error = function (err) {\n var destination = this.destination;\n if (destination && destination.error) {\n this.destination.error(err);\n }\n };\n AnonymousSubject.prototype.complete = function () {\n var destination = this.destination;\n if (destination && destination.complete) {\n this.destination.complete();\n }\n };\n AnonymousSubject.prototype._subscribe = function (subscriber) {\n var source = this.source;\n if (source) {\n return this.source.subscribe(subscriber);\n }\n else {\n return Subscription.EMPTY;\n }\n };\n return AnonymousSubject;\n}(Subject));\nexport { AnonymousSubject };\n//# sourceMappingURL=Subject.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nexport function refCount() {\n return function refCountOperatorFunction(source) {\n return source.lift(new RefCountOperator(source));\n };\n}\nvar RefCountOperator = /*@__PURE__*/ (function () {\n function RefCountOperator(connectable) {\n this.connectable = connectable;\n }\n RefCountOperator.prototype.call = function (subscriber, source) {\n var connectable = this.connectable;\n connectable._refCount++;\n var refCounter = new RefCountSubscriber(subscriber, connectable);\n var subscription = source.subscribe(refCounter);\n if (!refCounter.closed) {\n refCounter.connection = connectable.connect();\n }\n return subscription;\n };\n return RefCountOperator;\n}());\nvar RefCountSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(RefCountSubscriber, _super);\n function RefCountSubscriber(destination, connectable) {\n var _this = _super.call(this, destination) || this;\n _this.connectable = connectable;\n return _this;\n }\n RefCountSubscriber.prototype._unsubscribe = function () {\n var connectable = this.connectable;\n if (!connectable) {\n this.connection = null;\n return;\n }\n this.connectable = null;\n var refCount = connectable._refCount;\n if (refCount <= 0) {\n this.connection = null;\n return;\n }\n connectable._refCount = refCount - 1;\n if (refCount > 1) {\n this.connection = null;\n return;\n }\n var connection = this.connection;\n var sharedConnection = connectable._connection;\n this.connection = null;\n if (sharedConnection && (!connection || sharedConnection === connection)) {\n sharedConnection.unsubscribe();\n }\n };\n return RefCountSubscriber;\n}(Subscriber));\n//# sourceMappingURL=refCount.js.map\n","/** PURE_IMPORTS_START tslib,_Subject,_Observable,_Subscriber,_Subscription,_operators_refCount PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { SubjectSubscriber } from '../Subject';\nimport { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { refCount as higherOrderRefCount } from '../operators/refCount';\nvar ConnectableObservable = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ConnectableObservable, _super);\n function ConnectableObservable(source, subjectFactory) {\n var _this = _super.call(this) || this;\n _this.source = source;\n _this.subjectFactory = subjectFactory;\n _this._refCount = 0;\n _this._isComplete = false;\n return _this;\n }\n ConnectableObservable.prototype._subscribe = function (subscriber) {\n return this.getSubject().subscribe(subscriber);\n };\n ConnectableObservable.prototype.getSubject = function () {\n var subject = this._subject;\n if (!subject || subject.isStopped) {\n this._subject = this.subjectFactory();\n }\n return this._subject;\n };\n ConnectableObservable.prototype.connect = function () {\n var connection = this._connection;\n if (!connection) {\n this._isComplete = false;\n connection = this._connection = new Subscription();\n connection.add(this.source\n .subscribe(new ConnectableSubscriber(this.getSubject(), this)));\n if (connection.closed) {\n this._connection = null;\n connection = Subscription.EMPTY;\n }\n }\n return connection;\n };\n ConnectableObservable.prototype.refCount = function () {\n return higherOrderRefCount()(this);\n };\n return ConnectableObservable;\n}(Observable));\nexport { ConnectableObservable };\nexport var connectableObservableDescriptor = /*@__PURE__*/ (function () {\n var connectableProto = ConnectableObservable.prototype;\n return {\n operator: { value: null },\n _refCount: { value: 0, writable: true },\n _subject: { value: null, writable: true },\n _connection: { value: null, writable: true },\n _subscribe: { value: connectableProto._subscribe },\n _isComplete: { value: connectableProto._isComplete, writable: true },\n getSubject: { value: connectableProto.getSubject },\n connect: { value: connectableProto.connect },\n refCount: { value: connectableProto.refCount }\n };\n})();\nvar ConnectableSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ConnectableSubscriber, _super);\n function ConnectableSubscriber(destination, connectable) {\n var _this = _super.call(this, destination) || this;\n _this.connectable = connectable;\n return _this;\n }\n ConnectableSubscriber.prototype._error = function (err) {\n this._unsubscribe();\n _super.prototype._error.call(this, err);\n };\n ConnectableSubscriber.prototype._complete = function () {\n this.connectable._isComplete = true;\n this._unsubscribe();\n _super.prototype._complete.call(this);\n };\n ConnectableSubscriber.prototype._unsubscribe = function () {\n var connectable = this.connectable;\n if (connectable) {\n this.connectable = null;\n var connection = connectable._connection;\n connectable._refCount = 0;\n connectable._subject = null;\n connectable._connection = null;\n if (connection) {\n connection.unsubscribe();\n }\n }\n };\n return ConnectableSubscriber;\n}(SubjectSubscriber));\nvar RefCountOperator = /*@__PURE__*/ (function () {\n function RefCountOperator(connectable) {\n this.connectable = connectable;\n }\n RefCountOperator.prototype.call = function (subscriber, source) {\n var connectable = this.connectable;\n connectable._refCount++;\n var refCounter = new RefCountSubscriber(subscriber, connectable);\n var subscription = source.subscribe(refCounter);\n if (!refCounter.closed) {\n refCounter.connection = connectable.connect();\n }\n return subscription;\n };\n return RefCountOperator;\n}());\nvar RefCountSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(RefCountSubscriber, _super);\n function RefCountSubscriber(destination, connectable) {\n var _this = _super.call(this, destination) || this;\n _this.connectable = connectable;\n return _this;\n }\n RefCountSubscriber.prototype._unsubscribe = function () {\n var connectable = this.connectable;\n if (!connectable) {\n this.connection = null;\n return;\n }\n this.connectable = null;\n var refCount = connectable._refCount;\n if (refCount <= 0) {\n this.connection = null;\n return;\n }\n connectable._refCount = refCount - 1;\n if (refCount > 1) {\n this.connection = null;\n return;\n }\n var connection = this.connection;\n var sharedConnection = connectable._connection;\n this.connection = null;\n if (sharedConnection && (!connection || sharedConnection === connection)) {\n sharedConnection.unsubscribe();\n }\n };\n return RefCountSubscriber;\n}(Subscriber));\n//# sourceMappingURL=ConnectableObservable.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber,_Subscription,_Observable,_Subject PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nimport { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nexport function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) {\n return function (source) {\n return source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector));\n };\n}\nvar GroupByOperator = /*@__PURE__*/ (function () {\n function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) {\n this.keySelector = keySelector;\n this.elementSelector = elementSelector;\n this.durationSelector = durationSelector;\n this.subjectSelector = subjectSelector;\n }\n GroupByOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector));\n };\n return GroupByOperator;\n}());\nvar GroupBySubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(GroupBySubscriber, _super);\n function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) {\n var _this = _super.call(this, destination) || this;\n _this.keySelector = keySelector;\n _this.elementSelector = elementSelector;\n _this.durationSelector = durationSelector;\n _this.subjectSelector = subjectSelector;\n _this.groups = null;\n _this.attemptedToUnsubscribe = false;\n _this.count = 0;\n return _this;\n }\n GroupBySubscriber.prototype._next = function (value) {\n var key;\n try {\n key = this.keySelector(value);\n }\n catch (err) {\n this.error(err);\n return;\n }\n this._group(value, key);\n };\n GroupBySubscriber.prototype._group = function (value, key) {\n var groups = this.groups;\n if (!groups) {\n groups = this.groups = new Map();\n }\n var group = groups.get(key);\n var element;\n if (this.elementSelector) {\n try {\n element = this.elementSelector(value);\n }\n catch (err) {\n this.error(err);\n }\n }\n else {\n element = value;\n }\n if (!group) {\n group = (this.subjectSelector ? this.subjectSelector() : new Subject());\n groups.set(key, group);\n var groupedObservable = new GroupedObservable(key, group, this);\n this.destination.next(groupedObservable);\n if (this.durationSelector) {\n var duration = void 0;\n try {\n duration = this.durationSelector(new GroupedObservable(key, group));\n }\n catch (err) {\n this.error(err);\n return;\n }\n this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this)));\n }\n }\n if (!group.closed) {\n group.next(element);\n }\n };\n GroupBySubscriber.prototype._error = function (err) {\n var groups = this.groups;\n if (groups) {\n groups.forEach(function (group, key) {\n group.error(err);\n });\n groups.clear();\n }\n this.destination.error(err);\n };\n GroupBySubscriber.prototype._complete = function () {\n var groups = this.groups;\n if (groups) {\n groups.forEach(function (group, key) {\n group.complete();\n });\n groups.clear();\n }\n this.destination.complete();\n };\n GroupBySubscriber.prototype.removeGroup = function (key) {\n this.groups.delete(key);\n };\n GroupBySubscriber.prototype.unsubscribe = function () {\n if (!this.closed) {\n this.attemptedToUnsubscribe = true;\n if (this.count === 0) {\n _super.prototype.unsubscribe.call(this);\n }\n }\n };\n return GroupBySubscriber;\n}(Subscriber));\nvar GroupDurationSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(GroupDurationSubscriber, _super);\n function GroupDurationSubscriber(key, group, parent) {\n var _this = _super.call(this, group) || this;\n _this.key = key;\n _this.group = group;\n _this.parent = parent;\n return _this;\n }\n GroupDurationSubscriber.prototype._next = function (value) {\n this.complete();\n };\n GroupDurationSubscriber.prototype._unsubscribe = function () {\n var _a = this, parent = _a.parent, key = _a.key;\n this.key = this.parent = null;\n if (parent) {\n parent.removeGroup(key);\n }\n };\n return GroupDurationSubscriber;\n}(Subscriber));\nvar GroupedObservable = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(GroupedObservable, _super);\n function GroupedObservable(key, groupSubject, refCountSubscription) {\n var _this = _super.call(this) || this;\n _this.key = key;\n _this.groupSubject = groupSubject;\n _this.refCountSubscription = refCountSubscription;\n return _this;\n }\n GroupedObservable.prototype._subscribe = function (subscriber) {\n var subscription = new Subscription();\n var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject;\n if (refCountSubscription && !refCountSubscription.closed) {\n subscription.add(new InnerRefCountSubscription(refCountSubscription));\n }\n subscription.add(groupSubject.subscribe(subscriber));\n return subscription;\n };\n return GroupedObservable;\n}(Observable));\nexport { GroupedObservable };\nvar InnerRefCountSubscription = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(InnerRefCountSubscription, _super);\n function InnerRefCountSubscription(parent) {\n var _this = _super.call(this) || this;\n _this.parent = parent;\n parent.count++;\n return _this;\n }\n InnerRefCountSubscription.prototype.unsubscribe = function () {\n var parent = this.parent;\n if (!parent.closed && !this.closed) {\n _super.prototype.unsubscribe.call(this);\n parent.count -= 1;\n if (parent.count === 0 && parent.attemptedToUnsubscribe) {\n parent.unsubscribe();\n }\n }\n };\n return InnerRefCountSubscription;\n}(Subscription));\n//# sourceMappingURL=groupBy.js.map\n","/** PURE_IMPORTS_START tslib,_Subject,_util_ObjectUnsubscribedError PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subject } from './Subject';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nvar BehaviorSubject = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(BehaviorSubject, _super);\n function BehaviorSubject(_value) {\n var _this = _super.call(this) || this;\n _this._value = _value;\n return _this;\n }\n Object.defineProperty(BehaviorSubject.prototype, \"value\", {\n get: function () {\n return this.getValue();\n },\n enumerable: true,\n configurable: true\n });\n BehaviorSubject.prototype._subscribe = function (subscriber) {\n var subscription = _super.prototype._subscribe.call(this, subscriber);\n if (subscription && !subscription.closed) {\n subscriber.next(this._value);\n }\n return subscription;\n };\n BehaviorSubject.prototype.getValue = function () {\n if (this.hasError) {\n throw this.thrownError;\n }\n else if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n else {\n return this._value;\n }\n };\n BehaviorSubject.prototype.next = function (value) {\n _super.prototype.next.call(this, this._value = value);\n };\n return BehaviorSubject;\n}(Subject));\nexport { BehaviorSubject };\n//# sourceMappingURL=BehaviorSubject.js.map\n","/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscription } from '../Subscription';\nvar Action = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(Action, _super);\n function Action(scheduler, work) {\n return _super.call(this) || this;\n }\n Action.prototype.schedule = function (state, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n return this;\n };\n return Action;\n}(Subscription));\nexport { Action };\n//# sourceMappingURL=Action.js.map\n","/** PURE_IMPORTS_START tslib,_Action PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Action } from './Action';\nvar AsyncAction = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AsyncAction, _super);\n function AsyncAction(scheduler, work) {\n var _this = _super.call(this, scheduler, work) || this;\n _this.scheduler = scheduler;\n _this.work = work;\n _this.pending = false;\n return _this;\n }\n AsyncAction.prototype.schedule = function (state, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if (this.closed) {\n return this;\n }\n this.state = state;\n var id = this.id;\n var scheduler = this.scheduler;\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n this.pending = true;\n this.delay = delay;\n this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);\n return this;\n };\n AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n return setInterval(scheduler.flush.bind(scheduler, this), delay);\n };\n AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if (delay !== null && this.delay === delay && this.pending === false) {\n return id;\n }\n clearInterval(id);\n return undefined;\n };\n AsyncAction.prototype.execute = function (state, delay) {\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n this.pending = false;\n var error = this._execute(state, delay);\n if (error) {\n return error;\n }\n else if (this.pending === false && this.id != null) {\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n };\n AsyncAction.prototype._execute = function (state, delay) {\n var errored = false;\n var errorValue = undefined;\n try {\n this.work(state);\n }\n catch (e) {\n errored = true;\n errorValue = !!e && e || new Error(e);\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n };\n AsyncAction.prototype._unsubscribe = function () {\n var id = this.id;\n var scheduler = this.scheduler;\n var actions = scheduler.actions;\n var index = actions.indexOf(this);\n this.work = null;\n this.state = null;\n this.pending = false;\n this.scheduler = null;\n if (index !== -1) {\n actions.splice(index, 1);\n }\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n this.delay = null;\n };\n return AsyncAction;\n}(Action));\nexport { AsyncAction };\n//# sourceMappingURL=AsyncAction.js.map\n","/** PURE_IMPORTS_START tslib,_AsyncAction PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { AsyncAction } from './AsyncAction';\nvar QueueAction = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(QueueAction, _super);\n function QueueAction(scheduler, work) {\n var _this = _super.call(this, scheduler, work) || this;\n _this.scheduler = scheduler;\n _this.work = work;\n return _this;\n }\n QueueAction.prototype.schedule = function (state, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if (delay > 0) {\n return _super.prototype.schedule.call(this, state, delay);\n }\n this.delay = delay;\n this.state = state;\n this.scheduler.flush(this);\n return this;\n };\n QueueAction.prototype.execute = function (state, delay) {\n return (delay > 0 || this.closed) ?\n _super.prototype.execute.call(this, state, delay) :\n this._execute(state, delay);\n };\n QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);\n }\n return scheduler.flush(this);\n };\n return QueueAction;\n}(AsyncAction));\nexport { QueueAction };\n//# sourceMappingURL=QueueAction.js.map\n","var Scheduler = /*@__PURE__*/ (function () {\n function Scheduler(SchedulerAction, now) {\n if (now === void 0) {\n now = Scheduler.now;\n }\n this.SchedulerAction = SchedulerAction;\n this.now = now;\n }\n Scheduler.prototype.schedule = function (work, delay, state) {\n if (delay === void 0) {\n delay = 0;\n }\n return new this.SchedulerAction(this, work).schedule(state, delay);\n };\n Scheduler.now = function () { return Date.now(); };\n return Scheduler;\n}());\nexport { Scheduler };\n//# sourceMappingURL=Scheduler.js.map\n","/** PURE_IMPORTS_START tslib,_Scheduler PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Scheduler } from '../Scheduler';\nvar AsyncScheduler = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AsyncScheduler, _super);\n function AsyncScheduler(SchedulerAction, now) {\n if (now === void 0) {\n now = Scheduler.now;\n }\n var _this = _super.call(this, SchedulerAction, function () {\n if (AsyncScheduler.delegate && AsyncScheduler.delegate !== _this) {\n return AsyncScheduler.delegate.now();\n }\n else {\n return now();\n }\n }) || this;\n _this.actions = [];\n _this.active = false;\n _this.scheduled = undefined;\n return _this;\n }\n AsyncScheduler.prototype.schedule = function (work, delay, state) {\n if (delay === void 0) {\n delay = 0;\n }\n if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {\n return AsyncScheduler.delegate.schedule(work, delay, state);\n }\n else {\n return _super.prototype.schedule.call(this, work, delay, state);\n }\n };\n AsyncScheduler.prototype.flush = function (action) {\n var actions = this.actions;\n if (this.active) {\n actions.push(action);\n return;\n }\n var error;\n this.active = true;\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (action = actions.shift());\n this.active = false;\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n };\n return AsyncScheduler;\n}(Scheduler));\nexport { AsyncScheduler };\n//# sourceMappingURL=AsyncScheduler.js.map\n","/** PURE_IMPORTS_START tslib,_AsyncScheduler PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { AsyncScheduler } from './AsyncScheduler';\nvar QueueScheduler = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(QueueScheduler, _super);\n function QueueScheduler() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return QueueScheduler;\n}(AsyncScheduler));\nexport { QueueScheduler };\n//# sourceMappingURL=QueueScheduler.js.map\n","/** PURE_IMPORTS_START _QueueAction,_QueueScheduler PURE_IMPORTS_END */\nimport { QueueAction } from './QueueAction';\nimport { QueueScheduler } from './QueueScheduler';\nexport var queueScheduler = /*@__PURE__*/ new QueueScheduler(QueueAction);\nexport var queue = queueScheduler;\n//# sourceMappingURL=queue.js.map\n","/** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nexport var EMPTY = /*@__PURE__*/ new Observable(function (subscriber) { return subscriber.complete(); });\nexport function empty(scheduler) {\n return scheduler ? emptyScheduled(scheduler) : EMPTY;\n}\nfunction emptyScheduled(scheduler) {\n return new Observable(function (subscriber) { return scheduler.schedule(function () { return subscriber.complete(); }); });\n}\n//# sourceMappingURL=empty.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function isScheduler(value) {\n return value && typeof value.schedule === 'function';\n}\n//# sourceMappingURL=isScheduler.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport var subscribeToArray = function (array) {\n return function (subscriber) {\n for (var i = 0, len = array.length; i < len && !subscriber.closed; i++) {\n subscriber.next(array[i]);\n }\n subscriber.complete();\n };\n};\n//# sourceMappingURL=subscribeToArray.js.map\n","/** PURE_IMPORTS_START _Observable,_Subscription PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nexport function scheduleArray(input, scheduler) {\n return new Observable(function (subscriber) {\n var sub = new Subscription();\n var i = 0;\n sub.add(scheduler.schedule(function () {\n if (i === input.length) {\n subscriber.complete();\n return;\n }\n subscriber.next(input[i++]);\n if (!subscriber.closed) {\n sub.add(this.schedule());\n }\n }));\n return sub;\n });\n}\n//# sourceMappingURL=scheduleArray.js.map\n","/** PURE_IMPORTS_START _Observable,_util_subscribeToArray,_scheduled_scheduleArray PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { subscribeToArray } from '../util/subscribeToArray';\nimport { scheduleArray } from '../scheduled/scheduleArray';\nexport function fromArray(input, scheduler) {\n if (!scheduler) {\n return new Observable(subscribeToArray(input));\n }\n else {\n return scheduleArray(input, scheduler);\n }\n}\n//# sourceMappingURL=fromArray.js.map\n","/** PURE_IMPORTS_START _util_isScheduler,_fromArray,_scheduled_scheduleArray PURE_IMPORTS_END */\nimport { isScheduler } from '../util/isScheduler';\nimport { fromArray } from './fromArray';\nimport { scheduleArray } from '../scheduled/scheduleArray';\nexport function of() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var scheduler = args[args.length - 1];\n if (isScheduler(scheduler)) {\n args.pop();\n return scheduleArray(args, scheduler);\n }\n else {\n return fromArray(args);\n }\n}\n//# sourceMappingURL=of.js.map\n","/** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nexport function throwError(error, scheduler) {\n if (!scheduler) {\n return new Observable(function (subscriber) { return subscriber.error(error); });\n }\n else {\n return new Observable(function (subscriber) { return scheduler.schedule(dispatch, 0, { error: error, subscriber: subscriber }); });\n }\n}\nfunction dispatch(_a) {\n var error = _a.error, subscriber = _a.subscriber;\n subscriber.error(error);\n}\n//# sourceMappingURL=throwError.js.map\n","/** PURE_IMPORTS_START _observable_empty,_observable_of,_observable_throwError PURE_IMPORTS_END */\nimport { empty } from './observable/empty';\nimport { of } from './observable/of';\nimport { throwError } from './observable/throwError';\nexport var NotificationKind;\n/*@__PURE__*/ (function (NotificationKind) {\n NotificationKind[\"NEXT\"] = \"N\";\n NotificationKind[\"ERROR\"] = \"E\";\n NotificationKind[\"COMPLETE\"] = \"C\";\n})(NotificationKind || (NotificationKind = {}));\nvar Notification = /*@__PURE__*/ (function () {\n function Notification(kind, value, error) {\n this.kind = kind;\n this.value = value;\n this.error = error;\n this.hasValue = kind === 'N';\n }\n Notification.prototype.observe = function (observer) {\n switch (this.kind) {\n case 'N':\n return observer.next && observer.next(this.value);\n case 'E':\n return observer.error && observer.error(this.error);\n case 'C':\n return observer.complete && observer.complete();\n }\n };\n Notification.prototype.do = function (next, error, complete) {\n var kind = this.kind;\n switch (kind) {\n case 'N':\n return next && next(this.value);\n case 'E':\n return error && error(this.error);\n case 'C':\n return complete && complete();\n }\n };\n Notification.prototype.accept = function (nextOrObserver, error, complete) {\n if (nextOrObserver && typeof nextOrObserver.next === 'function') {\n return this.observe(nextOrObserver);\n }\n else {\n return this.do(nextOrObserver, error, complete);\n }\n };\n Notification.prototype.toObservable = function () {\n var kind = this.kind;\n switch (kind) {\n case 'N':\n return of(this.value);\n case 'E':\n return throwError(this.error);\n case 'C':\n return empty();\n }\n throw new Error('unexpected notification kind value');\n };\n Notification.createNext = function (value) {\n if (typeof value !== 'undefined') {\n return new Notification('N', value);\n }\n return Notification.undefinedValueNotification;\n };\n Notification.createError = function (err) {\n return new Notification('E', undefined, err);\n };\n Notification.createComplete = function () {\n return Notification.completeNotification;\n };\n Notification.completeNotification = new Notification('C');\n Notification.undefinedValueNotification = new Notification('N', undefined);\n return Notification;\n}());\nexport { Notification };\n//# sourceMappingURL=Notification.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber,_Notification PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nimport { Notification } from '../Notification';\nexport function observeOn(scheduler, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n return function observeOnOperatorFunction(source) {\n return source.lift(new ObserveOnOperator(scheduler, delay));\n };\n}\nvar ObserveOnOperator = /*@__PURE__*/ (function () {\n function ObserveOnOperator(scheduler, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n this.scheduler = scheduler;\n this.delay = delay;\n }\n ObserveOnOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));\n };\n return ObserveOnOperator;\n}());\nexport { ObserveOnOperator };\nvar ObserveOnSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ObserveOnSubscriber, _super);\n function ObserveOnSubscriber(destination, scheduler, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n var _this = _super.call(this, destination) || this;\n _this.scheduler = scheduler;\n _this.delay = delay;\n return _this;\n }\n ObserveOnSubscriber.dispatch = function (arg) {\n var notification = arg.notification, destination = arg.destination;\n notification.observe(destination);\n this.unsubscribe();\n };\n ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {\n var destination = this.destination;\n destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));\n };\n ObserveOnSubscriber.prototype._next = function (value) {\n this.scheduleMessage(Notification.createNext(value));\n };\n ObserveOnSubscriber.prototype._error = function (err) {\n this.scheduleMessage(Notification.createError(err));\n this.unsubscribe();\n };\n ObserveOnSubscriber.prototype._complete = function () {\n this.scheduleMessage(Notification.createComplete());\n this.unsubscribe();\n };\n return ObserveOnSubscriber;\n}(Subscriber));\nexport { ObserveOnSubscriber };\nvar ObserveOnMessage = /*@__PURE__*/ (function () {\n function ObserveOnMessage(notification, destination) {\n this.notification = notification;\n this.destination = destination;\n }\n return ObserveOnMessage;\n}());\nexport { ObserveOnMessage };\n//# sourceMappingURL=observeOn.js.map\n","/** PURE_IMPORTS_START tslib,_Subject,_scheduler_queue,_Subscription,_operators_observeOn,_util_ObjectUnsubscribedError,_SubjectSubscription PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subject } from './Subject';\nimport { queue } from './scheduler/queue';\nimport { Subscription } from './Subscription';\nimport { ObserveOnSubscriber } from './operators/observeOn';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { SubjectSubscription } from './SubjectSubscription';\nvar ReplaySubject = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ReplaySubject, _super);\n function ReplaySubject(bufferSize, windowTime, scheduler) {\n if (bufferSize === void 0) {\n bufferSize = Number.POSITIVE_INFINITY;\n }\n if (windowTime === void 0) {\n windowTime = Number.POSITIVE_INFINITY;\n }\n var _this = _super.call(this) || this;\n _this.scheduler = scheduler;\n _this._events = [];\n _this._infiniteTimeWindow = false;\n _this._bufferSize = bufferSize < 1 ? 1 : bufferSize;\n _this._windowTime = windowTime < 1 ? 1 : windowTime;\n if (windowTime === Number.POSITIVE_INFINITY) {\n _this._infiniteTimeWindow = true;\n _this.next = _this.nextInfiniteTimeWindow;\n }\n else {\n _this.next = _this.nextTimeWindow;\n }\n return _this;\n }\n ReplaySubject.prototype.nextInfiniteTimeWindow = function (value) {\n if (!this.isStopped) {\n var _events = this._events;\n _events.push(value);\n if (_events.length > this._bufferSize) {\n _events.shift();\n }\n }\n _super.prototype.next.call(this, value);\n };\n ReplaySubject.prototype.nextTimeWindow = function (value) {\n if (!this.isStopped) {\n this._events.push(new ReplayEvent(this._getNow(), value));\n this._trimBufferThenGetEvents();\n }\n _super.prototype.next.call(this, value);\n };\n ReplaySubject.prototype._subscribe = function (subscriber) {\n var _infiniteTimeWindow = this._infiniteTimeWindow;\n var _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents();\n var scheduler = this.scheduler;\n var len = _events.length;\n var subscription;\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n else if (this.isStopped || this.hasError) {\n subscription = Subscription.EMPTY;\n }\n else {\n this.observers.push(subscriber);\n subscription = new SubjectSubscription(this, subscriber);\n }\n if (scheduler) {\n subscriber.add(subscriber = new ObserveOnSubscriber(subscriber, scheduler));\n }\n if (_infiniteTimeWindow) {\n for (var i = 0; i < len && !subscriber.closed; i++) {\n subscriber.next(_events[i]);\n }\n }\n else {\n for (var i = 0; i < len && !subscriber.closed; i++) {\n subscriber.next(_events[i].value);\n }\n }\n if (this.hasError) {\n subscriber.error(this.thrownError);\n }\n else if (this.isStopped) {\n subscriber.complete();\n }\n return subscription;\n };\n ReplaySubject.prototype._getNow = function () {\n return (this.scheduler || queue).now();\n };\n ReplaySubject.prototype._trimBufferThenGetEvents = function () {\n var now = this._getNow();\n var _bufferSize = this._bufferSize;\n var _windowTime = this._windowTime;\n var _events = this._events;\n var eventsCount = _events.length;\n var spliceCount = 0;\n while (spliceCount < eventsCount) {\n if ((now - _events[spliceCount].time) < _windowTime) {\n break;\n }\n spliceCount++;\n }\n if (eventsCount > _bufferSize) {\n spliceCount = Math.max(spliceCount, eventsCount - _bufferSize);\n }\n if (spliceCount > 0) {\n _events.splice(0, spliceCount);\n }\n return _events;\n };\n return ReplaySubject;\n}(Subject));\nexport { ReplaySubject };\nvar ReplayEvent = /*@__PURE__*/ (function () {\n function ReplayEvent(time, value) {\n this.time = time;\n this.value = value;\n }\n return ReplayEvent;\n}());\n//# sourceMappingURL=ReplaySubject.js.map\n","/** PURE_IMPORTS_START tslib,_Subject,_Subscription PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subject } from './Subject';\nimport { Subscription } from './Subscription';\nvar AsyncSubject = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AsyncSubject, _super);\n function AsyncSubject() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.value = null;\n _this.hasNext = false;\n _this.hasCompleted = false;\n return _this;\n }\n AsyncSubject.prototype._subscribe = function (subscriber) {\n if (this.hasError) {\n subscriber.error(this.thrownError);\n return Subscription.EMPTY;\n }\n else if (this.hasCompleted && this.hasNext) {\n subscriber.next(this.value);\n subscriber.complete();\n return Subscription.EMPTY;\n }\n return _super.prototype._subscribe.call(this, subscriber);\n };\n AsyncSubject.prototype.next = function (value) {\n if (!this.hasCompleted) {\n this.value = value;\n this.hasNext = true;\n }\n };\n AsyncSubject.prototype.error = function (error) {\n if (!this.hasCompleted) {\n _super.prototype.error.call(this, error);\n }\n };\n AsyncSubject.prototype.complete = function () {\n this.hasCompleted = true;\n if (this.hasNext) {\n _super.prototype.next.call(this, this.value);\n }\n _super.prototype.complete.call(this);\n };\n return AsyncSubject;\n}(Subject));\nexport { AsyncSubject };\n//# sourceMappingURL=AsyncSubject.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar nextHandle = 1;\nvar RESOLVED = /*@__PURE__*/ (function () { return /*@__PURE__*/ Promise.resolve(); })();\nvar activeHandles = {};\nfunction findAndClearHandle(handle) {\n if (handle in activeHandles) {\n delete activeHandles[handle];\n return true;\n }\n return false;\n}\nexport var Immediate = {\n setImmediate: function (cb) {\n var handle = nextHandle++;\n activeHandles[handle] = true;\n RESOLVED.then(function () { return findAndClearHandle(handle) && cb(); });\n return handle;\n },\n clearImmediate: function (handle) {\n findAndClearHandle(handle);\n },\n};\nexport var TestTools = {\n pending: function () {\n return Object.keys(activeHandles).length;\n }\n};\n//# sourceMappingURL=Immediate.js.map\n","/** PURE_IMPORTS_START tslib,_util_Immediate,_AsyncAction PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Immediate } from '../util/Immediate';\nimport { AsyncAction } from './AsyncAction';\nvar AsapAction = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AsapAction, _super);\n function AsapAction(scheduler, work) {\n var _this = _super.call(this, scheduler, work) || this;\n _this.scheduler = scheduler;\n _this.work = work;\n return _this;\n }\n AsapAction.prototype.requestAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if (delay !== null && delay > 0) {\n return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);\n }\n scheduler.actions.push(this);\n return scheduler.scheduled || (scheduler.scheduled = Immediate.setImmediate(scheduler.flush.bind(scheduler, null)));\n };\n AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);\n }\n if (scheduler.actions.length === 0) {\n Immediate.clearImmediate(id);\n scheduler.scheduled = undefined;\n }\n return undefined;\n };\n return AsapAction;\n}(AsyncAction));\nexport { AsapAction };\n//# sourceMappingURL=AsapAction.js.map\n","/** PURE_IMPORTS_START tslib,_AsyncScheduler PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { AsyncScheduler } from './AsyncScheduler';\nvar AsapScheduler = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AsapScheduler, _super);\n function AsapScheduler() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AsapScheduler.prototype.flush = function (action) {\n this.active = true;\n this.scheduled = undefined;\n var actions = this.actions;\n var error;\n var index = -1;\n var count = actions.length;\n action = action || actions.shift();\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (++index < count && (action = actions.shift()));\n this.active = false;\n if (error) {\n while (++index < count && (action = actions.shift())) {\n action.unsubscribe();\n }\n throw error;\n }\n };\n return AsapScheduler;\n}(AsyncScheduler));\nexport { AsapScheduler };\n//# sourceMappingURL=AsapScheduler.js.map\n","/** PURE_IMPORTS_START _AsapAction,_AsapScheduler PURE_IMPORTS_END */\nimport { AsapAction } from './AsapAction';\nimport { AsapScheduler } from './AsapScheduler';\nexport var asapScheduler = /*@__PURE__*/ new AsapScheduler(AsapAction);\nexport var asap = asapScheduler;\n//# sourceMappingURL=asap.js.map\n","/** PURE_IMPORTS_START _AsyncAction,_AsyncScheduler PURE_IMPORTS_END */\nimport { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\nexport var asyncScheduler = /*@__PURE__*/ new AsyncScheduler(AsyncAction);\nexport var async = asyncScheduler;\n//# sourceMappingURL=async.js.map\n","/** PURE_IMPORTS_START tslib,_AsyncAction PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { AsyncAction } from './AsyncAction';\nvar AnimationFrameAction = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AnimationFrameAction, _super);\n function AnimationFrameAction(scheduler, work) {\n var _this = _super.call(this, scheduler, work) || this;\n _this.scheduler = scheduler;\n _this.work = work;\n return _this;\n }\n AnimationFrameAction.prototype.requestAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if (delay !== null && delay > 0) {\n return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);\n }\n scheduler.actions.push(this);\n return scheduler.scheduled || (scheduler.scheduled = requestAnimationFrame(function () { return scheduler.flush(null); }));\n };\n AnimationFrameAction.prototype.recycleAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\n return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);\n }\n if (scheduler.actions.length === 0) {\n cancelAnimationFrame(id);\n scheduler.scheduled = undefined;\n }\n return undefined;\n };\n return AnimationFrameAction;\n}(AsyncAction));\nexport { AnimationFrameAction };\n//# sourceMappingURL=AnimationFrameAction.js.map\n","/** PURE_IMPORTS_START tslib,_AsyncScheduler PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { AsyncScheduler } from './AsyncScheduler';\nvar AnimationFrameScheduler = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AnimationFrameScheduler, _super);\n function AnimationFrameScheduler() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AnimationFrameScheduler.prototype.flush = function (action) {\n this.active = true;\n this.scheduled = undefined;\n var actions = this.actions;\n var error;\n var index = -1;\n var count = actions.length;\n action = action || actions.shift();\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (++index < count && (action = actions.shift()));\n this.active = false;\n if (error) {\n while (++index < count && (action = actions.shift())) {\n action.unsubscribe();\n }\n throw error;\n }\n };\n return AnimationFrameScheduler;\n}(AsyncScheduler));\nexport { AnimationFrameScheduler };\n//# sourceMappingURL=AnimationFrameScheduler.js.map\n","/** PURE_IMPORTS_START _AnimationFrameAction,_AnimationFrameScheduler PURE_IMPORTS_END */\nimport { AnimationFrameAction } from './AnimationFrameAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\nexport var animationFrameScheduler = /*@__PURE__*/ new AnimationFrameScheduler(AnimationFrameAction);\nexport var animationFrame = animationFrameScheduler;\n//# sourceMappingURL=animationFrame.js.map\n","/** PURE_IMPORTS_START tslib,_AsyncAction,_AsyncScheduler PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\nvar VirtualTimeScheduler = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(VirtualTimeScheduler, _super);\n function VirtualTimeScheduler(SchedulerAction, maxFrames) {\n if (SchedulerAction === void 0) {\n SchedulerAction = VirtualAction;\n }\n if (maxFrames === void 0) {\n maxFrames = Number.POSITIVE_INFINITY;\n }\n var _this = _super.call(this, SchedulerAction, function () { return _this.frame; }) || this;\n _this.maxFrames = maxFrames;\n _this.frame = 0;\n _this.index = -1;\n return _this;\n }\n VirtualTimeScheduler.prototype.flush = function () {\n var _a = this, actions = _a.actions, maxFrames = _a.maxFrames;\n var error, action;\n while ((action = actions[0]) && action.delay <= maxFrames) {\n actions.shift();\n this.frame = action.delay;\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n }\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n };\n VirtualTimeScheduler.frameTimeFactor = 10;\n return VirtualTimeScheduler;\n}(AsyncScheduler));\nexport { VirtualTimeScheduler };\nvar VirtualAction = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(VirtualAction, _super);\n function VirtualAction(scheduler, work, index) {\n if (index === void 0) {\n index = scheduler.index += 1;\n }\n var _this = _super.call(this, scheduler, work) || this;\n _this.scheduler = scheduler;\n _this.work = work;\n _this.index = index;\n _this.active = true;\n _this.index = scheduler.index = index;\n return _this;\n }\n VirtualAction.prototype.schedule = function (state, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if (!this.id) {\n return _super.prototype.schedule.call(this, state, delay);\n }\n this.active = false;\n var action = new VirtualAction(this.scheduler, this.work);\n this.add(action);\n return action.schedule(state, delay);\n };\n VirtualAction.prototype.requestAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n this.delay = scheduler.frame + delay;\n var actions = scheduler.actions;\n actions.push(this);\n actions.sort(VirtualAction.sortActions);\n return true;\n };\n VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n return undefined;\n };\n VirtualAction.prototype._execute = function (state, delay) {\n if (this.active === true) {\n return _super.prototype._execute.call(this, state, delay);\n }\n };\n VirtualAction.sortActions = function (a, b) {\n if (a.delay === b.delay) {\n if (a.index === b.index) {\n return 0;\n }\n else if (a.index > b.index) {\n return 1;\n }\n else {\n return -1;\n }\n }\n else if (a.delay > b.delay) {\n return 1;\n }\n else {\n return -1;\n }\n };\n return VirtualAction;\n}(AsyncAction));\nexport { VirtualAction };\n//# sourceMappingURL=VirtualTimeScheduler.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function noop() { }\n//# sourceMappingURL=noop.js.map\n","/** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nexport function isObservable(obj) {\n return !!obj && (obj instanceof Observable || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'));\n}\n//# sourceMappingURL=isObservable.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar ArgumentOutOfRangeErrorImpl = /*@__PURE__*/ (function () {\n function ArgumentOutOfRangeErrorImpl() {\n Error.call(this);\n this.message = 'argument out of range';\n this.name = 'ArgumentOutOfRangeError';\n return this;\n }\n ArgumentOutOfRangeErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);\n return ArgumentOutOfRangeErrorImpl;\n})();\nexport var ArgumentOutOfRangeError = ArgumentOutOfRangeErrorImpl;\n//# sourceMappingURL=ArgumentOutOfRangeError.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar EmptyErrorImpl = /*@__PURE__*/ (function () {\n function EmptyErrorImpl() {\n Error.call(this);\n this.message = 'no elements in sequence';\n this.name = 'EmptyError';\n return this;\n }\n EmptyErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);\n return EmptyErrorImpl;\n})();\nexport var EmptyError = EmptyErrorImpl;\n//# sourceMappingURL=EmptyError.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar TimeoutErrorImpl = /*@__PURE__*/ (function () {\n function TimeoutErrorImpl() {\n Error.call(this);\n this.message = 'Timeout has occurred';\n this.name = 'TimeoutError';\n return this;\n }\n TimeoutErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);\n return TimeoutErrorImpl;\n})();\nexport var TimeoutError = TimeoutErrorImpl;\n//# sourceMappingURL=TimeoutError.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nexport function map(project, thisArg) {\n return function mapOperation(source) {\n if (typeof project !== 'function') {\n throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');\n }\n return source.lift(new MapOperator(project, thisArg));\n };\n}\nvar MapOperator = /*@__PURE__*/ (function () {\n function MapOperator(project, thisArg) {\n this.project = project;\n this.thisArg = thisArg;\n }\n MapOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));\n };\n return MapOperator;\n}());\nexport { MapOperator };\nvar MapSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(MapSubscriber, _super);\n function MapSubscriber(destination, project, thisArg) {\n var _this = _super.call(this, destination) || this;\n _this.project = project;\n _this.count = 0;\n _this.thisArg = thisArg || _this;\n return _this;\n }\n MapSubscriber.prototype._next = function (value) {\n var result;\n try {\n result = this.project.call(this.thisArg, value, this.count++);\n }\n catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n };\n return MapSubscriber;\n}(Subscriber));\n//# sourceMappingURL=map.js.map\n","/** PURE_IMPORTS_START _Observable,_AsyncSubject,_operators_map,_util_canReportError,_util_isArray,_util_isScheduler PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { AsyncSubject } from '../AsyncSubject';\nimport { map } from '../operators/map';\nimport { canReportError } from '../util/canReportError';\nimport { isArray } from '../util/isArray';\nimport { isScheduler } from '../util/isScheduler';\nexport function bindCallback(callbackFunc, resultSelector, scheduler) {\n if (resultSelector) {\n if (isScheduler(resultSelector)) {\n scheduler = resultSelector;\n }\n else {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return bindCallback(callbackFunc, scheduler).apply(void 0, args).pipe(map(function (args) { return isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));\n };\n }\n }\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var context = this;\n var subject;\n var params = {\n context: context,\n subject: subject,\n callbackFunc: callbackFunc,\n scheduler: scheduler,\n };\n return new Observable(function (subscriber) {\n if (!scheduler) {\n if (!subject) {\n subject = new AsyncSubject();\n var handler = function () {\n var innerArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n innerArgs[_i] = arguments[_i];\n }\n subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);\n subject.complete();\n };\n try {\n callbackFunc.apply(context, args.concat([handler]));\n }\n catch (err) {\n if (canReportError(subject)) {\n subject.error(err);\n }\n else {\n console.warn(err);\n }\n }\n }\n return subject.subscribe(subscriber);\n }\n else {\n var state = {\n args: args, subscriber: subscriber, params: params,\n };\n return scheduler.schedule(dispatch, 0, state);\n }\n });\n };\n}\nfunction dispatch(state) {\n var _this = this;\n var self = this;\n var args = state.args, subscriber = state.subscriber, params = state.params;\n var callbackFunc = params.callbackFunc, context = params.context, scheduler = params.scheduler;\n var subject = params.subject;\n if (!subject) {\n subject = params.subject = new AsyncSubject();\n var handler = function () {\n var innerArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n innerArgs[_i] = arguments[_i];\n }\n var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;\n _this.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));\n };\n try {\n callbackFunc.apply(context, args.concat([handler]));\n }\n catch (err) {\n subject.error(err);\n }\n }\n this.add(subject.subscribe(subscriber));\n}\nfunction dispatchNext(state) {\n var value = state.value, subject = state.subject;\n subject.next(value);\n subject.complete();\n}\nfunction dispatchError(state) {\n var err = state.err, subject = state.subject;\n subject.error(err);\n}\n//# sourceMappingURL=bindCallback.js.map\n","/** PURE_IMPORTS_START _Observable,_AsyncSubject,_operators_map,_util_canReportError,_util_isScheduler,_util_isArray PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { AsyncSubject } from '../AsyncSubject';\nimport { map } from '../operators/map';\nimport { canReportError } from '../util/canReportError';\nimport { isScheduler } from '../util/isScheduler';\nimport { isArray } from '../util/isArray';\nexport function bindNodeCallback(callbackFunc, resultSelector, scheduler) {\n if (resultSelector) {\n if (isScheduler(resultSelector)) {\n scheduler = resultSelector;\n }\n else {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return bindNodeCallback(callbackFunc, scheduler).apply(void 0, args).pipe(map(function (args) { return isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));\n };\n }\n }\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var params = {\n subject: undefined,\n args: args,\n callbackFunc: callbackFunc,\n scheduler: scheduler,\n context: this,\n };\n return new Observable(function (subscriber) {\n var context = params.context;\n var subject = params.subject;\n if (!scheduler) {\n if (!subject) {\n subject = params.subject = new AsyncSubject();\n var handler = function () {\n var innerArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n innerArgs[_i] = arguments[_i];\n }\n var err = innerArgs.shift();\n if (err) {\n subject.error(err);\n return;\n }\n subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);\n subject.complete();\n };\n try {\n callbackFunc.apply(context, args.concat([handler]));\n }\n catch (err) {\n if (canReportError(subject)) {\n subject.error(err);\n }\n else {\n console.warn(err);\n }\n }\n }\n return subject.subscribe(subscriber);\n }\n else {\n return scheduler.schedule(dispatch, 0, { params: params, subscriber: subscriber, context: context });\n }\n });\n };\n}\nfunction dispatch(state) {\n var _this = this;\n var params = state.params, subscriber = state.subscriber, context = state.context;\n var callbackFunc = params.callbackFunc, args = params.args, scheduler = params.scheduler;\n var subject = params.subject;\n if (!subject) {\n subject = params.subject = new AsyncSubject();\n var handler = function () {\n var innerArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n innerArgs[_i] = arguments[_i];\n }\n var err = innerArgs.shift();\n if (err) {\n _this.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject }));\n }\n else {\n var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;\n _this.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));\n }\n };\n try {\n callbackFunc.apply(context, args.concat([handler]));\n }\n catch (err) {\n this.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject }));\n }\n }\n this.add(subject.subscribe(subscriber));\n}\nfunction dispatchNext(arg) {\n var value = arg.value, subject = arg.subject;\n subject.next(value);\n subject.complete();\n}\nfunction dispatchError(arg) {\n var err = arg.err, subject = arg.subject;\n subject.error(err);\n}\n//# sourceMappingURL=bindNodeCallback.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from './Subscriber';\nvar OuterSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(OuterSubscriber, _super);\n function OuterSubscriber() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n this.destination.next(innerValue);\n };\n OuterSubscriber.prototype.notifyError = function (error, innerSub) {\n this.destination.error(error);\n };\n OuterSubscriber.prototype.notifyComplete = function (innerSub) {\n this.destination.complete();\n };\n return OuterSubscriber;\n}(Subscriber));\nexport { OuterSubscriber };\n//# sourceMappingURL=OuterSubscriber.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from './Subscriber';\nvar InnerSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(InnerSubscriber, _super);\n function InnerSubscriber(parent, outerValue, outerIndex) {\n var _this = _super.call(this) || this;\n _this.parent = parent;\n _this.outerValue = outerValue;\n _this.outerIndex = outerIndex;\n _this.index = 0;\n return _this;\n }\n InnerSubscriber.prototype._next = function (value) {\n this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);\n };\n InnerSubscriber.prototype._error = function (error) {\n this.parent.notifyError(error, this);\n this.unsubscribe();\n };\n InnerSubscriber.prototype._complete = function () {\n this.parent.notifyComplete(this);\n this.unsubscribe();\n };\n return InnerSubscriber;\n}(Subscriber));\nexport { InnerSubscriber };\n//# sourceMappingURL=InnerSubscriber.js.map\n","/** PURE_IMPORTS_START _hostReportError PURE_IMPORTS_END */\nimport { hostReportError } from './hostReportError';\nexport var subscribeToPromise = function (promise) {\n return function (subscriber) {\n promise.then(function (value) {\n if (!subscriber.closed) {\n subscriber.next(value);\n subscriber.complete();\n }\n }, function (err) { return subscriber.error(err); })\n .then(null, hostReportError);\n return subscriber;\n };\n};\n//# sourceMappingURL=subscribeToPromise.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function getSymbolIterator() {\n if (typeof Symbol !== 'function' || !Symbol.iterator) {\n return '@@iterator';\n }\n return Symbol.iterator;\n}\nexport var iterator = /*@__PURE__*/ getSymbolIterator();\nexport var $$iterator = iterator;\n//# sourceMappingURL=iterator.js.map\n","/** PURE_IMPORTS_START _symbol_iterator PURE_IMPORTS_END */\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nexport var subscribeToIterable = function (iterable) {\n return function (subscriber) {\n var iterator = iterable[Symbol_iterator]();\n do {\n var item = void 0;\n try {\n item = iterator.next();\n }\n catch (err) {\n subscriber.error(err);\n return subscriber;\n }\n if (item.done) {\n subscriber.complete();\n break;\n }\n subscriber.next(item.value);\n if (subscriber.closed) {\n break;\n }\n } while (true);\n if (typeof iterator.return === 'function') {\n subscriber.add(function () {\n if (iterator.return) {\n iterator.return();\n }\n });\n }\n return subscriber;\n };\n};\n//# sourceMappingURL=subscribeToIterable.js.map\n","/** PURE_IMPORTS_START _symbol_observable PURE_IMPORTS_END */\nimport { observable as Symbol_observable } from '../symbol/observable';\nexport var subscribeToObservable = function (obj) {\n return function (subscriber) {\n var obs = obj[Symbol_observable]();\n if (typeof obs.subscribe !== 'function') {\n throw new TypeError('Provided object does not correctly implement Symbol.observable');\n }\n else {\n return obs.subscribe(subscriber);\n }\n };\n};\n//# sourceMappingURL=subscribeToObservable.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });\n//# sourceMappingURL=isArrayLike.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function isPromise(value) {\n return !!value && typeof value.subscribe !== 'function' && typeof value.then === 'function';\n}\n//# sourceMappingURL=isPromise.js.map\n","/** PURE_IMPORTS_START _subscribeToArray,_subscribeToPromise,_subscribeToIterable,_subscribeToObservable,_isArrayLike,_isPromise,_isObject,_symbol_iterator,_symbol_observable PURE_IMPORTS_END */\nimport { subscribeToArray } from './subscribeToArray';\nimport { subscribeToPromise } from './subscribeToPromise';\nimport { subscribeToIterable } from './subscribeToIterable';\nimport { subscribeToObservable } from './subscribeToObservable';\nimport { isArrayLike } from './isArrayLike';\nimport { isPromise } from './isPromise';\nimport { isObject } from './isObject';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { observable as Symbol_observable } from '../symbol/observable';\nexport var subscribeTo = function (result) {\n if (!!result && typeof result[Symbol_observable] === 'function') {\n return subscribeToObservable(result);\n }\n else if (isArrayLike(result)) {\n return subscribeToArray(result);\n }\n else if (isPromise(result)) {\n return subscribeToPromise(result);\n }\n else if (!!result && typeof result[Symbol_iterator] === 'function') {\n return subscribeToIterable(result);\n }\n else {\n var value = isObject(result) ? 'an invalid object' : \"'\" + result + \"'\";\n var msg = \"You provided \" + value + \" where a stream was expected.\"\n + ' You can provide an Observable, Promise, Array, or Iterable.';\n throw new TypeError(msg);\n }\n};\n//# sourceMappingURL=subscribeTo.js.map\n","/** PURE_IMPORTS_START _InnerSubscriber,_subscribeTo,_Observable PURE_IMPORTS_END */\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { subscribeTo } from './subscribeTo';\nimport { Observable } from '../Observable';\nexport function subscribeToResult(outerSubscriber, result, outerValue, outerIndex, innerSubscriber) {\n if (innerSubscriber === void 0) {\n innerSubscriber = new InnerSubscriber(outerSubscriber, outerValue, outerIndex);\n }\n if (innerSubscriber.closed) {\n return undefined;\n }\n if (result instanceof Observable) {\n return result.subscribe(innerSubscriber);\n }\n return subscribeTo(result)(innerSubscriber);\n}\n//# sourceMappingURL=subscribeToResult.js.map\n","/** PURE_IMPORTS_START tslib,_util_isScheduler,_util_isArray,_OuterSubscriber,_util_subscribeToResult,_fromArray PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { isScheduler } from '../util/isScheduler';\nimport { isArray } from '../util/isArray';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { fromArray } from './fromArray';\nvar NONE = {};\nexport function combineLatest() {\n var observables = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n observables[_i] = arguments[_i];\n }\n var resultSelector = undefined;\n var scheduler = undefined;\n if (isScheduler(observables[observables.length - 1])) {\n scheduler = observables.pop();\n }\n if (typeof observables[observables.length - 1] === 'function') {\n resultSelector = observables.pop();\n }\n if (observables.length === 1 && isArray(observables[0])) {\n observables = observables[0];\n }\n return fromArray(observables, scheduler).lift(new CombineLatestOperator(resultSelector));\n}\nvar CombineLatestOperator = /*@__PURE__*/ (function () {\n function CombineLatestOperator(resultSelector) {\n this.resultSelector = resultSelector;\n }\n CombineLatestOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new CombineLatestSubscriber(subscriber, this.resultSelector));\n };\n return CombineLatestOperator;\n}());\nexport { CombineLatestOperator };\nvar CombineLatestSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(CombineLatestSubscriber, _super);\n function CombineLatestSubscriber(destination, resultSelector) {\n var _this = _super.call(this, destination) || this;\n _this.resultSelector = resultSelector;\n _this.active = 0;\n _this.values = [];\n _this.observables = [];\n return _this;\n }\n CombineLatestSubscriber.prototype._next = function (observable) {\n this.values.push(NONE);\n this.observables.push(observable);\n };\n CombineLatestSubscriber.prototype._complete = function () {\n var observables = this.observables;\n var len = observables.length;\n if (len === 0) {\n this.destination.complete();\n }\n else {\n this.active = len;\n this.toRespond = len;\n for (var i = 0; i < len; i++) {\n var observable = observables[i];\n this.add(subscribeToResult(this, observable, undefined, i));\n }\n }\n };\n CombineLatestSubscriber.prototype.notifyComplete = function (unused) {\n if ((this.active -= 1) === 0) {\n this.destination.complete();\n }\n };\n CombineLatestSubscriber.prototype.notifyNext = function (_outerValue, innerValue, outerIndex) {\n var values = this.values;\n var oldVal = values[outerIndex];\n var toRespond = !this.toRespond\n ? 0\n : oldVal === NONE ? --this.toRespond : this.toRespond;\n values[outerIndex] = innerValue;\n if (toRespond === 0) {\n if (this.resultSelector) {\n this._tryResultSelector(values);\n }\n else {\n this.destination.next(values.slice());\n }\n }\n };\n CombineLatestSubscriber.prototype._tryResultSelector = function (values) {\n var result;\n try {\n result = this.resultSelector.apply(this, values);\n }\n catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n };\n return CombineLatestSubscriber;\n}(OuterSubscriber));\nexport { CombineLatestSubscriber };\n//# sourceMappingURL=combineLatest.js.map\n","/** PURE_IMPORTS_START _Observable,_Subscription,_symbol_observable PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nimport { observable as Symbol_observable } from '../symbol/observable';\nexport function scheduleObservable(input, scheduler) {\n return new Observable(function (subscriber) {\n var sub = new Subscription();\n sub.add(scheduler.schedule(function () {\n var observable = input[Symbol_observable]();\n sub.add(observable.subscribe({\n next: function (value) { sub.add(scheduler.schedule(function () { return subscriber.next(value); })); },\n error: function (err) { sub.add(scheduler.schedule(function () { return subscriber.error(err); })); },\n complete: function () { sub.add(scheduler.schedule(function () { return subscriber.complete(); })); },\n }));\n }));\n return sub;\n });\n}\n//# sourceMappingURL=scheduleObservable.js.map\n","/** PURE_IMPORTS_START _Observable,_Subscription PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nexport function schedulePromise(input, scheduler) {\n return new Observable(function (subscriber) {\n var sub = new Subscription();\n sub.add(scheduler.schedule(function () {\n return input.then(function (value) {\n sub.add(scheduler.schedule(function () {\n subscriber.next(value);\n sub.add(scheduler.schedule(function () { return subscriber.complete(); }));\n }));\n }, function (err) {\n sub.add(scheduler.schedule(function () { return subscriber.error(err); }));\n });\n }));\n return sub;\n });\n}\n//# sourceMappingURL=schedulePromise.js.map\n","/** PURE_IMPORTS_START _Observable,_Subscription,_symbol_iterator PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nexport function scheduleIterable(input, scheduler) {\n if (!input) {\n throw new Error('Iterable cannot be null');\n }\n return new Observable(function (subscriber) {\n var sub = new Subscription();\n var iterator;\n sub.add(function () {\n if (iterator && typeof iterator.return === 'function') {\n iterator.return();\n }\n });\n sub.add(scheduler.schedule(function () {\n iterator = input[Symbol_iterator]();\n sub.add(scheduler.schedule(function () {\n if (subscriber.closed) {\n return;\n }\n var value;\n var done;\n try {\n var result = iterator.next();\n value = result.value;\n done = result.done;\n }\n catch (err) {\n subscriber.error(err);\n return;\n }\n if (done) {\n subscriber.complete();\n }\n else {\n subscriber.next(value);\n this.schedule();\n }\n }));\n }));\n return sub;\n });\n}\n//# sourceMappingURL=scheduleIterable.js.map\n","/** PURE_IMPORTS_START _symbol_observable PURE_IMPORTS_END */\nimport { observable as Symbol_observable } from '../symbol/observable';\nexport function isInteropObservable(input) {\n return input && typeof input[Symbol_observable] === 'function';\n}\n//# sourceMappingURL=isInteropObservable.js.map\n","/** PURE_IMPORTS_START _symbol_iterator PURE_IMPORTS_END */\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nexport function isIterable(input) {\n return input && typeof input[Symbol_iterator] === 'function';\n}\n//# sourceMappingURL=isIterable.js.map\n","/** PURE_IMPORTS_START _scheduleObservable,_schedulePromise,_scheduleArray,_scheduleIterable,_util_isInteropObservable,_util_isPromise,_util_isArrayLike,_util_isIterable PURE_IMPORTS_END */\nimport { scheduleObservable } from './scheduleObservable';\nimport { schedulePromise } from './schedulePromise';\nimport { scheduleArray } from './scheduleArray';\nimport { scheduleIterable } from './scheduleIterable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isPromise } from '../util/isPromise';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isIterable } from '../util/isIterable';\nexport function scheduled(input, scheduler) {\n if (input != null) {\n if (isInteropObservable(input)) {\n return scheduleObservable(input, scheduler);\n }\n else if (isPromise(input)) {\n return schedulePromise(input, scheduler);\n }\n else if (isArrayLike(input)) {\n return scheduleArray(input, scheduler);\n }\n else if (isIterable(input) || typeof input === 'string') {\n return scheduleIterable(input, scheduler);\n }\n }\n throw new TypeError((input !== null && typeof input || input) + ' is not observable');\n}\n//# sourceMappingURL=scheduled.js.map\n","/** PURE_IMPORTS_START _Observable,_util_subscribeTo,_scheduled_scheduled PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { subscribeTo } from '../util/subscribeTo';\nimport { scheduled } from '../scheduled/scheduled';\nexport function from(input, scheduler) {\n if (!scheduler) {\n if (input instanceof Observable) {\n return input;\n }\n return new Observable(subscribeTo(input));\n }\n else {\n return scheduled(input, scheduler);\n }\n}\n//# sourceMappingURL=from.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber,_Observable,_util_subscribeTo PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from './Subscriber';\nimport { Observable } from './Observable';\nimport { subscribeTo } from './util/subscribeTo';\nvar SimpleInnerSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(SimpleInnerSubscriber, _super);\n function SimpleInnerSubscriber(parent) {\n var _this = _super.call(this) || this;\n _this.parent = parent;\n return _this;\n }\n SimpleInnerSubscriber.prototype._next = function (value) {\n this.parent.notifyNext(value);\n };\n SimpleInnerSubscriber.prototype._error = function (error) {\n this.parent.notifyError(error);\n this.unsubscribe();\n };\n SimpleInnerSubscriber.prototype._complete = function () {\n this.parent.notifyComplete();\n this.unsubscribe();\n };\n return SimpleInnerSubscriber;\n}(Subscriber));\nexport { SimpleInnerSubscriber };\nvar ComplexInnerSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ComplexInnerSubscriber, _super);\n function ComplexInnerSubscriber(parent, outerValue, outerIndex) {\n var _this = _super.call(this) || this;\n _this.parent = parent;\n _this.outerValue = outerValue;\n _this.outerIndex = outerIndex;\n return _this;\n }\n ComplexInnerSubscriber.prototype._next = function (value) {\n this.parent.notifyNext(this.outerValue, value, this.outerIndex, this);\n };\n ComplexInnerSubscriber.prototype._error = function (error) {\n this.parent.notifyError(error);\n this.unsubscribe();\n };\n ComplexInnerSubscriber.prototype._complete = function () {\n this.parent.notifyComplete(this);\n this.unsubscribe();\n };\n return ComplexInnerSubscriber;\n}(Subscriber));\nexport { ComplexInnerSubscriber };\nvar SimpleOuterSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(SimpleOuterSubscriber, _super);\n function SimpleOuterSubscriber() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SimpleOuterSubscriber.prototype.notifyNext = function (innerValue) {\n this.destination.next(innerValue);\n };\n SimpleOuterSubscriber.prototype.notifyError = function (err) {\n this.destination.error(err);\n };\n SimpleOuterSubscriber.prototype.notifyComplete = function () {\n this.destination.complete();\n };\n return SimpleOuterSubscriber;\n}(Subscriber));\nexport { SimpleOuterSubscriber };\nvar ComplexOuterSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ComplexOuterSubscriber, _super);\n function ComplexOuterSubscriber() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ComplexOuterSubscriber.prototype.notifyNext = function (_outerValue, innerValue, _outerIndex, _innerSub) {\n this.destination.next(innerValue);\n };\n ComplexOuterSubscriber.prototype.notifyError = function (error) {\n this.destination.error(error);\n };\n ComplexOuterSubscriber.prototype.notifyComplete = function (_innerSub) {\n this.destination.complete();\n };\n return ComplexOuterSubscriber;\n}(Subscriber));\nexport { ComplexOuterSubscriber };\nexport function innerSubscribe(result, innerSubscriber) {\n if (innerSubscriber.closed) {\n return undefined;\n }\n if (result instanceof Observable) {\n return result.subscribe(innerSubscriber);\n }\n var subscription;\n try {\n subscription = subscribeTo(result)(innerSubscriber);\n }\n catch (error) {\n innerSubscriber.error(error);\n }\n return subscription;\n}\n//# sourceMappingURL=innerSubscribe.js.map\n","/** PURE_IMPORTS_START tslib,_map,_observable_from,_innerSubscribe PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { map } from './map';\nimport { from } from '../observable/from';\nimport { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function mergeMap(project, resultSelector, concurrent) {\n if (concurrent === void 0) {\n concurrent = Number.POSITIVE_INFINITY;\n }\n if (typeof resultSelector === 'function') {\n return function (source) { return source.pipe(mergeMap(function (a, i) { return from(project(a, i)).pipe(map(function (b, ii) { return resultSelector(a, b, i, ii); })); }, concurrent)); };\n }\n else if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n return function (source) { return source.lift(new MergeMapOperator(project, concurrent)); };\n}\nvar MergeMapOperator = /*@__PURE__*/ (function () {\n function MergeMapOperator(project, concurrent) {\n if (concurrent === void 0) {\n concurrent = Number.POSITIVE_INFINITY;\n }\n this.project = project;\n this.concurrent = concurrent;\n }\n MergeMapOperator.prototype.call = function (observer, source) {\n return source.subscribe(new MergeMapSubscriber(observer, this.project, this.concurrent));\n };\n return MergeMapOperator;\n}());\nexport { MergeMapOperator };\nvar MergeMapSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(MergeMapSubscriber, _super);\n function MergeMapSubscriber(destination, project, concurrent) {\n if (concurrent === void 0) {\n concurrent = Number.POSITIVE_INFINITY;\n }\n var _this = _super.call(this, destination) || this;\n _this.project = project;\n _this.concurrent = concurrent;\n _this.hasCompleted = false;\n _this.buffer = [];\n _this.active = 0;\n _this.index = 0;\n return _this;\n }\n MergeMapSubscriber.prototype._next = function (value) {\n if (this.active < this.concurrent) {\n this._tryNext(value);\n }\n else {\n this.buffer.push(value);\n }\n };\n MergeMapSubscriber.prototype._tryNext = function (value) {\n var result;\n var index = this.index++;\n try {\n result = this.project(value, index);\n }\n catch (err) {\n this.destination.error(err);\n return;\n }\n this.active++;\n this._innerSub(result);\n };\n MergeMapSubscriber.prototype._innerSub = function (ish) {\n var innerSubscriber = new SimpleInnerSubscriber(this);\n var destination = this.destination;\n destination.add(innerSubscriber);\n var innerSubscription = innerSubscribe(ish, innerSubscriber);\n if (innerSubscription !== innerSubscriber) {\n destination.add(innerSubscription);\n }\n };\n MergeMapSubscriber.prototype._complete = function () {\n this.hasCompleted = true;\n if (this.active === 0 && this.buffer.length === 0) {\n this.destination.complete();\n }\n this.unsubscribe();\n };\n MergeMapSubscriber.prototype.notifyNext = function (innerValue) {\n this.destination.next(innerValue);\n };\n MergeMapSubscriber.prototype.notifyComplete = function () {\n var buffer = this.buffer;\n this.active--;\n if (buffer.length > 0) {\n this._next(buffer.shift());\n }\n else if (this.active === 0 && this.hasCompleted) {\n this.destination.complete();\n }\n };\n return MergeMapSubscriber;\n}(SimpleOuterSubscriber));\nexport { MergeMapSubscriber };\nexport var flatMap = mergeMap;\n//# sourceMappingURL=mergeMap.js.map\n","/** PURE_IMPORTS_START _mergeMap,_util_identity PURE_IMPORTS_END */\nimport { mergeMap } from './mergeMap';\nimport { identity } from '../util/identity';\nexport function mergeAll(concurrent) {\n if (concurrent === void 0) {\n concurrent = Number.POSITIVE_INFINITY;\n }\n return mergeMap(identity, concurrent);\n}\n//# sourceMappingURL=mergeAll.js.map\n","/** PURE_IMPORTS_START _mergeAll PURE_IMPORTS_END */\nimport { mergeAll } from './mergeAll';\nexport function concatAll() {\n return mergeAll(1);\n}\n//# sourceMappingURL=concatAll.js.map\n","/** PURE_IMPORTS_START _of,_operators_concatAll PURE_IMPORTS_END */\nimport { of } from './of';\nimport { concatAll } from '../operators/concatAll';\nexport function concat() {\n var observables = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n observables[_i] = arguments[_i];\n }\n return concatAll()(of.apply(void 0, observables));\n}\n//# sourceMappingURL=concat.js.map\n","/** PURE_IMPORTS_START _Observable,_from,_empty PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { from } from './from';\nimport { empty } from './empty';\nexport function defer(observableFactory) {\n return new Observable(function (subscriber) {\n var input;\n try {\n input = observableFactory();\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n var source = input ? from(input) : empty();\n return source.subscribe(subscriber);\n });\n}\n//# sourceMappingURL=defer.js.map\n","/** PURE_IMPORTS_START _Observable,_util_isArray,_operators_map,_util_isObject,_from PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { isArray } from '../util/isArray';\nimport { map } from '../operators/map';\nimport { isObject } from '../util/isObject';\nimport { from } from './from';\nexport function forkJoin() {\n var sources = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n sources[_i] = arguments[_i];\n }\n if (sources.length === 1) {\n var first_1 = sources[0];\n if (isArray(first_1)) {\n return forkJoinInternal(first_1, null);\n }\n if (isObject(first_1) && Object.getPrototypeOf(first_1) === Object.prototype) {\n var keys = Object.keys(first_1);\n return forkJoinInternal(keys.map(function (key) { return first_1[key]; }), keys);\n }\n }\n if (typeof sources[sources.length - 1] === 'function') {\n var resultSelector_1 = sources.pop();\n sources = (sources.length === 1 && isArray(sources[0])) ? sources[0] : sources;\n return forkJoinInternal(sources, null).pipe(map(function (args) { return resultSelector_1.apply(void 0, args); }));\n }\n return forkJoinInternal(sources, null);\n}\nfunction forkJoinInternal(sources, keys) {\n return new Observable(function (subscriber) {\n var len = sources.length;\n if (len === 0) {\n subscriber.complete();\n return;\n }\n var values = new Array(len);\n var completed = 0;\n var emitted = 0;\n var _loop_1 = function (i) {\n var source = from(sources[i]);\n var hasValue = false;\n subscriber.add(source.subscribe({\n next: function (value) {\n if (!hasValue) {\n hasValue = true;\n emitted++;\n }\n values[i] = value;\n },\n error: function (err) { return subscriber.error(err); },\n complete: function () {\n completed++;\n if (completed === len || !hasValue) {\n if (emitted === len) {\n subscriber.next(keys ?\n keys.reduce(function (result, key, i) { return (result[key] = values[i], result); }, {}) :\n values);\n }\n subscriber.complete();\n }\n }\n }));\n };\n for (var i = 0; i < len; i++) {\n _loop_1(i);\n }\n });\n}\n//# sourceMappingURL=forkJoin.js.map\n","/** PURE_IMPORTS_START _Observable,_util_isArray,_util_isFunction,_operators_map PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { isArray } from '../util/isArray';\nimport { isFunction } from '../util/isFunction';\nimport { map } from '../operators/map';\nvar toString = /*@__PURE__*/ (function () { return Object.prototype.toString; })();\nexport function fromEvent(target, eventName, options, resultSelector) {\n if (isFunction(options)) {\n resultSelector = options;\n options = undefined;\n }\n if (resultSelector) {\n return fromEvent(target, eventName, options).pipe(map(function (args) { return isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));\n }\n return new Observable(function (subscriber) {\n function handler(e) {\n if (arguments.length > 1) {\n subscriber.next(Array.prototype.slice.call(arguments));\n }\n else {\n subscriber.next(e);\n }\n }\n setupSubscription(target, eventName, handler, subscriber, options);\n });\n}\nfunction setupSubscription(sourceObj, eventName, handler, subscriber, options) {\n var unsubscribe;\n if (isEventTarget(sourceObj)) {\n var source_1 = sourceObj;\n sourceObj.addEventListener(eventName, handler, options);\n unsubscribe = function () { return source_1.removeEventListener(eventName, handler, options); };\n }\n else if (isJQueryStyleEventEmitter(sourceObj)) {\n var source_2 = sourceObj;\n sourceObj.on(eventName, handler);\n unsubscribe = function () { return source_2.off(eventName, handler); };\n }\n else if (isNodeStyleEventEmitter(sourceObj)) {\n var source_3 = sourceObj;\n sourceObj.addListener(eventName, handler);\n unsubscribe = function () { return source_3.removeListener(eventName, handler); };\n }\n else if (sourceObj && sourceObj.length) {\n for (var i = 0, len = sourceObj.length; i < len; i++) {\n setupSubscription(sourceObj[i], eventName, handler, subscriber, options);\n }\n }\n else {\n throw new TypeError('Invalid event target');\n }\n subscriber.add(unsubscribe);\n}\nfunction isNodeStyleEventEmitter(sourceObj) {\n return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';\n}\nfunction isJQueryStyleEventEmitter(sourceObj) {\n return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';\n}\nfunction isEventTarget(sourceObj) {\n return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';\n}\n//# sourceMappingURL=fromEvent.js.map\n","/** PURE_IMPORTS_START _Observable,_util_isArray,_util_isFunction,_operators_map PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { isArray } from '../util/isArray';\nimport { isFunction } from '../util/isFunction';\nimport { map } from '../operators/map';\nexport function fromEventPattern(addHandler, removeHandler, resultSelector) {\n if (resultSelector) {\n return fromEventPattern(addHandler, removeHandler).pipe(map(function (args) { return isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));\n }\n return new Observable(function (subscriber) {\n var handler = function () {\n var e = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n e[_i] = arguments[_i];\n }\n return subscriber.next(e.length === 1 ? e[0] : e);\n };\n var retValue;\n try {\n retValue = addHandler(handler);\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n if (!isFunction(removeHandler)) {\n return undefined;\n }\n return function () { return removeHandler(handler, retValue); };\n });\n}\n//# sourceMappingURL=fromEventPattern.js.map\n","/** PURE_IMPORTS_START _Observable,_util_identity,_util_isScheduler PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { identity } from '../util/identity';\nimport { isScheduler } from '../util/isScheduler';\nexport function generate(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) {\n var resultSelector;\n var initialState;\n if (arguments.length == 1) {\n var options = initialStateOrOptions;\n initialState = options.initialState;\n condition = options.condition;\n iterate = options.iterate;\n resultSelector = options.resultSelector || identity;\n scheduler = options.scheduler;\n }\n else if (resultSelectorOrObservable === undefined || isScheduler(resultSelectorOrObservable)) {\n initialState = initialStateOrOptions;\n resultSelector = identity;\n scheduler = resultSelectorOrObservable;\n }\n else {\n initialState = initialStateOrOptions;\n resultSelector = resultSelectorOrObservable;\n }\n return new Observable(function (subscriber) {\n var state = initialState;\n if (scheduler) {\n return scheduler.schedule(dispatch, 0, {\n subscriber: subscriber,\n iterate: iterate,\n condition: condition,\n resultSelector: resultSelector,\n state: state\n });\n }\n do {\n if (condition) {\n var conditionResult = void 0;\n try {\n conditionResult = condition(state);\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n if (!conditionResult) {\n subscriber.complete();\n break;\n }\n }\n var value = void 0;\n try {\n value = resultSelector(state);\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n subscriber.next(value);\n if (subscriber.closed) {\n break;\n }\n try {\n state = iterate(state);\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n } while (true);\n return undefined;\n });\n}\nfunction dispatch(state) {\n var subscriber = state.subscriber, condition = state.condition;\n if (subscriber.closed) {\n return undefined;\n }\n if (state.needIterate) {\n try {\n state.state = state.iterate(state.state);\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n }\n else {\n state.needIterate = true;\n }\n if (condition) {\n var conditionResult = void 0;\n try {\n conditionResult = condition(state.state);\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n if (!conditionResult) {\n subscriber.complete();\n return undefined;\n }\n if (subscriber.closed) {\n return undefined;\n }\n }\n var value;\n try {\n value = state.resultSelector(state.state);\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n if (subscriber.closed) {\n return undefined;\n }\n subscriber.next(value);\n if (subscriber.closed) {\n return undefined;\n }\n return this.schedule(state);\n}\n//# sourceMappingURL=generate.js.map\n","/** PURE_IMPORTS_START _defer,_empty PURE_IMPORTS_END */\nimport { defer } from './defer';\nimport { EMPTY } from './empty';\nexport function iif(condition, trueResult, falseResult) {\n if (trueResult === void 0) {\n trueResult = EMPTY;\n }\n if (falseResult === void 0) {\n falseResult = EMPTY;\n }\n return defer(function () { return condition() ? trueResult : falseResult; });\n}\n//# sourceMappingURL=iif.js.map\n","/** PURE_IMPORTS_START _isArray PURE_IMPORTS_END */\nimport { isArray } from './isArray';\nexport function isNumeric(val) {\n return !isArray(val) && (val - parseFloat(val) + 1) >= 0;\n}\n//# sourceMappingURL=isNumeric.js.map\n","/** PURE_IMPORTS_START _Observable,_scheduler_async,_util_isNumeric PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { async } from '../scheduler/async';\nimport { isNumeric } from '../util/isNumeric';\nexport function interval(period, scheduler) {\n if (period === void 0) {\n period = 0;\n }\n if (scheduler === void 0) {\n scheduler = async;\n }\n if (!isNumeric(period) || period < 0) {\n period = 0;\n }\n if (!scheduler || typeof scheduler.schedule !== 'function') {\n scheduler = async;\n }\n return new Observable(function (subscriber) {\n subscriber.add(scheduler.schedule(dispatch, period, { subscriber: subscriber, counter: 0, period: period }));\n return subscriber;\n });\n}\nfunction dispatch(state) {\n var subscriber = state.subscriber, counter = state.counter, period = state.period;\n subscriber.next(counter);\n this.schedule({ subscriber: subscriber, counter: counter + 1, period: period }, period);\n}\n//# sourceMappingURL=interval.js.map\n","/** PURE_IMPORTS_START _Observable,_util_isScheduler,_operators_mergeAll,_fromArray PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { isScheduler } from '../util/isScheduler';\nimport { mergeAll } from '../operators/mergeAll';\nimport { fromArray } from './fromArray';\nexport function merge() {\n var observables = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n observables[_i] = arguments[_i];\n }\n var concurrent = Number.POSITIVE_INFINITY;\n var scheduler = null;\n var last = observables[observables.length - 1];\n if (isScheduler(last)) {\n scheduler = observables.pop();\n if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {\n concurrent = observables.pop();\n }\n }\n else if (typeof last === 'number') {\n concurrent = observables.pop();\n }\n if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable) {\n return observables[0];\n }\n return mergeAll(concurrent)(fromArray(observables, scheduler));\n}\n//# sourceMappingURL=merge.js.map\n","/** PURE_IMPORTS_START _Observable,_util_noop PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { noop } from '../util/noop';\nexport var NEVER = /*@__PURE__*/ new Observable(noop);\nexport function never() {\n return NEVER;\n}\n//# sourceMappingURL=never.js.map\n","/** PURE_IMPORTS_START _Observable,_from,_util_isArray,_empty PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { from } from './from';\nimport { isArray } from '../util/isArray';\nimport { EMPTY } from './empty';\nexport function onErrorResumeNext() {\n var sources = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n sources[_i] = arguments[_i];\n }\n if (sources.length === 0) {\n return EMPTY;\n }\n var first = sources[0], remainder = sources.slice(1);\n if (sources.length === 1 && isArray(first)) {\n return onErrorResumeNext.apply(void 0, first);\n }\n return new Observable(function (subscriber) {\n var subNext = function () { return subscriber.add(onErrorResumeNext.apply(void 0, remainder).subscribe(subscriber)); };\n return from(first).subscribe({\n next: function (value) { subscriber.next(value); },\n error: subNext,\n complete: subNext,\n });\n });\n}\n//# sourceMappingURL=onErrorResumeNext.js.map\n","/** PURE_IMPORTS_START _Observable,_Subscription PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nexport function pairs(obj, scheduler) {\n if (!scheduler) {\n return new Observable(function (subscriber) {\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length && !subscriber.closed; i++) {\n var key = keys[i];\n if (obj.hasOwnProperty(key)) {\n subscriber.next([key, obj[key]]);\n }\n }\n subscriber.complete();\n });\n }\n else {\n return new Observable(function (subscriber) {\n var keys = Object.keys(obj);\n var subscription = new Subscription();\n subscription.add(scheduler.schedule(dispatch, 0, { keys: keys, index: 0, subscriber: subscriber, subscription: subscription, obj: obj }));\n return subscription;\n });\n }\n}\nexport function dispatch(state) {\n var keys = state.keys, index = state.index, subscriber = state.subscriber, subscription = state.subscription, obj = state.obj;\n if (!subscriber.closed) {\n if (index < keys.length) {\n var key = keys[index];\n subscriber.next([key, obj[key]]);\n subscription.add(this.schedule({ keys: keys, index: index + 1, subscriber: subscriber, subscription: subscription, obj: obj }));\n }\n else {\n subscriber.complete();\n }\n }\n}\n//# sourceMappingURL=pairs.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function not(pred, thisArg) {\n function notPred() {\n return !(notPred.pred.apply(notPred.thisArg, arguments));\n }\n notPred.pred = pred;\n notPred.thisArg = thisArg;\n return notPred;\n}\n//# sourceMappingURL=not.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nexport function filter(predicate, thisArg) {\n return function filterOperatorFunction(source) {\n return source.lift(new FilterOperator(predicate, thisArg));\n };\n}\nvar FilterOperator = /*@__PURE__*/ (function () {\n function FilterOperator(predicate, thisArg) {\n this.predicate = predicate;\n this.thisArg = thisArg;\n }\n FilterOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));\n };\n return FilterOperator;\n}());\nvar FilterSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(FilterSubscriber, _super);\n function FilterSubscriber(destination, predicate, thisArg) {\n var _this = _super.call(this, destination) || this;\n _this.predicate = predicate;\n _this.thisArg = thisArg;\n _this.count = 0;\n return _this;\n }\n FilterSubscriber.prototype._next = function (value) {\n var result;\n try {\n result = this.predicate.call(this.thisArg, value, this.count++);\n }\n catch (err) {\n this.destination.error(err);\n return;\n }\n if (result) {\n this.destination.next(value);\n }\n };\n return FilterSubscriber;\n}(Subscriber));\n//# sourceMappingURL=filter.js.map\n","/** PURE_IMPORTS_START _util_not,_util_subscribeTo,_operators_filter,_Observable PURE_IMPORTS_END */\nimport { not } from '../util/not';\nimport { subscribeTo } from '../util/subscribeTo';\nimport { filter } from '../operators/filter';\nimport { Observable } from '../Observable';\nexport function partition(source, predicate, thisArg) {\n return [\n filter(predicate, thisArg)(new Observable(subscribeTo(source))),\n filter(not(predicate, thisArg))(new Observable(subscribeTo(source)))\n ];\n}\n//# sourceMappingURL=partition.js.map\n","/** PURE_IMPORTS_START tslib,_util_isArray,_fromArray,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { isArray } from '../util/isArray';\nimport { fromArray } from './fromArray';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { subscribeToResult } from '../util/subscribeToResult';\nexport function race() {\n var observables = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n observables[_i] = arguments[_i];\n }\n if (observables.length === 1) {\n if (isArray(observables[0])) {\n observables = observables[0];\n }\n else {\n return observables[0];\n }\n }\n return fromArray(observables, undefined).lift(new RaceOperator());\n}\nvar RaceOperator = /*@__PURE__*/ (function () {\n function RaceOperator() {\n }\n RaceOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new RaceSubscriber(subscriber));\n };\n return RaceOperator;\n}());\nexport { RaceOperator };\nvar RaceSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(RaceSubscriber, _super);\n function RaceSubscriber(destination) {\n var _this = _super.call(this, destination) || this;\n _this.hasFirst = false;\n _this.observables = [];\n _this.subscriptions = [];\n return _this;\n }\n RaceSubscriber.prototype._next = function (observable) {\n this.observables.push(observable);\n };\n RaceSubscriber.prototype._complete = function () {\n var observables = this.observables;\n var len = observables.length;\n if (len === 0) {\n this.destination.complete();\n }\n else {\n for (var i = 0; i < len && !this.hasFirst; i++) {\n var observable = observables[i];\n var subscription = subscribeToResult(this, observable, undefined, i);\n if (this.subscriptions) {\n this.subscriptions.push(subscription);\n }\n this.add(subscription);\n }\n this.observables = null;\n }\n };\n RaceSubscriber.prototype.notifyNext = function (_outerValue, innerValue, outerIndex) {\n if (!this.hasFirst) {\n this.hasFirst = true;\n for (var i = 0; i < this.subscriptions.length; i++) {\n if (i !== outerIndex) {\n var subscription = this.subscriptions[i];\n subscription.unsubscribe();\n this.remove(subscription);\n }\n }\n this.subscriptions = null;\n }\n this.destination.next(innerValue);\n };\n return RaceSubscriber;\n}(OuterSubscriber));\nexport { RaceSubscriber };\n//# sourceMappingURL=race.js.map\n","/** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nexport function range(start, count, scheduler) {\n if (start === void 0) {\n start = 0;\n }\n return new Observable(function (subscriber) {\n if (count === undefined) {\n count = start;\n start = 0;\n }\n var index = 0;\n var current = start;\n if (scheduler) {\n return scheduler.schedule(dispatch, 0, {\n index: index, count: count, start: start, subscriber: subscriber\n });\n }\n else {\n do {\n if (index++ >= count) {\n subscriber.complete();\n break;\n }\n subscriber.next(current++);\n if (subscriber.closed) {\n break;\n }\n } while (true);\n }\n return undefined;\n });\n}\nexport function dispatch(state) {\n var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber;\n if (index >= count) {\n subscriber.complete();\n return;\n }\n subscriber.next(start);\n if (subscriber.closed) {\n return;\n }\n state.index = index + 1;\n state.start = start + 1;\n this.schedule(state);\n}\n//# sourceMappingURL=range.js.map\n","/** PURE_IMPORTS_START _Observable,_scheduler_async,_util_isNumeric,_util_isScheduler PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { async } from '../scheduler/async';\nimport { isNumeric } from '../util/isNumeric';\nimport { isScheduler } from '../util/isScheduler';\nexport function timer(dueTime, periodOrScheduler, scheduler) {\n if (dueTime === void 0) {\n dueTime = 0;\n }\n var period = -1;\n if (isNumeric(periodOrScheduler)) {\n period = Number(periodOrScheduler) < 1 && 1 || Number(periodOrScheduler);\n }\n else if (isScheduler(periodOrScheduler)) {\n scheduler = periodOrScheduler;\n }\n if (!isScheduler(scheduler)) {\n scheduler = async;\n }\n return new Observable(function (subscriber) {\n var due = isNumeric(dueTime)\n ? dueTime\n : (+dueTime - scheduler.now());\n return scheduler.schedule(dispatch, due, {\n index: 0, period: period, subscriber: subscriber\n });\n });\n}\nfunction dispatch(state) {\n var index = state.index, period = state.period, subscriber = state.subscriber;\n subscriber.next(index);\n if (subscriber.closed) {\n return;\n }\n else if (period === -1) {\n return subscriber.complete();\n }\n state.index = index + 1;\n this.schedule(state, period);\n}\n//# sourceMappingURL=timer.js.map\n","/** PURE_IMPORTS_START _Observable,_from,_empty PURE_IMPORTS_END */\nimport { Observable } from '../Observable';\nimport { from } from './from';\nimport { EMPTY } from './empty';\nexport function using(resourceFactory, observableFactory) {\n return new Observable(function (subscriber) {\n var resource;\n try {\n resource = resourceFactory();\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n var result;\n try {\n result = observableFactory(resource);\n }\n catch (err) {\n subscriber.error(err);\n return undefined;\n }\n var source = result ? from(result) : EMPTY;\n var subscription = source.subscribe(subscriber);\n return function () {\n subscription.unsubscribe();\n if (resource) {\n resource.unsubscribe();\n }\n };\n });\n}\n//# sourceMappingURL=using.js.map\n","/** PURE_IMPORTS_START tslib,_fromArray,_util_isArray,_Subscriber,_.._internal_symbol_iterator,_innerSubscribe PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { fromArray } from './fromArray';\nimport { isArray } from '../util/isArray';\nimport { Subscriber } from '../Subscriber';\nimport { iterator as Symbol_iterator } from '../../internal/symbol/iterator';\nimport { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function zip() {\n var observables = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n observables[_i] = arguments[_i];\n }\n var resultSelector = observables[observables.length - 1];\n if (typeof resultSelector === 'function') {\n observables.pop();\n }\n return fromArray(observables, undefined).lift(new ZipOperator(resultSelector));\n}\nvar ZipOperator = /*@__PURE__*/ (function () {\n function ZipOperator(resultSelector) {\n this.resultSelector = resultSelector;\n }\n ZipOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector));\n };\n return ZipOperator;\n}());\nexport { ZipOperator };\nvar ZipSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ZipSubscriber, _super);\n function ZipSubscriber(destination, resultSelector, values) {\n if (values === void 0) {\n values = Object.create(null);\n }\n var _this = _super.call(this, destination) || this;\n _this.resultSelector = resultSelector;\n _this.iterators = [];\n _this.active = 0;\n _this.resultSelector = (typeof resultSelector === 'function') ? resultSelector : undefined;\n return _this;\n }\n ZipSubscriber.prototype._next = function (value) {\n var iterators = this.iterators;\n if (isArray(value)) {\n iterators.push(new StaticArrayIterator(value));\n }\n else if (typeof value[Symbol_iterator] === 'function') {\n iterators.push(new StaticIterator(value[Symbol_iterator]()));\n }\n else {\n iterators.push(new ZipBufferIterator(this.destination, this, value));\n }\n };\n ZipSubscriber.prototype._complete = function () {\n var iterators = this.iterators;\n var len = iterators.length;\n this.unsubscribe();\n if (len === 0) {\n this.destination.complete();\n return;\n }\n this.active = len;\n for (var i = 0; i < len; i++) {\n var iterator = iterators[i];\n if (iterator.stillUnsubscribed) {\n var destination = this.destination;\n destination.add(iterator.subscribe());\n }\n else {\n this.active--;\n }\n }\n };\n ZipSubscriber.prototype.notifyInactive = function () {\n this.active--;\n if (this.active === 0) {\n this.destination.complete();\n }\n };\n ZipSubscriber.prototype.checkIterators = function () {\n var iterators = this.iterators;\n var len = iterators.length;\n var destination = this.destination;\n for (var i = 0; i < len; i++) {\n var iterator = iterators[i];\n if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {\n return;\n }\n }\n var shouldComplete = false;\n var args = [];\n for (var i = 0; i < len; i++) {\n var iterator = iterators[i];\n var result = iterator.next();\n if (iterator.hasCompleted()) {\n shouldComplete = true;\n }\n if (result.done) {\n destination.complete();\n return;\n }\n args.push(result.value);\n }\n if (this.resultSelector) {\n this._tryresultSelector(args);\n }\n else {\n destination.next(args);\n }\n if (shouldComplete) {\n destination.complete();\n }\n };\n ZipSubscriber.prototype._tryresultSelector = function (args) {\n var result;\n try {\n result = this.resultSelector.apply(this, args);\n }\n catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n };\n return ZipSubscriber;\n}(Subscriber));\nexport { ZipSubscriber };\nvar StaticIterator = /*@__PURE__*/ (function () {\n function StaticIterator(iterator) {\n this.iterator = iterator;\n this.nextResult = iterator.next();\n }\n StaticIterator.prototype.hasValue = function () {\n return true;\n };\n StaticIterator.prototype.next = function () {\n var result = this.nextResult;\n this.nextResult = this.iterator.next();\n return result;\n };\n StaticIterator.prototype.hasCompleted = function () {\n var nextResult = this.nextResult;\n return Boolean(nextResult && nextResult.done);\n };\n return StaticIterator;\n}());\nvar StaticArrayIterator = /*@__PURE__*/ (function () {\n function StaticArrayIterator(array) {\n this.array = array;\n this.index = 0;\n this.length = 0;\n this.length = array.length;\n }\n StaticArrayIterator.prototype[Symbol_iterator] = function () {\n return this;\n };\n StaticArrayIterator.prototype.next = function (value) {\n var i = this.index++;\n var array = this.array;\n return i < this.length ? { value: array[i], done: false } : { value: null, done: true };\n };\n StaticArrayIterator.prototype.hasValue = function () {\n return this.array.length > this.index;\n };\n StaticArrayIterator.prototype.hasCompleted = function () {\n return this.array.length === this.index;\n };\n return StaticArrayIterator;\n}());\nvar ZipBufferIterator = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ZipBufferIterator, _super);\n function ZipBufferIterator(destination, parent, observable) {\n var _this = _super.call(this, destination) || this;\n _this.parent = parent;\n _this.observable = observable;\n _this.stillUnsubscribed = true;\n _this.buffer = [];\n _this.isComplete = false;\n return _this;\n }\n ZipBufferIterator.prototype[Symbol_iterator] = function () {\n return this;\n };\n ZipBufferIterator.prototype.next = function () {\n var buffer = this.buffer;\n if (buffer.length === 0 && this.isComplete) {\n return { value: null, done: true };\n }\n else {\n return { value: buffer.shift(), done: false };\n }\n };\n ZipBufferIterator.prototype.hasValue = function () {\n return this.buffer.length > 0;\n };\n ZipBufferIterator.prototype.hasCompleted = function () {\n return this.buffer.length === 0 && this.isComplete;\n };\n ZipBufferIterator.prototype.notifyComplete = function () {\n if (this.buffer.length > 0) {\n this.isComplete = true;\n this.parent.notifyInactive();\n }\n else {\n this.destination.complete();\n }\n };\n ZipBufferIterator.prototype.notifyNext = function (innerValue) {\n this.buffer.push(innerValue);\n this.parent.checkIterators();\n };\n ZipBufferIterator.prototype.subscribe = function () {\n return innerSubscribe(this.observable, new SimpleInnerSubscriber(this));\n };\n return ZipBufferIterator;\n}(SimpleOuterSubscriber));\n//# sourceMappingURL=zip.js.map\n","import {\r\n IMsal2AuthService,\r\n IMsal2ProviderOptions,\r\n IMsalLoginOptions,\r\n LoginEvent,\r\n LogoutEvent,\r\n Msal2EventType,\r\n RefreshAuthExpirationEvent\r\n} from \"./interface\";\r\nimport {AccountInfo, AuthenticationResult} from \"@azure/msal-browser\";\r\nimport {Subject} from \"rxjs\";\r\n\r\nconst fakeAccount = {\r\n \"homeAccountId\": \"d9394b16-7958-4c05-8353-b3d58d10cab0-b2c_1a_signin.8169f436-4306-4551-aeb6-3952cbbf9fec\",\r\n \"environment\": \"vivlidev.b2clogin.com\",\r\n \"tenantId\": \"8169f436-4306-4551-aeb6-3952cbbf9fec\",\r\n \"username\": \"\",\r\n \"localAccountId\": \"d9394b16-7958-4c05-8353-b3d58d10cab0\",\r\n \"name\": \"Test User\",\r\n \"idTokenClaims\": {\r\n \"exp\": 1675874972,\r\n \"nbf\": 1675871372,\r\n \"ver\": \"1.0\",\r\n \"iss\": \"https://vivlidev.b2clogin.com/8169f436-4306-4551-aeb6-3952cbbf9fec/v2.0/\",\r\n \"sub\": \"d9394b16-7958-4c05-8353-b3d58d10cab0\",\r\n \"aud\": \"0ab5fd88-35e3-465d-881f-d4ddcf0817f2\",\r\n \"nonce\": \"fb32e1ba-6bfb-4b81-aee9-fcd214b7eee6\",\r\n \"iat\": 1675871372,\r\n \"auth_time\": 1675871345,\r\n \"oid\": \"d9394b16-7958-4c05-8353-b3d58d10cab0\",\r\n \"name\": \"Test User\",\r\n \"email\": \"test.user@vivli.org\",\r\n \"idp\": \"localAuthority\",\r\n \"tid\": \"8169f436-4306-4551-aeb6-3952cbbf9fec\",\r\n \"tfp\": \"B2C_1A_SignIn\"\r\n }\r\n}\r\nconst fakeToken = \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzU4NzY0ODMsIm5iZiI6MTY3NTg3Mjg4MywidmVyIjoiMS4wIiwiaXNzIjoiaHR0cHM6Ly92aXZsaWRldi5iMmNsb2dpbi5jb20vODE2OWY0MzYtNDMwNi00NTUxLWFlYjYtMzk1MmNiYmY5ZmVjL3YyLjAvIiwic3ViIjoiZDkzOTRiMTYtNzk1OC00YzA1LTgzNTMtYjNkNThkMTBjYWIwIiwiYXVkIjoiMGFiNWZkODgtMzVlMy00NjVkLTg4MWYtZDRkZGNmMDgxN2YyIiwibm9uY2UiOiJlMmIyN2Y5MS0xZDk0LTRhMjItODc4NS00NGViNTU2NDY0Y2QiLCJpYXQiOjE2NzU4NzI4ODMsImF1dGhfdGltZSI6MTY3NTg3Mjg4Miwib2lkIjoiZDkzOTRiMTYtNzk1OC00YzA1LTgzNTMtYjNkNThkMTBjYWIwIiwibmFtZSI6IlRlc3QgVXNlciIsImVtYWlsIjoidGVzdC11c2VyQHZpdmxpLm9yZyIsImlkcCI6ImxvY2FsQXV0aG9yaXR5IiwidGlkIjoiODE2OWY0MzYtNDMwNi00NTUxLWFlYjYtMzk1MmNiYmY5ZmVjIiwidGZwIjoiQjJDXzFBX1NpZ25JbiJ9.CuSyVOpySt2MtSFf4EBmqskollJTa-TU4N8P99Fml-k\";\r\n\r\nexport class Msal2FakeService implements IMsal2AuthService {\r\n public authEvents: Subject;\r\n\r\n public options: IMsal2ProviderOptions;\r\n\r\n private account: AccountInfo;\r\n\r\n private apiToken: string;\r\n\r\n constructor(options: IMsal2ProviderOptions) {\r\n this.authEvents = new Subject();\r\n this.options = options;\r\n }\r\n\r\n public getAccount = (): AccountInfo | null => {\r\n return this.account;\r\n }\r\n\r\n public getApiToken = (): string => {\r\n return fakeToken;\r\n }\r\n\r\n public getTokenPopup = (): Promise => {\r\n return new Promise((resolve) => {\r\n const token = this.getApiToken();\r\n this.triggerEvent(new RefreshAuthExpirationEvent(token))\r\n resolve(token);\r\n })\r\n }\r\n\r\n public getTokenRedirect = (): Promise => {\r\n const token = this.getApiToken();\r\n return new Promise((resolve) => {\r\n this.triggerEvent(new RefreshAuthExpirationEvent(token))\r\n resolve(token);\r\n })\r\n }\r\n\r\n public isSsoUser = (): boolean => {\r\n return false;\r\n }\r\n\r\n public loadAuthModule = (): Promise => {\r\n return new Promise((res) => res(''));\r\n }\r\n\r\n public login = (options?: IMsalLoginOptions): Promise => {\r\n this.account = fakeAccount;\r\n this.apiToken = fakeToken;\r\n\r\n return new Promise((resolve) => {\r\n const loginEvent = new LoginEvent(fakeAccount, fakeToken);\r\n this.triggerEvent(loginEvent);\r\n resolve();\r\n });\r\n }\r\n\r\n public logout = (): void => {\r\n this.account = null;\r\n this.apiToken = null;\r\n\r\n this.triggerEvent(new LogoutEvent());\r\n }\r\n\r\n public signUp = (): Promise => {\r\n return Promise.resolve(undefined);\r\n }\r\n\r\n public silentLogin = (): void => {\r\n }\r\n\r\n public triggerEvent = (event: Msal2EventType): void => {\r\n this.authEvents.next(event);\r\n }\r\n\r\n public updatePassword = (): void => {\r\n }\r\n\r\n public updateProfile = (): void => {\r\n }\r\n\r\n loadNonLocalAccount(onLoginSuccess?: (userAccount: AccountInfo) => void) {\r\n }\r\n\r\n}\r\n","//! moment.js\n//! version : 2.29.4\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! momentjs.com\n\nvar hookCallback;\n\nfunction hooks() {\n return hookCallback.apply(null, arguments);\n}\n\n// This is done to register the method called with moment()\n// without creating circular dependencies.\nfunction setHookCallback(callback) {\n hookCallback = callback;\n}\n\nfunction isArray(input) {\n return (\n input instanceof Array ||\n Object.prototype.toString.call(input) === '[object Array]'\n );\n}\n\nfunction isObject(input) {\n // IE8 will treat undefined and null as object if it wasn't for\n // input != null\n return (\n input != null &&\n Object.prototype.toString.call(input) === '[object Object]'\n );\n}\n\nfunction hasOwnProp(a, b) {\n return Object.prototype.hasOwnProperty.call(a, b);\n}\n\nfunction isObjectEmpty(obj) {\n if (Object.getOwnPropertyNames) {\n return Object.getOwnPropertyNames(obj).length === 0;\n } else {\n var k;\n for (k in obj) {\n if (hasOwnProp(obj, k)) {\n return false;\n }\n }\n return true;\n }\n}\n\nfunction isUndefined(input) {\n return input === void 0;\n}\n\nfunction isNumber(input) {\n return (\n typeof input === 'number' ||\n Object.prototype.toString.call(input) === '[object Number]'\n );\n}\n\nfunction isDate(input) {\n return (\n input instanceof Date ||\n Object.prototype.toString.call(input) === '[object Date]'\n );\n}\n\nfunction map(arr, fn) {\n var res = [],\n i,\n arrLen = arr.length;\n for (i = 0; i < arrLen; ++i) {\n res.push(fn(arr[i], i));\n }\n return res;\n}\n\nfunction extend(a, b) {\n for (var i in b) {\n if (hasOwnProp(b, i)) {\n a[i] = b[i];\n }\n }\n\n if (hasOwnProp(b, 'toString')) {\n a.toString = b.toString;\n }\n\n if (hasOwnProp(b, 'valueOf')) {\n a.valueOf = b.valueOf;\n }\n\n return a;\n}\n\nfunction createUTC(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, true).utc();\n}\n\nfunction defaultParsingFlags() {\n // We need to deep clone this object.\n return {\n empty: false,\n unusedTokens: [],\n unusedInput: [],\n overflow: -2,\n charsLeftOver: 0,\n nullInput: false,\n invalidEra: null,\n invalidMonth: null,\n invalidFormat: false,\n userInvalidated: false,\n iso: false,\n parsedDateParts: [],\n era: null,\n meridiem: null,\n rfc2822: false,\n weekdayMismatch: false,\n };\n}\n\nfunction getParsingFlags(m) {\n if (m._pf == null) {\n m._pf = defaultParsingFlags();\n }\n return m._pf;\n}\n\nvar some;\nif (Array.prototype.some) {\n some = Array.prototype.some;\n} else {\n some = function (fun) {\n var t = Object(this),\n len = t.length >>> 0,\n i;\n\n for (i = 0; i < len; i++) {\n if (i in t && fun.call(this, t[i], i, t)) {\n return true;\n }\n }\n\n return false;\n };\n}\n\nfunction isValid(m) {\n if (m._isValid == null) {\n var flags = getParsingFlags(m),\n parsedParts = some.call(flags.parsedDateParts, function (i) {\n return i != null;\n }),\n isNowValid =\n !isNaN(m._d.getTime()) &&\n flags.overflow < 0 &&\n !flags.empty &&\n !flags.invalidEra &&\n !flags.invalidMonth &&\n !flags.invalidWeekday &&\n !flags.weekdayMismatch &&\n !flags.nullInput &&\n !flags.invalidFormat &&\n !flags.userInvalidated &&\n (!flags.meridiem || (flags.meridiem && parsedParts));\n\n if (m._strict) {\n isNowValid =\n isNowValid &&\n flags.charsLeftOver === 0 &&\n flags.unusedTokens.length === 0 &&\n flags.bigHour === undefined;\n }\n\n if (Object.isFrozen == null || !Object.isFrozen(m)) {\n m._isValid = isNowValid;\n } else {\n return isNowValid;\n }\n }\n return m._isValid;\n}\n\nfunction createInvalid(flags) {\n var m = createUTC(NaN);\n if (flags != null) {\n extend(getParsingFlags(m), flags);\n } else {\n getParsingFlags(m).userInvalidated = true;\n }\n\n return m;\n}\n\n// Plugins that add properties should also add the key here (null value),\n// so we can properly clone ourselves.\nvar momentProperties = (hooks.momentProperties = []),\n updateInProgress = false;\n\nfunction copyConfig(to, from) {\n var i,\n prop,\n val,\n momentPropertiesLen = momentProperties.length;\n\n if (!isUndefined(from._isAMomentObject)) {\n to._isAMomentObject = from._isAMomentObject;\n }\n if (!isUndefined(from._i)) {\n to._i = from._i;\n }\n if (!isUndefined(from._f)) {\n to._f = from._f;\n }\n if (!isUndefined(from._l)) {\n to._l = from._l;\n }\n if (!isUndefined(from._strict)) {\n to._strict = from._strict;\n }\n if (!isUndefined(from._tzm)) {\n to._tzm = from._tzm;\n }\n if (!isUndefined(from._isUTC)) {\n to._isUTC = from._isUTC;\n }\n if (!isUndefined(from._offset)) {\n to._offset = from._offset;\n }\n if (!isUndefined(from._pf)) {\n to._pf = getParsingFlags(from);\n }\n if (!isUndefined(from._locale)) {\n to._locale = from._locale;\n }\n\n if (momentPropertiesLen > 0) {\n for (i = 0; i < momentPropertiesLen; i++) {\n prop = momentProperties[i];\n val = from[prop];\n if (!isUndefined(val)) {\n to[prop] = val;\n }\n }\n }\n\n return to;\n}\n\n// Moment prototype object\nfunction Moment(config) {\n copyConfig(this, config);\n this._d = new Date(config._d != null ? config._d.getTime() : NaN);\n if (!this.isValid()) {\n this._d = new Date(NaN);\n }\n // Prevent infinite loop in case updateOffset creates new moment\n // objects.\n if (updateInProgress === false) {\n updateInProgress = true;\n hooks.updateOffset(this);\n updateInProgress = false;\n }\n}\n\nfunction isMoment(obj) {\n return (\n obj instanceof Moment || (obj != null && obj._isAMomentObject != null)\n );\n}\n\nfunction warn(msg) {\n if (\n hooks.suppressDeprecationWarnings === false &&\n typeof console !== 'undefined' &&\n console.warn\n ) {\n console.warn('Deprecation warning: ' + msg);\n }\n}\n\nfunction deprecate(msg, fn) {\n var firstTime = true;\n\n return extend(function () {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(null, msg);\n }\n if (firstTime) {\n var args = [],\n arg,\n i,\n key,\n argLen = arguments.length;\n for (i = 0; i < argLen; i++) {\n arg = '';\n if (typeof arguments[i] === 'object') {\n arg += '\\n[' + i + '] ';\n for (key in arguments[0]) {\n if (hasOwnProp(arguments[0], key)) {\n arg += key + ': ' + arguments[0][key] + ', ';\n }\n }\n arg = arg.slice(0, -2); // Remove trailing comma and space\n } else {\n arg = arguments[i];\n }\n args.push(arg);\n }\n warn(\n msg +\n '\\nArguments: ' +\n Array.prototype.slice.call(args).join('') +\n '\\n' +\n new Error().stack\n );\n firstTime = false;\n }\n return fn.apply(this, arguments);\n }, fn);\n}\n\nvar deprecations = {};\n\nfunction deprecateSimple(name, msg) {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(name, msg);\n }\n if (!deprecations[name]) {\n warn(msg);\n deprecations[name] = true;\n }\n}\n\nhooks.suppressDeprecationWarnings = false;\nhooks.deprecationHandler = null;\n\nfunction isFunction(input) {\n return (\n (typeof Function !== 'undefined' && input instanceof Function) ||\n Object.prototype.toString.call(input) === '[object Function]'\n );\n}\n\nfunction set(config) {\n var prop, i;\n for (i in config) {\n if (hasOwnProp(config, i)) {\n prop = config[i];\n if (isFunction(prop)) {\n this[i] = prop;\n } else {\n this['_' + i] = prop;\n }\n }\n }\n this._config = config;\n // Lenient ordinal parsing accepts just a number in addition to\n // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n this._dayOfMonthOrdinalParseLenient = new RegExp(\n (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +\n '|' +\n /\\d{1,2}/.source\n );\n}\n\nfunction mergeConfigs(parentConfig, childConfig) {\n var res = extend({}, parentConfig),\n prop;\n for (prop in childConfig) {\n if (hasOwnProp(childConfig, prop)) {\n if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {\n res[prop] = {};\n extend(res[prop], parentConfig[prop]);\n extend(res[prop], childConfig[prop]);\n } else if (childConfig[prop] != null) {\n res[prop] = childConfig[prop];\n } else {\n delete res[prop];\n }\n }\n }\n for (prop in parentConfig) {\n if (\n hasOwnProp(parentConfig, prop) &&\n !hasOwnProp(childConfig, prop) &&\n isObject(parentConfig[prop])\n ) {\n // make sure changes to properties don't modify parent config\n res[prop] = extend({}, res[prop]);\n }\n }\n return res;\n}\n\nfunction Locale(config) {\n if (config != null) {\n this.set(config);\n }\n}\n\nvar keys;\n\nif (Object.keys) {\n keys = Object.keys;\n} else {\n keys = function (obj) {\n var i,\n res = [];\n for (i in obj) {\n if (hasOwnProp(obj, i)) {\n res.push(i);\n }\n }\n return res;\n };\n}\n\nvar defaultCalendar = {\n sameDay: '[Today at] LT',\n nextDay: '[Tomorrow at] LT',\n nextWeek: 'dddd [at] LT',\n lastDay: '[Yesterday at] LT',\n lastWeek: '[Last] dddd [at] LT',\n sameElse: 'L',\n};\n\nfunction calendar(key, mom, now) {\n var output = this._calendar[key] || this._calendar['sameElse'];\n return isFunction(output) ? output.call(mom, now) : output;\n}\n\nfunction zeroFill(number, targetLength, forceSign) {\n var absNumber = '' + Math.abs(number),\n zerosToFill = targetLength - absNumber.length,\n sign = number >= 0;\n return (\n (sign ? (forceSign ? '+' : '') : '-') +\n Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +\n absNumber\n );\n}\n\nvar formattingTokens =\n /(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,\n localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,\n formatFunctions = {},\n formatTokenFunctions = {};\n\n// token: 'M'\n// padded: ['MM', 2]\n// ordinal: 'Mo'\n// callback: function () { this.month() + 1 }\nfunction addFormatToken(token, padded, ordinal, callback) {\n var func = callback;\n if (typeof callback === 'string') {\n func = function () {\n return this[callback]();\n };\n }\n if (token) {\n formatTokenFunctions[token] = func;\n }\n if (padded) {\n formatTokenFunctions[padded[0]] = function () {\n return zeroFill(func.apply(this, arguments), padded[1], padded[2]);\n };\n }\n if (ordinal) {\n formatTokenFunctions[ordinal] = function () {\n return this.localeData().ordinal(\n func.apply(this, arguments),\n token\n );\n };\n }\n}\n\nfunction removeFormattingTokens(input) {\n if (input.match(/\\[[\\s\\S]/)) {\n return input.replace(/^\\[|\\]$/g, '');\n }\n return input.replace(/\\\\/g, '');\n}\n\nfunction makeFormatFunction(format) {\n var array = format.match(formattingTokens),\n i,\n length;\n\n for (i = 0, length = array.length; i < length; i++) {\n if (formatTokenFunctions[array[i]]) {\n array[i] = formatTokenFunctions[array[i]];\n } else {\n array[i] = removeFormattingTokens(array[i]);\n }\n }\n\n return function (mom) {\n var output = '',\n i;\n for (i = 0; i < length; i++) {\n output += isFunction(array[i])\n ? array[i].call(mom, format)\n : array[i];\n }\n return output;\n };\n}\n\n// format date using native date object\nfunction formatMoment(m, format) {\n if (!m.isValid()) {\n return m.localeData().invalidDate();\n }\n\n format = expandFormat(format, m.localeData());\n formatFunctions[format] =\n formatFunctions[format] || makeFormatFunction(format);\n\n return formatFunctions[format](m);\n}\n\nfunction expandFormat(format, locale) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return locale.longDateFormat(input) || input;\n }\n\n localFormattingTokens.lastIndex = 0;\n while (i >= 0 && localFormattingTokens.test(format)) {\n format = format.replace(\n localFormattingTokens,\n replaceLongDateFormatTokens\n );\n localFormattingTokens.lastIndex = 0;\n i -= 1;\n }\n\n return format;\n}\n\nvar defaultLongDateFormat = {\n LTS: 'h:mm:ss A',\n LT: 'h:mm A',\n L: 'MM/DD/YYYY',\n LL: 'MMMM D, YYYY',\n LLL: 'MMMM D, YYYY h:mm A',\n LLLL: 'dddd, MMMM D, YYYY h:mm A',\n};\n\nfunction longDateFormat(key) {\n var format = this._longDateFormat[key],\n formatUpper = this._longDateFormat[key.toUpperCase()];\n\n if (format || !formatUpper) {\n return format;\n }\n\n this._longDateFormat[key] = formatUpper\n .match(formattingTokens)\n .map(function (tok) {\n if (\n tok === 'MMMM' ||\n tok === 'MM' ||\n tok === 'DD' ||\n tok === 'dddd'\n ) {\n return tok.slice(1);\n }\n return tok;\n })\n .join('');\n\n return this._longDateFormat[key];\n}\n\nvar defaultInvalidDate = 'Invalid date';\n\nfunction invalidDate() {\n return this._invalidDate;\n}\n\nvar defaultOrdinal = '%d',\n defaultDayOfMonthOrdinalParse = /\\d{1,2}/;\n\nfunction ordinal(number) {\n return this._ordinal.replace('%d', number);\n}\n\nvar defaultRelativeTime = {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n ss: '%d seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n w: 'a week',\n ww: '%d weeks',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years',\n};\n\nfunction relativeTime(number, withoutSuffix, string, isFuture) {\n var output = this._relativeTime[string];\n return isFunction(output)\n ? output(number, withoutSuffix, string, isFuture)\n : output.replace(/%d/i, number);\n}\n\nfunction pastFuture(diff, output) {\n var format = this._relativeTime[diff > 0 ? 'future' : 'past'];\n return isFunction(format) ? format(output) : format.replace(/%s/i, output);\n}\n\nvar aliases = {};\n\nfunction addUnitAlias(unit, shorthand) {\n var lowerCase = unit.toLowerCase();\n aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;\n}\n\nfunction normalizeUnits(units) {\n return typeof units === 'string'\n ? aliases[units] || aliases[units.toLowerCase()]\n : undefined;\n}\n\nfunction normalizeObjectUnits(inputObject) {\n var normalizedInput = {},\n normalizedProp,\n prop;\n\n for (prop in inputObject) {\n if (hasOwnProp(inputObject, prop)) {\n normalizedProp = normalizeUnits(prop);\n if (normalizedProp) {\n normalizedInput[normalizedProp] = inputObject[prop];\n }\n }\n }\n\n return normalizedInput;\n}\n\nvar priorities = {};\n\nfunction addUnitPriority(unit, priority) {\n priorities[unit] = priority;\n}\n\nfunction getPrioritizedUnits(unitsObj) {\n var units = [],\n u;\n for (u in unitsObj) {\n if (hasOwnProp(unitsObj, u)) {\n units.push({ unit: u, priority: priorities[u] });\n }\n }\n units.sort(function (a, b) {\n return a.priority - b.priority;\n });\n return units;\n}\n\nfunction isLeapYear(year) {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n}\n\nfunction absFloor(number) {\n if (number < 0) {\n // -0 -> 0\n return Math.ceil(number) || 0;\n } else {\n return Math.floor(number);\n }\n}\n\nfunction toInt(argumentForCoercion) {\n var coercedNumber = +argumentForCoercion,\n value = 0;\n\n if (coercedNumber !== 0 && isFinite(coercedNumber)) {\n value = absFloor(coercedNumber);\n }\n\n return value;\n}\n\nfunction makeGetSet(unit, keepTime) {\n return function (value) {\n if (value != null) {\n set$1(this, unit, value);\n hooks.updateOffset(this, keepTime);\n return this;\n } else {\n return get(this, unit);\n }\n };\n}\n\nfunction get(mom, unit) {\n return mom.isValid()\n ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()\n : NaN;\n}\n\nfunction set$1(mom, unit, value) {\n if (mom.isValid() && !isNaN(value)) {\n if (\n unit === 'FullYear' &&\n isLeapYear(mom.year()) &&\n mom.month() === 1 &&\n mom.date() === 29\n ) {\n value = toInt(value);\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](\n value,\n mom.month(),\n daysInMonth(value, mom.month())\n );\n } else {\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);\n }\n }\n}\n\n// MOMENTS\n\nfunction stringGet(units) {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units]();\n }\n return this;\n}\n\nfunction stringSet(units, value) {\n if (typeof units === 'object') {\n units = normalizeObjectUnits(units);\n var prioritized = getPrioritizedUnits(units),\n i,\n prioritizedLen = prioritized.length;\n for (i = 0; i < prioritizedLen; i++) {\n this[prioritized[i].unit](units[prioritized[i].unit]);\n }\n } else {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units](value);\n }\n }\n return this;\n}\n\nvar match1 = /\\d/, // 0 - 9\n match2 = /\\d\\d/, // 00 - 99\n match3 = /\\d{3}/, // 000 - 999\n match4 = /\\d{4}/, // 0000 - 9999\n match6 = /[+-]?\\d{6}/, // -999999 - 999999\n match1to2 = /\\d\\d?/, // 0 - 99\n match3to4 = /\\d\\d\\d\\d?/, // 999 - 9999\n match5to6 = /\\d\\d\\d\\d\\d\\d?/, // 99999 - 999999\n match1to3 = /\\d{1,3}/, // 0 - 999\n match1to4 = /\\d{1,4}/, // 0 - 9999\n match1to6 = /[+-]?\\d{1,6}/, // -999999 - 999999\n matchUnsigned = /\\d+/, // 0 - inf\n matchSigned = /[+-]?\\d+/, // -inf - inf\n matchOffset = /Z|[+-]\\d\\d:?\\d\\d/gi, // +00:00 -00:00 +0000 -0000 or Z\n matchShortOffset = /Z|[+-]\\d\\d(?::?\\d\\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z\n matchTimestamp = /[+-]?\\d+(\\.\\d{1,3})?/, // 123456789 123456789.123\n // any word (or two) characters or numbers including two/three word month in arabic.\n // includes scottish gaelic two word and hyphenated months\n matchWord =\n /[0-9]{0,256}['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFF07\\uFF10-\\uFFEF]{1,256}|[\\u0600-\\u06FF\\/]{1,256}(\\s*?[\\u0600-\\u06FF]{1,256}){1,2}/i,\n regexes;\n\nregexes = {};\n\nfunction addRegexToken(token, regex, strictRegex) {\n regexes[token] = isFunction(regex)\n ? regex\n : function (isStrict, localeData) {\n return isStrict && strictRegex ? strictRegex : regex;\n };\n}\n\nfunction getParseRegexForToken(token, config) {\n if (!hasOwnProp(regexes, token)) {\n return new RegExp(unescapeFormat(token));\n }\n\n return regexes[token](config._strict, config._locale);\n}\n\n// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript\nfunction unescapeFormat(s) {\n return regexEscape(\n s\n .replace('\\\\', '')\n .replace(\n /\\\\(\\[)|\\\\(\\])|\\[([^\\]\\[]*)\\]|\\\\(.)/g,\n function (matched, p1, p2, p3, p4) {\n return p1 || p2 || p3 || p4;\n }\n )\n );\n}\n\nfunction regexEscape(s) {\n return s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nvar tokens = {};\n\nfunction addParseToken(token, callback) {\n var i,\n func = callback,\n tokenLen;\n if (typeof token === 'string') {\n token = [token];\n }\n if (isNumber(callback)) {\n func = function (input, array) {\n array[callback] = toInt(input);\n };\n }\n tokenLen = token.length;\n for (i = 0; i < tokenLen; i++) {\n tokens[token[i]] = func;\n }\n}\n\nfunction addWeekParseToken(token, callback) {\n addParseToken(token, function (input, array, config, token) {\n config._w = config._w || {};\n callback(input, config._w, config, token);\n });\n}\n\nfunction addTimeToArrayFromToken(token, input, config) {\n if (input != null && hasOwnProp(tokens, token)) {\n tokens[token](input, config._a, config, token);\n }\n}\n\nvar YEAR = 0,\n MONTH = 1,\n DATE = 2,\n HOUR = 3,\n MINUTE = 4,\n SECOND = 5,\n MILLISECOND = 6,\n WEEK = 7,\n WEEKDAY = 8;\n\nfunction mod(n, x) {\n return ((n % x) + x) % x;\n}\n\nvar indexOf;\n\nif (Array.prototype.indexOf) {\n indexOf = Array.prototype.indexOf;\n} else {\n indexOf = function (o) {\n // I know\n var i;\n for (i = 0; i < this.length; ++i) {\n if (this[i] === o) {\n return i;\n }\n }\n return -1;\n };\n}\n\nfunction daysInMonth(year, month) {\n if (isNaN(year) || isNaN(month)) {\n return NaN;\n }\n var modMonth = mod(month, 12);\n year += (month - modMonth) / 12;\n return modMonth === 1\n ? isLeapYear(year)\n ? 29\n : 28\n : 31 - ((modMonth % 7) % 2);\n}\n\n// FORMATTING\n\naddFormatToken('M', ['MM', 2], 'Mo', function () {\n return this.month() + 1;\n});\n\naddFormatToken('MMM', 0, 0, function (format) {\n return this.localeData().monthsShort(this, format);\n});\n\naddFormatToken('MMMM', 0, 0, function (format) {\n return this.localeData().months(this, format);\n});\n\n// ALIASES\n\naddUnitAlias('month', 'M');\n\n// PRIORITY\n\naddUnitPriority('month', 8);\n\n// PARSING\n\naddRegexToken('M', match1to2);\naddRegexToken('MM', match1to2, match2);\naddRegexToken('MMM', function (isStrict, locale) {\n return locale.monthsShortRegex(isStrict);\n});\naddRegexToken('MMMM', function (isStrict, locale) {\n return locale.monthsRegex(isStrict);\n});\n\naddParseToken(['M', 'MM'], function (input, array) {\n array[MONTH] = toInt(input) - 1;\n});\n\naddParseToken(['MMM', 'MMMM'], function (input, array, config, token) {\n var month = config._locale.monthsParse(input, token, config._strict);\n // if we didn't find a month name, mark the date as invalid.\n if (month != null) {\n array[MONTH] = month;\n } else {\n getParsingFlags(config).invalidMonth = input;\n }\n});\n\n// LOCALES\n\nvar defaultLocaleMonths =\n 'January_February_March_April_May_June_July_August_September_October_November_December'.split(\n '_'\n ),\n defaultLocaleMonthsShort =\n 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),\n MONTHS_IN_FORMAT = /D[oD]?(\\[[^\\[\\]]*\\]|\\s)+MMMM?/,\n defaultMonthsShortRegex = matchWord,\n defaultMonthsRegex = matchWord;\n\nfunction localeMonths(m, format) {\n if (!m) {\n return isArray(this._months)\n ? this._months\n : this._months['standalone'];\n }\n return isArray(this._months)\n ? this._months[m.month()]\n : this._months[\n (this._months.isFormat || MONTHS_IN_FORMAT).test(format)\n ? 'format'\n : 'standalone'\n ][m.month()];\n}\n\nfunction localeMonthsShort(m, format) {\n if (!m) {\n return isArray(this._monthsShort)\n ? this._monthsShort\n : this._monthsShort['standalone'];\n }\n return isArray(this._monthsShort)\n ? this._monthsShort[m.month()]\n : this._monthsShort[\n MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'\n ][m.month()];\n}\n\nfunction handleStrictParse(monthName, format, strict) {\n var i,\n ii,\n mom,\n llc = monthName.toLocaleLowerCase();\n if (!this._monthsParse) {\n // this is not used\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n for (i = 0; i < 12; ++i) {\n mom = createUTC([2000, i]);\n this._shortMonthsParse[i] = this.monthsShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n}\n\nfunction localeMonthsParse(monthName, format, strict) {\n var i, mom, regex;\n\n if (this._monthsParseExact) {\n return handleStrictParse.call(this, monthName, format, strict);\n }\n\n if (!this._monthsParse) {\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n }\n\n // TODO: add sorting\n // Sorting makes sure if one month (or abbr) is a prefix of another\n // see sorting in computeMonthsParse\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n if (strict && !this._longMonthsParse[i]) {\n this._longMonthsParse[i] = new RegExp(\n '^' + this.months(mom, '').replace('.', '') + '$',\n 'i'\n );\n this._shortMonthsParse[i] = new RegExp(\n '^' + this.monthsShort(mom, '').replace('.', '') + '$',\n 'i'\n );\n }\n if (!strict && !this._monthsParse[i]) {\n regex =\n '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');\n this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'MMMM' &&\n this._longMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'MMM' &&\n this._shortMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (!strict && this._monthsParse[i].test(monthName)) {\n return i;\n }\n }\n}\n\n// MOMENTS\n\nfunction setMonth(mom, value) {\n var dayOfMonth;\n\n if (!mom.isValid()) {\n // No op\n return mom;\n }\n\n if (typeof value === 'string') {\n if (/^\\d+$/.test(value)) {\n value = toInt(value);\n } else {\n value = mom.localeData().monthsParse(value);\n // TODO: Another silent failure?\n if (!isNumber(value)) {\n return mom;\n }\n }\n }\n\n dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));\n mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);\n return mom;\n}\n\nfunction getSetMonth(value) {\n if (value != null) {\n setMonth(this, value);\n hooks.updateOffset(this, true);\n return this;\n } else {\n return get(this, 'Month');\n }\n}\n\nfunction getDaysInMonth() {\n return daysInMonth(this.year(), this.month());\n}\n\nfunction monthsShortRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsShortStrictRegex;\n } else {\n return this._monthsShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsShortRegex')) {\n this._monthsShortRegex = defaultMonthsShortRegex;\n }\n return this._monthsShortStrictRegex && isStrict\n ? this._monthsShortStrictRegex\n : this._monthsShortRegex;\n }\n}\n\nfunction monthsRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsStrictRegex;\n } else {\n return this._monthsRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsRegex')) {\n this._monthsRegex = defaultMonthsRegex;\n }\n return this._monthsStrictRegex && isStrict\n ? this._monthsStrictRegex\n : this._monthsRegex;\n }\n}\n\nfunction computeMonthsParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom;\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n shortPieces.push(this.monthsShort(mom, ''));\n longPieces.push(this.months(mom, ''));\n mixedPieces.push(this.months(mom, ''));\n mixedPieces.push(this.monthsShort(mom, ''));\n }\n // Sorting makes sure if one month (or abbr) is a prefix of another it\n // will match the longer piece.\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n for (i = 0; i < 12; i++) {\n shortPieces[i] = regexEscape(shortPieces[i]);\n longPieces[i] = regexEscape(longPieces[i]);\n }\n for (i = 0; i < 24; i++) {\n mixedPieces[i] = regexEscape(mixedPieces[i]);\n }\n\n this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._monthsShortRegex = this._monthsRegex;\n this._monthsStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._monthsShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n}\n\n// FORMATTING\n\naddFormatToken('Y', 0, 0, function () {\n var y = this.year();\n return y <= 9999 ? zeroFill(y, 4) : '+' + y;\n});\n\naddFormatToken(0, ['YY', 2], 0, function () {\n return this.year() % 100;\n});\n\naddFormatToken(0, ['YYYY', 4], 0, 'year');\naddFormatToken(0, ['YYYYY', 5], 0, 'year');\naddFormatToken(0, ['YYYYYY', 6, true], 0, 'year');\n\n// ALIASES\n\naddUnitAlias('year', 'y');\n\n// PRIORITIES\n\naddUnitPriority('year', 1);\n\n// PARSING\n\naddRegexToken('Y', matchSigned);\naddRegexToken('YY', match1to2, match2);\naddRegexToken('YYYY', match1to4, match4);\naddRegexToken('YYYYY', match1to6, match6);\naddRegexToken('YYYYYY', match1to6, match6);\n\naddParseToken(['YYYYY', 'YYYYYY'], YEAR);\naddParseToken('YYYY', function (input, array) {\n array[YEAR] =\n input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);\n});\naddParseToken('YY', function (input, array) {\n array[YEAR] = hooks.parseTwoDigitYear(input);\n});\naddParseToken('Y', function (input, array) {\n array[YEAR] = parseInt(input, 10);\n});\n\n// HELPERS\n\nfunction daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n}\n\n// HOOKS\n\nhooks.parseTwoDigitYear = function (input) {\n return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);\n};\n\n// MOMENTS\n\nvar getSetYear = makeGetSet('FullYear', true);\n\nfunction getIsLeapYear() {\n return isLeapYear(this.year());\n}\n\nfunction createDate(y, m, d, h, M, s, ms) {\n // can't just apply() to create a date:\n // https://stackoverflow.com/q/181348\n var date;\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n date = new Date(y + 400, m, d, h, M, s, ms);\n if (isFinite(date.getFullYear())) {\n date.setFullYear(y);\n }\n } else {\n date = new Date(y, m, d, h, M, s, ms);\n }\n\n return date;\n}\n\nfunction createUTCDate(y) {\n var date, args;\n // the Date.UTC function remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n args = Array.prototype.slice.call(arguments);\n // preserve leap years using a full 400 year cycle, then reset\n args[0] = y + 400;\n date = new Date(Date.UTC.apply(null, args));\n if (isFinite(date.getUTCFullYear())) {\n date.setUTCFullYear(y);\n }\n } else {\n date = new Date(Date.UTC.apply(null, arguments));\n }\n\n return date;\n}\n\n// start-of-first-week - start-of-year\nfunction firstWeekOffset(year, dow, doy) {\n var // first-week day -- which january is always in the first week (4 for iso, 1 for other)\n fwd = 7 + dow - doy,\n // first-week day local weekday -- which local weekday is fwd\n fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;\n\n return -fwdlw + fwd - 1;\n}\n\n// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday\nfunction dayOfYearFromWeeks(year, week, weekday, dow, doy) {\n var localWeekday = (7 + weekday - dow) % 7,\n weekOffset = firstWeekOffset(year, dow, doy),\n dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,\n resYear,\n resDayOfYear;\n\n if (dayOfYear <= 0) {\n resYear = year - 1;\n resDayOfYear = daysInYear(resYear) + dayOfYear;\n } else if (dayOfYear > daysInYear(year)) {\n resYear = year + 1;\n resDayOfYear = dayOfYear - daysInYear(year);\n } else {\n resYear = year;\n resDayOfYear = dayOfYear;\n }\n\n return {\n year: resYear,\n dayOfYear: resDayOfYear,\n };\n}\n\nfunction weekOfYear(mom, dow, doy) {\n var weekOffset = firstWeekOffset(mom.year(), dow, doy),\n week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,\n resWeek,\n resYear;\n\n if (week < 1) {\n resYear = mom.year() - 1;\n resWeek = week + weeksInYear(resYear, dow, doy);\n } else if (week > weeksInYear(mom.year(), dow, doy)) {\n resWeek = week - weeksInYear(mom.year(), dow, doy);\n resYear = mom.year() + 1;\n } else {\n resYear = mom.year();\n resWeek = week;\n }\n\n return {\n week: resWeek,\n year: resYear,\n };\n}\n\nfunction weeksInYear(year, dow, doy) {\n var weekOffset = firstWeekOffset(year, dow, doy),\n weekOffsetNext = firstWeekOffset(year + 1, dow, doy);\n return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;\n}\n\n// FORMATTING\n\naddFormatToken('w', ['ww', 2], 'wo', 'week');\naddFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');\n\n// ALIASES\n\naddUnitAlias('week', 'w');\naddUnitAlias('isoWeek', 'W');\n\n// PRIORITIES\n\naddUnitPriority('week', 5);\naddUnitPriority('isoWeek', 5);\n\n// PARSING\n\naddRegexToken('w', match1to2);\naddRegexToken('ww', match1to2, match2);\naddRegexToken('W', match1to2);\naddRegexToken('WW', match1to2, match2);\n\naddWeekParseToken(\n ['w', 'ww', 'W', 'WW'],\n function (input, week, config, token) {\n week[token.substr(0, 1)] = toInt(input);\n }\n);\n\n// HELPERS\n\n// LOCALES\n\nfunction localeWeek(mom) {\n return weekOfYear(mom, this._week.dow, this._week.doy).week;\n}\n\nvar defaultLocaleWeek = {\n dow: 0, // Sunday is the first day of the week.\n doy: 6, // The week that contains Jan 6th is the first week of the year.\n};\n\nfunction localeFirstDayOfWeek() {\n return this._week.dow;\n}\n\nfunction localeFirstDayOfYear() {\n return this._week.doy;\n}\n\n// MOMENTS\n\nfunction getSetWeek(input) {\n var week = this.localeData().week(this);\n return input == null ? week : this.add((input - week) * 7, 'd');\n}\n\nfunction getSetISOWeek(input) {\n var week = weekOfYear(this, 1, 4).week;\n return input == null ? week : this.add((input - week) * 7, 'd');\n}\n\n// FORMATTING\n\naddFormatToken('d', 0, 'do', 'day');\n\naddFormatToken('dd', 0, 0, function (format) {\n return this.localeData().weekdaysMin(this, format);\n});\n\naddFormatToken('ddd', 0, 0, function (format) {\n return this.localeData().weekdaysShort(this, format);\n});\n\naddFormatToken('dddd', 0, 0, function (format) {\n return this.localeData().weekdays(this, format);\n});\n\naddFormatToken('e', 0, 0, 'weekday');\naddFormatToken('E', 0, 0, 'isoWeekday');\n\n// ALIASES\n\naddUnitAlias('day', 'd');\naddUnitAlias('weekday', 'e');\naddUnitAlias('isoWeekday', 'E');\n\n// PRIORITY\naddUnitPriority('day', 11);\naddUnitPriority('weekday', 11);\naddUnitPriority('isoWeekday', 11);\n\n// PARSING\n\naddRegexToken('d', match1to2);\naddRegexToken('e', match1to2);\naddRegexToken('E', match1to2);\naddRegexToken('dd', function (isStrict, locale) {\n return locale.weekdaysMinRegex(isStrict);\n});\naddRegexToken('ddd', function (isStrict, locale) {\n return locale.weekdaysShortRegex(isStrict);\n});\naddRegexToken('dddd', function (isStrict, locale) {\n return locale.weekdaysRegex(isStrict);\n});\n\naddWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {\n var weekday = config._locale.weekdaysParse(input, token, config._strict);\n // if we didn't get a weekday name, mark the date as invalid\n if (weekday != null) {\n week.d = weekday;\n } else {\n getParsingFlags(config).invalidWeekday = input;\n }\n});\n\naddWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {\n week[token] = toInt(input);\n});\n\n// HELPERS\n\nfunction parseWeekday(input, locale) {\n if (typeof input !== 'string') {\n return input;\n }\n\n if (!isNaN(input)) {\n return parseInt(input, 10);\n }\n\n input = locale.weekdaysParse(input);\n if (typeof input === 'number') {\n return input;\n }\n\n return null;\n}\n\nfunction parseIsoWeekday(input, locale) {\n if (typeof input === 'string') {\n return locale.weekdaysParse(input) % 7 || 7;\n }\n return isNaN(input) ? null : input;\n}\n\n// LOCALES\nfunction shiftWeekdays(ws, n) {\n return ws.slice(n, 7).concat(ws.slice(0, n));\n}\n\nvar defaultLocaleWeekdays =\n 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),\n defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),\n defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),\n defaultWeekdaysRegex = matchWord,\n defaultWeekdaysShortRegex = matchWord,\n defaultWeekdaysMinRegex = matchWord;\n\nfunction localeWeekdays(m, format) {\n var weekdays = isArray(this._weekdays)\n ? this._weekdays\n : this._weekdays[\n m && m !== true && this._weekdays.isFormat.test(format)\n ? 'format'\n : 'standalone'\n ];\n return m === true\n ? shiftWeekdays(weekdays, this._week.dow)\n : m\n ? weekdays[m.day()]\n : weekdays;\n}\n\nfunction localeWeekdaysShort(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysShort, this._week.dow)\n : m\n ? this._weekdaysShort[m.day()]\n : this._weekdaysShort;\n}\n\nfunction localeWeekdaysMin(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysMin, this._week.dow)\n : m\n ? this._weekdaysMin[m.day()]\n : this._weekdaysMin;\n}\n\nfunction handleStrictParse$1(weekdayName, format, strict) {\n var i,\n ii,\n mom,\n llc = weekdayName.toLocaleLowerCase();\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._minWeekdaysParse = [];\n\n for (i = 0; i < 7; ++i) {\n mom = createUTC([2000, 1]).day(i);\n this._minWeekdaysParse[i] = this.weekdaysMin(\n mom,\n ''\n ).toLocaleLowerCase();\n this._shortWeekdaysParse[i] = this.weekdaysShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n}\n\nfunction localeWeekdaysParse(weekdayName, format, strict) {\n var i, mom, regex;\n\n if (this._weekdaysParseExact) {\n return handleStrictParse$1.call(this, weekdayName, format, strict);\n }\n\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._minWeekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._fullWeekdaysParse = [];\n }\n\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n\n mom = createUTC([2000, 1]).day(i);\n if (strict && !this._fullWeekdaysParse[i]) {\n this._fullWeekdaysParse[i] = new RegExp(\n '^' + this.weekdays(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._shortWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysShort(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._minWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysMin(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n }\n if (!this._weekdaysParse[i]) {\n regex =\n '^' +\n this.weekdays(mom, '') +\n '|^' +\n this.weekdaysShort(mom, '') +\n '|^' +\n this.weekdaysMin(mom, '');\n this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'dddd' &&\n this._fullWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'ddd' &&\n this._shortWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'dd' &&\n this._minWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {\n return i;\n }\n }\n}\n\n// MOMENTS\n\nfunction getSetDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();\n if (input != null) {\n input = parseWeekday(input, this.localeData());\n return this.add(input - day, 'd');\n } else {\n return day;\n }\n}\n\nfunction getSetLocaleDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;\n return input == null ? weekday : this.add(input - weekday, 'd');\n}\n\nfunction getSetISODayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n\n // behaves the same as moment#day except\n // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)\n // as a setter, sunday should belong to the previous week.\n\n if (input != null) {\n var weekday = parseIsoWeekday(input, this.localeData());\n return this.day(this.day() % 7 ? weekday : weekday - 7);\n } else {\n return this.day() || 7;\n }\n}\n\nfunction weekdaysRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysStrictRegex;\n } else {\n return this._weekdaysRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n this._weekdaysRegex = defaultWeekdaysRegex;\n }\n return this._weekdaysStrictRegex && isStrict\n ? this._weekdaysStrictRegex\n : this._weekdaysRegex;\n }\n}\n\nfunction weekdaysShortRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysShortStrictRegex;\n } else {\n return this._weekdaysShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysShortRegex')) {\n this._weekdaysShortRegex = defaultWeekdaysShortRegex;\n }\n return this._weekdaysShortStrictRegex && isStrict\n ? this._weekdaysShortStrictRegex\n : this._weekdaysShortRegex;\n }\n}\n\nfunction weekdaysMinRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysMinStrictRegex;\n } else {\n return this._weekdaysMinRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysMinRegex')) {\n this._weekdaysMinRegex = defaultWeekdaysMinRegex;\n }\n return this._weekdaysMinStrictRegex && isStrict\n ? this._weekdaysMinStrictRegex\n : this._weekdaysMinRegex;\n }\n}\n\nfunction computeWeekdaysParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var minPieces = [],\n shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom,\n minp,\n shortp,\n longp;\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, 1]).day(i);\n minp = regexEscape(this.weekdaysMin(mom, ''));\n shortp = regexEscape(this.weekdaysShort(mom, ''));\n longp = regexEscape(this.weekdays(mom, ''));\n minPieces.push(minp);\n shortPieces.push(shortp);\n longPieces.push(longp);\n mixedPieces.push(minp);\n mixedPieces.push(shortp);\n mixedPieces.push(longp);\n }\n // Sorting makes sure if one weekday (or abbr) is a prefix of another it\n // will match the longer piece.\n minPieces.sort(cmpLenRev);\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n\n this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._weekdaysShortRegex = this._weekdaysRegex;\n this._weekdaysMinRegex = this._weekdaysRegex;\n\n this._weekdaysStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysMinStrictRegex = new RegExp(\n '^(' + minPieces.join('|') + ')',\n 'i'\n );\n}\n\n// FORMATTING\n\nfunction hFormat() {\n return this.hours() % 12 || 12;\n}\n\nfunction kFormat() {\n return this.hours() || 24;\n}\n\naddFormatToken('H', ['HH', 2], 0, 'hour');\naddFormatToken('h', ['hh', 2], 0, hFormat);\naddFormatToken('k', ['kk', 2], 0, kFormat);\n\naddFormatToken('hmm', 0, 0, function () {\n return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);\n});\n\naddFormatToken('hmmss', 0, 0, function () {\n return (\n '' +\n hFormat.apply(this) +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n});\n\naddFormatToken('Hmm', 0, 0, function () {\n return '' + this.hours() + zeroFill(this.minutes(), 2);\n});\n\naddFormatToken('Hmmss', 0, 0, function () {\n return (\n '' +\n this.hours() +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n});\n\nfunction meridiem(token, lowercase) {\n addFormatToken(token, 0, 0, function () {\n return this.localeData().meridiem(\n this.hours(),\n this.minutes(),\n lowercase\n );\n });\n}\n\nmeridiem('a', true);\nmeridiem('A', false);\n\n// ALIASES\n\naddUnitAlias('hour', 'h');\n\n// PRIORITY\naddUnitPriority('hour', 13);\n\n// PARSING\n\nfunction matchMeridiem(isStrict, locale) {\n return locale._meridiemParse;\n}\n\naddRegexToken('a', matchMeridiem);\naddRegexToken('A', matchMeridiem);\naddRegexToken('H', match1to2);\naddRegexToken('h', match1to2);\naddRegexToken('k', match1to2);\naddRegexToken('HH', match1to2, match2);\naddRegexToken('hh', match1to2, match2);\naddRegexToken('kk', match1to2, match2);\n\naddRegexToken('hmm', match3to4);\naddRegexToken('hmmss', match5to6);\naddRegexToken('Hmm', match3to4);\naddRegexToken('Hmmss', match5to6);\n\naddParseToken(['H', 'HH'], HOUR);\naddParseToken(['k', 'kk'], function (input, array, config) {\n var kInput = toInt(input);\n array[HOUR] = kInput === 24 ? 0 : kInput;\n});\naddParseToken(['a', 'A'], function (input, array, config) {\n config._isPm = config._locale.isPM(input);\n config._meridiem = input;\n});\naddParseToken(['h', 'hh'], function (input, array, config) {\n array[HOUR] = toInt(input);\n getParsingFlags(config).bigHour = true;\n});\naddParseToken('hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n getParsingFlags(config).bigHour = true;\n});\naddParseToken('hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n getParsingFlags(config).bigHour = true;\n});\naddParseToken('Hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n});\naddParseToken('Hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n});\n\n// LOCALES\n\nfunction localeIsPM(input) {\n // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays\n // Using charAt should be more compatible.\n return (input + '').toLowerCase().charAt(0) === 'p';\n}\n\nvar defaultLocaleMeridiemParse = /[ap]\\.?m?\\.?/i,\n // Setting the hour should keep the time, because the user explicitly\n // specified which hour they want. So trying to maintain the same hour (in\n // a new timezone) makes sense. Adding/subtracting hours does not follow\n // this rule.\n getSetHour = makeGetSet('Hours', true);\n\nfunction localeMeridiem(hours, minutes, isLower) {\n if (hours > 11) {\n return isLower ? 'pm' : 'PM';\n } else {\n return isLower ? 'am' : 'AM';\n }\n}\n\nvar baseConfig = {\n calendar: defaultCalendar,\n longDateFormat: defaultLongDateFormat,\n invalidDate: defaultInvalidDate,\n ordinal: defaultOrdinal,\n dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,\n relativeTime: defaultRelativeTime,\n\n months: defaultLocaleMonths,\n monthsShort: defaultLocaleMonthsShort,\n\n week: defaultLocaleWeek,\n\n weekdays: defaultLocaleWeekdays,\n weekdaysMin: defaultLocaleWeekdaysMin,\n weekdaysShort: defaultLocaleWeekdaysShort,\n\n meridiemParse: defaultLocaleMeridiemParse,\n};\n\n// internal storage for locale config files\nvar locales = {},\n localeFamilies = {},\n globalLocale;\n\nfunction commonPrefix(arr1, arr2) {\n var i,\n minl = Math.min(arr1.length, arr2.length);\n for (i = 0; i < minl; i += 1) {\n if (arr1[i] !== arr2[i]) {\n return i;\n }\n }\n return minl;\n}\n\nfunction normalizeLocale(key) {\n return key ? key.toLowerCase().replace('_', '-') : key;\n}\n\n// pick the locale from the array\n// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each\n// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root\nfunction chooseLocale(names) {\n var i = 0,\n j,\n next,\n locale,\n split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (\n next &&\n next.length >= j &&\n commonPrefix(split, next) >= j - 1\n ) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return globalLocale;\n}\n\nfunction isLocaleNameSane(name) {\n // Prevent names that look like filesystem paths, i.e contain '/' or '\\'\n return name.match('^[^/\\\\\\\\]*$') != null;\n}\n\nfunction loadLocale(name) {\n var oldLocale = null,\n aliasedRequire;\n // TODO: Find a better way to register and load all the locales in Node\n if (\n locales[name] === undefined &&\n typeof module !== 'undefined' &&\n module &&\n module.exports &&\n isLocaleNameSane(name)\n ) {\n try {\n oldLocale = globalLocale._abbr;\n aliasedRequire = require;\n aliasedRequire('./locale/' + name);\n getSetGlobalLocale(oldLocale);\n } catch (e) {\n // mark as not found to avoid repeating expensive file require call causing high CPU\n // when trying to find en-US, en_US, en-us for every format call\n locales[name] = null; // null means not found\n }\n }\n return locales[name];\n}\n\n// This function will load locale and then set the global locale. If\n// no arguments are passed in, it will simply return the current global\n// locale key.\nfunction getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn(\n 'Locale ' + key + ' not found. Did you forget to load it?'\n );\n }\n }\n }\n\n return globalLocale._abbr;\n}\n\nfunction defineLocale(name, config) {\n if (config !== null) {\n var locale,\n parentConfig = baseConfig;\n config.abbr = name;\n if (locales[name] != null) {\n deprecateSimple(\n 'defineLocaleOverride',\n 'use moment.updateLocale(localeName, config) to change ' +\n 'an existing locale. moment.defineLocale(localeName, ' +\n 'config) should only be used for creating a new locale ' +\n 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'\n );\n parentConfig = locales[name]._config;\n } else if (config.parentLocale != null) {\n if (locales[config.parentLocale] != null) {\n parentConfig = locales[config.parentLocale]._config;\n } else {\n locale = loadLocale(config.parentLocale);\n if (locale != null) {\n parentConfig = locale._config;\n } else {\n if (!localeFamilies[config.parentLocale]) {\n localeFamilies[config.parentLocale] = [];\n }\n localeFamilies[config.parentLocale].push({\n name: name,\n config: config,\n });\n return null;\n }\n }\n }\n locales[name] = new Locale(mergeConfigs(parentConfig, config));\n\n if (localeFamilies[name]) {\n localeFamilies[name].forEach(function (x) {\n defineLocale(x.name, x.config);\n });\n }\n\n // backwards compat for now: also set the locale\n // make sure we set the locale AFTER all child locales have been\n // created, so we won't end up with the child locale set.\n getSetGlobalLocale(name);\n\n return locales[name];\n } else {\n // useful for testing\n delete locales[name];\n return null;\n }\n}\n\nfunction updateLocale(name, config) {\n if (config != null) {\n var locale,\n tmpLocale,\n parentConfig = baseConfig;\n\n if (locales[name] != null && locales[name].parentLocale != null) {\n // Update existing child locale in-place to avoid memory-leaks\n locales[name].set(mergeConfigs(locales[name]._config, config));\n } else {\n // MERGE\n tmpLocale = loadLocale(name);\n if (tmpLocale != null) {\n parentConfig = tmpLocale._config;\n }\n config = mergeConfigs(parentConfig, config);\n if (tmpLocale == null) {\n // updateLocale is called for creating a new locale\n // Set abbr so it will have a name (getters return\n // undefined otherwise).\n config.abbr = name;\n }\n locale = new Locale(config);\n locale.parentLocale = locales[name];\n locales[name] = locale;\n }\n\n // backwards compat for now: also set the locale\n getSetGlobalLocale(name);\n } else {\n // pass null for config to unupdate, useful for tests\n if (locales[name] != null) {\n if (locales[name].parentLocale != null) {\n locales[name] = locales[name].parentLocale;\n if (name === getSetGlobalLocale()) {\n getSetGlobalLocale(name);\n }\n } else if (locales[name] != null) {\n delete locales[name];\n }\n }\n }\n return locales[name];\n}\n\n// returns locale data\nfunction getLocale(key) {\n var locale;\n\n if (key && key._locale && key._locale._abbr) {\n key = key._locale._abbr;\n }\n\n if (!key) {\n return globalLocale;\n }\n\n if (!isArray(key)) {\n //short-circuit everything else\n locale = loadLocale(key);\n if (locale) {\n return locale;\n }\n key = [key];\n }\n\n return chooseLocale(key);\n}\n\nfunction listLocales() {\n return keys(locales);\n}\n\nfunction checkOverflow(m) {\n var overflow,\n a = m._a;\n\n if (a && getParsingFlags(m).overflow === -2) {\n overflow =\n a[MONTH] < 0 || a[MONTH] > 11\n ? MONTH\n : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])\n ? DATE\n : a[HOUR] < 0 ||\n a[HOUR] > 24 ||\n (a[HOUR] === 24 &&\n (a[MINUTE] !== 0 ||\n a[SECOND] !== 0 ||\n a[MILLISECOND] !== 0))\n ? HOUR\n : a[MINUTE] < 0 || a[MINUTE] > 59\n ? MINUTE\n : a[SECOND] < 0 || a[SECOND] > 59\n ? SECOND\n : a[MILLISECOND] < 0 || a[MILLISECOND] > 999\n ? MILLISECOND\n : -1;\n\n if (\n getParsingFlags(m)._overflowDayOfYear &&\n (overflow < YEAR || overflow > DATE)\n ) {\n overflow = DATE;\n }\n if (getParsingFlags(m)._overflowWeeks && overflow === -1) {\n overflow = WEEK;\n }\n if (getParsingFlags(m)._overflowWeekday && overflow === -1) {\n overflow = WEEKDAY;\n }\n\n getParsingFlags(m).overflow = overflow;\n }\n\n return m;\n}\n\n// iso 8601 regex\n// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)\nvar extendedIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n basicIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/,\n isoDates = [\n ['YYYYYY-MM-DD', /[+-]\\d{6}-\\d\\d-\\d\\d/],\n ['YYYY-MM-DD', /\\d{4}-\\d\\d-\\d\\d/],\n ['GGGG-[W]WW-E', /\\d{4}-W\\d\\d-\\d/],\n ['GGGG-[W]WW', /\\d{4}-W\\d\\d/, false],\n ['YYYY-DDD', /\\d{4}-\\d{3}/],\n ['YYYY-MM', /\\d{4}-\\d\\d/, false],\n ['YYYYYYMMDD', /[+-]\\d{10}/],\n ['YYYYMMDD', /\\d{8}/],\n ['GGGG[W]WWE', /\\d{4}W\\d{3}/],\n ['GGGG[W]WW', /\\d{4}W\\d{2}/, false],\n ['YYYYDDD', /\\d{7}/],\n ['YYYYMM', /\\d{6}/, false],\n ['YYYY', /\\d{4}/, false],\n ],\n // iso time formats and regexes\n isoTimes = [\n ['HH:mm:ss.SSSS', /\\d\\d:\\d\\d:\\d\\d\\.\\d+/],\n ['HH:mm:ss,SSSS', /\\d\\d:\\d\\d:\\d\\d,\\d+/],\n ['HH:mm:ss', /\\d\\d:\\d\\d:\\d\\d/],\n ['HH:mm', /\\d\\d:\\d\\d/],\n ['HHmmss.SSSS', /\\d\\d\\d\\d\\d\\d\\.\\d+/],\n ['HHmmss,SSSS', /\\d\\d\\d\\d\\d\\d,\\d+/],\n ['HHmmss', /\\d\\d\\d\\d\\d\\d/],\n ['HHmm', /\\d\\d\\d\\d/],\n ['HH', /\\d\\d/],\n ],\n aspNetJsonRegex = /^\\/?Date\\((-?\\d+)/i,\n // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3\n rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,\n obsOffsets = {\n UT: 0,\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n };\n\n// date from iso format\nfunction configFromISO(config) {\n var i,\n l,\n string = config._i,\n match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),\n allowTime,\n dateFormat,\n timeFormat,\n tzFormat,\n isoDatesLen = isoDates.length,\n isoTimesLen = isoTimes.length;\n\n if (match) {\n getParsingFlags(config).iso = true;\n for (i = 0, l = isoDatesLen; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return;\n }\n if (match[3]) {\n for (i = 0, l = isoTimesLen; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n } else {\n config._isValid = false;\n return;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n configFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n}\n\nfunction extractFromRFC2822Strings(\n yearStr,\n monthStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr\n) {\n var result = [\n untruncateYear(yearStr),\n defaultLocaleMonthsShort.indexOf(monthStr),\n parseInt(dayStr, 10),\n parseInt(hourStr, 10),\n parseInt(minuteStr, 10),\n ];\n\n if (secondStr) {\n result.push(parseInt(secondStr, 10));\n }\n\n return result;\n}\n\nfunction untruncateYear(yearStr) {\n var year = parseInt(yearStr, 10);\n if (year <= 49) {\n return 2000 + year;\n } else if (year <= 999) {\n return 1900 + year;\n }\n return year;\n}\n\nfunction preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^()]*\\)|[\\n\\t]/g, ' ')\n .replace(/(\\s\\s+)/g, ' ')\n .replace(/^\\s\\s*/, '')\n .replace(/\\s\\s*$/, '');\n}\n\nfunction checkWeekday(weekdayStr, parsedInput, config) {\n if (weekdayStr) {\n // TODO: Replace the vanilla JS Date object with an independent day-of-week check.\n var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),\n weekdayActual = new Date(\n parsedInput[0],\n parsedInput[1],\n parsedInput[2]\n ).getDay();\n if (weekdayProvided !== weekdayActual) {\n getParsingFlags(config).weekdayMismatch = true;\n config._isValid = false;\n return false;\n }\n }\n return true;\n}\n\nfunction calculateOffset(obsOffset, militaryOffset, numOffset) {\n if (obsOffset) {\n return obsOffsets[obsOffset];\n } else if (militaryOffset) {\n // the only allowed military tz is Z\n return 0;\n } else {\n var hm = parseInt(numOffset, 10),\n m = hm % 100,\n h = (hm - m) / 100;\n return h * 60 + m;\n }\n}\n\n// date and time from ref 2822 format\nfunction configFromRFC2822(config) {\n var match = rfc2822.exec(preprocessRFC2822(config._i)),\n parsedArray;\n if (match) {\n parsedArray = extractFromRFC2822Strings(\n match[4],\n match[3],\n match[2],\n match[5],\n match[6],\n match[7]\n );\n if (!checkWeekday(match[1], parsedArray, config)) {\n return;\n }\n\n config._a = parsedArray;\n config._tzm = calculateOffset(match[8], match[9], match[10]);\n\n config._d = createUTCDate.apply(null, config._a);\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n\n getParsingFlags(config).rfc2822 = true;\n } else {\n config._isValid = false;\n }\n}\n\n// date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict\nfunction configFromString(config) {\n var matched = aspNetJsonRegex.exec(config._i);\n if (matched !== null) {\n config._d = new Date(+matched[1]);\n return;\n }\n\n configFromISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n configFromRFC2822(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n if (config._strict) {\n config._isValid = false;\n } else {\n // Final attempt, use Input Fallback\n hooks.createFromInputFallback(config);\n }\n}\n\nhooks.createFromInputFallback = deprecate(\n 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +\n 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +\n 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',\n function (config) {\n config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));\n }\n);\n\n// Pick the first defined of two or three arguments.\nfunction defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n}\n\nfunction currentDateArray(config) {\n // hooks is actually the exported moment object\n var nowValue = new Date(hooks.now());\n if (config._useUTC) {\n return [\n nowValue.getUTCFullYear(),\n nowValue.getUTCMonth(),\n nowValue.getUTCDate(),\n ];\n }\n return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];\n}\n\n// convert an array to a date.\n// the array should mirror the parameters below\n// note: all values past the year are optional and will default to the lowest possible value.\n// [year, month, day , hour, minute, second, millisecond]\nfunction configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n expectedWeekday,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (\n config._dayOfYear > daysInYear(yearToUse) ||\n config._dayOfYear === 0\n ) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] =\n config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (\n config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0\n ) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(\n null,\n input\n );\n expectedWeekday = config._useUTC\n ? config._d.getUTCDay()\n : config._d.getDay();\n\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (\n config._w &&\n typeof config._w.d !== 'undefined' &&\n config._w.d !== expectedWeekday\n ) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n}\n\nfunction dayOfYearFromWeekInfo(config) {\n var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;\n\n w = config._w;\n if (w.GG != null || w.W != null || w.E != null) {\n dow = 1;\n doy = 4;\n\n // TODO: We need to take the current isoWeekYear, but that depends on\n // how we interpret now (local, utc, fixed offset). So create\n // a now version of current config (take local/utc/offset flags, and\n // create now).\n weekYear = defaults(\n w.GG,\n config._a[YEAR],\n weekOfYear(createLocal(), 1, 4).year\n );\n week = defaults(w.W, 1);\n weekday = defaults(w.E, 1);\n if (weekday < 1 || weekday > 7) {\n weekdayOverflow = true;\n }\n } else {\n dow = config._locale._week.dow;\n doy = config._locale._week.doy;\n\n curWeek = weekOfYear(createLocal(), dow, doy);\n\n weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);\n\n // Default to current week.\n week = defaults(w.w, curWeek.week);\n\n if (w.d != null) {\n // weekday -- low day numbers are considered next week\n weekday = w.d;\n if (weekday < 0 || weekday > 6) {\n weekdayOverflow = true;\n }\n } else if (w.e != null) {\n // local weekday -- counting starts from beginning of week\n weekday = w.e + dow;\n if (w.e < 0 || w.e > 6) {\n weekdayOverflow = true;\n }\n } else {\n // default to beginning of week\n weekday = dow;\n }\n }\n if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {\n getParsingFlags(config)._overflowWeeks = true;\n } else if (weekdayOverflow != null) {\n getParsingFlags(config)._overflowWeekday = true;\n } else {\n temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);\n config._a[YEAR] = temp.year;\n config._dayOfYear = temp.dayOfYear;\n }\n}\n\n// constant that refers to the ISO standard\nhooks.ISO_8601 = function () {};\n\n// constant that refers to the RFC 2822 form\nhooks.RFC_2822 = function () {};\n\n// date from string and format string\nfunction configFromStringAndFormat(config) {\n // TODO: Move this to another part of the creation flow to prevent circular deps\n if (config._f === hooks.ISO_8601) {\n configFromISO(config);\n return;\n }\n if (config._f === hooks.RFC_2822) {\n configFromRFC2822(config);\n return;\n }\n config._a = [];\n getParsingFlags(config).empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i,\n parsedInput,\n tokens,\n token,\n skipped,\n stringLength = string.length,\n totalParsedInputLength = 0,\n era,\n tokenLen;\n\n tokens =\n expandFormat(config._f, config._locale).match(formattingTokens) || [];\n tokenLen = tokens.length;\n for (i = 0; i < tokenLen; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) ||\n [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n getParsingFlags(config).unusedInput.push(skipped);\n }\n string = string.slice(\n string.indexOf(parsedInput) + parsedInput.length\n );\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n getParsingFlags(config).empty = false;\n } else {\n getParsingFlags(config).unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n } else if (config._strict && !parsedInput) {\n getParsingFlags(config).unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n getParsingFlags(config).charsLeftOver =\n stringLength - totalParsedInputLength;\n if (string.length > 0) {\n getParsingFlags(config).unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (\n config._a[HOUR] <= 12 &&\n getParsingFlags(config).bigHour === true &&\n config._a[HOUR] > 0\n ) {\n getParsingFlags(config).bigHour = undefined;\n }\n\n getParsingFlags(config).parsedDateParts = config._a.slice(0);\n getParsingFlags(config).meridiem = config._meridiem;\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(\n config._locale,\n config._a[HOUR],\n config._meridiem\n );\n\n // handle era\n era = getParsingFlags(config).era;\n if (era !== null) {\n config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);\n }\n\n configFromArray(config);\n checkOverflow(config);\n}\n\nfunction meridiemFixWrap(locale, hour, meridiem) {\n var isPm;\n\n if (meridiem == null) {\n // nothing to do\n return hour;\n }\n if (locale.meridiemHour != null) {\n return locale.meridiemHour(hour, meridiem);\n } else if (locale.isPM != null) {\n // Fallback\n isPm = locale.isPM(meridiem);\n if (isPm && hour < 12) {\n hour += 12;\n }\n if (!isPm && hour === 12) {\n hour = 0;\n }\n return hour;\n } else {\n // this is not supposed to happen\n return hour;\n }\n}\n\n// date from string and array of format strings\nfunction configFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n scoreToBeat,\n i,\n currentScore,\n validFormatFound,\n bestFormatIsValid = false,\n configfLen = config._f.length;\n\n if (configfLen === 0) {\n getParsingFlags(config).invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < configfLen; i++) {\n currentScore = 0;\n validFormatFound = false;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._f = config._f[i];\n configFromStringAndFormat(tempConfig);\n\n if (isValid(tempConfig)) {\n validFormatFound = true;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += getParsingFlags(tempConfig).charsLeftOver;\n\n //or tokens\n currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;\n\n getParsingFlags(tempConfig).score = currentScore;\n\n if (!bestFormatIsValid) {\n if (\n scoreToBeat == null ||\n currentScore < scoreToBeat ||\n validFormatFound\n ) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n if (validFormatFound) {\n bestFormatIsValid = true;\n }\n }\n } else {\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n }\n\n extend(config, bestMoment || tempConfig);\n}\n\nfunction configFromObject(config) {\n if (config._d) {\n return;\n }\n\n var i = normalizeObjectUnits(config._i),\n dayOrDate = i.day === undefined ? i.date : i.day;\n config._a = map(\n [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],\n function (obj) {\n return obj && parseInt(obj, 10);\n }\n );\n\n configFromArray(config);\n}\n\nfunction createFromConfig(config) {\n var res = new Moment(checkOverflow(prepareConfig(config)));\n if (res._nextDay) {\n // Adding is smart enough around DST\n res.add(1, 'd');\n res._nextDay = undefined;\n }\n\n return res;\n}\n\nfunction prepareConfig(config) {\n var input = config._i,\n format = config._f;\n\n config._locale = config._locale || getLocale(config._l);\n\n if (input === null || (format === undefined && input === '')) {\n return createInvalid({ nullInput: true });\n }\n\n if (typeof input === 'string') {\n config._i = input = config._locale.preparse(input);\n }\n\n if (isMoment(input)) {\n return new Moment(checkOverflow(input));\n } else if (isDate(input)) {\n config._d = input;\n } else if (isArray(format)) {\n configFromStringAndArray(config);\n } else if (format) {\n configFromStringAndFormat(config);\n } else {\n configFromInput(config);\n }\n\n if (!isValid(config)) {\n config._d = null;\n }\n\n return config;\n}\n\nfunction configFromInput(config) {\n var input = config._i;\n if (isUndefined(input)) {\n config._d = new Date(hooks.now());\n } else if (isDate(input)) {\n config._d = new Date(input.valueOf());\n } else if (typeof input === 'string') {\n configFromString(config);\n } else if (isArray(input)) {\n config._a = map(input.slice(0), function (obj) {\n return parseInt(obj, 10);\n });\n configFromArray(config);\n } else if (isObject(input)) {\n configFromObject(config);\n } else if (isNumber(input)) {\n // from milliseconds\n config._d = new Date(input);\n } else {\n hooks.createFromInputFallback(config);\n }\n}\n\nfunction createLocalOrUTC(input, format, locale, strict, isUTC) {\n var c = {};\n\n if (format === true || format === false) {\n strict = format;\n format = undefined;\n }\n\n if (locale === true || locale === false) {\n strict = locale;\n locale = undefined;\n }\n\n if (\n (isObject(input) && isObjectEmpty(input)) ||\n (isArray(input) && input.length === 0)\n ) {\n input = undefined;\n }\n // object construction must be done this way.\n // https://github.com/moment/moment/issues/1423\n c._isAMomentObject = true;\n c._useUTC = c._isUTC = isUTC;\n c._l = locale;\n c._i = input;\n c._f = format;\n c._strict = strict;\n\n return createFromConfig(c);\n}\n\nfunction createLocal(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, false);\n}\n\nvar prototypeMin = deprecate(\n 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other < this ? this : other;\n } else {\n return createInvalid();\n }\n }\n ),\n prototypeMax = deprecate(\n 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other > this ? this : other;\n } else {\n return createInvalid();\n }\n }\n );\n\n// Pick a moment m from moments so that m[fn](other) is true for all\n// other. This relies on the function fn to be transitive.\n//\n// moments should either be an array of moment objects or an array, whose\n// first element is an array of moment objects.\nfunction pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n}\n\n// TODO: Use [].sort instead?\nfunction min() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}\n\nfunction max() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isAfter', args);\n}\n\nvar now = function () {\n return Date.now ? Date.now() : +new Date();\n};\n\nvar ordering = [\n 'year',\n 'quarter',\n 'month',\n 'week',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'millisecond',\n];\n\nfunction isDurationValid(m) {\n var key,\n unitHasDecimal = false,\n i,\n orderLen = ordering.length;\n for (key in m) {\n if (\n hasOwnProp(m, key) &&\n !(\n indexOf.call(ordering, key) !== -1 &&\n (m[key] == null || !isNaN(m[key]))\n )\n ) {\n return false;\n }\n }\n\n for (i = 0; i < orderLen; ++i) {\n if (m[ordering[i]]) {\n if (unitHasDecimal) {\n return false; // only allow non-integers for smallest unit\n }\n if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {\n unitHasDecimal = true;\n }\n }\n }\n\n return true;\n}\n\nfunction isValid$1() {\n return this._isValid;\n}\n\nfunction createInvalid$1() {\n return createDuration(NaN);\n}\n\nfunction Duration(duration) {\n var normalizedInput = normalizeObjectUnits(duration),\n years = normalizedInput.year || 0,\n quarters = normalizedInput.quarter || 0,\n months = normalizedInput.month || 0,\n weeks = normalizedInput.week || normalizedInput.isoWeek || 0,\n days = normalizedInput.day || 0,\n hours = normalizedInput.hour || 0,\n minutes = normalizedInput.minute || 0,\n seconds = normalizedInput.second || 0,\n milliseconds = normalizedInput.millisecond || 0;\n\n this._isValid = isDurationValid(normalizedInput);\n\n // representation for dateAddRemove\n this._milliseconds =\n +milliseconds +\n seconds * 1e3 + // 1000\n minutes * 6e4 + // 1000 * 60\n hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978\n // Because of dateAddRemove treats 24 hours as different from a\n // day when working around DST, we need to store them separately\n this._days = +days + weeks * 7;\n // It is impossible to translate months into days without knowing\n // which months you are are talking about, so we have to store\n // it separately.\n this._months = +months + quarters * 3 + years * 12;\n\n this._data = {};\n\n this._locale = getLocale();\n\n this._bubble();\n}\n\nfunction isDuration(obj) {\n return obj instanceof Duration;\n}\n\nfunction absRound(number) {\n if (number < 0) {\n return Math.round(-1 * number) * -1;\n } else {\n return Math.round(number);\n }\n}\n\n// compare two arrays, return the number of differences\nfunction compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (\n (dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))\n ) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n}\n\n// FORMATTING\n\nfunction offset(token, separator) {\n addFormatToken(token, 0, 0, function () {\n var offset = this.utcOffset(),\n sign = '+';\n if (offset < 0) {\n offset = -offset;\n sign = '-';\n }\n return (\n sign +\n zeroFill(~~(offset / 60), 2) +\n separator +\n zeroFill(~~offset % 60, 2)\n );\n });\n}\n\noffset('Z', ':');\noffset('ZZ', '');\n\n// PARSING\n\naddRegexToken('Z', matchShortOffset);\naddRegexToken('ZZ', matchShortOffset);\naddParseToken(['Z', 'ZZ'], function (input, array, config) {\n config._useUTC = true;\n config._tzm = offsetFromString(matchShortOffset, input);\n});\n\n// HELPERS\n\n// timezone chunker\n// '+10:00' > ['10', '00']\n// '-1530' > ['-15', '30']\nvar chunkOffset = /([\\+\\-]|\\d\\d)/gi;\n\nfunction offsetFromString(matcher, string) {\n var matches = (string || '').match(matcher),\n chunk,\n parts,\n minutes;\n\n if (matches === null) {\n return null;\n }\n\n chunk = matches[matches.length - 1] || [];\n parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];\n minutes = +(parts[1] * 60) + toInt(parts[2]);\n\n return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;\n}\n\n// Return a moment from input, that is local/utc/zone equivalent to model.\nfunction cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff =\n (isMoment(input) || isDate(input)\n ? input.valueOf()\n : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n}\n\nfunction getDateOffset(m) {\n // On Firefox.24 Date#getTimezoneOffset returns a floating point.\n // https://github.com/moment/moment/pull/1871\n return -Math.round(m._d.getTimezoneOffset());\n}\n\n// HOOKS\n\n// This function will be called whenever a moment is mutated.\n// It is intended to keep the offset in sync with the timezone.\nhooks.updateOffset = function () {};\n\n// MOMENTS\n\n// keepLocalTime = true means only change the timezone, without\n// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->\n// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset\n// +0200, so we adjust the time as needed, to be valid.\n//\n// Keeping the time actually adds/subtracts (one hour)\n// from the actual represented time. That is why we call updateOffset\n// a second time. In case it wants us to change the offset again\n// _changeInProgress == true case, then we have to adjust, because\n// there is no such time in the given timezone.\nfunction getSetOffset(input, keepLocalTime, keepMinutes) {\n var offset = this._offset || 0,\n localAdjust;\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n if (input != null) {\n if (typeof input === 'string') {\n input = offsetFromString(matchShortOffset, input);\n if (input === null) {\n return this;\n }\n } else if (Math.abs(input) < 16 && !keepMinutes) {\n input = input * 60;\n }\n if (!this._isUTC && keepLocalTime) {\n localAdjust = getDateOffset(this);\n }\n this._offset = input;\n this._isUTC = true;\n if (localAdjust != null) {\n this.add(localAdjust, 'm');\n }\n if (offset !== input) {\n if (!keepLocalTime || this._changeInProgress) {\n addSubtract(\n this,\n createDuration(input - offset, 'm'),\n 1,\n false\n );\n } else if (!this._changeInProgress) {\n this._changeInProgress = true;\n hooks.updateOffset(this, true);\n this._changeInProgress = null;\n }\n }\n return this;\n } else {\n return this._isUTC ? offset : getDateOffset(this);\n }\n}\n\nfunction getSetZone(input, keepLocalTime) {\n if (input != null) {\n if (typeof input !== 'string') {\n input = -input;\n }\n\n this.utcOffset(input, keepLocalTime);\n\n return this;\n } else {\n return -this.utcOffset();\n }\n}\n\nfunction setOffsetToUTC(keepLocalTime) {\n return this.utcOffset(0, keepLocalTime);\n}\n\nfunction setOffsetToLocal(keepLocalTime) {\n if (this._isUTC) {\n this.utcOffset(0, keepLocalTime);\n this._isUTC = false;\n\n if (keepLocalTime) {\n this.subtract(getDateOffset(this), 'm');\n }\n }\n return this;\n}\n\nfunction setOffsetToParsedOffset() {\n if (this._tzm != null) {\n this.utcOffset(this._tzm, false, true);\n } else if (typeof this._i === 'string') {\n var tZone = offsetFromString(matchOffset, this._i);\n if (tZone != null) {\n this.utcOffset(tZone);\n } else {\n this.utcOffset(0, true);\n }\n }\n return this;\n}\n\nfunction hasAlignedHourOffset(input) {\n if (!this.isValid()) {\n return false;\n }\n input = input ? createLocal(input).utcOffset() : 0;\n\n return (this.utcOffset() - input) % 60 === 0;\n}\n\nfunction isDaylightSavingTime() {\n return (\n this.utcOffset() > this.clone().month(0).utcOffset() ||\n this.utcOffset() > this.clone().month(5).utcOffset()\n );\n}\n\nfunction isDaylightSavingTimeShifted() {\n if (!isUndefined(this._isDSTShifted)) {\n return this._isDSTShifted;\n }\n\n var c = {},\n other;\n\n copyConfig(c, this);\n c = prepareConfig(c);\n\n if (c._a) {\n other = c._isUTC ? createUTC(c._a) : createLocal(c._a);\n this._isDSTShifted =\n this.isValid() && compareArrays(c._a, other.toArray()) > 0;\n } else {\n this._isDSTShifted = false;\n }\n\n return this._isDSTShifted;\n}\n\nfunction isLocal() {\n return this.isValid() ? !this._isUTC : false;\n}\n\nfunction isUtcOffset() {\n return this.isValid() ? this._isUTC : false;\n}\n\nfunction isUtc() {\n return this.isValid() ? this._isUTC && this._offset === 0 : false;\n}\n\n// ASP.NET json date format regex\nvar aspNetRegex = /^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,\n // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html\n // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere\n // and further modified to allow for strings containing both week and day\n isoRegex =\n /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\nfunction createDuration(input, key) {\n var duration = input,\n // matching against regexp is expensive, do it on demand\n match = null,\n sign,\n ret,\n diffRes;\n\n if (isDuration(input)) {\n duration = {\n ms: input._milliseconds,\n d: input._days,\n M: input._months,\n };\n } else if (isNumber(input) || !isNaN(+input)) {\n duration = {};\n if (key) {\n duration[key] = +input;\n } else {\n duration.milliseconds = +input;\n }\n } else if ((match = aspNetRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: 0,\n d: toInt(match[DATE]) * sign,\n h: toInt(match[HOUR]) * sign,\n m: toInt(match[MINUTE]) * sign,\n s: toInt(match[SECOND]) * sign,\n ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match\n };\n } else if ((match = isoRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: parseIso(match[2], sign),\n M: parseIso(match[3], sign),\n w: parseIso(match[4], sign),\n d: parseIso(match[5], sign),\n h: parseIso(match[6], sign),\n m: parseIso(match[7], sign),\n s: parseIso(match[8], sign),\n };\n } else if (duration == null) {\n // checks for null or undefined\n duration = {};\n } else if (\n typeof duration === 'object' &&\n ('from' in duration || 'to' in duration)\n ) {\n diffRes = momentsDifference(\n createLocal(duration.from),\n createLocal(duration.to)\n );\n\n duration = {};\n duration.ms = diffRes.milliseconds;\n duration.M = diffRes.months;\n }\n\n ret = new Duration(duration);\n\n if (isDuration(input) && hasOwnProp(input, '_locale')) {\n ret._locale = input._locale;\n }\n\n if (isDuration(input) && hasOwnProp(input, '_isValid')) {\n ret._isValid = input._isValid;\n }\n\n return ret;\n}\n\ncreateDuration.fn = Duration.prototype;\ncreateDuration.invalid = createInvalid$1;\n\nfunction parseIso(inp, sign) {\n // We'd normally use ~~inp for this, but unfortunately it also\n // converts floats to ints.\n // inp may be undefined, so careful calling replace on it.\n var res = inp && parseFloat(inp.replace(',', '.'));\n // apply sign while we're at it\n return (isNaN(res) ? 0 : res) * sign;\n}\n\nfunction positiveMomentsDifference(base, other) {\n var res = {};\n\n res.months =\n other.month() - base.month() + (other.year() - base.year()) * 12;\n if (base.clone().add(res.months, 'M').isAfter(other)) {\n --res.months;\n }\n\n res.milliseconds = +other - +base.clone().add(res.months, 'M');\n\n return res;\n}\n\nfunction momentsDifference(base, other) {\n var res;\n if (!(base.isValid() && other.isValid())) {\n return { milliseconds: 0, months: 0 };\n }\n\n other = cloneWithOffset(other, base);\n if (base.isBefore(other)) {\n res = positiveMomentsDifference(base, other);\n } else {\n res = positiveMomentsDifference(other, base);\n res.milliseconds = -res.milliseconds;\n res.months = -res.months;\n }\n\n return res;\n}\n\n// TODO: remove 'name' arg after deprecation is removed\nfunction createAdder(direction, name) {\n return function (val, period) {\n var dur, tmp;\n //invert the arguments, but complain about it\n if (period !== null && !isNaN(+period)) {\n deprecateSimple(\n name,\n 'moment().' +\n name +\n '(period, number) is deprecated. Please use moment().' +\n name +\n '(number, period). ' +\n 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'\n );\n tmp = val;\n val = period;\n period = tmp;\n }\n\n dur = createDuration(val, period);\n addSubtract(this, dur, direction);\n return this;\n };\n}\n\nfunction addSubtract(mom, duration, isAdding, updateOffset) {\n var milliseconds = duration._milliseconds,\n days = absRound(duration._days),\n months = absRound(duration._months);\n\n if (!mom.isValid()) {\n // No op\n return;\n }\n\n updateOffset = updateOffset == null ? true : updateOffset;\n\n if (months) {\n setMonth(mom, get(mom, 'Month') + months * isAdding);\n }\n if (days) {\n set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);\n }\n if (milliseconds) {\n mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);\n }\n if (updateOffset) {\n hooks.updateOffset(mom, days || months);\n }\n}\n\nvar add = createAdder(1, 'add'),\n subtract = createAdder(-1, 'subtract');\n\nfunction isString(input) {\n return typeof input === 'string' || input instanceof String;\n}\n\n// type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined\nfunction isMomentInput(input) {\n return (\n isMoment(input) ||\n isDate(input) ||\n isString(input) ||\n isNumber(input) ||\n isNumberOrStringArray(input) ||\n isMomentInputObject(input) ||\n input === null ||\n input === undefined\n );\n}\n\nfunction isMomentInputObject(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'years',\n 'year',\n 'y',\n 'months',\n 'month',\n 'M',\n 'days',\n 'day',\n 'd',\n 'dates',\n 'date',\n 'D',\n 'hours',\n 'hour',\n 'h',\n 'minutes',\n 'minute',\n 'm',\n 'seconds',\n 'second',\n 's',\n 'milliseconds',\n 'millisecond',\n 'ms',\n ],\n i,\n property,\n propertyLen = properties.length;\n\n for (i = 0; i < propertyLen; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n}\n\nfunction isNumberOrStringArray(input) {\n var arrayTest = isArray(input),\n dataTypeTest = false;\n if (arrayTest) {\n dataTypeTest =\n input.filter(function (item) {\n return !isNumber(item) && isString(input);\n }).length === 0;\n }\n return arrayTest && dataTypeTest;\n}\n\nfunction isCalendarSpec(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'sameDay',\n 'nextDay',\n 'lastDay',\n 'nextWeek',\n 'lastWeek',\n 'sameElse',\n ],\n i,\n property;\n\n for (i = 0; i < properties.length; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n}\n\nfunction getCalendarFormat(myMoment, now) {\n var diff = myMoment.diff(now, 'days', true);\n return diff < -6\n ? 'sameElse'\n : diff < -1\n ? 'lastWeek'\n : diff < 0\n ? 'lastDay'\n : diff < 1\n ? 'sameDay'\n : diff < 2\n ? 'nextDay'\n : diff < 7\n ? 'nextWeek'\n : 'sameElse';\n}\n\nfunction calendar$1(time, formats) {\n // Support for single parameter, formats only overload to the calendar function\n if (arguments.length === 1) {\n if (!arguments[0]) {\n time = undefined;\n formats = undefined;\n } else if (isMomentInput(arguments[0])) {\n time = arguments[0];\n formats = undefined;\n } else if (isCalendarSpec(arguments[0])) {\n formats = arguments[0];\n time = undefined;\n }\n }\n // We want to compare the start of today, vs this.\n // Getting start-of-today depends on whether we're local/utc/offset or not.\n var now = time || createLocal(),\n sod = cloneWithOffset(now, this).startOf('day'),\n format = hooks.calendarFormat(this, sod) || 'sameElse',\n output =\n formats &&\n (isFunction(formats[format])\n ? formats[format].call(this, now)\n : formats[format]);\n\n return this.format(\n output || this.localeData().calendar(format, this, createLocal(now))\n );\n}\n\nfunction clone() {\n return new Moment(this);\n}\n\nfunction isAfter(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() > localInput.valueOf();\n } else {\n return localInput.valueOf() < this.clone().startOf(units).valueOf();\n }\n}\n\nfunction isBefore(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() < localInput.valueOf();\n } else {\n return this.clone().endOf(units).valueOf() < localInput.valueOf();\n }\n}\n\nfunction isBetween(from, to, units, inclusivity) {\n var localFrom = isMoment(from) ? from : createLocal(from),\n localTo = isMoment(to) ? to : createLocal(to);\n if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {\n return false;\n }\n inclusivity = inclusivity || '()';\n return (\n (inclusivity[0] === '('\n ? this.isAfter(localFrom, units)\n : !this.isBefore(localFrom, units)) &&\n (inclusivity[1] === ')'\n ? this.isBefore(localTo, units)\n : !this.isAfter(localTo, units))\n );\n}\n\nfunction isSame(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input),\n inputMs;\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() === localInput.valueOf();\n } else {\n inputMs = localInput.valueOf();\n return (\n this.clone().startOf(units).valueOf() <= inputMs &&\n inputMs <= this.clone().endOf(units).valueOf()\n );\n }\n}\n\nfunction isSameOrAfter(input, units) {\n return this.isSame(input, units) || this.isAfter(input, units);\n}\n\nfunction isSameOrBefore(input, units) {\n return this.isSame(input, units) || this.isBefore(input, units);\n}\n\nfunction diff(input, units, asFloat) {\n var that, zoneDelta, output;\n\n if (!this.isValid()) {\n return NaN;\n }\n\n that = cloneWithOffset(input, this);\n\n if (!that.isValid()) {\n return NaN;\n }\n\n zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;\n\n units = normalizeUnits(units);\n\n switch (units) {\n case 'year':\n output = monthDiff(this, that) / 12;\n break;\n case 'month':\n output = monthDiff(this, that);\n break;\n case 'quarter':\n output = monthDiff(this, that) / 3;\n break;\n case 'second':\n output = (this - that) / 1e3;\n break; // 1000\n case 'minute':\n output = (this - that) / 6e4;\n break; // 1000 * 60\n case 'hour':\n output = (this - that) / 36e5;\n break; // 1000 * 60 * 60\n case 'day':\n output = (this - that - zoneDelta) / 864e5;\n break; // 1000 * 60 * 60 * 24, negate dst\n case 'week':\n output = (this - that - zoneDelta) / 6048e5;\n break; // 1000 * 60 * 60 * 24 * 7, negate dst\n default:\n output = this - that;\n }\n\n return asFloat ? output : absFloor(output);\n}\n\nfunction monthDiff(a, b) {\n if (a.date() < b.date()) {\n // end-of-month calculations work correct when the start month has more\n // days than the end month.\n return -monthDiff(b, a);\n }\n // difference in months\n var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),\n // b is in (anchor - 1 month, anchor + 1 month)\n anchor = a.clone().add(wholeMonthDiff, 'months'),\n anchor2,\n adjust;\n\n if (b - anchor < 0) {\n anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor - anchor2);\n } else {\n anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor2 - anchor);\n }\n\n //check for negative zero, return zero if negative zero\n return -(wholeMonthDiff + adjust) || 0;\n}\n\nhooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';\nhooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';\n\nfunction toString() {\n return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');\n}\n\nfunction toISOString(keepOffset) {\n if (!this.isValid()) {\n return null;\n }\n var utc = keepOffset !== true,\n m = utc ? this.clone().utc() : this;\n if (m.year() < 0 || m.year() > 9999) {\n return formatMoment(\n m,\n utc\n ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'\n : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n }\n if (isFunction(Date.prototype.toISOString)) {\n // native implementation is ~50x faster, use it when we can\n if (utc) {\n return this.toDate().toISOString();\n } else {\n return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)\n .toISOString()\n .replace('Z', formatMoment(m, 'Z'));\n }\n }\n return formatMoment(\n m,\n utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n}\n\n/**\n * Return a human readable representation of a moment that can\n * also be evaluated to get a new moment which is the same\n *\n * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects\n */\nfunction inspect() {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment',\n zone = '',\n prefix,\n year,\n datetime,\n suffix;\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n prefix = '[' + func + '(\"]';\n year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';\n datetime = '-MM-DD[T]HH:mm:ss.SSS';\n suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n}\n\nfunction format(inputString) {\n if (!inputString) {\n inputString = this.isUtc()\n ? hooks.defaultFormatUtc\n : hooks.defaultFormat;\n }\n var output = formatMoment(this, inputString);\n return this.localeData().postformat(output);\n}\n\nfunction from(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ to: this, from: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n}\n\nfunction fromNow(withoutSuffix) {\n return this.from(createLocal(), withoutSuffix);\n}\n\nfunction to(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ from: this, to: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n}\n\nfunction toNow(withoutSuffix) {\n return this.to(createLocal(), withoutSuffix);\n}\n\n// If passed a locale key, it will set the locale for this\n// instance. Otherwise, it will return the locale configuration\n// variables for this instance.\nfunction locale(key) {\n var newLocaleData;\n\n if (key === undefined) {\n return this._locale._abbr;\n } else {\n newLocaleData = getLocale(key);\n if (newLocaleData != null) {\n this._locale = newLocaleData;\n }\n return this;\n }\n}\n\nvar lang = deprecate(\n 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',\n function (key) {\n if (key === undefined) {\n return this.localeData();\n } else {\n return this.locale(key);\n }\n }\n);\n\nfunction localeData() {\n return this._locale;\n}\n\nvar MS_PER_SECOND = 1000,\n MS_PER_MINUTE = 60 * MS_PER_SECOND,\n MS_PER_HOUR = 60 * MS_PER_MINUTE,\n MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;\n\n// actual modulo - handles negative numbers (for dates before 1970):\nfunction mod$1(dividend, divisor) {\n return ((dividend % divisor) + divisor) % divisor;\n}\n\nfunction localStartOfDate(y, m, d) {\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return new Date(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return new Date(y, m, d).valueOf();\n }\n}\n\nfunction utcStartOfDate(y, m, d) {\n // Date.UTC remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return Date.UTC(y, m, d);\n }\n}\n\nfunction startOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year(), 0, 1);\n break;\n case 'quarter':\n time = startOfDate(\n this.year(),\n this.month() - (this.month() % 3),\n 1\n );\n break;\n case 'month':\n time = startOfDate(this.year(), this.month(), 1);\n break;\n case 'week':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday()\n );\n break;\n case 'isoWeek':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1)\n );\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date());\n break;\n case 'hour':\n time = this._d.valueOf();\n time -= mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n );\n break;\n case 'minute':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_MINUTE);\n break;\n case 'second':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_SECOND);\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n}\n\nfunction endOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year() + 1, 0, 1) - 1;\n break;\n case 'quarter':\n time =\n startOfDate(\n this.year(),\n this.month() - (this.month() % 3) + 3,\n 1\n ) - 1;\n break;\n case 'month':\n time = startOfDate(this.year(), this.month() + 1, 1) - 1;\n break;\n case 'week':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday() + 7\n ) - 1;\n break;\n case 'isoWeek':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1) + 7\n ) - 1;\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;\n break;\n case 'hour':\n time = this._d.valueOf();\n time +=\n MS_PER_HOUR -\n mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n ) -\n 1;\n break;\n case 'minute':\n time = this._d.valueOf();\n time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;\n break;\n case 'second':\n time = this._d.valueOf();\n time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n}\n\nfunction valueOf() {\n return this._d.valueOf() - (this._offset || 0) * 60000;\n}\n\nfunction unix() {\n return Math.floor(this.valueOf() / 1000);\n}\n\nfunction toDate() {\n return new Date(this.valueOf());\n}\n\nfunction toArray() {\n var m = this;\n return [\n m.year(),\n m.month(),\n m.date(),\n m.hour(),\n m.minute(),\n m.second(),\n m.millisecond(),\n ];\n}\n\nfunction toObject() {\n var m = this;\n return {\n years: m.year(),\n months: m.month(),\n date: m.date(),\n hours: m.hours(),\n minutes: m.minutes(),\n seconds: m.seconds(),\n milliseconds: m.milliseconds(),\n };\n}\n\nfunction toJSON() {\n // new Date(NaN).toJSON() === null\n return this.isValid() ? this.toISOString() : null;\n}\n\nfunction isValid$2() {\n return isValid(this);\n}\n\nfunction parsingFlags() {\n return extend({}, getParsingFlags(this));\n}\n\nfunction invalidAt() {\n return getParsingFlags(this).overflow;\n}\n\nfunction creationData() {\n return {\n input: this._i,\n format: this._f,\n locale: this._locale,\n isUTC: this._isUTC,\n strict: this._strict,\n };\n}\n\naddFormatToken('N', 0, 0, 'eraAbbr');\naddFormatToken('NN', 0, 0, 'eraAbbr');\naddFormatToken('NNN', 0, 0, 'eraAbbr');\naddFormatToken('NNNN', 0, 0, 'eraName');\naddFormatToken('NNNNN', 0, 0, 'eraNarrow');\n\naddFormatToken('y', ['y', 1], 'yo', 'eraYear');\naddFormatToken('y', ['yy', 2], 0, 'eraYear');\naddFormatToken('y', ['yyy', 3], 0, 'eraYear');\naddFormatToken('y', ['yyyy', 4], 0, 'eraYear');\n\naddRegexToken('N', matchEraAbbr);\naddRegexToken('NN', matchEraAbbr);\naddRegexToken('NNN', matchEraAbbr);\naddRegexToken('NNNN', matchEraName);\naddRegexToken('NNNNN', matchEraNarrow);\n\naddParseToken(\n ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],\n function (input, array, config, token) {\n var era = config._locale.erasParse(input, token, config._strict);\n if (era) {\n getParsingFlags(config).era = era;\n } else {\n getParsingFlags(config).invalidEra = input;\n }\n }\n);\n\naddRegexToken('y', matchUnsigned);\naddRegexToken('yy', matchUnsigned);\naddRegexToken('yyy', matchUnsigned);\naddRegexToken('yyyy', matchUnsigned);\naddRegexToken('yo', matchEraYearOrdinal);\n\naddParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);\naddParseToken(['yo'], function (input, array, config, token) {\n var match;\n if (config._locale._eraYearOrdinalRegex) {\n match = input.match(config._locale._eraYearOrdinalRegex);\n }\n\n if (config._locale.eraYearOrdinalParse) {\n array[YEAR] = config._locale.eraYearOrdinalParse(input, match);\n } else {\n array[YEAR] = parseInt(input, 10);\n }\n});\n\nfunction localeEras(m, format) {\n var i,\n l,\n date,\n eras = this._eras || getLocale('en')._eras;\n for (i = 0, l = eras.length; i < l; ++i) {\n switch (typeof eras[i].since) {\n case 'string':\n // truncate time\n date = hooks(eras[i].since).startOf('day');\n eras[i].since = date.valueOf();\n break;\n }\n\n switch (typeof eras[i].until) {\n case 'undefined':\n eras[i].until = +Infinity;\n break;\n case 'string':\n // truncate time\n date = hooks(eras[i].until).startOf('day').valueOf();\n eras[i].until = date.valueOf();\n break;\n }\n }\n return eras;\n}\n\nfunction localeErasParse(eraName, format, strict) {\n var i,\n l,\n eras = this.eras(),\n name,\n abbr,\n narrow;\n eraName = eraName.toUpperCase();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n name = eras[i].name.toUpperCase();\n abbr = eras[i].abbr.toUpperCase();\n narrow = eras[i].narrow.toUpperCase();\n\n if (strict) {\n switch (format) {\n case 'N':\n case 'NN':\n case 'NNN':\n if (abbr === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNN':\n if (name === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNNN':\n if (narrow === eraName) {\n return eras[i];\n }\n break;\n }\n } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {\n return eras[i];\n }\n }\n}\n\nfunction localeErasConvertYear(era, year) {\n var dir = era.since <= era.until ? +1 : -1;\n if (year === undefined) {\n return hooks(era.since).year();\n } else {\n return hooks(era.since).year() + (year - era.offset) * dir;\n }\n}\n\nfunction getEraName() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].name;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].name;\n }\n }\n\n return '';\n}\n\nfunction getEraNarrow() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].narrow;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].narrow;\n }\n }\n\n return '';\n}\n\nfunction getEraAbbr() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].abbr;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].abbr;\n }\n }\n\n return '';\n}\n\nfunction getEraYear() {\n var i,\n l,\n dir,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n dir = eras[i].since <= eras[i].until ? +1 : -1;\n\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (\n (eras[i].since <= val && val <= eras[i].until) ||\n (eras[i].until <= val && val <= eras[i].since)\n ) {\n return (\n (this.year() - hooks(eras[i].since).year()) * dir +\n eras[i].offset\n );\n }\n }\n\n return this.year();\n}\n\nfunction erasNameRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNameRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNameRegex : this._erasRegex;\n}\n\nfunction erasAbbrRegex(isStrict) {\n if (!hasOwnProp(this, '_erasAbbrRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasAbbrRegex : this._erasRegex;\n}\n\nfunction erasNarrowRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNarrowRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNarrowRegex : this._erasRegex;\n}\n\nfunction matchEraAbbr(isStrict, locale) {\n return locale.erasAbbrRegex(isStrict);\n}\n\nfunction matchEraName(isStrict, locale) {\n return locale.erasNameRegex(isStrict);\n}\n\nfunction matchEraNarrow(isStrict, locale) {\n return locale.erasNarrowRegex(isStrict);\n}\n\nfunction matchEraYearOrdinal(isStrict, locale) {\n return locale._eraYearOrdinalRegex || matchUnsigned;\n}\n\nfunction computeErasParse() {\n var abbrPieces = [],\n namePieces = [],\n narrowPieces = [],\n mixedPieces = [],\n i,\n l,\n eras = this.eras();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n namePieces.push(regexEscape(eras[i].name));\n abbrPieces.push(regexEscape(eras[i].abbr));\n narrowPieces.push(regexEscape(eras[i].narrow));\n\n mixedPieces.push(regexEscape(eras[i].name));\n mixedPieces.push(regexEscape(eras[i].abbr));\n mixedPieces.push(regexEscape(eras[i].narrow));\n }\n\n this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');\n this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');\n this._erasNarrowRegex = new RegExp(\n '^(' + narrowPieces.join('|') + ')',\n 'i'\n );\n}\n\n// FORMATTING\n\naddFormatToken(0, ['gg', 2], 0, function () {\n return this.weekYear() % 100;\n});\n\naddFormatToken(0, ['GG', 2], 0, function () {\n return this.isoWeekYear() % 100;\n});\n\nfunction addWeekYearFormatToken(token, getter) {\n addFormatToken(0, [token, token.length], 0, getter);\n}\n\naddWeekYearFormatToken('gggg', 'weekYear');\naddWeekYearFormatToken('ggggg', 'weekYear');\naddWeekYearFormatToken('GGGG', 'isoWeekYear');\naddWeekYearFormatToken('GGGGG', 'isoWeekYear');\n\n// ALIASES\n\naddUnitAlias('weekYear', 'gg');\naddUnitAlias('isoWeekYear', 'GG');\n\n// PRIORITY\n\naddUnitPriority('weekYear', 1);\naddUnitPriority('isoWeekYear', 1);\n\n// PARSING\n\naddRegexToken('G', matchSigned);\naddRegexToken('g', matchSigned);\naddRegexToken('GG', match1to2, match2);\naddRegexToken('gg', match1to2, match2);\naddRegexToken('GGGG', match1to4, match4);\naddRegexToken('gggg', match1to4, match4);\naddRegexToken('GGGGG', match1to6, match6);\naddRegexToken('ggggg', match1to6, match6);\n\naddWeekParseToken(\n ['gggg', 'ggggg', 'GGGG', 'GGGGG'],\n function (input, week, config, token) {\n week[token.substr(0, 2)] = toInt(input);\n }\n);\n\naddWeekParseToken(['gg', 'GG'], function (input, week, config, token) {\n week[token] = hooks.parseTwoDigitYear(input);\n});\n\n// MOMENTS\n\nfunction getSetWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.week(),\n this.weekday(),\n this.localeData()._week.dow,\n this.localeData()._week.doy\n );\n}\n\nfunction getSetISOWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.isoWeek(),\n this.isoWeekday(),\n 1,\n 4\n );\n}\n\nfunction getISOWeeksInYear() {\n return weeksInYear(this.year(), 1, 4);\n}\n\nfunction getISOWeeksInISOWeekYear() {\n return weeksInYear(this.isoWeekYear(), 1, 4);\n}\n\nfunction getWeeksInYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);\n}\n\nfunction getWeeksInWeekYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);\n}\n\nfunction getSetWeekYearHelper(input, week, weekday, dow, doy) {\n var weeksTarget;\n if (input == null) {\n return weekOfYear(this, dow, doy).year;\n } else {\n weeksTarget = weeksInYear(input, dow, doy);\n if (week > weeksTarget) {\n week = weeksTarget;\n }\n return setWeekAll.call(this, input, week, weekday, dow, doy);\n }\n}\n\nfunction setWeekAll(weekYear, week, weekday, dow, doy) {\n var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),\n date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);\n\n this.year(date.getUTCFullYear());\n this.month(date.getUTCMonth());\n this.date(date.getUTCDate());\n return this;\n}\n\n// FORMATTING\n\naddFormatToken('Q', 0, 'Qo', 'quarter');\n\n// ALIASES\n\naddUnitAlias('quarter', 'Q');\n\n// PRIORITY\n\naddUnitPriority('quarter', 7);\n\n// PARSING\n\naddRegexToken('Q', match1);\naddParseToken('Q', function (input, array) {\n array[MONTH] = (toInt(input) - 1) * 3;\n});\n\n// MOMENTS\n\nfunction getSetQuarter(input) {\n return input == null\n ? Math.ceil((this.month() + 1) / 3)\n : this.month((input - 1) * 3 + (this.month() % 3));\n}\n\n// FORMATTING\n\naddFormatToken('D', ['DD', 2], 'Do', 'date');\n\n// ALIASES\n\naddUnitAlias('date', 'D');\n\n// PRIORITY\naddUnitPriority('date', 9);\n\n// PARSING\n\naddRegexToken('D', match1to2);\naddRegexToken('DD', match1to2, match2);\naddRegexToken('Do', function (isStrict, locale) {\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n return isStrict\n ? locale._dayOfMonthOrdinalParse || locale._ordinalParse\n : locale._dayOfMonthOrdinalParseLenient;\n});\n\naddParseToken(['D', 'DD'], DATE);\naddParseToken('Do', function (input, array) {\n array[DATE] = toInt(input.match(match1to2)[0]);\n});\n\n// MOMENTS\n\nvar getSetDayOfMonth = makeGetSet('Date', true);\n\n// FORMATTING\n\naddFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');\n\n// ALIASES\n\naddUnitAlias('dayOfYear', 'DDD');\n\n// PRIORITY\naddUnitPriority('dayOfYear', 4);\n\n// PARSING\n\naddRegexToken('DDD', match1to3);\naddRegexToken('DDDD', match3);\naddParseToken(['DDD', 'DDDD'], function (input, array, config) {\n config._dayOfYear = toInt(input);\n});\n\n// HELPERS\n\n// MOMENTS\n\nfunction getSetDayOfYear(input) {\n var dayOfYear =\n Math.round(\n (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5\n ) + 1;\n return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');\n}\n\n// FORMATTING\n\naddFormatToken('m', ['mm', 2], 0, 'minute');\n\n// ALIASES\n\naddUnitAlias('minute', 'm');\n\n// PRIORITY\n\naddUnitPriority('minute', 14);\n\n// PARSING\n\naddRegexToken('m', match1to2);\naddRegexToken('mm', match1to2, match2);\naddParseToken(['m', 'mm'], MINUTE);\n\n// MOMENTS\n\nvar getSetMinute = makeGetSet('Minutes', false);\n\n// FORMATTING\n\naddFormatToken('s', ['ss', 2], 0, 'second');\n\n// ALIASES\n\naddUnitAlias('second', 's');\n\n// PRIORITY\n\naddUnitPriority('second', 15);\n\n// PARSING\n\naddRegexToken('s', match1to2);\naddRegexToken('ss', match1to2, match2);\naddParseToken(['s', 'ss'], SECOND);\n\n// MOMENTS\n\nvar getSetSecond = makeGetSet('Seconds', false);\n\n// FORMATTING\n\naddFormatToken('S', 0, 0, function () {\n return ~~(this.millisecond() / 100);\n});\n\naddFormatToken(0, ['SS', 2], 0, function () {\n return ~~(this.millisecond() / 10);\n});\n\naddFormatToken(0, ['SSS', 3], 0, 'millisecond');\naddFormatToken(0, ['SSSS', 4], 0, function () {\n return this.millisecond() * 10;\n});\naddFormatToken(0, ['SSSSS', 5], 0, function () {\n return this.millisecond() * 100;\n});\naddFormatToken(0, ['SSSSSS', 6], 0, function () {\n return this.millisecond() * 1000;\n});\naddFormatToken(0, ['SSSSSSS', 7], 0, function () {\n return this.millisecond() * 10000;\n});\naddFormatToken(0, ['SSSSSSSS', 8], 0, function () {\n return this.millisecond() * 100000;\n});\naddFormatToken(0, ['SSSSSSSSS', 9], 0, function () {\n return this.millisecond() * 1000000;\n});\n\n// ALIASES\n\naddUnitAlias('millisecond', 'ms');\n\n// PRIORITY\n\naddUnitPriority('millisecond', 16);\n\n// PARSING\n\naddRegexToken('S', match1to3, match1);\naddRegexToken('SS', match1to3, match2);\naddRegexToken('SSS', match1to3, match3);\n\nvar token, getSetMillisecond;\nfor (token = 'SSSS'; token.length <= 9; token += 'S') {\n addRegexToken(token, matchUnsigned);\n}\n\nfunction parseMs(input, array) {\n array[MILLISECOND] = toInt(('0.' + input) * 1000);\n}\n\nfor (token = 'S'; token.length <= 9; token += 'S') {\n addParseToken(token, parseMs);\n}\n\ngetSetMillisecond = makeGetSet('Milliseconds', false);\n\n// FORMATTING\n\naddFormatToken('z', 0, 0, 'zoneAbbr');\naddFormatToken('zz', 0, 0, 'zoneName');\n\n// MOMENTS\n\nfunction getZoneAbbr() {\n return this._isUTC ? 'UTC' : '';\n}\n\nfunction getZoneName() {\n return this._isUTC ? 'Coordinated Universal Time' : '';\n}\n\nvar proto = Moment.prototype;\n\nproto.add = add;\nproto.calendar = calendar$1;\nproto.clone = clone;\nproto.diff = diff;\nproto.endOf = endOf;\nproto.format = format;\nproto.from = from;\nproto.fromNow = fromNow;\nproto.to = to;\nproto.toNow = toNow;\nproto.get = stringGet;\nproto.invalidAt = invalidAt;\nproto.isAfter = isAfter;\nproto.isBefore = isBefore;\nproto.isBetween = isBetween;\nproto.isSame = isSame;\nproto.isSameOrAfter = isSameOrAfter;\nproto.isSameOrBefore = isSameOrBefore;\nproto.isValid = isValid$2;\nproto.lang = lang;\nproto.locale = locale;\nproto.localeData = localeData;\nproto.max = prototypeMax;\nproto.min = prototypeMin;\nproto.parsingFlags = parsingFlags;\nproto.set = stringSet;\nproto.startOf = startOf;\nproto.subtract = subtract;\nproto.toArray = toArray;\nproto.toObject = toObject;\nproto.toDate = toDate;\nproto.toISOString = toISOString;\nproto.inspect = inspect;\nif (typeof Symbol !== 'undefined' && Symbol.for != null) {\n proto[Symbol.for('nodejs.util.inspect.custom')] = function () {\n return 'Moment<' + this.format() + '>';\n };\n}\nproto.toJSON = toJSON;\nproto.toString = toString;\nproto.unix = unix;\nproto.valueOf = valueOf;\nproto.creationData = creationData;\nproto.eraName = getEraName;\nproto.eraNarrow = getEraNarrow;\nproto.eraAbbr = getEraAbbr;\nproto.eraYear = getEraYear;\nproto.year = getSetYear;\nproto.isLeapYear = getIsLeapYear;\nproto.weekYear = getSetWeekYear;\nproto.isoWeekYear = getSetISOWeekYear;\nproto.quarter = proto.quarters = getSetQuarter;\nproto.month = getSetMonth;\nproto.daysInMonth = getDaysInMonth;\nproto.week = proto.weeks = getSetWeek;\nproto.isoWeek = proto.isoWeeks = getSetISOWeek;\nproto.weeksInYear = getWeeksInYear;\nproto.weeksInWeekYear = getWeeksInWeekYear;\nproto.isoWeeksInYear = getISOWeeksInYear;\nproto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;\nproto.date = getSetDayOfMonth;\nproto.day = proto.days = getSetDayOfWeek;\nproto.weekday = getSetLocaleDayOfWeek;\nproto.isoWeekday = getSetISODayOfWeek;\nproto.dayOfYear = getSetDayOfYear;\nproto.hour = proto.hours = getSetHour;\nproto.minute = proto.minutes = getSetMinute;\nproto.second = proto.seconds = getSetSecond;\nproto.millisecond = proto.milliseconds = getSetMillisecond;\nproto.utcOffset = getSetOffset;\nproto.utc = setOffsetToUTC;\nproto.local = setOffsetToLocal;\nproto.parseZone = setOffsetToParsedOffset;\nproto.hasAlignedHourOffset = hasAlignedHourOffset;\nproto.isDST = isDaylightSavingTime;\nproto.isLocal = isLocal;\nproto.isUtcOffset = isUtcOffset;\nproto.isUtc = isUtc;\nproto.isUTC = isUtc;\nproto.zoneAbbr = getZoneAbbr;\nproto.zoneName = getZoneName;\nproto.dates = deprecate(\n 'dates accessor is deprecated. Use date instead.',\n getSetDayOfMonth\n);\nproto.months = deprecate(\n 'months accessor is deprecated. Use month instead',\n getSetMonth\n);\nproto.years = deprecate(\n 'years accessor is deprecated. Use year instead',\n getSetYear\n);\nproto.zone = deprecate(\n 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',\n getSetZone\n);\nproto.isDSTShifted = deprecate(\n 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',\n isDaylightSavingTimeShifted\n);\n\nfunction createUnix(input) {\n return createLocal(input * 1000);\n}\n\nfunction createInZone() {\n return createLocal.apply(null, arguments).parseZone();\n}\n\nfunction preParsePostFormat(string) {\n return string;\n}\n\nvar proto$1 = Locale.prototype;\n\nproto$1.calendar = calendar;\nproto$1.longDateFormat = longDateFormat;\nproto$1.invalidDate = invalidDate;\nproto$1.ordinal = ordinal;\nproto$1.preparse = preParsePostFormat;\nproto$1.postformat = preParsePostFormat;\nproto$1.relativeTime = relativeTime;\nproto$1.pastFuture = pastFuture;\nproto$1.set = set;\nproto$1.eras = localeEras;\nproto$1.erasParse = localeErasParse;\nproto$1.erasConvertYear = localeErasConvertYear;\nproto$1.erasAbbrRegex = erasAbbrRegex;\nproto$1.erasNameRegex = erasNameRegex;\nproto$1.erasNarrowRegex = erasNarrowRegex;\n\nproto$1.months = localeMonths;\nproto$1.monthsShort = localeMonthsShort;\nproto$1.monthsParse = localeMonthsParse;\nproto$1.monthsRegex = monthsRegex;\nproto$1.monthsShortRegex = monthsShortRegex;\nproto$1.week = localeWeek;\nproto$1.firstDayOfYear = localeFirstDayOfYear;\nproto$1.firstDayOfWeek = localeFirstDayOfWeek;\n\nproto$1.weekdays = localeWeekdays;\nproto$1.weekdaysMin = localeWeekdaysMin;\nproto$1.weekdaysShort = localeWeekdaysShort;\nproto$1.weekdaysParse = localeWeekdaysParse;\n\nproto$1.weekdaysRegex = weekdaysRegex;\nproto$1.weekdaysShortRegex = weekdaysShortRegex;\nproto$1.weekdaysMinRegex = weekdaysMinRegex;\n\nproto$1.isPM = localeIsPM;\nproto$1.meridiem = localeMeridiem;\n\nfunction get$1(format, index, field, setter) {\n var locale = getLocale(),\n utc = createUTC().set(setter, index);\n return locale[field](utc, format);\n}\n\nfunction listMonthsImpl(format, index, field) {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n\n if (index != null) {\n return get$1(format, index, field, 'month');\n }\n\n var i,\n out = [];\n for (i = 0; i < 12; i++) {\n out[i] = get$1(format, i, field, 'month');\n }\n return out;\n}\n\n// ()\n// (5)\n// (fmt, 5)\n// (fmt)\n// (true)\n// (true, 5)\n// (true, fmt, 5)\n// (true, fmt)\nfunction listWeekdaysImpl(localeSorted, format, index, field) {\n if (typeof localeSorted === 'boolean') {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n } else {\n format = localeSorted;\n index = format;\n localeSorted = false;\n\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n }\n\n var locale = getLocale(),\n shift = localeSorted ? locale._week.dow : 0,\n i,\n out = [];\n\n if (index != null) {\n return get$1(format, (index + shift) % 7, field, 'day');\n }\n\n for (i = 0; i < 7; i++) {\n out[i] = get$1(format, (i + shift) % 7, field, 'day');\n }\n return out;\n}\n\nfunction listMonths(format, index) {\n return listMonthsImpl(format, index, 'months');\n}\n\nfunction listMonthsShort(format, index) {\n return listMonthsImpl(format, index, 'monthsShort');\n}\n\nfunction listWeekdays(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdays');\n}\n\nfunction listWeekdaysShort(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');\n}\n\nfunction listWeekdaysMin(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');\n}\n\ngetSetGlobalLocale('en', {\n eras: [\n {\n since: '0001-01-01',\n until: +Infinity,\n offset: 1,\n name: 'Anno Domini',\n narrow: 'AD',\n abbr: 'AD',\n },\n {\n since: '0000-12-31',\n until: -Infinity,\n offset: 1,\n name: 'Before Christ',\n narrow: 'BC',\n abbr: 'BC',\n },\n ],\n dayOfMonthOrdinalParse: /\\d{1,2}(th|st|nd|rd)/,\n ordinal: function (number) {\n var b = number % 10,\n output =\n toInt((number % 100) / 10) === 1\n ? 'th'\n : b === 1\n ? 'st'\n : b === 2\n ? 'nd'\n : b === 3\n ? 'rd'\n : 'th';\n return number + output;\n },\n});\n\n// Side effect imports\n\nhooks.lang = deprecate(\n 'moment.lang is deprecated. Use moment.locale instead.',\n getSetGlobalLocale\n);\nhooks.langData = deprecate(\n 'moment.langData is deprecated. Use moment.localeData instead.',\n getLocale\n);\n\nvar mathAbs = Math.abs;\n\nfunction abs() {\n var data = this._data;\n\n this._milliseconds = mathAbs(this._milliseconds);\n this._days = mathAbs(this._days);\n this._months = mathAbs(this._months);\n\n data.milliseconds = mathAbs(data.milliseconds);\n data.seconds = mathAbs(data.seconds);\n data.minutes = mathAbs(data.minutes);\n data.hours = mathAbs(data.hours);\n data.months = mathAbs(data.months);\n data.years = mathAbs(data.years);\n\n return this;\n}\n\nfunction addSubtract$1(duration, input, value, direction) {\n var other = createDuration(input, value);\n\n duration._milliseconds += direction * other._milliseconds;\n duration._days += direction * other._days;\n duration._months += direction * other._months;\n\n return duration._bubble();\n}\n\n// supports only 2.0-style add(1, 's') or add(duration)\nfunction add$1(input, value) {\n return addSubtract$1(this, input, value, 1);\n}\n\n// supports only 2.0-style subtract(1, 's') or subtract(duration)\nfunction subtract$1(input, value) {\n return addSubtract$1(this, input, value, -1);\n}\n\nfunction absCeil(number) {\n if (number < 0) {\n return Math.floor(number);\n } else {\n return Math.ceil(number);\n }\n}\n\nfunction bubble() {\n var milliseconds = this._milliseconds,\n days = this._days,\n months = this._months,\n data = this._data,\n seconds,\n minutes,\n hours,\n years,\n monthsFromDays;\n\n // if we have a mix of positive and negative values, bubble down first\n // check: https://github.com/moment/moment/issues/2166\n if (\n !(\n (milliseconds >= 0 && days >= 0 && months >= 0) ||\n (milliseconds <= 0 && days <= 0 && months <= 0)\n )\n ) {\n milliseconds += absCeil(monthsToDays(months) + days) * 864e5;\n days = 0;\n months = 0;\n }\n\n // The following code bubbles up values, see the tests for\n // examples of what that means.\n data.milliseconds = milliseconds % 1000;\n\n seconds = absFloor(milliseconds / 1000);\n data.seconds = seconds % 60;\n\n minutes = absFloor(seconds / 60);\n data.minutes = minutes % 60;\n\n hours = absFloor(minutes / 60);\n data.hours = hours % 24;\n\n days += absFloor(hours / 24);\n\n // convert days to months\n monthsFromDays = absFloor(daysToMonths(days));\n months += monthsFromDays;\n days -= absCeil(monthsToDays(monthsFromDays));\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n data.days = days;\n data.months = months;\n data.years = years;\n\n return this;\n}\n\nfunction daysToMonths(days) {\n // 400 years have 146097 days (taking into account leap year rules)\n // 400 years have 12 months === 4800\n return (days * 4800) / 146097;\n}\n\nfunction monthsToDays(months) {\n // the reverse of daysToMonths\n return (months * 146097) / 4800;\n}\n\nfunction as(units) {\n if (!this.isValid()) {\n return NaN;\n }\n var days,\n months,\n milliseconds = this._milliseconds;\n\n units = normalizeUnits(units);\n\n if (units === 'month' || units === 'quarter' || units === 'year') {\n days = this._days + milliseconds / 864e5;\n months = this._months + daysToMonths(days);\n switch (units) {\n case 'month':\n return months;\n case 'quarter':\n return months / 3;\n case 'year':\n return months / 12;\n }\n } else {\n // handle milliseconds separately because of floating point math errors (issue #1867)\n days = this._days + Math.round(monthsToDays(this._months));\n switch (units) {\n case 'week':\n return days / 7 + milliseconds / 6048e5;\n case 'day':\n return days + milliseconds / 864e5;\n case 'hour':\n return days * 24 + milliseconds / 36e5;\n case 'minute':\n return days * 1440 + milliseconds / 6e4;\n case 'second':\n return days * 86400 + milliseconds / 1000;\n // Math.floor prevents floating point math errors here\n case 'millisecond':\n return Math.floor(days * 864e5) + milliseconds;\n default:\n throw new Error('Unknown unit ' + units);\n }\n }\n}\n\n// TODO: Use this.as('ms')?\nfunction valueOf$1() {\n if (!this.isValid()) {\n return NaN;\n }\n return (\n this._milliseconds +\n this._days * 864e5 +\n (this._months % 12) * 2592e6 +\n toInt(this._months / 12) * 31536e6\n );\n}\n\nfunction makeAs(alias) {\n return function () {\n return this.as(alias);\n };\n}\n\nvar asMilliseconds = makeAs('ms'),\n asSeconds = makeAs('s'),\n asMinutes = makeAs('m'),\n asHours = makeAs('h'),\n asDays = makeAs('d'),\n asWeeks = makeAs('w'),\n asMonths = makeAs('M'),\n asQuarters = makeAs('Q'),\n asYears = makeAs('y');\n\nfunction clone$1() {\n return createDuration(this);\n}\n\nfunction get$2(units) {\n units = normalizeUnits(units);\n return this.isValid() ? this[units + 's']() : NaN;\n}\n\nfunction makeGetter(name) {\n return function () {\n return this.isValid() ? this._data[name] : NaN;\n };\n}\n\nvar milliseconds = makeGetter('milliseconds'),\n seconds = makeGetter('seconds'),\n minutes = makeGetter('minutes'),\n hours = makeGetter('hours'),\n days = makeGetter('days'),\n months = makeGetter('months'),\n years = makeGetter('years');\n\nfunction weeks() {\n return absFloor(this.days() / 7);\n}\n\nvar round = Math.round,\n thresholds = {\n ss: 44, // a few seconds to seconds\n s: 45, // seconds to minute\n m: 45, // minutes to hour\n h: 22, // hours to day\n d: 26, // days to month/week\n w: null, // weeks to month\n M: 11, // months to year\n };\n\n// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize\nfunction substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {\n return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);\n}\n\nfunction relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {\n var duration = createDuration(posNegDuration).abs(),\n seconds = round(duration.as('s')),\n minutes = round(duration.as('m')),\n hours = round(duration.as('h')),\n days = round(duration.as('d')),\n months = round(duration.as('M')),\n weeks = round(duration.as('w')),\n years = round(duration.as('y')),\n a =\n (seconds <= thresholds.ss && ['s', seconds]) ||\n (seconds < thresholds.s && ['ss', seconds]) ||\n (minutes <= 1 && ['m']) ||\n (minutes < thresholds.m && ['mm', minutes]) ||\n (hours <= 1 && ['h']) ||\n (hours < thresholds.h && ['hh', hours]) ||\n (days <= 1 && ['d']) ||\n (days < thresholds.d && ['dd', days]);\n\n if (thresholds.w != null) {\n a =\n a ||\n (weeks <= 1 && ['w']) ||\n (weeks < thresholds.w && ['ww', weeks]);\n }\n a = a ||\n (months <= 1 && ['M']) ||\n (months < thresholds.M && ['MM', months]) ||\n (years <= 1 && ['y']) || ['yy', years];\n\n a[2] = withoutSuffix;\n a[3] = +posNegDuration > 0;\n a[4] = locale;\n return substituteTimeAgo.apply(null, a);\n}\n\n// This function allows you to set the rounding function for relative time strings\nfunction getSetRelativeTimeRounding(roundingFunction) {\n if (roundingFunction === undefined) {\n return round;\n }\n if (typeof roundingFunction === 'function') {\n round = roundingFunction;\n return true;\n }\n return false;\n}\n\n// This function allows you to set a threshold for relative time strings\nfunction getSetRelativeTimeThreshold(threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshold === 's') {\n thresholds.ss = limit - 1;\n }\n return true;\n}\n\nfunction humanize(argWithSuffix, argThresholds) {\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var withSuffix = false,\n th = thresholds,\n locale,\n output;\n\n if (typeof argWithSuffix === 'object') {\n argThresholds = argWithSuffix;\n argWithSuffix = false;\n }\n if (typeof argWithSuffix === 'boolean') {\n withSuffix = argWithSuffix;\n }\n if (typeof argThresholds === 'object') {\n th = Object.assign({}, thresholds, argThresholds);\n if (argThresholds.s != null && argThresholds.ss == null) {\n th.ss = argThresholds.s - 1;\n }\n }\n\n locale = this.localeData();\n output = relativeTime$1(this, !withSuffix, th, locale);\n\n if (withSuffix) {\n output = locale.pastFuture(+this, output);\n }\n\n return locale.postformat(output);\n}\n\nvar abs$1 = Math.abs;\n\nfunction sign(x) {\n return (x > 0) - (x < 0) || +x;\n}\n\nfunction toISOString$1() {\n // for ISO strings we do not use the normal bubbling rules:\n // * milliseconds bubble up until they become hours\n // * days do not bubble at all\n // * months bubble up until they become years\n // This is because there is no context-free conversion between hours and days\n // (think of clock changes)\n // and also not between days and months (28-31 days per month)\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var seconds = abs$1(this._milliseconds) / 1000,\n days = abs$1(this._days),\n months = abs$1(this._months),\n minutes,\n hours,\n years,\n s,\n total = this.asSeconds(),\n totalSign,\n ymSign,\n daysSign,\n hmsSign;\n\n if (!total) {\n // this is the same as C#'s (Noda) and python (isodate)...\n // but not other JS (goog.date)\n return 'P0D';\n }\n\n // 3600 seconds -> 60 minutes -> 1 hour\n minutes = absFloor(seconds / 60);\n hours = absFloor(minutes / 60);\n seconds %= 60;\n minutes %= 60;\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js\n s = seconds ? seconds.toFixed(3).replace(/\\.?0+$/, '') : '';\n\n totalSign = total < 0 ? '-' : '';\n ymSign = sign(this._months) !== sign(total) ? '-' : '';\n daysSign = sign(this._days) !== sign(total) ? '-' : '';\n hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';\n\n return (\n totalSign +\n 'P' +\n (years ? ymSign + years + 'Y' : '') +\n (months ? ymSign + months + 'M' : '') +\n (days ? daysSign + days + 'D' : '') +\n (hours || minutes || seconds ? 'T' : '') +\n (hours ? hmsSign + hours + 'H' : '') +\n (minutes ? hmsSign + minutes + 'M' : '') +\n (seconds ? hmsSign + s + 'S' : '')\n );\n}\n\nvar proto$2 = Duration.prototype;\n\nproto$2.isValid = isValid$1;\nproto$2.abs = abs;\nproto$2.add = add$1;\nproto$2.subtract = subtract$1;\nproto$2.as = as;\nproto$2.asMilliseconds = asMilliseconds;\nproto$2.asSeconds = asSeconds;\nproto$2.asMinutes = asMinutes;\nproto$2.asHours = asHours;\nproto$2.asDays = asDays;\nproto$2.asWeeks = asWeeks;\nproto$2.asMonths = asMonths;\nproto$2.asQuarters = asQuarters;\nproto$2.asYears = asYears;\nproto$2.valueOf = valueOf$1;\nproto$2._bubble = bubble;\nproto$2.clone = clone$1;\nproto$2.get = get$2;\nproto$2.milliseconds = milliseconds;\nproto$2.seconds = seconds;\nproto$2.minutes = minutes;\nproto$2.hours = hours;\nproto$2.days = days;\nproto$2.weeks = weeks;\nproto$2.months = months;\nproto$2.years = years;\nproto$2.humanize = humanize;\nproto$2.toISOString = toISOString$1;\nproto$2.toString = toISOString$1;\nproto$2.toJSON = toISOString$1;\nproto$2.locale = locale;\nproto$2.localeData = localeData;\n\nproto$2.toIsoString = deprecate(\n 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',\n toISOString$1\n);\nproto$2.lang = lang;\n\n// FORMATTING\n\naddFormatToken('X', 0, 0, 'unix');\naddFormatToken('x', 0, 0, 'valueOf');\n\n// PARSING\n\naddRegexToken('x', matchSigned);\naddRegexToken('X', matchTimestamp);\naddParseToken('X', function (input, array, config) {\n config._d = new Date(parseFloat(input) * 1000);\n});\naddParseToken('x', function (input, array, config) {\n config._d = new Date(toInt(input));\n});\n\n//! moment.js\n\nhooks.version = '2.29.4';\n\nsetHookCallback(createLocal);\n\nhooks.fn = proto;\nhooks.min = min;\nhooks.max = max;\nhooks.now = now;\nhooks.utc = createUTC;\nhooks.unix = createUnix;\nhooks.months = listMonths;\nhooks.isDate = isDate;\nhooks.locale = getSetGlobalLocale;\nhooks.invalid = createInvalid;\nhooks.duration = createDuration;\nhooks.isMoment = isMoment;\nhooks.weekdays = listWeekdays;\nhooks.parseZone = createInZone;\nhooks.localeData = getLocale;\nhooks.isDuration = isDuration;\nhooks.monthsShort = listMonthsShort;\nhooks.weekdaysMin = listWeekdaysMin;\nhooks.defineLocale = defineLocale;\nhooks.updateLocale = updateLocale;\nhooks.locales = listLocales;\nhooks.weekdaysShort = listWeekdaysShort;\nhooks.normalizeUnits = normalizeUnits;\nhooks.relativeTimeRounding = getSetRelativeTimeRounding;\nhooks.relativeTimeThreshold = getSetRelativeTimeThreshold;\nhooks.calendarFormat = getCalendarFormat;\nhooks.prototype = proto;\n\n// currently HTML5 input type only supports 24-hour formats\nhooks.HTML5_FMT = {\n DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // \n DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // \n DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // \n DATE: 'YYYY-MM-DD', // \n TIME: 'HH:mm', // \n TIME_SECONDS: 'HH:mm:ss', // \n TIME_MS: 'HH:mm:ss.SSS', // \n WEEK: 'GGGG-[W]WW', // \n MONTH: 'YYYY-MM', // \n};\n\nexport default hooks;\n","export enum AvailableIpdContentTypeEnum {\r\n Basic = 'Basic',\r\n Full = 'Full',\r\n}\r\n","export enum RecruitmentStatusEnum {\r\n None = '',\r\n Completed = 'Completed',\r\n Terminated = 'Terminated',\r\n}\r\n","export enum InterventionModelEnum {\r\n SingleGroup = 'Single Group',\r\n ParallelGroup = 'ParallelGroup',\r\n ParallelGroupRandomized = 'ParallelGroupRandomized',\r\n ParallelGroupNonRandomized = 'ParallelGroupNonRandomized',\r\n Crossover = 'Crossover',\r\n CaseCrossOver = 'CaseCrossover',\r\n CaseControl = 'CaseControl',\r\n Cohort = 'Cohort',\r\n CrossSectional = 'CrossSectional',\r\n}\r\n","export enum AssignmentToInterventionEnum {\r\n NotApplicable = 'NotApplicable',\r\n Randomized = 'Randomized',\r\n NonRandomized = 'NonRandomized',\r\n}\r\n","export enum StudyStatusEnum {\r\n None = '',\r\n Draft = 'Draft',\r\n SubmittedToVivliForPreCheck = 'SubmittedToVivliForPreCheck',\r\n AwaitingCuration = 'AwaitingCuration',\r\n CurationInProgress = 'CurationInProgress',\r\n CurationInternalReview = 'CurationInternalReview',\r\n AwaitingCurationQaReview = 'AwaitingCurationQaReview',\r\n CurationQaReviewInProgress = 'CurationQaReviewInProgress',\r\n CurationRevisionsRequired = 'CurationRevisionsRequired',\r\n CurationDiscussionsRequired = 'CurationDiscussionsRequired',\r\n CurationBlocked = 'CurationBlocked',\r\n SponsorRequiresCurationRevisions = 'SponsorRequiresCurationRevisions',\r\n SponsorApprovesCuration = 'SponsorApprovesCuration',\r\n SubmittedToVivliForPostCheck = 'SubmittedToVivliForPostCheck',\r\n Posted = 'Posted',\r\n Cancelled = 'Cancelled',\r\n}\r\n","export enum PhaseEnum {\r\n None = '',\r\n NA = 'NA',\r\n EarlyPhase1 = 'Early Phase 1',\r\n Phase1 = 'Phase 1',\r\n Phase1Phase2 = 'Phase 1/Phase 2',\r\n Phase2 = 'Phase 2',\r\n Phase2a = 'Phase 2a',\r\n Phase2b = 'Phase 2b',\r\n Phase2Phase3 = 'Phase 2/Phase 3',\r\n Phase3 = 'Phase 3',\r\n Phase3a = 'Phase 3a',\r\n Phase3b = 'Phase 3b',\r\n Phase4 = 'Phase 4',\r\n\r\n}\r\n","export enum BulkUploadContentTypeEnum {\r\n CSDRMetadataSheet = 'CSDRMetadataSheet',\r\n VivliMetadataSheet = 'VivliMetadataSheet',\r\n IdsOnlySheet = 'IdsOnlySheet',\r\n}\r\n","export enum BulkUpdateContentTypeEnum {\r\n PostStudies = 'PostStudies',\r\n AwaitingCurationStudies = 'AwaitingCurationStudies',\r\n PropertyUpdate = 'PropertyUpdate',\r\n}\r\n","export enum StudyRequestBehaviorEnum {\r\n None = '',\r\n Vivli = 'Vivli',\r\n External = 'External',\r\n}\r\n","export enum DataPackageStatusEnum {\r\n Draft = 'Draft',\r\n Submitted = 'Submitted',\r\n}\r\n","export enum DataPackageTypeEnum {\r\n DataRequestMetadata = 'DataRequestMetadata',\r\n StudyMetadata = 'StudyMetadata',\r\n RequestedStudyIPD = 'RequestedStudyIPD',\r\n StudyIPD = 'StudyIPD',\r\n}\r\n","export enum DataPackageValidationModeEnum {\r\n Any = 'Any',\r\n All = 'All',\r\n}\r\n","export enum StudyTabEnum {\r\n Draft = 'Draft',\r\n InProgress = 'In Progress',\r\n Posted = 'Posted',\r\n Cancelled = 'Cancelled'\r\n}\r\n","export enum StudyDatasetAdminCtAmrTabEnum {\r\n StudyDetails = 'Study Details',\r\n DatasetDetails = \"Dataset Details\",\r\n AdministrativeDetails = 'Administrative Details',\r\n AmrDocuments = 'Dataset Documents',\r\n StudyDocuments = 'Study Documents',\r\n ResearchTeam = 'Research Team',\r\n History = 'History',\r\n Json = 'JSON',\r\n DataPackage = 'Data Package',\r\n Chat = 'Chat',\r\n Usage = 'Usage',\r\n Requests = 'Requests',\r\n}\r\n","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","export default /^(?:[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;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;","import { IUserDetails } from '@vivli/features/users/infrastructure/interface';\r\nimport moment from 'moment';\r\nimport { IReportItem } from '@vivli/shared/infrastructure/interface';\r\nimport { IStudy } from '@vivli/features/studies/infrastructure/interface';\r\nimport { StudyStatusEnum } from '@vivli/features/studies/infrastructure/enum';\r\nimport { v4 as uuid } from 'uuid';\r\nimport { IListingRequestSummary } from '@vivli/features/listing-request/infrastructure/interface';\r\n\r\nexport abstract class DataTransformationService {\r\n public static formatUserDetails = (user: IUserDetails): IUserDetails => {\r\n if (!user) {\r\n return user;\r\n }\r\n\r\n let roleName = null;\r\n\r\n if (user.isVivliAdmin) {\r\n roleName = '(Vivli Admin)';\r\n } else if (user.isOperationsAdmin) {\r\n roleName = '(Operations Admin)';\r\n }\r\n\r\n return {\r\n ...user,\r\n status: user.disabled ? 'Disabled' : 'Active',\r\n roleName,\r\n displayNameWithAdminStatus: roleName ? user.displayName + ' ' + roleName : user.displayName,\r\n };\r\n };\r\n\r\n public static formatUsersDetails = (users: IUserDetails[]): IUserDetails[] => {\r\n return users?.map(DataTransformationService.formatUserDetails);\r\n };\r\n\r\n public static formatDate = (date: Date | string): string => {\r\n return date ? moment(date).format('YYYY-MM-DD') : '';\r\n };\r\n\r\n public static formatReportItems = (items: any[]): IReportItem[] => {\r\n return items.map((reportItem) => {\r\n const firstPublicationDate = DataTransformationService.formatDate(reportItem.statusUpdate?.firstPublicationDate);\r\n const dateModified = DataTransformationService.formatDate(reportItem.dateModified);\r\n const dateSubmittedToDataContributor = DataTransformationService.formatDate(reportItem.dateSubmittedToDataContributor);\r\n const nextActionDate = DataTransformationService.formatDate(reportItem.statusUpdate?.nextActionDate);\r\n const nextActionDateLR = DataTransformationService.formatDate(reportItem.nextActionDate);\r\n const currentWorkflowStepStartDate = DataTransformationService.formatDate(reportItem.statusUpdate?.currentWorkflowStepStartDate);\r\n const vmBillingStartDate = DataTransformationService.formatDate(reportItem.statusUpdate?.vmBillingStartDate);\r\n const submittedDate = DataTransformationService.formatDate(reportItem.submittedDate);\r\n const postedDate = DataTransformationService.formatDate(reportItem.postedDate);\r\n const dateSubmitted = DataTransformationService.formatDate(reportItem.dateSubmitted);\r\n const studyFinalCompletionDate = DataTransformationService.formatDate(reportItem.studyFinalCompletionDate);\r\n const dateFinalResponse = DataTransformationService.formatDate(reportItem.dateFinalResponse);\r\n const lastUpdated = DataTransformationService.formatDate(reportItem.lastUpdated);\r\n const dateOriginalExecution = DataTransformationService.formatDate(reportItem.dateOriginalExecution);\r\n const dateCurrentExpiration = DataTransformationService.formatDate(reportItem.dateCurrentExpiration);\r\n const dateExecution = DataTransformationService.formatDate(reportItem.dateExecution);\r\n const dateExpiration = DataTransformationService.formatDate(reportItem.datedateExpiration);\r\n\r\n let realId = reportItem.id; //this is the real id of the data request\r\n if (reportItem.enquiryId) {\r\n realId = reportItem.enquiryId;\r\n }\r\n\r\n return {\r\n ...reportItem,\r\n submittedDate,\r\n postedDate,\r\n dateSubmitted,\r\n studyFinalCompletionDate,\r\n dateFinalResponse,\r\n nextActionDate: nextActionDateLR,\r\n dateModified,\r\n lastUpdated,\r\n dateOriginalExecution,\r\n dateCurrentExpiration,\r\n dateExecution,\r\n dateExpiration,\r\n realId: realId,\r\n id: uuid(), //guid used to guarantee we have a unique id in all cases\r\n dataContributorsList: reportItem.dataContributors?.split(';').filter((x) => x?.length > 0),\r\n resultsRemovalRequestsList: reportItem.resultsRemovalRequests?.split(';').filter((x) => x?.length > 0),\r\n statusUpdate: {\r\n ...reportItem.statusUpdate,\r\n firstPublicationDate,\r\n nextActionDate,\r\n currentWorkflowStepStartDate,\r\n vmBillingStartDate,\r\n requestReviewStatusList: reportItem.statusUpdate?.requestReviewStatus.split(';').filter((x) => x?.length > 0),\r\n dataUploadStatusList: reportItem.statusUpdate?.dataUploadStatus.split(';').filter((x) => x?.length > 0),\r\n duaStatusList: reportItem.statusUpdate?.duaStatus.split(';').filter((x) => x?.length > 0),\r\n },\r\n dateSubmittedToDataContributor,\r\n };\r\n });\r\n };\r\n\r\n public static mapStatusToMessage(status: StudyStatusEnum): string {\r\n switch (status) {\r\n case StudyStatusEnum.Draft:\r\n return 'Draft';\r\n case StudyStatusEnum.SubmittedToVivliForPreCheck:\r\n return 'Awaiting Vivli Review';\r\n case StudyStatusEnum.AwaitingCuration:\r\n return 'Awaiting Curation';\r\n case StudyStatusEnum.CurationInProgress:\r\n return 'Curation In Progress';\r\n case StudyStatusEnum.CurationInternalReview:\r\n return 'Curation Internal Curator Review';\r\n case StudyStatusEnum.AwaitingCurationQaReview:\r\n return 'Awaiting Curation QC Review';\r\n case StudyStatusEnum.CurationQaReviewInProgress:\r\n return 'Curation QC Review In Progress';\r\n case StudyStatusEnum.CurationRevisionsRequired:\r\n return 'Curation Revisions Requested';\r\n case StudyStatusEnum.CurationDiscussionsRequired:\r\n return 'Curation Requires Revisions from Curator';\r\n case StudyStatusEnum.CurationBlocked:\r\n return 'Curation Blocked Due to Issues';\r\n case StudyStatusEnum.SubmittedToVivliForPostCheck:\r\n return 'Awaiting Vivli Post Review';\r\n case StudyStatusEnum.SponsorApprovesCuration:\r\n return 'Study Sponsor Has Approved Curation';\r\n case StudyStatusEnum.SponsorRequiresCurationRevisions:\r\n return 'Study Sponsor Requested Curation Changes';\r\n case StudyStatusEnum.Posted:\r\n return 'Posted';\r\n case StudyStatusEnum.Cancelled:\r\n return 'Submission Cancelled';\r\n }\r\n\r\n return status;\r\n }\r\n\r\n public static getStudyDateDisplay = (study: IStudy) => {\r\n switch (study.status) {\r\n case StudyStatusEnum.Draft:\r\n return DataTransformationService.formatDate(study.draftCreatedDate);\r\n break;\r\n case StudyStatusEnum.Posted:\r\n case StudyStatusEnum.Cancelled:\r\n return DataTransformationService.formatDate(study.postedDate);\r\n break;\r\n default:\r\n return DataTransformationService.formatDate(study.submittedDate);\r\n }\r\n };\r\n\r\n public static formatStudy = (study: IStudy) => {\r\n return {\r\n ...study,\r\n studyStatusDisplay: DataTransformationService.mapStatusToMessage(study.status),\r\n dateDisplay: DataTransformationService.getStudyDateDisplay(study),\r\n };\r\n };\r\n\r\n public static formatStudies = (studies: IStudy[]) => {\r\n return studies.map(DataTransformationService.formatStudy);\r\n };\r\n\r\n public static formatListingRequestSummary = (listingRequestSummary: IListingRequestSummary) => {\r\n return {\r\n ...listingRequestSummary,\r\n createdDateDisplay: DataTransformationService.formatDate(listingRequestSummary.createdDate),\r\n submittedDateDisplay: DataTransformationService.formatDate(listingRequestSummary.submittedDate),\r\n approvedDateDisplay: DataTransformationService.formatDate(listingRequestSummary.approvedDate),\r\n withdrawnDateDisplay: DataTransformationService.formatDate(listingRequestSummary.withdrawnDate),\r\n };\r\n };\r\n\r\n public static formatListingRequestSummaries = (listingRequestSummaries: IListingRequestSummary[]) => {\r\n return listingRequestSummaries.map(DataTransformationService.formatListingRequestSummary);\r\n };\r\n}\r\n","export type storageType = 'local' | 'session';\r\n\r\nexport abstract class StorageService {\r\n\r\n static setItem(key: string, item: any, type: storageType = 'local'): boolean {\r\n try {\r\n this._setByType(key, item, type);\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n }\r\n\r\n static getItem(key: string, type: storageType = 'local'): T {\r\n try {\r\n return this._getByType(key, type);\r\n } catch {\r\n return null;\r\n }\r\n }\r\n\r\n static deleteItem(key, type: storageType = 'local'): void {\r\n try {\r\n this._deleteByType(key, type);\r\n } catch { }\r\n }\r\n\r\n private static _getStorage(type: storageType): Storage {\r\n switch (type) {\r\n case \"local\":\r\n return localStorage;\r\n case \"session\":\r\n return sessionStorage;\r\n }\r\n }\r\n\r\n private static _deleteByType(key: string, type: storageType): void {\r\n const storage = this._getStorage(type);\r\n storage.removeItem(key);\r\n }\r\n\r\n private static _setByType(key: string, item: any, type: storageType) {\r\n const storage = this._getStorage(type);\r\n const storageItem = JSON.stringify({ value: item });\r\n storage.setItem(key, storageItem);\r\n }\r\n\r\n private static _getByType(key: string, type: storageType): T {\r\n const storage = this._getStorage(type);\r\n const storageItem = storage.getItem(key);\r\n const parsedItem = JSON.parse(storageItem);\r\n\r\n return parsedItem.value as T;\r\n }\r\n}\r\n","export enum PicoTypeEnum {\r\n P = 'P',\r\n I = 'I',\r\n C = 'C',\r\n O = 'O',\r\n None = 'None',\r\n}\r\n","export enum GridCellRendererEnum {\r\n GridCellList = 'GridCellList',\r\n GridCheckbox = 'GridCheckbox',\r\n GridCellLargeText = 'GridCellLargeText',\r\n DataRequestDate = 'DataRequestDate',\r\n DataRequestStatus = 'DataRequestStatus',\r\n DataRequestTitle = 'DataRequestTitle',\r\n MyDataRequestTitle = 'MyDataRequestTitle',\r\n GridDataStudyButton = 'GridDataStudyButton',\r\n GridCellDateTime = 'GridCellDateTime',\r\n}\r\n","export enum FormFieldTypeEnum {\r\n Text,\r\n TextArea,\r\n DropDown,\r\n Checkbox,\r\n CheckboxList,\r\n Date,\r\n RadioGroup,\r\n YesNoRadio,\r\n Radio\r\n}\r\n","export enum AssignedAppTypeEnum {\r\n Default = 'Default',\r\n Amr = 'Amr'\r\n}\r\n","export enum TranslationKeyEnum {\r\n isDefault = 'isDefault',\r\n Vivli = 'Vivli',\r\n picoButton = 'picoButton',\r\n studies = 'studies',\r\n study = 'study',\r\n welcomeMessage = 'welcomeMessage',\r\n studyID = 'studyID',\r\n studyType = 'studyType',\r\n fileUploadInstructions = 'fileUploadInstructions',\r\n popUpWelcomeMessage = 'popUpWelcomeMessage',\r\n title = 'title',\r\n update = 'update',\r\n duaValidatedStatusString = 'duaValidatedStatusString',\r\n chatHelperText = 'chatHelperText',\r\n howToGuideLink = 'howToGuideLink',\r\n privacyLink = 'privacyLink',\r\n cookiePolicyLink = 'cookiePolicyLink',\r\n eeaDisclosurePolicyLink = 'eeaDisclosurePolicyLink',\r\n contactUsLink = 'contactUsLink',\r\n vmResearchEnvironmentConfig = 'vmResearchEnvironmentConfig',\r\n pathway2SubmitConfirmText = 'pathway2SubmitConfirmText',\r\n accessDataPackagesIPD = 'accessDataPackagesIPD',\r\n accessDPResearchEnvironment = 'accessDPResearchEnvironment',\r\n}\r\n","export enum LocalStorageKeyEnum {\r\n ShowWelcomePopup = 'show-welcome-popup',\r\n CustomPortalName = 'custom-portal-name',\r\n ShowIpdSubmitConfirmation = 'show-ipd-submit-confirmation',\r\n}\r\n","export enum LoadIndicatorSizeEnum {\r\n Small = 'small',\r\n Medium = 'medium',\r\n Large = 'large',\r\n}\r\n","export enum LoadIndicatorColorEnum {\r\n Blue = 'blue',\r\n White = 'white',\r\n DarkerGreen = 'darker-green',\r\n ErrorRed = 'error-red',\r\n}\r\n","export enum ReportDataTypeEnum {\r\n DataRequest = 'DataRequest',\r\n ListingRequest = 'ListingRequest',\r\n DataSet = 'DataSet',\r\n Enquiry = 'Enquiry',\r\n DuaDetail = 'DuaDetail'\r\n}\r\n","import { IEnvironment } from './environment.interface';\r\nimport { AssignedAppTypeEnum } from '@vivli/shared/infrastructure/enum';\r\n\r\nlet assignedAppType = AssignedAppTypeEnum.Default;\r\n\r\nif (import.meta.env.VITE_ASSIGNED_APP_TYPE.toLowerCase().includes('amr')) {\r\n assignedAppType = AssignedAppTypeEnum.Amr;\r\n}\r\nexport const environment: IEnvironment = {\r\n production: import.meta.env.VITE_IS_PRODUCTION === 'true',\r\n isLocal: import.meta.env.VITE_IS_LOCAL === 'true',\r\n useStrictMode: import.meta.env.VITE_USE_STRICT_MODE === 'true',\r\n assignedAppType: assignedAppType,\r\n isLoggerEnabled: import.meta.env.VITE_IS_LOGGER_ENABLED === 'true',\r\n isAutomation: import.meta.env.VITE_IS_AUTOMATION === 'true',\r\n viewRequestResultsOnly: import.meta.env.VITE_VIEW_REQUEST_RESULTS_ONLY === 'true',\r\n useIntercepts: import.meta.env.VITE_USE_INTERCEPTS === 'true',\r\n};\r\n","import {StorageService} from \"./storage.service\";\r\nimport {environment} from \"@vivli/core/environments\";\r\n\r\nconst activeKeyStorageName = 'current-debug-key';\r\n\r\nenum ErrorTypeEnum {\r\n All = 'all',\r\n Info = 'info',\r\n Error = 'error',\r\n Warn = 'warn',\r\n Debug = 'debug'\r\n}\r\n\r\nconst getActiveKey = (): string => {\r\n const params = new URLSearchParams(window.location.search);\r\n\r\n let key = params.get('debug-key');\r\n\r\n // logger bypass for local development\r\n if (environment.isLoggerEnabled) {\r\n key = 'all'\r\n }\r\n\r\n if (key) {\r\n StorageService.setItem(activeKeyStorageName, key, 'session');\r\n } else {\r\n key = StorageService.getItem(activeKeyStorageName, 'session');\r\n }\r\n\r\n return key;\r\n}\r\n\r\nexport abstract class LoggerService {\r\n\r\n public static info = (message: any, ...optionalParams: any[]) => {\r\n const activeKey = getActiveKey();\r\n if (activeKey === ErrorTypeEnum.Info || activeKey === ErrorTypeEnum.All) {\r\n console.info(message, optionalParams)\r\n }\r\n }\r\n\r\n public static error = (message: any, ...optionalParams: any[]) => {\r\n const activeKey = getActiveKey();\r\n if (activeKey === ErrorTypeEnum.Error || activeKey === ErrorTypeEnum.All) {\r\n console.error(message, optionalParams);\r\n }\r\n }\r\n\r\n public static warn = (message: any, ...optionalParams: any[]) => {\r\n const activeKey = getActiveKey();\r\n if (activeKey === ErrorTypeEnum.Warn || activeKey === ErrorTypeEnum.All) {\r\n console.warn(message, optionalParams);\r\n }\r\n }\r\n\r\n public static debug = (message: any, ...optionalParams: any[]) => {\r\n const activeKey = getActiveKey();\r\n if (activeKey === ErrorTypeEnum.Debug || activeKey === ErrorTypeEnum.All) {\r\n console.debug(message, optionalParams);\r\n }\r\n }\r\n\r\n public static log = (message: any, ...optionalParams: any[]) => {\r\n const activeKey = getActiveKey();\r\n if (activeKey === ErrorTypeEnum.All) {\r\n console.log(message, optionalParams);\r\n }\r\n }\r\n}\r\n","/*!\n * @license Copyright 2015-2022 Ably Real-time Ltd (ably.com)\n * \n * Ably JavaScript Library v1.2.44\n * https://github.com/ably/ably-js\n * \n * Released under the Apache Licence v2.0\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Ably\"] = factory();\n\telse\n\t\troot[\"Ably\"] = factory();\n})(window, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 42);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__extends\", function() { return __extends; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__assign\", function() { return __assign; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__rest\", function() { return __rest; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__decorate\", function() { return __decorate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__param\", function() { return __param; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__metadata\", function() { return __metadata; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__awaiter\", function() { return __awaiter; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__generator\", function() { return __generator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__createBinding\", function() { return __createBinding; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__exportStar\", function() { return __exportStar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__values\", function() { return __values; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__read\", function() { return __read; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__spread\", function() { return __spread; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__spreadArrays\", function() { return __spreadArrays; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__spreadArray\", function() { return __spreadArray; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__await\", function() { return __await; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncGenerator\", function() { return __asyncGenerator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncDelegator\", function() { return __asyncDelegator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__asyncValues\", function() { return __asyncValues; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__makeTemplateObject\", function() { return __makeTemplateObject; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__importStar\", function() { return __importStar; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__importDefault\", function() { return __importDefault; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__classPrivateFieldGet\", function() { return __classPrivateFieldGet; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"__classPrivateFieldSet\", function() { return __classPrivateFieldSet; });\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nfunction __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nfunction __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nfunction __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nvar __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nfunction __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nfunction __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nfunction __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nfunction __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nfunction __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nfunction __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nfunction __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nfunction __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nfunction __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nfunction __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nfunction __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nfunction __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nfunction __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nfunction __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nfunction __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.allToUpperCase = exports.allToLowerCase = exports.encodeBody = exports.decodeBody = exports.Format = exports.promisify = exports.trim = exports.arrChooseN = exports.randomHexString = exports.randomString = exports.cheapRandStr = exports.dataSizeBytes = exports.inspectBody = exports.inspectError = exports.isErrorInfoOrPartialErrorInfo = exports.now = exports.parseQueryString = exports.toQueryString = exports.arrPopRandomElement = exports.defaultPostHeaders = exports.defaultGetHeaders = exports.allSame = exports.arrEvery = exports.arrFilter = exports.arrMap = exports.safeArrForEach = exports.arrForEach = exports.forInOwnNonNullProperties = exports.valuesArray = exports.keysArray = exports.arrWithoutValue = exports.arrDeleteValue = exports.arrIn = exports.arrIndexOf = exports.arrSubtract = exports.arrIntersectOb = exports.arrIntersect = exports.intersect = exports.containsValue = exports.inherits = exports.prototypicalClone = exports.shallowClone = exports.isEmptyArg = exports.isOnlyPropIn = exports.isEmpty = exports.isObject = exports.ensureArray = exports.isArray = exports.copy = exports.mixin = void 0;\nexports.toBase64 = exports.matchDerivedChannel = exports.shallowEquals = exports.getGlobalObject = exports.getRetryTime = exports.getJitterCoefficient = exports.getBackoffCoefficient = void 0;\nvar tslib_1 = __webpack_require__(0);\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar defaults_1 = tslib_1.__importStar(__webpack_require__(8));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar enc_base64_1 = __webpack_require__(11);\nvar enc_utf8_1 = __webpack_require__(31);\nfunction randomPosn(arrOrStr) {\n return Math.floor(Math.random() * arrOrStr.length);\n}\n/*\n * Add a set of properties to a target object\n * target: the target object\n * props: an object whose enumerable properties are\n * added, by reference only\n */\nfunction mixin(target) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n for (var i = 0; i < args.length; i++) {\n var source = args[i];\n if (!source) {\n break;\n }\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n for (var key in source) {\n if (!hasOwnProperty || hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n}\nexports.mixin = mixin;\n/*\n * Add a set of properties to a target object\n * target: the target object\n * props: an object whose enumerable properties are\n * added, by reference only\n */\nfunction copy(src) {\n return mixin({}, src);\n}\nexports.copy = copy;\n/*\n * Determine whether or not a given object is\n * an array.\n */\nexports.isArray = Array.isArray ||\n function (value) {\n return Object.prototype.toString.call(value) == '[object Array]';\n };\n/*\n * Ensures that an Array object is always returned\n * returning the original Array of obj is an Array\n * else wrapping the obj in a single element Array\n */\nfunction ensureArray(obj) {\n if (isEmptyArg(obj)) {\n return [];\n }\n if ((0, exports.isArray)(obj)) {\n return obj;\n }\n return [obj];\n}\nexports.ensureArray = ensureArray;\nfunction isObject(ob) {\n return Object.prototype.toString.call(ob) == '[object Object]';\n}\nexports.isObject = isObject;\n/*\n * Determine whether or not an object contains\n * any enumerable properties.\n * ob: the object\n */\nfunction isEmpty(ob) {\n for (var prop in ob)\n return false;\n return true;\n}\nexports.isEmpty = isEmpty;\nfunction isOnlyPropIn(ob, property) {\n for (var prop in ob) {\n if (prop !== property) {\n return false;\n }\n }\n return true;\n}\nexports.isOnlyPropIn = isOnlyPropIn;\n/*\n * Determine whether or not an argument to an overloaded function is\n * undefined (missing) or null.\n * This method is useful when constructing functions such as (WebIDL terminology):\n * off([TreatUndefinedAs=Null] DOMString? event)\n * as you can then confirm the argument using:\n * Utils.isEmptyArg(event)\n */\nfunction isEmptyArg(arg) {\n return arg === null || arg === undefined;\n}\nexports.isEmptyArg = isEmptyArg;\n/*\n * Perform a simple shallow clone of an object.\n * Result is an object irrespective of whether\n * the input is an object or array. All\n * enumerable properties are copied.\n * ob: the object\n */\nfunction shallowClone(ob) {\n var result = new Object();\n for (var prop in ob)\n result[prop] = ob[prop];\n return result;\n}\nexports.shallowClone = shallowClone;\n/*\n * Clone an object by creating a new object with the\n * given object as its prototype. Optionally\n * a set of additional own properties can be\n * supplied to be added to the newly created clone.\n * ob: the object to be cloned\n * ownProperties: optional object with additional\n * properties to add\n */\nfunction prototypicalClone(ob, ownProperties) {\n var F = /** @class */ (function () {\n function F() {\n }\n return F;\n }());\n F.prototype = ob;\n var result = new F();\n if (ownProperties)\n mixin(result, ownProperties);\n return result;\n}\nexports.prototypicalClone = prototypicalClone;\n/*\n * Declare a constructor to represent a subclass\n * of another constructor\n * If platform has a built-in version we use that from Platform, else we\n * define here (so can make use of other Utils fns)\n * See node.js util.inherits\n */\nvar inherits = function (ctor, superCtor) {\n if (platform_1.default.Config.inherits) {\n platform_1.default.Config.inherits(ctor, superCtor);\n return;\n }\n ctor.super_ = superCtor;\n ctor.prototype = prototypicalClone(superCtor.prototype, { constructor: ctor });\n};\nexports.inherits = inherits;\n/*\n * Determine whether or not an object has an enumerable\n * property whose value equals a given value.\n * ob: the object\n * val: the value to find\n */\nfunction containsValue(ob, val) {\n for (var i in ob) {\n if (ob[i] == val)\n return true;\n }\n return false;\n}\nexports.containsValue = containsValue;\nfunction intersect(arr, ob) {\n return (0, exports.isArray)(ob) ? arrIntersect(arr, ob) : arrIntersectOb(arr, ob);\n}\nexports.intersect = intersect;\nfunction arrIntersect(arr1, arr2) {\n var result = [];\n for (var i = 0; i < arr1.length; i++) {\n var member = arr1[i];\n if ((0, exports.arrIndexOf)(arr2, member) != -1)\n result.push(member);\n }\n return result;\n}\nexports.arrIntersect = arrIntersect;\nfunction arrIntersectOb(arr, ob) {\n var result = [];\n for (var i = 0; i < arr.length; i++) {\n var member = arr[i];\n if (member in ob)\n result.push(member);\n }\n return result;\n}\nexports.arrIntersectOb = arrIntersectOb;\nfunction arrSubtract(arr1, arr2) {\n var result = [];\n for (var i = 0; i < arr1.length; i++) {\n var element = arr1[i];\n if ((0, exports.arrIndexOf)(arr2, element) == -1)\n result.push(element);\n }\n return result;\n}\nexports.arrSubtract = arrSubtract;\nexports.arrIndexOf = Array.prototype.indexOf\n ? function (arr, elem, fromIndex) {\n return arr.indexOf(elem, fromIndex);\n }\n : function (arr, elem, fromIndex) {\n fromIndex = fromIndex || 0;\n var len = arr.length;\n for (; fromIndex < len; fromIndex++) {\n if (arr[fromIndex] === elem) {\n return fromIndex;\n }\n }\n return -1;\n };\nfunction arrIn(arr, val) {\n return (0, exports.arrIndexOf)(arr, val) !== -1;\n}\nexports.arrIn = arrIn;\nfunction arrDeleteValue(arr, val) {\n var idx = (0, exports.arrIndexOf)(arr, val);\n var res = idx != -1;\n if (res)\n arr.splice(idx, 1);\n return res;\n}\nexports.arrDeleteValue = arrDeleteValue;\nfunction arrWithoutValue(arr, val) {\n var newArr = arr.slice();\n arrDeleteValue(newArr, val);\n return newArr;\n}\nexports.arrWithoutValue = arrWithoutValue;\n/*\n * Construct an array of the keys of the enumerable\n * properties of a given object, optionally limited\n * to only the own properties.\n * ob: the object\n * ownOnly: boolean, get own properties only\n */\nfunction keysArray(ob, ownOnly) {\n var result = [];\n for (var prop in ob) {\n if (ownOnly && !Object.prototype.hasOwnProperty.call(ob, prop))\n continue;\n result.push(prop);\n }\n return result;\n}\nexports.keysArray = keysArray;\n/*\n * Construct an array of the values of the enumerable\n * properties of a given object, optionally limited\n * to only the own properties.\n * ob: the object\n * ownOnly: boolean, get own properties only\n */\nfunction valuesArray(ob, ownOnly) {\n var result = [];\n for (var prop in ob) {\n if (ownOnly && !Object.prototype.hasOwnProperty.call(ob, prop))\n continue;\n result.push(ob[prop]);\n }\n return result;\n}\nexports.valuesArray = valuesArray;\nfunction forInOwnNonNullProperties(ob, fn) {\n for (var prop in ob) {\n if (Object.prototype.hasOwnProperty.call(ob, prop) && ob[prop]) {\n fn(prop);\n }\n }\n}\nexports.forInOwnNonNullProperties = forInOwnNonNullProperties;\nexports.arrForEach = Array.prototype.forEach\n ? function (arr, fn) {\n arr.forEach(fn);\n }\n : function (arr, fn) {\n var len = arr.length;\n for (var i = 0; i < len; i++) {\n fn(arr[i], i, arr);\n }\n };\n/* Useful when the function may mutate the array */\nfunction safeArrForEach(arr, fn) {\n return (0, exports.arrForEach)(arr.slice(), fn);\n}\nexports.safeArrForEach = safeArrForEach;\nexports.arrMap = Array.prototype.map\n ? function (arr, fn) {\n return arr.map(fn);\n }\n : function (arr, fn) {\n var result = [];\n var len = arr.length;\n for (var i = 0; i < len; i++) {\n result.push(fn(arr[i], i, arr));\n }\n return result;\n };\nexports.arrFilter = Array.prototype.filter\n ? function (arr, fn) {\n return arr.filter(fn);\n }\n : function (arr, fn) {\n var result = [], len = arr.length;\n for (var i = 0; i < len; i++) {\n if (fn(arr[i])) {\n result.push(arr[i]);\n }\n }\n return result;\n };\nexports.arrEvery = Array.prototype.every\n ? function (arr, fn) {\n return arr.every(fn);\n }\n : function (arr, fn) {\n var len = arr.length;\n for (var i = 0; i < len; i++) {\n if (!fn(arr[i], i, arr)) {\n return false;\n }\n }\n return true;\n };\nfunction allSame(arr, prop) {\n if (arr.length === 0) {\n return true;\n }\n var first = arr[0][prop];\n return (0, exports.arrEvery)(arr, function (item) {\n return item[prop] === first;\n });\n}\nexports.allSame = allSame;\nvar contentTypes = {\n json: 'application/json',\n jsonp: 'application/javascript',\n xml: 'application/xml',\n html: 'text/html',\n msgpack: 'application/x-msgpack',\n};\nfunction defaultGetHeaders(options, format) {\n var accept = contentTypes[format || Format.json];\n return {\n accept: accept,\n 'X-Ably-Version': defaults_1.default.protocolVersion.toString(),\n 'Ably-Agent': (0, defaults_1.getAgentString)(options),\n };\n}\nexports.defaultGetHeaders = defaultGetHeaders;\nfunction defaultPostHeaders(options, format) {\n var contentType;\n var accept = (contentType = contentTypes[format || Format.json]);\n return {\n accept: accept,\n 'content-type': contentType,\n 'X-Ably-Version': defaults_1.default.protocolVersion.toString(),\n 'Ably-Agent': (0, defaults_1.getAgentString)(options),\n };\n}\nexports.defaultPostHeaders = defaultPostHeaders;\nfunction arrPopRandomElement(arr) {\n return arr.splice(randomPosn(arr), 1)[0];\n}\nexports.arrPopRandomElement = arrPopRandomElement;\nfunction toQueryString(params) {\n var parts = [];\n if (params) {\n for (var key in params)\n parts.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));\n }\n return parts.length ? '?' + parts.join('&') : '';\n}\nexports.toQueryString = toQueryString;\nfunction parseQueryString(query) {\n var match;\n var search = /([^?&=]+)=?([^&]*)/g;\n var result = {};\n while ((match = search.exec(query)))\n result[decodeURIComponent(match[1])] = decodeURIComponent(match[2]);\n return result;\n}\nexports.parseQueryString = parseQueryString;\nexports.now = Date.now ||\n function () {\n /* IE 8 */\n return new Date().getTime();\n };\nfunction isErrorInfoOrPartialErrorInfo(err) {\n return (typeof err == 'object' &&\n err !== null &&\n (err.constructor.name == 'ErrorInfo' || err.constructor.name == 'PartialErrorInfo'));\n}\nexports.isErrorInfoOrPartialErrorInfo = isErrorInfoOrPartialErrorInfo;\nfunction inspectError(err) {\n var _a, _b;\n if (err instanceof Error ||\n ((_a = err === null || err === void 0 ? void 0 : err.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'ErrorInfo' ||\n ((_b = err === null || err === void 0 ? void 0 : err.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'PartialErrorInfo')\n return err.toString();\n return platform_1.default.Config.inspect(err);\n}\nexports.inspectError = inspectError;\nfunction inspectBody(body) {\n if (platform_1.default.BufferUtils.isBuffer(body)) {\n return body.toString();\n }\n else if (typeof body === 'string') {\n return body;\n }\n else {\n return platform_1.default.Config.inspect(body);\n }\n}\nexports.inspectBody = inspectBody;\n/* Data is assumed to be either a string or a buffer. */\nfunction dataSizeBytes(data) {\n if (platform_1.default.BufferUtils.isBuffer(data)) {\n return platform_1.default.BufferUtils.byteLength(data);\n }\n if (typeof data === 'string') {\n return platform_1.default.Config.stringByteSize(data);\n }\n throw new Error('Expected input of Utils.dataSizeBytes to be a buffer or string, but was: ' + typeof data);\n}\nexports.dataSizeBytes = dataSizeBytes;\nfunction cheapRandStr() {\n return String(Math.random()).substr(2);\n}\nexports.cheapRandStr = cheapRandStr;\n/* Takes param the minimum number of bytes of entropy the string must\n * include, not the length of the string. String length produced is not\n * guaranteed. */\nvar randomString = function (numBytes) {\n if (platform_1.default.Config.getRandomValues && typeof Uint8Array !== 'undefined') {\n var uIntArr = new Uint8Array(numBytes);\n platform_1.default.Config.getRandomValues(uIntArr);\n return platform_1.default.BufferUtils.base64Encode(uIntArr);\n }\n /* Old browser; fall back to Math.random. Could just use a\n * CryptoJS version of the above, but want this to still work in nocrypto\n * versions of the library */\n var charset = platform_1.default.BufferUtils.base64CharSet;\n /* base64 has 33% overhead; round length up */\n var length = Math.round((numBytes * 4) / 3);\n var result = '';\n for (var i = 0; i < length; i++) {\n result += charset[randomPosn(charset)];\n }\n return result;\n};\nexports.randomString = randomString;\nvar randomHexString = function (numBytes) {\n if (platform_1.default.Config.getRandomValues && typeof Uint8Array !== 'undefined') {\n var uIntArr = new Uint8Array(numBytes);\n platform_1.default.Config.getRandomValues(uIntArr);\n return platform_1.default.BufferUtils.hexEncode(uIntArr);\n }\n var charset = platform_1.default.BufferUtils.hexCharSet;\n var length = numBytes * 2;\n var result = '';\n for (var i = 0; i < length; i++) {\n result += charset[randomPosn(charset)];\n }\n return result;\n};\nexports.randomHexString = randomHexString;\n/* Pick n elements at random without replacement from an array */\nfunction arrChooseN(arr, n) {\n var numItems = Math.min(n, arr.length), mutableArr = arr.slice(), result = [];\n for (var i = 0; i < numItems; i++) {\n result.push(arrPopRandomElement(mutableArr));\n }\n return result;\n}\nexports.arrChooseN = arrChooseN;\nexports.trim = String.prototype.trim\n ? function (str) {\n return str.trim();\n }\n : function (str) {\n return str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n };\nfunction promisify(ob, fnName, args) {\n return new Promise(function (resolve, reject) {\n ob[fnName].apply(ob, tslib_1.__spreadArray(tslib_1.__spreadArray([], args, false), [function (err, res) {\n err ? reject(err) : resolve(res);\n }], false));\n });\n}\nexports.promisify = promisify;\nvar Format;\n(function (Format) {\n Format[\"msgpack\"] = \"msgpack\";\n Format[\"json\"] = \"json\";\n})(Format = exports.Format || (exports.Format = {}));\nfunction decodeBody(body, format) {\n return format == 'msgpack' ? platform_1.default.Config.msgpack.decode(body) : JSON.parse(String(body));\n}\nexports.decodeBody = decodeBody;\nfunction encodeBody(body, format) {\n return format == 'msgpack' ? platform_1.default.Config.msgpack.encode(body, true) : JSON.stringify(body);\n}\nexports.encodeBody = encodeBody;\nfunction allToLowerCase(arr) {\n return arr.map(function (element) {\n return element && element.toLowerCase();\n });\n}\nexports.allToLowerCase = allToLowerCase;\nfunction allToUpperCase(arr) {\n return arr.map(function (element) {\n return element && element.toUpperCase();\n });\n}\nexports.allToUpperCase = allToUpperCase;\nfunction getBackoffCoefficient(count) {\n return Math.min((count + 2) / 3, 2);\n}\nexports.getBackoffCoefficient = getBackoffCoefficient;\nfunction getJitterCoefficient() {\n return 1 - Math.random() * 0.2;\n}\nexports.getJitterCoefficient = getJitterCoefficient;\n/**\n *\n * @param initialTimeout initial timeout value\n * @param retryAttempt integer indicating retryAttempt\n * @returns RetryTimeout value for given timeout and retryAttempt.\n * If x is the value generated then,\n * Upper bound = min((retryAttempt + 2) / 3, 2) * initialTimeout,\n * Lower bound = 0.8 * Upper bound,\n * Lower bound < x < Upper bound\n */\nfunction getRetryTime(initialTimeout, retryAttempt) {\n return initialTimeout * getBackoffCoefficient(retryAttempt) * getJitterCoefficient();\n}\nexports.getRetryTime = getRetryTime;\nfunction getGlobalObject() {\n if (global) {\n return global;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n return self;\n}\nexports.getGlobalObject = getGlobalObject;\nfunction shallowEquals(source, target) {\n return (Object.keys(source).every(function (key) { return source[key] === target[key]; }) &&\n Object.keys(target).every(function (key) { return target[key] === source[key]; }));\n}\nexports.shallowEquals = shallowEquals;\nfunction matchDerivedChannel(name) {\n /**\n * This regex check is to retain existing channel params if any e.g [?rewind=1]foo to\n * [filter=xyz?rewind=1]foo. This is to keep channel compatibility around use of\n * channel params that work with derived channels.\n *\n * This eslint unsafe regex warning is triggered because the RegExp uses nested quantifiers,\n * but it does not create any situation where the regex engine has to\n * explore a large number of possible matches so it’s safe to ignore\n */\n var regex = /^(\\[([^?]*)(?:(.*))\\])?(.+)$/; // eslint-disable-line\n var match = name.match(regex);\n if (!match || !match.length || match.length < 5) {\n throw new errorinfo_1.default('regex match failed', 400, 40010);\n }\n // Fail if there is already a channel qualifier, eg [meta]foo should fail instead of just overriding with [filter=xyz]foo\n if (match[2]) {\n throw new errorinfo_1.default(\"cannot use a derived option with a \".concat(match[2], \" channel\"), 400, 40010);\n }\n // Return match values to be added to derive channel quantifier.\n return {\n qualifierParam: match[3] || '',\n channelName: match[4],\n };\n}\nexports.matchDerivedChannel = matchDerivedChannel;\nfunction toBase64(str) {\n if (platform_1.default.Config.createHmac) {\n return Buffer.from(str, 'ascii').toString('base64');\n }\n return (0, enc_base64_1.stringify)((0, enc_utf8_1.parse)(str));\n}\nexports.toBase64 = toBase64;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13)))\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\n// Workaround for salesforce lightning locker compatibility\n// This is a shorthand version of Utils.getGlobalObject (which we can't use here without creating a circular import)\nvar globalObject = global || (typeof window !== 'undefined' ? window : self);\nvar LogLevels;\n(function (LogLevels) {\n LogLevels[LogLevels[\"None\"] = 0] = \"None\";\n LogLevels[LogLevels[\"Error\"] = 1] = \"Error\";\n LogLevels[LogLevels[\"Major\"] = 2] = \"Major\";\n LogLevels[LogLevels[\"Minor\"] = 3] = \"Minor\";\n LogLevels[LogLevels[\"Micro\"] = 4] = \"Micro\";\n})(LogLevels || (LogLevels = {}));\nfunction pad(timeSegment, three) {\n return \"\".concat(timeSegment).padStart(three ? 3 : 2, '0');\n}\nfunction getHandler(logger) {\n return platform_1.default.Config.logTimestamps\n ? function (msg) {\n var time = new Date();\n logger(pad(time.getHours()) +\n ':' +\n pad(time.getMinutes()) +\n ':' +\n pad(time.getSeconds()) +\n '.' +\n pad(time.getMilliseconds(), 1) +\n ' ' +\n msg);\n }\n : logger;\n}\nvar getDefaultLoggers = function () {\n var _a, _b;\n var consoleLogger;\n var errorLogger;\n /* Can't just check for console && console.log; fails in IE <=9 */\n if ((typeof Window === 'undefined' && typeof WorkerGlobalScope === 'undefined') /* node */ ||\n typeof ((_b = (_a = globalObject === null || globalObject === void 0 ? void 0 : globalObject.console) === null || _a === void 0 ? void 0 : _a.log) === null || _b === void 0 ? void 0 : _b.apply) === 'function' /* sensible browsers */) {\n consoleLogger = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n console.log.apply(console, args);\n };\n errorLogger = console.warn\n ? function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n console.warn.apply(console, args);\n }\n : consoleLogger;\n }\n else if (globalObject === null || globalObject === void 0 ? void 0 : globalObject.console.log) {\n /* IE <= 9 with the console open -- console.log does not\n * inherit from Function, so has no apply method */\n consoleLogger = errorLogger = function () {\n Function.prototype.apply.call(console.log, console, arguments);\n };\n }\n else {\n /* IE <= 9 when dev tools are closed - window.console not even defined */\n consoleLogger = errorLogger = function () { };\n }\n return [consoleLogger, errorLogger].map(getHandler);\n};\nvar Logger = /** @class */ (function () {\n function Logger() {\n Logger.logLevel = Logger.LOG_DEFAULT;\n }\n Logger.initLogHandlers = function () {\n var _a = getDefaultLoggers(), logHandler = _a[0], logErrorHandler = _a[1];\n this.logHandler = logHandler;\n this.logErrorHandler = logErrorHandler;\n };\n Logger.logLevel = LogLevels.Error; // default logLevel\n // public constants\n Logger.LOG_NONE = LogLevels.None;\n Logger.LOG_ERROR = LogLevels.Error;\n Logger.LOG_MAJOR = LogLevels.Major;\n Logger.LOG_MINOR = LogLevels.Minor;\n Logger.LOG_MICRO = LogLevels.Micro;\n // aliases\n Logger.LOG_DEFAULT = LogLevels.Error;\n Logger.LOG_DEBUG = LogLevels.Micro;\n /* public static functions */\n Logger.logAction = function (level, action, message) {\n if (Logger.shouldLog(level)) {\n (level === LogLevels.Error ? Logger.logErrorHandler : Logger.logHandler)('Ably: ' + action + ': ' + message);\n }\n };\n Logger.deprecated = function (original, replacement) {\n Logger.deprecatedWithMsg(original, \"Please use '\" + replacement + \"' instead.\");\n };\n Logger.deprecatedWithMsg = function (funcName, msg) {\n if (Logger.shouldLog(LogLevels.Error)) {\n Logger.logErrorHandler(\"Ably: Deprecation warning - '\" + funcName + \"' is deprecated and will be removed from a future version. \" + msg);\n }\n };\n /* Where a logging operation is expensive, such as serialisation of data, use shouldLog will prevent\n the object being serialised if the log level will not output the message */\n Logger.shouldLog = function (level) {\n return level <= Logger.logLevel;\n };\n Logger.setLog = function (level, handler) {\n if (level !== undefined)\n Logger.logLevel = level;\n if (handler !== undefined)\n Logger.logHandler = Logger.logErrorHandler = handler;\n };\n return Logger;\n}());\nexports.default = Logger;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13)))\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar Platform = /** @class */ (function () {\n function Platform() {\n }\n return Platform;\n}());\nexports.default = Platform;\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PartialErrorInfo = void 0;\nvar tslib_1 = __webpack_require__(0);\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nfunction toString(err) {\n var result = '[' + err.constructor.name;\n if (err.message)\n result += ': ' + err.message;\n if (err.statusCode)\n result += '; statusCode=' + err.statusCode;\n if (err.code)\n result += '; code=' + err.code;\n if (err.cause)\n result += '; cause=' + Utils.inspectError(err.cause);\n if (err.href && !(err.message && err.message.indexOf('help.ably.io') > -1))\n result += '; see ' + err.href + ' ';\n result += ']';\n return result;\n}\nvar ErrorInfo = /** @class */ (function (_super) {\n tslib_1.__extends(ErrorInfo, _super);\n function ErrorInfo(message, code, statusCode, cause) {\n var _this = _super.call(this, message) || this;\n if (typeof Object.setPrototypeOf !== 'undefined') {\n Object.setPrototypeOf(_this, ErrorInfo.prototype);\n }\n _this.code = code;\n _this.statusCode = statusCode;\n _this.cause = cause;\n return _this;\n }\n ErrorInfo.prototype.toString = function () {\n return toString(this);\n };\n ErrorInfo.fromValues = function (values) {\n var _a = values, message = _a.message, code = _a.code, statusCode = _a.statusCode;\n if (typeof message !== 'string' || typeof code !== 'number' || typeof statusCode !== 'number') {\n throw new Error('ErrorInfo.fromValues(): invalid values: ' + platform_1.default.Config.inspect(values));\n }\n var result = Object.assign(new ErrorInfo(message, code, statusCode), values);\n if (result.code && !result.href) {\n result.href = 'https://help.ably.io/error/' + result.code;\n }\n return result;\n };\n return ErrorInfo;\n}(Error));\nexports.default = ErrorInfo;\nvar PartialErrorInfo = /** @class */ (function (_super) {\n tslib_1.__extends(PartialErrorInfo, _super);\n function PartialErrorInfo(message, code, statusCode, cause) {\n var _this = _super.call(this, message) || this;\n if (typeof Object.setPrototypeOf !== 'undefined') {\n Object.setPrototypeOf(_this, PartialErrorInfo.prototype);\n }\n _this.code = code;\n _this.statusCode = statusCode;\n _this.cause = cause;\n return _this;\n }\n PartialErrorInfo.prototype.toString = function () {\n return toString(this);\n };\n return PartialErrorInfo;\n}(Error));\nexports.PartialErrorInfo = PartialErrorInfo;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Check if typed arrays are supported\n\t if (typeof ArrayBuffer != 'function') {\n\t return;\n\t }\n\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\n\t // Reference original init\n\t var superInit = WordArray.init;\n\n\t // Augment WordArray.init to handle typed arrays\n\t var subInit = WordArray.init = function (typedArray) {\n\t // Convert buffers to uint8\n\t if (typedArray instanceof ArrayBuffer) {\n\t typedArray = new Uint8Array(typedArray);\n\t }\n\n\t // Convert other array views to uint8\n\t if (\n\t typedArray instanceof Int8Array ||\n\t (typeof Uint8ClampedArray !== \"undefined\" && typedArray instanceof Uint8ClampedArray) ||\n\t typedArray instanceof Int16Array ||\n\t typedArray instanceof Uint16Array ||\n\t typedArray instanceof Int32Array ||\n\t typedArray instanceof Uint32Array ||\n\t typedArray instanceof Float32Array ||\n\t typedArray instanceof Float64Array\n\t ) {\n\t typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);\n\t }\n\n\t // Handle Uint8Array\n\t if (typedArray instanceof Uint8Array) {\n\t // Shortcut\n\t var typedArrayByteLength = typedArray.byteLength;\n\n\t // Extract bytes\n\t var words = [];\n\t for (var i = 0; i < typedArrayByteLength; i++) {\n\t words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);\n\t }\n\n\t // Initialize this word array\n\t superInit.call(this, words, typedArrayByteLength);\n\t } else {\n\t // Else call normal init\n\t superInit.apply(this, arguments);\n\t }\n\t };\n\n\t subInit.prototype = WordArray;\n\t}());\n\n\n\treturn CryptoJS.lib.WordArray;\n\n}));\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global) {;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse {}\n}(this, function () {\n\n\t/*globals window, global, require*/\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\n\t var crypto;\n\n\t // Native crypto from window (Browser)\n\t if (typeof window !== 'undefined' && window.crypto) {\n\t crypto = window.crypto;\n\t }\n\n\t // Native (experimental IE 11) crypto from window (Browser)\n\t if (!crypto && typeof window !== 'undefined' && window.msCrypto) {\n\t crypto = window.msCrypto;\n\t }\n\n\t // Native crypto from global (NodeJS)\n\t if (!crypto && typeof global !== 'undefined' && global.crypto) {\n\t crypto = global.crypto;\n\t }\n\n\t // Native crypto import via require (NodeJS)\n\t if (!crypto && \"function\" === 'function') {\n\t try {\n\t crypto = __webpack_require__(44);\n\t } catch (err) {}\n\t }\n\n\t /*\n\t * Cryptographically secure pseudorandom number generator\n\t *\n\t * As Math.random() is cryptographically not safe to use\n\t */\n\t var cryptoSecureRandomInt = function () {\n\t if (crypto) {\n\t // Use getRandomValues method (Browser)\n\t if (typeof crypto.getRandomValues === 'function') {\n\t try {\n\t return crypto.getRandomValues(new Uint32Array(1))[0];\n\t } catch (err) {}\n\t }\n\n\t // Use randomBytes method (NodeJS)\n\t if (typeof crypto.randomBytes === 'function') {\n\t try {\n\t return crypto.randomBytes(4).readInt32LE();\n\t } catch (err) {}\n\t }\n\t }\n\n\t throw new Error('Native crypto module could not be used to get secure random number.');\n\t };\n\n\t /*\n\t * Local polyfill of Object.create\n\n\t */\n\t var create = Object.create || (function () {\n\t function F() {}\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }())\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var i = 0; i < thatSigBytes; i += 4) {\n\t thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t for (var i = 0; i < nBytes; i += 4) {\n\t words.push(cryptoSecureRandomInt());\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t var processedWords;\n\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13)))\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\n/* Call the listener, catch any exceptions and log, but continue operation*/\nfunction callListener(eventThis, listener, args) {\n try {\n listener.apply(eventThis, args);\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'EventEmitter.emit()', 'Unexpected listener exception: ' + e + '; stack = ' + (e && e.stack));\n }\n}\n/**\n * Remove listeners that match listener\n * @param targetListeners is an array of listener arrays or event objects with arrays of listeners\n * @param listener the listener callback to remove\n * @param eventFilter (optional) event name instructing the function to only remove listeners for the specified event\n */\nfunction removeListener(targetListeners, listener, eventFilter) {\n var listeners;\n var index;\n var eventName;\n for (var targetListenersIndex = 0; targetListenersIndex < targetListeners.length; targetListenersIndex++) {\n listeners = targetListeners[targetListenersIndex];\n if (eventFilter) {\n listeners = listeners[eventFilter];\n }\n if (Utils.isArray(listeners)) {\n while ((index = Utils.arrIndexOf(listeners, listener)) !== -1) {\n listeners.splice(index, 1);\n }\n /* If events object has an event name key with no listeners then\n remove the key to stop the list growing indefinitely */\n if (eventFilter && listeners.length === 0) {\n delete targetListeners[targetListenersIndex][eventFilter];\n }\n }\n else if (Utils.isObject(listeners)) {\n /* events */\n for (eventName in listeners) {\n if (Object.prototype.hasOwnProperty.call(listeners, eventName) && Utils.isArray(listeners[eventName])) {\n removeListener([listeners], listener, eventName);\n }\n }\n }\n }\n}\nvar EventEmitter = /** @class */ (function () {\n function EventEmitter() {\n this.any = [];\n this.events = Object.create(null);\n this.anyOnce = [];\n this.eventsOnce = Object.create(null);\n }\n EventEmitter.prototype.on = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (args.length === 1) {\n var listener = args[0];\n if (typeof listener === 'function') {\n this.any.push(listener);\n }\n else {\n throw new Error('EventListener.on(): Invalid arguments: ' + platform_1.default.Config.inspect(args));\n }\n }\n if (args.length === 2) {\n var event_1 = args[0], listener_1 = args[1];\n if (typeof listener_1 !== 'function') {\n throw new Error('EventListener.on(): Invalid arguments: ' + platform_1.default.Config.inspect(args));\n }\n if (Utils.isEmptyArg(event_1)) {\n this.any.push(listener_1);\n }\n else if (Utils.isArray(event_1)) {\n event_1.forEach(function (eventName) {\n _this.on(eventName, listener_1);\n });\n }\n else {\n if (typeof event_1 !== 'string') {\n throw new Error('EventListener.on(): Invalid arguments: ' + platform_1.default.Config.inspect(args));\n }\n var listeners = this.events[event_1] || (this.events[event_1] = []);\n listeners.push(listener_1);\n }\n }\n };\n EventEmitter.prototype.off = function () {\n var _a;\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (args.length == 0 || (Utils.isEmptyArg(args[0]) && Utils.isEmptyArg(args[1]))) {\n this.any = [];\n this.events = Object.create(null);\n this.anyOnce = [];\n this.eventsOnce = Object.create(null);\n return;\n }\n var firstArg = args[0], secondArg = args[1];\n var listener = null;\n var event = null;\n if (args.length === 1 || !secondArg) {\n if (typeof firstArg === 'function') {\n /* we take this to be the listener and treat the event as \"any\" .. */\n listener = firstArg;\n }\n else {\n event = firstArg;\n }\n /* ... or we take event to be the actual event name and listener to be all */\n }\n else {\n if (typeof secondArg !== 'function') {\n throw new Error('EventEmitter.off(): invalid arguments:' + platform_1.default.Config.inspect(args));\n }\n _a = [firstArg, secondArg], event = _a[0], listener = _a[1];\n }\n if (listener && Utils.isEmptyArg(event)) {\n removeListener([this.any, this.events, this.anyOnce, this.eventsOnce], listener);\n return;\n }\n if (Utils.isArray(event)) {\n event.forEach(function (eventName) {\n _this.off(eventName, listener);\n });\n return;\n }\n /* \"normal\" case where event is an actual event */\n if (typeof event !== 'string') {\n throw new Error('EventEmitter.off(): invalid arguments:' + platform_1.default.Config.inspect(args));\n }\n if (listener) {\n removeListener([this.events, this.eventsOnce], listener, event);\n }\n else {\n delete this.events[event];\n delete this.eventsOnce[event];\n }\n };\n /**\n * Get the array of listeners for a given event; excludes once events\n * @param event (optional) the name of the event, or none for 'any'\n * @return array of events, or null if none\n */\n EventEmitter.prototype.listeners = function (event) {\n if (event) {\n var listeners = this.events[event] || [];\n if (this.eventsOnce[event])\n Array.prototype.push.apply(listeners, this.eventsOnce[event]);\n return listeners.length ? listeners : null;\n }\n return this.any.length ? this.any : null;\n };\n /**\n * Emit an event\n * @param event the event name\n * @param args the arguments to pass to the listener\n */\n EventEmitter.prototype.emit = function (event) {\n var args = []; /* , args... */\n for (var _i = 1 /* , args... */; _i < arguments.length /* , args... */; _i++ /* , args... */) {\n args[_i - 1] = arguments[_i]; /* , args... */\n }\n var eventThis = { event: event };\n var listeners = [];\n if (this.anyOnce.length) {\n Array.prototype.push.apply(listeners, this.anyOnce);\n this.anyOnce = [];\n }\n if (this.any.length) {\n Array.prototype.push.apply(listeners, this.any);\n }\n var eventsOnceListeners = this.eventsOnce[event];\n if (eventsOnceListeners) {\n Array.prototype.push.apply(listeners, eventsOnceListeners);\n delete this.eventsOnce[event];\n }\n var eventsListeners = this.events[event];\n if (eventsListeners) {\n Array.prototype.push.apply(listeners, eventsListeners);\n }\n Utils.arrForEach(listeners, function (listener) {\n callListener(eventThis, listener, args);\n });\n };\n EventEmitter.prototype.once = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var argCount = args.length;\n if ((argCount === 0 || (argCount === 1 && typeof args[0] !== 'function')) && platform_1.default.Config.Promise) {\n var event_2 = args[0];\n return new platform_1.default.Config.Promise(function (resolve) {\n _this.once(event_2, resolve);\n });\n }\n var firstArg = args[0], secondArg = args[1];\n if (args.length === 1 && typeof firstArg === 'function') {\n this.anyOnce.push(firstArg);\n }\n else if (Utils.isEmptyArg(firstArg)) {\n if (typeof secondArg !== 'function') {\n throw new Error('EventEmitter.once(): Invalid arguments:' + platform_1.default.Config.inspect(args));\n }\n this.anyOnce.push(secondArg);\n }\n else if (Utils.isArray(firstArg)) {\n var self_1 = this;\n var listenerWrapper_1 = function () {\n var innerArgs = Array.prototype.slice.call(arguments);\n Utils.arrForEach(firstArg, function (eventName) {\n self_1.off(eventName, listenerWrapper_1);\n });\n if (typeof secondArg !== 'function') {\n throw new Error('EventEmitter.once(): Invalid arguments:' + platform_1.default.Config.inspect(args));\n }\n secondArg.apply(this, innerArgs);\n };\n Utils.arrForEach(firstArg, function (eventName) {\n self_1.on(eventName, listenerWrapper_1);\n });\n }\n else {\n if (typeof firstArg !== 'string') {\n throw new Error('EventEmitter.once(): Invalid arguments:' + platform_1.default.Config.inspect(args));\n }\n var listeners = this.eventsOnce[firstArg] || (this.eventsOnce[firstArg] = []);\n if (secondArg) {\n if (typeof secondArg !== 'function') {\n throw new Error('EventEmitter.once(): Invalid arguments:' + platform_1.default.Config.inspect(args));\n }\n listeners.push(secondArg);\n }\n }\n };\n /**\n * Private API\n *\n * Listen for a single occurrence of a state event and fire immediately if currentState matches targetState\n * @param targetState the name of the state event to listen to\n * @param currentState the name of the current state of this object\n * @param listener the listener to be called\n * @param listenerArgs\n */\n EventEmitter.prototype.whenState = function (targetState, currentState, listener) {\n var _this = this;\n var listenerArgs = [];\n for (var _i = 3; _i < arguments.length; _i++) {\n listenerArgs[_i - 3] = arguments[_i];\n }\n var eventThis = { event: targetState };\n if (typeof targetState !== 'string' || typeof currentState !== 'string') {\n throw 'whenState requires a valid event String argument';\n }\n if (typeof listener !== 'function' && platform_1.default.Config.Promise) {\n return new platform_1.default.Config.Promise(function (resolve) {\n EventEmitter.prototype.whenState.apply(_this, [targetState, currentState, resolve].concat(listenerArgs));\n });\n }\n if (targetState === currentState) {\n callListener(eventThis, listener, listenerArgs);\n }\n else {\n this.once(targetState, listener);\n }\n };\n return EventEmitter;\n}());\nexports.default = EventEmitter;\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getDefaults = exports.normaliseOptions = exports.objectifyOptions = exports.getAgentString = exports.getHosts = exports.getFallbackHosts = exports.environmentFallbackHosts = exports.getHttpScheme = exports.getPort = exports.getHost = void 0;\nvar tslib_1 = __webpack_require__(0);\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar package_json_1 = __webpack_require__(43);\nvar agent = 'ably-js/' + package_json_1.version;\nvar Defaults = {\n ENVIRONMENT: '',\n REST_HOST: 'rest.ably.io',\n REALTIME_HOST: 'realtime.ably.io',\n FALLBACK_HOSTS: [\n 'A.ably-realtime.com',\n 'B.ably-realtime.com',\n 'C.ably-realtime.com',\n 'D.ably-realtime.com',\n 'E.ably-realtime.com',\n ],\n PORT: 80,\n TLS_PORT: 443,\n TIMEOUTS: {\n /* Documented as options params: */\n disconnectedRetryTimeout: 15000,\n suspendedRetryTimeout: 30000,\n /* Undocumented, but part of the api and can be used by customers: */\n httpRequestTimeout: 15000,\n channelRetryTimeout: 15000,\n fallbackRetryTimeout: 600000,\n /* For internal / test use only: */\n connectionStateTtl: 120000,\n realtimeRequestTimeout: 10000,\n recvTimeout: 90000,\n preferenceConnectTimeout: 6000,\n parallelUpgradeDelay: 6000,\n },\n httpMaxRetryCount: 3,\n maxMessageSize: 65536,\n version: package_json_1.version,\n protocolVersion: 2,\n agent: agent,\n getHost: getHost,\n getPort: getPort,\n getHttpScheme: getHttpScheme,\n environmentFallbackHosts: environmentFallbackHosts,\n getFallbackHosts: getFallbackHosts,\n getHosts: getHosts,\n checkHost: checkHost,\n objectifyOptions: objectifyOptions,\n normaliseOptions: normaliseOptions,\n};\nfunction getHost(options, host, ws) {\n if (ws)\n host = (host == options.restHost && options.realtimeHost) || host || options.realtimeHost;\n else\n host = host || options.restHost;\n return host;\n}\nexports.getHost = getHost;\nfunction getPort(options, tls) {\n return tls || options.tls ? options.tlsPort : options.port;\n}\nexports.getPort = getPort;\nfunction getHttpScheme(options) {\n return options.tls ? 'https://' : 'http://';\n}\nexports.getHttpScheme = getHttpScheme;\n// construct environment fallback hosts as per RSC15i\nfunction environmentFallbackHosts(environment) {\n return [\n environment + '-a-fallback.ably-realtime.com',\n environment + '-b-fallback.ably-realtime.com',\n environment + '-c-fallback.ably-realtime.com',\n environment + '-d-fallback.ably-realtime.com',\n environment + '-e-fallback.ably-realtime.com',\n ];\n}\nexports.environmentFallbackHosts = environmentFallbackHosts;\nfunction getFallbackHosts(options) {\n var fallbackHosts = options.fallbackHosts, httpMaxRetryCount = typeof options.httpMaxRetryCount !== 'undefined' ? options.httpMaxRetryCount : Defaults.httpMaxRetryCount;\n return fallbackHosts ? Utils.arrChooseN(fallbackHosts, httpMaxRetryCount) : [];\n}\nexports.getFallbackHosts = getFallbackHosts;\nfunction getHosts(options) {\n return [options.restHost].concat(getFallbackHosts(options));\n}\nexports.getHosts = getHosts;\nfunction checkHost(host) {\n if (typeof host !== 'string') {\n throw new errorinfo_1.default('host must be a string; was a ' + typeof host, 40000, 400);\n }\n if (!host.length) {\n throw new errorinfo_1.default('host must not be zero-length', 40000, 400);\n }\n}\nfunction getRealtimeHost(options, production, environment) {\n if (options.realtimeHost)\n return options.realtimeHost;\n /* prefer setting realtimeHost to restHost as a custom restHost typically indicates\n * a development environment is being used that can't be inferred by the library */\n if (options.restHost) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Defaults.normaliseOptions', 'restHost is set to \"' +\n options.restHost +\n '\" but realtimeHost is not set, so setting realtimeHost to \"' +\n options.restHost +\n '\" too. If this is not what you want, please set realtimeHost explicitly.');\n return options.restHost;\n }\n return production ? Defaults.REALTIME_HOST : environment + '-' + Defaults.REALTIME_HOST;\n}\nfunction getTimeouts(options) {\n /* Allow values passed in options to override default timeouts */\n var timeouts = {};\n for (var prop in Defaults.TIMEOUTS) {\n timeouts[prop] = options[prop] || Defaults.TIMEOUTS[prop];\n }\n return timeouts;\n}\nfunction getAgentString(options) {\n var agentStr = Defaults.agent;\n if (options.agents) {\n for (var agent in options.agents) {\n agentStr += ' ' + agent + '/' + options.agents[agent];\n }\n }\n return agentStr;\n}\nexports.getAgentString = getAgentString;\nfunction objectifyOptions(options) {\n if (typeof options == 'string') {\n return options.indexOf(':') == -1 ? { token: options } : { key: options };\n }\n return options;\n}\nexports.objectifyOptions = objectifyOptions;\nfunction normaliseOptions(options) {\n /* Deprecated options */\n if (options.host) {\n logger_1.default.deprecated('host', 'restHost');\n options.restHost = options.host;\n }\n if (options.wsHost) {\n logger_1.default.deprecated('wsHost', 'realtimeHost');\n options.realtimeHost = options.wsHost;\n }\n if (options.queueEvents) {\n logger_1.default.deprecated('queueEvents', 'queueMessages');\n options.queueMessages = options.queueEvents;\n }\n if (options.fallbackHostsUseDefault) {\n /* fallbackHostsUseDefault and fallbackHosts are mutually exclusive as per TO3k7 */\n if (options.fallbackHosts) {\n var msg = 'fallbackHosts and fallbackHostsUseDefault cannot both be set';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Defaults.normaliseOptions', msg);\n throw new errorinfo_1.default(msg, 40000, 400);\n }\n /* default fallbacks can't be used with custom ports */\n if (options.port || options.tlsPort) {\n var msg = 'fallbackHostsUseDefault cannot be set when port or tlsPort are set';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Defaults.normaliseOptions', msg);\n throw new errorinfo_1.default(msg, 40000, 400);\n }\n /* emit an appropriate deprecation warning */\n if (options.environment) {\n logger_1.default.deprecatedWithMsg('fallbackHostsUseDefault', 'There is no longer a need to set this when the environment option is also set since the library will now generate the correct fallback hosts using the environment option.');\n }\n else {\n logger_1.default.deprecated('fallbackHostsUseDefault', 'fallbackHosts: Ably.Defaults.FALLBACK_HOSTS');\n }\n /* use the default fallback hosts as requested */\n options.fallbackHosts = Defaults.FALLBACK_HOSTS;\n }\n /* options.recover as a boolean is deprecated, and therefore is not part of the public typing */\n if (options.recover === true) {\n logger_1.default.deprecated('{recover: true}', '{recover: function(lastConnectionDetails, cb) { cb(true); }}');\n options.recover = function (lastConnectionDetails, cb) {\n cb(true);\n };\n }\n if (typeof options.recover === 'function' && options.closeOnUnload === true) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Defaults.normaliseOptions', 'closeOnUnload was true and a session recovery function was set - these are mutually exclusive, so unsetting the latter');\n options.recover = undefined;\n }\n if (!('closeOnUnload' in options)) {\n /* Have closeOnUnload default to true unless we have any indication that\n * the user may want to recover the connection */\n options.closeOnUnload = !options.recover;\n }\n if (options.transports && Utils.arrIn(options.transports, 'xhr')) {\n logger_1.default.deprecated('transports: [\"xhr\"]', 'transports: [\"xhr_streaming\"]');\n Utils.arrDeleteValue(options.transports, 'xhr');\n options.transports.push('xhr_streaming');\n }\n if (!('queueMessages' in options))\n options.queueMessages = true;\n /* infer hosts and fallbacks based on the configured environment */\n var environment = (options.environment && String(options.environment).toLowerCase()) || Defaults.ENVIRONMENT;\n var production = !environment || environment === 'production';\n if (!options.fallbackHosts && !options.restHost && !options.realtimeHost && !options.port && !options.tlsPort) {\n options.fallbackHosts = production ? Defaults.FALLBACK_HOSTS : environmentFallbackHosts(environment);\n }\n var restHost = options.restHost || (production ? Defaults.REST_HOST : environment + '-' + Defaults.REST_HOST);\n var realtimeHost = getRealtimeHost(options, production, environment);\n Utils.arrForEach((options.fallbackHosts || []).concat(restHost, realtimeHost), checkHost);\n options.port = options.port || Defaults.PORT;\n options.tlsPort = options.tlsPort || Defaults.TLS_PORT;\n if (!('tls' in options))\n options.tls = true;\n var timeouts = getTimeouts(options);\n if ('useBinaryProtocol' in options) {\n options.useBinaryProtocol = platform_1.default.Config.supportsBinary && options.useBinaryProtocol;\n }\n else {\n options.useBinaryProtocol = platform_1.default.Config.preferBinary;\n }\n if (options.clientId) {\n var headers = (options.headers = options.headers || {});\n headers['X-Ably-ClientId'] = platform_1.default.BufferUtils.base64Encode(platform_1.default.BufferUtils.utf8Encode(options.clientId));\n }\n if (!('idempotentRestPublishing' in options)) {\n options.idempotentRestPublishing = true;\n }\n if (options.promises && !platform_1.default.Config.Promise) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Defaults.normaliseOptions', '{promises: true} was specified, but no Promise constructor found; disabling promises');\n options.promises = false;\n }\n var connectivityCheckParams = null;\n var connectivityCheckUrl = options.connectivityCheckUrl;\n if (options.connectivityCheckUrl) {\n var _a = options.connectivityCheckUrl.split('?'), uri = _a[0], qs = _a[1];\n connectivityCheckParams = qs ? Utils.parseQueryString(qs) : {};\n if (uri.indexOf('://') === -1) {\n uri = 'https://' + uri;\n }\n connectivityCheckUrl = uri;\n }\n return tslib_1.__assign(tslib_1.__assign({}, options), { useBinaryProtocol: 'useBinaryProtocol' in options\n ? platform_1.default.Config.supportsBinary && options.useBinaryProtocol\n : platform_1.default.Config.preferBinary, realtimeHost: realtimeHost, restHost: restHost, maxMessageSize: options.maxMessageSize || Defaults.maxMessageSize, timeouts: timeouts, connectivityCheckParams: connectivityCheckParams, connectivityCheckUrl: connectivityCheckUrl });\n}\nexports.normaliseOptions = normaliseOptions;\nexports.default = Defaults;\nfunction getDefaults(platformDefaults) {\n return Object.assign(Defaults, platformDefaults);\n}\nexports.getDefaults = getDefaults;\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nfunction normaliseContext(context) {\n if (!context || !context.channelOptions) {\n return {\n channelOptions: context,\n plugins: {},\n baseEncodedPreviousPayload: undefined,\n };\n }\n return context;\n}\nfunction normalizeCipherOptions(options) {\n if (options && options.cipher) {\n if (!platform_1.default.Crypto)\n throw new Error('Encryption not enabled; use ably.encryption.js instead');\n var cipher = platform_1.default.Crypto.getCipher(options.cipher);\n return {\n cipher: cipher.cipherParams,\n channelCipher: cipher.cipher,\n };\n }\n return options !== null && options !== void 0 ? options : {};\n}\nfunction getMessageSize(msg) {\n var size = 0;\n if (msg.name) {\n size += msg.name.length;\n }\n if (msg.clientId) {\n size += msg.clientId.length;\n }\n if (msg.extras) {\n size += JSON.stringify(msg.extras).length;\n }\n if (msg.data) {\n size += Utils.dataSizeBytes(msg.data);\n }\n return size;\n}\nvar Message = /** @class */ (function () {\n function Message() {\n }\n /**\n * Overload toJSON() to intercept JSON.stringify()\n * @return {*}\n */\n Message.prototype.toJSON = function () {\n /* encode data to base64 if present and we're returning real JSON;\n * although msgpack calls toJSON(), we know it is a stringify()\n * call if it has a non-empty arguments list */\n var encoding = this.encoding;\n var data = this.data;\n if (data && platform_1.default.BufferUtils.isBuffer(data)) {\n if (arguments.length > 0) {\n /* stringify call */\n encoding = encoding ? encoding + '/base64' : 'base64';\n data = platform_1.default.BufferUtils.base64Encode(data);\n }\n else {\n /* Called by msgpack. toBuffer returns a datatype understandable by\n * that platform's msgpack implementation (Buffer in node, Uint8Array\n * in browsers) */\n data = platform_1.default.BufferUtils.toBuffer(data);\n }\n }\n return {\n name: this.name,\n id: this.id,\n clientId: this.clientId,\n connectionId: this.connectionId,\n connectionKey: this.connectionKey,\n extras: this.extras,\n encoding: encoding,\n data: data,\n };\n };\n Message.prototype.toString = function () {\n var result = '[Message';\n if (this.name)\n result += '; name=' + this.name;\n if (this.id)\n result += '; id=' + this.id;\n if (this.timestamp)\n result += '; timestamp=' + this.timestamp;\n if (this.clientId)\n result += '; clientId=' + this.clientId;\n if (this.connectionId)\n result += '; connectionId=' + this.connectionId;\n if (this.encoding)\n result += '; encoding=' + this.encoding;\n if (this.extras)\n result += '; extras =' + JSON.stringify(this.extras);\n if (this.data) {\n if (typeof this.data == 'string')\n result += '; data=' + this.data;\n else if (platform_1.default.BufferUtils.isBuffer(this.data))\n result += '; data (buffer)=' + platform_1.default.BufferUtils.base64Encode(this.data);\n else\n result += '; data (json)=' + JSON.stringify(this.data);\n }\n if (this.extras)\n result += '; extras=' + JSON.stringify(this.extras);\n result += ']';\n return result;\n };\n Message.encrypt = function (msg, options, callback) {\n var data = msg.data, encoding = msg.encoding, cipher = options.channelCipher;\n encoding = encoding ? encoding + '/' : '';\n if (!platform_1.default.BufferUtils.isBuffer(data)) {\n data = platform_1.default.BufferUtils.utf8Encode(String(data));\n encoding = encoding + 'utf-8/';\n }\n cipher.encrypt(data, function (err, data) {\n if (err) {\n callback(err);\n return;\n }\n msg.data = data;\n msg.encoding = encoding + 'cipher+' + cipher.algorithm;\n callback(null, msg);\n });\n };\n Message.encode = function (msg, options, callback) {\n var data = msg.data;\n var nativeDataType = typeof data == 'string' || platform_1.default.BufferUtils.isBuffer(data) || data === null || data === undefined;\n if (!nativeDataType) {\n if (Utils.isObject(data) || Utils.isArray(data)) {\n msg.data = JSON.stringify(data);\n msg.encoding = msg.encoding ? msg.encoding + '/json' : 'json';\n }\n else {\n throw new errorinfo_1.default('Data type is unsupported', 40013, 400);\n }\n }\n if (options != null && options.cipher) {\n Message.encrypt(msg, options, callback);\n }\n else {\n callback(null, msg);\n }\n };\n Message.encodeArray = function (messages, options, callback) {\n var processed = 0;\n for (var i = 0; i < messages.length; i++) {\n Message.encode(messages[i], options, function (err) {\n if (err) {\n callback(err);\n return;\n }\n processed++;\n if (processed == messages.length) {\n callback(null, messages);\n }\n });\n }\n };\n Message.decode = function (message, inputContext) {\n var context = normaliseContext(inputContext);\n var lastPayload = message.data;\n var encoding = message.encoding;\n if (encoding) {\n var xforms = encoding.split('/');\n var lastProcessedEncodingIndex = void 0, encodingsToProcess = xforms.length, data = message.data;\n var xform = '';\n try {\n while ((lastProcessedEncodingIndex = encodingsToProcess) > 0) {\n // eslint-disable-next-line security/detect-unsafe-regex\n var match = xforms[--encodingsToProcess].match(/([-\\w]+)(\\+([\\w-]+))?/);\n if (!match)\n break;\n xform = match[1];\n switch (xform) {\n case 'base64':\n data = platform_1.default.BufferUtils.base64Decode(String(data));\n if (lastProcessedEncodingIndex == xforms.length) {\n lastPayload = data;\n }\n continue;\n case 'utf-8':\n data = platform_1.default.BufferUtils.utf8Decode(data);\n continue;\n case 'json':\n data = JSON.parse(data);\n continue;\n case 'cipher':\n if (context.channelOptions != null &&\n context.channelOptions.cipher &&\n context.channelOptions.channelCipher) {\n var xformAlgorithm = match[3], cipher = context.channelOptions.channelCipher;\n /* don't attempt to decrypt unless the cipher params are compatible */\n if (xformAlgorithm != cipher.algorithm) {\n throw new Error('Unable to decrypt message with given cipher; incompatible cipher params');\n }\n data = cipher.decrypt(data);\n continue;\n }\n else {\n throw new Error('Unable to decrypt message; not an encrypted channel');\n }\n case 'vcdiff':\n if (!context.plugins || !context.plugins.vcdiff) {\n throw new errorinfo_1.default('Missing Vcdiff decoder (https://github.com/ably-forks/vcdiff-decoder)', 40019, 400);\n }\n if (typeof Uint8Array === 'undefined') {\n throw new errorinfo_1.default('Delta decoding not supported on this browser (need ArrayBuffer & Uint8Array)', 40020, 400);\n }\n try {\n var deltaBase = context.baseEncodedPreviousPayload;\n if (typeof deltaBase === 'string') {\n deltaBase = platform_1.default.BufferUtils.utf8Encode(deltaBase);\n }\n /* vcdiff expects Uint8Arrays, can't copy with ArrayBuffers. (also, if we\n * don't have a TextDecoder, deltaBase might be a WordArray here, so need\n * to process it into a buffer anyway) */\n deltaBase = platform_1.default.BufferUtils.toBuffer(deltaBase);\n data = platform_1.default.BufferUtils.toBuffer(data);\n data = platform_1.default.BufferUtils.typedArrayToBuffer(context.plugins.vcdiff.decode(data, deltaBase));\n lastPayload = data;\n }\n catch (e) {\n throw new errorinfo_1.default('Vcdiff delta decode failed with ' + e, 40018, 400);\n }\n continue;\n default:\n throw new Error('Unknown encoding');\n }\n }\n }\n catch (e) {\n var err = e;\n throw new errorinfo_1.default('Error processing the ' + xform + ' encoding, decoder returned ‘' + err.message + '’', err.code || 40013, 400);\n }\n finally {\n message.encoding =\n lastProcessedEncodingIndex <= 0 ? null : xforms.slice(0, lastProcessedEncodingIndex).join('/');\n message.data = data;\n }\n }\n context.baseEncodedPreviousPayload = lastPayload;\n };\n Message.fromResponseBody = function (body, options, format) {\n if (format) {\n body = Utils.decodeBody(body, format);\n }\n for (var i = 0; i < body.length; i++) {\n var msg = (body[i] = Message.fromValues(body[i]));\n try {\n Message.decode(msg, options);\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Message.fromResponseBody()', e.toString());\n }\n }\n return body;\n };\n Message.fromValues = function (values) {\n return Object.assign(new Message(), values);\n };\n Message.fromValuesArray = function (values) {\n var count = values.length, result = new Array(count);\n for (var i = 0; i < count; i++)\n result[i] = Message.fromValues(values[i]);\n return result;\n };\n Message.fromEncoded = function (encoded, inputOptions) {\n var msg = Message.fromValues(encoded);\n var options = normalizeCipherOptions(inputOptions !== null && inputOptions !== void 0 ? inputOptions : null);\n /* if decoding fails at any point, catch and return the message decoded to\n * the fullest extent possible */\n try {\n Message.decode(msg, options);\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Message.fromEncoded()', e.toString());\n }\n return msg;\n };\n Message.fromEncodedArray = function (encodedArray, options) {\n return encodedArray.map(function (encoded) {\n return Message.fromEncoded(encoded, options);\n });\n };\n /* This should be called on encode()d (and encrypt()d) Messages (as it\n * assumes the data is a string or buffer) */\n Message.getMessagesSize = function (messages) {\n var msg, total = 0;\n for (var i = 0; i < messages.length; i++) {\n msg = messages[i];\n total += msg.size || (msg.size = getMessageSize(msg));\n }\n return total;\n };\n Message.serialize = Utils.encodeBody;\n return Message;\n}());\nexports.default = Message;\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar message_1 = tslib_1.__importDefault(__webpack_require__(9));\nvar presencemessage_1 = tslib_1.__importDefault(__webpack_require__(15));\nvar actions = {\n HEARTBEAT: 0,\n ACK: 1,\n NACK: 2,\n CONNECT: 3,\n CONNECTED: 4,\n DISCONNECT: 5,\n DISCONNECTED: 6,\n CLOSE: 7,\n CLOSED: 8,\n ERROR: 9,\n ATTACH: 10,\n ATTACHED: 11,\n DETACH: 12,\n DETACHED: 13,\n PRESENCE: 14,\n MESSAGE: 15,\n SYNC: 16,\n AUTH: 17,\n ACTIVATE: 18,\n};\nvar ActionName = [];\nObject.keys(actions).forEach(function (name) {\n ActionName[actions[name]] = name;\n});\nvar flags = {\n /* Channel attach state flags */\n HAS_PRESENCE: 1 << 0,\n HAS_BACKLOG: 1 << 1,\n RESUMED: 1 << 2,\n TRANSIENT: 1 << 4,\n ATTACH_RESUME: 1 << 5,\n /* Channel mode flags */\n PRESENCE: 1 << 16,\n PUBLISH: 1 << 17,\n SUBSCRIBE: 1 << 18,\n PRESENCE_SUBSCRIBE: 1 << 19,\n};\nvar flagNames = Object.keys(flags);\nflags.MODE_ALL = flags.PRESENCE | flags.PUBLISH | flags.SUBSCRIBE | flags.PRESENCE_SUBSCRIBE;\nfunction toStringArray(array) {\n var result = [];\n if (array) {\n for (var i = 0; i < array.length; i++) {\n result.push(array[i].toString());\n }\n }\n return '[ ' + result.join(', ') + ' ]';\n}\nvar simpleAttributes = 'id channel channelSerial connectionId count msgSerial timestamp'.split(' ');\nvar ProtocolMessage = /** @class */ (function () {\n function ProtocolMessage() {\n var _this = this;\n this.hasFlag = function (flag) {\n return (_this.flags & flags[flag]) > 0;\n };\n }\n ProtocolMessage.prototype.setFlag = function (flag) {\n return (this.flags = this.flags | flags[flag]);\n };\n ProtocolMessage.prototype.getMode = function () {\n return this.flags && this.flags & flags.MODE_ALL;\n };\n ProtocolMessage.prototype.encodeModesToFlags = function (modes) {\n var _this = this;\n modes.forEach(function (mode) { return _this.setFlag(mode); });\n };\n ProtocolMessage.prototype.decodeModesFromFlags = function () {\n var _this = this;\n var modes = [];\n ProtocolMessage.channelModes.forEach(function (mode) {\n if (_this.hasFlag(mode)) {\n modes.push(mode);\n }\n });\n return modes.length > 0 ? modes : undefined;\n };\n ProtocolMessage.fromValues = function (values) {\n return Object.assign(new ProtocolMessage(), values);\n };\n ProtocolMessage.Action = actions;\n ProtocolMessage.channelModes = ['PRESENCE', 'PUBLISH', 'SUBSCRIBE', 'PRESENCE_SUBSCRIBE'];\n ProtocolMessage.ActionName = ActionName;\n ProtocolMessage.serialize = Utils.encodeBody;\n ProtocolMessage.deserialize = function (serialized, format) {\n var deserialized = Utils.decodeBody(serialized, format);\n return ProtocolMessage.fromDeserialized(deserialized);\n };\n ProtocolMessage.fromDeserialized = function (deserialized) {\n var error = deserialized.error;\n if (error)\n deserialized.error = errorinfo_1.default.fromValues(error);\n var messages = deserialized.messages;\n if (messages)\n for (var i = 0; i < messages.length; i++)\n messages[i] = message_1.default.fromValues(messages[i]);\n var presence = deserialized.presence;\n if (presence)\n for (var i = 0; i < presence.length; i++)\n presence[i] = presencemessage_1.default.fromValues(presence[i], true);\n return Object.assign(new ProtocolMessage(), deserialized);\n };\n ProtocolMessage.stringify = function (msg) {\n var result = '[ProtocolMessage';\n if (msg.action !== undefined)\n result += '; action=' + ProtocolMessage.ActionName[msg.action] || false;\n var attribute;\n for (var attribIndex = 0; attribIndex < simpleAttributes.length; attribIndex++) {\n attribute = simpleAttributes[attribIndex];\n if (msg[attribute] !== undefined)\n result += '; ' + attribute + '=' + msg[attribute];\n }\n if (msg.messages)\n result += '; messages=' + toStringArray(message_1.default.fromValuesArray(msg.messages));\n if (msg.presence)\n result += '; presence=' + toStringArray(presencemessage_1.default.fromValuesArray(msg.presence));\n if (msg.error)\n result += '; error=' + errorinfo_1.default.fromValues(msg.error).toString();\n if (msg.auth && msg.auth.accessToken)\n result += '; token=' + msg.auth.accessToken;\n if (msg.flags)\n result += '; flags=' + flagNames.filter(msg.hasFlag).join(',');\n if (msg.params) {\n var stringifiedParams_1 = '';\n Utils.forInOwnNonNullProperties(msg.params, function (prop) {\n if (stringifiedParams_1.length > 0) {\n stringifiedParams_1 += '; ';\n }\n stringifiedParams_1 += prop + '=' + msg.params[prop];\n });\n if (stringifiedParams_1.length > 0) {\n result += '; params=[' + stringifiedParams_1 + ']';\n }\n }\n result += ']';\n return result;\n };\n return ProtocolMessage;\n}());\nexports.default = ProtocolMessage;\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var C_enc = C.enc;\n\n\t /**\n\t * Base64 encoding strategy.\n\t */\n\t var Base64 = C_enc.Base64 = {\n\t /**\n\t * Converts a word array to a Base64 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Base64 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var base64String = CryptoJS.enc.Base64.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\t var map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n\t // Clamp excess bits\n\t wordArray.clamp();\n\n\t // Convert\n\t var base64Chars = [];\n\t for (var i = 0; i < sigBytes; i += 3) {\n\t var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;\n\t var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;\n\n\t var triplet = (byte1 << 16) | (byte2 << 8) | byte3;\n\n\t for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {\n\t base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));\n\t }\n\t }\n\n\t // Add padding\n\t var paddingChar = map.charAt(64);\n\t if (paddingChar) {\n\t while (base64Chars.length % 4) {\n\t base64Chars.push(paddingChar);\n\t }\n\t }\n\n\t return base64Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Base64 string to a word array.\n\t *\n\t * @param {string} base64Str The Base64 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Base64.parse(base64String);\n\t */\n\t parse: function (base64Str) {\n\t // Shortcuts\n\t var base64StrLength = base64Str.length;\n\t var map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\t var reverseMap = this._reverseMap;\n\n\t if (!reverseMap) {\n\t reverseMap = this._reverseMap = [];\n\t for (var j = 0; j < map.length; j++) {\n\t reverseMap[map.charCodeAt(j)] = j;\n\t }\n\t }\n\n\t // Ignore padding\n\t var paddingChar = map.charAt(64);\n\t if (paddingChar) {\n\t var paddingIndex = base64Str.indexOf(paddingChar);\n\t if (paddingIndex !== -1) {\n\t base64StrLength = paddingIndex;\n\t }\n\t }\n\n\t // Convert\n\t return parseLoop(base64Str, base64StrLength, reverseMap);\n\n\t }\n\t };\n\n\t function parseLoop(base64Str, base64StrLength, reverseMap) {\n\t var words = [];\n\t var nBytes = 0;\n\t for (var i = 0; i < base64StrLength; i++) {\n\t if (i % 4) {\n\t var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);\n\t var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);\n\t var bitsCombined = bits1 | bits2;\n\t words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);\n\t nBytes++;\n\t }\n\t }\n\t return WordArray.create(words, nBytes);\n\t }\n\t}());\n\n\n\treturn CryptoJS.enc.Base64;\n\n}));\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar protocolmessage_1 = tslib_1.__importDefault(__webpack_require__(10));\nvar transport_1 = tslib_1.__importDefault(__webpack_require__(26));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar defaults_1 = tslib_1.__importDefault(__webpack_require__(8));\nvar connectionerrors_1 = tslib_1.__importDefault(__webpack_require__(20));\nvar auth_1 = tslib_1.__importDefault(__webpack_require__(17));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar XHRStates_1 = tslib_1.__importDefault(__webpack_require__(21));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\n/* TODO: can remove once realtime sends protocol message responses for comet errors */\nfunction shouldBeErrorAction(err) {\n var UNRESOLVABLE_ERROR_CODES = [80015, 80017, 80030];\n if (err.code) {\n if (auth_1.default.isTokenErr(err))\n return false;\n if (Utils.arrIn(UNRESOLVABLE_ERROR_CODES, err.code))\n return true;\n return err.code >= 40000 && err.code < 50000;\n }\n else {\n /* Likely a network or transport error of some kind. Certainly not fatal to the connection */\n return false;\n }\n}\nfunction protocolMessageFromRawError(err) {\n /* err will be either a legacy (non-protocolmessage) comet error response\n * (which will have an err.code), or a xhr/network error (which won't). */\n if (shouldBeErrorAction(err)) {\n return [protocolmessage_1.default.fromValues({ action: protocolmessage_1.default.Action.ERROR, error: err })];\n }\n else {\n return [protocolmessage_1.default.fromValues({ action: protocolmessage_1.default.Action.DISCONNECTED, error: err })];\n }\n}\n/*\n * A base comet transport class\n */\nvar CometTransport = /** @class */ (function (_super) {\n tslib_1.__extends(CometTransport, _super);\n function CometTransport(connectionManager, auth, params) {\n var _this = _super.call(this, connectionManager, auth, params, /* binary not supported for comet so force JSON protocol */ true) || this;\n /* For comet, we could do the auth update by aborting the current recv and\n * starting a new one with the new token, that'd be sufficient for realtime.\n * Problem is JSONP - you can't cancel truly abort a recv once started. So\n * we need to send an AUTH for jsonp. In which case it's simpler to keep all\n * comet transports the same and do it for all of them. So we send the AUTH\n * instead, and don't need to abort the recv */\n _this.onAuthUpdated = function (tokenDetails) {\n _this.authParams = { access_token: tokenDetails.token };\n };\n _this.stream = 'stream' in params ? params.stream : true;\n _this.sendRequest = null;\n _this.recvRequest = null;\n _this.pendingCallback = null;\n _this.pendingItems = null;\n return _this;\n }\n CometTransport.prototype.connect = function () {\n var _this = this;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'CometTransport.connect()', 'starting');\n transport_1.default.prototype.connect.call(this);\n var params = this.params;\n var options = params.options;\n var host = defaults_1.default.getHost(options, params.host);\n var port = defaults_1.default.getPort(options);\n var cometScheme = options.tls ? 'https://' : 'http://';\n this.baseUri = cometScheme + host + ':' + port + '/comet/';\n var connectUri = this.baseUri + 'connect';\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'CometTransport.connect()', 'uri: ' + connectUri);\n this.auth.getAuthParams(function (err, authParams) {\n if (err) {\n _this.disconnect(err);\n return;\n }\n if (_this.isDisposed) {\n return;\n }\n _this.authParams = authParams;\n var connectParams = _this.params.getConnectParams(authParams);\n if ('stream' in connectParams)\n _this.stream = connectParams.stream;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'CometTransport.connect()', 'connectParams:' + Utils.toQueryString(connectParams));\n /* this will be the 'recvRequest' so this connection can stream messages */\n var preconnected = false;\n var connectRequest = (_this.recvRequest = _this.createRequest(connectUri, null, connectParams, null, _this.stream ? XHRStates_1.default.REQ_RECV_STREAM : XHRStates_1.default.REQ_RECV));\n connectRequest.on('data', function (data) {\n if (!_this.recvRequest) {\n /* the transport was disposed before we connected */\n return;\n }\n if (!preconnected) {\n preconnected = true;\n _this.emit('preconnect');\n }\n _this.onData(data);\n });\n connectRequest.on('complete', function (err) {\n if (!_this.recvRequest) {\n /* the transport was disposed before we connected */\n err = err || new errorinfo_1.default('Request cancelled', 80003, 400);\n }\n _this.recvRequest = null;\n /* Connect request may complete without a emitting 'data' event since that is not\n * emitted for e.g. a non-streamed error response. Still implies preconnect. */\n if (!preconnected && !err) {\n preconnected = true;\n _this.emit('preconnect');\n }\n _this.onActivity();\n if (err) {\n if (err.code) {\n /* A protocol error received from realtime. TODO: once realtime\n * consistendly sends errors wrapped in protocol messages, should be\n * able to remove this */\n _this.onData(protocolMessageFromRawError(err));\n }\n else {\n /* A network/xhr error. Don't bother wrapping in a protocol message,\n * just disconnect the transport */\n _this.disconnect(err);\n }\n return;\n }\n platform_1.default.Config.nextTick(function () {\n _this.recv();\n });\n });\n connectRequest.exec();\n });\n };\n CometTransport.prototype.requestClose = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'CometTransport.requestClose()');\n this._requestCloseOrDisconnect(true);\n };\n CometTransport.prototype.requestDisconnect = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'CometTransport.requestDisconnect()');\n this._requestCloseOrDisconnect(false);\n };\n CometTransport.prototype._requestCloseOrDisconnect = function (closing) {\n var _this = this;\n var closeOrDisconnectUri = closing ? this.closeUri : this.disconnectUri;\n if (closeOrDisconnectUri) {\n var request = this.createRequest(closeOrDisconnectUri, null, this.authParams, null, XHRStates_1.default.REQ_SEND);\n request.on('complete', function (err) {\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'CometTransport.request' + (closing ? 'Close()' : 'Disconnect()'), 'request returned err = ' + Utils.inspectError(err));\n _this.finish('disconnected', err);\n }\n });\n request.exec();\n }\n };\n CometTransport.prototype.dispose = function () {\n var _this = this;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'CometTransport.dispose()', '');\n if (!this.isDisposed) {\n this.isDisposed = true;\n if (this.recvRequest) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'CometTransport.dispose()', 'aborting recv request');\n this.recvRequest.abort();\n this.recvRequest = null;\n }\n /* In almost all cases the transport will be finished before it's\n * disposed. Finish here just to make sure. */\n this.finish('disconnected', connectionerrors_1.default.disconnected());\n platform_1.default.Config.nextTick(function () {\n _this.emit('disposed');\n });\n }\n };\n CometTransport.prototype.onConnect = function (message) {\n var _a;\n /* if this transport has been disposed whilst awaiting connection, do nothing */\n if (this.isDisposed) {\n return;\n }\n /* the connectionKey in a comet connected response is really\n * - */\n var connectionStr = (_a = message.connectionDetails) === null || _a === void 0 ? void 0 : _a.connectionKey;\n transport_1.default.prototype.onConnect.call(this, message);\n var baseConnectionUri = this.baseUri + connectionStr;\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'CometTransport.onConnect()', 'baseUri = ' + baseConnectionUri);\n this.sendUri = baseConnectionUri + '/send';\n this.recvUri = baseConnectionUri + '/recv';\n this.closeUri = baseConnectionUri + '/close';\n this.disconnectUri = baseConnectionUri + '/disconnect';\n };\n CometTransport.prototype.send = function (message) {\n if (this.sendRequest) {\n /* there is a pending send, so queue this message */\n this.pendingItems = this.pendingItems || [];\n this.pendingItems.push(message);\n return;\n }\n /* send this, plus any pending, now */\n var pendingItems = this.pendingItems || [];\n pendingItems.push(message);\n this.pendingItems = null;\n this.sendItems(pendingItems);\n };\n CometTransport.prototype.sendAnyPending = function () {\n var pendingItems = this.pendingItems;\n if (!pendingItems) {\n return;\n }\n this.pendingItems = null;\n this.sendItems(pendingItems);\n };\n CometTransport.prototype.sendItems = function (items) {\n var _this = this;\n var sendRequest = (this.sendRequest = this.createRequest(this.sendUri, null, this.authParams, this.encodeRequest(items), XHRStates_1.default.REQ_SEND));\n sendRequest.on('complete', function (err, data) {\n if (err)\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'CometTransport.sendItems()', 'on complete: err = ' + Utils.inspectError(err));\n _this.sendRequest = null;\n /* the result of the request, even if a nack, is usually a protocol response\n * contained in the data. An err is anomolous, and indicates some issue with the\n * network,transport, or connection */\n if (err) {\n if (err.code) {\n /* A protocol error received from realtime. TODO: once realtime\n * consistendly sends errors wrapped in protocol messages, should be\n * able to remove this */\n _this.onData(protocolMessageFromRawError(err));\n }\n else {\n /* A network/xhr error. Don't bother wrapping in a protocol message,\n * just disconnect the transport */\n _this.disconnect(err);\n }\n return;\n }\n if (data) {\n _this.onData(data);\n }\n if (_this.pendingItems) {\n platform_1.default.Config.nextTick(function () {\n /* If there's a new send request by now, any pending items will have\n * been picked up by that; any new ones added since then will be\n * picked up after that one completes */\n if (!_this.sendRequest) {\n _this.sendAnyPending();\n }\n });\n }\n });\n sendRequest.exec();\n };\n CometTransport.prototype.recv = function () {\n var _this = this;\n /* do nothing if there is an active request, which might be streaming */\n if (this.recvRequest)\n return;\n /* If we're no longer connected, do nothing */\n if (!this.isConnected)\n return;\n var recvRequest = (this.recvRequest = this.createRequest(this.recvUri, null, this.authParams, null, this.stream ? XHRStates_1.default.REQ_RECV_STREAM : XHRStates_1.default.REQ_RECV_POLL));\n recvRequest.on('data', function (data) {\n _this.onData(data);\n });\n recvRequest.on('complete', function (err) {\n _this.recvRequest = null;\n /* A request completing must be considered activity, as realtime sends\n * heartbeats every 15s since a request began, not every 15s absolutely */\n _this.onActivity();\n if (err) {\n if (err.code) {\n /* A protocol error received from realtime. TODO: once realtime\n * consistently sends errors wrapped in protocol messages, should be\n * able to remove this */\n _this.onData(protocolMessageFromRawError(err));\n }\n else {\n /* A network/xhr error. Don't bother wrapping in a protocol message,\n * just disconnect the transport */\n _this.disconnect(err);\n }\n return;\n }\n platform_1.default.Config.nextTick(function () {\n _this.recv();\n });\n });\n recvRequest.exec();\n };\n CometTransport.prototype.onData = function (responseData) {\n try {\n var items = this.decodeResponse(responseData);\n if (items && items.length)\n for (var i = 0; i < items.length; i++)\n this.onProtocolMessage(protocolmessage_1.default.fromDeserialized(items[i]));\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'CometTransport.onData()', 'Unexpected exception handing channel event: ' + e.stack);\n }\n };\n CometTransport.prototype.encodeRequest = function (requestItems) {\n return JSON.stringify(requestItems);\n };\n CometTransport.prototype.decodeResponse = function (responseData) {\n if (typeof responseData == 'string')\n return JSON.parse(responseData);\n return responseData;\n };\n return CometTransport;\n}(transport_1.default));\nexports.default = CometTransport;\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports) {\n\nvar g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar auth_1 = tslib_1.__importDefault(__webpack_require__(17));\nvar HttpMethods_1 = tslib_1.__importDefault(__webpack_require__(18));\nvar errorinfo_1 = __webpack_require__(4);\nfunction withAuthDetails(rest, headers, params, errCallback, opCallback) {\n if (rest.http.supportsAuthHeaders) {\n rest.auth.getAuthHeaders(function (err, authHeaders) {\n if (err)\n errCallback(err);\n else\n opCallback(Utils.mixin(authHeaders, headers), params);\n });\n }\n else {\n rest.auth.getAuthParams(function (err, authParams) {\n if (err)\n errCallback(err);\n else\n opCallback(headers, Utils.mixin(authParams, params));\n });\n }\n}\nfunction unenvelope(callback, format) {\n return function (err, body, outerHeaders, unpacked, outerStatusCode) {\n if (err && !body) {\n callback(err);\n return;\n }\n if (!unpacked) {\n try {\n body = Utils.decodeBody(body, format);\n }\n catch (e) {\n if (Utils.isErrorInfoOrPartialErrorInfo(e)) {\n callback(e);\n }\n else {\n callback(new errorinfo_1.PartialErrorInfo(Utils.inspectError(e), null));\n }\n return;\n }\n }\n if (!body) {\n callback(new errorinfo_1.PartialErrorInfo('unenvelope(): Response body is missing', null));\n return;\n }\n var _a = body, wrappedStatusCode = _a.statusCode, response = _a.response, wrappedHeaders = _a.headers;\n if (wrappedStatusCode === undefined) {\n /* Envelope already unwrapped by the transport */\n callback(err, body, outerHeaders, true, outerStatusCode);\n return;\n }\n if (wrappedStatusCode < 200 || wrappedStatusCode >= 300) {\n /* handle wrapped errors */\n var wrappedErr = (response && response.error) || err;\n if (!wrappedErr) {\n wrappedErr = new Error('Error in unenveloping ' + body);\n wrappedErr.statusCode = wrappedStatusCode;\n }\n callback(wrappedErr, response, wrappedHeaders, true, wrappedStatusCode);\n return;\n }\n callback(err, response, wrappedHeaders, true, wrappedStatusCode);\n };\n}\nfunction paramString(params) {\n var paramPairs = [];\n if (params) {\n for (var needle in params) {\n paramPairs.push(needle + '=' + params[needle]);\n }\n }\n return paramPairs.join('&');\n}\nfunction urlFromPathAndParams(path, params) {\n return path + (params ? '?' : '') + paramString(params);\n}\nfunction logResponseHandler(callback, method, path, params) {\n return function (err, body, headers, unpacked, statusCode) {\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Resource.' + method + '()', 'Received Error; ' + urlFromPathAndParams(path, params) + '; Error: ' + Utils.inspectError(err));\n }\n else {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Resource.' + method + '()', 'Received; ' +\n urlFromPathAndParams(path, params) +\n '; Headers: ' +\n paramString(headers) +\n '; StatusCode: ' +\n statusCode +\n '; Body: ' +\n (platform_1.default.BufferUtils.isBuffer(body) ? body.toString() : body));\n }\n if (callback) {\n callback(err, body, headers, unpacked, statusCode);\n }\n };\n}\nvar Resource = /** @class */ (function () {\n function Resource() {\n }\n Resource.get = function (rest, path, headers, params, envelope, callback) {\n Resource.do(HttpMethods_1.default.Get, rest, path, null, headers, params, envelope, callback);\n };\n Resource.delete = function (rest, path, headers, params, envelope, callback) {\n Resource.do(HttpMethods_1.default.Delete, rest, path, null, headers, params, envelope, callback);\n };\n Resource.post = function (rest, path, body, headers, params, envelope, callback) {\n Resource.do(HttpMethods_1.default.Post, rest, path, body, headers, params, envelope, callback);\n };\n Resource.patch = function (rest, path, body, headers, params, envelope, callback) {\n Resource.do(HttpMethods_1.default.Patch, rest, path, body, headers, params, envelope, callback);\n };\n Resource.put = function (rest, path, body, headers, params, envelope, callback) {\n Resource.do(HttpMethods_1.default.Put, rest, path, body, headers, params, envelope, callback);\n };\n Resource.do = function (method, rest, path, body, headers, params, envelope, callback) {\n if (logger_1.default.shouldLog(logger_1.default.LOG_MICRO)) {\n callback = logResponseHandler(callback, method, path, params);\n }\n if (envelope) {\n callback = callback && unenvelope(callback, envelope);\n (params = params || {})['envelope'] = envelope;\n }\n function doRequest(headers, params) {\n var _a;\n if (logger_1.default.shouldLog(logger_1.default.LOG_MICRO)) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Resource.' + method + '()', 'Sending; ' + urlFromPathAndParams(path, params));\n }\n if (logger_1.default.shouldLog(logger_1.default.LOG_MICRO)) {\n var decodedBody = body;\n if (((_a = headers['content-type']) === null || _a === void 0 ? void 0 : _a.indexOf('msgpack')) > 0) {\n try {\n decodedBody = platform_1.default.Config.msgpack.decode(body);\n }\n catch (decodeErr) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Resource.' + method + '()', 'Sending MsgPack Decoding Error: ' + Utils.inspectError(decodeErr));\n }\n }\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Resource.' + method + '()', 'Sending; ' + urlFromPathAndParams(path, params) + '; Body: ' + decodedBody);\n }\n rest.http.do(method, rest, path, headers, body, params, function (err, res, headers, unpacked, statusCode) {\n if (err && auth_1.default.isTokenErr(err)) {\n /* token has expired, so get a new one */\n rest.auth.authorize(null, null, function (err) {\n if (err) {\n callback(err);\n return;\n }\n /* retry ... */\n withAuthDetails(rest, headers, params, callback, doRequest);\n });\n return;\n }\n callback(err, res, headers, unpacked, statusCode);\n });\n }\n withAuthDetails(rest, headers, params, callback, doRequest);\n };\n return Resource;\n}());\nexports.default = Resource;\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar message_1 = tslib_1.__importDefault(__webpack_require__(9));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nfunction toActionValue(actionString) {\n return PresenceMessage.Actions.indexOf(actionString);\n}\nvar PresenceMessage = /** @class */ (function () {\n function PresenceMessage() {\n }\n /* Returns whether this presenceMessage is synthesized, i.e. was not actually\n * sent by the connection (usually means a leave event sent 15s after a\n * disconnection). This is useful because synthesized messages cannot be\n * compared for newness by id lexicographically - RTP2b1\n */\n PresenceMessage.prototype.isSynthesized = function () {\n if (!this.id || !this.connectionId) {\n return true;\n }\n return this.id.substring(this.connectionId.length, 0) !== this.connectionId;\n };\n /* RTP2b2 */\n PresenceMessage.prototype.parseId = function () {\n if (!this.id)\n throw new Error('parseId(): Presence message does not contain an id');\n var parts = this.id.split(':');\n return {\n connectionId: parts[0],\n msgSerial: parseInt(parts[1], 10),\n index: parseInt(parts[2], 10),\n };\n };\n /**\n * Overload toJSON() to intercept JSON.stringify()\n * @return {*}\n */\n PresenceMessage.prototype.toJSON = function () {\n /* encode data to base64 if present and we're returning real JSON;\n * although msgpack calls toJSON(), we know it is a stringify()\n * call if it has a non-empty arguments list */\n var data = this.data;\n var encoding = this.encoding;\n if (data && platform_1.default.BufferUtils.isBuffer(data)) {\n if (arguments.length > 0) {\n /* stringify call */\n encoding = encoding ? encoding + '/base64' : 'base64';\n data = platform_1.default.BufferUtils.base64Encode(data);\n }\n else {\n /* Called by msgpack. toBuffer returns a datatype understandable by\n * that platform's msgpack implementation (Buffer in node, Uint8Array\n * in browsers) */\n data = platform_1.default.BufferUtils.toBuffer(data);\n }\n }\n return {\n id: this.id,\n clientId: this.clientId,\n /* Convert presence action back to an int for sending to Ably */\n action: toActionValue(this.action),\n data: data,\n encoding: encoding,\n extras: this.extras,\n };\n };\n PresenceMessage.prototype.toString = function () {\n var result = '[PresenceMessage';\n result += '; action=' + this.action;\n if (this.id)\n result += '; id=' + this.id;\n if (this.timestamp)\n result += '; timestamp=' + this.timestamp;\n if (this.clientId)\n result += '; clientId=' + this.clientId;\n if (this.connectionId)\n result += '; connectionId=' + this.connectionId;\n if (this.encoding)\n result += '; encoding=' + this.encoding;\n if (this.data) {\n if (typeof this.data == 'string')\n result += '; data=' + this.data;\n else if (platform_1.default.BufferUtils.isBuffer(this.data))\n result += '; data (buffer)=' + platform_1.default.BufferUtils.base64Encode(this.data);\n else\n result += '; data (json)=' + JSON.stringify(this.data);\n }\n if (this.extras) {\n result += '; extras=' + JSON.stringify(this.extras);\n }\n result += ']';\n return result;\n };\n PresenceMessage.fromResponseBody = function (body, options, format) {\n var messages = [];\n if (format) {\n body = Utils.decodeBody(body, format);\n }\n for (var i = 0; i < body.length; i++) {\n var msg = (messages[i] = PresenceMessage.fromValues(body[i], true));\n try {\n PresenceMessage.decode(msg, options);\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'PresenceMessage.fromResponseBody()', e.toString());\n }\n }\n return messages;\n };\n PresenceMessage.fromValues = function (values, stringifyAction) {\n if (stringifyAction) {\n values.action = PresenceMessage.Actions[values.action];\n }\n return Object.assign(new PresenceMessage(), values);\n };\n PresenceMessage.fromValuesArray = function (values) {\n var count = values.length, result = new Array(count);\n for (var i = 0; i < count; i++)\n result[i] = PresenceMessage.fromValues(values[i]);\n return result;\n };\n PresenceMessage.fromEncoded = function (encoded, options) {\n var msg = PresenceMessage.fromValues(encoded, true);\n /* if decoding fails at any point, catch and return the message decoded to\n * the fullest extent possible */\n try {\n PresenceMessage.decode(msg, options !== null && options !== void 0 ? options : {});\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'PresenceMessage.fromEncoded()', e.toString());\n }\n return msg;\n };\n PresenceMessage.fromEncodedArray = function (encodedArray, options) {\n return encodedArray.map(function (encoded) {\n return PresenceMessage.fromEncoded(encoded, options);\n });\n };\n PresenceMessage.fromData = function (data) {\n if (data instanceof PresenceMessage) {\n return data;\n }\n return PresenceMessage.fromValues({\n data: data,\n });\n };\n PresenceMessage.Actions = ['absent', 'present', 'enter', 'leave', 'update'];\n PresenceMessage.encode = message_1.default.encode;\n PresenceMessage.decode = message_1.default.decode;\n PresenceMessage.getMessagesSize = message_1.default.getMessagesSize;\n return PresenceMessage;\n}());\nexports.default = PresenceMessage;\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar errorinfo_1 = tslib_1.__importStar(__webpack_require__(4));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar defaults_1 = tslib_1.__importDefault(__webpack_require__(8));\nvar XHRStates_1 = tslib_1.__importDefault(__webpack_require__(21));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nfunction isAblyError(responseBody, headers) {\n return Utils.arrIn(Utils.allToLowerCase(Utils.keysArray(headers)), 'x-ably-errorcode');\n}\nfunction getAblyError(responseBody, headers) {\n if (isAblyError(responseBody, headers)) {\n return responseBody.error && errorinfo_1.default.fromValues(responseBody.error);\n }\n}\nvar noop = function () { };\nvar idCounter = 0;\nvar pendingRequests = {};\nvar isIE = typeof global !== 'undefined' && global.XDomainRequest;\nfunction ieVersion() {\n var match = navigator.userAgent.toString().match(/MSIE\\s([\\d.]+)/);\n return match && Number(match[1]);\n}\nfunction needJsonEnvelope() {\n /* IE 10 xhr bug: http://stackoverflow.com/a/16320339 */\n var version;\n return isIE && (version = ieVersion()) && version === 10;\n}\nfunction getHeader(xhr, header) {\n return xhr.getResponseHeader && xhr.getResponseHeader(header);\n}\n/* Safari mysteriously returns 'Identity' for transfer-encoding when in fact\n * it is 'chunked'. So instead, decide that it is chunked when\n * transfer-encoding is present or content-length is absent. ('or' because\n * when using http2 streaming, there's no transfer-encoding header, but can\n * still deduce streaming from lack of content-length) */\nfunction isEncodingChunked(xhr) {\n return (xhr.getResponseHeader && (xhr.getResponseHeader('transfer-encoding') || !xhr.getResponseHeader('content-length')));\n}\nfunction getHeadersAsObject(xhr) {\n var headerPairs = Utils.trim(xhr.getAllResponseHeaders()).split('\\r\\n');\n var headers = {};\n for (var i = 0; i < headerPairs.length; i++) {\n var parts = headerPairs[i].split(':').map(Utils.trim);\n headers[parts[0].toLowerCase()] = parts[1];\n }\n return headers;\n}\nvar XHRRequest = /** @class */ (function (_super) {\n tslib_1.__extends(XHRRequest, _super);\n function XHRRequest(uri, headers, params, body, requestMode, timeouts, method) {\n var _this = _super.call(this) || this;\n params = params || {};\n params.rnd = Utils.cheapRandStr();\n if (needJsonEnvelope() && !params.envelope)\n params.envelope = 'json';\n _this.uri = uri + Utils.toQueryString(params);\n _this.headers = headers || {};\n _this.body = body;\n _this.method = method ? method.toUpperCase() : Utils.isEmptyArg(body) ? 'GET' : 'POST';\n _this.requestMode = requestMode;\n _this.timeouts = timeouts;\n _this.timedOut = false;\n _this.requestComplete = false;\n _this.id = String(++idCounter);\n pendingRequests[_this.id] = _this;\n return _this;\n }\n XHRRequest.createRequest = function (uri, headers, params, body, requestMode, timeouts, method) {\n /* XHR requests are used either with the context being a realtime\n * transport, or with timeouts passed in (for when used by a rest client),\n * or completely standalone. Use the appropriate timeouts in each case */\n var _timeouts = timeouts || defaults_1.default.TIMEOUTS;\n return new XHRRequest(uri, headers, Utils.copy(params), body, requestMode, _timeouts, method);\n };\n XHRRequest.prototype.complete = function (err, body, headers, unpacked, statusCode) {\n if (!this.requestComplete) {\n this.requestComplete = true;\n if (!err && body) {\n this.emit('data', body);\n }\n this.emit('complete', err, body, headers, unpacked, statusCode);\n this.dispose();\n }\n };\n XHRRequest.prototype.abort = function () {\n this.dispose();\n };\n XHRRequest.prototype.exec = function () {\n var _this = this;\n var headers = this.headers;\n var timeout = this.requestMode == XHRStates_1.default.REQ_SEND ? this.timeouts.httpRequestTimeout : this.timeouts.recvTimeout, timer = (this.timer = setTimeout(function () {\n _this.timedOut = true;\n xhr.abort();\n }, timeout)), method = this.method, xhr = (this.xhr = new XMLHttpRequest()), accept = headers['accept'];\n var body = this.body;\n var responseType = 'text';\n if (!accept) {\n // Default to JSON\n headers['accept'] = 'application/json';\n }\n else if (accept.indexOf('application/x-msgpack') === 0) {\n // Msgpack responses will be typed as ArrayBuffer\n responseType = 'arraybuffer';\n }\n if (body) {\n var contentType = headers['content-type'] || (headers['content-type'] = 'application/json');\n if (contentType.indexOf('application/json') > -1 && typeof body != 'string')\n body = JSON.stringify(body);\n }\n // Can probably remove this directive if https://github.com/nodesecurity/eslint-plugin-security/issues/26 is resolved\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n xhr.open(method, this.uri, true);\n xhr.responseType = responseType;\n if ('authorization' in headers) {\n xhr.withCredentials = true;\n }\n for (var h in headers)\n xhr.setRequestHeader(h, headers[h]);\n var errorHandler = function (errorEvent, message, code, statusCode) {\n var _a;\n var errorMessage = message + ' (event type: ' + errorEvent.type + ')';\n if ((_a = _this === null || _this === void 0 ? void 0 : _this.xhr) === null || _a === void 0 ? void 0 : _a.statusText)\n errorMessage += ', current statusText is ' + _this.xhr.statusText;\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Request.on' + errorEvent.type + '()', errorMessage);\n _this.complete(new errorinfo_1.PartialErrorInfo(errorMessage, code, statusCode));\n };\n xhr.onerror = function (errorEvent) {\n errorHandler(errorEvent, 'XHR error occurred', null, 400);\n };\n xhr.onabort = function (errorEvent) {\n if (_this.timedOut) {\n errorHandler(errorEvent, 'Request aborted due to request timeout expiring', null, 408);\n }\n else {\n errorHandler(errorEvent, 'Request cancelled', null, 400);\n }\n };\n xhr.ontimeout = function (errorEvent) {\n errorHandler(errorEvent, 'Request timed out', null, 408);\n };\n var streaming;\n var statusCode;\n var successResponse;\n var streamPos = 0;\n var unpacked = false;\n var onResponse = function () {\n clearTimeout(timer);\n successResponse = statusCode < 400;\n if (statusCode == 204) {\n _this.complete(null, null, null, null, statusCode);\n return;\n }\n streaming = _this.requestMode == XHRStates_1.default.REQ_RECV_STREAM && successResponse && isEncodingChunked(xhr);\n };\n var onEnd = function () {\n var parsedResponse;\n try {\n var contentType = getHeader(xhr, 'content-type');\n /* Be liberal in what we accept; buggy auth servers may respond\n * without the correct contenttype, but assume they're still\n * responding with json */\n var json = contentType ? contentType.indexOf('application/json') >= 0 : xhr.responseType == 'text';\n if (json) {\n /* If we requested msgpack but server responded with json, then since\n * we set the responseType expecting msgpack, the response will be\n * an ArrayBuffer containing json */\n var jsonResponseBody = xhr.responseType === 'arraybuffer'\n ? platform_1.default.BufferUtils.utf8Decode(xhr.response)\n : String(xhr.responseText);\n if (jsonResponseBody.length) {\n parsedResponse = JSON.parse(jsonResponseBody);\n }\n else {\n parsedResponse = jsonResponseBody;\n }\n unpacked = true;\n }\n else {\n parsedResponse = xhr.response;\n }\n if (parsedResponse.response !== undefined) {\n /* unwrap JSON envelope */\n statusCode = parsedResponse.statusCode;\n successResponse = statusCode < 400;\n headers = parsedResponse.headers;\n parsedResponse = parsedResponse.response;\n }\n else {\n headers = getHeadersAsObject(xhr);\n }\n }\n catch (e) {\n _this.complete(new errorinfo_1.PartialErrorInfo('Malformed response body from server: ' + e.message, null, 400));\n return;\n }\n /* If response is an array, it's an array of protocol messages -- even if\n * is contains an error action (hence the nonsuccess statuscode), we can\n * consider the request to have succeeded, just pass it on to\n * onProtocolMessage to decide what to do */\n if (successResponse || Utils.isArray(parsedResponse)) {\n _this.complete(null, parsedResponse, headers, unpacked, statusCode);\n return;\n }\n var err = getAblyError(parsedResponse, headers);\n if (!err) {\n err = new errorinfo_1.PartialErrorInfo('Error response received from server: ' +\n statusCode +\n ' body was: ' +\n platform_1.default.Config.inspect(parsedResponse), null, statusCode);\n }\n _this.complete(err, parsedResponse, headers, unpacked, statusCode);\n };\n function onProgress() {\n var responseText = xhr.responseText;\n var bodyEnd = responseText.length - 1;\n var idx, chunk;\n while (streamPos < bodyEnd && (idx = responseText.indexOf('\\n', streamPos)) > -1) {\n chunk = responseText.slice(streamPos, idx);\n streamPos = idx + 1;\n onChunk(chunk);\n }\n }\n var onChunk = function (chunk) {\n try {\n chunk = JSON.parse(chunk);\n }\n catch (e) {\n _this.complete(new errorinfo_1.PartialErrorInfo('Malformed response body from server: ' + e.message, null, 400));\n return;\n }\n _this.emit('data', chunk);\n };\n var onStreamEnd = function () {\n onProgress();\n _this.streamComplete = true;\n platform_1.default.Config.nextTick(function () {\n _this.complete();\n });\n };\n xhr.onreadystatechange = function () {\n var readyState = xhr.readyState;\n if (readyState < 3)\n return;\n if (xhr.status !== 0) {\n if (statusCode === undefined) {\n statusCode = xhr.status;\n /* IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450 */\n if (statusCode === 1223)\n statusCode = 204;\n onResponse();\n }\n if (readyState == 3 && streaming) {\n onProgress();\n }\n else if (readyState == 4) {\n if (streaming)\n onStreamEnd();\n else\n onEnd();\n }\n }\n };\n xhr.send(body);\n };\n XHRRequest.prototype.dispose = function () {\n var xhr = this.xhr;\n if (xhr) {\n xhr.onreadystatechange = xhr.onerror = xhr.onabort = xhr.ontimeout = noop;\n this.xhr = null;\n var timer = this.timer;\n if (timer) {\n clearTimeout(timer);\n this.timer = null;\n }\n if (!this.requestComplete)\n xhr.abort();\n }\n delete pendingRequests[this.id];\n };\n return XHRRequest;\n}(eventemitter_1.default));\nexports.default = XHRRequest;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13)))\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar multicaster_1 = tslib_1.__importDefault(__webpack_require__(23));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar hmac_sha256_1 = tslib_1.__importDefault(__webpack_require__(45));\nvar enc_base64_1 = __webpack_require__(11);\nvar HttpMethods_1 = tslib_1.__importDefault(__webpack_require__(18));\nvar HttpStatusCodes_1 = tslib_1.__importDefault(__webpack_require__(25));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar resource_1 = tslib_1.__importDefault(__webpack_require__(14));\nvar MAX_TOKEN_LENGTH = Math.pow(2, 17);\nfunction noop() { }\nfunction random() {\n return ('000000' + Math.floor(Math.random() * 1e16)).slice(-16);\n}\nfunction isRealtime(client) {\n return !!client.connection;\n}\n/* A client auth callback may give errors in any number of formats; normalise to an ErrorInfo or PartialErrorInfo */\nfunction normaliseAuthcallbackError(err) {\n if (!Utils.isErrorInfoOrPartialErrorInfo(err)) {\n return new errorinfo_1.default(Utils.inspectError(err), err.code || 40170, err.statusCode || 401);\n }\n /* network errors will not have an inherent error code */\n if (!err.code) {\n if (err.statusCode === 403) {\n err.code = 40300;\n }\n else {\n err.code = 40170;\n /* normalise statusCode to 401 per RSA4e */\n err.statusCode = 401;\n }\n }\n return err;\n}\nvar hmac = function (text, key) {\n if (platform_1.default.Config.createHmac) {\n var inst = platform_1.default.Config.createHmac('SHA256', key);\n inst.update(text);\n return inst.digest('base64');\n }\n return (0, enc_base64_1.stringify)((0, hmac_sha256_1.default)(text, key));\n};\nfunction c14n(capability) {\n if (!capability)\n return '';\n if (typeof capability == 'string')\n capability = JSON.parse(capability);\n var c14nCapability = Object.create(null);\n var keys = Utils.keysArray(capability, true);\n if (!keys)\n return '';\n keys.sort();\n for (var i = 0; i < keys.length; i++) {\n c14nCapability[keys[i]] = capability[keys[i]].sort();\n }\n return JSON.stringify(c14nCapability);\n}\nfunction logAndValidateTokenAuthMethod(authOptions) {\n if (authOptions.authCallback) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth()', 'using token auth with authCallback');\n }\n else if (authOptions.authUrl) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth()', 'using token auth with authUrl');\n }\n else if (authOptions.key) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth()', 'using token auth with client-side signing');\n }\n else if (authOptions.tokenDetails) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth()', 'using token auth with supplied token only');\n }\n else {\n var msg = 'authOptions must include valid authentication parameters';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth()', msg);\n throw new Error(msg);\n }\n}\nfunction basicAuthForced(options) {\n return 'useTokenAuth' in options && !options.useTokenAuth;\n}\n/* RSA4 */\nfunction useTokenAuth(options) {\n return (options.useTokenAuth ||\n (!basicAuthForced(options) && (options.authCallback || options.authUrl || options.token || options.tokenDetails)));\n}\n/* RSA4a */\nfunction noWayToRenew(options) {\n return !options.key && !options.authCallback && !options.authUrl;\n}\nvar trId = 0;\nfunction getTokenRequestId() {\n return trId++;\n}\nvar Auth = /** @class */ (function () {\n function Auth(client, options) {\n // This initialization is always overwritten and only used to prevent a TypeScript compiler error\n this.authOptions = {};\n this.client = client;\n this.tokenParams = options.defaultTokenParams || {};\n /* The id of the current token request if one is in progress, else null */\n this.currentTokenRequestId = null;\n this.waitingForTokenRequest = null;\n if (useTokenAuth(options)) {\n /* Token auth */\n if (options.key && !hmac) {\n var msg = 'client-side token request signing not supported';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth()', msg);\n throw new Error(msg);\n }\n if (noWayToRenew(options)) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth()', 'Warning: library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help');\n }\n this._saveTokenOptions(options.defaultTokenParams, options);\n logAndValidateTokenAuthMethod(this.authOptions);\n }\n else {\n /* Basic auth */\n if (!options.key) {\n var msg = 'No authentication options provided; need one of: key, authUrl, or authCallback (or for testing only, token or tokenDetails)';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth()', msg);\n throw new errorinfo_1.default(msg, 40160, 401);\n }\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth()', 'anonymous, using basic auth');\n this._saveBasicOptions(options);\n }\n }\n Auth.prototype.authorize = function (tokenParams, authOptions, callback) {\n var _this = this;\n var _authOptions;\n /* shuffle and normalise arguments as necessary */\n if (typeof tokenParams == 'function' && !callback) {\n callback = tokenParams;\n _authOptions = tokenParams = null;\n }\n else if (typeof authOptions == 'function' && !callback) {\n callback = authOptions;\n _authOptions = null;\n }\n else {\n _authOptions = authOptions;\n }\n if (!callback) {\n if (this.client.options.promises) {\n return Utils.promisify(this, 'authorize', arguments);\n }\n }\n /* RSA10a: authorize() call implies token auth. If a key is passed it, we\n * just check if it doesn't clash and assume we're generating a token from it */\n if (_authOptions && _authOptions.key && this.authOptions.key !== _authOptions.key) {\n throw new errorinfo_1.default('Unable to update auth options with incompatible key', 40102, 401);\n }\n if (_authOptions && 'force' in _authOptions) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth.authorize', 'Deprecation warning: specifying {force: true} in authOptions is no longer necessary, authorize() now always gets a new token. Please remove this, as in version 1.0 and later, having a non-null authOptions will overwrite stored library authOptions, which may not be what you want');\n /* Emulate the old behaviour: if 'force' was the only member of authOptions,\n * set it to null so it doesn't overwrite stored. TODO: remove in version 1.0 */\n if (Utils.isOnlyPropIn(_authOptions, 'force')) {\n _authOptions = null;\n }\n }\n this._forceNewToken(tokenParams, _authOptions, function (err, tokenDetails) {\n if (err) {\n if (_this.client.connection && err.statusCode === HttpStatusCodes_1.default.Forbidden) {\n /* Per RSA4d & RSA4d1, if the auth server explicitly repudiates our right to\n * stay connecticed by returning a 403, we actively disconnect the connection\n * even though we may well still have time left in the old token. */\n _this.client.connection.connectionManager.actOnErrorFromAuthorize(err);\n }\n callback === null || callback === void 0 ? void 0 : callback(err);\n return;\n }\n /* RTC8\n * - When authorize called by an end user and have a realtime connection,\n * don't call back till new token has taken effect.\n * - Use this.client.connection as a proxy for (this.client instanceof Realtime),\n * which doesn't work in node as Realtime isn't part of the vm context for Rest clients */\n if (isRealtime(_this.client)) {\n _this.client.connection.connectionManager.onAuthUpdated(tokenDetails, callback || noop);\n }\n else {\n callback === null || callback === void 0 ? void 0 : callback(null, tokenDetails);\n }\n });\n };\n Auth.prototype.authorise = function (tokenParams, authOptions, callback) {\n logger_1.default.deprecated('Auth.authorise', 'Auth.authorize');\n this.authorize(tokenParams, authOptions, callback);\n };\n /* For internal use, eg by connectionManager - useful when want to call back\n * as soon as we have the new token, rather than waiting for it to take\n * effect on the connection as #authorize does */\n Auth.prototype._forceNewToken = function (tokenParams, authOptions, callback) {\n var _this = this;\n /* get rid of current token even if still valid */\n this.tokenDetails = null;\n /* _save normalises the tokenParams and authOptions and updates the auth\n * object. All subsequent operations should use the values on `this`,\n * not the passed in ones. */\n this._saveTokenOptions(tokenParams, authOptions);\n logAndValidateTokenAuthMethod(this.authOptions);\n this._ensureValidAuthCredentials(true, function (err, tokenDetails) {\n /* RSA10g */\n delete _this.tokenParams.timestamp;\n delete _this.authOptions.queryTime;\n callback(err, tokenDetails);\n });\n };\n Auth.prototype.requestToken = function (tokenParams, authOptions, callback) {\n var _this = this;\n /* shuffle and normalise arguments as necessary */\n if (typeof tokenParams == 'function' && !callback) {\n callback = tokenParams;\n authOptions = tokenParams = null;\n }\n else if (typeof authOptions == 'function' && !callback) {\n callback = authOptions;\n authOptions = null;\n }\n if (!callback && this.client.options.promises) {\n return Utils.promisify(this, 'requestToken', arguments);\n }\n /* RSA8e: if authOptions passed in, they're used instead of stored, don't merge them */\n authOptions = authOptions || this.authOptions;\n tokenParams = tokenParams || Utils.copy(this.tokenParams);\n var _callback = callback || noop;\n /* first set up whatever callback will be used to get signed\n * token requests */\n var tokenRequestCallback, client = this.client;\n if (authOptions.authCallback) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth.requestToken()', 'using token auth with authCallback');\n tokenRequestCallback = authOptions.authCallback;\n }\n else if (authOptions.authUrl) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth.requestToken()', 'using token auth with authUrl');\n tokenRequestCallback = function (params, cb) {\n var authHeaders = Utils.mixin({ accept: 'application/json, text/plain' }, authOptions.authHeaders);\n var usePost = authOptions.authMethod && authOptions.authMethod.toLowerCase() === 'post';\n var providedQsParams;\n /* Combine authParams with any qs params given in the authUrl */\n var queryIdx = authOptions.authUrl.indexOf('?');\n if (queryIdx > -1) {\n providedQsParams = Utils.parseQueryString(authOptions.authUrl.slice(queryIdx));\n authOptions.authUrl = authOptions.authUrl.slice(0, queryIdx);\n if (!usePost) {\n /* In case of conflict, authParams take precedence over qs params in the authUrl */\n authOptions.authParams = Utils.mixin(providedQsParams, authOptions.authParams);\n }\n }\n /* RSA8c2 */\n var authParams = Utils.mixin({}, authOptions.authParams || {}, params);\n var authUrlRequestCallback = function (err, body, headers, unpacked) {\n var contentType;\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Auth.requestToken().tokenRequestCallback', 'Received Error: ' + Utils.inspectError(err));\n }\n else {\n contentType = headers['content-type'];\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Auth.requestToken().tokenRequestCallback', 'Received; content-type: ' + contentType + '; body: ' + Utils.inspectBody(body));\n }\n if (err || unpacked)\n return cb(err, body);\n if (platform_1.default.BufferUtils.isBuffer(body))\n body = body.toString();\n if (!contentType) {\n cb(new errorinfo_1.default('authUrl response is missing a content-type header', 40170, 401));\n return;\n }\n var json = contentType.indexOf('application/json') > -1, text = contentType.indexOf('text/plain') > -1 || contentType.indexOf('application/jwt') > -1;\n if (!json && !text) {\n cb(new errorinfo_1.default('authUrl responded with unacceptable content-type ' +\n contentType +\n ', should be either text/plain, application/jwt or application/json', 40170, 401));\n return;\n }\n if (json) {\n if (body.length > MAX_TOKEN_LENGTH) {\n cb(new errorinfo_1.default('authUrl response exceeded max permitted length', 40170, 401));\n return;\n }\n try {\n body = JSON.parse(body);\n }\n catch (e) {\n cb(new errorinfo_1.default('Unexpected error processing authURL response; err = ' + e.message, 40170, 401));\n return;\n }\n }\n cb(null, body, contentType);\n };\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Auth.requestToken().tokenRequestCallback', 'Requesting token from ' +\n authOptions.authUrl +\n '; Params: ' +\n JSON.stringify(authParams) +\n '; method: ' +\n (usePost ? 'POST' : 'GET'));\n if (usePost) {\n /* send body form-encoded */\n var headers = authHeaders || {};\n headers['content-type'] = 'application/x-www-form-urlencoded';\n var body = Utils.toQueryString(authParams).slice(1); /* slice is to remove the initial '?' */\n _this.client.http.doUri(HttpMethods_1.default.Post, client, authOptions.authUrl, headers, body, providedQsParams, authUrlRequestCallback);\n }\n else {\n _this.client.http.doUri(HttpMethods_1.default.Get, client, authOptions.authUrl, authHeaders || {}, null, authParams, authUrlRequestCallback);\n }\n };\n }\n else if (authOptions.key) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth.requestToken()', 'using token auth with client-side signing');\n tokenRequestCallback = function (params, cb) {\n _this.createTokenRequest(params, authOptions, cb);\n };\n }\n else {\n var msg = 'Need a new token, but authOptions does not include any way to request one (no authUrl, authCallback, or key)';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth()', 'library initialized with a token literal without any way to renew the token when it expires (no authUrl, authCallback, or key). See https://help.ably.io/error/40171 for help');\n _callback(new errorinfo_1.default(msg, 40171, 403));\n return;\n }\n /* normalise token params */\n if ('capability' in tokenParams)\n tokenParams.capability = c14n(tokenParams.capability);\n var tokenRequest = function (signedTokenParams, tokenCb) {\n var keyName = signedTokenParams.keyName, path = '/keys/' + keyName + '/requestToken', tokenUri = function (host) {\n return client.baseUri(host) + path;\n };\n var requestHeaders = Utils.defaultPostHeaders(_this.client.options);\n if (authOptions.requestHeaders)\n Utils.mixin(requestHeaders, authOptions.requestHeaders);\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Auth.requestToken().requestToken', 'Sending POST to ' + path + '; Token params: ' + JSON.stringify(signedTokenParams));\n _this.client.http.do(HttpMethods_1.default.Post, client, tokenUri, requestHeaders, JSON.stringify(signedTokenParams), null, tokenCb);\n };\n var tokenRequestCallbackTimeoutExpired = false, timeoutLength = this.client.options.timeouts.realtimeRequestTimeout, tokenRequestCallbackTimeout = setTimeout(function () {\n tokenRequestCallbackTimeoutExpired = true;\n var msg = 'Token request callback timed out after ' + timeoutLength / 1000 + ' seconds';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth.requestToken()', msg);\n _callback(new errorinfo_1.default(msg, 40170, 401));\n }, timeoutLength);\n tokenRequestCallback(tokenParams, function (err, tokenRequestOrDetails, contentType) {\n if (tokenRequestCallbackTimeoutExpired)\n return;\n clearTimeout(tokenRequestCallbackTimeout);\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth.requestToken()', 'token request signing call returned error; err = ' + Utils.inspectError(err));\n _callback(normaliseAuthcallbackError(err));\n return;\n }\n /* the response from the callback might be a token string, a signed request or a token details */\n if (typeof tokenRequestOrDetails === 'string') {\n if (tokenRequestOrDetails.length === 0) {\n _callback(new errorinfo_1.default('Token string is empty', 40170, 401));\n }\n else if (tokenRequestOrDetails.length > MAX_TOKEN_LENGTH) {\n _callback(new errorinfo_1.default('Token string exceeded max permitted length (was ' + tokenRequestOrDetails.length + ' bytes)', 40170, 401));\n }\n else if (tokenRequestOrDetails === 'undefined' || tokenRequestOrDetails === 'null') {\n /* common failure mode with poorly-implemented authCallbacks */\n _callback(new errorinfo_1.default('Token string was literal null/undefined', 40170, 401));\n }\n else if (tokenRequestOrDetails[0] === '{' && !(contentType && contentType.indexOf('application/jwt') > -1)) {\n _callback(new errorinfo_1.default(\"Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details\", 40170, 401));\n }\n else {\n _callback(null, { token: tokenRequestOrDetails });\n }\n return;\n }\n if (typeof tokenRequestOrDetails !== 'object') {\n var msg = 'Expected token request callback to call back with a token string or token request/details object, but got a ' +\n typeof tokenRequestOrDetails;\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth.requestToken()', msg);\n _callback(new errorinfo_1.default(msg, 40170, 401));\n return;\n }\n var objectSize = JSON.stringify(tokenRequestOrDetails).length;\n if (objectSize > MAX_TOKEN_LENGTH && !authOptions.suppressMaxLengthCheck) {\n _callback(new errorinfo_1.default('Token request/details object exceeded max permitted stringified size (was ' + objectSize + ' bytes)', 40170, 401));\n return;\n }\n if ('issued' in tokenRequestOrDetails) {\n /* a tokenDetails object */\n _callback(null, tokenRequestOrDetails);\n return;\n }\n if (!('keyName' in tokenRequestOrDetails)) {\n var msg = 'Expected token request callback to call back with a token string, token request object, or token details object';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth.requestToken()', msg);\n _callback(new errorinfo_1.default(msg, 40170, 401));\n return;\n }\n /* it's a token request, so make the request */\n tokenRequest(tokenRequestOrDetails, function (err, tokenResponse, headers, unpacked) {\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth.requestToken()', 'token request API call returned error; err = ' + Utils.inspectError(err));\n _callback(normaliseAuthcallbackError(err));\n return;\n }\n if (!unpacked)\n tokenResponse = JSON.parse(tokenResponse);\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth.getToken()', 'token received');\n _callback(null, tokenResponse);\n });\n });\n };\n /**\n * Create and sign a token request based on the given options.\n * NOTE this can only be used when the key value is available locally.\n * Otherwise, signed token requests must be obtained from the key\n * owner (either using the token request callback or url).\n *\n * @param authOptions\n * an object containing the request options:\n * - key: the key to use. If not specified, a key passed in constructing\n * the Rest interface will be used\n *\n * - queryTime (optional) boolean indicating that the ably system should be\n * queried for the current time when none is specified explicitly\n *\n * - requestHeaders (optional, unsupported, for testing only) extra headers to add to the\n * requestToken request\n *\n * @param tokenParams\n * an object containing the parameters for the requested token:\n * - ttl: (optional) the requested life of the token in ms. If none is specified\n * a default of 1 hour is provided. The maximum lifetime is 24hours; any request\n * exceeding that lifetime will be rejected with an error.\n *\n * - capability: (optional) the capability to associate with the access token.\n * If none is specified, a token will be requested with all of the\n * capabilities of the specified key.\n *\n * - clientId: (optional) a client ID to associate with the token; if not\n * specified, a clientId passed in constructing the Rest interface will be used\n *\n * - timestamp: (optional) the time in ms since the epoch. If none is specified,\n * the system will be queried for a time value to use.\n *\n * @param callback\n */\n Auth.prototype.createTokenRequest = function (tokenParams, authOptions, callback) {\n var _this = this;\n /* shuffle and normalise arguments as necessary */\n if (typeof tokenParams == 'function' && !callback) {\n callback = tokenParams;\n authOptions = tokenParams = null;\n }\n else if (typeof authOptions == 'function' && !callback) {\n callback = authOptions;\n authOptions = null;\n }\n if (!callback && this.client.options.promises) {\n return Utils.promisify(this, 'createTokenRequest', arguments);\n }\n /* RSA9h: if authOptions passed in, they're used instead of stored, don't merge them */\n authOptions = authOptions || this.authOptions;\n tokenParams = tokenParams || Utils.copy(this.tokenParams);\n var key = authOptions.key;\n if (!key) {\n callback(new errorinfo_1.default('No key specified', 40101, 403));\n return;\n }\n var keyParts = key.split(':'), keyName = keyParts[0], keySecret = keyParts[1];\n if (!keySecret) {\n callback(new errorinfo_1.default('Invalid key specified', 40101, 403));\n return;\n }\n if (tokenParams.clientId === '') {\n callback(new errorinfo_1.default('clientId can’t be an empty string', 40012, 400));\n return;\n }\n if ('capability' in tokenParams) {\n tokenParams.capability = c14n(tokenParams.capability);\n }\n var request = Utils.mixin({ keyName: keyName }, tokenParams), clientId = tokenParams.clientId || '', ttl = tokenParams.ttl || '', capability = tokenParams.capability || '';\n (function (authoriseCb) {\n if (request.timestamp) {\n authoriseCb();\n return;\n }\n _this.getTimestamp(authOptions && authOptions.queryTime, function (err, time) {\n if (err) {\n callback(err);\n return;\n }\n request.timestamp = time;\n authoriseCb();\n });\n })(function () {\n /* nonce */\n /* NOTE: there is no expectation that the client\n * specifies the nonce; this is done by the library\n * However, this can be overridden by the client\n * simply for testing purposes. */\n var nonce = request.nonce || (request.nonce = random()), timestamp = request.timestamp;\n var signText = request.keyName + '\\n' + ttl + '\\n' + capability + '\\n' + clientId + '\\n' + timestamp + '\\n' + nonce + '\\n';\n /* mac */\n /* NOTE: there is no expectation that the client\n * specifies the mac; this is done by the library\n * However, this can be overridden by the client\n * simply for testing purposes. */\n request.mac = request.mac || hmac(signText, keySecret);\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth.getTokenRequest()', 'generated signed request');\n callback(null, request);\n });\n };\n /**\n * Get the auth query params to use for a websocket connection,\n * based on the current auth parameters\n */\n Auth.prototype.getAuthParams = function (callback) {\n if (this.method == 'basic')\n callback(null, { key: this.key });\n else\n this._ensureValidAuthCredentials(false, function (err, tokenDetails) {\n if (err) {\n callback(err);\n return;\n }\n if (!tokenDetails) {\n throw new Error('Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails');\n }\n callback(null, { access_token: tokenDetails.token });\n });\n };\n /**\n * Get the authorization header to use for a REST or comet request,\n * based on the current auth parameters\n */\n Auth.prototype.getAuthHeaders = function (callback) {\n if (this.method == 'basic') {\n callback(null, { authorization: 'Basic ' + this.basicKey });\n }\n else {\n this._ensureValidAuthCredentials(false, function (err, tokenDetails) {\n if (err) {\n callback(err);\n return;\n }\n if (!tokenDetails) {\n throw new Error('Auth.getAuthParams(): _ensureValidAuthCredentials returned no error or tokenDetails');\n }\n callback(null, { authorization: 'Bearer ' + Utils.toBase64(tokenDetails.token) });\n });\n }\n };\n /**\n * Get the current time based on the local clock,\n * or if the option queryTime is true, return the server time.\n * The server time offset from the local time is stored so that\n * only one request to the server to get the time is ever needed\n */\n Auth.prototype.getTimestamp = function (queryTime, callback) {\n if (!this.isTimeOffsetSet() && (queryTime || this.authOptions.queryTime)) {\n this.client.time(callback);\n }\n else {\n callback(null, this.getTimestampUsingOffset());\n }\n };\n Auth.prototype.getTimestampUsingOffset = function () {\n return Utils.now() + (this.client.serverTimeOffset || 0);\n };\n Auth.prototype.isTimeOffsetSet = function () {\n return this.client.serverTimeOffset !== null;\n };\n Auth.prototype._saveBasicOptions = function (authOptions) {\n this.method = 'basic';\n this.key = authOptions.key;\n this.basicKey = Utils.toBase64(authOptions.key);\n this.authOptions = authOptions || {};\n if ('clientId' in authOptions) {\n this._userSetClientId(authOptions.clientId);\n }\n };\n Auth.prototype._saveTokenOptions = function (tokenParams, authOptions) {\n this.method = 'token';\n if (tokenParams) {\n /* We temporarily persist tokenParams.timestamp in case a new token needs\n * to be requested, then null it out in the callback of\n * _ensureValidAuthCredentials for RSA10g compliance */\n this.tokenParams = tokenParams;\n }\n if (authOptions) {\n /* normalise */\n if (authOptions.token) {\n /* options.token may contain a token string or, for convenience, a TokenDetails */\n authOptions.tokenDetails =\n typeof authOptions.token === 'string'\n ? { token: authOptions.token }\n : authOptions.token;\n }\n if (authOptions.tokenDetails) {\n this.tokenDetails = authOptions.tokenDetails;\n }\n if ('clientId' in authOptions) {\n this._userSetClientId(authOptions.clientId);\n }\n this.authOptions = authOptions;\n }\n };\n /* @param forceSupersede: force a new token request even if there's one in\n * progress, making all pending callbacks wait for the new one */\n Auth.prototype._ensureValidAuthCredentials = function (forceSupersede, callback) {\n var _this = this;\n var token = this.tokenDetails;\n if (token) {\n if (this._tokenClientIdMismatch(token.clientId)) {\n /* 403 to trigger a permanently failed client - RSA15c */\n callback(new errorinfo_1.default('Mismatch between clientId in token (' + token.clientId + ') and current clientId (' + this.clientId + ')', 40102, 403));\n return;\n }\n /* RSA4b1 -- if we have a server time offset set already, we can\n * automatically remove expired tokens. Else just use the cached token. If it is\n * expired Ably will tell us and we'll discard it then. */\n if (!this.isTimeOffsetSet() || !token.expires || token.expires >= this.getTimestampUsingOffset()) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth.getToken()', 'using cached token; expires = ' + token.expires);\n callback(null, token);\n return;\n }\n /* expired, so remove and fallthrough to getting a new one */\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth.getToken()', 'deleting expired token');\n this.tokenDetails = null;\n }\n (this.waitingForTokenRequest || (this.waitingForTokenRequest = multicaster_1.default.create())).push(callback);\n if (this.currentTokenRequestId !== null && !forceSupersede) {\n return;\n }\n /* Request a new token */\n var tokenRequestId = (this.currentTokenRequestId = getTokenRequestId());\n this.requestToken(this.tokenParams, this.authOptions, function (err, tokenResponse) {\n if (_this.currentTokenRequestId > tokenRequestId) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Auth._ensureValidAuthCredentials()', 'Discarding token request response; overtaken by newer one');\n return;\n }\n _this.currentTokenRequestId = null;\n var callbacks = _this.waitingForTokenRequest || noop;\n _this.waitingForTokenRequest = null;\n if (err) {\n callbacks(err);\n return;\n }\n callbacks(null, (_this.tokenDetails = tokenResponse));\n });\n };\n /* User-set: check types, '*' is disallowed, throw any errors */\n Auth.prototype._userSetClientId = function (clientId) {\n if (!(typeof clientId === 'string' || clientId === null)) {\n throw new errorinfo_1.default('clientId must be either a string or null', 40012, 400);\n }\n else if (clientId === '*') {\n throw new errorinfo_1.default('Can’t use \"*\" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, instantiate the library with {defaultTokenParams: {clientId: \"*\"}}), or if calling authorize(), pass it in as a tokenParam: authorize({clientId: \"*\"}, authOptions)', 40012, 400);\n }\n else {\n var err = this._uncheckedSetClientId(clientId);\n if (err)\n throw err;\n }\n };\n /* Ably-set: no typechecking, '*' is allowed but not set on this.clientId), return errors to the caller */\n Auth.prototype._uncheckedSetClientId = function (clientId) {\n if (this._tokenClientIdMismatch(clientId)) {\n /* Should never happen in normal circumstances as realtime should\n * recognise mismatch and return an error */\n var msg = 'Unexpected clientId mismatch: client has ' + this.clientId + ', requested ' + clientId;\n var err = new errorinfo_1.default(msg, 40102, 401);\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Auth._uncheckedSetClientId()', msg);\n return err;\n }\n else {\n /* RSA7a4: if options.clientId is provided and is not\n * null, it overrides defaultTokenParams.clientId */\n this.clientId = this.tokenParams.clientId = clientId;\n return null;\n }\n };\n Auth.prototype._tokenClientIdMismatch = function (tokenClientId) {\n return !!(this.clientId &&\n this.clientId !== '*' &&\n tokenClientId &&\n tokenClientId !== '*' &&\n this.clientId !== tokenClientId);\n };\n Auth.isTokenErr = function (error) {\n return error.code && error.code >= 40140 && error.code < 40150;\n };\n Auth.prototype.revokeTokens = function (specifiers, optionsOrCallbackArg, callbackArg) {\n if (useTokenAuth(this.client.options)) {\n throw new errorinfo_1.default('Cannot revoke tokens when using token auth', 40162, 401);\n }\n var keyName = this.client.options.keyName;\n var resolvedOptions;\n if (typeof optionsOrCallbackArg === 'function') {\n callbackArg = optionsOrCallbackArg;\n resolvedOptions = {};\n }\n else {\n resolvedOptions = optionsOrCallbackArg !== null && optionsOrCallbackArg !== void 0 ? optionsOrCallbackArg : {};\n }\n if (callbackArg === undefined) {\n if (this.client.options.promises) {\n return Utils.promisify(this, 'revokeTokens', [specifiers, resolvedOptions]);\n }\n callbackArg = noop;\n }\n var callback = callbackArg;\n var requestBodyDTO = tslib_1.__assign({ targets: specifiers.map(function (specifier) { return \"\".concat(specifier.type, \":\").concat(specifier.value); }) }, resolvedOptions);\n var format = this.client.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultPostHeaders(this.client.options, format);\n if (this.client.options.headers)\n Utils.mixin(headers, this.client.options.headers);\n var requestBody = Utils.encodeBody(requestBodyDTO, format);\n resource_1.default.post(this.client, \"/keys/\".concat(keyName, \"/revokeTokens\"), requestBody, headers, { newBatchResponse: 'true' }, null, function (err, body, headers, unpacked) {\n if (err) {\n // TODO remove this type assertion after fixing https://github.com/ably/ably-js/issues/1405\n callback(err);\n return;\n }\n var batchResult = (unpacked ? body : Utils.decodeBody(body, format));\n callback(null, batchResult);\n });\n };\n return Auth;\n}());\nexports.default = Auth;\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar HttpMethods;\n(function (HttpMethods) {\n HttpMethods[\"Get\"] = \"get\";\n HttpMethods[\"Delete\"] = \"delete\";\n HttpMethods[\"Post\"] = \"post\";\n HttpMethods[\"Put\"] = \"put\";\n HttpMethods[\"Patch\"] = \"patch\";\n})(HttpMethods || (HttpMethods = {}));\nexports.default = HttpMethods;\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HttpPaginatedResponse = exports.PaginatedResult = void 0;\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar resource_1 = tslib_1.__importDefault(__webpack_require__(14));\nfunction getRelParams(linkUrl) {\n var urlMatch = linkUrl.match(/^\\.\\/(\\w+)\\?(.*)$/);\n return urlMatch && urlMatch[2] && Utils.parseQueryString(urlMatch[2]);\n}\nfunction parseRelLinks(linkHeader) {\n if (typeof linkHeader == 'string')\n linkHeader = linkHeader.split(',');\n var relParams = {};\n for (var i = 0; i < linkHeader.length; i++) {\n var linkMatch = linkHeader[i].match(/^\\s*<(.+)>;\\s*rel=\"(\\w+)\"$/);\n if (linkMatch) {\n var params = getRelParams(linkMatch[1]);\n if (params)\n relParams[linkMatch[2]] = params;\n }\n }\n return relParams;\n}\nfunction returnErrOnly(err, body, useHPR) {\n /* If using httpPaginatedResponse, errors from Ably are returned as part of\n * the HPR, only do callback(err) for network errors etc. which don't\n * return a body and/or have no ably-originated error code (non-numeric\n * error codes originate from node) */\n return !(useHPR && (body || typeof err.code === 'number'));\n}\nvar PaginatedResource = /** @class */ (function () {\n function PaginatedResource(rest, path, headers, envelope, bodyHandler, useHttpPaginatedResponse) {\n this.rest = rest;\n this.path = path;\n this.headers = headers;\n this.envelope = envelope !== null && envelope !== void 0 ? envelope : null;\n this.bodyHandler = bodyHandler;\n this.useHttpPaginatedResponse = useHttpPaginatedResponse || false;\n }\n PaginatedResource.prototype.get = function (params, callback) {\n var _this = this;\n resource_1.default.get(this.rest, this.path, this.headers, params, this.envelope, function (err, body, headers, unpacked, statusCode) {\n _this.handlePage(err, body, headers, unpacked, statusCode, callback);\n });\n };\n PaginatedResource.prototype.delete = function (params, callback) {\n var _this = this;\n resource_1.default.delete(this.rest, this.path, this.headers, params, this.envelope, function (err, body, headers, unpacked, statusCode) {\n _this.handlePage(err, body, headers, unpacked, statusCode, callback);\n });\n };\n PaginatedResource.prototype.post = function (params, body, callback) {\n var _this = this;\n resource_1.default.post(this.rest, this.path, body, this.headers, params, this.envelope, function (err, responseBody, headers, unpacked, statusCode) {\n if (callback) {\n _this.handlePage(err, responseBody, headers, unpacked, statusCode, callback);\n }\n });\n };\n PaginatedResource.prototype.put = function (params, body, callback) {\n var _this = this;\n resource_1.default.put(this.rest, this.path, body, this.headers, params, this.envelope, function (err, responseBody, headers, unpacked, statusCode) {\n if (callback) {\n _this.handlePage(err, responseBody, headers, unpacked, statusCode, callback);\n }\n });\n };\n PaginatedResource.prototype.patch = function (params, body, callback) {\n var _this = this;\n resource_1.default.patch(this.rest, this.path, body, this.headers, params, this.envelope, function (err, responseBody, headers, unpacked, statusCode) {\n if (callback) {\n _this.handlePage(err, responseBody, headers, unpacked, statusCode, callback);\n }\n });\n };\n PaginatedResource.prototype.handlePage = function (err, body, headers, unpacked, statusCode, callback) {\n if (err && returnErrOnly(err, body, this.useHttpPaginatedResponse)) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'PaginatedResource.handlePage()', 'Unexpected error getting resource: err = ' + Utils.inspectError(err));\n callback === null || callback === void 0 ? void 0 : callback(err);\n return;\n }\n var items, linkHeader, relParams;\n try {\n items = this.bodyHandler(body, headers || {}, unpacked);\n }\n catch (e) {\n /* If we got an error, the failure to parse the body is almost certainly\n * due to that, so callback with that in preference over the parse error */\n callback === null || callback === void 0 ? void 0 : callback(err || e);\n return;\n }\n if (headers && (linkHeader = headers['Link'] || headers['link'])) {\n relParams = parseRelLinks(linkHeader);\n }\n if (this.useHttpPaginatedResponse) {\n callback(null, new HttpPaginatedResponse(this, items, headers || {}, statusCode, relParams, err));\n }\n else {\n callback(null, new PaginatedResult(this, items, relParams));\n }\n };\n return PaginatedResource;\n}());\nvar PaginatedResult = /** @class */ (function () {\n function PaginatedResult(resource, items, relParams) {\n var _this = this;\n this.resource = resource;\n this.items = items;\n var self = this;\n if (relParams) {\n if ('first' in relParams) {\n this.first = function (callback) {\n if (!callback && self.resource.rest.options.promises) {\n return Utils.promisify(self, 'first', []);\n }\n self.get(relParams.first, callback);\n };\n }\n if ('current' in relParams) {\n this.current = function (callback) {\n if (!callback && self.resource.rest.options.promises) {\n return Utils.promisify(self, 'current', []);\n }\n self.get(relParams.current, callback);\n };\n }\n this.next = function (callback) {\n if (!callback && self.resource.rest.options.promises) {\n return Utils.promisify(self, 'next', []);\n }\n if ('next' in relParams) {\n self.get(relParams.next, callback);\n }\n else {\n callback(null);\n }\n };\n this.hasNext = function () {\n return 'next' in relParams;\n };\n this.isLast = function () {\n var _a;\n return !((_a = _this.hasNext) === null || _a === void 0 ? void 0 : _a.call(_this));\n };\n }\n }\n /* We assume that only the initial request can be a POST, and that accessing\n * the rest of a multipage set of results can always be done with GET */\n PaginatedResult.prototype.get = function (params, callback) {\n var res = this.resource;\n resource_1.default.get(res.rest, res.path, res.headers, params, res.envelope, function (err, body, headers, unpacked, statusCode) {\n res.handlePage(err, body, headers, unpacked, statusCode, callback);\n });\n };\n return PaginatedResult;\n}());\nexports.PaginatedResult = PaginatedResult;\nvar HttpPaginatedResponse = /** @class */ (function (_super) {\n tslib_1.__extends(HttpPaginatedResponse, _super);\n function HttpPaginatedResponse(resource, items, headers, statusCode, relParams, err) {\n var _this = _super.call(this, resource, items, relParams) || this;\n _this.statusCode = statusCode;\n _this.success = statusCode < 300 && statusCode >= 200;\n _this.headers = headers;\n _this.errorCode = err && err.code;\n _this.errorMessage = err && err.message;\n return _this;\n }\n HttpPaginatedResponse.prototype.toJSON = function () {\n return {\n items: this.items,\n statusCode: this.statusCode,\n success: this.success,\n headers: this.headers,\n errorCode: this.errorCode,\n errorMessage: this.errorMessage,\n };\n };\n return HttpPaginatedResponse;\n}(PaginatedResult));\nexports.HttpPaginatedResponse = HttpPaginatedResponse;\nexports.default = PaginatedResource;\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isRetriable = void 0;\nvar tslib_1 = __webpack_require__(0);\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar ConnectionErrorCodes = {\n DISCONNECTED: 80003,\n SUSPENDED: 80002,\n FAILED: 80000,\n CLOSING: 80017,\n CLOSED: 80017,\n UNKNOWN_CONNECTION_ERR: 50002,\n UNKNOWN_CHANNEL_ERR: 50001,\n};\nvar ConnectionErrors = {\n disconnected: function () {\n return errorinfo_1.default.fromValues({\n statusCode: 400,\n code: ConnectionErrorCodes.DISCONNECTED,\n message: 'Connection to server temporarily unavailable',\n });\n },\n suspended: function () {\n return errorinfo_1.default.fromValues({\n statusCode: 400,\n code: ConnectionErrorCodes.SUSPENDED,\n message: 'Connection to server unavailable',\n });\n },\n failed: function () {\n return errorinfo_1.default.fromValues({\n statusCode: 400,\n code: ConnectionErrorCodes.FAILED,\n message: 'Connection failed or disconnected by server',\n });\n },\n closing: function () {\n return errorinfo_1.default.fromValues({\n statusCode: 400,\n code: ConnectionErrorCodes.CLOSING,\n message: 'Connection closing',\n });\n },\n closed: function () {\n return errorinfo_1.default.fromValues({\n statusCode: 400,\n code: ConnectionErrorCodes.CLOSED,\n message: 'Connection closed',\n });\n },\n unknownConnectionErr: function () {\n return errorinfo_1.default.fromValues({\n statusCode: 500,\n code: ConnectionErrorCodes.UNKNOWN_CONNECTION_ERR,\n message: 'Internal connection error',\n });\n },\n unknownChannelErr: function () {\n return errorinfo_1.default.fromValues({\n statusCode: 500,\n code: ConnectionErrorCodes.UNKNOWN_CONNECTION_ERR,\n message: 'Internal channel error',\n });\n },\n};\nfunction isRetriable(err) {\n if (!err.statusCode || !err.code || err.statusCode >= 500) {\n return true;\n }\n return Object.values(ConnectionErrorCodes).includes(err.code);\n}\nexports.isRetriable = isRetriable;\nexports.default = ConnectionErrors;\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar XHRStates;\n(function (XHRStates) {\n XHRStates[XHRStates[\"REQ_SEND\"] = 0] = \"REQ_SEND\";\n XHRStates[XHRStates[\"REQ_RECV\"] = 1] = \"REQ_RECV\";\n XHRStates[XHRStates[\"REQ_RECV_POLL\"] = 2] = \"REQ_RECV_POLL\";\n XHRStates[XHRStates[\"REQ_RECV_STREAM\"] = 3] = \"REQ_RECV_STREAM\";\n})(XHRStates || (XHRStates = {}));\nexports.default = XHRStates;\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6), __webpack_require__(5), __webpack_require__(58), __webpack_require__(11), __webpack_require__(40), __webpack_require__(32), __webpack_require__(24), __webpack_require__(27), __webpack_require__(28), __webpack_require__(59), __webpack_require__(60));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS;\n\n}));\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar Multicaster = /** @class */ (function () {\n // Private constructor; use static Multicaster.create instead\n function Multicaster(members) {\n this.members = members || [];\n }\n Multicaster.prototype.call = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n for (var _a = 0, _b = this.members; _a < _b.length; _a++) {\n var member = _b[_a];\n if (member) {\n try {\n member.apply(void 0, args);\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Multicaster multiple callback handler', 'Unexpected exception: ' + e + '; stack = ' + e.stack);\n }\n }\n }\n };\n Multicaster.prototype.push = function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n (_a = this.members).push.apply(_a, args);\n };\n Multicaster.create = function (members) {\n var instance = new Multicaster(members);\n return Object.assign(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return instance.call.apply(instance, args);\n }, {\n push: function (fn) { return instance.push(fn); },\n });\n };\n return Multicaster;\n}());\nexports.default = Multicaster;\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var C_enc = C.enc;\n\t var Utf8 = C_enc.Utf8;\n\t var C_algo = C.algo;\n\n\t /**\n\t * HMAC algorithm.\n\t */\n\t var HMAC = C_algo.HMAC = Base.extend({\n\t /**\n\t * Initializes a newly created HMAC.\n\t *\n\t * @param {Hasher} hasher The hash algorithm to use.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @example\n\t *\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n\t */\n\t init: function (hasher, key) {\n\t // Init hasher\n\t hasher = this._hasher = new hasher.init();\n\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof key == 'string') {\n\t key = Utf8.parse(key);\n\t }\n\n\t // Shortcuts\n\t var hasherBlockSize = hasher.blockSize;\n\t var hasherBlockSizeBytes = hasherBlockSize * 4;\n\n\t // Allow arbitrary length keys\n\t if (key.sigBytes > hasherBlockSizeBytes) {\n\t key = hasher.finalize(key);\n\t }\n\n\t // Clamp excess bits\n\t key.clamp();\n\n\t // Clone key for inner and outer pads\n\t var oKey = this._oKey = key.clone();\n\t var iKey = this._iKey = key.clone();\n\n\t // Shortcuts\n\t var oKeyWords = oKey.words;\n\t var iKeyWords = iKey.words;\n\n\t // XOR keys with pad constants\n\t for (var i = 0; i < hasherBlockSize; i++) {\n\t oKeyWords[i] ^= 0x5c5c5c5c;\n\t iKeyWords[i] ^= 0x36363636;\n\t }\n\t oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this HMAC to its initial state.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.reset();\n\t */\n\t reset: function () {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Reset\n\t hasher.reset();\n\t hasher.update(this._iKey);\n\t },\n\n\t /**\n\t * Updates this HMAC with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {HMAC} This HMAC instance.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.update('message');\n\t * hmacHasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t this._hasher.update(messageUpdate);\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the HMAC computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @example\n\t *\n\t * var hmac = hmacHasher.finalize();\n\t * var hmac = hmacHasher.finalize('message');\n\t * var hmac = hmacHasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Compute HMAC\n\t var innerHash = hasher.finalize(messageUpdate);\n\t hasher.reset();\n\t var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n\n\t return hmac;\n\t }\n\t });\n\t}());\n\n\n}));\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSuccessCode = void 0;\nvar HttpStatusCodes;\n(function (HttpStatusCodes) {\n HttpStatusCodes[HttpStatusCodes[\"Success\"] = 200] = \"Success\";\n HttpStatusCodes[HttpStatusCodes[\"NoContent\"] = 204] = \"NoContent\";\n HttpStatusCodes[HttpStatusCodes[\"BadRequest\"] = 400] = \"BadRequest\";\n HttpStatusCodes[HttpStatusCodes[\"Unauthorized\"] = 401] = \"Unauthorized\";\n HttpStatusCodes[HttpStatusCodes[\"Forbidden\"] = 403] = \"Forbidden\";\n HttpStatusCodes[HttpStatusCodes[\"RequestTimeout\"] = 408] = \"RequestTimeout\";\n HttpStatusCodes[HttpStatusCodes[\"InternalServerError\"] = 500] = \"InternalServerError\";\n})(HttpStatusCodes || (HttpStatusCodes = {}));\nfunction isSuccessCode(statusCode) {\n return statusCode >= HttpStatusCodes.Success && statusCode < HttpStatusCodes.BadRequest;\n}\nexports.isSuccessCode = isSuccessCode;\nexports.default = HttpStatusCodes;\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar protocolmessage_1 = tslib_1.__importDefault(__webpack_require__(10));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar connectionerrors_1 = tslib_1.__importDefault(__webpack_require__(20));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar actions = protocolmessage_1.default.Action;\nvar closeMessage = protocolmessage_1.default.fromValues({ action: actions.CLOSE });\nvar disconnectMessage = protocolmessage_1.default.fromValues({ action: actions.DISCONNECT });\n/*\n * Transport instances inherit from EventEmitter and emit the following events:\n *\n * event name data\n * closed error\n * failed error\n * disposed\n * connected null error, connectionSerial, connectionId, connectionDetails\n * event channel message object\n */\nvar Transport = /** @class */ (function (_super) {\n tslib_1.__extends(Transport, _super);\n function Transport(connectionManager, auth, params, forceJsonProtocol) {\n var _this = _super.call(this) || this;\n if (forceJsonProtocol) {\n params.format = undefined;\n params.heartbeats = true;\n }\n _this.connectionManager = connectionManager;\n connectionManager.registerProposedTransport(_this);\n _this.auth = auth;\n _this.params = params;\n _this.timeouts = params.options.timeouts;\n _this.format = params.format;\n _this.isConnected = false;\n _this.isFinished = false;\n _this.isDisposed = false;\n _this.maxIdleInterval = null;\n _this.idleTimer = null;\n _this.lastActivity = null;\n return _this;\n }\n Transport.prototype.connect = function () { };\n Transport.prototype.close = function () {\n if (this.isConnected) {\n this.requestClose();\n }\n this.finish('closed', connectionerrors_1.default.closed());\n };\n Transport.prototype.disconnect = function (err) {\n /* Used for network/transport issues that need to result in the transport\n * being disconnected, but should not transition the connection to 'failed' */\n if (this.isConnected) {\n this.requestDisconnect();\n }\n this.finish('disconnected', err || connectionerrors_1.default.disconnected());\n };\n Transport.prototype.fail = function (err) {\n /* Used for client-side-detected fatal connection issues */\n if (this.isConnected) {\n this.requestDisconnect();\n }\n this.finish('failed', err || connectionerrors_1.default.failed());\n };\n Transport.prototype.finish = function (event, err) {\n var _a;\n if (this.isFinished) {\n return;\n }\n this.isFinished = true;\n this.isConnected = false;\n this.maxIdleInterval = null;\n clearTimeout((_a = this.idleTimer) !== null && _a !== void 0 ? _a : undefined);\n this.idleTimer = null;\n this.emit(event, err);\n this.dispose();\n };\n Transport.prototype.onProtocolMessage = function (message) {\n if (logger_1.default.shouldLog(logger_1.default.LOG_MICRO)) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Transport.onProtocolMessage()', 'received on ' +\n this.shortName +\n ': ' +\n protocolmessage_1.default.stringify(message) +\n '; connectionId = ' +\n this.connectionManager.connectionId);\n }\n this.onActivity();\n switch (message.action) {\n case actions.HEARTBEAT:\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Transport.onProtocolMessage()', this.shortName + ' heartbeat; connectionId = ' + this.connectionManager.connectionId);\n this.emit('heartbeat', message.id);\n break;\n case actions.CONNECTED:\n this.onConnect(message);\n this.emit('connected', message.error, message.connectionId, message.connectionDetails, message);\n break;\n case actions.CLOSED:\n this.onClose(message);\n break;\n case actions.DISCONNECTED:\n this.onDisconnect(message);\n break;\n case actions.ACK:\n this.emit('ack', message.msgSerial, message.count);\n break;\n case actions.NACK:\n this.emit('nack', message.msgSerial, message.count, message.error);\n break;\n case actions.SYNC:\n this.connectionManager.onChannelMessage(message, this);\n break;\n case actions.ACTIVATE:\n // Ignored.\n break;\n case actions.AUTH:\n this.auth.authorize(function (err) {\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Transport.onProtocolMessage()', 'Ably requested re-authentication, but unable to obtain a new token: ' + Utils.inspectError(err));\n }\n });\n break;\n case actions.ERROR:\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Transport.onProtocolMessage()', 'received error action; connectionId = ' +\n this.connectionManager.connectionId +\n '; err = ' +\n platform_1.default.Config.inspect(message.error) +\n (message.channel ? ', channel: ' + message.channel : ''));\n if (message.channel === undefined) {\n this.onFatalError(message);\n break;\n }\n /* otherwise it's a channel-specific error, so handle it in the channel */\n this.connectionManager.onChannelMessage(message, this);\n break;\n default:\n /* all other actions are channel-specific */\n this.connectionManager.onChannelMessage(message, this);\n }\n };\n Transport.prototype.onConnect = function (message) {\n this.isConnected = true;\n if (!message.connectionDetails) {\n throw new Error('Transport.onConnect(): Connect message recieved without connectionDetails');\n }\n var maxPromisedIdle = message.connectionDetails.maxIdleInterval;\n if (maxPromisedIdle) {\n this.maxIdleInterval = maxPromisedIdle + this.timeouts.realtimeRequestTimeout;\n this.onActivity();\n }\n /* else Realtime declines to guarantee any maximum idle interval - CD2h */\n };\n Transport.prototype.onDisconnect = function (message) {\n /* Used for when the server has disconnected the client (usually with a\n * DISCONNECTED action) */\n var err = message && message.error;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Transport.onDisconnect()', 'err = ' + Utils.inspectError(err));\n this.finish('disconnected', err);\n };\n Transport.prototype.onFatalError = function (message) {\n /* On receipt of a fatal connection error, we can assume that the server\n * will close the connection and the transport, and do not need to request\n * a disconnection - RTN15i */\n var err = message && message.error;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Transport.onFatalError()', 'err = ' + Utils.inspectError(err));\n this.finish('failed', err);\n };\n Transport.prototype.onClose = function (message) {\n var err = message && message.error;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Transport.onClose()', 'err = ' + Utils.inspectError(err));\n this.finish('closed', err);\n };\n Transport.prototype.requestClose = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Transport.requestClose()', '');\n this.send(closeMessage);\n };\n Transport.prototype.requestDisconnect = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Transport.requestDisconnect()', '');\n this.send(disconnectMessage);\n };\n Transport.prototype.ping = function (id) {\n var msg = { action: protocolmessage_1.default.Action.HEARTBEAT };\n if (id)\n msg.id = id;\n this.send(protocolmessage_1.default.fromValues(msg));\n };\n Transport.prototype.dispose = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Transport.dispose()', '');\n this.isDisposed = true;\n this.off();\n };\n Transport.prototype.onActivity = function () {\n if (!this.maxIdleInterval) {\n return;\n }\n this.lastActivity = this.connectionManager.lastActivity = Utils.now();\n this.setIdleTimer(this.maxIdleInterval + 100);\n };\n Transport.prototype.setIdleTimer = function (timeout) {\n var _this = this;\n if (!this.idleTimer) {\n this.idleTimer = setTimeout(function () {\n _this.onIdleTimerExpire();\n }, timeout);\n }\n };\n Transport.prototype.onIdleTimerExpire = function () {\n if (!this.lastActivity || !this.maxIdleInterval) {\n throw new Error('Transport.onIdleTimerExpire(): lastActivity/maxIdleInterval not set');\n }\n this.idleTimer = null;\n var sinceLast = Utils.now() - this.lastActivity;\n var timeRemaining = this.maxIdleInterval - sinceLast;\n if (timeRemaining <= 0) {\n var msg = 'No activity seen from realtime in ' + sinceLast + 'ms; assuming connection has dropped';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Transport.onIdleTimerExpire()', msg);\n this.disconnect(new errorinfo_1.default(msg, 80003, 408));\n }\n else {\n this.setIdleTimer(timeRemaining + 100);\n }\n };\n Transport.tryConnect = function (transportCtor, connectionManager, auth, transportParams, callback) {\n var transport = new transportCtor(connectionManager, auth, transportParams);\n var transportAttemptTimer;\n var errorCb = function (err) {\n clearTimeout(transportAttemptTimer);\n callback({ event: this.event, error: err });\n };\n var realtimeRequestTimeout = connectionManager.options.timeouts.realtimeRequestTimeout;\n transportAttemptTimer = setTimeout(function () {\n transport.off(['preconnect', 'disconnected', 'failed']);\n transport.dispose();\n errorCb.call({ event: 'disconnected' }, new errorinfo_1.default('Timeout waiting for transport to indicate itself viable', 50000, 500));\n }, realtimeRequestTimeout);\n transport.on(['failed', 'disconnected'], errorCb);\n transport.on('preconnect', function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Transport.tryConnect()', 'viable transport ' + transport);\n clearTimeout(transportAttemptTimer);\n transport.off(['failed', 'disconnected'], errorCb);\n callback(null, transport);\n });\n transport.connect();\n };\n return Transport;\n}(eventemitter_1.default));\nexports.default = Transport;\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6), __webpack_require__(40), __webpack_require__(24));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var WordArray = C_lib.WordArray;\n\t var C_algo = C.algo;\n\t var MD5 = C_algo.MD5;\n\n\t /**\n\t * This key derivation function is meant to conform with EVP_BytesToKey.\n\t * www.openssl.org/docs/crypto/EVP_BytesToKey.html\n\t */\n\t var EvpKDF = C_algo.EvpKDF = Base.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)\n\t * @property {Hasher} hasher The hash algorithm to use. Default: MD5\n\t * @property {number} iterations The number of iterations to perform. Default: 1\n\t */\n\t cfg: Base.extend({\n\t keySize: 128/32,\n\t hasher: MD5,\n\t iterations: 1\n\t }),\n\n\t /**\n\t * Initializes a newly created key derivation function.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for the derivation.\n\t *\n\t * @example\n\t *\n\t * var kdf = CryptoJS.algo.EvpKDF.create();\n\t * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });\n\t * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });\n\t */\n\t init: function (cfg) {\n\t this.cfg = this.cfg.extend(cfg);\n\t },\n\n\t /**\n\t * Derives a key from a password.\n\t *\n\t * @param {WordArray|string} password The password.\n\t * @param {WordArray|string} salt A salt.\n\t *\n\t * @return {WordArray} The derived key.\n\t *\n\t * @example\n\t *\n\t * var key = kdf.compute(password, salt);\n\t */\n\t compute: function (password, salt) {\n\t var block;\n\n\t // Shortcut\n\t var cfg = this.cfg;\n\n\t // Init hasher\n\t var hasher = cfg.hasher.create();\n\n\t // Initial values\n\t var derivedKey = WordArray.create();\n\n\t // Shortcuts\n\t var derivedKeyWords = derivedKey.words;\n\t var keySize = cfg.keySize;\n\t var iterations = cfg.iterations;\n\n\t // Generate key\n\t while (derivedKeyWords.length < keySize) {\n\t if (block) {\n\t hasher.update(block);\n\t }\n\t block = hasher.update(password).finalize(salt);\n\t hasher.reset();\n\n\t // Iterations\n\t for (var i = 1; i < iterations; i++) {\n\t block = hasher.finalize(block);\n\t hasher.reset();\n\t }\n\n\t derivedKey.concat(block);\n\t }\n\t derivedKey.sigBytes = keySize * 4;\n\n\t return derivedKey;\n\t }\n\t });\n\n\t /**\n\t * Derives a key from a password.\n\t *\n\t * @param {WordArray|string} password The password.\n\t * @param {WordArray|string} salt A salt.\n\t * @param {Object} cfg (Optional) The configuration options to use for this computation.\n\t *\n\t * @return {WordArray} The derived key.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var key = CryptoJS.EvpKDF(password, salt);\n\t * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });\n\t * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });\n\t */\n\t C.EvpKDF = function (password, salt, cfg) {\n\t return EvpKDF.create(cfg).compute(password, salt);\n\t };\n\t}());\n\n\n\treturn CryptoJS.EvpKDF;\n\n}));\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6), __webpack_require__(27));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t/**\n\t * Cipher core components.\n\t */\n\tCryptoJS.lib.Cipher || (function (undefined) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var WordArray = C_lib.WordArray;\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;\n\t var C_enc = C.enc;\n\t var Utf8 = C_enc.Utf8;\n\t var Base64 = C_enc.Base64;\n\t var C_algo = C.algo;\n\t var EvpKDF = C_algo.EvpKDF;\n\n\t /**\n\t * Abstract base cipher template.\n\t *\n\t * @property {number} keySize This cipher's key size. Default: 4 (128 bits)\n\t * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)\n\t * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.\n\t * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.\n\t */\n\t var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {WordArray} iv The IV to use for this operation.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Creates this cipher in encryption mode.\n\t *\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {Cipher} A cipher instance.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });\n\t */\n\t createEncryptor: function (key, cfg) {\n\t return this.create(this._ENC_XFORM_MODE, key, cfg);\n\t },\n\n\t /**\n\t * Creates this cipher in decryption mode.\n\t *\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {Cipher} A cipher instance.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });\n\t */\n\t createDecryptor: function (key, cfg) {\n\t return this.create(this._DEC_XFORM_MODE, key, cfg);\n\t },\n\n\t /**\n\t * Initializes a newly created cipher.\n\t *\n\t * @param {number} xformMode Either the encryption or decryption transormation mode constant.\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @example\n\t *\n\t * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });\n\t */\n\t init: function (xformMode, key, cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Store transform mode and key\n\t this._xformMode = xformMode;\n\t this._key = key;\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this cipher to its initial state.\n\t *\n\t * @example\n\t *\n\t * cipher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-cipher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Adds data to be encrypted or decrypted.\n\t *\n\t * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.\n\t *\n\t * @return {WordArray} The data after processing.\n\t *\n\t * @example\n\t *\n\t * var encrypted = cipher.process('data');\n\t * var encrypted = cipher.process(wordArray);\n\t */\n\t process: function (dataUpdate) {\n\t // Append\n\t this._append(dataUpdate);\n\n\t // Process available blocks\n\t return this._process();\n\t },\n\n\t /**\n\t * Finalizes the encryption or decryption process.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.\n\t *\n\t * @return {WordArray} The data after final processing.\n\t *\n\t * @example\n\t *\n\t * var encrypted = cipher.finalize();\n\t * var encrypted = cipher.finalize('data');\n\t * var encrypted = cipher.finalize(wordArray);\n\t */\n\t finalize: function (dataUpdate) {\n\t // Final data update\n\t if (dataUpdate) {\n\t this._append(dataUpdate);\n\t }\n\n\t // Perform concrete-cipher logic\n\t var finalProcessedData = this._doFinalize();\n\n\t return finalProcessedData;\n\t },\n\n\t keySize: 128/32,\n\n\t ivSize: 128/32,\n\n\t _ENC_XFORM_MODE: 1,\n\n\t _DEC_XFORM_MODE: 2,\n\n\t /**\n\t * Creates shortcut functions to a cipher's object interface.\n\t *\n\t * @param {Cipher} cipher The cipher to create a helper for.\n\t *\n\t * @return {Object} An object with encrypt and decrypt shortcut functions.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);\n\t */\n\t _createHelper: (function () {\n\t function selectCipherStrategy(key) {\n\t if (typeof key == 'string') {\n\t return PasswordBasedCipher;\n\t } else {\n\t return SerializableCipher;\n\t }\n\t }\n\n\t return function (cipher) {\n\t return {\n\t encrypt: function (message, key, cfg) {\n\t return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);\n\t },\n\n\t decrypt: function (ciphertext, key, cfg) {\n\t return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);\n\t }\n\t };\n\t };\n\t }())\n\t });\n\n\t /**\n\t * Abstract base stream cipher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)\n\t */\n\t var StreamCipher = C_lib.StreamCipher = Cipher.extend({\n\t _doFinalize: function () {\n\t // Process partial blocks\n\t var finalProcessedBlocks = this._process(!!'flush');\n\n\t return finalProcessedBlocks;\n\t },\n\n\t blockSize: 1\n\t });\n\n\t /**\n\t * Mode namespace.\n\t */\n\t var C_mode = C.mode = {};\n\n\t /**\n\t * Abstract base block cipher mode template.\n\t */\n\t var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({\n\t /**\n\t * Creates this mode for encryption.\n\t *\n\t * @param {Cipher} cipher A block cipher instance.\n\t * @param {Array} iv The IV words.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);\n\t */\n\t createEncryptor: function (cipher, iv) {\n\t return this.Encryptor.create(cipher, iv);\n\t },\n\n\t /**\n\t * Creates this mode for decryption.\n\t *\n\t * @param {Cipher} cipher A block cipher instance.\n\t * @param {Array} iv The IV words.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);\n\t */\n\t createDecryptor: function (cipher, iv) {\n\t return this.Decryptor.create(cipher, iv);\n\t },\n\n\t /**\n\t * Initializes a newly created mode.\n\t *\n\t * @param {Cipher} cipher A block cipher instance.\n\t * @param {Array} iv The IV words.\n\t *\n\t * @example\n\t *\n\t * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);\n\t */\n\t init: function (cipher, iv) {\n\t this._cipher = cipher;\n\t this._iv = iv;\n\t }\n\t });\n\n\t /**\n\t * Cipher Block Chaining mode.\n\t */\n\t var CBC = C_mode.CBC = (function () {\n\t /**\n\t * Abstract base CBC mode.\n\t */\n\t var CBC = BlockCipherMode.extend();\n\n\t /**\n\t * CBC encryptor.\n\t */\n\t CBC.Encryptor = CBC.extend({\n\t /**\n\t * Processes the data block at offset.\n\t *\n\t * @param {Array} words The data words to operate on.\n\t * @param {number} offset The offset where the block starts.\n\t *\n\t * @example\n\t *\n\t * mode.processBlock(data.words, offset);\n\t */\n\t processBlock: function (words, offset) {\n\t // Shortcuts\n\t var cipher = this._cipher;\n\t var blockSize = cipher.blockSize;\n\n\t // XOR and encrypt\n\t xorBlock.call(this, words, offset, blockSize);\n\t cipher.encryptBlock(words, offset);\n\n\t // Remember this block to use with next block\n\t this._prevBlock = words.slice(offset, offset + blockSize);\n\t }\n\t });\n\n\t /**\n\t * CBC decryptor.\n\t */\n\t CBC.Decryptor = CBC.extend({\n\t /**\n\t * Processes the data block at offset.\n\t *\n\t * @param {Array} words The data words to operate on.\n\t * @param {number} offset The offset where the block starts.\n\t *\n\t * @example\n\t *\n\t * mode.processBlock(data.words, offset);\n\t */\n\t processBlock: function (words, offset) {\n\t // Shortcuts\n\t var cipher = this._cipher;\n\t var blockSize = cipher.blockSize;\n\n\t // Remember this block to use with next block\n\t var thisBlock = words.slice(offset, offset + blockSize);\n\n\t // Decrypt and XOR\n\t cipher.decryptBlock(words, offset);\n\t xorBlock.call(this, words, offset, blockSize);\n\n\t // This block becomes the previous block\n\t this._prevBlock = thisBlock;\n\t }\n\t });\n\n\t function xorBlock(words, offset, blockSize) {\n\t var block;\n\n\t // Shortcut\n\t var iv = this._iv;\n\n\t // Choose mixing block\n\t if (iv) {\n\t block = iv;\n\n\t // Remove IV for subsequent blocks\n\t this._iv = undefined;\n\t } else {\n\t block = this._prevBlock;\n\t }\n\n\t // XOR blocks\n\t for (var i = 0; i < blockSize; i++) {\n\t words[offset + i] ^= block[i];\n\t }\n\t }\n\n\t return CBC;\n\t }());\n\n\t /**\n\t * Padding namespace.\n\t */\n\t var C_pad = C.pad = {};\n\n\t /**\n\t * PKCS #5/7 padding strategy.\n\t */\n\t var Pkcs7 = C_pad.Pkcs7 = {\n\t /**\n\t * Pads data using the algorithm defined in PKCS #5/7.\n\t *\n\t * @param {WordArray} data The data to pad.\n\t * @param {number} blockSize The multiple that the data should be padded to.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * CryptoJS.pad.Pkcs7.pad(wordArray, 4);\n\t */\n\t pad: function (data, blockSize) {\n\t // Shortcut\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count padding bytes\n\t var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;\n\n\t // Create padding word\n\t var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;\n\n\t // Create padding\n\t var paddingWords = [];\n\t for (var i = 0; i < nPaddingBytes; i += 4) {\n\t paddingWords.push(paddingWord);\n\t }\n\t var padding = WordArray.create(paddingWords, nPaddingBytes);\n\n\t // Add padding\n\t data.concat(padding);\n\t },\n\n\t /**\n\t * Unpads data that had been padded using the algorithm defined in PKCS #5/7.\n\t *\n\t * @param {WordArray} data The data to unpad.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * CryptoJS.pad.Pkcs7.unpad(wordArray);\n\t */\n\t unpad: function (data) {\n\t // Get number of padding bytes from last byte\n\t var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;\n\n\t // Remove padding\n\t data.sigBytes -= nPaddingBytes;\n\t }\n\t };\n\n\t /**\n\t * Abstract base block cipher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)\n\t */\n\t var BlockCipher = C_lib.BlockCipher = Cipher.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {Mode} mode The block mode to use. Default: CBC\n\t * @property {Padding} padding The padding strategy to use. Default: Pkcs7\n\t */\n\t cfg: Cipher.cfg.extend({\n\t mode: CBC,\n\t padding: Pkcs7\n\t }),\n\n\t reset: function () {\n\t var modeCreator;\n\n\t // Reset cipher\n\t Cipher.reset.call(this);\n\n\t // Shortcuts\n\t var cfg = this.cfg;\n\t var iv = cfg.iv;\n\t var mode = cfg.mode;\n\n\t // Reset block mode\n\t if (this._xformMode == this._ENC_XFORM_MODE) {\n\t modeCreator = mode.createEncryptor;\n\t } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {\n\t modeCreator = mode.createDecryptor;\n\t // Keep at least one block in the buffer for unpadding\n\t this._minBufferSize = 1;\n\t }\n\n\t if (this._mode && this._mode.__creator == modeCreator) {\n\t this._mode.init(this, iv && iv.words);\n\t } else {\n\t this._mode = modeCreator.call(mode, this, iv && iv.words);\n\t this._mode.__creator = modeCreator;\n\t }\n\t },\n\n\t _doProcessBlock: function (words, offset) {\n\t this._mode.processBlock(words, offset);\n\t },\n\n\t _doFinalize: function () {\n\t var finalProcessedBlocks;\n\n\t // Shortcut\n\t var padding = this.cfg.padding;\n\n\t // Finalize\n\t if (this._xformMode == this._ENC_XFORM_MODE) {\n\t // Pad data\n\t padding.pad(this._data, this.blockSize);\n\n\t // Process final blocks\n\t finalProcessedBlocks = this._process(!!'flush');\n\t } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {\n\t // Process final blocks\n\t finalProcessedBlocks = this._process(!!'flush');\n\n\t // Unpad data\n\t padding.unpad(finalProcessedBlocks);\n\t }\n\n\t return finalProcessedBlocks;\n\t },\n\n\t blockSize: 128/32\n\t });\n\n\t /**\n\t * A collection of cipher parameters.\n\t *\n\t * @property {WordArray} ciphertext The raw ciphertext.\n\t * @property {WordArray} key The key to this ciphertext.\n\t * @property {WordArray} iv The IV used in the ciphering operation.\n\t * @property {WordArray} salt The salt used with a key derivation function.\n\t * @property {Cipher} algorithm The cipher algorithm.\n\t * @property {Mode} mode The block mode used in the ciphering operation.\n\t * @property {Padding} padding The padding scheme used in the ciphering operation.\n\t * @property {number} blockSize The block size of the cipher.\n\t * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.\n\t */\n\t var CipherParams = C_lib.CipherParams = Base.extend({\n\t /**\n\t * Initializes a newly created cipher params object.\n\t *\n\t * @param {Object} cipherParams An object with any of the possible cipher parameters.\n\t *\n\t * @example\n\t *\n\t * var cipherParams = CryptoJS.lib.CipherParams.create({\n\t * ciphertext: ciphertextWordArray,\n\t * key: keyWordArray,\n\t * iv: ivWordArray,\n\t * salt: saltWordArray,\n\t * algorithm: CryptoJS.algo.AES,\n\t * mode: CryptoJS.mode.CBC,\n\t * padding: CryptoJS.pad.PKCS7,\n\t * blockSize: 4,\n\t * formatter: CryptoJS.format.OpenSSL\n\t * });\n\t */\n\t init: function (cipherParams) {\n\t this.mixIn(cipherParams);\n\t },\n\n\t /**\n\t * Converts this cipher params object to a string.\n\t *\n\t * @param {Format} formatter (Optional) The formatting strategy to use.\n\t *\n\t * @return {string} The stringified cipher params.\n\t *\n\t * @throws Error If neither the formatter nor the default formatter is set.\n\t *\n\t * @example\n\t *\n\t * var string = cipherParams + '';\n\t * var string = cipherParams.toString();\n\t * var string = cipherParams.toString(CryptoJS.format.OpenSSL);\n\t */\n\t toString: function (formatter) {\n\t return (formatter || this.formatter).stringify(this);\n\t }\n\t });\n\n\t /**\n\t * Format namespace.\n\t */\n\t var C_format = C.format = {};\n\n\t /**\n\t * OpenSSL formatting strategy.\n\t */\n\t var OpenSSLFormatter = C_format.OpenSSL = {\n\t /**\n\t * Converts a cipher params object to an OpenSSL-compatible string.\n\t *\n\t * @param {CipherParams} cipherParams The cipher params object.\n\t *\n\t * @return {string} The OpenSSL-compatible string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);\n\t */\n\t stringify: function (cipherParams) {\n\t var wordArray;\n\n\t // Shortcuts\n\t var ciphertext = cipherParams.ciphertext;\n\t var salt = cipherParams.salt;\n\n\t // Format\n\t if (salt) {\n\t wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);\n\t } else {\n\t wordArray = ciphertext;\n\t }\n\n\t return wordArray.toString(Base64);\n\t },\n\n\t /**\n\t * Converts an OpenSSL-compatible string to a cipher params object.\n\t *\n\t * @param {string} openSSLStr The OpenSSL-compatible string.\n\t *\n\t * @return {CipherParams} The cipher params object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);\n\t */\n\t parse: function (openSSLStr) {\n\t var salt;\n\n\t // Parse base64\n\t var ciphertext = Base64.parse(openSSLStr);\n\n\t // Shortcut\n\t var ciphertextWords = ciphertext.words;\n\n\t // Test for salt\n\t if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {\n\t // Extract salt\n\t salt = WordArray.create(ciphertextWords.slice(2, 4));\n\n\t // Remove salt from ciphertext\n\t ciphertextWords.splice(0, 4);\n\t ciphertext.sigBytes -= 16;\n\t }\n\n\t return CipherParams.create({ ciphertext: ciphertext, salt: salt });\n\t }\n\t };\n\n\t /**\n\t * A cipher wrapper that returns ciphertext as a serializable cipher params object.\n\t */\n\t var SerializableCipher = C_lib.SerializableCipher = Base.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL\n\t */\n\t cfg: Base.extend({\n\t format: OpenSSLFormatter\n\t }),\n\n\t /**\n\t * Encrypts a message.\n\t *\n\t * @param {Cipher} cipher The cipher algorithm to use.\n\t * @param {WordArray|string} message The message to encrypt.\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {CipherParams} A cipher params object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);\n\t * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });\n\t * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n\t */\n\t encrypt: function (cipher, message, key, cfg) {\n\t // Apply config defaults\n\t cfg = this.cfg.extend(cfg);\n\n\t // Encrypt\n\t var encryptor = cipher.createEncryptor(key, cfg);\n\t var ciphertext = encryptor.finalize(message);\n\n\t // Shortcut\n\t var cipherCfg = encryptor.cfg;\n\n\t // Create and return serializable cipher params\n\t return CipherParams.create({\n\t ciphertext: ciphertext,\n\t key: key,\n\t iv: cipherCfg.iv,\n\t algorithm: cipher,\n\t mode: cipherCfg.mode,\n\t padding: cipherCfg.padding,\n\t blockSize: cipher.blockSize,\n\t formatter: cfg.format\n\t });\n\t },\n\n\t /**\n\t * Decrypts serialized ciphertext.\n\t *\n\t * @param {Cipher} cipher The cipher algorithm to use.\n\t * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {WordArray} The plaintext.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n\t * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n\t */\n\t decrypt: function (cipher, ciphertext, key, cfg) {\n\t // Apply config defaults\n\t cfg = this.cfg.extend(cfg);\n\n\t // Convert string to CipherParams\n\t ciphertext = this._parse(ciphertext, cfg.format);\n\n\t // Decrypt\n\t var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);\n\n\t return plaintext;\n\t },\n\n\t /**\n\t * Converts serialized ciphertext to CipherParams,\n\t * else assumed CipherParams already and returns ciphertext unchanged.\n\t *\n\t * @param {CipherParams|string} ciphertext The ciphertext.\n\t * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.\n\t *\n\t * @return {CipherParams} The unserialized ciphertext.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);\n\t */\n\t _parse: function (ciphertext, format) {\n\t if (typeof ciphertext == 'string') {\n\t return format.parse(ciphertext, this);\n\t } else {\n\t return ciphertext;\n\t }\n\t }\n\t });\n\n\t /**\n\t * Key derivation function namespace.\n\t */\n\t var C_kdf = C.kdf = {};\n\n\t /**\n\t * OpenSSL key derivation function.\n\t */\n\t var OpenSSLKdf = C_kdf.OpenSSL = {\n\t /**\n\t * Derives a key and IV from a password.\n\t *\n\t * @param {string} password The password to derive from.\n\t * @param {number} keySize The size in words of the key to generate.\n\t * @param {number} ivSize The size in words of the IV to generate.\n\t * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.\n\t *\n\t * @return {CipherParams} A cipher params object with the key, IV, and salt.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);\n\t * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');\n\t */\n\t execute: function (password, keySize, ivSize, salt) {\n\t // Generate random salt\n\t if (!salt) {\n\t salt = WordArray.random(64/8);\n\t }\n\n\t // Derive key and IV\n\t var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);\n\n\t // Separate key and IV\n\t var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);\n\t key.sigBytes = keySize * 4;\n\n\t // Return params\n\t return CipherParams.create({ key: key, iv: iv, salt: salt });\n\t }\n\t };\n\n\t /**\n\t * A serializable cipher wrapper that derives the key from a password,\n\t * and returns ciphertext as a serializable cipher params object.\n\t */\n\t var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL\n\t */\n\t cfg: SerializableCipher.cfg.extend({\n\t kdf: OpenSSLKdf\n\t }),\n\n\t /**\n\t * Encrypts a message using a password.\n\t *\n\t * @param {Cipher} cipher The cipher algorithm to use.\n\t * @param {WordArray|string} message The message to encrypt.\n\t * @param {string} password The password.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {CipherParams} A cipher params object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');\n\t * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });\n\t */\n\t encrypt: function (cipher, message, password, cfg) {\n\t // Apply config defaults\n\t cfg = this.cfg.extend(cfg);\n\n\t // Derive key and other params\n\t var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);\n\n\t // Add IV to config\n\t cfg.iv = derivedParams.iv;\n\n\t // Encrypt\n\t var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);\n\n\t // Mix in derived params\n\t ciphertext.mixIn(derivedParams);\n\n\t return ciphertext;\n\t },\n\n\t /**\n\t * Decrypts serialized ciphertext using a password.\n\t *\n\t * @param {Cipher} cipher The cipher algorithm to use.\n\t * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n\t * @param {string} password The password.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {WordArray} The plaintext.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });\n\t * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });\n\t */\n\t decrypt: function (cipher, ciphertext, password, cfg) {\n\t // Apply config defaults\n\t cfg = this.cfg.extend(cfg);\n\n\t // Convert string to CipherParams\n\t ciphertext = this._parse(ciphertext, cfg.format);\n\n\t // Derive key and other params\n\t var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);\n\n\t // Add IV to config\n\t cfg.iv = derivedParams.iv;\n\n\t // Decrypt\n\t var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);\n\n\t return plaintext;\n\t }\n\t });\n\t}());\n\n\n}));\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Request = exports.createRequest = void 0;\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar comettransport_1 = tslib_1.__importDefault(__webpack_require__(12));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar errorinfo_1 = __webpack_require__(4);\nvar defaults_1 = tslib_1.__importDefault(__webpack_require__(8));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar XHRStates_1 = tslib_1.__importDefault(__webpack_require__(21));\n// Workaround for salesforce lightning locker compatibility\nvar globalObject = Utils.getGlobalObject();\nvar noop = function () { };\n/* Can't just use window.Ably, as that won't exist if using the commonjs version. */\nvar _ = (globalObject._ablyjs_jsonp = {});\n/* express strips out parantheses from the callback!\n * Kludge to still alow its responses to work, while not keeping the\n * function form for normal use and not cluttering window.Ably\n * https://github.com/expressjs/express/blob/5b4d4b4ab1324743534fbcd4709f4e75bb4b4e9d/lib/response.js#L305\n */\n_._ = function (id) {\n return _['_' + id] || noop;\n};\nvar idCounter = 1;\nvar shortName = 'jsonp';\nfunction createRequest(uri, headers, params, body, requestMode, timeouts, method) {\n /* JSONP requests are used either with the context being a realtime\n * transport, or with timeouts passed in (for when used by a rest client),\n * or completely standalone. Use the appropriate timeouts in each case */\n timeouts = timeouts || defaults_1.default.TIMEOUTS;\n return new Request(undefined, uri, headers, Utils.copy(params), body, requestMode, timeouts, method);\n}\nexports.createRequest = createRequest;\nvar JSONPTransport = /** @class */ (function (_super) {\n tslib_1.__extends(JSONPTransport, _super);\n function JSONPTransport(connectionManager, auth, params) {\n var _this = _super.call(this, connectionManager, auth, params) || this;\n _this.shortName = shortName;\n params.stream = false;\n return _this;\n }\n JSONPTransport.isAvailable = function () {\n return platform_1.default.Config.jsonpSupported && platform_1.default.Config.allowComet;\n };\n JSONPTransport.prototype.toString = function () {\n return 'JSONPTransport; uri=' + this.baseUri + '; isConnected=' + this.isConnected;\n };\n JSONPTransport.prototype.createRequest = function (uri, headers, params, body, requestMode, timeouts, method) {\n /* JSONP requests are used either with the context being a realtime\n * transport, or with timeouts passed in (for when used by a rest client),\n * or completely standalone. Use the appropriate timeouts in each case */\n timeouts = (this === null || this === void 0 ? void 0 : this.timeouts) || timeouts || defaults_1.default.TIMEOUTS;\n return createRequest(uri, headers, params, body, requestMode, timeouts, method);\n };\n return JSONPTransport;\n}(comettransport_1.default));\nvar Request = /** @class */ (function (_super) {\n tslib_1.__extends(Request, _super);\n function Request(id, uri, headers, params, body, requestMode, timeouts, method) {\n var _this = _super.call(this) || this;\n if (id === undefined)\n id = idCounter++;\n _this.id = id;\n _this.uri = uri;\n _this.params = params || {};\n _this.params.rnd = Utils.cheapRandStr();\n if (headers) {\n /* JSONP doesn't allow headers. Cherry-pick a couple to turn into qs params */\n if (headers['X-Ably-Version'])\n _this.params.v = headers['X-Ably-Version'];\n if (headers['X-Ably-Lib'])\n _this.params.lib = headers['X-Ably-Lib'];\n }\n _this.body = body;\n _this.method = method;\n _this.requestMode = requestMode;\n _this.timeouts = timeouts;\n _this.requestComplete = false;\n return _this;\n }\n Request.prototype.exec = function () {\n var _this = this;\n var id = this.id, body = this.body, method = this.method, uri = this.uri, params = this.params;\n params.callback = '_ablyjs_jsonp._(' + id + ')';\n params.envelope = 'jsonp';\n if (body) {\n params.body = body;\n }\n if (method && method !== 'get') {\n params.method = method;\n }\n var script = (this.script = document.createElement('script'));\n var src = uri + Utils.toQueryString(params);\n script.src = src;\n if (script.src.split('/').slice(-1)[0] !== src.split('/').slice(-1)[0]) {\n /* The src has been truncated. Can't abort, but can at least emit an\n * error so the user knows what's gone wrong. (Can't compare strings\n * directly as src may have a port, script.src won't) */\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'JSONP Request.exec()', 'Warning: the browser appears to have truncated the script URI. This will likely result in the request failing due to an unparseable body param');\n }\n script.async = true;\n script.type = 'text/javascript';\n script.charset = 'UTF-8';\n script.onerror = function (err) {\n _this.complete(new errorinfo_1.PartialErrorInfo('JSONP script error (event: ' + platform_1.default.Config.inspect(err) + ')', null, 400));\n };\n _['_' + id] = function (message) {\n if (message.statusCode) {\n /* Handle as enveloped jsonp, as all jsonp transport uses should be */\n var response = message.response;\n if (message.statusCode == 204) {\n _this.complete(null, null, null, message.statusCode);\n }\n else if (!response) {\n _this.complete(new errorinfo_1.PartialErrorInfo('Invalid server response: no envelope detected', null, 500));\n }\n else if (message.statusCode < 400 || Utils.isArray(response)) {\n /* If response is an array, it's an array of protocol messages -- even if\n * it contains an error action (hence the nonsuccess statuscode), we can\n * consider the request to have succeeded, just pass it on to\n * onProtocolMessage to decide what to do */\n _this.complete(null, response, message.headers, message.statusCode);\n }\n else {\n var err = response.error || new errorinfo_1.PartialErrorInfo('Error response received from server', null, message.statusCode);\n _this.complete(err);\n }\n }\n else {\n /* Handle as non-enveloped -- as will be eg from a customer's authUrl server */\n _this.complete(null, message);\n }\n };\n var timeout = this.requestMode == XHRStates_1.default.REQ_SEND ? this.timeouts.httpRequestTimeout : this.timeouts.recvTimeout;\n this.timer = setTimeout(this.abort.bind(this), timeout);\n var head = document.getElementsByTagName('head')[0];\n head.insertBefore(script, head.firstChild);\n };\n Request.prototype.complete = function (err, body, headers, statusCode) {\n headers = headers || {};\n if (!this.requestComplete) {\n this.requestComplete = true;\n var contentType = void 0;\n if (body) {\n contentType = typeof body == 'string' ? 'text/plain' : 'application/json';\n headers['content-type'] = contentType;\n this.emit('data', body);\n }\n this.emit('complete', err, body, headers, /* unpacked: */ true, statusCode);\n this.dispose();\n }\n };\n Request.prototype.abort = function () {\n this.dispose();\n };\n Request.prototype.dispose = function () {\n var timer = this.timer;\n if (timer) {\n clearTimeout(timer);\n this.timer = null;\n }\n var script = this.script;\n if (script.parentNode)\n script.parentNode.removeChild(script);\n delete _[this.id];\n this.emit('disposed');\n };\n return Request;\n}(eventemitter_1.default));\nexports.Request = Request;\nfunction default_1(connectionManager) {\n globalObject.JSONPTransport = JSONPTransport;\n if (JSONPTransport.isAvailable()) {\n connectionManager.supportedTransports[shortName] = JSONPTransport;\n }\n return JSONPTransport;\n}\nexports.default = default_1;\n\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar defaults_1 = tslib_1.__importDefault(__webpack_require__(8));\nvar auth_1 = tslib_1.__importDefault(__webpack_require__(17));\nvar push_1 = tslib_1.__importDefault(__webpack_require__(46));\nvar paginatedresource_1 = tslib_1.__importDefault(__webpack_require__(19));\nvar channel_1 = tslib_1.__importDefault(__webpack_require__(33));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar stats_1 = tslib_1.__importDefault(__webpack_require__(49));\nvar HttpMethods_1 = tslib_1.__importDefault(__webpack_require__(18));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar message_1 = tslib_1.__importDefault(__webpack_require__(9));\nvar presencemessage_1 = tslib_1.__importDefault(__webpack_require__(15));\nvar resource_1 = tslib_1.__importDefault(__webpack_require__(14));\nvar noop = function () { };\nvar Rest = /** @class */ (function () {\n function Rest(options) {\n if (!options) {\n var msg = 'no options provided';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Rest()', msg);\n throw new Error(msg);\n }\n var optionsObj = defaults_1.default.objectifyOptions(options);\n if (optionsObj.log) {\n logger_1.default.setLog(optionsObj.log.level, optionsObj.log.handler);\n }\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Rest()', 'initialized with clientOptions ' + platform_1.default.Config.inspect(options));\n var normalOptions = (this.options = defaults_1.default.normaliseOptions(optionsObj));\n /* process options */\n if (normalOptions.key) {\n var keyMatch = normalOptions.key.match(/^([^:\\s]+):([^:.\\s]+)$/);\n if (!keyMatch) {\n var msg = 'invalid key parameter';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Rest()', msg);\n throw new errorinfo_1.default(msg, 40400, 404);\n }\n normalOptions.keyName = keyMatch[1];\n normalOptions.keySecret = keyMatch[2];\n }\n if ('clientId' in normalOptions) {\n if (!(typeof normalOptions.clientId === 'string' || normalOptions.clientId === null))\n throw new errorinfo_1.default('clientId must be either a string or null', 40012, 400);\n else if (normalOptions.clientId === '*')\n throw new errorinfo_1.default('Can’t use \"*\" as a clientId as that string is reserved. (To change the default token request behaviour to use a wildcard clientId, use {defaultTokenParams: {clientId: \"*\"}})', 40012, 400);\n }\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Rest()', 'started; version = ' + defaults_1.default.version);\n this.baseUri = this.authority = function (host) {\n return defaults_1.default.getHttpScheme(normalOptions) + host + ':' + defaults_1.default.getPort(normalOptions, false);\n };\n this._currentFallback = null;\n this.serverTimeOffset = null;\n this.http = new platform_1.default.Http(normalOptions);\n this.auth = new auth_1.default(this, normalOptions);\n this.channels = new Channels(this);\n this.push = new push_1.default(this);\n }\n Rest.prototype.stats = function (params, callback) {\n /* params and callback are optional; see if params contains the callback */\n if (callback === undefined) {\n if (typeof params == 'function') {\n callback = params;\n params = null;\n }\n else {\n if (this.options.promises) {\n return Utils.promisify(this, 'stats', [params]);\n }\n callback = noop;\n }\n }\n var headers = Utils.defaultGetHeaders(this.options), format = this.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, envelope = this.http.supportsLinkHeaders ? undefined : format;\n if (this.options.headers)\n Utils.mixin(headers, this.options.headers);\n new paginatedresource_1.default(this, '/stats', headers, envelope, function (body, headers, unpacked) {\n var statsValues = unpacked ? body : JSON.parse(body);\n for (var i = 0; i < statsValues.length; i++)\n statsValues[i] = stats_1.default.fromValues(statsValues[i]);\n return statsValues;\n }).get(params, callback);\n };\n Rest.prototype.time = function (params, callback) {\n var _this = this;\n /* params and callback are optional; see if params contains the callback */\n if (callback === undefined) {\n if (typeof params == 'function') {\n callback = params;\n params = null;\n }\n else {\n if (this.options.promises) {\n return Utils.promisify(this, 'time', [params]);\n }\n }\n }\n var _callback = callback || noop;\n var headers = Utils.defaultGetHeaders(this.options);\n if (this.options.headers)\n Utils.mixin(headers, this.options.headers);\n var timeUri = function (host) {\n return _this.authority(host) + '/time';\n };\n this.http.do(HttpMethods_1.default.Get, this, timeUri, headers, null, params, function (err, res, headers, unpacked) {\n if (err) {\n _callback(err);\n return;\n }\n if (!unpacked)\n res = JSON.parse(res);\n var time = res[0];\n if (!time) {\n _callback(new errorinfo_1.default('Internal error (unexpected result type from GET /time)', 50000, 500));\n return;\n }\n /* calculate time offset only once for this device by adding to the prototype */\n _this.serverTimeOffset = time - Utils.now();\n _callback(null, time);\n });\n };\n Rest.prototype.request = function (method, path, params, body, customHeaders, callback) {\n var useBinary = this.options.useBinaryProtocol, encoder = useBinary ? platform_1.default.Config.msgpack.encode : JSON.stringify, decoder = useBinary ? platform_1.default.Config.msgpack.decode : JSON.parse, format = useBinary ? Utils.Format.msgpack : Utils.Format.json, envelope = this.http.supportsLinkHeaders ? undefined : format;\n params = params || {};\n var _method = method.toLowerCase();\n var headers = _method == 'get' ? Utils.defaultGetHeaders(this.options, format) : Utils.defaultPostHeaders(this.options, format);\n if (callback === undefined) {\n if (this.options.promises) {\n return Utils.promisify(this, 'request', [method, path, params, body, customHeaders]);\n }\n callback = noop;\n }\n if (typeof body !== 'string') {\n body = encoder(body);\n }\n if (this.options.headers) {\n Utils.mixin(headers, this.options.headers);\n }\n if (customHeaders) {\n Utils.mixin(headers, customHeaders);\n }\n var paginatedResource = new paginatedresource_1.default(this, path, headers, envelope, function (resbody, headers, unpacked) {\n return Utils.ensureArray(unpacked ? resbody : decoder(resbody));\n }, \n /* useHttpPaginatedResponse: */ true);\n if (!Utils.arrIn(platform_1.default.Http.methods, _method)) {\n throw new errorinfo_1.default('Unsupported method ' + _method, 40500, 405);\n }\n if (Utils.arrIn(platform_1.default.Http.methodsWithBody, _method)) {\n paginatedResource[_method](params, body, callback);\n }\n else {\n paginatedResource[_method](params, callback);\n }\n };\n Rest.prototype.batchPublish = function (specOrSpecs, callbackArg) {\n if (callbackArg === undefined) {\n if (this.options.promises) {\n return Utils.promisify(this, 'batchPublish', [specOrSpecs]);\n }\n callbackArg = noop;\n }\n var callback = callbackArg;\n var requestBodyDTO;\n var singleSpecMode;\n if (Utils.isArray(specOrSpecs)) {\n requestBodyDTO = specOrSpecs;\n singleSpecMode = false;\n }\n else {\n requestBodyDTO = [specOrSpecs];\n singleSpecMode = true;\n }\n var format = this.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultPostHeaders(this.options, format);\n if (this.options.headers)\n Utils.mixin(headers, this.options.headers);\n var requestBody = Utils.encodeBody(requestBodyDTO, format);\n resource_1.default.post(this, '/messages', requestBody, headers, { newBatchResponse: 'true' }, null, function (err, body, headers, unpacked) {\n if (err) {\n // TODO remove this type assertion after fixing https://github.com/ably/ably-js/issues/1405\n callback(err);\n return;\n }\n var batchResults = (unpacked ? body : Utils.decodeBody(body, format));\n // I don't love the below type assertions for `callback` but not sure how to avoid them\n if (singleSpecMode) {\n callback(null, batchResults[0]);\n }\n else {\n callback(null, batchResults);\n }\n });\n };\n Rest.prototype.batchPresence = function (channels, callbackArg) {\n if (callbackArg === undefined) {\n if (this.options.promises) {\n return Utils.promisify(this, 'batchPresence', [channels]);\n }\n callbackArg = noop;\n }\n var callback = callbackArg;\n var format = this.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultPostHeaders(this.options, format);\n if (this.options.headers)\n Utils.mixin(headers, this.options.headers);\n var channelsParam = channels.join(',');\n resource_1.default.get(this, '/presence', headers, { newBatchResponse: 'true', channels: channelsParam }, null, function (err, body, headers, unpacked) {\n if (err) {\n // TODO remove this type assertion after fixing https://github.com/ably/ably-js/issues/1405\n callback(err);\n return;\n }\n var batchResult = (unpacked ? body : Utils.decodeBody(body, format));\n callback(null, batchResult);\n });\n };\n Rest.prototype.setLog = function (logOptions) {\n logger_1.default.setLog(logOptions.level, logOptions.handler);\n };\n Rest.Promise = function (options) {\n options = defaults_1.default.objectifyOptions(options);\n options.promises = true;\n return new Rest(options);\n };\n Rest.Callbacks = Rest;\n Rest.Platform = platform_1.default;\n Rest.Message = message_1.default;\n Rest.PresenceMessage = presencemessage_1.default;\n return Rest;\n}());\nvar Channels = /** @class */ (function () {\n function Channels(rest) {\n this.rest = rest;\n this.all = Object.create(null);\n }\n Channels.prototype.get = function (name, channelOptions) {\n name = String(name);\n var channel = this.all[name];\n if (!channel) {\n this.all[name] = channel = new channel_1.default(this.rest, name, channelOptions);\n }\n else if (channelOptions) {\n channel.setOptions(channelOptions);\n }\n return channel;\n };\n /* Included to support certain niche use-cases; most users should ignore this.\n * Please do not use this unless you know what you're doing */\n Channels.prototype.release = function (name) {\n delete this.all[String(name)];\n };\n return Channels;\n}());\nexports.default = Rest;\n\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.enc.Utf8;\n\n}));\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function (Math) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Initialization and round constants tables\n\t var H = [];\n\t var K = [];\n\n\t // Compute constants\n\t (function () {\n\t function isPrime(n) {\n\t var sqrtN = Math.sqrt(n);\n\t for (var factor = 2; factor <= sqrtN; factor++) {\n\t if (!(n % factor)) {\n\t return false;\n\t }\n\t }\n\n\t return true;\n\t }\n\n\t function getFractionalBits(n) {\n\t return ((n - (n | 0)) * 0x100000000) | 0;\n\t }\n\n\t var n = 2;\n\t var nPrime = 0;\n\t while (nPrime < 64) {\n\t if (isPrime(n)) {\n\t if (nPrime < 8) {\n\t H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\n\t }\n\t K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\n\n\t nPrime++;\n\t }\n\n\t n++;\n\t }\n\t }());\n\n\t // Reusable object\n\t var W = [];\n\n\t /**\n\t * SHA-256 hash algorithm.\n\t */\n\t var SHA256 = C_algo.SHA256 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init(H.slice(0));\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcut\n\t var H = this._hash.words;\n\n\t // Working variables\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\t var e = H[4];\n\t var f = H[5];\n\t var g = H[6];\n\t var h = H[7];\n\n\t // Computation\n\t for (var i = 0; i < 64; i++) {\n\t if (i < 16) {\n\t W[i] = M[offset + i] | 0;\n\t } else {\n\t var gamma0x = W[i - 15];\n\t var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\n\t ((gamma0x << 14) | (gamma0x >>> 18)) ^\n\t (gamma0x >>> 3);\n\n\t var gamma1x = W[i - 2];\n\t var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\n\t ((gamma1x << 13) | (gamma1x >>> 19)) ^\n\t (gamma1x >>> 10);\n\n\t W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\n\t }\n\n\t var ch = (e & f) ^ (~e & g);\n\t var maj = (a & b) ^ (a & c) ^ (b & c);\n\n\t var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\n\t var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\n\n\t var t1 = h + sigma1 + ch + K[i] + W[i];\n\t var t2 = sigma0 + maj;\n\n\t h = g;\n\t g = f;\n\t f = e;\n\t e = (d + t1) | 0;\n\t d = c;\n\t c = b;\n\t b = a;\n\t a = (t1 + t2) | 0;\n\t }\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t H[4] = (H[4] + e) | 0;\n\t H[5] = (H[5] + f) | 0;\n\t H[6] = (H[6] + g) | 0;\n\t H[7] = (H[7] + h) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Return final computed hash\n\t return this._hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA256('message');\n\t * var hash = CryptoJS.SHA256(wordArray);\n\t */\n\t C.SHA256 = Hasher._createHelper(SHA256);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA256(message, key);\n\t */\n\t C.HmacSHA256 = Hasher._createHmacHelper(SHA256);\n\t}(Math));\n\n\n\treturn CryptoJS.SHA256;\n\n}));\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar presence_1 = tslib_1.__importDefault(__webpack_require__(34));\nvar message_1 = tslib_1.__importDefault(__webpack_require__(9));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar paginatedresource_1 = tslib_1.__importDefault(__webpack_require__(19));\nvar resource_1 = tslib_1.__importDefault(__webpack_require__(14));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nfunction noop() { }\nvar MSG_ID_ENTROPY_BYTES = 9;\nfunction allEmptyIds(messages) {\n return Utils.arrEvery(messages, function (message) {\n return !message.id;\n });\n}\nfunction normaliseChannelOptions(options) {\n var channelOptions = options || {};\n if (channelOptions.cipher) {\n if (!platform_1.default.Crypto)\n throw new Error('Encryption not enabled; use ably.encryption.js instead');\n var cipher = platform_1.default.Crypto.getCipher(channelOptions.cipher);\n channelOptions.cipher = cipher.cipherParams;\n channelOptions.channelCipher = cipher.cipher;\n }\n else if ('cipher' in channelOptions) {\n /* Don't deactivate an existing cipher unless options\n * has a 'cipher' key that's falsey */\n channelOptions.cipher = undefined;\n channelOptions.channelCipher = null;\n }\n return channelOptions;\n}\nvar Channel = /** @class */ (function (_super) {\n tslib_1.__extends(Channel, _super);\n function Channel(rest, name, channelOptions) {\n var _this = _super.call(this) || this;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Channel()', 'started; name = ' + name);\n _this.rest = rest;\n _this.name = name;\n _this.basePath = '/channels/' + encodeURIComponent(name);\n _this.presence = new presence_1.default(_this);\n _this.channelOptions = normaliseChannelOptions(channelOptions);\n return _this;\n }\n Channel.prototype.setOptions = function (options) {\n this.channelOptions = normaliseChannelOptions(options);\n };\n Channel.prototype.history = function (params, callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Channel.history()', 'channel = ' + this.name);\n /* params and callback are optional; see if params contains the callback */\n if (callback === undefined) {\n if (typeof params == 'function') {\n callback = params;\n params = null;\n }\n else {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'history', arguments);\n }\n callback = noop;\n }\n }\n this._history(params, callback);\n };\n Channel.prototype._history = function (params, callback) {\n var rest = this.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, envelope = this.rest.http.supportsLinkHeaders ? undefined : format, headers = Utils.defaultGetHeaders(rest.options, format);\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n var options = this.channelOptions;\n new paginatedresource_1.default(rest, this.basePath + '/messages', headers, envelope, function (body, headers, unpacked) {\n return message_1.default.fromResponseBody(body, options, unpacked ? undefined : format);\n }).get(params, callback);\n };\n Channel.prototype.publish = function () {\n var _this = this;\n var argCount = arguments.length, first = arguments[0], second = arguments[1];\n var callback = arguments[argCount - 1];\n var messages;\n var params;\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'publish', arguments);\n }\n callback = noop;\n }\n if (typeof first === 'string' || first === null) {\n /* (name, data, ...) */\n messages = [message_1.default.fromValues({ name: first, data: second })];\n params = arguments[2];\n }\n else if (Utils.isObject(first)) {\n messages = [message_1.default.fromValues(first)];\n params = arguments[1];\n }\n else if (Utils.isArray(first)) {\n messages = message_1.default.fromValuesArray(first);\n params = arguments[1];\n }\n else {\n throw new errorinfo_1.default('The single-argument form of publish() expects a message object or an array of message objects', 40013, 400);\n }\n if (typeof params !== 'object' || !params) {\n /* No params supplied (so after-message argument is just the callback or undefined) */\n params = {};\n }\n var rest = this.rest, options = rest.options, format = options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, idempotentRestPublishing = rest.options.idempotentRestPublishing, headers = Utils.defaultPostHeaders(rest.options, format);\n if (options.headers)\n Utils.mixin(headers, options.headers);\n if (idempotentRestPublishing && allEmptyIds(messages)) {\n var msgIdBase_1 = Utils.randomString(MSG_ID_ENTROPY_BYTES);\n Utils.arrForEach(messages, function (message, index) {\n message.id = msgIdBase_1 + ':' + index.toString();\n });\n }\n message_1.default.encodeArray(messages, this.channelOptions, function (err) {\n if (err) {\n callback(err);\n return;\n }\n /* RSL1i */\n var size = message_1.default.getMessagesSize(messages), maxMessageSize = options.maxMessageSize;\n if (size > maxMessageSize) {\n callback(new errorinfo_1.default('Maximum size of messages that can be published at once exceeded ( was ' +\n size +\n ' bytes; limit is ' +\n maxMessageSize +\n ' bytes)', 40009, 400));\n return;\n }\n _this._publish(message_1.default.serialize(messages, format), headers, params, callback);\n });\n };\n Channel.prototype._publish = function (requestBody, headers, params, callback) {\n resource_1.default.post(this.rest, this.basePath + '/messages', requestBody, headers, params, null, callback);\n };\n Channel.prototype.status = function (callback) {\n if (typeof callback !== 'function' && this.rest.options.promises) {\n return Utils.promisify(this, 'status', []);\n }\n var format = this.rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json;\n var headers = Utils.defaultPostHeaders(this.rest.options, format);\n resource_1.default.get(this.rest, this.basePath, headers, {}, format, callback || noop);\n };\n return Channel;\n}(eventemitter_1.default));\nexports.default = Channel;\n\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar paginatedresource_1 = tslib_1.__importDefault(__webpack_require__(19));\nvar presencemessage_1 = tslib_1.__importDefault(__webpack_require__(15));\nfunction noop() { }\nvar Presence = /** @class */ (function (_super) {\n tslib_1.__extends(Presence, _super);\n function Presence(channel) {\n var _this = _super.call(this) || this;\n _this.channel = channel;\n _this.basePath = channel.basePath + '/presence';\n return _this;\n }\n Presence.prototype.get = function (params, callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Presence.get()', 'channel = ' + this.channel.name);\n /* params and callback are optional; see if params contains the callback */\n if (callback === undefined) {\n if (typeof params == 'function') {\n callback = params;\n params = null;\n }\n else {\n if (this.channel.rest.options.promises) {\n return Utils.promisify(this, 'get', arguments);\n }\n callback = noop;\n }\n }\n var rest = this.channel.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, envelope = this.channel.rest.http.supportsLinkHeaders ? undefined : format, headers = Utils.defaultGetHeaders(rest.options, format);\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n var options = this.channel.channelOptions;\n new paginatedresource_1.default(rest, this.basePath, headers, envelope, function (body, headers, unpacked) {\n return presencemessage_1.default.fromResponseBody(body, options, unpacked ? undefined : format);\n }).get(params, callback);\n };\n Presence.prototype.history = function (params, callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Presence.history()', 'channel = ' + this.channel.name);\n return this._history(params, callback);\n };\n Presence.prototype._history = function (params, callback) {\n /* params and callback are optional; see if params contains the callback */\n if (callback === undefined) {\n if (typeof params == 'function') {\n callback = params;\n params = null;\n }\n else {\n if (this.channel.rest.options.promises) {\n return Utils.promisify(this, '_history', [params]);\n }\n callback = noop;\n }\n }\n var rest = this.channel.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, envelope = this.channel.rest.http.supportsLinkHeaders ? undefined : format, headers = Utils.defaultGetHeaders(rest.options, format);\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n var options = this.channel.channelOptions;\n new paginatedresource_1.default(rest, this.basePath + '/history', headers, envelope, function (body, headers, unpacked) {\n return presencemessage_1.default.fromResponseBody(body, options, unpacked ? undefined : format);\n }).get(params, callback);\n };\n return Presence;\n}(eventemitter_1.default));\nexports.default = Presence;\n\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TransportParams = void 0;\nvar tslib_1 = __webpack_require__(0);\nvar protocolmessage_1 = tslib_1.__importDefault(__webpack_require__(10));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar protocol_1 = tslib_1.__importStar(__webpack_require__(52));\nvar defaults_1 = tslib_1.__importStar(__webpack_require__(8));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar messagequeue_1 = tslib_1.__importDefault(__webpack_require__(36));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar connectionstatechange_1 = tslib_1.__importDefault(__webpack_require__(37));\nvar connectionerrors_1 = tslib_1.__importStar(__webpack_require__(20));\nvar errorinfo_1 = tslib_1.__importStar(__webpack_require__(4));\nvar auth_1 = tslib_1.__importDefault(__webpack_require__(17));\nvar message_1 = tslib_1.__importDefault(__webpack_require__(9));\nvar multicaster_1 = tslib_1.__importDefault(__webpack_require__(23));\nvar websockettransport_1 = tslib_1.__importDefault(__webpack_require__(53));\nvar transport_1 = tslib_1.__importDefault(__webpack_require__(26));\nvar HttpStatusCodes_1 = tslib_1.__importDefault(__webpack_require__(25));\nvar haveWebStorage = function () { var _a; return typeof platform_1.default.WebStorage !== 'undefined' && ((_a = platform_1.default.WebStorage) === null || _a === void 0 ? void 0 : _a.localSupported); };\nvar haveSessionStorage = function () { var _a; return typeof platform_1.default.WebStorage !== 'undefined' && ((_a = platform_1.default.WebStorage) === null || _a === void 0 ? void 0 : _a.sessionSupported); };\nvar actions = protocolmessage_1.default.Action;\nvar noop = function () { };\nvar transportPreferenceName = 'ably-transport-preference';\nvar sessionRecoveryName = 'ably-connection-recovery';\nfunction getSessionRecoverData() {\n var _a, _b;\n return haveSessionStorage() && ((_b = (_a = platform_1.default.WebStorage) === null || _a === void 0 ? void 0 : _a.getSession) === null || _b === void 0 ? void 0 : _b.call(_a, sessionRecoveryName));\n}\nfunction setSessionRecoverData(value) {\n var _a, _b;\n return haveSessionStorage() && ((_b = (_a = platform_1.default.WebStorage) === null || _a === void 0 ? void 0 : _a.setSession) === null || _b === void 0 ? void 0 : _b.call(_a, sessionRecoveryName, value));\n}\nfunction clearSessionRecoverData() {\n var _a, _b;\n return haveSessionStorage() && ((_b = (_a = platform_1.default.WebStorage) === null || _a === void 0 ? void 0 : _a.removeSession) === null || _b === void 0 ? void 0 : _b.call(_a, sessionRecoveryName));\n}\nfunction betterTransportThan(a, b) {\n return (Utils.arrIndexOf(platform_1.default.Defaults.transportPreferenceOrder, a.shortName) >\n Utils.arrIndexOf(platform_1.default.Defaults.transportPreferenceOrder, b.shortName));\n}\nfunction bundleWith(dest, src, maxSize) {\n var action;\n if (dest.channel !== src.channel) {\n /* RTL6d3 */\n return false;\n }\n if ((action = dest.action) !== actions.PRESENCE && action !== actions.MESSAGE) {\n /* RTL6d - can only bundle messages or presence */\n return false;\n }\n if (action !== src.action) {\n /* RTL6d4 */\n return false;\n }\n var kind = action === actions.PRESENCE ? 'presence' : 'messages', proposed = dest[kind].concat(src[kind]), size = message_1.default.getMessagesSize(proposed);\n if (size > maxSize) {\n /* RTL6d1 */\n return false;\n }\n if (!Utils.allSame(proposed, 'clientId')) {\n /* RTL6d2 */\n return false;\n }\n if (!Utils.arrEvery(proposed, function (msg) {\n return !msg.id;\n })) {\n /* RTL6d7 */\n return false;\n }\n /* we're good to go! */\n dest[kind] = proposed;\n return true;\n}\nfunction decodeRecoveryKey(recoveryKey) {\n try {\n return JSON.parse(recoveryKey);\n }\n catch (e) {\n return null;\n }\n}\nvar TransportParams = /** @class */ (function () {\n function TransportParams(options, host, mode, connectionKey) {\n this.options = options;\n this.host = host;\n this.mode = mode;\n this.connectionKey = connectionKey;\n this.format = options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json;\n }\n TransportParams.prototype.getConnectParams = function (authParams) {\n var params = authParams ? Utils.copy(authParams) : {};\n var options = this.options;\n switch (this.mode) {\n case 'upgrade':\n params.upgrade = this.connectionKey;\n break;\n case 'resume':\n params.resume = this.connectionKey;\n break;\n case 'recover': {\n var recoveryContext = decodeRecoveryKey(options.recover);\n if (recoveryContext) {\n params.recover = recoveryContext.connectionKey;\n }\n break;\n }\n default:\n }\n if (options.clientId !== undefined) {\n params.clientId = options.clientId;\n }\n if (options.echoMessages === false) {\n params.echo = 'false';\n }\n if (this.format !== undefined) {\n params.format = this.format;\n }\n if (this.stream !== undefined) {\n params.stream = this.stream;\n }\n if (this.heartbeats !== undefined) {\n params.heartbeats = this.heartbeats;\n }\n params.v = defaults_1.default.protocolVersion;\n params.agent = encodeURIComponent((0, defaults_1.getAgentString)(this.options));\n if (options.transportParams !== undefined) {\n Utils.mixin(params, options.transportParams);\n }\n return params;\n };\n TransportParams.prototype.toString = function () {\n var result = '[mode=' + this.mode;\n if (this.host) {\n result += ',host=' + this.host;\n }\n if (this.connectionKey) {\n result += ',connectionKey=' + this.connectionKey;\n }\n if (this.format) {\n result += ',format=' + this.format;\n }\n result += ']';\n return result;\n };\n return TransportParams;\n}());\nexports.TransportParams = TransportParams;\nvar ConnectionManager = /** @class */ (function (_super) {\n tslib_1.__extends(ConnectionManager, _super);\n function ConnectionManager(realtime, options) {\n var _this = _super.call(this) || this;\n _this.disconnectedRetryCount = 0;\n ConnectionManager.initTransports();\n _this.realtime = realtime;\n _this.options = options;\n var timeouts = options.timeouts;\n /* connectingTimeout: leave preferenceConnectTimeout (~6s) to try the\n * preference transport, then realtimeRequestTimeout (~10s) to establish\n * the base transport in case that fails */\n var connectingTimeout = timeouts.preferenceConnectTimeout + timeouts.realtimeRequestTimeout;\n _this.states = {\n initialized: {\n state: 'initialized',\n terminal: false,\n queueEvents: true,\n sendEvents: false,\n failState: 'disconnected',\n },\n connecting: {\n state: 'connecting',\n terminal: false,\n queueEvents: true,\n sendEvents: false,\n retryDelay: connectingTimeout,\n failState: 'disconnected',\n },\n connected: {\n state: 'connected',\n terminal: false,\n queueEvents: false,\n sendEvents: true,\n failState: 'disconnected',\n },\n synchronizing: {\n state: 'connected',\n terminal: false,\n queueEvents: true,\n sendEvents: false,\n forceQueueEvents: true,\n failState: 'disconnected',\n },\n disconnected: {\n state: 'disconnected',\n terminal: false,\n queueEvents: true,\n sendEvents: false,\n retryDelay: timeouts.disconnectedRetryTimeout,\n failState: 'disconnected',\n },\n suspended: {\n state: 'suspended',\n terminal: false,\n queueEvents: false,\n sendEvents: false,\n retryDelay: timeouts.suspendedRetryTimeout,\n failState: 'suspended',\n },\n closing: {\n state: 'closing',\n terminal: false,\n queueEvents: false,\n sendEvents: false,\n retryDelay: timeouts.realtimeRequestTimeout,\n failState: 'closed',\n },\n closed: { state: 'closed', terminal: true, queueEvents: false, sendEvents: false, failState: 'closed' },\n failed: { state: 'failed', terminal: true, queueEvents: false, sendEvents: false, failState: 'failed' },\n };\n _this.state = _this.states.initialized;\n _this.errorReason = null;\n _this.queuedMessages = new messagequeue_1.default();\n _this.msgSerial = 0;\n _this.connectionDetails = undefined;\n _this.connectionId = undefined;\n _this.connectionKey = undefined;\n _this.connectionStateTtl = timeouts.connectionStateTtl;\n _this.maxIdleInterval = null;\n _this.transports = Utils.intersect(options.transports || defaults_1.default.defaultTransports, ConnectionManager.supportedTransports);\n /* baseTransports selects the leftmost transport in the Defaults.baseTransportOrder list\n * that's both requested and supported. Normally this will be xhr_polling;\n * if xhr isn't supported it will be jsonp. If the user has forced a\n * transport, it'll just be that one. */\n _this.baseTransport = Utils.intersect(defaults_1.default.baseTransportOrder, _this.transports)[0];\n _this.upgradeTransports = Utils.intersect(_this.transports, defaults_1.default.upgradeTransports);\n _this.transportPreference = null;\n _this.httpHosts = defaults_1.default.getHosts(options);\n _this.activeProtocol = null;\n _this.proposedTransports = [];\n _this.pendingTransports = [];\n _this.host = null;\n _this.lastAutoReconnectAttempt = null;\n _this.lastActivity = null;\n _this.forceFallbackHost = false;\n _this.connectCounter = 0;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Realtime.ConnectionManager()', 'started');\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Realtime.ConnectionManager()', 'requested transports = [' + (options.transports || defaults_1.default.defaultTransports) + ']');\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Realtime.ConnectionManager()', 'available transports = [' + _this.transports + ']');\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Realtime.ConnectionManager()', 'http hosts = [' + _this.httpHosts + ']');\n if (!_this.transports.length) {\n var msg = 'no requested transports available';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'realtime.ConnectionManager()', msg);\n throw new Error(msg);\n }\n var addEventListener = platform_1.default.Config.addEventListener;\n if (addEventListener) {\n /* intercept close event in browser to persist connection id if requested */\n if (haveSessionStorage() && typeof options.recover === 'function') {\n /* Usually can't use bind as not supported in IE8, but IE doesn't support sessionStorage, so... */\n addEventListener('beforeunload', _this.persistConnection.bind(_this));\n }\n if (options.closeOnUnload === true) {\n addEventListener('beforeunload', function () {\n logger_1.default.logAction(logger_1.default.LOG_MAJOR, 'Realtime.ConnectionManager()', 'beforeunload event has triggered the connection to close as closeOnUnload is true');\n _this.requestState({ state: 'closing' });\n });\n }\n /* Listen for online and offline events */\n addEventListener('online', function () {\n if (_this.state == _this.states.disconnected || _this.state == _this.states.suspended) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager caught browser ‘online’ event', 'reattempting connection');\n _this.requestState({ state: 'connecting' });\n }\n else if (_this.state == _this.states.connecting) {\n // RTN20c: if 'online' event recieved while CONNECTING, abandon connection attempt and retry\n _this.pendingTransports.forEach(function (transport) {\n // Detach transport listeners to avoid connection state side effects from calling dispose\n transport.off();\n });\n _this.disconnectAllTransports();\n _this.startConnect();\n }\n });\n addEventListener('offline', function () {\n if (_this.state == _this.states.connected) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager caught browser ‘offline’ event', 'disconnecting active transport');\n // Not sufficient to just go to the 'disconnected' state, want to\n // force all transports to reattempt the connection. Will immediately\n // retry.\n _this.disconnectAllTransports();\n }\n });\n }\n return _this;\n }\n ConnectionManager.initTransports = function () {\n (0, websockettransport_1.default)(ConnectionManager);\n Utils.arrForEach(platform_1.default.Transports, function (initFn) {\n initFn(ConnectionManager);\n });\n };\n ConnectionManager.prototype.createTransportParams = function (host, mode) {\n return new TransportParams(this.options, host, mode, this.connectionKey);\n };\n ConnectionManager.prototype.getTransportParams = function (callback) {\n var _this = this;\n var decideMode = function (modeCb) {\n if (_this.connectionKey) {\n modeCb('resume');\n return;\n }\n if (typeof _this.options.recover === 'string') {\n modeCb('recover');\n return;\n }\n var recoverFn = _this.options.recover, lastSessionData = getSessionRecoverData();\n if (lastSessionData && typeof recoverFn === 'function') {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.getTransportParams()', 'Calling clientOptions-provided recover function with last session data');\n recoverFn(lastSessionData, function (shouldRecover) {\n if (shouldRecover) {\n _this.options.recover = lastSessionData.recoveryKey;\n modeCb('recover');\n }\n else {\n modeCb('clean');\n }\n });\n return;\n }\n modeCb('clean');\n };\n decideMode(function (mode) {\n var transportParams = _this.createTransportParams(null, mode);\n if (mode === 'recover') {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.getTransportParams()', 'Transport recovery mode = recover; recoveryKey = ' + _this.options.recover);\n var recoveryContext = decodeRecoveryKey(_this.options.recover);\n if (recoveryContext) {\n _this.msgSerial = recoveryContext.msgSerial;\n }\n }\n else {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.getTransportParams()', 'Transport params = ' + transportParams.toString());\n }\n callback(transportParams);\n });\n };\n /**\n * Attempt to connect using a given transport\n * @param transportParams\n * @param candidate, the transport to try\n * @param callback\n */\n ConnectionManager.prototype.tryATransport = function (transportParams, candidate, callback) {\n var _this = this;\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.tryATransport()', 'trying ' + candidate);\n transport_1.default.tryConnect(ConnectionManager.supportedTransports[candidate], this, this.realtime.auth, transportParams, function (wrappedErr, transport) {\n var state = _this.state;\n if (state == _this.states.closing || state == _this.states.closed || state == _this.states.failed) {\n if (transport) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.tryATransport()', 'connection ' + state.state + ' while we were attempting the transport; closing ' + transport);\n transport.close();\n }\n callback(true);\n return;\n }\n if (wrappedErr) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.tryATransport()', 'transport ' + candidate + ' ' + wrappedErr.event + ', err: ' + wrappedErr.error.toString());\n /* Comet transport onconnect token errors can be dealt with here.\n * Websocket ones only happen after the transport claims to be viable,\n * so are dealt with as non-onconnect token errors */\n if (auth_1.default.isTokenErr(wrappedErr.error) &&\n !(_this.errorReason && auth_1.default.isTokenErr(_this.errorReason))) {\n _this.errorReason = wrappedErr.error;\n /* re-get a token and try again */\n _this.realtime.auth._forceNewToken(null, null, function (err) {\n if (err) {\n _this.actOnErrorFromAuthorize(err);\n return;\n }\n _this.tryATransport(transportParams, candidate, callback);\n });\n }\n else if (wrappedErr.event === 'failed') {\n /* Error that's fatal to the connection */\n _this.notifyState({ state: 'failed', error: wrappedErr.error });\n callback(true);\n }\n else if (wrappedErr.event === 'disconnected') {\n if (!(0, connectionerrors_1.isRetriable)(wrappedErr.error)) {\n /* Error received from the server that does not call for trying a fallback host, eg a rate limit */\n _this.notifyState({ state: _this.states.connecting.failState, error: wrappedErr.error });\n callback(true);\n }\n else {\n /* Error with that transport only; continue trying other fallback hosts */\n callback(false);\n }\n }\n return;\n }\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.tryATransport()', 'viable transport ' + candidate + '; setting pending');\n _this.setTransportPending(transport, transportParams);\n callback(null, transport);\n });\n };\n /**\n * Called when a transport is indicated to be viable, and the ConnectionManager\n * expects to activate this transport as soon as it is connected.\n * @param transport\n * @param transportParams\n */\n ConnectionManager.prototype.setTransportPending = function (transport, transportParams) {\n var _this = this;\n var mode = transportParams.mode;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.setTransportPending()', 'transport = ' + transport + '; mode = ' + mode);\n Utils.arrDeleteValue(this.proposedTransports, transport);\n this.pendingTransports.push(transport);\n var optimalTransport = platform_1.default.Defaults.transportPreferenceOrder[platform_1.default.Defaults.transportPreferenceOrder.length - 1];\n transport.once('connected', function (error, connectionId, connectionDetails) {\n if (mode == 'upgrade' && _this.activeProtocol) {\n /* if ws and xhrs are connecting in parallel, delay xhrs activation to let ws go ahead */\n if (transport.shortName !== optimalTransport &&\n Utils.arrIn(_this.getUpgradePossibilities(), optimalTransport) &&\n _this.activeProtocol) {\n setTimeout(function () {\n _this.scheduleTransportActivation(error, transport, connectionId, connectionDetails);\n }, _this.options.timeouts.parallelUpgradeDelay);\n }\n else {\n _this.scheduleTransportActivation(error, transport, connectionId, connectionDetails);\n }\n }\n else {\n _this.activateTransport(error, transport, connectionId, connectionDetails);\n /* allow connectImpl to start the upgrade process if needed, but allow\n * other event handlers, including activating the transport, to run first */\n platform_1.default.Config.nextTick(function () {\n _this.connectImpl(transportParams);\n });\n }\n if (mode === 'recover' && _this.options.recover) {\n /* After a successful recovery, we unpersist, as a recovery key cannot\n * be used more than once */\n _this.options.recover = null;\n _this.unpersistConnection();\n }\n });\n var self = this;\n transport.on(['disconnected', 'closed', 'failed'], function (error) {\n self.deactivateTransport(transport, this.event, error);\n });\n this.emit('transport.pending', transport);\n };\n /**\n * Called when an upgrade transport is connected,\n * to schedule the activation of that transport.\n * @param error\n * @param transport\n * @param connectionId\n * @param connectionDetails\n */\n ConnectionManager.prototype.scheduleTransportActivation = function (error, transport, connectionId, connectionDetails) {\n var _this = this;\n var currentTransport = this.activeProtocol && this.activeProtocol.getTransport(), abandon = function () {\n transport.disconnect();\n Utils.arrDeleteValue(_this.pendingTransports, transport);\n };\n if (this.state !== this.states.connected && this.state !== this.states.connecting) {\n /* This is most likely to happen for the delayed XHRs, when XHRs and ws are scheduled in parallel*/\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.scheduleTransportActivation()', 'Current connection state (' +\n this.state.state +\n (this.state === this.states.synchronizing ? ', but with an upgrade already in progress' : '') +\n ') is not valid to upgrade in; abandoning upgrade to ' +\n transport.shortName);\n abandon();\n return;\n }\n if (currentTransport && !betterTransportThan(transport, currentTransport)) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.scheduleTransportActivation()', 'Proposed transport ' +\n transport.shortName +\n ' is no better than current active transport ' +\n currentTransport.shortName +\n ' - abandoning upgrade');\n abandon();\n return;\n }\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.scheduleTransportActivation()', 'Scheduling transport upgrade; transport = ' + transport);\n var oldProtocol = null;\n if (!transport.isConnected) {\n /* This is only possible if the xhr streaming transport was disconnected during the parallelUpgradeDelay */\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.scheduleTransportActivation()', 'Proposed transport ' + transport.shortName + 'is no longer connected; abandoning upgrade');\n abandon();\n return;\n }\n if (this.state === this.states.connected) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.scheduleTransportActivation()', 'Currently connected, so temporarily pausing events until the upgrade is complete');\n this.state = this.states.synchronizing;\n oldProtocol = this.activeProtocol;\n }\n else if (this.state !== this.states.connecting) {\n /* Note: upgrading from the connecting state is valid if the old active\n * transport was deactivated after the upgrade transport first connected;\n * see logic in deactivateTransport */\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.scheduleTransportActivation()', 'Current connection state (' +\n this.state.state +\n (this.state === this.states.synchronizing ? ', but with an upgrade already in progress' : '') +\n ') is not valid to upgrade in; abandoning upgrade to ' +\n transport.shortName);\n abandon();\n return;\n }\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.scheduleTransportActivation()', 'Syncing transport; transport = ' + transport);\n var finishUpgrade = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.scheduleTransportActivation()', 'Activating transport; transport = ' + transport);\n // Send ACTIVATE to tell the server to make this transport the\n // active transport, which suspends channels until we re-attach.\n transport.send(protocolmessage_1.default.fromValues({\n action: actions.ACTIVATE,\n }));\n _this.activateTransport(error, transport, connectionId, connectionDetails);\n /* Restore pre-sync state. If state has changed in the meantime,\n * don't touch it -- since the websocket transport waits a tick before\n * disposing itself, it's possible for it to have happily synced\n * without err while, unknown to it, the connection has closed in the\n * meantime and the ws transport is scheduled for death */\n if (_this.state === _this.states.synchronizing) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.scheduleTransportActivation()', 'Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = ' + transport);\n _this.state = _this.states.connected;\n }\n else {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.scheduleTransportActivation()', 'Pre-upgrade protocol idle, but state is now ' + _this.state.state + ', so leaving unchanged');\n }\n if (_this.state.sendEvents) {\n _this.sendQueuedMessages();\n }\n };\n /* Wait until sync is done and old transport is idle before activating new transport. This\n * guarantees that messages arrive at realtime in the same order they are sent.\n *\n * If a message times out on the old transport, since it's still the active transport the\n * message will be requeued. deactivateTransport will see the pending transport and notify\n * the `connecting` state without starting a new connection, so the new transport can take\n * over once deactivateTransport clears the old protocol's queue.\n *\n * If there is no old protocol, that meant that we weren't in the connected state at the\n * beginning of the sync - likely the base transport died just before the sync. So can just\n * finish the upgrade. If we're actually in closing/failed rather than connecting, that's\n * fine, activatetransport will deal with that. */\n if (oldProtocol) {\n /* Most of the time this will be already true: the new-transport sync will have given\n * enough time for in-flight messages on the old transport to complete. */\n oldProtocol.onceIdle(finishUpgrade);\n }\n else {\n finishUpgrade();\n }\n };\n /**\n * Called when a transport is connected, and the connectionmanager decides that\n * it will now be the active transport. Returns whether or not it activated\n * the transport (if the connection is closing/closed it will choose not to).\n * @param transport the transport instance\n * @param connectionId the id of the new active connection\n * @param connectionDetails the details of the new active connection\n */\n ConnectionManager.prototype.activateTransport = function (error, transport, connectionId, connectionDetails) {\n var _this = this;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.activateTransport()', 'transport = ' + transport);\n if (error) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.activateTransport()', 'error = ' + error);\n }\n if (connectionId) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.activateTransport()', 'connectionId = ' + connectionId);\n }\n if (connectionDetails) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.activateTransport()', 'connectionDetails = ' + JSON.stringify(connectionDetails));\n }\n this.persistTransportPreference(transport);\n /* if the connectionmanager moved to the closing/closed state before this\n * connection event, then we won't activate this transport */\n var existingState = this.state, connectedState = this.states.connected.state;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.activateTransport()', 'current state = ' + existingState.state);\n if (existingState.state == this.states.closing.state ||\n existingState.state == this.states.closed.state ||\n existingState.state == this.states.failed.state) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.activateTransport()', 'Disconnecting transport and abandoning');\n transport.disconnect();\n return false;\n }\n /* remove this transport from pending transports */\n Utils.arrDeleteValue(this.pendingTransports, transport);\n /* if the transport is not connected then don't activate it */\n if (!transport.isConnected) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.activateTransport()', 'Declining to activate transport ' + transport + ' since it appears to no longer be connected');\n return false;\n }\n /* the given transport is connected; this will immediately\n * take over as the active transport */\n var existingActiveProtocol = this.activeProtocol;\n this.activeProtocol = new protocol_1.default(transport);\n this.host = transport.params.host;\n var connectionKey = connectionDetails.connectionKey;\n if (connectionKey && this.connectionKey != connectionKey) {\n this.setConnection(connectionId, connectionDetails, !!error);\n }\n /* Rebroadcast any new connectionDetails from the active transport, which\n * can come at any time (eg following a reauth), and emit an RTN24 UPDATE\n * event. (Listener added on nextTick because we're in a transport.on('connected')\n * callback at the moment; if we add it now we'll be adding it to the end\n * of the listeners array and it'll be called immediately) */\n this.onConnectionDetailsUpdate(connectionDetails, transport);\n platform_1.default.Config.nextTick(function () {\n transport.on('connected', function (connectedErr, _connectionId, connectionDetails) {\n _this.onConnectionDetailsUpdate(connectionDetails, transport);\n _this.emit('update', new connectionstatechange_1.default(connectedState, connectedState, null, connectedErr));\n });\n });\n /* If previously not connected, notify the state change (including any\n * error). */\n if (existingState.state === this.states.connected.state) {\n if (error) {\n /* if upgrading without error, leave any existing errorReason alone */\n this.errorReason = this.realtime.connection.errorReason = error;\n /* Only bother emitting an upgrade if there's an error; otherwise it's\n * just a transport upgrade, so auth details won't have changed */\n this.emit('update', new connectionstatechange_1.default(connectedState, connectedState, null, error));\n }\n }\n else {\n this.notifyState({ state: 'connected', error: error });\n this.errorReason = this.realtime.connection.errorReason = error || null;\n }\n /* Send after the connection state update, as Channels hooks into this to\n * resend attaches on a new transport if necessary */\n this.emit('transport.active', transport);\n /* Gracefully terminate existing protocol */\n if (existingActiveProtocol) {\n if (existingActiveProtocol.messageQueue.count() > 0) {\n /* We could just requeue pending messages on the new transport, but\n * actually this should never happen: transports should only take over\n * from other active transports when upgrading, and upgrading waits for\n * the old transport to be idle. So log an error. */\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.activateTransport()', 'Previous active protocol (for transport ' +\n existingActiveProtocol.transport.shortName +\n ', new one is ' +\n transport.shortName +\n ') finishing with ' +\n existingActiveProtocol.messageQueue.count() +\n ' messages still pending');\n }\n if (existingActiveProtocol.transport === transport) {\n var msg = 'Assumption violated: activating a transport that was also the transport for the previous active protocol; transport = ' +\n transport.shortName +\n '; stack = ' +\n new Error().stack;\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.activateTransport()', msg);\n }\n else {\n existingActiveProtocol.finish();\n }\n }\n /* Terminate any other pending transport(s), and\n * abort any not-yet-pending transport attempts */\n Utils.safeArrForEach(this.pendingTransports, function (pendingTransport) {\n if (pendingTransport === transport) {\n var msg = 'Assumption violated: activating a transport that is still marked as a pending transport; transport = ' +\n transport.shortName +\n '; stack = ' +\n new Error().stack;\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.activateTransport()', msg);\n Utils.arrDeleteValue(_this.pendingTransports, transport);\n }\n else {\n pendingTransport.disconnect();\n }\n });\n Utils.safeArrForEach(this.proposedTransports, function (proposedTransport) {\n if (proposedTransport === transport) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.activateTransport()', 'Assumption violated: activating a transport that is still marked as a proposed transport; transport = ' +\n transport.shortName +\n '; stack = ' +\n new Error().stack);\n Utils.arrDeleteValue(_this.proposedTransports, transport);\n }\n else {\n proposedTransport.dispose();\n }\n });\n return true;\n };\n /**\n * Called when a transport is no longer the active transport. This can occur\n * in any transport connection state.\n * @param transport\n */\n ConnectionManager.prototype.deactivateTransport = function (transport, state, error) {\n var currentProtocol = this.activeProtocol, wasActive = currentProtocol && currentProtocol.getTransport() === transport, wasPending = Utils.arrDeleteValue(this.pendingTransports, transport), wasProposed = Utils.arrDeleteValue(this.proposedTransports, transport), noTransportsScheduledForActivation = this.noTransportsScheduledForActivation();\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.deactivateTransport()', 'transport = ' + transport);\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.deactivateTransport()', 'state = ' +\n state +\n (wasActive ? '; was active' : wasPending ? '; was pending' : wasProposed ? '; was proposed' : '') +\n (noTransportsScheduledForActivation ? '' : '; another transport is scheduled for activation'));\n if (error && error.message)\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.deactivateTransport()', 'reason = ' + error.message);\n if (wasActive) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.deactivateTransport()', 'Getting, clearing, and requeuing ' +\n this.activeProtocol.messageQueue.count() +\n ' pending messages');\n this.queuePendingMessages(currentProtocol.getPendingMessages());\n /* Clear any messages we requeue to allow the protocol to become idle.\n * In case of an upgrade, this will trigger an immediate activation of\n * the upgrade transport, so delay a tick so this transport can finish\n * deactivating */\n platform_1.default.Config.nextTick(function () {\n currentProtocol.clearPendingMessages();\n });\n this.activeProtocol = this.host = null;\n }\n this.emit('transport.inactive', transport);\n /* this transport state change is a state change for the connectionmanager if\n * - the transport was the active transport and there are no transports\n * which are connected and scheduled for activation, just waiting for the\n * active transport to finish what its doing; or\n * - the transport was the active transport and the error was fatal (so\n * unhealable by another transport); or\n * - there is no active transport, and this is the last remaining\n * pending transport (so we were in the connecting state)\n */\n if ((wasActive && noTransportsScheduledForActivation) ||\n (wasActive && state === 'failed') ||\n state === 'closed' ||\n (currentProtocol === null && wasPending && this.pendingTransports.length === 0)) {\n /* If we're disconnected with a 5xx we need to try fallback hosts\n * (RTN14d), but (a) due to how the upgrade sequence works, the\n * host/transport selection sequence only cares about getting to\n * `preconnect` (eg establishing a websocket) getting a `disconnected`\n * protocol message afterwards is too late; and (b) host retry only\n * applies to connectBase unless the stored preference transport doesn't\n * work. We solve this by unpersisting the transport preference and\n * setting an instance variable to force fallback hosts to be used (if\n * any) here. Bit of a kludge, but no real better alternatives without\n * rewriting the entire thing */\n if (state === 'disconnected' && error && error.statusCode > 500 && this.httpHosts.length > 1) {\n this.unpersistTransportPreference();\n this.forceFallbackHost = true;\n /* and try to connect again to try a fallback host without waiting for the usual 15s disconnectedRetryTimeout */\n this.notifyState({ state: state, error: error, retryImmediately: true });\n return;\n }\n /* TODO remove below line once realtime sends token errors as DISCONNECTEDs */\n var newConnectionState = state === 'failed' && auth_1.default.isTokenErr(error) ? 'disconnected' : state;\n this.notifyState({ state: newConnectionState, error: error });\n return;\n }\n if (wasActive && state === 'disconnected' && this.state !== this.states.synchronizing) {\n /* If we were active but there is another transport scheduled for\n * activation, go into to the connecting state until that transport\n * activates and sets us back to connected. (manually starting the\n * transition timers in case that never happens). (If we were in the\n * synchronizing state, then that's fine, the old transport just got its\n * disconnected before the new one got the sync -- ignore it and keep\n * waiting for the sync. If it fails we have a separate sync timer that\n * will expire). */\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.deactivateTransport()', 'wasActive but another transport is connected and scheduled for activation, so going into the connecting state until it activates');\n this.startSuspendTimer();\n this.startTransitionTimer(this.states.connecting);\n this.notifyState({ state: 'connecting', error: error });\n }\n };\n /* Helper that returns true if there are no transports which are pending,\n * have been connected, and are just waiting for onceNoPending to fire before\n * being activated */\n ConnectionManager.prototype.noTransportsScheduledForActivation = function () {\n return (Utils.isEmpty(this.pendingTransports) ||\n this.pendingTransports.every(function (transport) {\n return !transport.isConnected;\n }));\n };\n ConnectionManager.prototype.setConnection = function (connectionId, connectionDetails, hasConnectionError) {\n /* if connectionKey changes but connectionId stays the same, then just a\n * transport change on the same connection. If connectionId changes, we're\n * on a new connection, with implications for msgSerial and channel state */\n /* If no previous connectionId, don't reset the msgSerial as it may have\n * been set by recover data (unless the recover failed) */\n var prevConnId = this.connectionId, connIdChanged = prevConnId && prevConnId !== connectionId, recoverFailure = !prevConnId && hasConnectionError;\n if (connIdChanged || recoverFailure) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.setConnection()', 'Resetting msgSerial');\n this.msgSerial = 0;\n // RTN19a2: In the event of a new connectionId, previous msgSerials are\n // meaningless.\n this.queuedMessages.resetSendAttempted();\n }\n if (this.connectionId !== connectionId) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.setConnection()', 'New connectionId; reattaching any attached channels');\n }\n this.realtime.connection.id = this.connectionId = connectionId;\n this.realtime.connection.key = this.connectionKey = connectionDetails.connectionKey;\n };\n ConnectionManager.prototype.clearConnection = function () {\n this.realtime.connection.id = this.connectionId = undefined;\n this.realtime.connection.key = this.connectionKey = undefined;\n this.msgSerial = 0;\n this.unpersistConnection();\n };\n ConnectionManager.prototype.createRecoveryKey = function () {\n // RTN16g2.\n if (!this.connectionKey) {\n return null;\n }\n return JSON.stringify({\n connectionKey: this.connectionKey,\n msgSerial: this.msgSerial,\n channelSerials: this.realtime.channels.channelSerials(),\n });\n };\n ConnectionManager.prototype.checkConnectionStateFreshness = function () {\n if (!this.lastActivity || !this.connectionId) {\n return;\n }\n var sinceLast = Utils.now() - this.lastActivity;\n if (sinceLast > this.connectionStateTtl + this.maxIdleInterval) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.checkConnectionStateFreshness()', 'Last known activity from realtime was ' + sinceLast + 'ms ago; discarding connection state');\n this.clearConnection();\n this.states.connecting.failState = 'suspended';\n }\n };\n /**\n * Called when the connectionmanager wants to persist transport\n * state for later recovery. Only applicable in the browser context.\n */\n ConnectionManager.prototype.persistConnection = function () {\n if (haveSessionStorage()) {\n var recoveryKey = this.createRecoveryKey();\n if (recoveryKey) {\n setSessionRecoverData({\n recoveryKey: recoveryKey,\n disconnectedAt: Utils.now(),\n location: global.location,\n clientId: this.realtime.auth.clientId,\n });\n }\n }\n };\n /**\n * Called when the connectionmanager wants to persist transport\n * state for later recovery. Only applicable in the browser context.\n */\n ConnectionManager.prototype.unpersistConnection = function () {\n clearSessionRecoverData();\n };\n /*********************\n * state management\n *********************/\n ConnectionManager.prototype.getError = function () {\n return this.errorReason || this.getStateError();\n };\n ConnectionManager.prototype.getStateError = function () {\n var _a, _b;\n return (_b = (_a = connectionerrors_1.default)[this.state.state]) === null || _b === void 0 ? void 0 : _b.call(_a);\n };\n ConnectionManager.prototype.activeState = function () {\n return this.state.queueEvents || this.state.sendEvents;\n };\n ConnectionManager.prototype.enactStateChange = function (stateChange) {\n var logLevel = stateChange.current === 'failed' ? logger_1.default.LOG_ERROR : logger_1.default.LOG_MAJOR;\n logger_1.default.logAction(logLevel, 'Connection state', stateChange.current + (stateChange.reason ? '; reason: ' + stateChange.reason : ''));\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.enactStateChange', 'setting new state: ' +\n stateChange.current +\n '; reason = ' +\n (stateChange.reason && stateChange.reason.message));\n var newState = (this.state = this.states[stateChange.current]);\n if (stateChange.reason) {\n this.errorReason = stateChange.reason;\n this.realtime.connection.errorReason = stateChange.reason;\n }\n if (newState.terminal || newState.state === 'suspended') {\n /* suspended is nonterminal, but once in the suspended state, realtime\n * will have discarded our connection state, so futher connection\n * attempts should start from scratch */\n this.clearConnection();\n }\n this.emit('connectionstate', stateChange);\n };\n /****************************************\n * ConnectionManager connection lifecycle\n ****************************************/\n ConnectionManager.prototype.startTransitionTimer = function (transitionState) {\n var _this = this;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.startTransitionTimer()', 'transitionState: ' + transitionState.state);\n if (this.transitionTimer) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.startTransitionTimer()', 'clearing already-running timer');\n clearTimeout(this.transitionTimer);\n }\n this.transitionTimer = setTimeout(function () {\n if (_this.transitionTimer) {\n _this.transitionTimer = null;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager ' + transitionState.state + ' timer expired', 'requesting new state: ' + transitionState.failState);\n _this.notifyState({ state: transitionState.failState });\n }\n }, transitionState.retryDelay);\n };\n ConnectionManager.prototype.cancelTransitionTimer = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.cancelTransitionTimer()', '');\n if (this.transitionTimer) {\n clearTimeout(this.transitionTimer);\n this.transitionTimer = null;\n }\n };\n ConnectionManager.prototype.startSuspendTimer = function () {\n var _this = this;\n if (this.suspendTimer)\n return;\n this.suspendTimer = setTimeout(function () {\n if (_this.suspendTimer) {\n _this.suspendTimer = null;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager suspend timer expired', 'requesting new state: suspended');\n _this.states.connecting.failState = 'suspended';\n _this.notifyState({ state: 'suspended' });\n }\n }, this.connectionStateTtl);\n };\n ConnectionManager.prototype.checkSuspendTimer = function (state) {\n if (state !== 'disconnected' && state !== 'suspended' && state !== 'connecting')\n this.cancelSuspendTimer();\n };\n ConnectionManager.prototype.cancelSuspendTimer = function () {\n this.states.connecting.failState = 'disconnected';\n if (this.suspendTimer) {\n clearTimeout(this.suspendTimer);\n this.suspendTimer = null;\n }\n };\n ConnectionManager.prototype.startRetryTimer = function (interval) {\n var _this = this;\n this.retryTimer = setTimeout(function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager retry timer expired', 'retrying');\n _this.retryTimer = null;\n _this.requestState({ state: 'connecting' });\n }, interval);\n };\n ConnectionManager.prototype.cancelRetryTimer = function () {\n if (this.retryTimer) {\n clearTimeout(this.retryTimer);\n this.retryTimer = null;\n }\n };\n ConnectionManager.prototype.notifyState = function (indicated) {\n var _this = this;\n var _a, _b;\n var state = indicated.state;\n /* We retry immediately if:\n * - something disconnects us while we're connected, or\n * - a viable (but not yet active) transport fails due to a token error (so\n * this.errorReason will be set, and startConnect will do a forced\n * authorize). If this.errorReason is already set (to a token error),\n * then there has been at least one previous attempt to connect that also\n * failed for a token error, so by RTN14b we go to DISCONNECTED and wait\n * before trying again */\n var retryImmediately = state === 'disconnected' &&\n (this.state === this.states.connected ||\n this.state === this.states.synchronizing ||\n indicated.retryImmediately ||\n (this.state === this.states.connecting &&\n indicated.error &&\n auth_1.default.isTokenErr(indicated.error) &&\n !(this.errorReason && auth_1.default.isTokenErr(this.errorReason))));\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.notifyState()', 'new state: ' + state + (retryImmediately ? '; will retry connection immediately' : ''));\n /* do nothing if we're already in the indicated state */\n if (state == this.state.state)\n return;\n /* kill timers (possibly excepting suspend timer depending on the notified\n * state), as these are superseded by this notification */\n this.cancelTransitionTimer();\n this.cancelRetryTimer();\n this.checkSuspendTimer(indicated.state);\n if (state === 'suspended' || state === 'connected') {\n this.disconnectedRetryCount = 0;\n }\n /* do nothing if we're unable to move from the current state */\n if (this.state.terminal)\n return;\n /* process new state */\n var newState = this.states[indicated.state];\n var retryDelay = newState.retryDelay;\n if (newState.state === 'disconnected') {\n this.disconnectedRetryCount++;\n retryDelay = Utils.getRetryTime(newState.retryDelay, this.disconnectedRetryCount);\n }\n var change = new connectionstatechange_1.default(this.state.state, newState.state, retryDelay, indicated.error || ((_b = (_a = connectionerrors_1.default)[newState.state]) === null || _b === void 0 ? void 0 : _b.call(_a)));\n if (retryImmediately) {\n var autoReconnect = function () {\n if (_this.state === _this.states.disconnected) {\n _this.lastAutoReconnectAttempt = Utils.now();\n _this.requestState({ state: 'connecting' });\n }\n };\n var sinceLast = this.lastAutoReconnectAttempt && Utils.now() - this.lastAutoReconnectAttempt + 1;\n if (sinceLast && sinceLast < 1000) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.notifyState()', 'Last reconnect attempt was only ' +\n sinceLast +\n 'ms ago, waiting another ' +\n (1000 - sinceLast) +\n 'ms before trying again');\n setTimeout(autoReconnect, 1000 - sinceLast);\n }\n else {\n platform_1.default.Config.nextTick(autoReconnect);\n }\n }\n else if (state === 'disconnected' || state === 'suspended') {\n this.startRetryTimer(retryDelay);\n }\n /* If going into disconnect/suspended (and not retrying immediately), or a\n * terminal state, ensure there are no orphaned transports hanging around. */\n if ((state === 'disconnected' && !retryImmediately) || state === 'suspended' || newState.terminal) {\n /* Wait till the next tick so the connection state change is enacted,\n * so aborting transports doesn't trigger redundant state changes */\n platform_1.default.Config.nextTick(function () {\n _this.disconnectAllTransports();\n });\n }\n if (state == 'connected' && !this.activeProtocol) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.notifyState()', 'Broken invariant: attempted to go into connected state, but there is no active protocol');\n }\n /* implement the change and notify */\n this.enactStateChange(change);\n if (this.state.sendEvents) {\n this.sendQueuedMessages();\n }\n else if (!this.state.queueEvents) {\n this.realtime.channels.propogateConnectionInterruption(state, change.reason);\n this.failQueuedMessages(change.reason); // RTN7c\n }\n };\n ConnectionManager.prototype.requestState = function (request) {\n var _this = this;\n var _a, _b;\n var state = request.state;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.requestState()', 'requested state: ' + state + '; current state: ' + this.state.state);\n if (state == this.state.state)\n return; /* silently do nothing */\n /* kill running timers, as this request supersedes them */\n this.cancelTransitionTimer();\n this.cancelRetryTimer();\n /* for suspend timer check rather than cancel -- eg requesting a connecting\n * state should not reset the suspend timer */\n this.checkSuspendTimer(state);\n if (state == 'connecting' && this.state.state == 'connected')\n return;\n if (state == 'closing' && this.state.state == 'closed')\n return;\n var newState = this.states[state], change = new connectionstatechange_1.default(this.state.state, newState.state, null, request.error || ((_b = (_a = connectionerrors_1.default)[newState.state]) === null || _b === void 0 ? void 0 : _b.call(_a)));\n this.enactStateChange(change);\n if (state == 'connecting') {\n platform_1.default.Config.nextTick(function () {\n _this.startConnect();\n });\n }\n if (state == 'closing') {\n this.closeImpl();\n }\n };\n ConnectionManager.prototype.startConnect = function () {\n var _this = this;\n if (this.state !== this.states.connecting) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.startConnect()', 'Must be in connecting state to connect, but was ' + this.state.state);\n return;\n }\n var auth = this.realtime.auth;\n /* The point of the connectCounter mechanism is to ensure that the\n * connection procedure can be cancelled. We want disconnectAllTransports\n * to be able to stop any in-progress connection, even before it gets to\n * the stage of having a pending (or even a proposed) transport that it can\n * dispose() of. So we check that it's still current after any async stage,\n * up until the stage that is synchronous with instantiating a transport */\n var connectCount = ++this.connectCounter;\n var connect = function () {\n _this.checkConnectionStateFreshness();\n _this.getTransportParams(function (transportParams) {\n if (transportParams.mode === 'recover' && transportParams.options.recover) {\n var recoveryContext = decodeRecoveryKey(transportParams.options.recover);\n if (recoveryContext) {\n _this.realtime.channels.recoverChannels(recoveryContext.channelSerials);\n }\n }\n if (connectCount !== _this.connectCounter) {\n return;\n }\n _this.connectImpl(transportParams, connectCount);\n });\n };\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.startConnect()', 'starting connection');\n this.startSuspendTimer();\n this.startTransitionTimer(this.states.connecting);\n if (auth.method === 'basic') {\n connect();\n }\n else {\n var authCb = function (err) {\n if (connectCount !== _this.connectCounter) {\n return;\n }\n if (err) {\n _this.actOnErrorFromAuthorize(err);\n }\n else {\n connect();\n }\n };\n if (this.errorReason && auth_1.default.isTokenErr(this.errorReason)) {\n /* Force a refetch of a new token */\n auth._forceNewToken(null, null, authCb);\n }\n else {\n auth._ensureValidAuthCredentials(false, authCb);\n }\n }\n };\n /**\n * There are three stages in connecting:\n * - preference: if there is a cached transport preference, we try to connect\n * on that. If that fails or times out we abort the attempt, remove the\n * preference and fall back to base. If it succeeds, we try upgrading it if\n * needed (will only be in the case where the preference is xhrs and the\n * browser supports ws).\n * - base: we try to connect with the best transport that we think will\n * never fail for this browser (usually this is xhr_polling; for very old\n * browsers will be jsonp, for node will be comet). If it doesn't work, we\n * try fallback hosts.\n * - upgrade: given a connected transport, we see if there are any better\n * ones, and if so, try to upgrade to them.\n *\n * connectImpl works out what stage you're at (which is purely a function of\n * the current connection state and whether there are any stored preferences),\n * and dispatches accordingly. After a transport has been set pending,\n * tryATransport calls connectImpl to see if there's another stage to be done.\n * */\n ConnectionManager.prototype.connectImpl = function (transportParams, connectCount) {\n var state = this.state.state;\n if (state !== this.states.connecting.state && state !== this.states.connected.state) {\n /* Only keep trying as long as in the 'connecting' state (or 'connected'\n * for upgrading). Any operation can put us into 'disconnected' to cancel\n * connection attempts and wait before retrying, or 'failed' to fail. */\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.connectImpl()', 'Must be in connecting state to connect (or connected to upgrade), but was ' + state);\n }\n else if (this.pendingTransports.length) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.connectImpl()', 'Transports ' + this.pendingTransports[0].toString() + ' currently pending; taking no action');\n }\n else if (state == this.states.connected.state) {\n this.upgradeIfNeeded(transportParams);\n }\n else if (this.transports.length > 1 && this.getTransportPreference()) {\n this.connectPreference(transportParams, connectCount);\n }\n else {\n this.connectBase(transportParams, connectCount);\n }\n };\n ConnectionManager.prototype.connectPreference = function (transportParams, connectCount) {\n var _this = this;\n var preference = this.getTransportPreference();\n var preferenceTimeoutExpired = false;\n if (!Utils.arrIn(this.transports, preference)) {\n this.unpersistTransportPreference();\n this.connectImpl(transportParams, connectCount);\n }\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.connectPreference()', 'Trying to connect with stored transport preference ' + preference);\n var preferenceTimeout = setTimeout(function () {\n preferenceTimeoutExpired = true;\n if (!(_this.state.state === _this.states.connected.state)) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.connectPreference()', 'Shortcircuit connection attempt with ' + preference + ' failed; clearing preference and trying from scratch');\n /* Abort all connection attempts. (This also disconnects the active\n * protocol, but none exists if we're not in the connected state) */\n _this.disconnectAllTransports();\n /* Be quite agressive about clearing the stored preference if ever it doesn't work */\n _this.unpersistTransportPreference();\n }\n _this.connectImpl(transportParams, connectCount);\n }, this.options.timeouts.preferenceConnectTimeout);\n /* For connectPreference, just use the main host. If host fallback is needed, do it in connectBase.\n * The wstransport it will substitute the httphost for an appropriate wshost */\n transportParams.host = this.httpHosts[0];\n this.tryATransport(transportParams, preference, function (fatal, transport) {\n clearTimeout(preferenceTimeout);\n if (preferenceTimeoutExpired && transport) {\n /* Viable, but too late - connectImpl() will already be trying\n * connectBase, and we weren't in upgrade mode. Just remove the\n * onconnected listener and get rid of it */\n transport.off();\n transport.disconnect();\n Utils.arrDeleteValue(_this.pendingTransports, transport);\n }\n else if (!transport && !fatal) {\n /* Preference failed in a transport-specific way. Try more */\n _this.unpersistTransportPreference();\n _this.connectImpl(transportParams, connectCount);\n }\n /* If suceeded, or failed fatally, nothing to do */\n });\n };\n /**\n * Try to establish a transport on the base transport (the best transport\n * such that if it doesn't work, nothing will work) as determined through\n * static feature detection, checking for network connectivity and trying\n * fallback hosts if applicable.\n * @param transportParams\n */\n ConnectionManager.prototype.connectBase = function (transportParams, connectCount) {\n var _this = this;\n var giveUp = function (err) {\n _this.notifyState({ state: _this.states.connecting.failState, error: err });\n };\n var candidateHosts = this.httpHosts.slice();\n var hostAttemptCb = function (fatal, transport) {\n if (connectCount !== _this.connectCounter) {\n return;\n }\n if (!transport && !fatal) {\n tryFallbackHosts();\n }\n };\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.connectBase()', 'Trying to connect with base transport ' + this.baseTransport);\n /* first try to establish a connection with the priority host with http transport */\n var host = candidateHosts.shift();\n if (!host) {\n giveUp(new errorinfo_1.default('Unable to connect (no available host)', 80003, 404));\n return;\n }\n transportParams.host = host;\n /* this is what we'll be doing if the attempt for the main host fails */\n var tryFallbackHosts = function () {\n /* if there aren't any fallback hosts, fail */\n if (!candidateHosts.length) {\n giveUp(new errorinfo_1.default('Unable to connect (and no more fallback hosts to try)', 80003, 404));\n return;\n }\n /* before trying any fallback (or any remaining fallback) we decide if\n * there is a problem with the ably host, or there is a general connectivity\n * problem */\n if (!_this.realtime.http.checkConnectivity) {\n giveUp(new errorinfo_1.PartialErrorInfo('Internal error: Http.checkConnectivity not set', null, 500));\n return;\n }\n _this.realtime.http.checkConnectivity(function (err, connectivity) {\n if (connectCount !== _this.connectCounter) {\n return;\n }\n /* we know err won't happen but handle it here anyway */\n if (err) {\n giveUp(err);\n return;\n }\n if (!connectivity) {\n /* the internet isn't reachable, so don't try the fallback hosts */\n giveUp(new errorinfo_1.default('Unable to connect (network unreachable)', 80003, 404));\n return;\n }\n /* the network is there, so there's a problem with the main host, or\n * its dns. Try the fallback hosts. We could try them simultaneously but\n * that would potentially cause a huge spike in load on the load balancer */\n transportParams.host = Utils.arrPopRandomElement(candidateHosts);\n _this.tryATransport(transportParams, _this.baseTransport, hostAttemptCb);\n });\n };\n if (this.forceFallbackHost && candidateHosts.length) {\n this.forceFallbackHost = false;\n tryFallbackHosts();\n return;\n }\n this.tryATransport(transportParams, this.baseTransport, hostAttemptCb);\n };\n ConnectionManager.prototype.getUpgradePossibilities = function () {\n /* returns the subset of upgradeTransports to the right of the current\n * transport in upgradeTransports (if it's in there - if not, currentSerial\n * will be -1, so return upgradeTransports.slice(0) == upgradeTransports */\n var current = this.activeProtocol.getTransport().shortName;\n var currentSerial = Utils.arrIndexOf(this.upgradeTransports, current);\n return this.upgradeTransports.slice(currentSerial + 1);\n };\n ConnectionManager.prototype.upgradeIfNeeded = function (transportParams) {\n var _this = this;\n var upgradePossibilities = this.getUpgradePossibilities();\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.upgradeIfNeeded()', 'upgrade possibilities: ' + platform_1.default.Config.inspect(upgradePossibilities));\n if (!upgradePossibilities.length) {\n return;\n }\n Utils.arrForEach(upgradePossibilities, function (upgradeTransport) {\n /* Note: the transport may mutate the params, so give each transport a fresh one */\n var upgradeTransportParams = _this.createTransportParams(transportParams.host, 'upgrade');\n _this.tryATransport(upgradeTransportParams, upgradeTransport, noop);\n });\n };\n ConnectionManager.prototype.closeImpl = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.closeImpl()', 'closing connection');\n this.cancelSuspendTimer();\n this.startTransitionTimer(this.states.closing);\n Utils.safeArrForEach(this.pendingTransports, function (transport) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.closeImpl()', 'Closing pending transport: ' + transport);\n if (transport)\n transport.close();\n });\n Utils.safeArrForEach(this.proposedTransports, function (transport) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.closeImpl()', 'Disposing of proposed transport: ' + transport);\n if (transport)\n transport.dispose();\n });\n if (this.activeProtocol) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.closeImpl()', 'Closing active transport: ' + this.activeProtocol.getTransport());\n this.activeProtocol.getTransport().close();\n }\n /* If there was an active transport, this will probably be\n * preempted by the notifyState call in deactivateTransport */\n this.notifyState({ state: 'closed' });\n };\n ConnectionManager.prototype.onAuthUpdated = function (tokenDetails, callback) {\n var _this = this;\n var _a;\n switch (this.state.state) {\n case 'connected': {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.onAuthUpdated()', 'Sending AUTH message on active transport');\n /* If there are any proposed/pending transports (eg an upgrade that\n * isn't yet scheduled for activation) that hasn't yet started syncing,\n * just to get rid of them & restart the upgrade with the new token, to\n * avoid a race condition. (If it has started syncing, the AUTH will be\n * queued until the upgrade is complete, so everything's fine) */\n if ((this.pendingTransports.length || this.proposedTransports.length) &&\n this.state !== this.states.synchronizing) {\n this.disconnectAllTransports(/* exceptActive: */ true);\n var transportParams_1 = this.activeProtocol.getTransport().params;\n platform_1.default.Config.nextTick(function () {\n if (_this.state.state === 'connected') {\n _this.upgradeIfNeeded(transportParams_1);\n }\n });\n }\n /* Do any transport-specific new-token action */\n var activeTransport = (_a = this.activeProtocol) === null || _a === void 0 ? void 0 : _a.getTransport();\n if (activeTransport && activeTransport.onAuthUpdated) {\n activeTransport.onAuthUpdated(tokenDetails);\n }\n var authMsg = protocolmessage_1.default.fromValues({\n action: actions.AUTH,\n auth: {\n accessToken: tokenDetails.token,\n },\n });\n this.send(authMsg);\n /* The answer will come back as either a connectiondetails event\n * (realtime sends a CONNECTED to acknowledge the reauth) or a\n * statechange to failed */\n var successListener_1 = function () {\n _this.off(failureListener_1);\n callback(null, tokenDetails);\n };\n var failureListener_1 = function (stateChange) {\n if (stateChange.current === 'failed') {\n _this.off(successListener_1);\n _this.off(failureListener_1);\n callback(stateChange.reason || _this.getStateError());\n }\n };\n this.once('connectiondetails', successListener_1);\n this.on('connectionstate', failureListener_1);\n break;\n }\n case 'connecting':\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.onAuthUpdated()', 'Aborting current connection attempts in order to start again with the new auth details');\n this.disconnectAllTransports();\n /* fallthrough to add statechange listener */\n default: {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.onAuthUpdated()', 'Connection state is ' + this.state.state + '; waiting until either connected or failed');\n var listener_1 = function (stateChange) {\n switch (stateChange.current) {\n case 'connected':\n _this.off(listener_1);\n callback(null, tokenDetails);\n break;\n case 'failed':\n case 'closed':\n case 'suspended':\n _this.off(listener_1);\n callback(stateChange.reason || _this.getStateError());\n break;\n default:\n /* ignore till we get either connected or failed */\n break;\n }\n };\n this.on('connectionstate', listener_1);\n if (this.state.state === 'connecting') {\n /* can happen if in the connecting state but no transport was pending\n * yet, so disconnectAllTransports did not trigger a disconnected state */\n this.startConnect();\n }\n else {\n this.requestState({ state: 'connecting' });\n }\n }\n }\n };\n ConnectionManager.prototype.disconnectAllTransports = function (exceptActive) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.disconnectAllTransports()', 'Disconnecting all transports' + (exceptActive ? ' except the active transport' : ''));\n /* This will prevent any connection procedure in an async part of one of its early stages from continuing */\n this.connectCounter++;\n Utils.safeArrForEach(this.pendingTransports, function (transport) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.disconnectAllTransports()', 'Disconnecting pending transport: ' + transport);\n if (transport)\n transport.disconnect();\n });\n this.pendingTransports = [];\n Utils.safeArrForEach(this.proposedTransports, function (transport) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.disconnectAllTransports()', 'Disposing of proposed transport: ' + transport);\n if (transport)\n transport.dispose();\n });\n this.proposedTransports = [];\n if (this.activeProtocol && !exceptActive) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.disconnectAllTransports()', 'Disconnecting active transport: ' + this.activeProtocol.getTransport());\n this.activeProtocol.getTransport().disconnect();\n }\n /* No need to notify state disconnected; disconnecting the active transport\n * will have that effect */\n };\n /******************\n * event queueing\n ******************/\n ConnectionManager.prototype.send = function (msg, queueEvent, callback) {\n callback = callback || noop;\n var state = this.state;\n if (state.sendEvents) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.send()', 'sending event');\n this.sendImpl(new protocol_1.PendingMessage(msg, callback));\n return;\n }\n var shouldQueue = (queueEvent && state.queueEvents) || state.forceQueueEvents;\n if (!shouldQueue) {\n var err = 'rejecting event, queueEvent was ' + queueEvent + ', state was ' + state.state;\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.send()', err);\n callback(this.errorReason || new errorinfo_1.default(err, 90000, 400));\n return;\n }\n if (logger_1.default.shouldLog(logger_1.default.LOG_MICRO)) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.send()', 'queueing msg; ' + protocolmessage_1.default.stringify(msg));\n }\n this.queue(msg, callback);\n };\n ConnectionManager.prototype.sendImpl = function (pendingMessage) {\n var msg = pendingMessage.message;\n /* If have already attempted to send this, resend with the same msgSerial,\n * so Ably can dedup if the previous send succeeded */\n if (pendingMessage.ackRequired && !pendingMessage.sendAttempted) {\n msg.msgSerial = this.msgSerial++;\n }\n try {\n this.activeProtocol.send(pendingMessage);\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.sendImpl()', 'Unexpected exception in transport.send(): ' + e.stack);\n }\n };\n ConnectionManager.prototype.queue = function (msg, callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.queue()', 'queueing event');\n var lastQueued = this.queuedMessages.last();\n var maxSize = this.options.maxMessageSize;\n /* If have already attempted to send a message, don't merge more messages\n * into it, as if the previous send actually succeeded and realtime ignores\n * the dup, they'll be lost */\n if (lastQueued && !lastQueued.sendAttempted && bundleWith(lastQueued.message, msg, maxSize)) {\n if (!lastQueued.merged) {\n lastQueued.callback = multicaster_1.default.create([lastQueued.callback]);\n lastQueued.merged = true;\n }\n lastQueued.callback.push(callback);\n }\n else {\n this.queuedMessages.push(new protocol_1.PendingMessage(msg, callback));\n }\n };\n ConnectionManager.prototype.sendQueuedMessages = function () {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.sendQueuedMessages()', 'sending ' + this.queuedMessages.count() + ' queued messages');\n var pendingMessage;\n while ((pendingMessage = this.queuedMessages.shift()))\n this.sendImpl(pendingMessage);\n };\n ConnectionManager.prototype.queuePendingMessages = function (pendingMessages) {\n if (pendingMessages && pendingMessages.length) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.queuePendingMessages()', 'queueing ' + pendingMessages.length + ' pending messages');\n this.queuedMessages.prepend(pendingMessages);\n }\n };\n ConnectionManager.prototype.failQueuedMessages = function (err) {\n var numQueued = this.queuedMessages.count();\n if (numQueued > 0) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.failQueuedMessages()', 'failing ' + numQueued + ' queued messages, err = ' + Utils.inspectError(err));\n this.queuedMessages.completeAllMessages(err);\n }\n };\n ConnectionManager.prototype.onChannelMessage = function (message, transport) {\n var onActiveTransport = this.activeProtocol && transport === this.activeProtocol.getTransport(), onUpgradeTransport = Utils.arrIn(this.pendingTransports, transport) && this.state == this.states.synchronizing;\n /* As the lib now has a period where the upgrade transport is synced but\n * before it's become active (while waiting for the old one to become\n * idle), message can validly arrive on it even though it isn't active */\n if (onActiveTransport || onUpgradeTransport) {\n this.realtime.channels.onChannelMessage(message);\n }\n else {\n // Message came in on a defunct transport. Allow only acks, nacks, & errors for outstanding\n // messages, no new messages (as sync has been sent on new transport so new messages will\n // be resent there, or connection has been closed so don't want new messages)\n if (Utils.arrIndexOf([actions.ACK, actions.NACK, actions.ERROR], message.action) > -1) {\n this.realtime.channels.onChannelMessage(message);\n }\n else {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'ConnectionManager.onChannelMessage()', 'received message ' + JSON.stringify(message) + 'on defunct transport; discarding');\n }\n }\n };\n ConnectionManager.prototype.ping = function (transport, callback) {\n var _this = this;\n /* if transport is specified, try that */\n if (transport) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.ping()', 'transport = ' + transport);\n var onTimeout = function () {\n transport.off('heartbeat', onHeartbeat_1);\n callback(new errorinfo_1.default('Timeout waiting for heartbeat response', 50000, 500));\n };\n var pingStart_1 = Utils.now(), id_1 = Utils.cheapRandStr();\n var onHeartbeat_1 = function (responseId) {\n if (responseId === id_1) {\n transport.off('heartbeat', onHeartbeat_1);\n clearTimeout(timer_1);\n var responseTime = Utils.now() - pingStart_1;\n callback(null, responseTime);\n }\n };\n var timer_1 = setTimeout(onTimeout, this.options.timeouts.realtimeRequestTimeout);\n transport.on('heartbeat', onHeartbeat_1);\n transport.ping(id_1);\n return;\n }\n /* if we're not connected, don't attempt */\n if (this.state.state !== 'connected') {\n callback(new errorinfo_1.default('Unable to ping service; not connected', 40000, 400));\n return;\n }\n /* no transport was specified, so use the current (connected) one\n * but ensure that we retry if the transport is superseded before we complete */\n var completed = false;\n var onPingComplete = function (err, responseTime) {\n _this.off('transport.active', onTransportActive);\n if (!completed) {\n completed = true;\n callback(err, responseTime);\n }\n };\n var onTransportActive = function () {\n if (!completed) {\n /* ensure that no callback happens for the currently outstanding operation */\n completed = true;\n /* repeat but picking up the new transport */\n platform_1.default.Config.nextTick(function () {\n _this.ping(null, callback);\n });\n }\n };\n this.on('transport.active', onTransportActive);\n this.ping(this.activeProtocol.getTransport(), onPingComplete);\n };\n ConnectionManager.prototype.abort = function (error) {\n this.activeProtocol.getTransport().fail(error);\n };\n ConnectionManager.prototype.registerProposedTransport = function (transport) {\n this.proposedTransports.push(transport);\n };\n ConnectionManager.prototype.getTransportPreference = function () {\n var _a, _b;\n return this.transportPreference || (haveWebStorage() && ((_b = (_a = platform_1.default.WebStorage) === null || _a === void 0 ? void 0 : _a.get) === null || _b === void 0 ? void 0 : _b.call(_a, transportPreferenceName)));\n };\n ConnectionManager.prototype.persistTransportPreference = function (transport) {\n var _a, _b;\n if (Utils.arrIn(defaults_1.default.upgradeTransports, transport.shortName)) {\n this.transportPreference = transport.shortName;\n if (haveWebStorage()) {\n (_b = (_a = platform_1.default.WebStorage) === null || _a === void 0 ? void 0 : _a.set) === null || _b === void 0 ? void 0 : _b.call(_a, transportPreferenceName, transport.shortName);\n }\n }\n };\n ConnectionManager.prototype.unpersistTransportPreference = function () {\n var _a, _b;\n this.transportPreference = null;\n if (haveWebStorage()) {\n (_b = (_a = platform_1.default.WebStorage) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a, transportPreferenceName);\n }\n };\n /* This method is only used during connection attempts, so implements RSA4c1, RSA4c2,\n * and RSA4d. It is generally not invoked for serverside-triggered reauths or manual\n * reauths, so RSA4c3 does not apply, except (per per RSA4d1) in the case that the auth\n * server returns 403. */\n ConnectionManager.prototype.actOnErrorFromAuthorize = function (err) {\n if (err.code === 40171) {\n /* No way to reauth */\n this.notifyState({ state: 'failed', error: err });\n }\n else if (err.code === 40102) {\n this.notifyState({ state: 'failed', error: err });\n }\n else if (err.statusCode === HttpStatusCodes_1.default.Forbidden) {\n var msg = 'Client configured authentication provider returned 403; failing the connection';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.actOnErrorFromAuthorize()', msg);\n this.notifyState({ state: 'failed', error: new errorinfo_1.default(msg, 80019, 403, err) });\n }\n else {\n var msg = 'Client configured authentication provider request failed';\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'ConnectionManager.actOnErrorFromAuthorize', msg);\n this.notifyState({ state: this.state.failState, error: new errorinfo_1.default(msg, 80019, 401, err) });\n }\n };\n ConnectionManager.prototype.onConnectionDetailsUpdate = function (connectionDetails, transport) {\n if (!connectionDetails) {\n return;\n }\n this.connectionDetails = connectionDetails;\n if (connectionDetails.maxMessageSize) {\n this.options.maxMessageSize = connectionDetails.maxMessageSize;\n }\n var clientId = connectionDetails.clientId;\n if (clientId) {\n var err = this.realtime.auth._uncheckedSetClientId(clientId);\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'ConnectionManager.onConnectionDetailsUpdate()', err.message);\n /* Errors setting the clientId are fatal to the connection */\n transport.fail(err);\n return;\n }\n }\n var connectionStateTtl = connectionDetails.connectionStateTtl;\n if (connectionStateTtl) {\n this.connectionStateTtl = connectionStateTtl;\n }\n this.maxIdleInterval = connectionDetails.maxIdleInterval;\n this.emit('connectiondetails', connectionDetails);\n };\n /*********************\n * transport management\n *********************/\n ConnectionManager.supportedTransports = {};\n return ConnectionManager;\n}(eventemitter_1.default));\nexports.default = ConnectionManager;\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13)))\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar MessageQueue = /** @class */ (function (_super) {\n tslib_1.__extends(MessageQueue, _super);\n function MessageQueue() {\n var _this = _super.call(this) || this;\n _this.messages = [];\n return _this;\n }\n MessageQueue.prototype.count = function () {\n return this.messages.length;\n };\n MessageQueue.prototype.push = function (message) {\n this.messages.push(message);\n };\n MessageQueue.prototype.shift = function () {\n return this.messages.shift();\n };\n MessageQueue.prototype.last = function () {\n return this.messages[this.messages.length - 1];\n };\n MessageQueue.prototype.copyAll = function () {\n return this.messages.slice();\n };\n MessageQueue.prototype.append = function (messages) {\n this.messages.push.apply(this.messages, messages);\n };\n MessageQueue.prototype.prepend = function (messages) {\n this.messages.unshift.apply(this.messages, messages);\n };\n MessageQueue.prototype.completeMessages = function (serial, count, err) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'MessageQueue.completeMessages()', 'serial = ' + serial + '; count = ' + count);\n err = err || null;\n var messages = this.messages;\n if (messages.length === 0) {\n throw new Error('MessageQueue.completeMessages(): completeMessages called on any empty MessageQueue');\n }\n var first = messages[0];\n if (first) {\n var startSerial = first.message.msgSerial;\n var endSerial = serial + count; /* the serial of the first message that is *not* the subject of this call */\n if (endSerial > startSerial) {\n var completeMessages = messages.splice(0, endSerial - startSerial);\n for (var _i = 0, completeMessages_1 = completeMessages; _i < completeMessages_1.length; _i++) {\n var message = completeMessages_1[_i];\n message.callback(err);\n }\n }\n if (messages.length == 0)\n this.emit('idle');\n }\n };\n MessageQueue.prototype.completeAllMessages = function (err) {\n this.completeMessages(0, Number.MAX_SAFE_INTEGER || Number.MAX_VALUE, err);\n };\n MessageQueue.prototype.resetSendAttempted = function () {\n for (var _i = 0, _a = this.messages; _i < _a.length; _i++) {\n var msg = _a[_i];\n msg.sendAttempted = false;\n }\n };\n MessageQueue.prototype.clear = function () {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'MessageQueue.clear()', 'clearing ' + this.messages.length + ' messages');\n this.messages = [];\n this.emit('idle');\n };\n return MessageQueue;\n}(eventemitter_1.default));\nexports.default = MessageQueue;\n\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ConnectionStateChange = /** @class */ (function () {\n function ConnectionStateChange(previous, current, retryIn, reason) {\n this.previous = previous;\n this.current = current;\n if (retryIn)\n this.retryIn = retryIn;\n if (reason)\n this.reason = reason;\n }\n return ConnectionStateChange;\n}());\nexports.default = ConnectionStateChange;\n\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar protocolmessage_1 = tslib_1.__importDefault(__webpack_require__(10));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar channel_1 = tslib_1.__importDefault(__webpack_require__(33));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar realtimepresence_1 = tslib_1.__importDefault(__webpack_require__(54));\nvar message_1 = tslib_1.__importDefault(__webpack_require__(9));\nvar channelstatechange_1 = tslib_1.__importDefault(__webpack_require__(39));\nvar errorinfo_1 = tslib_1.__importStar(__webpack_require__(4));\nvar presencemessage_1 = tslib_1.__importDefault(__webpack_require__(15));\nvar connectionerrors_1 = tslib_1.__importDefault(__webpack_require__(20));\nvar actions = protocolmessage_1.default.Action;\nvar noop = function () { };\nfunction validateChannelOptions(options) {\n if (options && 'params' in options && !Utils.isObject(options.params)) {\n return new errorinfo_1.default('options.params must be an object', 40000, 400);\n }\n if (options && 'modes' in options) {\n if (!Utils.isArray(options.modes)) {\n return new errorinfo_1.default('options.modes must be an array', 40000, 400);\n }\n for (var i = 0; i < options.modes.length; i++) {\n var currentMode = options.modes[i];\n if (!currentMode ||\n typeof currentMode !== 'string' ||\n !Utils.arrIn(protocolmessage_1.default.channelModes, String.prototype.toUpperCase.call(currentMode))) {\n return new errorinfo_1.default('Invalid channel mode: ' + currentMode, 40000, 400);\n }\n }\n }\n}\nvar RealtimeChannel = /** @class */ (function (_super) {\n tslib_1.__extends(RealtimeChannel, _super);\n function RealtimeChannel(realtime, name, options) {\n var _this = _super.call(this, realtime, name, options) || this;\n _this.retryCount = 0;\n _this.history = function (params, callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimeChannel.history()', 'channel = ' + this.name);\n /* params and callback are optional; see if params contains the callback */\n if (callback === undefined) {\n if (typeof params == 'function') {\n callback = params;\n params = null;\n }\n else {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'history', arguments);\n }\n callback = noop;\n }\n }\n if (params && params.untilAttach) {\n if (this.state !== 'attached') {\n callback(new errorinfo_1.default('option untilAttach requires the channel to be attached', 40000, 400));\n return;\n }\n if (!this.properties.attachSerial) {\n callback(new errorinfo_1.default('untilAttach was specified and channel is attached, but attachSerial is not defined', 40000, 400));\n return;\n }\n delete params.untilAttach;\n params.from_serial = this.properties.attachSerial;\n }\n channel_1.default.prototype._history.call(this, params, callback);\n };\n _this.whenState = (function (state, listener) {\n return eventemitter_1.default.prototype.whenState.call(_this, state, _this.state, listener);\n });\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimeChannel()', 'started; name = ' + name);\n _this.realtime = realtime;\n _this.presence = new realtimepresence_1.default(_this);\n _this.connectionManager = realtime.connection.connectionManager;\n _this.state = 'initialized';\n _this.subscriptions = new eventemitter_1.default();\n _this.syncChannelSerial = undefined;\n _this.properties = {\n attachSerial: undefined,\n channelSerial: undefined,\n };\n _this.setOptions(options);\n _this.errorReason = null;\n _this._requestedFlags = null;\n _this._mode = null;\n _this._attachResume = false;\n _this._decodingContext = {\n channelOptions: _this.channelOptions,\n plugins: realtime.options.plugins || {},\n baseEncodedPreviousPayload: undefined,\n };\n _this._lastPayload = {\n messageId: null,\n protocolMessageChannelSerial: null,\n decodeFailureRecoveryInProgress: null,\n };\n /* Only differences between this and the public event emitter is that this emits an\n * update event for all ATTACHEDs, whether resumed or not */\n _this._allChannelChanges = new eventemitter_1.default();\n return _this;\n }\n RealtimeChannel.prototype.invalidStateError = function () {\n return new errorinfo_1.default('Channel operation failed as channel state is ' + this.state, 90001, 400, this.errorReason || undefined);\n };\n RealtimeChannel.processListenerArgs = function (args) {\n /* [event], listener, [callback] */\n args = Array.prototype.slice.call(args);\n if (typeof args[0] === 'function') {\n args.unshift(null);\n }\n if (args[args.length - 1] == undefined) {\n args.pop();\n }\n return args;\n };\n RealtimeChannel.prototype.setOptions = function (options, callback) {\n if (!callback) {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'setOptions', arguments);\n }\n }\n var _callback = callback ||\n function (err) {\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'RealtimeChannel.setOptions()', 'Set options failed: ' + err.toString());\n }\n };\n var err = validateChannelOptions(options);\n if (err) {\n _callback(err);\n return;\n }\n channel_1.default.prototype.setOptions.call(this, options);\n if (this._decodingContext)\n this._decodingContext.channelOptions = this.channelOptions;\n if (this._shouldReattachToSetOptions(options)) {\n /* This does not just do _attach(true, null, callback) because that would put us\n * into the 'attaching' state until we receive the new attached, which is\n * conceptually incorrect: we are still attached, we just have a pending request to\n * change some channel params. Per RTL17 going into the attaching state would mean\n * rejecting messages until we have confirmation that the options have changed,\n * which would unnecessarily lose message continuity. */\n this.attachImpl();\n // Ignore 'attaching' -- could be just due to to a resume & reattach, should not\n // call back setOptions until we're definitely attached with the new options (or\n // else in a terminal state)\n this._allChannelChanges.once(['attached', 'update', 'detached', 'failed'], function (stateChange) {\n switch (this.event) {\n case 'update':\n case 'attached':\n _callback === null || _callback === void 0 ? void 0 : _callback(null);\n return;\n default:\n _callback === null || _callback === void 0 ? void 0 : _callback(stateChange.reason);\n return;\n }\n });\n }\n else {\n _callback();\n }\n };\n RealtimeChannel.prototype._shouldReattachToSetOptions = function (options) {\n return (this.state === 'attached' || this.state === 'attaching') && ((options === null || options === void 0 ? void 0 : options.params) || (options === null || options === void 0 ? void 0 : options.modes));\n };\n RealtimeChannel.prototype.publish = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var messages = args[0];\n var argCount = args.length;\n var callback = args[argCount - 1];\n if (typeof callback !== 'function') {\n if (this.realtime.options.promises) {\n return Utils.promisify(this, 'publish', arguments);\n }\n callback = noop;\n ++argCount;\n }\n if (!this.connectionManager.activeState()) {\n callback(this.connectionManager.getError());\n return;\n }\n if (argCount == 2) {\n if (Utils.isObject(messages))\n messages = [message_1.default.fromValues(messages)];\n else if (Utils.isArray(messages))\n messages = message_1.default.fromValuesArray(messages);\n else\n throw new errorinfo_1.default('The single-argument form of publish() expects a message object or an array of message objects', 40013, 400);\n }\n else {\n messages = [message_1.default.fromValues({ name: args[0], data: args[1] })];\n }\n var maxMessageSize = this.realtime.options.maxMessageSize;\n message_1.default.encodeArray(messages, this.channelOptions, function (err) {\n if (err) {\n callback(err);\n return;\n }\n /* RSL1i */\n var size = message_1.default.getMessagesSize(messages);\n if (size > maxMessageSize) {\n callback(new errorinfo_1.default('Maximum size of messages that can be published at once exceeded ( was ' +\n size +\n ' bytes; limit is ' +\n maxMessageSize +\n ' bytes)', 40009, 400));\n return;\n }\n _this.__publish(messages, callback);\n });\n };\n // Double underscore used to prevent type conflict with underlying Channel._publish method\n RealtimeChannel.prototype.__publish = function (messages, callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimeChannel.publish()', 'message count = ' + messages.length);\n var state = this.state;\n switch (state) {\n case 'failed':\n case 'suspended':\n callback(errorinfo_1.default.fromValues(this.invalidStateError()));\n break;\n default: {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimeChannel.publish()', 'sending message; channel state is ' + state);\n var msg = new protocolmessage_1.default();\n msg.action = actions.MESSAGE;\n msg.channel = this.name;\n msg.messages = messages;\n this.sendMessage(msg, callback);\n break;\n }\n }\n };\n RealtimeChannel.prototype.onEvent = function (messages) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimeChannel.onEvent()', 'received message');\n var subscriptions = this.subscriptions;\n for (var i = 0; i < messages.length; i++) {\n var message = messages[i];\n subscriptions.emit(message.name, message);\n }\n };\n RealtimeChannel.prototype.attach = function (flags, callback) {\n var _flags;\n if (typeof flags === 'function') {\n callback = flags;\n _flags = null;\n }\n else {\n _flags = flags;\n }\n if (!callback) {\n if (this.realtime.options.promises) {\n return Utils.promisify(this, 'attach', arguments);\n }\n callback = function (err) {\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_MAJOR, 'RealtimeChannel.attach()', 'Channel attach failed: ' + err.toString());\n }\n };\n }\n if (_flags) {\n logger_1.default.deprecated('channel.attach() with flags', 'channel.setOptions() with channelOptions.params');\n /* If flags requested, always do a re-attach. TODO only do this if\n * current mode differs from requested mode */\n this._requestedFlags = _flags;\n }\n else if (this.state === 'attached') {\n callback(null, null);\n return;\n }\n this._attach(false, null, callback);\n };\n RealtimeChannel.prototype._attach = function (forceReattach, attachReason, callback) {\n if (!callback) {\n callback = function (err) {\n if (err) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'RealtimeChannel._attach()', 'Channel attach failed: ' + err.toString());\n }\n };\n }\n var connectionManager = this.connectionManager;\n if (!connectionManager.activeState()) {\n callback(connectionManager.getError());\n return;\n }\n if (this.state !== 'attaching' || forceReattach) {\n this.requestState('attaching', attachReason);\n }\n this.once(function (stateChange) {\n switch (this.event) {\n case 'attached':\n callback === null || callback === void 0 ? void 0 : callback(null, stateChange);\n break;\n case 'detached':\n case 'suspended':\n case 'failed':\n callback === null || callback === void 0 ? void 0 : callback(stateChange.reason ||\n connectionManager.getError() ||\n new errorinfo_1.default('Unable to attach; reason unknown; state = ' + this.event, 90000, 500));\n break;\n case 'detaching':\n callback === null || callback === void 0 ? void 0 : callback(new errorinfo_1.default('Attach request superseded by a subsequent detach request', 90000, 409));\n break;\n }\n });\n };\n RealtimeChannel.prototype.attachImpl = function () {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimeChannel.attachImpl()', 'sending ATTACH message');\n var attachMsg = protocolmessage_1.default.fromValues({\n action: actions.ATTACH,\n channel: this.name,\n params: this.channelOptions.params,\n // RTL4c1: Includes the channel serial to resume from a previous message\n // or attachment.\n channelSerial: this.properties.channelSerial,\n });\n if (this._requestedFlags) {\n attachMsg.encodeModesToFlags(this._requestedFlags);\n }\n else if (this.channelOptions.modes) {\n attachMsg.encodeModesToFlags(Utils.allToUpperCase(this.channelOptions.modes));\n }\n if (this._attachResume) {\n attachMsg.setFlag('ATTACH_RESUME');\n }\n if (this._lastPayload.decodeFailureRecoveryInProgress) {\n attachMsg.channelSerial = this._lastPayload.protocolMessageChannelSerial;\n }\n this.sendMessage(attachMsg, noop);\n };\n RealtimeChannel.prototype.detach = function (callback) {\n if (!callback) {\n if (this.realtime.options.promises) {\n return Utils.promisify(this, 'detach', arguments);\n }\n callback = noop;\n }\n var connectionManager = this.connectionManager;\n if (!connectionManager.activeState()) {\n callback(connectionManager.getError());\n return;\n }\n switch (this.state) {\n case 'suspended':\n this.notifyState('detached');\n callback();\n break;\n case 'detached':\n callback();\n break;\n case 'failed':\n callback(new errorinfo_1.default('Unable to detach; channel state = failed', 90001, 400));\n break;\n default:\n this.requestState('detaching');\n // eslint-disable-next-line no-fallthrough\n case 'detaching':\n this.once(function (stateChange) {\n switch (this.event) {\n case 'detached':\n callback();\n break;\n case 'attached':\n case 'suspended':\n case 'failed':\n callback(stateChange.reason ||\n connectionManager.getError() ||\n new errorinfo_1.default('Unable to detach; reason unknown; state = ' + this.event, 90000, 500));\n break;\n case 'attaching':\n callback(new errorinfo_1.default('Detach request superseded by a subsequent attach request', 90000, 409));\n break;\n }\n });\n }\n };\n RealtimeChannel.prototype.detachImpl = function (callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimeChannel.detach()', 'sending DETACH message');\n var msg = protocolmessage_1.default.fromValues({ action: actions.DETACH, channel: this.name });\n this.sendMessage(msg, callback || noop);\n };\n RealtimeChannel.prototype.subscribe = function () {\n var args = []; /* [event], listener, [callback] */\n for (var _i = 0 /* [event], listener, [callback] */; _i < arguments.length /* [event], listener, [callback] */; _i++ /* [event], listener, [callback] */) {\n args[_i] = arguments[_i]; /* [event], listener, [callback] */\n }\n var _a = RealtimeChannel.processListenerArgs(args), event = _a[0], listener = _a[1], callback = _a[2];\n if (!callback && this.realtime.options.promises) {\n return Utils.promisify(this, 'subscribe', [event, listener]);\n }\n if (this.state === 'failed') {\n callback === null || callback === void 0 ? void 0 : callback(errorinfo_1.default.fromValues(this.invalidStateError()));\n return;\n }\n // Filtered\n if (event && typeof event === 'object' && !Array.isArray(event)) {\n this._subscribeFilter(event, listener);\n }\n else {\n this.subscriptions.on(event, listener);\n }\n return this.attach(callback || noop);\n };\n RealtimeChannel.prototype._subscribeFilter = function (filter, listener) {\n var filteredListener = function (m) {\n var _a, _b, _c, _d, _e, _f;\n var mapping = {\n name: m.name,\n refTimeserial: (_b = (_a = m.extras) === null || _a === void 0 ? void 0 : _a.ref) === null || _b === void 0 ? void 0 : _b.timeserial,\n refType: (_d = (_c = m.extras) === null || _c === void 0 ? void 0 : _c.ref) === null || _d === void 0 ? void 0 : _d.type,\n isRef: !!((_f = (_e = m.extras) === null || _e === void 0 ? void 0 : _e.ref) === null || _f === void 0 ? void 0 : _f.timeserial),\n clientId: m.clientId,\n };\n // Check if any values are defined in the filter and if they match the value in the message object\n if (Object.entries(filter).find(function (_a) {\n var key = _a[0], value = _a[1];\n return value !== undefined ? mapping[key] !== value : false;\n })) {\n return;\n }\n listener(m);\n };\n this._addFilteredSubscription(filter, listener, filteredListener);\n this.subscriptions.on(filteredListener);\n };\n // Adds a new filtered subscription\n RealtimeChannel.prototype._addFilteredSubscription = function (filter, realListener, filteredListener) {\n var _a;\n if (!this.filteredSubscriptions) {\n this.filteredSubscriptions = new Map();\n }\n if (this.filteredSubscriptions.has(realListener)) {\n var realListenerMap = this.filteredSubscriptions.get(realListener);\n // Add the filtered listener to the map, or append to the array if this filter has already been used\n realListenerMap.set(filter, ((_a = realListenerMap === null || realListenerMap === void 0 ? void 0 : realListenerMap.get(filter)) === null || _a === void 0 ? void 0 : _a.concat(filteredListener)) || [filteredListener]);\n }\n else {\n this.filteredSubscriptions.set(realListener, new Map([[filter, [filteredListener]]]));\n }\n };\n RealtimeChannel.prototype._getAndDeleteFilteredSubscriptions = function (filter, realListener) {\n var _this = this;\n // No filtered subscriptions map means there has been no filtered subscriptions yet, so return nothing\n if (!this.filteredSubscriptions) {\n return [];\n }\n // Only a filter is passed in with no specific listener\n if (!realListener && filter) {\n // Return each listener which is attached to the specified filter object\n return Array.from(this.filteredSubscriptions.entries())\n .map(function (_a) {\n var _b;\n var key = _a[0], filterMaps = _a[1];\n // Get (then delete) the maps matching this filter\n var listenerMaps = filterMaps.get(filter);\n filterMaps.delete(filter);\n // Clear the parent if nothing is left\n if (filterMaps.size === 0) {\n (_b = _this.filteredSubscriptions) === null || _b === void 0 ? void 0 : _b.delete(key);\n }\n return listenerMaps;\n })\n .reduce(function (prev, cur) {\n var _a;\n return (cur ? (_a = prev).concat.apply(_a, cur) : prev);\n }, []);\n }\n // No subscriptions for this listener\n if (!realListener || !this.filteredSubscriptions.has(realListener)) {\n return [];\n }\n var realListenerMap = this.filteredSubscriptions.get(realListener);\n // If no filter is specified return all listeners using that function\n if (!filter) {\n // array.flat is not available unless we support es2019 or higher\n var listeners_1 = Array.from(realListenerMap.values()).reduce(function (prev, cur) { return prev.concat.apply(prev, cur); }, []);\n // remove the listener from the map\n this.filteredSubscriptions.delete(realListener);\n return listeners_1;\n }\n var listeners = realListenerMap.get(filter);\n realListenerMap.delete(filter);\n return listeners || [];\n };\n RealtimeChannel.prototype.unsubscribe = function () {\n var _this = this;\n var _a;\n var args = []; /* [event], listener */\n for (var _i = 0 /* [event], listener */; _i < arguments.length /* [event], listener */; _i++ /* [event], listener */) {\n args[_i] = arguments[_i]; /* [event], listener */\n }\n var _b = RealtimeChannel.processListenerArgs(args), event = _b[0], listener = _b[1];\n // If we either have a filtered listener, a filter or both we need to do additional processing to find the original function(s)\n if ((typeof event === 'object' && !listener) || ((_a = this.filteredSubscriptions) === null || _a === void 0 ? void 0 : _a.has(listener))) {\n this._getAndDeleteFilteredSubscriptions(event, listener).forEach(function (l) { return _this.subscriptions.off(l); });\n return;\n }\n this.subscriptions.off(event, listener);\n };\n RealtimeChannel.prototype.sync = function () {\n /* check preconditions */\n switch (this.state) {\n case 'initialized':\n case 'detaching':\n case 'detached':\n throw new errorinfo_1.PartialErrorInfo('Unable to sync to channel; not attached', 40000);\n default:\n }\n var connectionManager = this.connectionManager;\n if (!connectionManager.activeState()) {\n throw connectionManager.getError();\n }\n /* send sync request */\n var syncMessage = protocolmessage_1.default.fromValues({ action: actions.SYNC, channel: this.name });\n if (this.syncChannelSerial) {\n syncMessage.channelSerial = this.syncChannelSerial;\n }\n connectionManager.send(syncMessage);\n };\n RealtimeChannel.prototype.sendMessage = function (msg, callback) {\n this.connectionManager.send(msg, this.realtime.options.queueMessages, callback);\n };\n RealtimeChannel.prototype.sendPresence = function (presence, callback) {\n var msg = protocolmessage_1.default.fromValues({\n action: actions.PRESENCE,\n channel: this.name,\n presence: Utils.isArray(presence)\n ? presencemessage_1.default.fromValuesArray(presence)\n : [presencemessage_1.default.fromValues(presence)],\n });\n this.sendMessage(msg, callback);\n };\n RealtimeChannel.prototype.onMessage = function (message) {\n if (message.action === actions.ATTACHED ||\n message.action === actions.MESSAGE ||\n message.action === actions.PRESENCE) {\n // RTL15b\n this.setChannelSerial(message.channelSerial);\n }\n var syncChannelSerial, isSync = false;\n switch (message.action) {\n case actions.ATTACHED: {\n this.properties.attachSerial = message.channelSerial;\n this._mode = message.getMode();\n this.params = message.params || {};\n var modesFromFlags = message.decodeModesFromFlags();\n this.modes = (modesFromFlags && Utils.allToLowerCase(modesFromFlags)) || undefined;\n var resumed = message.hasFlag('RESUMED');\n var hasPresence = message.hasFlag('HAS_PRESENCE');\n var hasBacklog = message.hasFlag('HAS_BACKLOG');\n if (this.state === 'attached') {\n if (!resumed) {\n /* On a loss of continuity, the presence set needs to be re-synced */\n this.presence.onAttached(hasPresence);\n }\n var change = new channelstatechange_1.default(this.state, this.state, resumed, hasBacklog, message.error);\n this._allChannelChanges.emit('update', change);\n if (!resumed || this.channelOptions.updateOnAttached) {\n this.emit('update', change);\n }\n }\n else if (this.state === 'detaching') {\n /* RTL5i: re-send DETACH and remain in the 'detaching' state */\n this.checkPendingState();\n }\n else {\n this.notifyState('attached', message.error, resumed, hasPresence, hasBacklog);\n }\n break;\n }\n case actions.DETACHED: {\n var detachErr = message.error\n ? errorinfo_1.default.fromValues(message.error)\n : new errorinfo_1.default('Channel detached', 90001, 404);\n if (this.state === 'detaching') {\n this.notifyState('detached', detachErr);\n }\n else if (this.state === 'attaching') {\n /* Only retry immediately if we were previously attached. If we were\n * attaching, go into suspended, fail messages, and wait a few seconds\n * before retrying */\n this.notifyState('suspended', detachErr);\n }\n else {\n this.requestState('attaching', detachErr);\n }\n break;\n }\n case actions.SYNC:\n /* syncs can have channelSerials, but might not if the sync is one page long */\n isSync = true;\n syncChannelSerial = this.syncChannelSerial = message.channelSerial;\n /* syncs can happen on channels with no presence data as part of connection\n * resuming, in which case protocol message has no presence property */\n if (!message.presence)\n break;\n // eslint-disable-next-line no-fallthrough\n case actions.PRESENCE: {\n var presence = message.presence;\n var id = message.id, connectionId = message.connectionId, timestamp = message.timestamp;\n var options = this.channelOptions;\n var presenceMsg = void 0;\n for (var i = 0; i < presence.length; i++) {\n try {\n presenceMsg = presence[i];\n presencemessage_1.default.decode(presenceMsg, options);\n if (!presenceMsg.connectionId)\n presenceMsg.connectionId = connectionId;\n if (!presenceMsg.timestamp)\n presenceMsg.timestamp = timestamp;\n if (!presenceMsg.id)\n presenceMsg.id = id + ':' + i;\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'RealtimeChannel.onMessage()', e.toString());\n }\n }\n this.presence.setPresence(presence, isSync, syncChannelSerial);\n break;\n }\n case actions.MESSAGE: {\n //RTL17\n if (this.state !== 'attached') {\n logger_1.default.logAction(logger_1.default.LOG_MAJOR, 'RealtimeChannel.onMessage()', 'Message \"' +\n message.id +\n '\" skipped as this channel \"' +\n this.name +\n '\" state is not \"attached\" (state is \"' +\n this.state +\n '\").');\n return;\n }\n var messages = message.messages, firstMessage = messages[0], lastMessage = messages[messages.length - 1], id = message.id, connectionId = message.connectionId, timestamp = message.timestamp;\n if (firstMessage.extras &&\n firstMessage.extras.delta &&\n firstMessage.extras.delta.from !== this._lastPayload.messageId) {\n var msg = 'Delta message decode failure - previous message not available for message \"' +\n message.id +\n '\" on this channel \"' +\n this.name +\n '\".';\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'RealtimeChannel.onMessage()', msg);\n this._startDecodeFailureRecovery(new errorinfo_1.default(msg, 40018, 400));\n break;\n }\n for (var i = 0; i < messages.length; i++) {\n var msg = messages[i];\n try {\n message_1.default.decode(msg, this._decodingContext);\n }\n catch (e) {\n /* decrypt failed .. the most likely cause is that we have the wrong key */\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'RealtimeChannel.onMessage()', e.toString());\n switch (e.code) {\n case 40018:\n /* decode failure */\n this._startDecodeFailureRecovery(e);\n return;\n case 40019:\n /* No vcdiff plugin passed in - no point recovering, give up */\n // eslint-disable-next-line no-fallthrough\n case 40021:\n /* Browser does not support deltas, similarly no point recovering */\n this.notifyState('failed', e);\n return;\n }\n }\n if (!msg.connectionId)\n msg.connectionId = connectionId;\n if (!msg.timestamp)\n msg.timestamp = timestamp;\n if (!msg.id)\n msg.id = id + ':' + i;\n }\n this._lastPayload.messageId = lastMessage.id;\n this._lastPayload.protocolMessageChannelSerial = message.channelSerial;\n this.onEvent(messages);\n break;\n }\n case actions.ERROR: {\n /* there was a channel-specific error */\n var err = message.error;\n if (err && err.code == 80016) {\n /* attach/detach operation attempted on superseded transport handle */\n this.checkPendingState();\n }\n else {\n this.notifyState('failed', errorinfo_1.default.fromValues(err));\n }\n break;\n }\n default:\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'RealtimeChannel.onMessage()', 'Fatal protocol error: unrecognised action (' + message.action + ')');\n this.connectionManager.abort(connectionerrors_1.default.unknownChannelErr());\n }\n };\n RealtimeChannel.prototype._startDecodeFailureRecovery = function (reason) {\n var _this = this;\n if (!this._lastPayload.decodeFailureRecoveryInProgress) {\n logger_1.default.logAction(logger_1.default.LOG_MAJOR, 'RealtimeChannel.onMessage()', 'Starting decode failure recovery process.');\n this._lastPayload.decodeFailureRecoveryInProgress = true;\n this._attach(true, reason, function () {\n _this._lastPayload.decodeFailureRecoveryInProgress = false;\n });\n }\n };\n RealtimeChannel.prototype.onAttached = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimeChannel.onAttached', 'activating channel; name = ' + this.name);\n };\n RealtimeChannel.prototype.notifyState = function (state, reason, resumed, hasPresence, hasBacklog) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimeChannel.notifyState', 'name = ' + this.name + ', current state = ' + this.state + ', notifying state ' + state);\n this.clearStateTimer();\n // RTP5a1\n if (Utils.arrIn(['detached', 'suspended', 'failed'], state)) {\n this.properties.channelSerial = null;\n }\n if (state === this.state) {\n return;\n }\n this.presence.actOnChannelState(state, hasPresence, reason);\n if (state === 'suspended' && this.connectionManager.state.sendEvents) {\n this.startRetryTimer();\n }\n else {\n this.cancelRetryTimer();\n }\n if (reason) {\n this.errorReason = reason;\n }\n var change = new channelstatechange_1.default(this.state, state, resumed, hasBacklog, reason);\n var logLevel = state === 'failed' ? logger_1.default.LOG_ERROR : logger_1.default.LOG_MAJOR;\n logger_1.default.logAction(logLevel, 'Channel state for channel \"' + this.name + '\"', state + (reason ? '; reason: ' + reason : ''));\n if (state !== 'attaching' && state !== 'suspended') {\n this.retryCount = 0;\n }\n /* Note: we don't set inProgress for pending states until the request is actually in progress */\n if (state === 'attached') {\n this.onAttached();\n }\n if (state === 'attached') {\n this._attachResume = true;\n }\n else if (state === 'detaching' || state === 'failed') {\n this._attachResume = false;\n }\n this.state = state;\n this._allChannelChanges.emit(state, change);\n this.emit(state, change);\n };\n RealtimeChannel.prototype.requestState = function (state, reason) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimeChannel.requestState', 'name = ' + this.name + ', state = ' + state);\n this.notifyState(state, reason);\n /* send the event and await response */\n this.checkPendingState();\n };\n RealtimeChannel.prototype.checkPendingState = function () {\n /* if can't send events, do nothing */\n var cmState = this.connectionManager.state;\n /* Allow attach messages to queue up when synchronizing, since this will be\n * the state we'll be in when upgrade transport.active triggers a checkpendingstate */\n if (!(cmState.sendEvents || cmState.forceQueueEvents)) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimeChannel.checkPendingState', 'sendEvents is false; state is ' + this.connectionManager.state.state);\n return;\n }\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimeChannel.checkPendingState', 'name = ' + this.name + ', state = ' + this.state);\n /* Only start the state timer running when actually sending the event */\n switch (this.state) {\n case 'attaching':\n this.startStateTimerIfNotRunning();\n this.attachImpl();\n break;\n case 'detaching':\n this.startStateTimerIfNotRunning();\n this.detachImpl();\n break;\n case 'attached':\n /* resume any sync operation that was in progress */\n this.sync();\n break;\n default:\n break;\n }\n };\n RealtimeChannel.prototype.timeoutPendingState = function () {\n switch (this.state) {\n case 'attaching': {\n var err = new errorinfo_1.default('Channel attach timed out', 90007, 408);\n this.notifyState('suspended', err);\n break;\n }\n case 'detaching': {\n var err = new errorinfo_1.default('Channel detach timed out', 90007, 408);\n this.notifyState('attached', err);\n break;\n }\n default:\n this.checkPendingState();\n break;\n }\n };\n RealtimeChannel.prototype.startStateTimerIfNotRunning = function () {\n var _this = this;\n if (!this.stateTimer) {\n this.stateTimer = setTimeout(function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimeChannel.startStateTimerIfNotRunning', 'timer expired');\n _this.stateTimer = null;\n _this.timeoutPendingState();\n }, this.realtime.options.timeouts.realtimeRequestTimeout);\n }\n };\n RealtimeChannel.prototype.clearStateTimer = function () {\n var stateTimer = this.stateTimer;\n if (stateTimer) {\n clearTimeout(stateTimer);\n this.stateTimer = null;\n }\n };\n RealtimeChannel.prototype.startRetryTimer = function () {\n var _this = this;\n if (this.retryTimer)\n return;\n this.retryCount++;\n var retryDelay = Utils.getRetryTime(this.realtime.options.timeouts.channelRetryTimeout, this.retryCount);\n this.retryTimer = setTimeout(function () {\n /* If connection is not connected, just leave in suspended, a reattach\n * will be triggered once it connects again */\n if (_this.state === 'suspended' && _this.connectionManager.state.sendEvents) {\n _this.retryTimer = null;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimeChannel retry timer expired', 'attempting a new attach');\n _this.requestState('attaching');\n }\n }, retryDelay);\n };\n RealtimeChannel.prototype.cancelRetryTimer = function () {\n if (this.retryTimer) {\n clearTimeout(this.retryTimer);\n this.retryTimer = null;\n }\n };\n /* @returns null (if can safely be released) | ErrorInfo (if cannot) */\n RealtimeChannel.prototype.getReleaseErr = function () {\n var s = this.state;\n if (s === 'initialized' || s === 'detached' || s === 'failed') {\n return null;\n }\n return new errorinfo_1.default('Can only release a channel in a state where there is no possibility of further updates from the server being received (initialized, detached, or failed); was ' +\n s, 90001, 400);\n };\n RealtimeChannel.prototype.setChannelSerial = function (channelSerial) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimeChannel.setChannelSerial()', 'Updating channel serial; serial = ' + channelSerial + '; previous = ' + this.properties.channelSerial);\n // RTP17h: Only update the channel serial if its present (it won't always\n // be set).\n if (channelSerial) {\n this.properties.channelSerial = channelSerial;\n }\n };\n return RealtimeChannel;\n}(channel_1.default));\nexports.default = RealtimeChannel;\n\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ChannelStateChange = /** @class */ (function () {\n function ChannelStateChange(previous, current, resumed, hasBacklog, reason) {\n this.previous = previous;\n this.current = current;\n if (current === 'attached') {\n this.resumed = resumed;\n this.hasBacklog = hasBacklog;\n }\n if (reason)\n this.reason = reason;\n }\n return ChannelStateChange;\n}());\nexports.default = ChannelStateChange;\n\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Reusable object\n\t var W = [];\n\n\t /**\n\t * SHA-1 hash algorithm.\n\t */\n\t var SHA1 = C_algo.SHA1 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init([\n\t 0x67452301, 0xefcdab89,\n\t 0x98badcfe, 0x10325476,\n\t 0xc3d2e1f0\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcut\n\t var H = this._hash.words;\n\n\t // Working variables\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\t var e = H[4];\n\n\t // Computation\n\t for (var i = 0; i < 80; i++) {\n\t if (i < 16) {\n\t W[i] = M[offset + i] | 0;\n\t } else {\n\t var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n\t W[i] = (n << 1) | (n >>> 31);\n\t }\n\n\t var t = ((a << 5) | (a >>> 27)) + e + W[i];\n\t if (i < 20) {\n\t t += ((b & c) | (~b & d)) + 0x5a827999;\n\t } else if (i < 40) {\n\t t += (b ^ c ^ d) + 0x6ed9eba1;\n\t } else if (i < 60) {\n\t t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;\n\t } else /* if (i < 80) */ {\n\t t += (b ^ c ^ d) - 0x359d3e2a;\n\t }\n\n\t e = d;\n\t d = c;\n\t c = (b << 30) | (b >>> 2);\n\t b = a;\n\t a = t;\n\t }\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t H[4] = (H[4] + e) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Return final computed hash\n\t return this._hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA1('message');\n\t * var hash = CryptoJS.SHA1(wordArray);\n\t */\n\t C.SHA1 = Hasher._createHelper(SHA1);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA1(message, key);\n\t */\n\t C.HmacSHA1 = Hasher._createHmacHelper(SHA1);\n\t}());\n\n\n\treturn CryptoJS.SHA1;\n\n}));\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction inspect(buffer) {\n if (buffer === undefined)\n return 'undefined';\n var view;\n var type;\n if (buffer instanceof ArrayBuffer) {\n type = 'ArrayBuffer';\n view = new DataView(buffer);\n }\n else if (buffer instanceof DataView) {\n type = 'DataView';\n view = buffer;\n }\n if (!view)\n return JSON.stringify(buffer);\n var bytes = [];\n for (var i = 0; i < buffer.byteLength; i++) {\n if (i > 20) {\n bytes.push('...');\n break;\n }\n var byte_ = view.getUint8(i).toString(16);\n if (byte_.length === 1)\n byte_ = '0' + byte_;\n bytes.push(byte_);\n }\n return '<' + type + ' ' + bytes.join(' ') + '>';\n}\n// Encode string as utf8 into dataview at offset\nfunction utf8Write(view, offset, string) {\n for (var i = 0, l = string.length; i < l; i++) {\n var codePoint = string.charCodeAt(i);\n // One byte of UTF-8\n if (codePoint < 0x80) {\n view.setUint8(offset++, ((codePoint >>> 0) & 0x7f) | 0x00);\n continue;\n }\n // Two bytes of UTF-8\n if (codePoint < 0x800) {\n view.setUint8(offset++, ((codePoint >>> 6) & 0x1f) | 0xc0);\n view.setUint8(offset++, ((codePoint >>> 0) & 0x3f) | 0x80);\n continue;\n }\n // Three bytes of UTF-8.\n if (codePoint < 0x10000) {\n view.setUint8(offset++, ((codePoint >>> 12) & 0x0f) | 0xe0);\n view.setUint8(offset++, ((codePoint >>> 6) & 0x3f) | 0x80);\n view.setUint8(offset++, ((codePoint >>> 0) & 0x3f) | 0x80);\n continue;\n }\n // Four bytes of UTF-8\n if (codePoint < 0x110000) {\n view.setUint8(offset++, ((codePoint >>> 18) & 0x07) | 0xf0);\n view.setUint8(offset++, ((codePoint >>> 12) & 0x3f) | 0x80);\n view.setUint8(offset++, ((codePoint >>> 6) & 0x3f) | 0x80);\n view.setUint8(offset++, ((codePoint >>> 0) & 0x3f) | 0x80);\n continue;\n }\n throw new Error('bad codepoint ' + codePoint);\n }\n}\nfunction utf8Read(view, offset, length) {\n var string = '';\n for (var i = offset, end = offset + length; i < end; i++) {\n var byte_ = view.getUint8(i);\n // One byte character\n if ((byte_ & 0x80) === 0x00) {\n string += String.fromCharCode(byte_);\n continue;\n }\n // Two byte character\n if ((byte_ & 0xe0) === 0xc0) {\n string += String.fromCharCode(((byte_ & 0x0f) << 6) | (view.getUint8(++i) & 0x3f));\n continue;\n }\n // Three byte character\n if ((byte_ & 0xf0) === 0xe0) {\n string += String.fromCharCode(((byte_ & 0x0f) << 12) | ((view.getUint8(++i) & 0x3f) << 6) | ((view.getUint8(++i) & 0x3f) << 0));\n continue;\n }\n // Four byte character\n if ((byte_ & 0xf8) === 0xf0) {\n string += String.fromCharCode(((byte_ & 0x07) << 18) |\n ((view.getUint8(++i) & 0x3f) << 12) |\n ((view.getUint8(++i) & 0x3f) << 6) |\n ((view.getUint8(++i) & 0x3f) << 0));\n continue;\n }\n throw new Error('Invalid byte ' + byte_.toString(16));\n }\n return string;\n}\nfunction utf8ByteCount(string) {\n var count = 0;\n for (var i = 0, l = string.length; i < l; i++) {\n var codePoint = string.charCodeAt(i);\n if (codePoint < 0x80) {\n count += 1;\n continue;\n }\n if (codePoint < 0x800) {\n count += 2;\n continue;\n }\n if (codePoint < 0x10000) {\n count += 3;\n continue;\n }\n if (codePoint < 0x110000) {\n count += 4;\n continue;\n }\n throw new Error('bad codepoint ' + codePoint);\n }\n return count;\n}\nfunction encode(value, sparse) {\n var size = sizeof(value, sparse);\n if (size === 0)\n return undefined;\n var buffer = new ArrayBuffer(size);\n var view = new DataView(buffer);\n _encode(value, view, 0, sparse);\n return buffer;\n}\nvar SH_L_32 = (1 << 16) * (1 << 16), SH_R_32 = 1 / SH_L_32;\nfunction getInt64(view, offset) {\n offset = offset || 0;\n return view.getInt32(offset) * SH_L_32 + view.getUint32(offset + 4);\n}\nfunction getUint64(view, offset) {\n offset = offset || 0;\n return view.getUint32(offset) * SH_L_32 + view.getUint32(offset + 4);\n}\nfunction setInt64(view, offset, val) {\n if (val < 0x8000000000000000) {\n view.setInt32(offset, Math.floor(val * SH_R_32));\n view.setInt32(offset + 4, val & -1);\n }\n else {\n view.setUint32(offset, 0x7fffffff);\n view.setUint32(offset + 4, 0x7fffffff);\n }\n}\nfunction setUint64(view, offset, val) {\n if (val < 0x10000000000000000) {\n view.setUint32(offset, Math.floor(val * SH_R_32));\n view.setInt32(offset + 4, val & -1);\n }\n else {\n view.setUint32(offset, 0xffffffff);\n view.setUint32(offset + 4, 0xffffffff);\n }\n}\n// https://gist.github.com/frsyuki/5432559 - v5 spec\n//\n// I've used one extension point from `fixext 1` to store `undefined`. On the wire this\n// should translate to exactly 0xd40000\n//\n// +--------+--------+--------+\n// | 0xd4 | 0x00 | 0x00 |\n// +--------+--------+--------+\n// ^ fixext | ^ value part unused (fixed to be 0)\n// ^ indicates undefined value\n//\nvar Decoder = /** @class */ (function () {\n function Decoder(view, offset) {\n var _this = this;\n this.map = function (length) {\n var value = {};\n for (var i = 0; i < length; i++) {\n var key = _this.parse();\n value[key] = _this.parse();\n }\n return value;\n };\n this.bin = function (length) {\n var value = new ArrayBuffer(length);\n new Uint8Array(value).set(new Uint8Array(_this.view.buffer, _this.offset, length), 0);\n _this.offset += length;\n return value;\n };\n this.buf = this.bin;\n this.str = function (length) {\n var value = utf8Read(_this.view, _this.offset, length);\n _this.offset += length;\n return value;\n };\n this.array = function (length) {\n var value = new Array(length);\n for (var i = 0; i < length; i++) {\n value[i] = _this.parse();\n }\n return value;\n };\n this.ext = function (length) {\n _this.offset += length;\n return {\n type: _this.view.getInt8(_this.offset),\n data: _this.buf(length),\n };\n };\n this.parse = function () {\n var type = _this.view.getUint8(_this.offset);\n var value, length;\n // Positive FixInt - 0xxxxxxx\n if ((type & 0x80) === 0x00) {\n _this.offset++;\n return type;\n }\n // FixMap - 1000xxxx\n if ((type & 0xf0) === 0x80) {\n length = type & 0x0f;\n _this.offset++;\n return _this.map(length);\n }\n // FixArray - 1001xxxx\n if ((type & 0xf0) === 0x90) {\n length = type & 0x0f;\n _this.offset++;\n return _this.array(length);\n }\n // FixStr - 101xxxxx\n if ((type & 0xe0) === 0xa0) {\n length = type & 0x1f;\n _this.offset++;\n return _this.str(length);\n }\n // Negative FixInt - 111xxxxx\n if ((type & 0xe0) === 0xe0) {\n value = _this.view.getInt8(_this.offset);\n _this.offset++;\n return value;\n }\n switch (type) {\n // nil\n case 0xc0:\n _this.offset++;\n return null;\n // 0xc1 never used - use for undefined (NON-STANDARD)\n case 0xc1:\n _this.offset++;\n return undefined;\n // false\n case 0xc2:\n _this.offset++;\n return false;\n // true\n case 0xc3:\n _this.offset++;\n return true;\n // bin 8\n case 0xc4:\n length = _this.view.getUint8(_this.offset + 1);\n _this.offset += 2;\n return _this.bin(length);\n // bin 16\n case 0xc5:\n length = _this.view.getUint16(_this.offset + 1);\n _this.offset += 3;\n return _this.bin(length);\n // bin 32\n case 0xc6:\n length = _this.view.getUint32(_this.offset + 1);\n _this.offset += 5;\n return _this.bin(length);\n // ext 8\n case 0xc7:\n length = _this.view.getUint8(_this.offset + 1);\n _this.offset += 2;\n return _this.ext(length);\n // ext 16\n case 0xc8:\n length = _this.view.getUint16(_this.offset + 1);\n _this.offset += 3;\n return _this.ext(length);\n // ext 32\n case 0xc9:\n length = _this.view.getUint32(_this.offset + 1);\n _this.offset += 5;\n return _this.ext(length);\n // float 32\n case 0xca:\n value = _this.view.getFloat32(_this.offset + 1);\n _this.offset += 5;\n return value;\n // float 64\n case 0xcb:\n value = _this.view.getFloat64(_this.offset + 1);\n _this.offset += 9;\n return value;\n // uint8\n case 0xcc:\n value = _this.view.getUint8(_this.offset + 1);\n _this.offset += 2;\n return value;\n // uint 16\n case 0xcd:\n value = _this.view.getUint16(_this.offset + 1);\n _this.offset += 3;\n return value;\n // uint 32\n case 0xce:\n value = _this.view.getUint32(_this.offset + 1);\n _this.offset += 5;\n return value;\n // uint 64\n case 0xcf:\n value = getUint64(_this.view, _this.offset + 1);\n _this.offset += 9;\n return value;\n // int 8\n case 0xd0:\n value = _this.view.getInt8(_this.offset + 1);\n _this.offset += 2;\n return value;\n // int 16\n case 0xd1:\n value = _this.view.getInt16(_this.offset + 1);\n _this.offset += 3;\n return value;\n // int 32\n case 0xd2:\n value = _this.view.getInt32(_this.offset + 1);\n _this.offset += 5;\n return value;\n // int 64\n case 0xd3:\n value = getInt64(_this.view, _this.offset + 1);\n _this.offset += 9;\n return value;\n // fixext 1\n case 0xd4:\n length = 1;\n _this.offset++;\n return _this.ext(length);\n // fixext 2\n case 0xd5:\n length = 2;\n _this.offset++;\n return _this.ext(length);\n // fixext 4\n case 0xd6:\n length = 4;\n _this.offset++;\n return _this.ext(length);\n // fixext 8\n case 0xd7:\n length = 8;\n _this.offset++;\n return _this.ext(length);\n // fixext 16\n case 0xd8:\n length = 16;\n _this.offset++;\n return _this.ext(length);\n // str8\n case 0xd9:\n length = _this.view.getUint8(_this.offset + 1);\n _this.offset += 2;\n return _this.str(length);\n // str 16\n case 0xda:\n length = _this.view.getUint16(_this.offset + 1);\n _this.offset += 3;\n return _this.str(length);\n // str 32\n case 0xdb:\n length = _this.view.getUint32(_this.offset + 1);\n _this.offset += 5;\n return _this.str(length);\n // array 16\n case 0xdc:\n length = _this.view.getUint16(_this.offset + 1);\n _this.offset += 3;\n return _this.array(length);\n // array 32\n case 0xdd:\n length = _this.view.getUint32(_this.offset + 1);\n _this.offset += 5;\n return _this.array(length);\n // map 16\n case 0xde:\n length = _this.view.getUint16(_this.offset + 1);\n _this.offset += 3;\n return _this.map(length);\n // map 32\n case 0xdf:\n length = _this.view.getUint32(_this.offset + 1);\n _this.offset += 5;\n return _this.map(length);\n }\n throw new Error('Unknown type 0x' + type.toString(16));\n };\n this.offset = offset || 0;\n this.view = view;\n }\n return Decoder;\n}());\nfunction decode(buffer) {\n var view = new DataView(buffer);\n var decoder = new Decoder(view);\n var value = decoder.parse();\n if (decoder.offset !== buffer.byteLength)\n throw new Error(buffer.byteLength - decoder.offset + ' trailing bytes');\n return value;\n}\nfunction encodeableKeys(value, sparse) {\n return Object.keys(value).filter(function (e) {\n var val = value[e], type = typeof val;\n return (!sparse || (val !== undefined && val !== null)) && ('function' !== type || !!val.toJSON);\n });\n}\nfunction _encode(value, view, offset, sparse) {\n var type = typeof value;\n // Strings Bytes\n // There are four string types: fixstr/str8/str16/str32\n if (typeof value === 'string') {\n var length_1 = utf8ByteCount(value);\n // fixstr\n if (length_1 < 0x20) {\n view.setUint8(offset, length_1 | 0xa0);\n utf8Write(view, offset + 1, value);\n return 1 + length_1;\n }\n // str8\n if (length_1 < 0x100) {\n view.setUint8(offset, 0xd9);\n view.setUint8(offset + 1, length_1);\n utf8Write(view, offset + 2, value);\n return 2 + length_1;\n }\n // str16\n if (length_1 < 0x10000) {\n view.setUint8(offset, 0xda);\n view.setUint16(offset + 1, length_1);\n utf8Write(view, offset + 3, value);\n return 3 + length_1;\n }\n // str32\n if (length_1 < 0x100000000) {\n view.setUint8(offset, 0xdb);\n view.setUint32(offset + 1, length_1);\n utf8Write(view, offset + 5, value);\n return 5 + length_1;\n }\n }\n if (ArrayBuffer.isView && ArrayBuffer.isView(value)) {\n // extract the arraybuffer and fallthrough\n value = value.buffer;\n }\n // There are three bin types: bin8/bin16/bin32\n if (value instanceof ArrayBuffer) {\n var length_2 = value.byteLength;\n // bin8\n if (length_2 < 0x100) {\n view.setUint8(offset, 0xc4);\n view.setUint8(offset + 1, length_2);\n new Uint8Array(view.buffer).set(new Uint8Array(value), offset + 2);\n return 2 + length_2;\n }\n // bin16\n if (length_2 < 0x10000) {\n view.setUint8(offset, 0xc5);\n view.setUint16(offset + 1, length_2);\n new Uint8Array(view.buffer).set(new Uint8Array(value), offset + 3);\n return 3 + length_2;\n }\n // bin 32\n if (length_2 < 0x100000000) {\n view.setUint8(offset, 0xc6);\n view.setUint32(offset + 1, length_2);\n new Uint8Array(view.buffer).set(new Uint8Array(value), offset + 5);\n return 5 + length_2;\n }\n }\n if (typeof value === 'number') {\n // Floating Point\n // NOTE: We're always using float64\n if (Math.floor(value) !== value) {\n view.setUint8(offset, 0xcb);\n view.setFloat64(offset + 1, value);\n return 9;\n }\n // Integers\n if (value >= 0) {\n // positive fixnum\n if (value < 0x80) {\n view.setUint8(offset, value);\n return 1;\n }\n // uint 8\n if (value < 0x100) {\n view.setUint8(offset, 0xcc);\n view.setUint8(offset + 1, value);\n return 2;\n }\n // uint 16\n if (value < 0x10000) {\n view.setUint8(offset, 0xcd);\n view.setUint16(offset + 1, value);\n return 3;\n }\n // uint 32\n if (value < 0x100000000) {\n view.setUint8(offset, 0xce);\n view.setUint32(offset + 1, value);\n return 5;\n }\n // uint 64\n if (value < 0x10000000000000000) {\n view.setUint8(offset, 0xcf);\n setUint64(view, offset + 1, value);\n return 9;\n }\n throw new Error('Number too big 0x' + value.toString(16));\n }\n // negative fixnum\n if (value >= -0x20) {\n view.setInt8(offset, value);\n return 1;\n }\n // int 8\n if (value >= -0x80) {\n view.setUint8(offset, 0xd0);\n view.setInt8(offset + 1, value);\n return 2;\n }\n // int 16\n if (value >= -0x8000) {\n view.setUint8(offset, 0xd1);\n view.setInt16(offset + 1, value);\n return 3;\n }\n // int 32\n if (value >= -0x80000000) {\n view.setUint8(offset, 0xd2);\n view.setInt32(offset + 1, value);\n return 5;\n }\n // int 64\n if (value >= -0x8000000000000000) {\n view.setUint8(offset, 0xd3);\n setInt64(view, offset + 1, value);\n return 9;\n }\n throw new Error('Number too small -0x' + (-value).toString(16).substr(1));\n }\n // undefined - use d4 (NON-STANDARD)\n if (type === 'undefined') {\n if (sparse)\n return 0;\n view.setUint8(offset, 0xd4);\n view.setUint8(offset + 1, 0x00);\n view.setUint8(offset + 2, 0x00);\n return 3;\n }\n // null\n if (value === null) {\n if (sparse)\n return 0;\n view.setUint8(offset, 0xc0);\n return 1;\n }\n // Boolean\n if (type === 'boolean') {\n view.setUint8(offset, value ? 0xc3 : 0xc2);\n return 1;\n }\n if ('function' === typeof value.toJSON)\n return _encode(value.toJSON(), view, offset, sparse);\n // Container Types\n if (type === 'object') {\n var length_3, size = 0;\n var keys = void 0;\n var isArray = Array.isArray(value);\n if (isArray) {\n length_3 = value.length;\n }\n else {\n keys = encodeableKeys(value, sparse);\n length_3 = keys.length;\n }\n if (length_3 < 0x10) {\n view.setUint8(offset, length_3 | (isArray ? 0x90 : 0x80));\n size = 1;\n }\n else if (length_3 < 0x10000) {\n view.setUint8(offset, isArray ? 0xdc : 0xde);\n view.setUint16(offset + 1, length_3);\n size = 3;\n }\n else if (length_3 < 0x100000000) {\n view.setUint8(offset, isArray ? 0xdd : 0xdf);\n view.setUint32(offset + 1, length_3);\n size = 5;\n }\n if (isArray) {\n for (var i = 0; i < length_3; i++) {\n size += _encode(value[i], view, offset + size, sparse);\n }\n }\n else if (keys) {\n for (var i = 0; i < length_3; i++) {\n var key = keys[i];\n size += _encode(key, view, offset + size);\n size += _encode(value[key], view, offset + size, sparse);\n }\n }\n return size;\n }\n if (type === 'function')\n return 0;\n throw new Error('Unknown type ' + type);\n}\nfunction sizeof(value, sparse) {\n var type = typeof value;\n // fixstr or str8 or str16 or str32\n if (type === 'string') {\n var length_4 = utf8ByteCount(value);\n if (length_4 < 0x20) {\n return 1 + length_4;\n }\n if (length_4 < 0x100) {\n return 2 + length_4;\n }\n if (length_4 < 0x10000) {\n return 3 + length_4;\n }\n if (length_4 < 0x100000000) {\n return 5 + length_4;\n }\n }\n if (ArrayBuffer.isView && ArrayBuffer.isView(value)) {\n // extract the arraybuffer and fallthrough\n value = value.buffer;\n }\n // bin8 or bin16 or bin32\n if (value instanceof ArrayBuffer) {\n var length_5 = value.byteLength;\n if (length_5 < 0x100) {\n return 2 + length_5;\n }\n if (length_5 < 0x10000) {\n return 3 + length_5;\n }\n if (length_5 < 0x100000000) {\n return 5 + length_5;\n }\n }\n if (typeof value === 'number') {\n // Floating Point (32 bits)\n // double\n if (Math.floor(value) !== value)\n return 9;\n // Integers\n if (value >= 0) {\n // positive fixint\n if (value < 0x80)\n return 1;\n // uint 8\n if (value < 0x100)\n return 2;\n // uint 16\n if (value < 0x10000)\n return 3;\n // uint 32\n if (value < 0x100000000)\n return 5;\n // uint 64\n if (value < 0x10000000000000000)\n return 9;\n // Too big\n throw new Error('Number too big 0x' + value.toString(16));\n }\n // negative fixint\n if (value >= -0x20)\n return 1;\n // int 8\n if (value >= -0x80)\n return 2;\n // int 16\n if (value >= -0x8000)\n return 3;\n // int 32\n if (value >= -0x80000000)\n return 5;\n // int 64\n if (value >= -0x8000000000000000)\n return 9;\n // Too small\n throw new Error('Number too small -0x' + value.toString(16).substr(1));\n }\n // Boolean\n if (type === 'boolean')\n return 1;\n // undefined, null\n if (value === null)\n return sparse ? 0 : 1;\n if (value === undefined)\n return sparse ? 0 : 3;\n if ('function' === typeof value.toJSON)\n return sizeof(value.toJSON(), sparse);\n // Container Types\n if (type === 'object') {\n var length_6, size = 0;\n if (Array.isArray(value)) {\n length_6 = value.length;\n for (var i = 0; i < length_6; i++) {\n size += sizeof(value[i], sparse);\n }\n }\n else {\n var keys = encodeableKeys(value, sparse);\n length_6 = keys.length;\n for (var i = 0; i < length_6; i++) {\n var key = keys[i];\n size += sizeof(key) + sizeof(value[key], sparse);\n }\n }\n if (length_6 < 0x10) {\n return 1 + size;\n }\n if (length_6 < 0x10000) {\n return 3 + size;\n }\n if (length_6 < 0x100000000) {\n return 5 + size;\n }\n throw new Error('Array or object too long 0x' + length_6.toString(16));\n }\n if (type === 'function')\n return 0;\n throw new Error('Unknown type ' + type);\n}\nexports.default = {\n encode: encode,\n decode: decode,\n inspect: inspect,\n utf8Write: utf8Write,\n utf8Read: utf8Read,\n utf8ByteCount: utf8ByteCount,\n};\n\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\n// Common\nvar rest_1 = tslib_1.__importDefault(__webpack_require__(30));\nvar realtime_1 = tslib_1.__importDefault(__webpack_require__(50));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\n// Platform Specific\nvar bufferutils_1 = tslib_1.__importDefault(__webpack_require__(55));\n// @ts-ignore\nvar crypto_1 = tslib_1.__importDefault(__webpack_require__(57));\nvar http_1 = tslib_1.__importDefault(__webpack_require__(62));\nvar config_1 = tslib_1.__importDefault(__webpack_require__(64));\n// @ts-ignore\nvar transport_1 = tslib_1.__importDefault(__webpack_require__(68));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar defaults_1 = __webpack_require__(8);\nvar webstorage_1 = tslib_1.__importDefault(__webpack_require__(65));\nvar defaults_2 = tslib_1.__importDefault(__webpack_require__(66));\nvar msgpack_1 = tslib_1.__importDefault(__webpack_require__(41));\nvar Crypto = (0, crypto_1.default)(config_1.default, bufferutils_1.default);\nplatform_1.default.Crypto = Crypto;\nplatform_1.default.BufferUtils = bufferutils_1.default;\nplatform_1.default.Http = http_1.default;\nplatform_1.default.Config = config_1.default;\nplatform_1.default.Transports = transport_1.default;\nplatform_1.default.WebStorage = webstorage_1.default;\nrest_1.default.Crypto = Crypto;\nrealtime_1.default.Crypto = Crypto;\nlogger_1.default.initLogHandlers();\nplatform_1.default.Defaults = (0, defaults_1.getDefaults)(defaults_2.default);\nif (platform_1.default.Config.agent) {\n // @ts-ignore\n platform_1.default.Defaults.agent += ' ' + platform_1.default.Config.agent;\n}\n/* If using IE8, don't attempt to upgrade from xhr_polling to xhr_streaming -\n * while it can do streaming, the low max http-connections-per-host limit means\n * that the polling transport is crippled during the upgrade process. So just\n * leave it at the base transport */\nif (platform_1.default.Config.noUpgrade) {\n platform_1.default.Defaults.upgradeTransports = [];\n}\nexports.default = {\n ErrorInfo: errorinfo_1.default,\n Rest: rest_1.default,\n Realtime: realtime_1.default,\n msgpack: msgpack_1.default,\n};\n\n\n/***/ }),\n/* 43 */\n/***/ (function(module) {\n\nmodule.exports = JSON.parse(\"{\\\"name\\\":\\\"ably\\\",\\\"description\\\":\\\"Realtime client library for Ably, the realtime messaging service\\\",\\\"version\\\":\\\"1.2.44\\\",\\\"license\\\":\\\"Apache-2.0\\\",\\\"bugs\\\":{\\\"url\\\":\\\"https://github.com/ably/ably-js/issues\\\",\\\"email\\\":\\\"support@ably.com\\\"},\\\"main\\\":\\\"./build/ably-node.js\\\",\\\"typings\\\":\\\"./ably.d.ts\\\",\\\"react-native\\\":{\\\"./build/ably-node.js\\\":\\\"./build/ably-reactnative.js\\\"},\\\"browser\\\":{\\\"./build/ably-node.js\\\":\\\"./build/ably-commonjs.js\\\"},\\\"files\\\":[\\\"build/**\\\",\\\"ably.d.ts\\\",\\\"callbacks.d.ts\\\",\\\"callbacks.js\\\",\\\"promises.d.ts\\\",\\\"promises.js\\\",\\\"resources/**\\\",\\\"src/**\\\",\\\"react/**\\\"],\\\"dependencies\\\":{\\\"@ably/msgpack-js\\\":\\\"^0.4.0\\\",\\\"got\\\":\\\"^11.8.5\\\",\\\"ws\\\":\\\"^5.1\\\"},\\\"peerDependencies\\\":{\\\"react\\\":\\\">=16.8.0\\\",\\\"react-dom\\\":\\\">=16.8.0\\\"},\\\"peerDependenciesMeta\\\":{\\\"react\\\":{\\\"optional\\\":true},\\\"react-dom\\\":{\\\"optional\\\":true}},\\\"devDependencies\\\":{\\\"@ably/vcdiff-decoder\\\":\\\"1.0.4\\\",\\\"@testing-library/react\\\":\\\"^13.3.0\\\",\\\"@types/crypto-js\\\":\\\"^4.0.1\\\",\\\"@types/node\\\":\\\"^15.0.0\\\",\\\"@types/request\\\":\\\"^2.48.7\\\",\\\"@types/ws\\\":\\\"^8.2.0\\\",\\\"@typescript-eslint/eslint-plugin\\\":\\\"^5.14.0\\\",\\\"@typescript-eslint/parser\\\":\\\"^5.14.0\\\",\\\"@vitejs/plugin-react\\\":\\\"^1.3.2\\\",\\\"async\\\":\\\"ably-forks/async#requirejs\\\",\\\"aws-sdk\\\":\\\"^2.1413.0\\\",\\\"chai\\\":\\\"^4.2.0\\\",\\\"copy-webpack-plugin\\\":\\\"^6.4.1\\\",\\\"cors\\\":\\\"^2.8.5\\\",\\\"crypto-js\\\":\\\"ably-forks/crypto-js#crypto-lite\\\",\\\"eslint\\\":\\\"^7.13.0\\\",\\\"eslint-plugin-import\\\":\\\"^2.28.0\\\",\\\"eslint-plugin-jsdoc\\\":\\\"^40.0.0\\\",\\\"eslint-plugin-react\\\":\\\"^7.32.2\\\",\\\"eslint-plugin-react-hooks\\\":\\\"^4.6.0\\\",\\\"eslint-plugin-security\\\":\\\"^1.4.0\\\",\\\"express\\\":\\\"^4.17.1\\\",\\\"glob\\\":\\\"~4.4\\\",\\\"google-closure-compiler\\\":\\\"^20180610.0.1\\\",\\\"grunt\\\":\\\"^1.6.1\\\",\\\"grunt-bump\\\":\\\"^0.3.1\\\",\\\"grunt-cli\\\":\\\"~1.2.0\\\",\\\"grunt-closure-tools\\\":\\\"^1.0.0\\\",\\\"grunt-contrib-concat\\\":\\\"~0.5\\\",\\\"grunt-shell\\\":\\\"~1.1\\\",\\\"grunt-webpack\\\":\\\"^4.0.2\\\",\\\"hexy\\\":\\\"~0.2\\\",\\\"jsdom\\\":\\\"^20.0.0\\\",\\\"kexec\\\":\\\"ably-forks/node-kexec#update-for-node-12\\\",\\\"minimist\\\":\\\"^1.2.5\\\",\\\"mocha\\\":\\\"^8.1.3\\\",\\\"null-loader\\\":\\\"^4.0.1\\\",\\\"playwright\\\":\\\"^1.10.0\\\",\\\"prettier\\\":\\\"^2.5.1\\\",\\\"react\\\":\\\">=18.1.0\\\",\\\"react-dom\\\":\\\">=18.1.0\\\",\\\"requirejs\\\":\\\"~2.1\\\",\\\"shelljs\\\":\\\"~0.8\\\",\\\"source-map-explorer\\\":\\\"^2.5.2\\\",\\\"ts-loader\\\":\\\"^8.2.0\\\",\\\"tsconfig-paths-webpack-plugin\\\":\\\"^4.0.1\\\",\\\"tslib\\\":\\\"^2.3.1\\\",\\\"typedoc\\\":\\\"^0.23.8\\\",\\\"typescript\\\":\\\"^4.6.4\\\",\\\"vite\\\":\\\"^4.4.9\\\",\\\"vitest\\\":\\\"^0.18.0\\\",\\\"webpack\\\":\\\"^4.44.2\\\",\\\"webpack-cli\\\":\\\"^4.2.0\\\"},\\\"engines\\\":{\\\"node\\\":\\\">=5.10.x\\\"},\\\"repository\\\":\\\"ably/ably-js\\\",\\\"jspm\\\":{\\\"registry\\\":\\\"npm\\\",\\\"directories\\\":{\\\"lib\\\":\\\"build\\\"},\\\"main\\\":\\\"ably\\\"},\\\"scripts\\\":{\\\"start:react\\\":\\\"npx vite serve\\\",\\\"grunt\\\":\\\"grunt\\\",\\\"test\\\":\\\"grunt test\\\",\\\"test:node\\\":\\\"grunt test:node\\\",\\\"test:node:skip-build\\\":\\\"grunt mocha\\\",\\\"test:webserver\\\":\\\"grunt test:webserver\\\",\\\"test:playwright\\\":\\\"node test/support/runPlaywrightTests.js\\\",\\\"test:react\\\":\\\"vitest run\\\",\\\"concat\\\":\\\"grunt concat\\\",\\\"build\\\":\\\"grunt build:all && npm run build:react\\\",\\\"build:node\\\":\\\"grunt build:node\\\",\\\"build:browser\\\":\\\"grunt build:browser\\\",\\\"build:react\\\":\\\"npm run build:react:mjs && npm run build:react:cjs && cp src/platform/react-hooks/res/package.react.json react/package.json\\\",\\\"build:react:mjs\\\":\\\"tsc --project src/platform/react-hooks/tsconfig.mjs.json && cp src/platform/react-hooks/res/package.mjs.json react/mjs/package.json\\\",\\\"build:react:cjs\\\":\\\"tsc --project src/platform/react-hooks/tsconfig.cjs.json && cp src/platform/react-hooks/res/package.cjs.json react/cjs/package.json\\\",\\\"requirejs\\\":\\\"grunt requirejs\\\",\\\"lint\\\":\\\"eslint .\\\",\\\"lint:fix\\\":\\\"eslint --fix .\\\",\\\"check-closure-compiler\\\":\\\"grunt check-closure-compiler\\\",\\\"prepare\\\":\\\"npm run build\\\",\\\"format\\\":\\\"prettier --write --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js docs/chrome-mv3.md\\\",\\\"format:check\\\":\\\"prettier --check --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/cdn_deploy.js\\\",\\\"sourcemap\\\":\\\"source-map-explorer build/ably.min.js\\\",\\\"sourcemap:noencryption\\\":\\\"source-map-explorer build/ably.noencryption.min.js\\\",\\\"docs\\\":\\\"typedoc --entryPoints ably.d.ts --out docs/generated/default --readme docs/landing-pages/default.md && typedoc --entryPoints promises.d.ts --out docs/generated/promises --name \\\\\\\"ably (Promise-based)\\\\\\\" --readme docs/landing-pages/promises.md && cp docs/landing-pages/choose-library.html docs/generated/index.html\\\"}}\");\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports) {\n\n\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6), __webpack_require__(32), __webpack_require__(24));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.HmacSHA256;\n\n}));\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar devicedetails_1 = tslib_1.__importDefault(__webpack_require__(47));\nvar resource_1 = tslib_1.__importDefault(__webpack_require__(14));\nvar paginatedresource_1 = tslib_1.__importDefault(__webpack_require__(19));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar pushchannelsubscription_1 = tslib_1.__importDefault(__webpack_require__(48));\nvar noop = function () { };\nvar Push = /** @class */ (function () {\n function Push(rest) {\n this.rest = rest;\n this.admin = new Admin(rest);\n }\n return Push;\n}());\nvar Admin = /** @class */ (function () {\n function Admin(rest) {\n this.rest = rest;\n this.deviceRegistrations = new DeviceRegistrations(rest);\n this.channelSubscriptions = new ChannelSubscriptions(rest);\n }\n Admin.prototype.publish = function (recipient, payload, callback) {\n var rest = this.rest;\n var format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultPostHeaders(rest.options, format), params = {};\n var body = Utils.mixin({ recipient: recipient }, payload);\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'publish', arguments);\n }\n callback = noop;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n if (rest.options.pushFullWait)\n Utils.mixin(params, { fullWait: 'true' });\n var requestBody = Utils.encodeBody(body, format);\n resource_1.default.post(rest, '/push/publish', requestBody, headers, params, null, function (err) { return callback(err); });\n };\n return Admin;\n}());\nvar DeviceRegistrations = /** @class */ (function () {\n function DeviceRegistrations(rest) {\n this.rest = rest;\n }\n DeviceRegistrations.prototype.save = function (device, callback) {\n var rest = this.rest;\n var body = devicedetails_1.default.fromValues(device);\n var format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultPostHeaders(rest.options, format), params = {};\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'save', arguments);\n }\n callback = noop;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n if (rest.options.pushFullWait)\n Utils.mixin(params, { fullWait: 'true' });\n var requestBody = Utils.encodeBody(body, format);\n resource_1.default.put(rest, '/push/deviceRegistrations/' + encodeURIComponent(device.id), requestBody, headers, params, null, function (err, body, headers, unpacked) {\n callback(err, !err\n ? devicedetails_1.default.fromResponseBody(body, unpacked ? undefined : format)\n : undefined);\n });\n };\n DeviceRegistrations.prototype.get = function (deviceIdOrDetails, callback) {\n var rest = this.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultGetHeaders(rest.options, format), deviceId = deviceIdOrDetails.id || deviceIdOrDetails;\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'get', arguments);\n }\n callback = noop;\n }\n if (typeof deviceId !== 'string' || !deviceId.length) {\n callback(new errorinfo_1.default('First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails', 40000, 400));\n return;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n resource_1.default.get(rest, '/push/deviceRegistrations/' + encodeURIComponent(deviceId), headers, {}, null, function (err, body, headers, unpacked) {\n callback(err, !err\n ? devicedetails_1.default.fromResponseBody(body, unpacked ? undefined : format)\n : undefined);\n });\n };\n DeviceRegistrations.prototype.list = function (params, callback) {\n var rest = this.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, envelope = this.rest.http.supportsLinkHeaders ? undefined : format, headers = Utils.defaultGetHeaders(rest.options, format);\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'list', arguments);\n }\n callback = noop;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n new paginatedresource_1.default(rest, '/push/deviceRegistrations', headers, envelope, function (body, headers, unpacked) {\n return devicedetails_1.default.fromResponseBody(body, unpacked ? undefined : format);\n }).get(params, callback);\n };\n DeviceRegistrations.prototype.remove = function (deviceIdOrDetails, callback) {\n var rest = this.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultGetHeaders(rest.options, format), params = {}, deviceId = deviceIdOrDetails.id || deviceIdOrDetails;\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'remove', arguments);\n }\n callback = noop;\n }\n if (typeof deviceId !== 'string' || !deviceId.length) {\n callback(new errorinfo_1.default('First argument to DeviceRegistrations#remove must be a deviceId string or DeviceDetails', 40000, 400));\n return;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n if (rest.options.pushFullWait)\n Utils.mixin(params, { fullWait: 'true' });\n resource_1.default['delete'](rest, '/push/deviceRegistrations/' + encodeURIComponent(deviceId), headers, params, null, function (err) { return callback(err); });\n };\n DeviceRegistrations.prototype.removeWhere = function (params, callback) {\n var rest = this.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultGetHeaders(rest.options, format);\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'removeWhere', arguments);\n }\n callback = noop;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n if (rest.options.pushFullWait)\n Utils.mixin(params, { fullWait: 'true' });\n resource_1.default['delete'](rest, '/push/deviceRegistrations', headers, params, null, function (err) { return callback(err); });\n };\n return DeviceRegistrations;\n}());\nvar ChannelSubscriptions = /** @class */ (function () {\n function ChannelSubscriptions(rest) {\n /* ChannelSubscriptions have no unique id; removing one is equivalent to removeWhere by its properties */\n this.remove = ChannelSubscriptions.prototype.removeWhere;\n this.rest = rest;\n }\n ChannelSubscriptions.prototype.save = function (subscription, callback) {\n var rest = this.rest;\n var body = pushchannelsubscription_1.default.fromValues(subscription);\n var format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultPostHeaders(rest.options, format), params = {};\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'save', arguments);\n }\n callback = noop;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n if (rest.options.pushFullWait)\n Utils.mixin(params, { fullWait: 'true' });\n var requestBody = Utils.encodeBody(body, format);\n resource_1.default.post(rest, '/push/channelSubscriptions', requestBody, headers, params, null, function (err, body, headers, unpacked) {\n callback(err, !err && pushchannelsubscription_1.default.fromResponseBody(body, unpacked ? undefined : format));\n });\n };\n ChannelSubscriptions.prototype.list = function (params, callback) {\n var rest = this.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, envelope = this.rest.http.supportsLinkHeaders ? undefined : format, headers = Utils.defaultGetHeaders(rest.options, format);\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'list', arguments);\n }\n callback = noop;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n new paginatedresource_1.default(rest, '/push/channelSubscriptions', headers, envelope, function (body, headers, unpacked) {\n return pushchannelsubscription_1.default.fromResponseBody(body, unpacked ? undefined : format);\n }).get(params, callback);\n };\n ChannelSubscriptions.prototype.removeWhere = function (params, callback) {\n var rest = this.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, headers = Utils.defaultGetHeaders(rest.options, format);\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'removeWhere', arguments);\n }\n callback = noop;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n if (rest.options.pushFullWait)\n Utils.mixin(params, { fullWait: 'true' });\n resource_1.default['delete'](rest, '/push/channelSubscriptions', headers, params, null, function (err) { return callback(err); });\n };\n ChannelSubscriptions.prototype.listChannels = function (params, callback) {\n var rest = this.rest, format = rest.options.useBinaryProtocol ? Utils.Format.msgpack : Utils.Format.json, envelope = this.rest.http.supportsLinkHeaders ? undefined : format, headers = Utils.defaultGetHeaders(rest.options, format);\n if (typeof callback !== 'function') {\n if (this.rest.options.promises) {\n return Utils.promisify(this, 'listChannels', arguments);\n }\n callback = noop;\n }\n if (rest.options.headers)\n Utils.mixin(headers, rest.options.headers);\n if (rest.options.pushFullWait)\n Utils.mixin(params, { fullWait: 'true' });\n new paginatedresource_1.default(rest, '/push/channels', headers, envelope, function (body, headers, unpacked) {\n var parsedBody = (!unpacked && format ? Utils.decodeBody(body, format) : body);\n for (var i = 0; i < parsedBody.length; i++) {\n parsedBody[i] = String(parsedBody[i]);\n }\n return parsedBody;\n }).get(params, callback);\n };\n return ChannelSubscriptions;\n}());\nexports.default = Push;\n\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar DeviceFormFactor;\n(function (DeviceFormFactor) {\n DeviceFormFactor[\"Phone\"] = \"phone\";\n DeviceFormFactor[\"Tablet\"] = \"tablet\";\n DeviceFormFactor[\"Desktop\"] = \"desktop\";\n DeviceFormFactor[\"TV\"] = \"tv\";\n DeviceFormFactor[\"Watch\"] = \"watch\";\n DeviceFormFactor[\"Car\"] = \"car\";\n DeviceFormFactor[\"Embedded\"] = \"embedded\";\n DeviceFormFactor[\"Other\"] = \"other\";\n})(DeviceFormFactor || (DeviceFormFactor = {}));\nvar DevicePlatform;\n(function (DevicePlatform) {\n DevicePlatform[\"Android\"] = \"android\";\n DevicePlatform[\"IOS\"] = \"ios\";\n DevicePlatform[\"Browser\"] = \"browser\";\n})(DevicePlatform || (DevicePlatform = {}));\nvar DeviceDetails = /** @class */ (function () {\n function DeviceDetails() {\n }\n DeviceDetails.prototype.toJSON = function () {\n var _a, _b, _c;\n return {\n id: this.id,\n deviceSecret: this.deviceSecret,\n platform: this.platform,\n formFactor: this.formFactor,\n clientId: this.clientId,\n metadata: this.metadata,\n deviceIdentityToken: this.deviceIdentityToken,\n push: {\n recipient: (_a = this.push) === null || _a === void 0 ? void 0 : _a.recipient,\n state: (_b = this.push) === null || _b === void 0 ? void 0 : _b.state,\n error: (_c = this.push) === null || _c === void 0 ? void 0 : _c.error,\n },\n };\n };\n DeviceDetails.prototype.toString = function () {\n var _a, _b, _c, _d;\n var result = '[DeviceDetails';\n if (this.id)\n result += '; id=' + this.id;\n if (this.platform)\n result += '; platform=' + this.platform;\n if (this.formFactor)\n result += '; formFactor=' + this.formFactor;\n if (this.clientId)\n result += '; clientId=' + this.clientId;\n if (this.metadata)\n result += '; metadata=' + this.metadata;\n if (this.deviceIdentityToken)\n result += '; deviceIdentityToken=' + JSON.stringify(this.deviceIdentityToken);\n if ((_a = this.push) === null || _a === void 0 ? void 0 : _a.recipient)\n result += '; push.recipient=' + JSON.stringify(this.push.recipient);\n if ((_b = this.push) === null || _b === void 0 ? void 0 : _b.state)\n result += '; push.state=' + this.push.state;\n if ((_c = this.push) === null || _c === void 0 ? void 0 : _c.error)\n result += '; push.error=' + JSON.stringify(this.push.error);\n if ((_d = this.push) === null || _d === void 0 ? void 0 : _d.metadata)\n result += '; push.metadata=' + this.push.metadata;\n result += ']';\n return result;\n };\n DeviceDetails.fromResponseBody = function (body, format) {\n if (format) {\n body = Utils.decodeBody(body, format);\n }\n if (Utils.isArray(body)) {\n return DeviceDetails.fromValuesArray(body);\n }\n else {\n return DeviceDetails.fromValues(body);\n }\n };\n DeviceDetails.fromValues = function (values) {\n values.error = values.error && errorinfo_1.default.fromValues(values.error);\n return Object.assign(new DeviceDetails(), values);\n };\n DeviceDetails.fromValuesArray = function (values) {\n var count = values.length, result = new Array(count);\n for (var i = 0; i < count; i++)\n result[i] = DeviceDetails.fromValues(values[i]);\n return result;\n };\n DeviceDetails.toRequestBody = Utils.encodeBody;\n return DeviceDetails;\n}());\nexports.default = DeviceDetails;\n\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar PushChannelSubscription = /** @class */ (function () {\n function PushChannelSubscription() {\n }\n /**\n * Overload toJSON() to intercept JSON.stringify()\n * @return {*}\n */\n PushChannelSubscription.prototype.toJSON = function () {\n return {\n channel: this.channel,\n deviceId: this.deviceId,\n clientId: this.clientId,\n };\n };\n PushChannelSubscription.prototype.toString = function () {\n var result = '[PushChannelSubscription';\n if (this.channel)\n result += '; channel=' + this.channel;\n if (this.deviceId)\n result += '; deviceId=' + this.deviceId;\n if (this.clientId)\n result += '; clientId=' + this.clientId;\n result += ']';\n return result;\n };\n PushChannelSubscription.fromResponseBody = function (body, format) {\n if (format) {\n body = Utils.decodeBody(body, format);\n }\n if (Utils.isArray(body)) {\n return PushChannelSubscription.fromValuesArray(body);\n }\n else {\n return PushChannelSubscription.fromValues(body);\n }\n };\n PushChannelSubscription.fromValues = function (values) {\n return Object.assign(new PushChannelSubscription(), values);\n };\n PushChannelSubscription.fromValuesArray = function (values) {\n var count = values.length, result = new Array(count);\n for (var i = 0; i < count; i++)\n result[i] = PushChannelSubscription.fromValues(values[i]);\n return result;\n };\n PushChannelSubscription.toRequestBody = Utils.encodeBody;\n return PushChannelSubscription;\n}());\nexports.default = PushChannelSubscription;\n\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar MessageCount = /** @class */ (function () {\n function MessageCount(values) {\n this.count = (values && values.count) || 0;\n this.data = (values && values.data) || 0;\n this.uncompressedData = (values && values.uncompressedData) || 0;\n this.failed = (values && values.failed) || 0;\n this.refused = (values && values.refused) || 0;\n }\n return MessageCount;\n}());\nvar MessageCategory = /** @class */ (function (_super) {\n tslib_1.__extends(MessageCategory, _super);\n function MessageCategory(values) {\n var _this = _super.call(this, values) || this;\n if (values && values.category) {\n _this.category = {};\n Utils.forInOwnNonNullProperties(values.category, function (prop) {\n _this.category[prop] = new MessageCount(values.category[prop]);\n });\n }\n return _this;\n }\n return MessageCategory;\n}(MessageCount));\nvar ResourceCount = /** @class */ (function () {\n function ResourceCount(values) {\n this.peak = (values && values.peak) || 0;\n this.min = (values && values.min) || 0;\n this.mean = (values && values.mean) || 0;\n this.opened = (values && values.opened) || 0;\n this.refused = (values && values.refused) || 0;\n }\n return ResourceCount;\n}());\nvar RequestCount = /** @class */ (function () {\n function RequestCount(values) {\n this.succeeded = (values && values.succeeded) || 0;\n this.failed = (values && values.failed) || 0;\n this.refused = (values && values.refused) || 0;\n }\n return RequestCount;\n}());\nvar ConnectionTypes = /** @class */ (function () {\n function ConnectionTypes(values) {\n this.plain = new ResourceCount(values && values.plain);\n this.tls = new ResourceCount(values && values.tls);\n this.all = new ResourceCount(values && values.all);\n }\n return ConnectionTypes;\n}());\nvar MessageTypes = /** @class */ (function () {\n function MessageTypes(values) {\n this.messages = new MessageCategory(values && values.messages);\n this.presence = new MessageCategory(values && values.presence);\n this.all = new MessageCategory(values && values.all);\n }\n return MessageTypes;\n}());\nvar MessageTraffic = /** @class */ (function () {\n function MessageTraffic(values) {\n this.realtime = new MessageTypes(values && values.realtime);\n this.rest = new MessageTypes(values && values.rest);\n this.webhook = new MessageTypes(values && values.webhook);\n this.sharedQueue = new MessageTypes(values && values.sharedQueue);\n this.externalQueue = new MessageTypes(values && values.externalQueue);\n this.httpEvent = new MessageTypes(values && values.httpEvent);\n this.push = new MessageTypes(values && values.push);\n this.all = new MessageTypes(values && values.all);\n }\n return MessageTraffic;\n}());\nvar MessageDirections = /** @class */ (function () {\n function MessageDirections(values) {\n this.all = new MessageTypes(values && values.all);\n this.inbound = new MessageTraffic(values && values.inbound);\n this.outbound = new MessageTraffic(values && values.outbound);\n }\n return MessageDirections;\n}());\nvar XchgMessages = /** @class */ (function () {\n function XchgMessages(values) {\n this.all = new MessageTypes(values && values.all);\n this.producerPaid = new MessageDirections(values && values.producerPaid);\n this.consumerPaid = new MessageDirections(values && values.consumerPaid);\n }\n return XchgMessages;\n}());\nvar PushStats = /** @class */ (function () {\n function PushStats(values) {\n this.messages = (values && values.messages) || 0;\n var notifications = values && values.notifications;\n this.notifications = {\n invalid: (notifications && notifications.invalid) || 0,\n attempted: (notifications && notifications.attempted) || 0,\n successful: (notifications && notifications.successful) || 0,\n failed: (notifications && notifications.failed) || 0,\n };\n this.directPublishes = (values && values.directPublishes) || 0;\n }\n return PushStats;\n}());\nvar ProcessedCount = /** @class */ (function () {\n function ProcessedCount(values) {\n this.succeeded = (values && values.succeeded) || 0;\n this.skipped = (values && values.skipped) || 0;\n this.failed = (values && values.failed) || 0;\n }\n return ProcessedCount;\n}());\nvar ProcessedMessages = /** @class */ (function () {\n function ProcessedMessages(values) {\n var _this = this;\n this.delta = undefined;\n if (values && values.delta) {\n this.delta = {};\n Utils.forInOwnNonNullProperties(values.delta, function (prop) {\n _this.delta[prop] = new ProcessedCount(values.delta[prop]);\n });\n }\n }\n return ProcessedMessages;\n}());\nvar Stats = /** @class */ (function (_super) {\n tslib_1.__extends(Stats, _super);\n function Stats(values) {\n var _this = _super.call(this, values) || this;\n _this.persisted = new MessageTypes(values && values.persisted);\n _this.connections = new ConnectionTypes(values && values.connections);\n _this.channels = new ResourceCount(values && values.channels);\n _this.apiRequests = new RequestCount(values && values.apiRequests);\n _this.tokenRequests = new RequestCount(values && values.tokenRequests);\n _this.xchgProducer = new XchgMessages(values && values.xchgProducer);\n _this.xchgConsumer = new XchgMessages(values && values.xchgConsumer);\n _this.push = new PushStats(values && values.pushStats);\n _this.processed = new ProcessedMessages(values && values.processed);\n _this.inProgress = (values && values.inProgress) || undefined;\n _this.unit = (values && values.unit) || undefined;\n _this.intervalId = (values && values.intervalId) || undefined;\n return _this;\n }\n Stats.fromValues = function (values) {\n return new Stats(values);\n };\n return Stats;\n}(MessageDirections));\nexports.default = Stats;\n\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar rest_1 = tslib_1.__importDefault(__webpack_require__(30));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar connection_1 = tslib_1.__importDefault(__webpack_require__(51));\nvar realtimechannel_1 = tslib_1.__importDefault(__webpack_require__(38));\nvar defaults_1 = tslib_1.__importDefault(__webpack_require__(8));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar protocolmessage_1 = tslib_1.__importDefault(__webpack_require__(10));\nvar connectionmanager_1 = tslib_1.__importDefault(__webpack_require__(35));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar message_1 = tslib_1.__importDefault(__webpack_require__(9));\nvar Realtime = /** @class */ (function (_super) {\n tslib_1.__extends(Realtime, _super);\n function Realtime(options) {\n var _this = _super.call(this, options) || this;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Realtime()', '');\n _this.connection = new connection_1.default(_this, _this.options);\n _this.channels = new Channels(_this);\n if (options.autoConnect !== false)\n _this.connect();\n return _this;\n }\n Realtime.prototype.connect = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Realtime.connect()', '');\n this.connection.connect();\n };\n Realtime.prototype.close = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Realtime.close()', '');\n this.connection.close();\n };\n Realtime.Promise = function (options) {\n options = defaults_1.default.objectifyOptions(options);\n options.promises = true;\n return new Realtime(options);\n };\n Realtime.Callbacks = Realtime;\n Realtime.Utils = Utils;\n Realtime.ConnectionManager = connectionmanager_1.default;\n Realtime.Platform = platform_1.default;\n Realtime.ProtocolMessage = protocolmessage_1.default;\n Realtime.Message = message_1.default;\n return Realtime;\n}(rest_1.default));\nvar Channels = /** @class */ (function (_super) {\n tslib_1.__extends(Channels, _super);\n function Channels(realtime) {\n var _this = _super.call(this) || this;\n _this.realtime = realtime;\n _this.all = Object.create(null);\n realtime.connection.connectionManager.on('transport.active', function () {\n _this.onTransportActive();\n });\n return _this;\n }\n Channels.prototype.channelSerials = function () {\n var serials = {};\n for (var _i = 0, _a = Utils.keysArray(this.all, true); _i < _a.length; _i++) {\n var name_1 = _a[_i];\n var channel = this.all[name_1];\n if (channel.properties.channelSerial) {\n serials[name_1] = channel.properties.channelSerial;\n }\n }\n return serials;\n };\n // recoverChannels gets the given channels and sets their channel serials.\n Channels.prototype.recoverChannels = function (channelSerials) {\n for (var _i = 0, _a = Utils.keysArray(channelSerials, true); _i < _a.length; _i++) {\n var name_2 = _a[_i];\n var channel = this.get(name_2);\n channel.properties.channelSerial = channelSerials[name_2];\n }\n };\n Channels.prototype.onChannelMessage = function (msg) {\n var channelName = msg.channel;\n if (channelName === undefined) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Channels.onChannelMessage()', 'received event unspecified channel, action = ' + msg.action);\n return;\n }\n var channel = this.all[channelName];\n if (!channel) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Channels.onChannelMessage()', 'received event for non-existent channel: ' + channelName);\n return;\n }\n channel.onMessage(msg);\n };\n /* called when a transport becomes connected; reattempt attach/detach\n * for channels that are attaching or detaching. */\n Channels.prototype.onTransportActive = function () {\n for (var channelName in this.all) {\n var channel = this.all[channelName];\n if (channel.state === 'attaching' || channel.state === 'detaching') {\n channel.checkPendingState();\n }\n else if (channel.state === 'suspended') {\n channel._attach(false, null);\n }\n else if (channel.state === 'attached') {\n // Note explicity request the state, channel.attach() would do nothing\n // as its already attached.\n channel.requestState('attaching');\n }\n }\n };\n /* Connection interruptions (ie when the connection will no longer queue\n * events) imply connection state changes for any channel which is either\n * attached, pending, or will attempt to become attached in the future */\n Channels.prototype.propogateConnectionInterruption = function (connectionState, reason) {\n var connectionStateToChannelState = {\n closing: 'detached',\n closed: 'detached',\n failed: 'failed',\n suspended: 'suspended',\n };\n var fromChannelStates = ['attaching', 'attached', 'detaching', 'suspended'];\n var toChannelState = connectionStateToChannelState[connectionState];\n for (var channelId in this.all) {\n var channel = this.all[channelId];\n if (Utils.arrIn(fromChannelStates, channel.state)) {\n channel.notifyState(toChannelState, reason);\n }\n }\n };\n Channels.prototype.get = function (name, channelOptions) {\n name = String(name);\n var channel = this.all[name];\n if (!channel) {\n channel = this.all[name] = new realtimechannel_1.default(this.realtime, name, channelOptions);\n }\n else if (channelOptions) {\n if (channel._shouldReattachToSetOptions(channelOptions)) {\n throw new errorinfo_1.default('Channels.get() cannot be used to set channel options that would cause the channel to reattach. Please, use RealtimeChannel.setOptions() instead.', 40000, 400);\n }\n channel.setOptions(channelOptions);\n }\n return channel;\n };\n Channels.prototype.getDerived = function (name, deriveOptions, channelOptions) {\n if (deriveOptions.filter) {\n var filter = Utils.toBase64(deriveOptions.filter);\n var match = Utils.matchDerivedChannel(name);\n name = \"[filter=\".concat(filter).concat(match.qualifierParam, \"]\").concat(match.channelName);\n }\n return this.get(name, channelOptions);\n };\n /* Included to support certain niche use-cases; most users should ignore this.\n * Please do not use this unless you know what you're doing */\n Channels.prototype.release = function (name) {\n name = String(name);\n var channel = this.all[name];\n if (!channel) {\n return;\n }\n var releaseErr = channel.getReleaseErr();\n if (releaseErr) {\n throw releaseErr;\n }\n delete this.all[name];\n };\n return Channels;\n}(eventemitter_1.default));\nexports.default = Realtime;\n\n\n/***/ }),\n/* 51 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar connectionmanager_1 = tslib_1.__importDefault(__webpack_require__(35));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar connectionstatechange_1 = tslib_1.__importDefault(__webpack_require__(37));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nfunction noop() { }\nvar Connection = /** @class */ (function (_super) {\n tslib_1.__extends(Connection, _super);\n function Connection(ably, options) {\n var _this = _super.call(this) || this;\n _this.whenState = (function (state, listener) {\n return eventemitter_1.default.prototype.whenState.call(_this, state, _this.state, listener, new connectionstatechange_1.default(undefined, state));\n });\n _this.ably = ably;\n _this.connectionManager = new connectionmanager_1.default(ably, options);\n _this.state = _this.connectionManager.state.state;\n _this.key = undefined;\n _this.id = undefined;\n _this.errorReason = null;\n _this.connectionManager.on('connectionstate', function (stateChange) {\n var state = (_this.state = stateChange.current);\n platform_1.default.Config.nextTick(function () {\n _this.emit(state, stateChange);\n });\n });\n _this.connectionManager.on('update', function (stateChange) {\n platform_1.default.Config.nextTick(function () {\n _this.emit('update', stateChange);\n });\n });\n return _this;\n }\n Connection.prototype.connect = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Connection.connect()', '');\n this.connectionManager.requestState({ state: 'connecting' });\n };\n Connection.prototype.ping = function (callback) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Connection.ping()', '');\n if (!callback) {\n if (this.ably.options.promises) {\n return Utils.promisify(this, 'ping', arguments);\n }\n callback = noop;\n }\n this.connectionManager.ping(null, callback);\n };\n Connection.prototype.close = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'Connection.close()', 'connectionKey = ' + this.key);\n this.connectionManager.requestState({ state: 'closing' });\n };\n Object.defineProperty(Connection.prototype, \"recoveryKey\", {\n get: function () {\n return this.createRecoveryKey();\n },\n enumerable: false,\n configurable: true\n });\n Connection.prototype.createRecoveryKey = function () {\n return this.connectionManager.createRecoveryKey();\n };\n return Connection;\n}(eventemitter_1.default));\nexports.default = Connection;\n\n\n/***/ }),\n/* 52 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PendingMessage = void 0;\nvar tslib_1 = __webpack_require__(0);\nvar protocolmessage_1 = tslib_1.__importDefault(__webpack_require__(10));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar messagequeue_1 = tslib_1.__importDefault(__webpack_require__(36));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar actions = protocolmessage_1.default.Action;\nvar PendingMessage = /** @class */ (function () {\n function PendingMessage(message, callback) {\n this.message = message;\n this.callback = callback;\n this.merged = false;\n var action = message.action;\n this.sendAttempted = false;\n this.ackRequired = action == actions.MESSAGE || action == actions.PRESENCE;\n }\n return PendingMessage;\n}());\nexports.PendingMessage = PendingMessage;\nvar Protocol = /** @class */ (function (_super) {\n tslib_1.__extends(Protocol, _super);\n function Protocol(transport) {\n var _this = _super.call(this) || this;\n _this.transport = transport;\n _this.messageQueue = new messagequeue_1.default();\n transport.on('ack', function (serial, count) {\n _this.onAck(serial, count);\n });\n transport.on('nack', function (serial, count, err) {\n _this.onNack(serial, count, err);\n });\n return _this;\n }\n Protocol.prototype.onAck = function (serial, count) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Protocol.onAck()', 'serial = ' + serial + '; count = ' + count);\n this.messageQueue.completeMessages(serial, count);\n };\n Protocol.prototype.onNack = function (serial, count, err) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'Protocol.onNack()', 'serial = ' + serial + '; count = ' + count + '; err = ' + Utils.inspectError(err));\n if (!err) {\n err = new errorinfo_1.default('Unable to send message; channel not responding', 50001, 500);\n }\n this.messageQueue.completeMessages(serial, count, err);\n };\n Protocol.prototype.onceIdle = function (listener) {\n var messageQueue = this.messageQueue;\n if (messageQueue.count() === 0) {\n listener();\n return;\n }\n messageQueue.once('idle', listener);\n };\n Protocol.prototype.send = function (pendingMessage) {\n if (pendingMessage.ackRequired) {\n this.messageQueue.push(pendingMessage);\n }\n if (logger_1.default.shouldLog(logger_1.default.LOG_MICRO)) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'Protocol.send()', 'sending msg; ' + protocolmessage_1.default.stringify(pendingMessage.message));\n }\n pendingMessage.sendAttempted = true;\n this.transport.send(pendingMessage.message);\n };\n Protocol.prototype.getTransport = function () {\n return this.transport;\n };\n Protocol.prototype.getPendingMessages = function () {\n return this.messageQueue.copyAll();\n };\n Protocol.prototype.clearPendingMessages = function () {\n return this.messageQueue.clear();\n };\n Protocol.prototype.finish = function () {\n var transport = this.transport;\n this.onceIdle(function () {\n transport.disconnect();\n });\n };\n return Protocol;\n}(eventemitter_1.default));\nexports.default = Protocol;\n\n\n/***/ }),\n/* 53 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar transport_1 = tslib_1.__importDefault(__webpack_require__(26));\nvar defaults_1 = tslib_1.__importDefault(__webpack_require__(8));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar protocolmessage_1 = tslib_1.__importDefault(__webpack_require__(10));\nvar errorinfo_1 = tslib_1.__importDefault(__webpack_require__(4));\nvar shortName = 'web_socket';\nfunction isNodeWebSocket(ws) {\n return !!ws.on;\n}\nvar WebSocketTransport = /** @class */ (function (_super) {\n tslib_1.__extends(WebSocketTransport, _super);\n function WebSocketTransport(connectionManager, auth, params) {\n var _this = _super.call(this, connectionManager, auth, params) || this;\n _this.shortName = shortName;\n /* If is a browser, can't detect pings, so request protocol heartbeats */\n params.heartbeats = platform_1.default.Config.useProtocolHeartbeats;\n _this.wsHost = defaults_1.default.getHost(params.options, params.host, true);\n return _this;\n }\n WebSocketTransport.isAvailable = function () {\n return !!platform_1.default.Config.WebSocket;\n };\n WebSocketTransport.prototype.createWebSocket = function (uri, connectParams) {\n this.uri = uri + Utils.toQueryString(connectParams);\n return new platform_1.default.Config.WebSocket(this.uri);\n };\n WebSocketTransport.prototype.toString = function () {\n return 'WebSocketTransport; uri=' + this.uri;\n };\n WebSocketTransport.prototype.connect = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'WebSocketTransport.connect()', 'starting');\n transport_1.default.prototype.connect.call(this);\n var self = this, params = this.params, options = params.options;\n var wsScheme = options.tls ? 'wss://' : 'ws://';\n var wsUri = wsScheme + this.wsHost + ':' + defaults_1.default.getPort(options) + '/';\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'WebSocketTransport.connect()', 'uri: ' + wsUri);\n this.auth.getAuthParams(function (err, authParams) {\n if (self.isDisposed) {\n return;\n }\n var paramStr = '';\n for (var param in authParams)\n paramStr += ' ' + param + ': ' + authParams[param] + ';';\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'WebSocketTransport.connect()', 'authParams:' + paramStr + ' err: ' + err);\n if (err) {\n self.disconnect(err);\n return;\n }\n var connectParams = params.getConnectParams(authParams);\n try {\n var wsConnection = (self.wsConnection = self.createWebSocket(wsUri, connectParams));\n wsConnection.binaryType = platform_1.default.Config.binaryType;\n wsConnection.onopen = function () {\n self.onWsOpen();\n };\n wsConnection.onclose = function (ev) {\n self.onWsClose(ev);\n };\n wsConnection.onmessage = function (ev) {\n self.onWsData(ev.data);\n };\n wsConnection.onerror = function (ev) {\n self.onWsError(ev);\n };\n if (isNodeWebSocket(wsConnection)) {\n /* node; browsers currently don't have a general eventemitter and can't detect\n * pings. Also, no need to reply with a pong explicitly, ws lib handles that */\n wsConnection.on('ping', function () {\n self.onActivity();\n });\n }\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'WebSocketTransport.connect()', 'Unexpected exception creating websocket: err = ' + (e.stack || e.message));\n self.disconnect(e);\n }\n });\n };\n WebSocketTransport.prototype.send = function (message) {\n var wsConnection = this.wsConnection;\n if (!wsConnection) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'WebSocketTransport.send()', 'No socket connection');\n return;\n }\n try {\n wsConnection.send(protocolmessage_1.default.serialize(message, this.params.format));\n }\n catch (e) {\n var msg = 'Exception from ws connection when trying to send: ' + Utils.inspectError(e);\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'WebSocketTransport.send()', msg);\n /* Don't try to request a disconnect, that'll just involve sending data\n * down the websocket again. Just finish the transport. */\n this.finish('disconnected', new errorinfo_1.default(msg, 50000, 500));\n }\n };\n WebSocketTransport.prototype.onWsData = function (data) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'WebSocketTransport.onWsData()', 'data received; length = ' + data.length + '; type = ' + typeof data);\n try {\n this.onProtocolMessage(protocolmessage_1.default.deserialize(data, this.format));\n }\n catch (e) {\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'WebSocketTransport.onWsData()', 'Unexpected exception handing channel message: ' + e.stack);\n }\n };\n WebSocketTransport.prototype.onWsOpen = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'WebSocketTransport.onWsOpen()', 'opened WebSocket');\n this.emit('preconnect');\n };\n WebSocketTransport.prototype.onWsClose = function (ev) {\n var wasClean, code;\n if (typeof ev == 'object') {\n /* W3C spec-compatible */\n code = ev.code;\n // ev.wasClean is undefined in reactnative\n wasClean = ev.wasClean || code === 1000;\n } /*if(typeof(ev) == 'number')*/\n else {\n /* ws in node */\n code = ev;\n wasClean = code == 1000;\n }\n delete this.wsConnection;\n if (wasClean) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'WebSocketTransport.onWsClose()', 'Cleanly closed WebSocket');\n var err = new errorinfo_1.default('Websocket closed', 80003, 400);\n this.finish('disconnected', err);\n }\n else {\n var msg = 'Unclean disconnection of WebSocket ; code = ' + code, err = new errorinfo_1.default(msg, 80003, 400);\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'WebSocketTransport.onWsClose()', msg);\n this.finish('disconnected', err);\n }\n this.emit('disposed');\n };\n WebSocketTransport.prototype.onWsError = function (err) {\n var _this = this;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'WebSocketTransport.onError()', 'Error from WebSocket: ' + err.message);\n /* Wait a tick before aborting: if the websocket was connected, this event\n * will be immediately followed by an onclose event with a close code. Allow\n * that to close it (so we see the close code) rather than anticipating it */\n platform_1.default.Config.nextTick(function () {\n _this.disconnect(Error(err.message));\n });\n };\n WebSocketTransport.prototype.dispose = function () {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'WebSocketTransport.dispose()', '');\n this.isDisposed = true;\n var wsConnection = this.wsConnection;\n if (wsConnection) {\n /* Ignore any messages that come through after dispose() is called but before\n * websocket is actually closed. (mostly would be harmless, but if it's a\n * CONNECTED, it'll re-tick isConnected and cause all sorts of havoc) */\n wsConnection.onmessage = function () { };\n delete this.wsConnection;\n /* defer until the next event loop cycle before closing the socket,\n * giving some implementations the opportunity to send any outstanding close message */\n platform_1.default.Config.nextTick(function () {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'WebSocketTransport.dispose()', 'closing websocket');\n if (!wsConnection) {\n throw new Error('WebSocketTransport.dispose(): wsConnection is not defined');\n }\n wsConnection.close();\n });\n }\n };\n return WebSocketTransport;\n}(transport_1.default));\nfunction initialiseTransport(connectionManager) {\n if (WebSocketTransport.isAvailable())\n connectionManager.supportedTransports[shortName] = WebSocketTransport;\n return WebSocketTransport;\n}\nexports.default = initialiseTransport;\n\n\n/***/ }),\n/* 54 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar presence_1 = tslib_1.__importDefault(__webpack_require__(34));\nvar eventemitter_1 = tslib_1.__importDefault(__webpack_require__(7));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar presencemessage_1 = tslib_1.__importDefault(__webpack_require__(15));\nvar errorinfo_1 = tslib_1.__importStar(__webpack_require__(4));\nvar realtimechannel_1 = tslib_1.__importDefault(__webpack_require__(38));\nvar multicaster_1 = tslib_1.__importDefault(__webpack_require__(23));\nvar channelstatechange_1 = tslib_1.__importDefault(__webpack_require__(39));\nvar noop = function () { };\nfunction getClientId(realtimePresence) {\n return realtimePresence.channel.realtime.auth.clientId;\n}\nfunction isAnonymousOrWildcard(realtimePresence) {\n var realtime = realtimePresence.channel.realtime;\n /* If not currently connected, we can't assume that we're an anonymous\n * client, as realtime may inform us of our clientId in the CONNECTED\n * message. So assume we're not anonymous and leave it to realtime to\n * return an error if we are */\n var clientId = realtime.auth.clientId;\n return (!clientId || clientId === '*') && realtime.connection.state === 'connected';\n}\n/* Callback is called only in the event of an error */\nfunction waitAttached(channel, callback, action) {\n switch (channel.state) {\n case 'attached':\n case 'suspended':\n action();\n break;\n case 'initialized':\n case 'detached':\n case 'detaching':\n case 'attaching':\n channel.attach(function (err) {\n if (err)\n callback(err);\n else\n action();\n });\n break;\n default:\n callback(errorinfo_1.default.fromValues(channel.invalidStateError()));\n }\n}\nfunction newerThan(item, existing) {\n /* RTP2b1: if either is synthesised, compare by timestamp */\n if (item.isSynthesized() || existing.isSynthesized()) {\n // RTP2b1a: if equal, prefer the newly-arrived one\n return item.timestamp >= existing.timestamp;\n }\n /* RTP2b2 */\n var itemOrderings = item.parseId(), existingOrderings = existing.parseId();\n if (itemOrderings.msgSerial === existingOrderings.msgSerial) {\n return itemOrderings.index > existingOrderings.index;\n }\n else {\n return itemOrderings.msgSerial > existingOrderings.msgSerial;\n }\n}\nvar RealtimePresence = /** @class */ (function (_super) {\n tslib_1.__extends(RealtimePresence, _super);\n function RealtimePresence(channel) {\n var _this = _super.call(this, channel) || this;\n _this.channel = channel;\n _this.syncComplete = false;\n _this.members = new PresenceMap(_this, function (item) { return item.clientId + ':' + item.connectionId; });\n // RTP17h: Store own members by clientId only.\n _this._myMembers = new PresenceMap(_this, function (item) { return item.clientId; });\n _this.subscriptions = new eventemitter_1.default();\n _this.pendingPresence = [];\n return _this;\n }\n RealtimePresence.prototype.enter = function (data, callback) {\n if (isAnonymousOrWildcard(this)) {\n throw new errorinfo_1.default('clientId must be specified to enter a presence channel', 40012, 400);\n }\n return this._enterOrUpdateClient(undefined, undefined, data, 'enter', callback);\n };\n RealtimePresence.prototype.update = function (data, callback) {\n if (isAnonymousOrWildcard(this)) {\n throw new errorinfo_1.default('clientId must be specified to update presence data', 40012, 400);\n }\n return this._enterOrUpdateClient(undefined, undefined, data, 'update', callback);\n };\n RealtimePresence.prototype.enterClient = function (clientId, data, callback) {\n return this._enterOrUpdateClient(undefined, clientId, data, 'enter', callback);\n };\n RealtimePresence.prototype.updateClient = function (clientId, data, callback) {\n return this._enterOrUpdateClient(undefined, clientId, data, 'update', callback);\n };\n RealtimePresence.prototype._enterOrUpdateClient = function (id, clientId, data, action, callback) {\n var _this = this;\n if (!callback) {\n if (typeof data === 'function') {\n callback = data;\n data = null;\n }\n else {\n if (this.channel.realtime.options.promises) {\n return Utils.promisify(this, '_enterOrUpdateClient', [id, clientId, data, action]);\n }\n callback = noop;\n }\n }\n var channel = this.channel;\n if (!channel.connectionManager.activeState()) {\n callback(channel.connectionManager.getError());\n return;\n }\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimePresence.' + action + 'Client()', 'channel = ' + channel.name + ', id = ' + id + ', client = ' + (clientId || '(implicit) ' + getClientId(this)));\n var presence = presencemessage_1.default.fromData(data);\n presence.action = action;\n if (id) {\n presence.id = id;\n }\n if (clientId) {\n presence.clientId = clientId;\n }\n presencemessage_1.default.encode(presence, channel.channelOptions, function (err) {\n if (err) {\n callback(err);\n return;\n }\n switch (channel.state) {\n case 'attached':\n channel.sendPresence(presence, callback);\n break;\n case 'initialized':\n case 'detached':\n channel.attach();\n // eslint-disable-next-line no-fallthrough\n case 'attaching':\n _this.pendingPresence.push({\n presence: presence,\n callback: callback,\n });\n break;\n default:\n err = new errorinfo_1.PartialErrorInfo('Unable to ' + action + ' presence channel while in ' + channel.state + ' state', 90001);\n err.code = 90001;\n callback(err);\n }\n });\n };\n RealtimePresence.prototype.leave = function (data, callback) {\n if (isAnonymousOrWildcard(this)) {\n throw new errorinfo_1.default('clientId must have been specified to enter or leave a presence channel', 40012, 400);\n }\n return this.leaveClient(undefined, data, callback);\n };\n RealtimePresence.prototype.leaveClient = function (clientId, data, callback) {\n if (!callback) {\n if (typeof data === 'function') {\n callback = data;\n data = null;\n }\n else {\n if (this.channel.realtime.options.promises) {\n return Utils.promisify(this, 'leaveClient', [clientId, data]);\n }\n callback = noop;\n }\n }\n var channel = this.channel;\n if (!channel.connectionManager.activeState()) {\n callback === null || callback === void 0 ? void 0 : callback(channel.connectionManager.getError());\n return;\n }\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimePresence.leaveClient()', 'leaving; channel = ' + this.channel.name + ', client = ' + clientId);\n var presence = presencemessage_1.default.fromValues({\n action: 'leave',\n data: data,\n });\n if (clientId) {\n presence.clientId = clientId;\n }\n switch (channel.state) {\n case 'attached':\n channel.sendPresence(presence, callback);\n break;\n case 'attaching':\n this.pendingPresence.push({\n presence: presence,\n callback: callback,\n });\n break;\n case 'initialized':\n case 'failed': {\n /* we're not attached; therefore we let any entered status\n * timeout by itself instead of attaching just in order to leave */\n var err = new errorinfo_1.PartialErrorInfo('Unable to leave presence channel (incompatible state)', 90001);\n callback === null || callback === void 0 ? void 0 : callback(err);\n break;\n }\n default:\n callback === null || callback === void 0 ? void 0 : callback(channel.invalidStateError());\n }\n };\n // Return type is any to avoid conflict with base Presence class\n RealtimePresence.prototype.get = function (params, callback) {\n var _this = this;\n var args = Array.prototype.slice.call(arguments);\n if (args.length == 1 && typeof args[0] == 'function')\n args.unshift(null);\n params = args[0];\n callback = args[1];\n var waitForSync = !params || ('waitForSync' in params ? params.waitForSync : true);\n if (!callback) {\n if (this.channel.realtime.options.promises) {\n return Utils.promisify(this, 'get', args);\n }\n callback = noop;\n }\n function returnMembers(members) {\n callback(null, params ? members.list(params) : members.values());\n }\n /* Special-case the suspended state: can still get (stale) presence set if waitForSync is false */\n if (this.channel.state === 'suspended') {\n if (waitForSync) {\n callback(errorinfo_1.default.fromValues({\n statusCode: 400,\n code: 91005,\n message: 'Presence state is out of sync due to channel being in the SUSPENDED state',\n }));\n }\n else {\n returnMembers(this.members);\n }\n return;\n }\n waitAttached(this.channel, callback, function () {\n var members = _this.members;\n if (waitForSync) {\n members.waitSync(function () {\n returnMembers(members);\n });\n }\n else {\n returnMembers(members);\n }\n });\n };\n RealtimePresence.prototype.history = function (params, callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimePresence.history()', 'channel = ' + this.name);\n /* params and callback are optional; see if params contains the callback */\n if (callback === undefined) {\n if (typeof params == 'function') {\n callback = params;\n params = null;\n }\n else {\n if (this.channel.realtime.options.promises) {\n return Utils.promisify(this, 'history', arguments);\n }\n callback = noop;\n }\n }\n if (params && params.untilAttach) {\n if (this.channel.state === 'attached') {\n delete params.untilAttach;\n params.from_serial = this.channel.properties.attachSerial;\n }\n else {\n callback(new errorinfo_1.default('option untilAttach requires the channel to be attached, was: ' + this.channel.state, 40000, 400));\n }\n }\n presence_1.default.prototype._history.call(this, params, callback);\n };\n RealtimePresence.prototype.setPresence = function (presenceSet, isSync, syncChannelSerial) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimePresence.setPresence()', 'received presence for ' + presenceSet.length + ' participants; syncChannelSerial = ' + syncChannelSerial);\n var syncCursor, match;\n var members = this.members, myMembers = this._myMembers, broadcastMessages = [], connId = this.channel.connectionManager.connectionId;\n if (isSync) {\n this.members.startSync();\n if (syncChannelSerial && (match = syncChannelSerial.match(/^[\\w-]+:(.*)$/))) {\n syncCursor = match[1];\n }\n }\n for (var i = 0; i < presenceSet.length; i++) {\n var presence = presencemessage_1.default.fromValues(presenceSet[i]);\n switch (presence.action) {\n case 'leave':\n if (members.remove(presence)) {\n broadcastMessages.push(presence);\n }\n if (presence.connectionId === connId && !presence.isSynthesized()) {\n myMembers.remove(presence);\n }\n break;\n case 'enter':\n case 'present':\n case 'update':\n if (members.put(presence)) {\n broadcastMessages.push(presence);\n }\n if (presence.connectionId === connId) {\n myMembers.put(presence);\n }\n break;\n }\n }\n /* if this is the last (or only) message in a sequence of sync updates, end the sync */\n if (isSync && !syncCursor) {\n members.endSync();\n this.channel.syncChannelSerial = null;\n }\n /* broadcast to listeners */\n for (var i = 0; i < broadcastMessages.length; i++) {\n var presence = broadcastMessages[i];\n this.subscriptions.emit(presence.action, presence);\n }\n };\n RealtimePresence.prototype.onAttached = function (hasPresence) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimePresence.onAttached()', 'channel = ' + this.channel.name + ', hasPresence = ' + hasPresence);\n if (hasPresence) {\n this.members.startSync();\n }\n else {\n this._synthesizeLeaves(this.members.values());\n this.members.clear();\n }\n // RTP17f: Re-enter own members when moving into the attached state.\n this._ensureMyMembersPresent();\n /* NB this must be after the _ensureMyMembersPresent call, which may add items to pendingPresence */\n var pendingPresence = this.pendingPresence, pendingPresCount = pendingPresence.length;\n if (pendingPresCount) {\n this.pendingPresence = [];\n var presenceArray = [];\n var multicaster = multicaster_1.default.create();\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimePresence.onAttached', 'sending ' + pendingPresCount + ' queued presence messages');\n for (var i = 0; i < pendingPresCount; i++) {\n var event_1 = pendingPresence[i];\n presenceArray.push(event_1.presence);\n multicaster.push(event_1.callback);\n }\n this.channel.sendPresence(presenceArray, multicaster);\n }\n };\n RealtimePresence.prototype.actOnChannelState = function (state, hasPresence, err) {\n switch (state) {\n case 'attached':\n this.onAttached(hasPresence);\n break;\n case 'detached':\n case 'failed':\n this._clearMyMembers();\n this.members.clear();\n /* falls through */\n case 'suspended':\n this.failPendingPresence(err);\n break;\n }\n };\n RealtimePresence.prototype.failPendingPresence = function (err) {\n if (this.pendingPresence.length) {\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'RealtimeChannel.failPendingPresence', 'channel; name = ' + this.channel.name + ', err = ' + Utils.inspectError(err));\n for (var i = 0; i < this.pendingPresence.length; i++)\n try {\n this.pendingPresence[i].callback(err);\n // eslint-disable-next-line no-empty\n }\n catch (e) { }\n this.pendingPresence = [];\n }\n };\n RealtimePresence.prototype._clearMyMembers = function () {\n this._myMembers.clear();\n };\n RealtimePresence.prototype._ensureMyMembersPresent = function () {\n var _this = this;\n var myMembers = this._myMembers, reenterCb = function (err) {\n if (err) {\n var msg = 'Presence auto-re-enter failed: ' + err.toString();\n var wrappedErr = new errorinfo_1.default(msg, 91004, 400);\n logger_1.default.logAction(logger_1.default.LOG_ERROR, 'RealtimePresence._ensureMyMembersPresent()', msg);\n var change = new channelstatechange_1.default(_this.channel.state, _this.channel.state, true, false, wrappedErr);\n _this.channel.emit('update', change);\n }\n };\n for (var memberKey in myMembers.map) {\n var entry = myMembers.map[memberKey];\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'RealtimePresence._ensureMyMembersPresent()', 'Auto-reentering clientId \"' + entry.clientId + '\" into the presence set');\n // RTP17g: Send ENTER containing the member id, clientId and data\n // attributes.\n this._enterOrUpdateClient(entry.id, entry.clientId, entry.data, 'enter', reenterCb);\n }\n };\n RealtimePresence.prototype._synthesizeLeaves = function (items) {\n var subscriptions = this.subscriptions;\n Utils.arrForEach(items, function (item) {\n var presence = presencemessage_1.default.fromValues({\n action: 'leave',\n connectionId: item.connectionId,\n clientId: item.clientId,\n data: item.data,\n encoding: item.encoding,\n timestamp: Utils.now(),\n });\n subscriptions.emit('leave', presence);\n });\n };\n /* Deprecated */\n RealtimePresence.prototype.on = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n logger_1.default.deprecated('presence.on', 'presence.subscribe');\n this.subscribe.apply(this, args);\n };\n /* Deprecated */\n RealtimePresence.prototype.off = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n logger_1.default.deprecated('presence.off', 'presence.unsubscribe');\n this.unsubscribe.apply(this, args);\n };\n RealtimePresence.prototype.subscribe = function () {\n var _args = []; /* [event], listener, [callback] */\n for (var _i = 0 /* [event], listener, [callback] */; _i < arguments.length /* [event], listener, [callback] */; _i++ /* [event], listener, [callback] */) {\n _args[_i] = arguments[_i]; /* [event], listener, [callback] */\n }\n var args = realtimechannel_1.default.processListenerArgs(_args);\n var event = args[0];\n var listener = args[1];\n var callback = args[2];\n var channel = this.channel;\n if (!callback) {\n if (this.channel.realtime.options.promises) {\n return Utils.promisify(this, 'subscribe', [event, listener]);\n }\n callback = noop;\n }\n if (channel.state === 'failed') {\n callback(errorinfo_1.default.fromValues(channel.invalidStateError()));\n return;\n }\n this.subscriptions.on(event, listener);\n channel.attach(callback);\n };\n RealtimePresence.prototype.unsubscribe = function () {\n var _args = []; /* [event], listener */\n for (var _i = 0 /* [event], listener */; _i < arguments.length /* [event], listener */; _i++ /* [event], listener */) {\n _args[_i] = arguments[_i]; /* [event], listener */\n }\n var args = realtimechannel_1.default.processListenerArgs(_args);\n var event = args[0];\n var listener = args[1];\n this.subscriptions.off(event, listener);\n };\n return RealtimePresence;\n}(presence_1.default));\nvar PresenceMap = /** @class */ (function (_super) {\n tslib_1.__extends(PresenceMap, _super);\n function PresenceMap(presence, memberKey) {\n var _this = _super.call(this) || this;\n _this.presence = presence;\n _this.map = Object.create(null);\n _this.syncInProgress = false;\n _this.residualMembers = null;\n _this.memberKey = memberKey;\n return _this;\n }\n PresenceMap.prototype.get = function (key) {\n return this.map[key];\n };\n PresenceMap.prototype.getClient = function (clientId) {\n var map = this.map, result = [];\n for (var key in map) {\n var item = map[key];\n if (item.clientId == clientId && item.action != 'absent')\n result.push(item);\n }\n return result;\n };\n PresenceMap.prototype.list = function (params) {\n var map = this.map, clientId = params && params.clientId, connectionId = params && params.connectionId, result = [];\n for (var key in map) {\n var item = map[key];\n if (item.action === 'absent')\n continue;\n if (clientId && clientId != item.clientId)\n continue;\n if (connectionId && connectionId != item.connectionId)\n continue;\n result.push(item);\n }\n return result;\n };\n PresenceMap.prototype.put = function (item) {\n if (item.action === 'enter' || item.action === 'update') {\n item = presencemessage_1.default.fromValues(item);\n item.action = 'present';\n }\n var map = this.map, key = this.memberKey(item);\n /* we've seen this member, so do not remove it at the end of sync */\n if (this.residualMembers)\n delete this.residualMembers[key];\n /* compare the timestamp of the new item with any existing member (or ABSENT witness) */\n var existingItem = map[key];\n if (existingItem && !newerThan(item, existingItem)) {\n return false;\n }\n map[key] = item;\n return true;\n };\n PresenceMap.prototype.values = function () {\n var map = this.map, result = [];\n for (var key in map) {\n var item = map[key];\n if (item.action != 'absent')\n result.push(item);\n }\n return result;\n };\n PresenceMap.prototype.remove = function (item) {\n var map = this.map, key = this.memberKey(item);\n var existingItem = map[key];\n if (existingItem && !newerThan(item, existingItem)) {\n return false;\n }\n /* RTP2f */\n if (this.syncInProgress) {\n item = presencemessage_1.default.fromValues(item);\n item.action = 'absent';\n map[key] = item;\n }\n else {\n delete map[key];\n }\n return true;\n };\n PresenceMap.prototype.startSync = function () {\n var map = this.map, syncInProgress = this.syncInProgress;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'PresenceMap.startSync()', 'channel = ' + this.presence.channel.name + '; syncInProgress = ' + syncInProgress);\n /* we might be called multiple times while a sync is in progress */\n if (!this.syncInProgress) {\n this.residualMembers = Utils.copy(map);\n this.setInProgress(true);\n }\n };\n PresenceMap.prototype.endSync = function () {\n var map = this.map, syncInProgress = this.syncInProgress;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'PresenceMap.endSync()', 'channel = ' + this.presence.channel.name + '; syncInProgress = ' + syncInProgress);\n if (syncInProgress) {\n /* we can now strip out the ABSENT members, as we have\n * received all of the out-of-order sync messages */\n for (var memberKey in map) {\n var entry = map[memberKey];\n if (entry.action === 'absent') {\n delete map[memberKey];\n }\n }\n /* any members that were present at the start of the sync,\n * and have not been seen in sync, can be removed, and leave events emitted */\n this.presence._synthesizeLeaves(Utils.valuesArray(this.residualMembers));\n for (var memberKey in this.residualMembers) {\n delete map[memberKey];\n }\n this.residualMembers = null;\n /* finish, notifying any waiters */\n this.setInProgress(false);\n }\n this.emit('sync');\n };\n PresenceMap.prototype.waitSync = function (callback) {\n var syncInProgress = this.syncInProgress;\n logger_1.default.logAction(logger_1.default.LOG_MINOR, 'PresenceMap.waitSync()', 'channel = ' + this.presence.channel.name + '; syncInProgress = ' + syncInProgress);\n if (!syncInProgress) {\n callback();\n return;\n }\n this.once('sync', callback);\n };\n PresenceMap.prototype.clear = function () {\n this.map = {};\n this.setInProgress(false);\n this.residualMembers = null;\n };\n PresenceMap.prototype.setInProgress = function (inProgress) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, 'PresenceMap.setInProgress()', 'inProgress = ' + inProgress);\n this.syncInProgress = inProgress;\n this.presence.syncComplete = !inProgress;\n };\n return PresenceMap;\n}(eventemitter_1.default));\nexports.default = RealtimePresence;\n\n\n/***/ }),\n/* 55 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar enc_hex_1 = __webpack_require__(56);\nvar enc_utf8_1 = __webpack_require__(31);\nvar enc_base64_1 = __webpack_require__(11);\nvar lib_typedarrays_1 = tslib_1.__importDefault(__webpack_require__(5));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar BufferUtils = /** @class */ (function () {\n function BufferUtils() {\n this.base64CharSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n this.hexCharSet = '0123456789abcdef';\n }\n BufferUtils.prototype.isWordArray = function (ob) {\n return ob !== null && ob !== undefined && ob.sigBytes !== undefined;\n };\n BufferUtils.prototype.isArrayBuffer = function (ob) {\n return ob !== null && ob !== undefined && ob.constructor === ArrayBuffer;\n };\n BufferUtils.prototype.isTypedArray = function (ob) {\n return !!ArrayBuffer && ArrayBuffer.isView && ArrayBuffer.isView(ob);\n };\n // // https://gist.githubusercontent.com/jonleighton/958841/raw/f200e30dfe95212c0165ccf1ae000ca51e9de803/gistfile1.js\n BufferUtils.prototype.uint8ViewToBase64 = function (bytes) {\n var base64 = '';\n var encodings = this.base64CharSet;\n var byteLength = bytes.byteLength;\n var byteRemainder = byteLength % 3;\n var mainLength = byteLength - byteRemainder;\n var a, b, c, d;\n var chunk;\n // Main loop deals with bytes in chunks of 3\n for (var i = 0; i < mainLength; i = i + 3) {\n // Combine the three bytes into a single integer\n chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n // Use bitmasks to extract 6-bit segments from the triplet\n a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18\n b = (chunk & 258048) >> 12; // 258048 = (2^6 - 1) << 12\n c = (chunk & 4032) >> 6; // 4032 = (2^6 - 1) << 6\n d = chunk & 63; // 63 = 2^6 - 1\n // Convert the raw binary segments to the appropriate ASCII encoding\n base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];\n }\n // Deal with the remaining bytes and padding\n if (byteRemainder == 1) {\n chunk = bytes[mainLength];\n a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2\n // Set the 4 least significant bits to zero\n b = (chunk & 3) << 4; // 3 = 2^2 - 1\n base64 += encodings[a] + encodings[b] + '==';\n }\n else if (byteRemainder == 2) {\n chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];\n a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10\n b = (chunk & 1008) >> 4; // 1008 = (2^6 - 1) << 4\n // Set the 2 least significant bits to zero\n c = (chunk & 15) << 2; // 15 = 2^4 - 1\n base64 += encodings[a] + encodings[b] + encodings[c] + '=';\n }\n return base64;\n };\n BufferUtils.prototype.base64ToArrayBuffer = function (base64) {\n var binary_string = atob === null || atob === void 0 ? void 0 : atob(base64); // this will always be defined in browser so it's safe to cast\n var len = binary_string.length;\n var bytes = new Uint8Array(len);\n for (var i = 0; i < len; i++) {\n var ascii = binary_string.charCodeAt(i);\n bytes[i] = ascii;\n }\n return bytes.buffer;\n };\n BufferUtils.prototype.isBuffer = function (buffer) {\n return this.isArrayBuffer(buffer) || this.isWordArray(buffer) || this.isTypedArray(buffer);\n };\n /* In browsers, returns a Uint8Array */\n BufferUtils.prototype.toBuffer = function (buffer) {\n if (!ArrayBuffer) {\n throw new Error(\"Can't convert to Buffer: browser does not support the necessary types\");\n }\n if (this.isArrayBuffer(buffer)) {\n return new Uint8Array(buffer);\n }\n if (this.isTypedArray(buffer)) {\n return new Uint8Array(buffer.buffer);\n }\n if (this.isWordArray(buffer)) {\n /* Backported from unreleased CryptoJS\n * https://code.google.com/p/crypto-js/source/browse/branches/3.x/src/lib-typedarrays.js?r=661 */\n var arrayBuffer = new ArrayBuffer(buffer.sigBytes);\n var uint8View = new Uint8Array(arrayBuffer);\n for (var i = 0; i < buffer.sigBytes; i++) {\n uint8View[i] = (buffer.words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n }\n return uint8View;\n }\n throw new Error('BufferUtils.toBuffer expected an arraybuffer, typed array, or CryptoJS wordarray');\n };\n BufferUtils.prototype.toArrayBuffer = function (buffer) {\n if (this.isArrayBuffer(buffer)) {\n return buffer;\n }\n return this.toBuffer(buffer).buffer;\n };\n BufferUtils.prototype.toWordArray = function (buffer) {\n if (this.isTypedArray(buffer)) {\n buffer = buffer.buffer;\n }\n return this.isWordArray(buffer) ? buffer : lib_typedarrays_1.default.create(buffer);\n };\n BufferUtils.prototype.base64Encode = function (buffer) {\n if (this.isWordArray(buffer)) {\n return (0, enc_base64_1.stringify)(buffer);\n }\n return this.uint8ViewToBase64(this.toBuffer(buffer));\n };\n BufferUtils.prototype.base64Decode = function (str) {\n if (ArrayBuffer && platform_1.default.Config.atob) {\n return this.base64ToArrayBuffer(str);\n }\n return (0, enc_base64_1.parse)(str);\n };\n BufferUtils.prototype.hexEncode = function (buffer) {\n return (0, enc_hex_1.stringify)(this.toWordArray(buffer));\n };\n BufferUtils.prototype.hexDecode = function (string) {\n var wordArray = (0, enc_hex_1.parse)(string);\n return ArrayBuffer ? this.toArrayBuffer(wordArray) : wordArray;\n };\n BufferUtils.prototype.utf8Encode = function (string) {\n if (platform_1.default.Config.TextEncoder) {\n return new platform_1.default.Config.TextEncoder().encode(string).buffer;\n }\n return (0, enc_utf8_1.parse)(string);\n };\n /* For utf8 decoding we apply slightly stricter input validation than to\n * hexEncode/base64Encode/etc: in those we accept anything that Buffer.from\n * can take (in particular allowing strings, which are just interpreted as\n * binary); here we ensure that the input is actually a buffer since trying\n * to utf8-decode a string to another string is almost certainly a mistake */\n BufferUtils.prototype.utf8Decode = function (buffer) {\n if (!this.isBuffer(buffer)) {\n throw new Error('Expected input of utf8decode to be an arraybuffer, typed array, or CryptoJS wordarray');\n }\n if (TextDecoder && !this.isWordArray(buffer)) {\n return new TextDecoder().decode(buffer);\n }\n buffer = this.toWordArray(buffer);\n return (0, enc_utf8_1.stringify)(buffer);\n };\n BufferUtils.prototype.bufferCompare = function (buffer1, buffer2) {\n if (!buffer1)\n return -1;\n if (!buffer2)\n return 1;\n var wordArray1 = this.toWordArray(buffer1);\n var wordArray2 = this.toWordArray(buffer2);\n wordArray1.clamp();\n wordArray2.clamp();\n var cmp = wordArray1.sigBytes - wordArray2.sigBytes;\n if (cmp != 0)\n return cmp;\n var words1 = wordArray1.words;\n var words2 = wordArray2.words;\n for (var i = 0; i < words1.length; i++) {\n cmp = words1[i] - words2[i];\n if (cmp != 0)\n return cmp;\n }\n return 0;\n };\n BufferUtils.prototype.byteLength = function (buffer) {\n if (this.isArrayBuffer(buffer) || this.isTypedArray(buffer)) {\n return buffer.byteLength;\n }\n else if (this.isWordArray(buffer)) {\n return buffer.sigBytes;\n }\n return -1;\n };\n /* Returns ArrayBuffer on browser and Buffer on Node.js */\n BufferUtils.prototype.typedArrayToBuffer = function (typedArray) {\n return typedArray.buffer;\n };\n return BufferUtils;\n}());\nexports.default = new BufferUtils();\n\n\n/***/ }),\n/* 56 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.enc.Hex;\n\n}));\n\n/***/ }),\n/* 57 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);\n/* harmony import */ var crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var crypto_js_build_enc_base64__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);\n/* harmony import */ var crypto_js_build_enc_base64__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(crypto_js_build_enc_base64__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var crypto_js_build__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22);\n/* harmony import */ var crypto_js_build__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto_js_build__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);\n/* harmony import */ var _common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var common_lib_types_errorinfo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4);\n/* harmony import */ var common_lib_types_errorinfo__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(common_lib_types_errorinfo__WEBPACK_IMPORTED_MODULE_4__);\n\n\n\n\n\n\nvar CryptoFactory = function (config, bufferUtils) {\n var DEFAULT_ALGORITHM = 'aes';\n var DEFAULT_KEYLENGTH = 256; // bits\n var DEFAULT_MODE = 'cbc';\n var DEFAULT_BLOCKLENGTH = 16; // bytes\n var DEFAULT_BLOCKLENGTH_WORDS = 4; // 32-bit words\n var UINT32_SUP = 0x100000000;\n var INT32_SUP = 0x80000000;\n\n /**\n * Internal: generate an array of secure random words corresponding to the given length of bytes\n * @param bytes\n * @param callback\n */\n var generateRandom;\n if (config.getRandomWordArray) {\n generateRandom = config.getRandomWordArray;\n } else if (typeof Uint32Array !== 'undefined' && config.getRandomValues) {\n var blockRandomArray = new Uint32Array(DEFAULT_BLOCKLENGTH_WORDS);\n generateRandom = function (bytes, callback) {\n var words = bytes / 4,\n nativeArray = words == DEFAULT_BLOCKLENGTH_WORDS ? blockRandomArray : new Uint32Array(words);\n config.getRandomValues(nativeArray, function (err) {\n if (typeof callback !== 'undefined') {\n callback(err, bufferUtils.toWordArray(nativeArray));\n }\n });\n };\n } else {\n generateRandom = function (bytes, callback) {\n _common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3___default.a.logAction(\n _common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3___default.a.LOG_MAJOR,\n 'Ably.Crypto.generateRandom()',\n 'Warning: the browser you are using does not support secure cryptographically secure randomness generation; falling back to insecure Math.random()'\n );\n var words = bytes / 4,\n array = new Array(words);\n for (var i = 0; i < words; i++) {\n /* cryptojs wordarrays use signed ints. When WordArray.create is fed a\n * Uint32Array unsigned are converted to signed automatically, but when\n * fed a normal array they aren't, so need to do so ourselves by\n * subtracting INT32_SUP */\n array[i] = Math.floor(Math.random() * UINT32_SUP) - INT32_SUP;\n }\n\n callback(null, crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create(array));\n };\n }\n\n /**\n * Internal: calculate the padded length of a given plaintext\n * using PKCS5.\n * @param plaintextLength\n * @return\n */\n function getPaddedLength(plaintextLength) {\n return (plaintextLength + DEFAULT_BLOCKLENGTH) & -DEFAULT_BLOCKLENGTH;\n }\n\n /**\n * Internal: checks that the cipherParams are a valid combination. Currently\n * just checks that the calculated keyLength is a valid one for aes-cbc\n */\n function validateCipherParams(params) {\n if (params.algorithm === 'aes' && params.mode === 'cbc') {\n if (params.keyLength === 128 || params.keyLength === 256) {\n return;\n }\n throw new Error(\n 'Unsupported key length ' +\n params.keyLength +\n ' for aes-cbc encryption. Encryption key must be 128 or 256 bits (16 or 32 ASCII characters)'\n );\n }\n }\n\n function normaliseBase64(string) {\n /* url-safe base64 strings use _ and - instread of / and + */\n return string.replace('_', '/').replace('-', '+');\n }\n\n /**\n * Internal: obtain the pkcs5 padding string for a given padded length;\n */\n var pkcs5Padding = [\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x10101010, 0x10101010, 0x10101010, 0x10101010], 16),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x01000000], 1),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x02020000], 2),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x03030300], 3),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x04040404], 4),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x05050505, 0x05000000], 5),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x06060606, 0x06060000], 6),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x07070707, 0x07070700], 7),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x08080808, 0x08080808], 8),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x09090909, 0x09090909, 0x09000000], 9),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0000], 10),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b00], 11),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c], 12),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d000000], 13),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0000], 14),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f], 15),\n crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create([0x10101010, 0x10101010, 0x10101010, 0x10101010], 16),\n ];\n\n /**\n * Utility classes and interfaces for message payload encryption.\n *\n * This class supports AES/CBC/PKCS5 with a default keylength of 128 bits\n * but supporting other keylengths. Other algorithms and chaining modes are\n * not supported directly, but supportable by extending/implementing the base\n * classes and interfaces here.\n *-\n * Secure random data for creation of Initialization Vectors (IVs) and keys\n * is obtained from window.crypto.getRandomValues if available, or from\n * Math.random() if not. Clients who do not want to depend on Math.random()\n * should polyfill window.crypto.getRandomValues with a library that seeds\n * a PRNG with real entropy.\n *\n * Each message payload is encrypted with an IV in CBC mode, and the IV is\n * concatenated with the resulting raw ciphertext to construct the \"ciphertext\"\n * data passed to the recipient.\n */\n function Crypto() {}\n\n /**\n * A class encapsulating the client-specifiable parameters for\n * the cipher.\n *\n * algorithm is the name of the algorithm in the default system provider,\n * or the lower-cased version of it; eg \"aes\" or \"AES\".\n *\n * Clients are recommended to not call this directly, but instead to use the\n * Crypto.getDefaultParams helper, which will fill in any fields not supplied\n * with default values and validation the result.\n */\n function CipherParams() {\n this.algorithm = null;\n this.keyLength = null;\n this.mode = null;\n this.key = null;\n }\n Crypto.CipherParams = CipherParams;\n\n /**\n * Obtain a complete CipherParams instance from the provided params, filling\n * in any not provided with default values, calculating a keyLength from\n * the supplied key, and validating the result.\n * @param params an object containing at a minimum a `key` key with value the\n * key, as either a binary (ArrayBuffer, Array, WordArray) or a\n * base64-encoded string. May optionally also contain: algorithm (defaults to\n * AES), mode (defaults to 'cbc')\n */\n Crypto.getDefaultParams = function (params) {\n var key;\n /* Backward compatibility */\n if (typeof params === 'function' || typeof params === 'string') {\n _common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3___default.a.deprecated('Crypto.getDefaultParams(key, callback)', 'Crypto.getDefaultParams({key: key})');\n if (typeof params === 'function') {\n Crypto.generateRandomKey(function (key) {\n params(null, Crypto.getDefaultParams({ key: key }));\n });\n } else if (typeof arguments[1] === 'function') {\n arguments[1](null, Crypto.getDefaultParams({ key: params }));\n } else {\n throw new Error('Invalid arguments for Crypto.getDefaultParams');\n }\n return;\n }\n\n if (!params.key) {\n throw new Error('Crypto.getDefaultParams: a key is required');\n }\n\n if (typeof params.key === 'string') {\n key = Object(crypto_js_build_enc_base64__WEBPACK_IMPORTED_MODULE_1__[\"parse\"])(normaliseBase64(params.key));\n } else {\n key = bufferUtils.toWordArray(params.key); // Expect key to be an Array, ArrayBuffer, or WordArray at this point\n }\n\n var cipherParams = new CipherParams();\n cipherParams.key = key;\n cipherParams.algorithm = params.algorithm || DEFAULT_ALGORITHM;\n cipherParams.keyLength = key.words.length * (4 * 8);\n cipherParams.mode = params.mode || DEFAULT_MODE;\n\n if (params.keyLength && params.keyLength !== cipherParams.keyLength) {\n throw new Error(\n 'Crypto.getDefaultParams: a keyLength of ' +\n params.keyLength +\n ' was specified, but the key actually has length ' +\n cipherParams.keyLength\n );\n }\n\n validateCipherParams(cipherParams);\n return cipherParams;\n };\n\n /**\n * Generate a random encryption key from the supplied keylength (or the\n * default keyLength if none supplied) as a CryptoJS WordArray\n * @param keyLength (optional) the required keyLength in bits\n * @param callback (optional) (err, key)\n */\n Crypto.generateRandomKey = function (keyLength, callback) {\n if (arguments.length == 1 && typeof keyLength == 'function') {\n callback = keyLength;\n keyLength = undefined;\n }\n\n generateRandom((keyLength || DEFAULT_KEYLENGTH) / 8, function (err, buf) {\n if (callback !== undefined) {\n callback(err ? common_lib_types_errorinfo__WEBPACK_IMPORTED_MODULE_4___default.a.fromValues(err) : null, buf);\n }\n });\n };\n\n /**\n * Internal; get a ChannelCipher instance based on the given cipherParams\n * @param params either a CipherParams instance or some subset of its\n * fields that includes a key\n */\n Crypto.getCipher = function (params) {\n var cipherParams = params instanceof CipherParams ? params : Crypto.getDefaultParams(params);\n\n return { cipherParams: cipherParams, cipher: new CBCCipher(cipherParams, DEFAULT_BLOCKLENGTH_WORDS, params.iv) };\n };\n\n function CBCCipher(params, blockLengthWords, iv) {\n this.algorithm = params.algorithm + '-' + String(params.keyLength) + '-' + params.mode;\n this.cjsAlgorithm = params.algorithm.toUpperCase().replace(/-\\d+$/, '');\n this.key = bufferUtils.toWordArray(params.key);\n if (iv) {\n this.iv = bufferUtils.toWordArray(iv).clone();\n }\n this.blockLengthWords = blockLengthWords;\n }\n\n CBCCipher.prototype.encrypt = function (plaintext, callback) {\n _common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3___default.a.logAction(_common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3___default.a.LOG_MICRO, 'CBCCipher.encrypt()', '');\n plaintext = bufferUtils.toWordArray(plaintext);\n var plaintextLength = plaintext.sigBytes,\n paddedLength = getPaddedLength(plaintextLength),\n self = this;\n\n var then = function () {\n self.getIv(function (err, iv) {\n if (err) {\n callback(err);\n return;\n }\n var cipherOut = self.encryptCipher.process(plaintext.concat(pkcs5Padding[paddedLength - plaintextLength]));\n var ciphertext = iv.concat(cipherOut);\n callback(null, ciphertext);\n });\n };\n\n if (!this.encryptCipher) {\n if (this.iv) {\n this.encryptCipher = crypto_js_build__WEBPACK_IMPORTED_MODULE_2___default.a.algo[this.cjsAlgorithm].createEncryptor(this.key, { iv: this.iv });\n then();\n } else {\n generateRandom(DEFAULT_BLOCKLENGTH, function (err, iv) {\n if (err) {\n callback(err);\n return;\n }\n self.encryptCipher = crypto_js_build__WEBPACK_IMPORTED_MODULE_2___default.a.algo[self.cjsAlgorithm].createEncryptor(self.key, { iv: iv });\n self.iv = iv;\n then();\n });\n }\n } else {\n then();\n }\n };\n\n CBCCipher.prototype.decrypt = function (ciphertext) {\n _common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3___default.a.logAction(_common_lib_util_logger__WEBPACK_IMPORTED_MODULE_3___default.a.LOG_MICRO, 'CBCCipher.decrypt()', '');\n ciphertext = bufferUtils.toWordArray(ciphertext);\n var blockLengthWords = this.blockLengthWords,\n ciphertextWords = ciphertext.words,\n iv = crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create(ciphertextWords.slice(0, blockLengthWords)),\n ciphertextBody = crypto_js_build_lib_typedarrays__WEBPACK_IMPORTED_MODULE_0___default.a.create(ciphertextWords.slice(blockLengthWords));\n\n var decryptCipher = crypto_js_build__WEBPACK_IMPORTED_MODULE_2___default.a.algo[this.cjsAlgorithm].createDecryptor(this.key, { iv: iv });\n var plaintext = decryptCipher.process(ciphertextBody);\n var epilogue = decryptCipher.finalize();\n decryptCipher.reset();\n if (epilogue && epilogue.sigBytes) plaintext.concat(epilogue);\n return plaintext;\n };\n\n CBCCipher.prototype.getIv = function (callback) {\n if (this.iv) {\n var iv = this.iv;\n this.iv = null;\n callback(null, iv);\n return;\n }\n\n /* Since the iv for a new block is the ciphertext of the last, this\n * sets a new iv (= aes(randomBlock XOR lastCipherText)) as well as\n * returning it */\n var self = this;\n generateRandom(DEFAULT_BLOCKLENGTH, function (err, randomBlock) {\n if (err) {\n callback(err);\n return;\n }\n callback(null, self.encryptCipher.process(randomBlock));\n });\n };\n\n return Crypto;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (CryptoFactory);\n\n\n/***/ }),\n/* 58 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var C_enc = C.enc;\n\n\t /**\n\t * UTF-16 BE encoding strategy.\n\t */\n\t var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {\n\t /**\n\t * Converts a word array to a UTF-16 BE string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-16 BE string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var utf16Chars = [];\n\t for (var i = 0; i < sigBytes; i += 2) {\n\t var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;\n\t utf16Chars.push(String.fromCharCode(codePoint));\n\t }\n\n\t return utf16Chars.join('');\n\t },\n\n\t /**\n\t * Converts a UTF-16 BE string to a word array.\n\t *\n\t * @param {string} utf16Str The UTF-16 BE string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf16.parse(utf16String);\n\t */\n\t parse: function (utf16Str) {\n\t // Shortcut\n\t var utf16StrLength = utf16Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < utf16StrLength; i++) {\n\t words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);\n\t }\n\n\t return WordArray.create(words, utf16StrLength * 2);\n\t }\n\t };\n\n\t /**\n\t * UTF-16 LE encoding strategy.\n\t */\n\t C_enc.Utf16LE = {\n\t /**\n\t * Converts a word array to a UTF-16 LE string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-16 LE string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var utf16Chars = [];\n\t for (var i = 0; i < sigBytes; i += 2) {\n\t var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);\n\t utf16Chars.push(String.fromCharCode(codePoint));\n\t }\n\n\t return utf16Chars.join('');\n\t },\n\n\t /**\n\t * Converts a UTF-16 LE string to a word array.\n\t *\n\t * @param {string} utf16Str The UTF-16 LE string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);\n\t */\n\t parse: function (utf16Str) {\n\t // Shortcut\n\t var utf16StrLength = utf16Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < utf16StrLength; i++) {\n\t words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));\n\t }\n\n\t return WordArray.create(words, utf16StrLength * 2);\n\t }\n\t };\n\n\t function swapEndian(word) {\n\t return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);\n\t }\n\t}());\n\n\n\treturn CryptoJS.enc.Utf16;\n\n}));\n\n/***/ }),\n/* 59 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6), __webpack_require__(28));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function (undefined) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var CipherParams = C_lib.CipherParams;\n\t var C_enc = C.enc;\n\t var Hex = C_enc.Hex;\n\t var C_format = C.format;\n\n\t var HexFormatter = C_format.Hex = {\n\t /**\n\t * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.\n\t *\n\t * @param {CipherParams} cipherParams The cipher params object.\n\t *\n\t * @return {string} The hexadecimally encoded string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.format.Hex.stringify(cipherParams);\n\t */\n\t stringify: function (cipherParams) {\n\t return cipherParams.ciphertext.toString(Hex);\n\t },\n\n\t /**\n\t * Converts a hexadecimally encoded ciphertext string to a cipher params object.\n\t *\n\t * @param {string} input The hexadecimally encoded string.\n\t *\n\t * @return {CipherParams} The cipher params object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var cipherParams = CryptoJS.format.Hex.parse(hexString);\n\t */\n\t parse: function (input) {\n\t var ciphertext = Hex.parse(input);\n\t return CipherParams.create({ ciphertext: ciphertext });\n\t }\n\t };\n\t}());\n\n\n\treturn CryptoJS.format.Hex;\n\n}));\n\n/***/ }),\n/* 60 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6), __webpack_require__(11), __webpack_require__(61), __webpack_require__(27), __webpack_require__(28));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var BlockCipher = C_lib.BlockCipher;\n\t var C_algo = C.algo;\n\n\t // Lookup tables\n\t var SBOX = [];\n\t var INV_SBOX = [];\n\t var SUB_MIX_0 = [];\n\t var SUB_MIX_1 = [];\n\t var SUB_MIX_2 = [];\n\t var SUB_MIX_3 = [];\n\t var INV_SUB_MIX_0 = [];\n\t var INV_SUB_MIX_1 = [];\n\t var INV_SUB_MIX_2 = [];\n\t var INV_SUB_MIX_3 = [];\n\n\t // Compute lookup tables\n\t (function () {\n\t // Compute double table\n\t var d = [];\n\t for (var i = 0; i < 256; i++) {\n\t if (i < 128) {\n\t d[i] = i << 1;\n\t } else {\n\t d[i] = (i << 1) ^ 0x11b;\n\t }\n\t }\n\n\t // Walk GF(2^8)\n\t var x = 0;\n\t var xi = 0;\n\t for (var i = 0; i < 256; i++) {\n\t // Compute sbox\n\t var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);\n\t sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;\n\t SBOX[x] = sx;\n\t INV_SBOX[sx] = x;\n\n\t // Compute multiplication\n\t var x2 = d[x];\n\t var x4 = d[x2];\n\t var x8 = d[x4];\n\n\t // Compute sub bytes, mix columns tables\n\t var t = (d[sx] * 0x101) ^ (sx * 0x1010100);\n\t SUB_MIX_0[x] = (t << 24) | (t >>> 8);\n\t SUB_MIX_1[x] = (t << 16) | (t >>> 16);\n\t SUB_MIX_2[x] = (t << 8) | (t >>> 24);\n\t SUB_MIX_3[x] = t;\n\n\t // Compute inv sub bytes, inv mix columns tables\n\t var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);\n\t INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);\n\t INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);\n\t INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);\n\t INV_SUB_MIX_3[sx] = t;\n\n\t // Compute next counter\n\t if (!x) {\n\t x = xi = 1;\n\t } else {\n\t x = x2 ^ d[d[d[x8 ^ x2]]];\n\t xi ^= d[d[xi]];\n\t }\n\t }\n\t }());\n\n\t // Precomputed Rcon lookup\n\t var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n\n\t /**\n\t * AES block cipher algorithm.\n\t */\n\t var AES = C_algo.AES = BlockCipher.extend({\n\t _doReset: function () {\n\t var t;\n\n\t // Skip reset of nRounds has been set before and key did not change\n\t if (this._nRounds && this._keyPriorReset === this._key) {\n\t return;\n\t }\n\n\t // Shortcuts\n\t var key = this._keyPriorReset = this._key;\n\t var keyWords = key.words;\n\t var keySize = key.sigBytes / 4;\n\n\t // Compute number of rounds\n\t var nRounds = this._nRounds = keySize + 6;\n\n\t // Compute number of key schedule rows\n\t var ksRows = (nRounds + 1) * 4;\n\n\t // Compute key schedule\n\t var keySchedule = this._keySchedule = [];\n\t for (var ksRow = 0; ksRow < ksRows; ksRow++) {\n\t if (ksRow < keySize) {\n\t keySchedule[ksRow] = keyWords[ksRow];\n\t } else {\n\t t = keySchedule[ksRow - 1];\n\n\t if (!(ksRow % keySize)) {\n\t // Rot word\n\t t = (t << 8) | (t >>> 24);\n\n\t // Sub word\n\t t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];\n\n\t // Mix Rcon\n\t t ^= RCON[(ksRow / keySize) | 0] << 24;\n\t } else if (keySize > 6 && ksRow % keySize == 4) {\n\t // Sub word\n\t t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];\n\t }\n\n\t keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;\n\t }\n\t }\n\n\t // Compute inv key schedule\n\t var invKeySchedule = this._invKeySchedule = [];\n\t for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {\n\t var ksRow = ksRows - invKsRow;\n\n\t if (invKsRow % 4) {\n\t var t = keySchedule[ksRow];\n\t } else {\n\t var t = keySchedule[ksRow - 4];\n\t }\n\n\t if (invKsRow < 4 || ksRow <= 4) {\n\t invKeySchedule[invKsRow] = t;\n\t } else {\n\t invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^\n\t INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];\n\t }\n\t }\n\t },\n\n\t encryptBlock: function (M, offset) {\n\t this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);\n\t },\n\n\t decryptBlock: function (M, offset) {\n\t // Swap 2nd and 4th rows\n\t var t = M[offset + 1];\n\t M[offset + 1] = M[offset + 3];\n\t M[offset + 3] = t;\n\n\t this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);\n\n\t // Inv swap 2nd and 4th rows\n\t var t = M[offset + 1];\n\t M[offset + 1] = M[offset + 3];\n\t M[offset + 3] = t;\n\t },\n\n\t _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {\n\t // Shortcut\n\t var nRounds = this._nRounds;\n\n\t // Get input, add round key\n\t var s0 = M[offset] ^ keySchedule[0];\n\t var s1 = M[offset + 1] ^ keySchedule[1];\n\t var s2 = M[offset + 2] ^ keySchedule[2];\n\t var s3 = M[offset + 3] ^ keySchedule[3];\n\n\t // Key schedule row counter\n\t var ksRow = 4;\n\n\t // Rounds\n\t for (var round = 1; round < nRounds; round++) {\n\t // Shift rows, sub bytes, mix columns, add round key\n\t var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];\n\t var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];\n\t var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];\n\t var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];\n\n\t // Update state\n\t s0 = t0;\n\t s1 = t1;\n\t s2 = t2;\n\t s3 = t3;\n\t }\n\n\t // Shift rows, sub bytes, add round key\n\t var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];\n\t var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];\n\t var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];\n\t var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];\n\n\t // Set output\n\t M[offset] = t0;\n\t M[offset + 1] = t1;\n\t M[offset + 2] = t2;\n\t M[offset + 3] = t3;\n\t },\n\n\t keySize: 256/32\n\t });\n\n\t /**\n\t * Shortcut functions to the cipher's object interface.\n\t *\n\t * @example\n\t *\n\t * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);\n\t * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);\n\t */\n\t C.AES = BlockCipher._createHelper(AES);\n\t}());\n\n\n\treturn CryptoJS.AES;\n\n}));\n\n/***/ }),\n/* 61 */\n/***/ (function(module, exports, __webpack_require__) {\n\n;(function (root, factory) {\n\tif (true) {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(__webpack_require__(6));\n\t}\n\telse {}\n}(this, function (CryptoJS) {\n\n\t(function (Math) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Constants table\n\t var T = [];\n\n\t // Compute constants\n\t (function () {\n\t for (var i = 0; i < 64; i++) {\n\t T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;\n\t }\n\t }());\n\n\t /**\n\t * MD5 hash algorithm.\n\t */\n\t var MD5 = C_algo.MD5 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init([\n\t 0x67452301, 0xefcdab89,\n\t 0x98badcfe, 0x10325476\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Swap endian\n\t for (var i = 0; i < 16; i++) {\n\t // Shortcuts\n\t var offset_i = offset + i;\n\t var M_offset_i = M[offset_i];\n\n\t M[offset_i] = (\n\t (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |\n\t (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)\n\t );\n\t }\n\n\t // Shortcuts\n\t var H = this._hash.words;\n\n\t var M_offset_0 = M[offset + 0];\n\t var M_offset_1 = M[offset + 1];\n\t var M_offset_2 = M[offset + 2];\n\t var M_offset_3 = M[offset + 3];\n\t var M_offset_4 = M[offset + 4];\n\t var M_offset_5 = M[offset + 5];\n\t var M_offset_6 = M[offset + 6];\n\t var M_offset_7 = M[offset + 7];\n\t var M_offset_8 = M[offset + 8];\n\t var M_offset_9 = M[offset + 9];\n\t var M_offset_10 = M[offset + 10];\n\t var M_offset_11 = M[offset + 11];\n\t var M_offset_12 = M[offset + 12];\n\t var M_offset_13 = M[offset + 13];\n\t var M_offset_14 = M[offset + 14];\n\t var M_offset_15 = M[offset + 15];\n\n\t // Working varialbes\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\n\t // Computation\n\t a = FF(a, b, c, d, M_offset_0, 7, T[0]);\n\t d = FF(d, a, b, c, M_offset_1, 12, T[1]);\n\t c = FF(c, d, a, b, M_offset_2, 17, T[2]);\n\t b = FF(b, c, d, a, M_offset_3, 22, T[3]);\n\t a = FF(a, b, c, d, M_offset_4, 7, T[4]);\n\t d = FF(d, a, b, c, M_offset_5, 12, T[5]);\n\t c = FF(c, d, a, b, M_offset_6, 17, T[6]);\n\t b = FF(b, c, d, a, M_offset_7, 22, T[7]);\n\t a = FF(a, b, c, d, M_offset_8, 7, T[8]);\n\t d = FF(d, a, b, c, M_offset_9, 12, T[9]);\n\t c = FF(c, d, a, b, M_offset_10, 17, T[10]);\n\t b = FF(b, c, d, a, M_offset_11, 22, T[11]);\n\t a = FF(a, b, c, d, M_offset_12, 7, T[12]);\n\t d = FF(d, a, b, c, M_offset_13, 12, T[13]);\n\t c = FF(c, d, a, b, M_offset_14, 17, T[14]);\n\t b = FF(b, c, d, a, M_offset_15, 22, T[15]);\n\n\t a = GG(a, b, c, d, M_offset_1, 5, T[16]);\n\t d = GG(d, a, b, c, M_offset_6, 9, T[17]);\n\t c = GG(c, d, a, b, M_offset_11, 14, T[18]);\n\t b = GG(b, c, d, a, M_offset_0, 20, T[19]);\n\t a = GG(a, b, c, d, M_offset_5, 5, T[20]);\n\t d = GG(d, a, b, c, M_offset_10, 9, T[21]);\n\t c = GG(c, d, a, b, M_offset_15, 14, T[22]);\n\t b = GG(b, c, d, a, M_offset_4, 20, T[23]);\n\t a = GG(a, b, c, d, M_offset_9, 5, T[24]);\n\t d = GG(d, a, b, c, M_offset_14, 9, T[25]);\n\t c = GG(c, d, a, b, M_offset_3, 14, T[26]);\n\t b = GG(b, c, d, a, M_offset_8, 20, T[27]);\n\t a = GG(a, b, c, d, M_offset_13, 5, T[28]);\n\t d = GG(d, a, b, c, M_offset_2, 9, T[29]);\n\t c = GG(c, d, a, b, M_offset_7, 14, T[30]);\n\t b = GG(b, c, d, a, M_offset_12, 20, T[31]);\n\n\t a = HH(a, b, c, d, M_offset_5, 4, T[32]);\n\t d = HH(d, a, b, c, M_offset_8, 11, T[33]);\n\t c = HH(c, d, a, b, M_offset_11, 16, T[34]);\n\t b = HH(b, c, d, a, M_offset_14, 23, T[35]);\n\t a = HH(a, b, c, d, M_offset_1, 4, T[36]);\n\t d = HH(d, a, b, c, M_offset_4, 11, T[37]);\n\t c = HH(c, d, a, b, M_offset_7, 16, T[38]);\n\t b = HH(b, c, d, a, M_offset_10, 23, T[39]);\n\t a = HH(a, b, c, d, M_offset_13, 4, T[40]);\n\t d = HH(d, a, b, c, M_offset_0, 11, T[41]);\n\t c = HH(c, d, a, b, M_offset_3, 16, T[42]);\n\t b = HH(b, c, d, a, M_offset_6, 23, T[43]);\n\t a = HH(a, b, c, d, M_offset_9, 4, T[44]);\n\t d = HH(d, a, b, c, M_offset_12, 11, T[45]);\n\t c = HH(c, d, a, b, M_offset_15, 16, T[46]);\n\t b = HH(b, c, d, a, M_offset_2, 23, T[47]);\n\n\t a = II(a, b, c, d, M_offset_0, 6, T[48]);\n\t d = II(d, a, b, c, M_offset_7, 10, T[49]);\n\t c = II(c, d, a, b, M_offset_14, 15, T[50]);\n\t b = II(b, c, d, a, M_offset_5, 21, T[51]);\n\t a = II(a, b, c, d, M_offset_12, 6, T[52]);\n\t d = II(d, a, b, c, M_offset_3, 10, T[53]);\n\t c = II(c, d, a, b, M_offset_10, 15, T[54]);\n\t b = II(b, c, d, a, M_offset_1, 21, T[55]);\n\t a = II(a, b, c, d, M_offset_8, 6, T[56]);\n\t d = II(d, a, b, c, M_offset_15, 10, T[57]);\n\t c = II(c, d, a, b, M_offset_6, 15, T[58]);\n\t b = II(b, c, d, a, M_offset_13, 21, T[59]);\n\t a = II(a, b, c, d, M_offset_4, 6, T[60]);\n\t d = II(d, a, b, c, M_offset_11, 10, T[61]);\n\t c = II(c, d, a, b, M_offset_2, 15, T[62]);\n\t b = II(b, c, d, a, M_offset_9, 21, T[63]);\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\n\t var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);\n\t var nBitsTotalL = nBitsTotal;\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (\n\t (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |\n\t (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)\n\t );\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (\n\t (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |\n\t (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)\n\t );\n\n\t data.sigBytes = (dataWords.length + 1) * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Shortcuts\n\t var hash = this._hash;\n\t var H = hash.words;\n\n\t // Swap endian\n\t for (var i = 0; i < 4; i++) {\n\t // Shortcut\n\t var H_i = H[i];\n\n\t H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |\n\t (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);\n\t }\n\n\t // Return final computed hash\n\t return hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t function FF(a, b, c, d, x, s, t) {\n\t var n = a + ((b & c) | (~b & d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function GG(a, b, c, d, x, s, t) {\n\t var n = a + ((b & d) | (c & ~d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function HH(a, b, c, d, x, s, t) {\n\t var n = a + (b ^ c ^ d) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function II(a, b, c, d, x, s, t) {\n\t var n = a + (c ^ (b | ~d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.MD5('message');\n\t * var hash = CryptoJS.MD5(wordArray);\n\t */\n\t C.MD5 = Hasher._createHelper(MD5);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacMD5(message, key);\n\t */\n\t C.HmacMD5 = Hasher._createHmacHelper(MD5);\n\t}(Math));\n\n\n\treturn CryptoJS.MD5;\n\n}));\n\n/***/ }),\n/* 62 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar _a;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar defaults_1 = tslib_1.__importDefault(__webpack_require__(8));\nvar errorinfo_1 = __webpack_require__(4);\nvar HttpMethods_1 = tslib_1.__importDefault(__webpack_require__(18));\nvar xhrrequest_1 = tslib_1.__importDefault(__webpack_require__(16));\nvar XHRStates_1 = tslib_1.__importDefault(__webpack_require__(21));\nvar logger_1 = tslib_1.__importDefault(__webpack_require__(2));\nvar jsonptransport_1 = __webpack_require__(29);\nvar fetchrequest_1 = tslib_1.__importDefault(__webpack_require__(63));\nvar HttpStatusCodes_1 = __webpack_require__(25);\nfunction shouldFallback(errorInfo) {\n var statusCode = errorInfo.statusCode;\n /* 400 + no code = a generic xhr onerror. Browser doesn't give us enough\n * detail to know whether it's fallback-fixable, but it may be (eg if a\n * network issue), so try just in case */\n return ((statusCode === 408 && !errorInfo.code) ||\n (statusCode === 400 && !errorInfo.code) ||\n (statusCode >= 500 && statusCode <= 504));\n}\nfunction getHosts(client) {\n /* If we're a connected realtime client, try the endpoint we're connected\n * to first -- but still have fallbacks, being connected is not an absolute\n * guarantee that a datacenter has free capacity to service REST requests. */\n var connection = client.connection, connectionHost = connection && connection.connectionManager.host;\n if (connectionHost) {\n return [connectionHost].concat(defaults_1.default.getFallbackHosts(client.options));\n }\n return defaults_1.default.getHosts(client.options);\n}\nvar Http = (_a = /** @class */ (function () {\n function class_1(options) {\n this.checksInProgress = null;\n this.checkConnectivity = undefined;\n this.supportsAuthHeaders = false;\n this.supportsLinkHeaders = false;\n this._getHosts = getHosts;\n this.options = options || {};\n var connectivityCheckUrl = this.options.connectivityCheckUrl || defaults_1.default.connectivityCheckUrl;\n var connectivityCheckParams = this.options.connectivityCheckParams;\n var connectivityUrlIsDefault = !this.options.connectivityCheckUrl;\n if (platform_1.default.Config.xhrSupported) {\n this.supportsAuthHeaders = true;\n this.Request = function (method, rest, uri, headers, params, body, callback) {\n var req = xhrrequest_1.default.createRequest(uri, headers, params, body, XHRStates_1.default.REQ_SEND, rest && rest.options.timeouts, method);\n req.once('complete', callback);\n req.exec();\n return req;\n };\n if (this.options.disableConnectivityCheck) {\n this.checkConnectivity = function (callback) {\n callback(null, true);\n };\n }\n else {\n this.checkConnectivity = function (callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, '(XHRRequest)Http.checkConnectivity()', 'Sending; ' + connectivityCheckUrl);\n this.doUri(HttpMethods_1.default.Get, null, connectivityCheckUrl, null, null, connectivityCheckParams, function (err, responseText, headers, unpacked, statusCode) {\n var result = false;\n if (!connectivityUrlIsDefault) {\n result = !err && (0, HttpStatusCodes_1.isSuccessCode)(statusCode);\n }\n else {\n result = !err && (responseText === null || responseText === void 0 ? void 0 : responseText.replace(/\\n/, '')) == 'yes';\n }\n logger_1.default.logAction(logger_1.default.LOG_MICRO, '(XHRRequest)Http.checkConnectivity()', 'Result: ' + result);\n callback(null, result);\n });\n };\n }\n }\n else if (platform_1.default.Config.jsonpSupported) {\n this.Request = function (method, rest, uri, headers, params, body, callback) {\n var req = (0, jsonptransport_1.createRequest)(uri, headers, params, body, XHRStates_1.default.REQ_SEND, rest && rest.options.timeouts, method);\n req.once('complete', callback);\n platform_1.default.Config.nextTick(function () {\n req.exec();\n });\n return req;\n };\n if (this.options.disableConnectivityCheck) {\n this.checkConnectivity = function (callback) {\n callback(null, true);\n };\n }\n else {\n this.checkConnectivity = function (callback) {\n var _this = this;\n var upUrl = defaults_1.default.jsonpInternetUpUrl;\n if (this.checksInProgress) {\n this.checksInProgress.push(callback);\n return;\n }\n this.checksInProgress = [callback];\n logger_1.default.logAction(logger_1.default.LOG_MICRO, '(JSONP)Http.checkConnectivity()', 'Sending; ' + upUrl);\n var req = new jsonptransport_1.Request('isTheInternetUp', upUrl, null, null, null, XHRStates_1.default.REQ_SEND, defaults_1.default.TIMEOUTS);\n req.once('complete', function (err, response) {\n var result = !err && response;\n logger_1.default.logAction(logger_1.default.LOG_MICRO, '(JSONP)Http.checkConnectivity()', 'Result: ' + result);\n for (var i = 0; i < _this.checksInProgress.length; i++)\n _this.checksInProgress[i](null, result);\n _this.checksInProgress = null;\n });\n platform_1.default.Config.nextTick(function () {\n req.exec();\n });\n };\n }\n }\n else if (platform_1.default.Config.fetchSupported) {\n this.supportsAuthHeaders = true;\n this.Request = fetchrequest_1.default;\n this.checkConnectivity = function (callback) {\n logger_1.default.logAction(logger_1.default.LOG_MICRO, '(Fetch)Http.checkConnectivity()', 'Sending; ' + connectivityCheckUrl);\n this.doUri(HttpMethods_1.default.Get, null, connectivityCheckUrl, null, null, null, function (err, responseText) {\n var result = !err && (responseText === null || responseText === void 0 ? void 0 : responseText.replace(/\\n/, '')) == 'yes';\n logger_1.default.logAction(logger_1.default.LOG_MICRO, '(Fetch)Http.checkConnectivity()', 'Result: ' + result);\n callback(null, result);\n });\n };\n }\n else {\n this.Request = function (method, rest, uri, headers, params, body, callback) {\n callback(new errorinfo_1.PartialErrorInfo('no supported HTTP transports available', null, 400), null);\n };\n }\n }\n /* Unlike for doUri, the 'rest' param here is mandatory, as it's used to generate the hosts */\n class_1.prototype.do = function (method, rest, path, headers, body, params, callback) {\n var _this = this;\n var uriFromHost = typeof path == 'function'\n ? path\n : function (host) {\n return rest.baseUri(host) + path;\n };\n var currentFallback = rest._currentFallback;\n if (currentFallback) {\n if (currentFallback.validUntil > Utils.now()) {\n /* Use stored fallback */\n if (!this.Request) {\n callback === null || callback === void 0 ? void 0 : callback(new errorinfo_1.PartialErrorInfo('Request invoked before assigned to', null, 500));\n return;\n }\n this.Request(method, rest, uriFromHost(currentFallback.host), headers, params, body, function (err) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n // This typecast is safe because ErrnoExceptions are only thrown in NodeJS\n if (err && shouldFallback(err)) {\n /* unstore the fallback and start from the top with the default sequence */\n rest._currentFallback = null;\n _this.do(method, rest, path, headers, body, params, callback);\n return;\n }\n callback === null || callback === void 0 ? void 0 : callback.apply(void 0, tslib_1.__spreadArray([err], args, false));\n });\n return;\n }\n else {\n /* Fallback expired; remove it and fallthrough to normal sequence */\n rest._currentFallback = null;\n }\n }\n var hosts = getHosts(rest);\n /* if there is only one host do it */\n if (hosts.length === 1) {\n this.doUri(method, rest, uriFromHost(hosts[0]), headers, body, params, callback);\n return;\n }\n /* hosts is an array with preferred host plus at least one fallback */\n var tryAHost = function (candidateHosts, persistOnSuccess) {\n var host = candidateHosts.shift();\n _this.doUri(method, rest, uriFromHost(host), headers, body, params, function (err) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n // This typecast is safe because ErrnoExceptions are only thrown in NodeJS\n if (err && shouldFallback(err) && candidateHosts.length) {\n tryAHost(candidateHosts, true);\n return;\n }\n if (persistOnSuccess) {\n /* RSC15f */\n rest._currentFallback = {\n host: host,\n validUntil: Utils.now() + rest.options.timeouts.fallbackRetryTimeout,\n };\n }\n callback === null || callback === void 0 ? void 0 : callback.apply(void 0, tslib_1.__spreadArray([err], args, false));\n });\n };\n tryAHost(hosts);\n };\n class_1.prototype.doUri = function (method, rest, uri, headers, body, params, callback) {\n if (!this.Request) {\n callback(new errorinfo_1.PartialErrorInfo('Request invoked before assigned to', null, 500));\n return;\n }\n this.Request(method, rest, uri, headers, params, body, callback);\n };\n return class_1;\n }()),\n _a.methods = [HttpMethods_1.default.Get, HttpMethods_1.default.Delete, HttpMethods_1.default.Post, HttpMethods_1.default.Put, HttpMethods_1.default.Patch],\n _a.methodsWithoutBody = [HttpMethods_1.default.Get, HttpMethods_1.default.Delete],\n _a.methodsWithBody = [HttpMethods_1.default.Post, HttpMethods_1.default.Put, HttpMethods_1.default.Patch],\n _a);\nexports.default = Http;\n\n\n/***/ }),\n/* 63 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar errorinfo_1 = tslib_1.__importStar(__webpack_require__(4));\nvar platform_1 = tslib_1.__importDefault(__webpack_require__(3));\nvar defaults_1 = tslib_1.__importDefault(__webpack_require__(8));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar utils_1 = __webpack_require__(1);\nfunction isAblyError(responseBody, headers) {\n return !!headers.get('x-ably-errorcode');\n}\nfunction getAblyError(responseBody, headers) {\n if (isAblyError(responseBody, headers)) {\n return responseBody.error && errorinfo_1.default.fromValues(responseBody.error);\n }\n}\nfunction fetchRequest(method, rest, uri, headers, params, body, callback) {\n var fetchHeaders = new Headers(headers || {});\n var _method = method ? method.toUpperCase() : Utils.isEmptyArg(body) ? 'GET' : 'POST';\n var controller = new AbortController();\n var timeout = setTimeout(function () {\n controller.abort();\n callback(new errorinfo_1.PartialErrorInfo('Request timed out', null, 408));\n }, rest ? rest.options.timeouts.httpRequestTimeout : defaults_1.default.TIMEOUTS.httpRequestTimeout);\n var requestInit = {\n method: _method,\n headers: fetchHeaders,\n body: body,\n };\n if (!platform_1.default.Config.isWebworker) {\n requestInit.credentials = fetchHeaders.has('authorization') ? 'include' : 'same-origin';\n }\n (0, utils_1.getGlobalObject)()\n .fetch(uri + '?' + new URLSearchParams(params || {}), requestInit)\n .then(function (res) {\n clearTimeout(timeout);\n var contentType = res.headers.get('Content-Type');\n var prom;\n if (contentType && contentType.indexOf('application/x-msgpack') > -1) {\n prom = res.arrayBuffer();\n }\n else if (contentType && contentType.indexOf('application/json') > -1) {\n prom = res.json();\n }\n else {\n prom = res.text();\n }\n prom.then(function (body) {\n var unpacked = !!contentType && contentType.indexOf('application/x-msgpack') === -1;\n if (!res.ok) {\n var err = getAblyError(body, res.headers) ||\n new errorinfo_1.PartialErrorInfo('Error response received from server: ' + res.status + ' body was: ' + platform_1.default.Config.inspect(body), null, res.status);\n callback(err, body, res.headers, unpacked, res.status);\n }\n else {\n callback(null, body, res.headers, unpacked, res.status);\n }\n });\n })\n .catch(function (err) {\n clearTimeout(timeout);\n callback(err);\n });\n}\nexports.default = fetchRequest;\n\n\n/***/ }),\n/* 64 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar msgpack_1 = tslib_1.__importDefault(__webpack_require__(41));\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\n// Workaround for salesforce lightning locker compat\nvar globalObject = Utils.getGlobalObject();\nif (typeof Window === 'undefined' && typeof WorkerGlobalScope === 'undefined') {\n console.log(\"Warning: this distribution of Ably is intended for browsers. On nodejs, please use the 'ably' package on npm\");\n}\nfunction allowComet() {\n /* xhr requests from local files are unreliable in some browsers, such as Chrome 65 and higher -- see eg\n * https://stackoverflow.com/questions/49256429/chrome-65-unable-to-make-post-requests-from-local-files-to-flask\n * So if websockets are supported, then just forget about comet transports and use that */\n var loc = globalObject.location;\n return !globalObject.WebSocket || !loc || !loc.origin || loc.origin.indexOf('http') > -1;\n}\nvar userAgent = globalObject.navigator && globalObject.navigator.userAgent.toString();\nvar currentUrl = globalObject.location && globalObject.location.href;\nvar Config = {\n agent: 'browser',\n logTimestamps: true,\n userAgent: userAgent,\n currentUrl: currentUrl,\n noUpgrade: userAgent && !!userAgent.match(/MSIE\\s8\\.0/),\n binaryType: 'arraybuffer',\n WebSocket: globalObject.WebSocket,\n fetchSupported: !!globalObject.fetch,\n xhrSupported: globalObject.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest(),\n jsonpSupported: typeof document !== 'undefined',\n allowComet: allowComet(),\n streamingSupported: true,\n useProtocolHeartbeats: true,\n createHmac: null,\n msgpack: msgpack_1.default,\n supportsBinary: !!globalObject.TextDecoder,\n preferBinary: false,\n ArrayBuffer: globalObject.ArrayBuffer,\n atob: globalObject.atob,\n nextTick: typeof globalObject.setImmediate !== 'undefined'\n ? globalObject.setImmediate.bind(globalObject)\n : function (f) {\n setTimeout(f, 0);\n },\n addEventListener: globalObject.addEventListener,\n inspect: JSON.stringify,\n stringByteSize: function (str) {\n /* str.length will be an underestimate for non-ascii strings. But if we're\n * in a browser too old to support TextDecoder, not much we can do. Better\n * to underestimate, so if we do go over-size, the server will reject the\n * message */\n return (globalObject.TextDecoder && new globalObject.TextEncoder().encode(str).length) || str.length;\n },\n TextEncoder: globalObject.TextEncoder,\n TextDecoder: globalObject.TextDecoder,\n Promise: globalObject.Promise,\n getRandomValues: (function (crypto) {\n if (crypto === undefined) {\n return undefined;\n }\n return function (arr, callback) {\n crypto.getRandomValues(arr);\n if (callback) {\n callback(null);\n }\n };\n })(globalObject.crypto || msCrypto),\n};\nexports.default = Config;\n\n\n/***/ }),\n/* 65 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(global) {\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar Utils = tslib_1.__importStar(__webpack_require__(1));\nvar test = 'ablyjs-storage-test';\nvar Webstorage = /** @class */ (function () {\n function Webstorage() {\n /* Even just accessing the session/localStorage object can throw a\n * security exception in some circumstances with some browsers. In\n * others, calling setItem will throw. So have to check in this\n * somewhat roundabout way. (If unsupported or no global object,\n * will throw on accessing a property of undefined) */\n try {\n global.sessionStorage.setItem(test, test);\n global.sessionStorage.removeItem(test);\n this.sessionSupported = true;\n }\n catch (e) {\n this.sessionSupported = false;\n }\n try {\n global.localStorage.setItem(test, test);\n global.localStorage.removeItem(test);\n this.localSupported = true;\n }\n catch (e) {\n this.localSupported = false;\n }\n }\n Webstorage.prototype.get = function (name) {\n return this._get(name, false);\n };\n Webstorage.prototype.getSession = function (name) {\n return this._get(name, true);\n };\n Webstorage.prototype.remove = function (name) {\n return this._remove(name, false);\n };\n Webstorage.prototype.removeSession = function (name) {\n return this._remove(name, true);\n };\n Webstorage.prototype.set = function (name, value, ttl) {\n return this._set(name, value, ttl, false);\n };\n Webstorage.prototype.setSession = function (name, value, ttl) {\n return this._set(name, value, ttl, true);\n };\n Webstorage.prototype._set = function (name, value, ttl, session) {\n var wrappedValue = { value: value };\n if (ttl) {\n wrappedValue.expires = Utils.now() + ttl;\n }\n return this.storageInterface(session).setItem(name, JSON.stringify(wrappedValue));\n };\n Webstorage.prototype._get = function (name, session) {\n if (session && !this.sessionSupported)\n throw new Error('Session Storage not supported');\n if (!session && !this.localSupported)\n throw new Error('Local Storage not supported');\n var rawItem = this.storageInterface(session).getItem(name);\n if (!rawItem)\n return null;\n var wrappedValue = JSON.parse(rawItem);\n if (wrappedValue.expires && wrappedValue.expires < Utils.now()) {\n this.storageInterface(session).removeItem(name);\n return null;\n }\n return wrappedValue.value;\n };\n Webstorage.prototype._remove = function (name, session) {\n return this.storageInterface(session).removeItem(name);\n };\n Webstorage.prototype.storageInterface = function (session) {\n return session ? global.sessionStorage : global.localStorage;\n };\n return Webstorage;\n}());\nexports.default = new Webstorage();\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(13)))\n\n/***/ }),\n/* 66 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = __webpack_require__(0);\nvar TransportNames_1 = tslib_1.__importDefault(__webpack_require__(67));\nvar Defaults = {\n connectivityCheckUrl: 'https://internet-up.ably-realtime.com/is-the-internet-up.txt',\n jsonpInternetUpUrl: 'https://internet-up.ably-realtime.com/is-the-internet-up-0-9.js',\n /* Order matters here: the base transport is the leftmost one in the\n * intersection of baseTransportOrder and the transports clientOption that's\n * supported. This is not quite the same as the preference order -- e.g.\n * xhr_polling is preferred to jsonp, but for browsers that support it we want\n * the base transport to be xhr_polling, not jsonp */\n defaultTransports: [\n TransportNames_1.default.XhrPolling,\n TransportNames_1.default.XhrStreaming,\n TransportNames_1.default.JsonP,\n TransportNames_1.default.WebSocket,\n ],\n baseTransportOrder: [\n TransportNames_1.default.XhrPolling,\n TransportNames_1.default.XhrStreaming,\n TransportNames_1.default.JsonP,\n TransportNames_1.default.WebSocket,\n ],\n transportPreferenceOrder: [\n TransportNames_1.default.JsonP,\n TransportNames_1.default.XhrPolling,\n TransportNames_1.default.XhrStreaming,\n TransportNames_1.default.WebSocket,\n ],\n upgradeTransports: [TransportNames_1.default.XhrStreaming, TransportNames_1.default.WebSocket],\n};\nexports.default = Defaults;\n\n\n/***/ }),\n/* 67 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar TransportNames;\n(function (TransportNames) {\n TransportNames[\"WebSocket\"] = \"web_socket\";\n TransportNames[\"Comet\"] = \"comet\";\n TransportNames[\"XhrStreaming\"] = \"xhr_streaming\";\n TransportNames[\"XhrPolling\"] = \"xhr_polling\";\n TransportNames[\"JsonP\"] = \"jsonp\";\n})(TransportNames || (TransportNames = {}));\nexports.default = TransportNames;\n\n\n/***/ }),\n/* 68 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXTERNAL MODULE: ./src/platform/web/lib/transport/jsonptransport.ts\nvar jsonptransport = __webpack_require__(29);\nvar jsonptransport_default = /*#__PURE__*/__webpack_require__.n(jsonptransport);\n\n// EXTERNAL MODULE: ./src/common/lib/util/utils.ts\nvar utils = __webpack_require__(1);\n\n// EXTERNAL MODULE: ./src/common/platform.ts\nvar platform = __webpack_require__(3);\nvar platform_default = /*#__PURE__*/__webpack_require__.n(platform);\n\n// EXTERNAL MODULE: ./src/common/lib/transport/comettransport.ts\nvar comettransport = __webpack_require__(12);\nvar comettransport_default = /*#__PURE__*/__webpack_require__.n(comettransport);\n\n// EXTERNAL MODULE: ./src/platform/web/lib/transport/xhrrequest.ts\nvar xhrrequest = __webpack_require__(16);\nvar xhrrequest_default = /*#__PURE__*/__webpack_require__.n(xhrrequest);\n\n// CONCATENATED MODULE: ./src/platform/web/lib/transport/xhrpollingtransport.js\n\n\n\n\n\nvar xhrpollingtransport_XHRPollingTransport = function (connectionManager) {\n var shortName = 'xhr_polling';\n\n function XHRPollingTransport(connectionManager, auth, params) {\n params.stream = false;\n comettransport_default.a.call(this, connectionManager, auth, params);\n this.shortName = shortName;\n }\n utils[\"inherits\"](XHRPollingTransport, comettransport_default.a);\n\n XHRPollingTransport.isAvailable = function () {\n return platform_default.a.Config.xhrSupported && platform_default.a.Config.allowComet;\n };\n\n XHRPollingTransport.prototype.toString = function () {\n return 'XHRPollingTransport; uri=' + this.baseUri + '; isConnected=' + this.isConnected;\n };\n\n XHRPollingTransport.prototype.createRequest = function (uri, headers, params, body, requestMode) {\n return xhrrequest_default.a.createRequest(uri, headers, params, body, requestMode, this.timeouts);\n };\n\n if (typeof connectionManager !== 'undefined' && XHRPollingTransport.isAvailable()) {\n connectionManager.supportedTransports[shortName] = XHRPollingTransport;\n }\n\n return XHRPollingTransport;\n};\n\n/* harmony default export */ var xhrpollingtransport = (xhrpollingtransport_XHRPollingTransport);\n\n// CONCATENATED MODULE: ./src/platform/web/lib/transport/xhrstreamingtransport.js\n\n\n\n\n\nvar xhrstreamingtransport_XHRStreamingTransport = function (connectionManager) {\n var shortName = 'xhr_streaming';\n\n /* public constructor */\n function XHRStreamingTransport(connectionManager, auth, params) {\n comettransport_default.a.call(this, connectionManager, auth, params);\n this.shortName = shortName;\n }\n utils[\"inherits\"](XHRStreamingTransport, comettransport_default.a);\n\n XHRStreamingTransport.isAvailable = function () {\n return platform_default.a.Config.xhrSupported && platform_default.a.Config.streamingSupported && platform_default.a.Config.allowComet;\n };\n\n XHRStreamingTransport.prototype.toString = function () {\n return 'XHRStreamingTransport; uri=' + this.baseUri + '; isConnected=' + this.isConnected;\n };\n\n XHRStreamingTransport.prototype.createRequest = function (uri, headers, params, body, requestMode) {\n return xhrrequest_default.a.createRequest(uri, headers, params, body, requestMode, this.timeouts);\n };\n\n if (typeof connectionManager !== 'undefined' && XHRStreamingTransport.isAvailable()) {\n connectionManager.supportedTransports[shortName] = XHRStreamingTransport;\n }\n\n return XHRStreamingTransport;\n};\n\n/* harmony default export */ var xhrstreamingtransport = (xhrstreamingtransport_XHRStreamingTransport);\n\n// CONCATENATED MODULE: ./src/platform/web/lib/transport/index.js\n\n\n\n\n/* harmony default export */ var transport = __webpack_exports__[\"default\"] = ([jsonptransport_default.a, xhrpollingtransport, xhrstreamingtransport]);\n\n\n/***/ })\n/******/ ])[\"default\"];\n});","import {configureAbly, useChannel} from \"@ably-labs/react-hooks\"\r\nimport {useVivliConfigurationService,} from '@vivli/core/infrastructure/context';\r\nimport {IPubSubService} from \"@vivli/shared/infrastructure/interface\";\r\nimport {Realtime, Types} from \"ably\";\r\nimport {LoggerService} from \"@vivli/shared/infrastructure/service\";\r\n\r\n\r\n\r\n\r\nexport class PubSubService implements IPubSubService {\r\n\r\n private ably: Realtime;\r\n private env: string\r\n private apiBase: string\r\n\r\n public constructor(envName: string, apiBase:string ) {\r\n this.apiBase = apiBase;\r\n this.env = envName;\r\n if (window.location.hostname === 'vivli.local') {\r\n this.env = \"Development\";\r\n }\r\n }\r\n\r\n private initializeIfNotYetDone = () => {\r\n\r\n if (!this.ably) {\r\n this.ably= new Realtime({authUrl: `${this.apiBase}api/VivliConfig/pubsub/auth/VivliPlatform`});\r\n // Connect to Ably\r\n this.ably.connection.on('connected', () => {\r\n LoggerService.info('Connected to Ably!');\r\n });\r\n\r\n }\r\n }\r\n public SubscribeToChannel = (channelName: string, callback: (message: any) => void) => {\r\n\r\n const channel = this.InitializeChannel(channelName);\r\n if (this.ably.connection.state === 'connecting') {\r\n setTimeout( () => {\r\n channel.subscribe( callback);\r\n }, 1000);\r\n } else if (this.ably.connection.state === 'connected') {\r\n // Subscribe to the channel\r\n channel.subscribe( callback);}\r\n else {\r\n LoggerService.info(\"Ably connection error, status: \" + this.ably.connection.state);\r\n }\r\n\r\n\r\n\r\n }\r\n\r\n public UnsubscribeFromChannel = (channelName: string) => {\r\n\r\n const channel = this.InitializeChannel(channelName);\r\n\r\n // unsubscribe from the channel\r\n channel.unsubscribe();\r\n\r\n }\r\n\r\n public SubscribeToEvent = (channelName: string, eventName: string, callback: (message: any) => void) => {\r\n const channel = this.InitializeChannel(channelName);\r\n if (this.ably.connection.state === 'connecting') {\r\n setTimeout( () => {\r\n channel.subscribe(eventName, callback);\r\n }, 1000);\r\n } else if (this.ably.connection.state === 'connected') {\r\n // Subscribe to the channel\r\n channel.subscribe(eventName, callback);}\r\n else {\r\n LoggerService.info(\"Ably connection error, status: \" + this.ably.connection.state);\r\n }\r\n\r\n }\r\n\r\n public CloseConnection = () => {\r\n if (!this.ably?.connection) return;\r\n // Register connection close callback\r\n this.ably.connection.on('closed', () => {\r\n LoggerService.info('Closed the connection to Ably.');\r\n });\r\n\r\n // Close the connection without waiting to receive messages\r\n this.ably.connection.close();\r\n\r\n }\r\n\r\n private InitializeChannel = (channelName: string) => {\r\n this.initializeIfNotYetDone();\r\n channelName = this.PrependChannelName(channelName);\r\n // Get the channel to connect to\r\n return this.ably.channels.get(channelName);\r\n }\r\n\r\n private PrependChannelName = (channelName: string): string => {\r\n\r\n if (channelName.startsWith(`${this.env}:`)) return channelName;\r\n return `${this.env}:${channelName}`;\r\n }\r\n}\r\n","import {\r\n AccountInfo,\r\n AuthenticationResult,\r\n EventType,\r\n InteractionRequiredAuthError,\r\n PopupRequest,\r\n PublicClientApplication,\r\n RedirectRequest,\r\n SilentRequest,\r\n SsoSilentRequest,\r\n} from '@azure/msal-browser';\r\nimport {\r\n B2cAuthorityTypeEnum,\r\n FailedToInitialize,\r\n IMsal2AuthService,\r\n IMsal2ProviderOptions,\r\n IMsalLoginOptions,\r\n LoggingInEvent,\r\n LoginEvent,\r\n LogoutEvent,\r\n Msal2EventType,\r\n Msal2EventTypeEnum,\r\n RefreshAuthExpirationEvent,\r\n SignedUpEvent,\r\n SignUpEvent,\r\n SilentLoggingInEvent,\r\n SilentLoginEvent,\r\n UnauthorizedEvent,\r\n UpdatedPasswordEvent,\r\n UpdatedProfileEvent,\r\n UpdatingPasswordEvent,\r\n UpdatingProfileEvent,\r\n UserCancelledLogin,\r\n} from './interface';\r\nimport {Subject} from 'rxjs';\r\nimport {LoggerService} from '@vivli/shared/infrastructure/service';\r\nimport {EndSessionPopupRequest} from '@azure/msal-browser/dist/request/EndSessionPopupRequest';\r\nimport {PopupEvent} from '@azure/msal-browser/dist/event/EventMessage';\r\n\r\nconst loggerKey = 'authService';\r\n\r\nexport class Msal2AuthService implements IMsal2AuthService {\r\n private msalApp: PublicClientApplication;\r\n private account: AccountInfo;\r\n private loggedIn = false;\r\n private apiToken: string = null;\r\n private popupWindow = null;\r\n public readonly options: IMsal2ProviderOptions;\r\n public authEvents: Subject = new Subject();\r\n\r\n constructor(options: IMsal2ProviderOptions) {\r\n this.msalApp = new PublicClientApplication(options.config);\r\n this.options = options;\r\n\r\n this.handleLoginPopupFocus();\r\n }\r\n\r\n private handleLoginPopupFocus = () => {\r\n this.msalApp.addEventCallback((message) => {\r\n if (message.eventType === EventType.POPUP_OPENED) {\r\n // Save the popup window for focusing later\r\n const payload = message.payload as PopupEvent;\r\n this.popupWindow = payload.popupWindow as Window;\r\n }\r\n return message;\r\n });\r\n };\r\n\r\n public getAccount = (): AccountInfo | null => {\r\n const activeAccount = this.msalApp.getActiveAccount();\r\n return activeAccount;\r\n };\r\n\r\n public triggerEvent = (event: Msal2EventType): void => {\r\n this.authEvents.next(event);\r\n };\r\n\r\n public showLoginWindow = () => {\r\n this.popupWindow?.focus();\r\n };\r\n\r\n /**\r\n * Handles the response from a popup or redirect. If response is null, will check if we have any accounts and attempt to sign in.\r\n * @param response\r\n * @param successEvent\r\n */\r\n private handleResponse(response: AuthenticationResult = null, successEvent?: Msal2EventType) {\r\n let account;\r\n if (response !== null) {\r\n account = response.account;\r\n } else {\r\n account = this.getAccount();\r\n }\r\n\r\n if (account) {\r\n if (successEvent) {\r\n switch (successEvent.type) {\r\n case Msal2EventTypeEnum.UpdatedProfileEvent:\r\n case Msal2EventTypeEnum.UpdatedPasswordEvent:\r\n case Msal2EventTypeEnum.SignedUpEvent:\r\n successEvent.idToken = response.idToken;\r\n break;\r\n }\r\n }\r\n\r\n this.apiToken = response.idToken;\r\n\r\n this.triggerEvent(successEvent || new LoginEvent(account, response.idToken));\r\n this.setLoggedIn(account);\r\n LoggerService.debug('renewed token for ' + account.localAccountId + ' after redirect', loggerKey);\r\n }\r\n }\r\n\r\n private handleLoginError(error: any) {\r\n this.setLoggedOut();\r\n\r\n this.handleUserCancelled(error);\r\n this.handlePasswordReset(error);\r\n }\r\n\r\n private handleUserCancelled(error: any) {\r\n if (error.errorCode === 'user_cancelled' || error.errorMessage.indexOf('AADB2C90091') !== -1) {\r\n this.triggerEvent(new UserCancelledLogin());\r\n }\r\n }\r\n\r\n private handlePasswordReset(error: any) {\r\n // password reset flow redirection for b2c\r\n if (!this.options.b2cOptions || !this.options.b2cOptions.authorities) return;\r\n\r\n if (error.errorMessage && error.errorMessage.indexOf('AADB2C90118') > -1) {\r\n this.updatePassword();\r\n }\r\n }\r\n\r\n private handleUnauthorizedLogin() {\r\n this.setLoggedOut();\r\n this.triggerEvent(new UnauthorizedEvent());\r\n }\r\n\r\n private getSilentRequest(account?: AccountInfo, authorityType?: B2cAuthorityTypeEnum): SilentRequest {\r\n const request: SilentRequest = {\r\n account: account || this.getAccount(),\r\n scopes: this.getScopes(),\r\n };\r\n\r\n return this.getRequestWithOptions(request, authorityType);\r\n }\r\n\r\n private getSsoSilentRequest(authorityType?: B2cAuthorityTypeEnum): SsoSilentRequest {\r\n const request: SsoSilentRequest = {\r\n loginHint: this.getAccount()?.idTokenClaims['email'] as any,\r\n scopes: this.getScopes(),\r\n };\r\n\r\n return this.getRequestWithOptions(request, authorityType);\r\n }\r\n\r\n private getRedirectUri() {\r\n let portDelimAndNumber = `:${window.location.port}`;\r\n portDelimAndNumber = portDelimAndNumber === ':' ? '' : portDelimAndNumber;\r\n return `${window.location.protocol}//${window.location.hostname}${portDelimAndNumber}`;\r\n }\r\n\r\n private getLoginRedirectRequest(authorityType?: B2cAuthorityTypeEnum): RedirectRequest {\r\n const redirectUri = this.getRedirectUri();\r\n const request: RedirectRequest = {\r\n scopes: this.getScopes(),\r\n redirectStartPage: this.options.b2cOptions.redirectUri || redirectUri,\r\n };\r\n\r\n return this.getRequestWithOptions(request, authorityType);\r\n }\r\n\r\n private getLoginPopupRequest(authorityType?: B2cAuthorityTypeEnum): PopupRequest {\r\n const request: PopupRequest = {\r\n scopes: this.getScopes(),\r\n };\r\n\r\n return this.getRequestWithOptions(request, authorityType);\r\n }\r\n\r\n private getRequestWithOptions(request: T, authorityType?: B2cAuthorityTypeEnum) {\r\n let requestWithOptions: T = request;\r\n\r\n const authority = this.getAuthority(authorityType);\r\n if (authority) requestWithOptions = { ...requestWithOptions, authority: authority };\r\n\r\n const scopes = this.getScopes();\r\n if (scopes) requestWithOptions = { ...requestWithOptions, scopes };\r\n\r\n return requestWithOptions;\r\n }\r\n\r\n private getScopes(): string[] {\r\n return this.options.b2cOptions?.scopes || [];\r\n }\r\n\r\n private getAuthority(authorityType: B2cAuthorityTypeEnum): string {\r\n if (!this.options.b2cOptions || !this.options.b2cOptions.authorities) return null;\r\n\r\n const authPolicyName = this.options.b2cOptions?.authorities[authorityType] || this.options.b2cOptions?.authorities.default;\r\n const b2cTenant = this.options.b2cOptions.tenant;\r\n const b2cName = b2cTenant.split('.')[0];\r\n return this.getAuthorityUrl(authPolicyName, b2cTenant, b2cName);\r\n }\r\n\r\n private getAuthorityUrl(authPolicyName: string, b2cTenant: string, b2cName: string) {\r\n return `https://${b2cName}.b2clogin.com/${b2cTenant}/${authPolicyName}`;\r\n }\r\n\r\n private setLoggedOut = () => {\r\n this.loggedIn = false;\r\n this.msalApp.setActiveAccount(null);\r\n };\r\n\r\n private setLoggedIn = (account: AccountInfo) => {\r\n this.loggedIn = true;\r\n this.account = account;\r\n this.msalApp.setActiveAccount(account);\r\n };\r\n\r\n public getApiToken = () => {\r\n return this.apiToken;\r\n };\r\n\r\n public updatePassword = () => {\r\n this.login({\r\n authorityType: 'forgotPassword',\r\n successEvent: new UpdatedPasswordEvent(),\r\n progressEvent: new UpdatingPasswordEvent(),\r\n });\r\n };\r\n\r\n public updateProfile = () => {\r\n this.login({\r\n authorityType: 'editProfile',\r\n successEvent: new UpdatedProfileEvent(),\r\n progressEvent: new UpdatingProfileEvent(),\r\n });\r\n };\r\n\r\n public signUp = () => {\r\n return this.login({\r\n authorityType: 'signUpOnly',\r\n successEvent: new SignedUpEvent(),\r\n progressEvent: new SignUpEvent(),\r\n });\r\n };\r\n\r\n public isSsoUser = () => {\r\n const idpClaim = this.getAccount().idTokenClaims['idp'] as any;\r\n return idpClaim !== -1 && idpClaim !== 'localAuthority';\r\n };\r\n\r\n /**\r\n * Checks whether we are in the middle of a redirect and handles state accordingly. Only required for redirect flows.\r\n *\r\n * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/initialization.md#redirect-apis\r\n */\r\n public loadAuthModule = (): Promise => {\r\n // if a hash is present at this time that means we are about to handle a login redirect\r\n // aka we are in the final process of logging in, likely originating from the /partner-login route\r\n if (window.location.hash) {\r\n this.triggerEvent(new LoggingInEvent());\r\n }\r\n\r\n return this.msalApp\r\n .handleRedirectPromise()\r\n .then((resp: AuthenticationResult | null) => {\r\n if (resp) {\r\n this.handleResponse(resp);\r\n }\r\n\r\n return resp;\r\n })\r\n .catch((e) => {\r\n this.triggerEvent(new FailedToInitialize());\r\n });\r\n };\r\n\r\n /**\r\n * Calls ssoSilent to attempt silent flow. If it fails due to interaction required error,\r\n * it will prompt the user to login using popup if forceLoginOnFail is true\r\n * @param forceLoginOnFail\r\n */\r\n public silentLogin = async (forceLoginOnFail?: boolean) => {\r\n // only attempt silent if we have a user context saved\r\n if (!this.getAccount()) {\r\n this.triggerEvent(new UnauthorizedEvent());\r\n return;\r\n }\r\n\r\n this.triggerEvent(new SilentLoggingInEvent());\r\n const silentRequest = this.getSsoSilentRequest();\r\n this.msalApp\r\n .ssoSilent(silentRequest)\r\n .then((resp) => {\r\n const account = this.getAccount();\r\n if (resp.account) {\r\n this.setLoggedIn(resp.account);\r\n this.triggerEvent(new SilentLoginEvent(account, resp.idToken));\r\n } else {\r\n this.setLoggedOut();\r\n this.triggerEvent(new UnauthorizedEvent());\r\n }\r\n })\r\n .catch((error) => {\r\n // console.error('Silent Error: ' + error);\r\n if (error instanceof InteractionRequiredAuthError) {\r\n this.triggerEvent(new UnauthorizedEvent(error));\r\n if (forceLoginOnFail) {\r\n this.setLoggedOut();\r\n this.login();\r\n }\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Calls loginPopup or loginRedirect based on given signInType.\r\n * Optional authority name\r\n * @param options\r\n */\r\n public login = (options?: IMsalLoginOptions): Promise => {\r\n const { quiet, authorityType, signInType, progressEvent, successEvent }: IMsalLoginOptions = {\r\n quiet: false,\r\n authorityType: 'signInOnly',\r\n signInType: 'loginPopup',\r\n ...options,\r\n };\r\n\r\n if (!quiet) {\r\n this.triggerEvent(progressEvent || new LoggingInEvent());\r\n }\r\n\r\n if (signInType === 'loginPopup') {\r\n const request = this.getLoginPopupRequest(authorityType);\r\n return this.msalApp\r\n .loginPopup(request)\r\n .then((resp: AuthenticationResult) => {\r\n return this.handleResponse(resp, successEvent);\r\n })\r\n .catch((error) => {\r\n this.handleLoginError(error);\r\n });\r\n } else if (signInType === 'loginRedirect') {\r\n const request = this.getLoginRedirectRequest(authorityType);\r\n this.msalApp.loginRedirect(request);\r\n }\r\n };\r\n\r\n /**\r\n * Logs out of current account.\r\n */\r\n public logout = (): void => {\r\n let account: AccountInfo | undefined;\r\n if (this.getAccount()) {\r\n account = this.getAccount();\r\n }\r\n\r\n const redirectUri = this.getRedirectUri();\r\n const logOutRequest: EndSessionPopupRequest = {\r\n account,\r\n postLogoutRedirectUri: redirectUri,\r\n };\r\n\r\n this.setLoggedOut();\r\n this.triggerEvent(new LogoutEvent());\r\n this.msalApp.logoutRedirect(logOutRequest);\r\n };\r\n\r\n /**\r\n * Gets a token silently, or falls back to interactive popup.\r\n */\r\n public getTokenPopup = async (): Promise => {\r\n try {\r\n const silentRequest = this.getSilentRequest();\r\n const response: AuthenticationResult = await this.msalApp.acquireTokenSilent(silentRequest);\r\n this.handleResponse(response, new RefreshAuthExpirationEvent(response.idToken));\r\n return response.idToken;\r\n } catch (e) {\r\n if (e instanceof InteractionRequiredAuthError) {\r\n return this.msalApp\r\n .acquireTokenPopup(this.getLoginPopupRequest())\r\n .then((resp) => {\r\n this.handleResponse(resp);\r\n return resp.idToken;\r\n })\r\n .catch((err) => {\r\n this.handleUnauthorizedLogin();\r\n return null;\r\n });\r\n } else {\r\n this.handleUnauthorizedLogin();\r\n }\r\n }\r\n\r\n return null;\r\n };\r\n\r\n /**\r\n * Gets a token silently, or falls back to interactive redirect.\r\n */\r\n public async getTokenRedirect(): Promise {\r\n try {\r\n const silentRequest = this.getSilentRequest();\r\n const response = await this.msalApp.acquireTokenSilent(silentRequest);\r\n this.triggerEvent(new RefreshAuthExpirationEvent(response.idToken));\r\n return response.idToken;\r\n } catch (e) {\r\n if (e instanceof InteractionRequiredAuthError) {\r\n this.msalApp.acquireTokenRedirect({ scopes: [] }).catch(() => {\r\n this.handleUnauthorizedLogin();\r\n });\r\n } else {\r\n this.handleUnauthorizedLogin();\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n","import {Msal2FakeService} from \"./msal-2-fake.service\";\r\nimport {Msal2AuthService} from \"./msal-2-auth.service\";\r\nimport {IMsal2ProviderOptions} from \"../lib/interface/msal-2-provider-options.interface\";\r\nimport {IMsal2AuthService} from \"./interface\";\r\nimport {environment} from \"@vivli/core/environments\";\r\n\r\nexport abstract class Msal2AuthFactory {\r\n\r\n public static Create(options: IMsal2ProviderOptions): IMsal2AuthService {\r\n if (environment.isAutomation && !environment.production) {\r\n return new Msal2FakeService(options)\r\n }\r\n\r\n return new Msal2AuthService(options);\r\n }\r\n}\r\n","import React, {useRef} from \"react\";\r\nimport {IMsal2Wrapper} from \"./interface\";\r\nimport {Msal2AuthContext} from \"./msal-2.context\";\r\nimport {Msal2AuthFactory} from \"./msal-2-auth.factory\";\r\n\r\nexport const Msal2Wrapper = ({\r\n children,\r\n silentLoginOnLoad,\r\n redirectLoginOnLoad,\r\n options,\r\n externalLoginOnLoad\r\n }: IMsal2Wrapper) => {\r\n const authInitializedRef = useRef(false);\r\n\r\n const authService = Msal2AuthFactory.Create(options)\r\n\r\n if (!authInitializedRef.current) {\r\n authInitializedRef.current = true;\r\n\r\n authService.loadAuthModule().then(resp => {\r\n if (!resp) {\r\n if (externalLoginOnLoad) {\r\n authService.login({signInType: 'loginRedirect', authorityType: 'sso'})\r\n } else if (redirectLoginOnLoad) {\r\n authService.login({signInType: \"loginRedirect\"});\r\n } else if (silentLoginOnLoad) {\r\n authService.silentLogin();\r\n }\r\n }\r\n })\r\n }\r\n\r\n return (\r\n authService && {children}\r\n )\r\n}\r\n","import {useEffect, useState} from \"react\";\r\nimport {IMsal2AuthService, LogoutWarning, Msal2EventTypeEnum} from \"../interface\";\r\nimport {interval, Subscription} from \"rxjs\";\r\nimport {LoggerService, StorageService} from \"@vivli/shared/infrastructure/service\";\r\nimport moment from \"moment\";\r\n\r\nexport const useLoginExpiration = (authService: IMsal2AuthService) => {\r\n const [innerAuthService, setInnerAuthService] = useState(authService)\r\n\r\n const expirationItemName = 'msal_timeout';\r\n const warningItemName = 'msal_warning';\r\n const intervalDelay = 30000; // 30 sec\r\n\r\n let warningWatcherSub: Subscription;\r\n let expirationWatcherSub: Subscription;\r\n\r\n const removeExpiration = () => {\r\n warningWatcherSub?.unsubscribe();\r\n expirationWatcherSub?.unsubscribe();\r\n StorageService.deleteItem(expirationItemName);\r\n StorageService.deleteItem(warningItemName);\r\n }\r\n\r\n const handleAuthExpiration = () => {\r\n removeExpiration();\r\n\r\n if (innerAuthService.getAccount()) {\r\n innerAuthService.logout();\r\n }\r\n }\r\n\r\n const setupExpirationTimer = () => {\r\n LoggerService.debug('Initializing expiration timer', moment())\r\n\r\n // check to see if it's time to log out the user\r\n expirationWatcherSub = interval(intervalDelay).subscribe(() => {\r\n const date = StorageService.getItem(expirationItemName);\r\n\r\n const expirationDate = moment(date);\r\n LoggerService.debug('Checking login expiration', expirationDate)\r\n\r\n // check if the current time is the same or after the warning time\r\n if (moment().isSameOrAfter(moment(expirationDate))) {\r\n expirationWatcherSub?.unsubscribe();\r\n\r\n // log out the user\r\n handleAuthExpiration();\r\n }\r\n })\r\n }\r\n\r\n const setupWarningTimer = () => {\r\n // check to see if it's time to warn the user they will be logged out soon\r\n warningWatcherSub = interval(intervalDelay).subscribe(() => {\r\n const date = StorageService.getItem(warningItemName);\r\n\r\n const warningDate = moment(date);\r\n LoggerService.debug('Checking warning expiration', warningDate)\r\n\r\n // check if the current time is the same or after the warning time\r\n if (moment().isSameOrAfter(warningDate)) {\r\n warningWatcherSub?.unsubscribe();\r\n\r\n // trigger the warning\r\n innerAuthService.triggerEvent(new LogoutWarning());\r\n\r\n // activate the expiration timer\r\n setupExpirationTimer();\r\n }\r\n })\r\n }\r\n\r\n const refreshExpiration = () => {\r\n removeExpiration();\r\n initializeExpiration();\r\n }\r\n\r\n const initializeExpiration = (): void => {\r\n if (!innerAuthService.options.timeout) {\r\n return;\r\n }\r\n\r\n // used to sync warning and timout dates\r\n const currentDate = moment();\r\n LoggerService.debug('Initializing Expiration', currentDate)\r\n\r\n // get minutes to expiration and minutes to warning\r\n const {expirationMinutes, warningMinutes} = innerAuthService.options.timeout;\r\n\r\n // save the date + minutes to warning/expiration to storage\r\n const timeTillWarning = currentDate.add(warningMinutes, 'minutes').toISOString(true);\r\n StorageService.setItem(warningItemName, timeTillWarning);\r\n\r\n const timeTillExpiration = currentDate.add(expirationMinutes - warningMinutes, 'minutes').toISOString(true);\r\n StorageService.setItem(expirationItemName, timeTillExpiration);\r\n\r\n setupWarningTimer();\r\n }\r\n\r\n const disableExpiration = () => {\r\n removeExpiration();\r\n }\r\n\r\n useEffect(() => {\r\n if (!innerAuthService || !innerAuthService.options.timeout) {\r\n return;\r\n }\r\n\r\n const eventsSub = innerAuthService.authEvents.subscribe(event => {\r\n switch (event.type) {\r\n case Msal2EventTypeEnum.LoginEvent:\r\n initializeExpiration();\r\n break;\r\n case Msal2EventTypeEnum.LogoutEvent:\r\n disableExpiration();\r\n break;\r\n case Msal2EventTypeEnum.RefreshAuthExpirationEvent:\r\n refreshExpiration();\r\n break;\r\n }\r\n })\r\n\r\n return () => {\r\n eventsSub.unsubscribe();\r\n disableExpiration();\r\n }\r\n }, [innerAuthService])\r\n\r\n useEffect(() => {\r\n setInnerAuthService(authService);\r\n }, [authService])\r\n}\r\n","import {IMsal2AuthService, Msal2EventTypeEnum} from \"../interface\";\r\nimport {useEffect} from \"react\";\r\nimport {StorageService} from \"@vivli/shared/infrastructure/service\";\r\nimport moment from \"moment\";\r\nimport {interval, Subscription} from \"rxjs\";\r\n\r\nexport const useLogoutOnClose = (authService: IMsal2AuthService, enabled = true) => {\r\n const lastActiveBrowserKey = 'session_keep_alive';\r\n\r\n const updateLastActive = () => {\r\n StorageService.setItem(lastActiveBrowserKey, moment().toISOString(true))\r\n }\r\n const checkIfLogoutNeeded = () => {\r\n const account = authService.getAccount();\r\n if (!account) {\r\n return;\r\n }\r\n\r\n // aka if all tabs were closed and this is a new tab, see if we need to start a new session / log the current user out\r\n const lastActiveBrowserDate = StorageService.getItem(lastActiveBrowserKey);\r\n if (!lastActiveBrowserDate) {\r\n authService.logout();\r\n } else {\r\n const currentDate = moment();\r\n const lastActivityDate = moment(lastActiveBrowserDate);\r\n const timeSinceLastActivity = currentDate.diff(lastActivityDate, 'seconds');\r\n\r\n if (timeSinceLastActivity > 30) {\r\n authService.logout();\r\n }\r\n }\r\n }\r\n\r\n const initializeBrowserActivityTimer = (): Subscription => {\r\n updateLastActive()\r\n return interval(5000).subscribe(updateLastActive);\r\n }\r\n\r\n useEffect(() => {\r\n if (!authService || !enabled) {\r\n return;\r\n }\r\n\r\n checkIfLogoutNeeded();\r\n let activityTimerSub = null;\r\n\r\n const eventsSub = authService.authEvents.subscribe(event => {\r\n switch (event.type) {\r\n case Msal2EventTypeEnum.LoginEvent:\r\n case Msal2EventTypeEnum.SilentLoginEvent:\r\n activityTimerSub?.unsubscribe();\r\n activityTimerSub = initializeBrowserActivityTimer();\r\n break;\r\n case Msal2EventTypeEnum.LogoutEvent:\r\n activityTimerSub?.unsubscribe();\r\n break;\r\n }\r\n })\r\n\r\n if (authService.getAccount()) {\r\n activityTimerSub?.unsubscribe();\r\n activityTimerSub = initializeBrowserActivityTimer();\r\n }\r\n\r\n return () => {\r\n eventsSub.unsubscribe();\r\n activityTimerSub?.unsubscribe();\r\n }\r\n }, [authService])\r\n}\r\n","import React from \"react\";\r\nimport {Configuration, LogLevel} from \"@azure/msal-browser\";\r\nimport {useConfigService} from \"@vivli/core/infrastructure/context\";\r\nimport {IB2COptions, IMsal2ProviderOptions, Msal2Wrapper} from \"@vivli/core/authentication\";\r\nimport {IConfig, IContextWrapper} from \"@vivli/shared/infrastructure/interface\";\r\nimport {LoggerService, StorageService} from \"@vivli/shared/infrastructure/service\";\r\n\r\nconst getAuthority = (config: IConfig, policyName?: string): string => {\r\n const storedPolicyName = StorageService.getItem('policyName');\r\n const policy = policyName || storedPolicyName || config.b2CSignInPolicyName;\r\n StorageService.setItem('policyName', policy);\r\n const b2cName = config.b2CTenant.split('.')[0]\r\n return `https://${b2cName}.b2clogin.com/${config.b2CTenant}/${policy}`;\r\n}\r\n\r\nconst getMsalConfig = ({\r\n config, authority\r\n }: { config: IConfig, authority?: any }): Configuration => {\r\n\r\n let portDelimAndNumber = `:${window.location.port}`;\r\n portDelimAndNumber = (portDelimAndNumber === ':') ? '' : portDelimAndNumber;\r\n const redirectUri = `${window.location.protocol}//${window.location.hostname}${portDelimAndNumber}`;\r\n const postLogoutRedirectUri = `${window.location.protocol}//${window.location.hostname}${portDelimAndNumber}`;\r\n\r\n return {\r\n auth: {\r\n clientId: config.b2CAppId,\r\n authority,\r\n redirectUri,\r\n postLogoutRedirectUri,\r\n knownAuthorities: [authority]\r\n },\r\n cache: {\r\n cacheLocation: 'localStorage'\r\n },\r\n system: {\r\n loggerOptions: {\r\n loggerCallback: (\r\n level,\r\n message,\r\n containsPii\r\n ) => {\r\n if (containsPii) {\r\n return;\r\n }\r\n switch (level) {\r\n case LogLevel.Error:\r\n LoggerService.error(message);\r\n return;\r\n case LogLevel.Info:\r\n LoggerService.info(message);\r\n return;\r\n case LogLevel.Verbose:\r\n LoggerService.debug(message);\r\n return;\r\n case LogLevel.Warning:\r\n LoggerService.warn(message);\r\n return;\r\n }\r\n },\r\n piiLoggingEnabled: false,\r\n },\r\n windowHashTimeout: 60000,\r\n iframeHashTimeout: 6000,\r\n loadFrameTimeout: 0,\r\n }\r\n }\r\n}\r\n\r\nexport const AuthWrapper = ({children}: IContextWrapper) => {\r\n const config = useConfigService();\r\n const authority = getAuthority(config);\r\n const msalConfig = getMsalConfig({config, authority});\r\n\r\n const {\r\n b2CEditProfilePolicyName,\r\n b2CSignInOnlyPolicyName,\r\n b2CPasswordPolicyName,\r\n b2CSignInPolicyName,\r\n b2CSignUpPolicyName,\r\n b2CSSOPolicyName,\r\n } = config;\r\n\r\n //Detect a login from a partner set up as an SSO provider -\r\n //in the parnterLog the authorities configured\r\n //will use an SSO policy as an override policy for the sign in and default policies.\r\n //in the \"normal login\" case we will use the usual signin and default policies.\r\n const isPartnerLogin = window.location.href.indexOf('partner-login') !== -1;\r\n let overridePolicyName = null;\r\n if (isPartnerLogin) {\r\n overridePolicyName = b2CSSOPolicyName;\r\n }\r\n\r\n const b2cOptions: IB2COptions = {\r\n scopes: [config.b2CApiAccessScope, 'openid', 'profile'],\r\n tenant: config.b2CTenant,\r\n authorities: {\r\n default: overridePolicyName || b2CSignInOnlyPolicyName,\r\n signInOnly: overridePolicyName || b2CSignInOnlyPolicyName,\r\n signUpOnly: b2CSignUpPolicyName,\r\n signUpSignIn: b2CSignInPolicyName,\r\n editProfile: b2CEditProfilePolicyName,\r\n forgotPassword: b2CPasswordPolicyName,\r\n sso: b2CSSOPolicyName,\r\n }\r\n }\r\n\r\n const options: IMsal2ProviderOptions = {\r\n b2cOptions,\r\n config: msalConfig,\r\n logoutOnBrowserClose: {\r\n keepAliveIntervalSeconds: 1,\r\n keepAliveSeconds: 30\r\n },\r\n timeout: {\r\n expirationMinutes: (config.sessionCookieLengthValueSeconds / 60),\r\n warningMinutes: (config.sessionCookieLengthValueSeconds - config.sessionExpirationWarningIntervalSeconds) / 60\r\n }\r\n }\r\n\r\n // in partner/SSO provider case use redirectLoginOnLoad instead of\r\n // silentLoginOnLoad, because we don't have an existing context;\r\n // the redirect lets the specified B2C flow do its job instead of\r\n // forcing user to interact with login if no existing context\r\n return (\r\n \r\n {children}\r\n \r\n )\r\n}\r\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","'use strict';\n\nvar bind = require('./helpers/bind');\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {Object} val The value to test\n * @return {boolean} True if value is a plain Object, otherwise false\n */\nfunction isPlainObject(val) {\n if (toString.call(val) !== '[object Object]') {\n return false;\n }\n\n var prototype = Object.getPrototypeOf(val);\n return prototype === null || prototype === Object.prototype;\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.trim ? str.trim() : str.replace(/^\\s+|\\s+$/g, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n */\nfunction isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (isPlainObject(result[key]) && isPlainObject(val)) {\n result[key] = merge(result[key], val);\n } else if (isPlainObject(val)) {\n result[key] = merge({}, val);\n } else if (isArray(val)) {\n result[key] = val.slice();\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n * @return {string} content value without BOM\n */\nfunction stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isBuffer: isBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isPlainObject: isPlainObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n extend: extend,\n trim: trim,\n stripBOM: stripBOM\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n var responseType = config.responseType;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(\n timeoutErrorMessage,\n config,\n config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = config.responseType;\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\nvar enhanceError = require('./core/enhanceError');\n\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nvar defaults = {\n\n transitional: {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n },\n\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Accept');\n normalizeHeaderName(headers, 'Content-Type');\n\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {\n setContentTypeIfUnset(headers, 'application/json');\n return stringifySafely(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n var transitional = this.transitional;\n var silentJSONParsing = transitional && transitional.silentJSONParsing;\n var forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';\n\n if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw enhanceError(e, this, 'E_JSON_PARSE');\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\ndefaults.headers = {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n }\n};\n\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n defaults.headers[method] = {};\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);\n});\n\nmodule.exports = defaults;\n","'use strict';\n\nvar utils = require('./../utils');\nvar defaults = require('./../defaults');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n var context = this || defaults;\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn.call(context, data, headers);\n });\n\n return data;\n};\n","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n","'use strict';\n\nvar pkg = require('./../../package.json');\n\nvar validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nvar deprecatedWarnings = {};\nvar currentVerArr = pkg.version.split('.');\n\n/**\n * Compare package versions\n * @param {string} version\n * @param {string?} thanVersion\n * @returns {boolean}\n */\nfunction isOlderVersion(version, thanVersion) {\n var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;\n var destVer = version.split('.');\n for (var i = 0; i < 3; i++) {\n if (pkgVersionArr[i] > destVer[i]) {\n return true;\n } else if (pkgVersionArr[i] < destVer[i]) {\n return false;\n }\n }\n return false;\n}\n\n/**\n * Transitional option validator\n * @param {function|boolean?} validator\n * @param {string?} version\n * @param {string} message\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n var isDeprecated = version && isOlderVersion(version);\n\n function formatMessage(opt, desc) {\n return '[Axios v' + pkg.version + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return function(value, opt, opts) {\n if (validator === false) {\n throw new Error(formatMessage(opt, ' has been removed in ' + version));\n }\n\n if (isDeprecated && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new TypeError('options must be an object');\n }\n var keys = Object.keys(options);\n var i = keys.length;\n while (i-- > 0) {\n var opt = keys[i];\n var validator = schema[opt];\n if (validator) {\n var value = options[opt];\n var result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new TypeError('option ' + opt + ' must be ' + result);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw Error('Unknown option ' + opt);\n }\n }\n}\n\nmodule.exports = {\n isOlderVersion: isOlderVersion,\n assertOptions: assertOptions,\n validators: validators\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\nvar validator = require('../helpers/validator');\n\nvar validators = validator.validators;\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n var transitional = config.transitional;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),\n forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),\n clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')\n }, false);\n }\n\n // filter out skipped interceptors\n var requestInterceptorChain = [];\n var synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n var responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n var promise;\n\n if (!synchronousRequestInterceptors) {\n var chain = [dispatchRequest, undefined];\n\n Array.prototype.unshift.apply(chain, requestInterceptorChain);\n chain = chain.concat(responseInterceptorChain);\n\n promise = Promise.resolve(config);\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n }\n\n\n var newConfig = config;\n while (requestInterceptorChain.length) {\n var onFulfilled = requestInterceptorChain.shift();\n var onRejected = requestInterceptorChain.shift();\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected(error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest(newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n while (responseInterceptorChain.length) {\n promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n","module.exports = require('./lib/axios');","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createObservable = void 0;\nconst rxjs_1 = require(\"rxjs\");\nconst axios_1 = require(\"axios\");\nfunction createObservable(promiseFactory, ...args) {\n let config = args[args.length - 1];\n config = config ? Object.assign({}, config) : {};\n args[args.length - 1] = config;\n let cancelSource;\n const hasCancelToken = !!config.cancelToken;\n if (hasCancelToken) {\n console.warn(`No need to use cancel token, just unsubscribe the subscription would cancel the http request automatically`);\n }\n const observable = new rxjs_1.Observable((subscriber) => {\n if (!hasCancelToken) {\n cancelSource = axios_1.default.CancelToken.source();\n config.cancelToken = cancelSource.token;\n }\n promiseFactory(...args).then(response => {\n subscriber.next(response);\n subscriber.complete();\n })\n .catch(error => subscriber.error(error));\n });\n const _subscribe = observable.subscribe.bind(observable);\n observable.subscribe = (...args2) => {\n const subscription = _subscribe(...args2);\n const _unsubscribe = subscription.unsubscribe.bind(subscription);\n subscription.unsubscribe = () => {\n if (cancelSource) {\n cancelSource.cancel();\n }\n _unsubscribe();\n };\n return subscription;\n };\n return observable;\n}\nexports.createObservable = createObservable;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Axios = void 0;\nconst axios_1 = require(\"axios\");\nconst create_observable_1 = require(\"./create-observable\");\nclass Axios {\n constructor(axiosInstance) {\n this.axiosInstance = axiosInstance;\n }\n get defaults() {\n return this.axiosInstance.defaults;\n }\n get interceptors() {\n return this.axiosInstance.interceptors;\n }\n static request(config) {\n return (0, create_observable_1.createObservable)(axios_1.default.request, config);\n }\n static get(url, config) {\n return (0, create_observable_1.createObservable)(axios_1.default.get, url, config);\n }\n static post(url, data, config) {\n return (0, create_observable_1.createObservable)(axios_1.default.post, url, data, config);\n }\n static put(url, data, config) {\n return (0, create_observable_1.createObservable)(axios_1.default.put, url, data, config);\n }\n static patch(url, data, config) {\n return (0, create_observable_1.createObservable)(axios_1.default.patch, url, data, config);\n }\n static delete(url, config) {\n return (0, create_observable_1.createObservable)(axios_1.default.delete, url, config);\n }\n static head(url, config) {\n return (0, create_observable_1.createObservable)(axios_1.default.head, url, config);\n }\n static create(config) {\n return new Axios(axios_1.default.create(config));\n }\n request(config) {\n return (0, create_observable_1.createObservable)(this.axiosInstance.request, config);\n }\n get(url, config) {\n return (0, create_observable_1.createObservable)(this.axiosInstance.get, url, config);\n }\n head(url, config) {\n return (0, create_observable_1.createObservable)(this.axiosInstance.head, url, config);\n }\n post(url, data, config) {\n return (0, create_observable_1.createObservable)(this.axiosInstance.post, url, data, config);\n }\n put(url, data, config) {\n return (0, create_observable_1.createObservable)(this.axiosInstance.put, url, data, config);\n }\n patch(url, data, config) {\n return (0, create_observable_1.createObservable)(this.axiosInstance.patch, url, data, config);\n }\n delete(url, config) {\n return (0, create_observable_1.createObservable)(this.axiosInstance.delete, url, config);\n }\n}\nexports.Axios = Axios;\nAxios.defaults = axios_1.default.defaults;\nAxios.interceptors = axios_1.default.interceptors;\nexports.default = Axios;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Axios = void 0;\n__exportStar(require(\"./axios-observable.interface\"), exports);\nconst axios_1 = require(\"./axios\");\nObject.defineProperty(exports, \"Axios\", { enumerable: true, get: function () { return axios_1.Axios; } });\nexports.default = axios_1.Axios;\n","/** PURE_IMPORTS_START tslib,_innerSubscribe PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function catchError(selector) {\n return function catchErrorOperatorFunction(source) {\n var operator = new CatchOperator(selector);\n var caught = source.lift(operator);\n return (operator.caught = caught);\n };\n}\nvar CatchOperator = /*@__PURE__*/ (function () {\n function CatchOperator(selector) {\n this.selector = selector;\n }\n CatchOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));\n };\n return CatchOperator;\n}());\nvar CatchSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(CatchSubscriber, _super);\n function CatchSubscriber(destination, selector, caught) {\n var _this = _super.call(this, destination) || this;\n _this.selector = selector;\n _this.caught = caught;\n return _this;\n }\n CatchSubscriber.prototype.error = function (err) {\n if (!this.isStopped) {\n var result = void 0;\n try {\n result = this.selector(err, this.caught);\n }\n catch (err2) {\n _super.prototype.error.call(this, err2);\n return;\n }\n this._unsubscribeAndRecycle();\n var innerSubscriber = new SimpleInnerSubscriber(this);\n this.add(innerSubscriber);\n var innerSubscription = innerSubscribe(result, innerSubscriber);\n if (innerSubscription !== innerSubscriber) {\n this.add(innerSubscription);\n }\n }\n };\n return CatchSubscriber;\n}(SimpleOuterSubscriber));\n//# sourceMappingURL=catchError.js.map\n","/** PURE_IMPORTS_START _mergeMap PURE_IMPORTS_END */\nimport { mergeMap } from './mergeMap';\nexport function concatMap(project, resultSelector) {\n return mergeMap(project, resultSelector, 1);\n}\n//# sourceMappingURL=concatMap.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber,_scheduler_async PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nimport { async } from '../scheduler/async';\nexport function debounceTime(dueTime, scheduler) {\n if (scheduler === void 0) {\n scheduler = async;\n }\n return function (source) { return source.lift(new DebounceTimeOperator(dueTime, scheduler)); };\n}\nvar DebounceTimeOperator = /*@__PURE__*/ (function () {\n function DebounceTimeOperator(dueTime, scheduler) {\n this.dueTime = dueTime;\n this.scheduler = scheduler;\n }\n DebounceTimeOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler));\n };\n return DebounceTimeOperator;\n}());\nvar DebounceTimeSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(DebounceTimeSubscriber, _super);\n function DebounceTimeSubscriber(destination, dueTime, scheduler) {\n var _this = _super.call(this, destination) || this;\n _this.dueTime = dueTime;\n _this.scheduler = scheduler;\n _this.debouncedSubscription = null;\n _this.lastValue = null;\n _this.hasValue = false;\n return _this;\n }\n DebounceTimeSubscriber.prototype._next = function (value) {\n this.clearDebounce();\n this.lastValue = value;\n this.hasValue = true;\n this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this));\n };\n DebounceTimeSubscriber.prototype._complete = function () {\n this.debouncedNext();\n this.destination.complete();\n };\n DebounceTimeSubscriber.prototype.debouncedNext = function () {\n this.clearDebounce();\n if (this.hasValue) {\n var lastValue = this.lastValue;\n this.lastValue = null;\n this.hasValue = false;\n this.destination.next(lastValue);\n }\n };\n DebounceTimeSubscriber.prototype.clearDebounce = function () {\n var debouncedSubscription = this.debouncedSubscription;\n if (debouncedSubscription !== null) {\n this.remove(debouncedSubscription);\n debouncedSubscription.unsubscribe();\n this.debouncedSubscription = null;\n }\n };\n return DebounceTimeSubscriber;\n}(Subscriber));\nfunction dispatchNext(subscriber) {\n subscriber.debouncedNext();\n}\n//# sourceMappingURL=debounceTime.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nexport function defaultIfEmpty(defaultValue) {\n if (defaultValue === void 0) {\n defaultValue = null;\n }\n return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); };\n}\nvar DefaultIfEmptyOperator = /*@__PURE__*/ (function () {\n function DefaultIfEmptyOperator(defaultValue) {\n this.defaultValue = defaultValue;\n }\n DefaultIfEmptyOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));\n };\n return DefaultIfEmptyOperator;\n}());\nvar DefaultIfEmptySubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(DefaultIfEmptySubscriber, _super);\n function DefaultIfEmptySubscriber(destination, defaultValue) {\n var _this = _super.call(this, destination) || this;\n _this.defaultValue = defaultValue;\n _this.isEmpty = true;\n return _this;\n }\n DefaultIfEmptySubscriber.prototype._next = function (value) {\n this.isEmpty = false;\n this.destination.next(value);\n };\n DefaultIfEmptySubscriber.prototype._complete = function () {\n if (this.isEmpty) {\n this.destination.next(this.defaultValue);\n }\n this.destination.complete();\n };\n return DefaultIfEmptySubscriber;\n}(Subscriber));\n//# sourceMappingURL=defaultIfEmpty.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function isDate(value) {\n return value instanceof Date && !isNaN(+value);\n}\n//# sourceMappingURL=isDate.js.map\n","/** PURE_IMPORTS_START tslib,_util_EmptyError,_Subscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { EmptyError } from '../util/EmptyError';\nimport { Subscriber } from '../Subscriber';\nexport function throwIfEmpty(errorFactory) {\n if (errorFactory === void 0) {\n errorFactory = defaultErrorFactory;\n }\n return function (source) {\n return source.lift(new ThrowIfEmptyOperator(errorFactory));\n };\n}\nvar ThrowIfEmptyOperator = /*@__PURE__*/ (function () {\n function ThrowIfEmptyOperator(errorFactory) {\n this.errorFactory = errorFactory;\n }\n ThrowIfEmptyOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new ThrowIfEmptySubscriber(subscriber, this.errorFactory));\n };\n return ThrowIfEmptyOperator;\n}());\nvar ThrowIfEmptySubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ThrowIfEmptySubscriber, _super);\n function ThrowIfEmptySubscriber(destination, errorFactory) {\n var _this = _super.call(this, destination) || this;\n _this.errorFactory = errorFactory;\n _this.hasValue = false;\n return _this;\n }\n ThrowIfEmptySubscriber.prototype._next = function (value) {\n this.hasValue = true;\n this.destination.next(value);\n };\n ThrowIfEmptySubscriber.prototype._complete = function () {\n if (!this.hasValue) {\n var err = void 0;\n try {\n err = this.errorFactory();\n }\n catch (e) {\n err = e;\n }\n this.destination.error(err);\n }\n else {\n return this.destination.complete();\n }\n };\n return ThrowIfEmptySubscriber;\n}(Subscriber));\nfunction defaultErrorFactory() {\n return new EmptyError();\n}\n//# sourceMappingURL=throwIfEmpty.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber,_util_ArgumentOutOfRangeError,_observable_empty PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nimport { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';\nimport { empty } from '../observable/empty';\nexport function take(count) {\n return function (source) {\n if (count === 0) {\n return empty();\n }\n else {\n return source.lift(new TakeOperator(count));\n }\n };\n}\nvar TakeOperator = /*@__PURE__*/ (function () {\n function TakeOperator(total) {\n this.total = total;\n if (this.total < 0) {\n throw new ArgumentOutOfRangeError;\n }\n }\n TakeOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new TakeSubscriber(subscriber, this.total));\n };\n return TakeOperator;\n}());\nvar TakeSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(TakeSubscriber, _super);\n function TakeSubscriber(destination, total) {\n var _this = _super.call(this, destination) || this;\n _this.total = total;\n _this.count = 0;\n return _this;\n }\n TakeSubscriber.prototype._next = function (value) {\n var total = this.total;\n var count = ++this.count;\n if (count <= total) {\n this.destination.next(value);\n if (count === total) {\n this.destination.complete();\n this.unsubscribe();\n }\n }\n };\n return TakeSubscriber;\n}(Subscriber));\n//# sourceMappingURL=take.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber,_Subscription PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nimport { Subscription } from '../Subscription';\nexport function finalize(callback) {\n return function (source) { return source.lift(new FinallyOperator(callback)); };\n}\nvar FinallyOperator = /*@__PURE__*/ (function () {\n function FinallyOperator(callback) {\n this.callback = callback;\n }\n FinallyOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new FinallySubscriber(subscriber, this.callback));\n };\n return FinallyOperator;\n}());\nvar FinallySubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(FinallySubscriber, _super);\n function FinallySubscriber(destination, callback) {\n var _this = _super.call(this, destination) || this;\n _this.add(new Subscription(callback));\n return _this;\n }\n return FinallySubscriber;\n}(Subscriber));\n//# sourceMappingURL=finalize.js.map\n","/** PURE_IMPORTS_START _util_EmptyError,_filter,_take,_defaultIfEmpty,_throwIfEmpty,_util_identity PURE_IMPORTS_END */\nimport { EmptyError } from '../util/EmptyError';\nimport { filter } from './filter';\nimport { take } from './take';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { identity } from '../util/identity';\nexport function first(predicate, defaultValue) {\n var hasDefaultValue = arguments.length >= 2;\n return function (source) { return source.pipe(predicate ? filter(function (v, i) { return predicate(v, i, source); }) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(function () { return new EmptyError(); })); };\n}\n//# sourceMappingURL=first.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber,_util_ArgumentOutOfRangeError,_observable_empty PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nimport { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';\nimport { empty } from '../observable/empty';\nexport function takeLast(count) {\n return function takeLastOperatorFunction(source) {\n if (count === 0) {\n return empty();\n }\n else {\n return source.lift(new TakeLastOperator(count));\n }\n };\n}\nvar TakeLastOperator = /*@__PURE__*/ (function () {\n function TakeLastOperator(total) {\n this.total = total;\n if (this.total < 0) {\n throw new ArgumentOutOfRangeError;\n }\n }\n TakeLastOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new TakeLastSubscriber(subscriber, this.total));\n };\n return TakeLastOperator;\n}());\nvar TakeLastSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(TakeLastSubscriber, _super);\n function TakeLastSubscriber(destination, total) {\n var _this = _super.call(this, destination) || this;\n _this.total = total;\n _this.ring = new Array();\n _this.count = 0;\n return _this;\n }\n TakeLastSubscriber.prototype._next = function (value) {\n var ring = this.ring;\n var total = this.total;\n var count = this.count++;\n if (ring.length < total) {\n ring.push(value);\n }\n else {\n var index = count % total;\n ring[index] = value;\n }\n };\n TakeLastSubscriber.prototype._complete = function () {\n var destination = this.destination;\n var count = this.count;\n if (count > 0) {\n var total = this.count >= this.total ? this.total : this.count;\n var ring = this.ring;\n for (var i = 0; i < total; i++) {\n var idx = (count++) % total;\n destination.next(ring[idx]);\n }\n }\n destination.complete();\n };\n return TakeLastSubscriber;\n}(Subscriber));\n//# sourceMappingURL=takeLast.js.map\n","/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscriber } from '../Subscriber';\nexport function scan(accumulator, seed) {\n var hasSeed = false;\n if (arguments.length >= 2) {\n hasSeed = true;\n }\n return function scanOperatorFunction(source) {\n return source.lift(new ScanOperator(accumulator, seed, hasSeed));\n };\n}\nvar ScanOperator = /*@__PURE__*/ (function () {\n function ScanOperator(accumulator, seed, hasSeed) {\n if (hasSeed === void 0) {\n hasSeed = false;\n }\n this.accumulator = accumulator;\n this.seed = seed;\n this.hasSeed = hasSeed;\n }\n ScanOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new ScanSubscriber(subscriber, this.accumulator, this.seed, this.hasSeed));\n };\n return ScanOperator;\n}());\nvar ScanSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(ScanSubscriber, _super);\n function ScanSubscriber(destination, accumulator, _seed, hasSeed) {\n var _this = _super.call(this, destination) || this;\n _this.accumulator = accumulator;\n _this._seed = _seed;\n _this.hasSeed = hasSeed;\n _this.index = 0;\n return _this;\n }\n Object.defineProperty(ScanSubscriber.prototype, \"seed\", {\n get: function () {\n return this._seed;\n },\n set: function (value) {\n this.hasSeed = true;\n this._seed = value;\n },\n enumerable: true,\n configurable: true\n });\n ScanSubscriber.prototype._next = function (value) {\n if (!this.hasSeed) {\n this.seed = value;\n this.destination.next(value);\n }\n else {\n return this._tryNext(value);\n }\n };\n ScanSubscriber.prototype._tryNext = function (value) {\n var index = this.index++;\n var result;\n try {\n result = this.accumulator(this.seed, value, index);\n }\n catch (err) {\n this.destination.error(err);\n }\n this.seed = result;\n this.destination.next(result);\n };\n return ScanSubscriber;\n}(Subscriber));\n//# sourceMappingURL=scan.js.map\n","/** PURE_IMPORTS_START _scan,_takeLast,_defaultIfEmpty,_util_pipe PURE_IMPORTS_END */\nimport { scan } from './scan';\nimport { takeLast } from './takeLast';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { pipe } from '../util/pipe';\nexport function reduce(accumulator, seed) {\n if (arguments.length >= 2) {\n return function reduceOperatorFunctionWithSeed(source) {\n return pipe(scan(accumulator, seed), takeLast(1), defaultIfEmpty(seed))(source);\n };\n }\n return function reduceOperatorFunction(source) {\n return pipe(scan(function (acc, value, index) { return accumulator(acc, value, index + 1); }), takeLast(1))(source);\n };\n}\n//# sourceMappingURL=reduce.js.map\n","/** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_innerSubscribe PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { async } from '../scheduler/async';\nimport { isDate } from '../util/isDate';\nimport { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';\nexport function timeoutWith(due, withObservable, scheduler) {\n if (scheduler === void 0) {\n scheduler = async;\n }\n return function (source) {\n var absoluteTimeout = isDate(due);\n var waitFor = absoluteTimeout ? (+due - scheduler.now()) : Math.abs(due);\n return source.lift(new TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler));\n };\n}\nvar TimeoutWithOperator = /*@__PURE__*/ (function () {\n function TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler) {\n this.waitFor = waitFor;\n this.absoluteTimeout = absoluteTimeout;\n this.withObservable = withObservable;\n this.scheduler = scheduler;\n }\n TimeoutWithOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new TimeoutWithSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.withObservable, this.scheduler));\n };\n return TimeoutWithOperator;\n}());\nvar TimeoutWithSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(TimeoutWithSubscriber, _super);\n function TimeoutWithSubscriber(destination, absoluteTimeout, waitFor, withObservable, scheduler) {\n var _this = _super.call(this, destination) || this;\n _this.absoluteTimeout = absoluteTimeout;\n _this.waitFor = waitFor;\n _this.withObservable = withObservable;\n _this.scheduler = scheduler;\n _this.scheduleTimeout();\n return _this;\n }\n TimeoutWithSubscriber.dispatchTimeout = function (subscriber) {\n var withObservable = subscriber.withObservable;\n subscriber._unsubscribeAndRecycle();\n subscriber.add(innerSubscribe(withObservable, new SimpleInnerSubscriber(subscriber)));\n };\n TimeoutWithSubscriber.prototype.scheduleTimeout = function () {\n var action = this.action;\n if (action) {\n this.action = action.schedule(this, this.waitFor);\n }\n else {\n this.add(this.action = this.scheduler.schedule(TimeoutWithSubscriber.dispatchTimeout, this.waitFor, this));\n }\n };\n TimeoutWithSubscriber.prototype._next = function (value) {\n if (!this.absoluteTimeout) {\n this.scheduleTimeout();\n }\n _super.prototype._next.call(this, value);\n };\n TimeoutWithSubscriber.prototype._unsubscribe = function () {\n this.action = undefined;\n this.scheduler = null;\n this.withObservable = null;\n };\n return TimeoutWithSubscriber;\n}(SimpleOuterSubscriber));\n//# sourceMappingURL=timeoutWith.js.map\n","/** PURE_IMPORTS_START _scheduler_async,_util_TimeoutError,_timeoutWith,_observable_throwError PURE_IMPORTS_END */\nimport { async } from '../scheduler/async';\nimport { TimeoutError } from '../util/TimeoutError';\nimport { timeoutWith } from './timeoutWith';\nimport { throwError } from '../observable/throwError';\nexport function timeout(due, scheduler) {\n if (scheduler === void 0) {\n scheduler = async;\n }\n return timeoutWith(due, throwError(new TimeoutError()), scheduler);\n}\n//# sourceMappingURL=timeout.js.map\n","/** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */\nimport { reduce } from './reduce';\nfunction toArrayReducer(arr, item, index) {\n if (index === 0) {\n return [item];\n }\n arr.push(item);\n return arr;\n}\nexport function toArray() {\n return reduce(toArrayReducer, []);\n}\n//# sourceMappingURL=toArray.js.map\n","import { AxiosError, AxiosRequestConfig, Method } from 'axios';\r\nimport axios from 'axios-observable';\r\nimport { IRestApiOptions, IRestRequestOptions } from '@vivli/core/infrastructure/interface';\r\nimport { from, Observable, throwError } from 'rxjs';\r\nimport { catchError, map, mergeMap } from 'rxjs/operators';\r\nimport { IConfig } from '@vivli/shared/infrastructure/interface';\r\n\r\nconst startTimeHeader = 'request-startTime';\r\n\r\nexport class RestApi {\r\n protected readonly _axiosInstance: axios;\r\n\r\n constructor(protected options: IRestApiOptions, public config?: IConfig) {\r\n const { baseUrl, retryCalls, retryDelay, headers, trackApiCall } = options;\r\n this._axiosInstance = axios.create({ baseURL: baseUrl, headers });\r\n this._axiosInstance.interceptors.request.use((config) => {\r\n config.headers[startTimeHeader] = new Date().getTime();\r\n return config;\r\n });\r\n this._axiosInstance.interceptors.response.use((response) => {\r\n const requestTime = Math.abs(new Date().getTime() - response.config.headers[startTimeHeader]);\r\n\r\n // added tsignore in order to check the window object to verify if this is a cypress call or not\r\n // do not try to call trackApiCall if cypress - JM 7-25-2022\r\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\r\n // @ts-ignore\r\n if (trackApiCall && !window.Cypress) {\r\n trackApiCall(requestTime);\r\n }\r\n return response;\r\n });\r\n }\r\n\r\n private buildRequest({\r\n url,\r\n method,\r\n data,\r\n options,\r\n authToken,\r\n }: {\r\n url: string;\r\n method: Method;\r\n data?: any;\r\n options?: IRestRequestOptions;\r\n authToken: string;\r\n }): Observable {\r\n //isJsonInput is true if the request data is suppose to be in json format,\r\n //false - when the data is FormData or any other type of data - not json.\r\n const isJsonInput =\r\n ( options?.additionalHeaders &&\r\n (!Object.keys(options.additionalHeaders).some((key) => key === 'Content-Type') ||\r\n options.additionalHeaders['Content-Type'].toString().toLower().indexOf('json') >= 0))??true;\r\n let requestConfig: AxiosRequestConfig = {\r\n url,\r\n method,\r\n headers: options?.additionalHeaders,\r\n data: isJsonInput ? JSON.stringify(data) : data,\r\n };\r\n\r\n if (options?.baseUrl) {\r\n requestConfig = {\r\n ...requestConfig,\r\n baseURL: options.baseUrl,\r\n };\r\n }\r\n\r\n if (options?.responseType) {\r\n requestConfig = {\r\n ...requestConfig,\r\n responseType: options.responseType,\r\n };\r\n }\r\n\r\n if (!options?.bypassAuth) {\r\n requestConfig = {\r\n ...requestConfig,\r\n headers: {\r\n ...requestConfig.headers,\r\n Authorization: `Bearer ${authToken}`,\r\n 'Content-Type': 'application/json; charset=utf-8',\r\n },\r\n };\r\n }\r\n\r\n if (options?.params) {\r\n requestConfig = {\r\n ...requestConfig,\r\n params: options.params,\r\n };\r\n }\r\n\r\n return this._axiosInstance.request(requestConfig).pipe(\r\n map((resp) => resp.data),\r\n catchError((err: AxiosError) => {\r\n if (err?.response?.data) {\r\n return throwError(err.response.request?.responseText);\r\n } else if (err?.message) {\r\n return throwError(err.message);\r\n } else {\r\n return throwError('Error occurred making call ' + err?.response?.request?.currentRequest?.toString());\r\n }\r\n })\r\n );\r\n }\r\n\r\n private handleAxiosCall({\r\n url,\r\n method,\r\n data,\r\n options,\r\n }: {\r\n url: string;\r\n method: Method;\r\n data?: any;\r\n options?: IRestRequestOptions;\r\n }): Observable {\r\n // if (options.bypassAuth)\r\n let authTokenCall: () => Promise;\r\n\r\n if (!options?.token) {\r\n if (options?.bypassAuth || !this.options.refreshAuthToken) {\r\n authTokenCall = () => Promise.resolve(null);\r\n } else {\r\n authTokenCall = this.options.refreshAuthToken;\r\n }\r\n } else {\r\n authTokenCall = () => Promise.resolve(options?.token);\r\n }\r\n\r\n const authObs = from(authTokenCall());\r\n\r\n return authObs.pipe(\r\n mergeMap((authToken) =>\r\n this.buildRequest({\r\n url,\r\n data,\r\n authToken,\r\n method,\r\n options,\r\n })\r\n )\r\n );\r\n }\r\n\r\n protected handleGet(url: string, options?: IRestRequestOptions): Observable {\r\n return this.handleAxiosCall({\r\n url,\r\n method: 'get',\r\n options,\r\n });\r\n }\r\n\r\n protected handlePost(url: string, data?: any, options?: IRestRequestOptions): Observable {\r\n return this.handleAxiosCall({\r\n url,\r\n method: 'post',\r\n data,\r\n options,\r\n });\r\n }\r\n\r\n protected handlePut(url: string, data?: any, options?: IRestRequestOptions): Observable {\r\n return this.handleAxiosCall({\r\n url,\r\n method: 'put',\r\n data,\r\n options,\r\n });\r\n }\r\n\r\n protected handlePatch(url: string, data?: any, options?: IRestRequestOptions): Observable {\r\n return this.handleAxiosCall({\r\n url,\r\n method: 'patch',\r\n data,\r\n options,\r\n });\r\n }\r\n\r\n protected handleDelete(url: string, options?: IRestRequestOptions): Observable {\r\n return this.handleAxiosCall({\r\n url,\r\n method: 'delete',\r\n options,\r\n });\r\n }\r\n}\r\n","export const RestDefaultHeaders = {\r\n 'Pragma': 'no-cache',\r\n 'Cache-Control': 'no-cache, no-store'\r\n}\r\n","export const countriesIntercept = [\r\n { name: 'Afghanistan', code: 'AFG', numberSites: 0 },\r\n {\r\n name: 'Åland Islands',\r\n code: 'ALA',\r\n numberSites: 0,\r\n },\r\n { name: 'Albania', code: 'ALB', numberSites: 0 },\r\n {\r\n name: 'Algeria',\r\n code: 'DZA',\r\n numberSites: 0,\r\n },\r\n { name: 'American Samoa', code: 'ASM', numberSites: 0 },\r\n {\r\n name: 'Andorra',\r\n code: 'AND',\r\n numberSites: 0,\r\n },\r\n { name: 'Angola', code: 'AGO', numberSites: 0 },\r\n {\r\n name: 'Anguilla',\r\n code: 'AIA',\r\n numberSites: 0,\r\n },\r\n { name: 'Antarctica', code: 'ATA', numberSites: 0 },\r\n {\r\n name: 'Antigua and Barbuda',\r\n code: 'ATG',\r\n numberSites: 0,\r\n },\r\n { name: 'Argentina', code: 'ARG', numberSites: 0 },\r\n {\r\n name: 'Armenia',\r\n code: 'ARM',\r\n numberSites: 0,\r\n },\r\n { name: 'Aruba', code: 'ABW', numberSites: 0 },\r\n {\r\n name: 'Australia',\r\n code: 'AUS',\r\n numberSites: 0,\r\n },\r\n { name: 'Austria', code: 'AUT', numberSites: 0 },\r\n {\r\n name: 'Azerbaijan',\r\n code: 'AZE',\r\n numberSites: 0,\r\n },\r\n { name: 'Bahamas', code: 'BHS', numberSites: 0 },\r\n {\r\n name: 'Bahrain',\r\n code: 'BHR',\r\n numberSites: 0,\r\n },\r\n { name: 'Bangladesh', code: 'BGD', numberSites: 0 },\r\n {\r\n name: 'Barbados',\r\n code: 'BRB',\r\n numberSites: 0,\r\n },\r\n { name: 'Belarus', code: 'BLR', numberSites: 0 },\r\n {\r\n name: 'Belgium',\r\n code: 'BEL',\r\n numberSites: 0,\r\n },\r\n { name: 'Belize', code: 'BLZ', numberSites: 0 },\r\n {\r\n name: 'Benin',\r\n code: 'BEN',\r\n numberSites: 0,\r\n },\r\n { name: 'Bermuda', code: 'BMU', numberSites: 0 },\r\n {\r\n name: 'Bhutan',\r\n code: 'BTN',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Bolivia (Plurinational State of)',\r\n code: 'BOL',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Bonaire, Sint Eustatius and Saba',\r\n code: 'BES',\r\n numberSites: 0,\r\n },\r\n { name: 'Bosnia and Herzegovina', code: 'BIH', numberSites: 0 },\r\n {\r\n name: 'Botswana',\r\n code: 'BWA',\r\n numberSites: 0,\r\n },\r\n { name: 'Bouvet Island', code: 'BVT', numberSites: 0 },\r\n {\r\n name: 'Brazil',\r\n code: 'BRA',\r\n numberSites: 0,\r\n },\r\n { name: 'British Indian Ocean Territory', code: 'IOT', numberSites: 0 },\r\n {\r\n name: 'Brunei Darussalam',\r\n code: 'BRN',\r\n numberSites: 0,\r\n },\r\n { name: 'Bulgaria', code: 'BGR', numberSites: 0 },\r\n {\r\n name: 'Burkina Faso',\r\n code: 'BFA',\r\n numberSites: 0,\r\n },\r\n { name: 'Burundi', code: 'BDI', numberSites: 0 },\r\n {\r\n name: 'Cambodia',\r\n code: 'KHM',\r\n numberSites: 0,\r\n },\r\n { name: 'Cameroon', code: 'CMR', numberSites: 0 },\r\n {\r\n name: 'Canada',\r\n code: 'CAN',\r\n numberSites: 0,\r\n },\r\n { name: 'Cabo Verde', code: 'CPV', numberSites: 0 },\r\n {\r\n name: 'Cayman Islands',\r\n code: 'CYM',\r\n numberSites: 0,\r\n },\r\n { name: 'Central African Republic', code: 'CAF', numberSites: 0 },\r\n {\r\n name: 'Chad',\r\n code: 'TCD',\r\n numberSites: 0,\r\n },\r\n { name: 'Chile', code: 'CHL', numberSites: 0 },\r\n {\r\n name: 'China',\r\n code: 'CHN',\r\n numberSites: 0,\r\n },\r\n { name: 'Christmas Island', code: 'CXR', numberSites: 0 },\r\n {\r\n name: 'Cocos (Keeling) Islands',\r\n code: 'CCK',\r\n numberSites: 0,\r\n },\r\n { name: 'Colombia', code: 'COL', numberSites: 0 },\r\n {\r\n name: 'Comoros',\r\n code: 'COM',\r\n numberSites: 0,\r\n },\r\n { name: 'Congo', code: 'COG', numberSites: 0 },\r\n {\r\n name: 'Congo (Democratic Republic of the)',\r\n code: 'COD',\r\n numberSites: 0,\r\n },\r\n { name: 'Cook Islands', code: 'COK', numberSites: 0 },\r\n {\r\n name: 'Costa Rica',\r\n code: 'CRI',\r\n numberSites: 0,\r\n },\r\n { name: 'Ivory Coast', code: 'CIV', numberSites: 0 },\r\n {\r\n name: 'Croatia',\r\n code: 'HRV',\r\n numberSites: 0,\r\n },\r\n { name: 'Cuba', code: 'CUB', numberSites: 0 },\r\n {\r\n name: 'Curaçao',\r\n code: 'CUW',\r\n numberSites: 0,\r\n },\r\n { name: 'Cyprus', code: 'CYP', numberSites: 0 },\r\n {\r\n name: 'Czech Republic',\r\n code: 'CZE',\r\n numberSites: 0,\r\n },\r\n { name: 'Denmark', code: 'DNK', numberSites: 0 },\r\n {\r\n name: 'Djibouti',\r\n code: 'DJI',\r\n numberSites: 0,\r\n },\r\n { name: 'Dominica', code: 'DMA', numberSites: 0 },\r\n {\r\n name: 'Dominican Republic',\r\n code: 'DOM',\r\n numberSites: 0,\r\n },\r\n { name: 'Ecuador', code: 'ECU', numberSites: 0 },\r\n {\r\n name: 'Egypt',\r\n code: 'EGY',\r\n numberSites: 0,\r\n },\r\n { name: 'El Salvador', code: 'SLV', numberSites: 0 },\r\n {\r\n name: 'Equatorial Guinea',\r\n code: 'GNQ',\r\n numberSites: 0,\r\n },\r\n { name: 'Eritrea', code: 'ERI', numberSites: 0 },\r\n {\r\n name: 'Estonia',\r\n code: 'EST',\r\n numberSites: 0,\r\n },\r\n { name: 'Ethiopia', code: 'ETH', numberSites: 0 },\r\n {\r\n name: 'Falkland Islands (Malvinas)',\r\n code: 'FLK',\r\n numberSites: 0,\r\n },\r\n { name: 'Faroe Islands', code: 'FRO', numberSites: 0 },\r\n {\r\n name: 'Fiji',\r\n code: 'FJI',\r\n numberSites: 0,\r\n },\r\n { name: 'Finland', code: 'FIN', numberSites: 0 },\r\n {\r\n name: 'France',\r\n code: 'FRA',\r\n numberSites: 0,\r\n },\r\n { name: 'French Guiana', code: 'GUF', numberSites: 0 },\r\n {\r\n name: 'French Polynesia',\r\n code: 'PYF',\r\n numberSites: 0,\r\n },\r\n { name: 'French Southern Territories', code: 'ATF', numberSites: 0 },\r\n {\r\n name: 'Gabon',\r\n code: 'GAB',\r\n numberSites: 0,\r\n },\r\n { name: 'Gambia', code: 'GMB', numberSites: 0 },\r\n {\r\n name: 'Georgia',\r\n code: 'GEO',\r\n numberSites: 0,\r\n },\r\n { name: 'Germany', code: 'DEU', numberSites: 0 },\r\n {\r\n name: 'Ghana',\r\n code: 'GHA',\r\n numberSites: 0,\r\n },\r\n { name: 'Gibraltar', code: 'GIB', numberSites: 0 },\r\n {\r\n name: 'Greece',\r\n code: 'GRC',\r\n numberSites: 0,\r\n },\r\n { name: 'Greenland', code: 'GRL', numberSites: 0 },\r\n {\r\n name: 'Grenada',\r\n code: 'GRD',\r\n numberSites: 0,\r\n },\r\n { name: 'Guadeloupe', code: 'GLP', numberSites: 0 },\r\n {\r\n name: 'Guam',\r\n code: 'GUM',\r\n numberSites: 0,\r\n },\r\n { name: 'Guatemala', code: 'GTM', numberSites: 0 },\r\n {\r\n name: 'Guernsey',\r\n code: 'GGY',\r\n numberSites: 0,\r\n },\r\n { name: 'Guinea', code: 'GIN', numberSites: 0 },\r\n {\r\n name: 'Guinea-Bissau',\r\n code: 'GNB',\r\n numberSites: 0,\r\n },\r\n { name: 'Guyana', code: 'GUY', numberSites: 0 },\r\n {\r\n name: 'Haiti',\r\n code: 'HTI',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Heard Island and McDonald Islands',\r\n code: 'HMD',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Holy See',\r\n code: 'VAT',\r\n numberSites: 0,\r\n },\r\n { name: 'Honduras', code: 'HND', numberSites: 0 },\r\n {\r\n name: 'Hong Kong',\r\n code: 'HKG',\r\n numberSites: 0,\r\n },\r\n { name: 'Hungary', code: 'HUN', numberSites: 0 },\r\n {\r\n name: 'Iceland',\r\n code: 'ISL',\r\n numberSites: 0,\r\n },\r\n { name: 'India', code: 'IND', numberSites: 0 },\r\n {\r\n name: 'Indonesia',\r\n code: 'IDN',\r\n numberSites: 0,\r\n },\r\n { name: 'Iran (Islamic Republic of)', code: 'IRN', numberSites: 0 },\r\n {\r\n name: 'Iraq',\r\n code: 'IRQ',\r\n numberSites: 0,\r\n },\r\n { name: 'Ireland', code: 'IRL', numberSites: 0 },\r\n {\r\n name: 'Isle of Man',\r\n code: 'IMN',\r\n numberSites: 0,\r\n },\r\n { name: 'Israel', code: 'ISR', numberSites: 0 },\r\n {\r\n name: 'Italy',\r\n code: 'ITA',\r\n numberSites: 0,\r\n },\r\n { name: 'Jamaica', code: 'JAM', numberSites: 0 },\r\n {\r\n name: 'Japan',\r\n code: 'JPN',\r\n numberSites: 0,\r\n },\r\n { name: 'Jersey', code: 'JEY', numberSites: 0 },\r\n {\r\n name: 'Jordan',\r\n code: 'JOR',\r\n numberSites: 0,\r\n },\r\n { name: 'Kazakhstan', code: 'KAZ', numberSites: 0 },\r\n {\r\n name: 'Kenya',\r\n code: 'KEN',\r\n numberSites: 0,\r\n },\r\n { name: 'Kiribati', code: 'KIR', numberSites: 0 },\r\n {\r\n name: \"Korea (Democratic People's Republic of)\",\r\n code: 'PRK',\r\n numberSites: 0,\r\n },\r\n { name: 'Korea (Republic of)', code: 'KOR', numberSites: 0 },\r\n {\r\n name: 'Kuwait',\r\n code: 'KWT',\r\n numberSites: 0,\r\n },\r\n { name: 'Kyrgyzstan', code: 'KGZ', numberSites: 0 },\r\n {\r\n name: \"Lao People's Democratic Republic\",\r\n code: 'LAO',\r\n numberSites: 0,\r\n },\r\n { name: 'Latvia', code: 'LVA', numberSites: 0 },\r\n {\r\n name: 'Lebanon',\r\n code: 'LBN',\r\n numberSites: 0,\r\n },\r\n { name: 'Lesotho', code: 'LSO', numberSites: 0 },\r\n {\r\n name: 'Liberia',\r\n code: 'LBR',\r\n numberSites: 0,\r\n },\r\n { name: 'Libya', code: 'LBY', numberSites: 0 },\r\n {\r\n name: 'Liechtenstein',\r\n code: 'LIE',\r\n numberSites: 0,\r\n },\r\n { name: 'Lithuania', code: 'LTU', numberSites: 0 },\r\n {\r\n name: 'Luxembourg',\r\n code: 'LUX',\r\n numberSites: 0,\r\n },\r\n { name: 'Macao', code: 'MAC', numberSites: 0 },\r\n {\r\n name: 'Macedonia (the former Yugoslav Republic of)',\r\n code: 'MKD',\r\n numberSites: 0,\r\n },\r\n { name: 'Madagascar', code: 'MDG', numberSites: 0 },\r\n {\r\n name: 'Malawi',\r\n code: 'MWI',\r\n numberSites: 0,\r\n },\r\n { name: 'Malaysia', code: 'MYS', numberSites: 0 },\r\n {\r\n name: 'Maldives',\r\n code: 'MDV',\r\n numberSites: 0,\r\n },\r\n { name: 'Mali', code: 'MLI', numberSites: 0 },\r\n {\r\n name: 'Malta',\r\n code: 'MLT',\r\n numberSites: 0,\r\n },\r\n { name: 'Marshall Islands', code: 'MHL', numberSites: 0 },\r\n {\r\n name: 'Martinique',\r\n code: 'MTQ',\r\n numberSites: 0,\r\n },\r\n { name: 'Mauritania', code: 'MRT', numberSites: 0 },\r\n {\r\n name: 'Mauritius',\r\n code: 'MUS',\r\n numberSites: 0,\r\n },\r\n { name: 'Mayotte', code: 'MYT', numberSites: 0 },\r\n {\r\n name: 'Mexico',\r\n code: 'MEX',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Micronesia (Federated States of)',\r\n code: 'FSM',\r\n numberSites: 0,\r\n },\r\n { name: 'Moldova (Republic of)', code: 'MDA', numberSites: 0 },\r\n {\r\n name: 'Monaco',\r\n code: 'MCO',\r\n numberSites: 0,\r\n },\r\n { name: 'Mongolia', code: 'MNG', numberSites: 0 },\r\n {\r\n name: 'Montenegro',\r\n code: 'MNE',\r\n numberSites: 0,\r\n },\r\n { name: 'Montserrat', code: 'MSR', numberSites: 0 },\r\n {\r\n name: 'Morocco',\r\n code: 'MAR',\r\n numberSites: 0,\r\n },\r\n { name: 'Mozambique', code: 'MOZ', numberSites: 0 },\r\n {\r\n name: 'Myanmar',\r\n code: 'MMR',\r\n numberSites: 0,\r\n },\r\n { name: 'Namibia', code: 'NAM', numberSites: 0 },\r\n {\r\n name: 'Nauru',\r\n code: 'NRU',\r\n numberSites: 0,\r\n },\r\n { name: 'Nepal', code: 'NPL', numberSites: 0 },\r\n {\r\n name: 'Netherlands',\r\n code: 'NLD',\r\n numberSites: 0,\r\n },\r\n { name: 'New Caledonia', code: 'NCL', numberSites: 0 },\r\n {\r\n name: 'New Zealand',\r\n code: 'NZL',\r\n numberSites: 0,\r\n },\r\n { name: 'Nicaragua', code: 'NIC', numberSites: 0 },\r\n {\r\n name: 'Niger',\r\n code: 'NER',\r\n numberSites: 0,\r\n },\r\n { name: 'Nigeria', code: 'NGA', numberSites: 0 },\r\n {\r\n name: 'Niue',\r\n code: 'NIU',\r\n numberSites: 0,\r\n },\r\n { name: 'Norfolk Island', code: 'NFK', numberSites: 0 },\r\n {\r\n name: 'Northern Mariana Islands',\r\n code: 'MNP',\r\n numberSites: 0,\r\n },\r\n { name: 'Norway', code: 'NOR', numberSites: 0 },\r\n {\r\n name: 'Oman',\r\n code: 'OMN',\r\n numberSites: 0,\r\n },\r\n { name: 'Pakistan', code: 'PAK', numberSites: 0 },\r\n {\r\n name: 'Palau',\r\n code: 'PLW',\r\n numberSites: 0,\r\n },\r\n { name: 'Palestine, State of', code: 'PSE', numberSites: 0 },\r\n {\r\n name: 'Panama',\r\n code: 'PAN',\r\n numberSites: 0,\r\n },\r\n { name: 'Papua New Guinea', code: 'PNG', numberSites: 0 },\r\n {\r\n name: 'Paraguay',\r\n code: 'PRY',\r\n numberSites: 0,\r\n },\r\n { name: 'Peru', code: 'PER', numberSites: 0 },\r\n {\r\n name: 'Philippines',\r\n code: 'PHL',\r\n numberSites: 0,\r\n },\r\n { name: 'Pitcairn', code: 'PCN', numberSites: 0 },\r\n {\r\n name: 'Poland',\r\n code: 'POL',\r\n numberSites: 0,\r\n },\r\n { name: 'Portugal', code: 'PRT', numberSites: 0 },\r\n {\r\n name: 'Puerto Rico',\r\n code: 'PRI',\r\n numberSites: 0,\r\n },\r\n { name: 'Qatar', code: 'QAT', numberSites: 0 },\r\n {\r\n name: 'Réunion',\r\n code: 'REU',\r\n numberSites: 0,\r\n },\r\n { name: 'Romania', code: 'ROU', numberSites: 0 },\r\n {\r\n name: 'Russian Federation',\r\n code: 'RUS',\r\n numberSites: 0,\r\n },\r\n { name: 'Rwanda', code: 'RWA', numberSites: 0 },\r\n {\r\n name: 'Saint Barthélemy',\r\n code: 'BLM',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Saint Helena, Ascension and Tristan da Cunha',\r\n code: 'SHN',\r\n numberSites: 0,\r\n },\r\n { name: 'Saint Kitts and Nevis', code: 'KNA', numberSites: 0 },\r\n {\r\n name: 'Saint Lucia',\r\n code: 'LCA',\r\n numberSites: 0,\r\n },\r\n { name: 'Saint Martin (French part)', code: 'MAF', numberSites: 0 },\r\n {\r\n name: 'Saint Pierre and Miquelon',\r\n code: 'SPM',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Saint Vincent and the Grenadines',\r\n code: 'VCT',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Samoa',\r\n code: 'WSM',\r\n numberSites: 0,\r\n },\r\n { name: 'San Marino', code: 'SMR', numberSites: 0 },\r\n {\r\n name: 'Sao Tome and Principe',\r\n code: 'STP',\r\n numberSites: 0,\r\n },\r\n { name: 'Saudi Arabia', code: 'SAU', numberSites: 0 },\r\n {\r\n name: 'Senegal',\r\n code: 'SEN',\r\n numberSites: 0,\r\n },\r\n { name: 'Serbia', code: 'SRB', numberSites: 0 },\r\n {\r\n name: 'Seychelles',\r\n code: 'SYC',\r\n numberSites: 0,\r\n },\r\n { name: 'Sierra Leone', code: 'SLE', numberSites: 0 },\r\n {\r\n name: 'Singapore',\r\n code: 'SGP',\r\n numberSites: 0,\r\n },\r\n { name: 'Sint Maarten (Dutch part)', code: 'SXM', numberSites: 0 },\r\n {\r\n name: 'Slovakia',\r\n code: 'SVK',\r\n numberSites: 0,\r\n },\r\n { name: 'Slovenia', code: 'SVN', numberSites: 0 },\r\n {\r\n name: 'Solomon Islands',\r\n code: 'SLB',\r\n numberSites: 0,\r\n },\r\n { name: 'Somalia', code: 'SOM', numberSites: 0 },\r\n {\r\n name: 'South Africa',\r\n code: 'ZAF',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'South Georgia and the South Sandwich Islands',\r\n code: 'SGS',\r\n numberSites: 0,\r\n },\r\n { name: 'South Sudan', code: 'SSD', numberSites: 0 },\r\n {\r\n name: 'Spain',\r\n code: 'ESP',\r\n numberSites: 0,\r\n },\r\n { name: 'Sri Lanka', code: 'LKA', numberSites: 0 },\r\n {\r\n name: 'Sudan',\r\n code: 'SDN',\r\n numberSites: 0,\r\n },\r\n { name: 'Suriname', code: 'SUR', numberSites: 0 },\r\n {\r\n name: 'Svalbard and Jan Mayen',\r\n code: 'SJM',\r\n numberSites: 0,\r\n },\r\n { name: 'Swaziland', code: 'SWZ', numberSites: 0 },\r\n {\r\n name: 'Sweden',\r\n code: 'SWE',\r\n numberSites: 0,\r\n },\r\n { name: 'Switzerland', code: 'CHE', numberSites: 0 },\r\n {\r\n name: 'Syrian Arab Republic',\r\n code: 'SYR',\r\n numberSites: 0,\r\n },\r\n { name: 'Taiwan, Province of China', code: 'TWN', numberSites: 0 },\r\n {\r\n name: 'Tajikistan',\r\n code: 'TJK',\r\n numberSites: 0,\r\n },\r\n { name: 'Tanzania, United Republic of', code: 'TZA', numberSites: 0 },\r\n {\r\n name: 'Thailand',\r\n code: 'THA',\r\n numberSites: 0,\r\n },\r\n { name: 'Timor-Leste', code: 'TLS', numberSites: 0 },\r\n {\r\n name: 'Togo',\r\n code: 'TGO',\r\n numberSites: 0,\r\n },\r\n { name: 'Tokelau', code: 'TKL', numberSites: 0 },\r\n {\r\n name: 'Tonga',\r\n code: 'TON',\r\n numberSites: 0,\r\n },\r\n { name: 'Trinidad and Tobago', code: 'TTO', numberSites: 0 },\r\n {\r\n name: 'Tunisia',\r\n code: 'TUN',\r\n numberSites: 0,\r\n },\r\n { name: 'Turkey', code: 'TUR', numberSites: 0 },\r\n {\r\n name: 'Turkmenistan',\r\n code: 'TKM',\r\n numberSites: 0,\r\n },\r\n { name: 'Turks and Caicos Islands', code: 'TCA', numberSites: 0 },\r\n {\r\n name: 'Tuvalu',\r\n code: 'TUV',\r\n numberSites: 0,\r\n },\r\n { name: 'Uganda', code: 'UGA', numberSites: 0 },\r\n {\r\n name: 'Ukraine',\r\n code: 'UKR',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'United Arab Emirates',\r\n code: 'ARE',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'United Kingdom of Great Britain and Northern Ireland',\r\n code: 'GBR',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'United States of America',\r\n code: 'USA',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'United States Minor Outlying Islands',\r\n code: 'UMI',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Uruguay',\r\n code: 'URY',\r\n numberSites: 0,\r\n },\r\n { name: 'Uzbekistan', code: 'UZB', numberSites: 0 },\r\n {\r\n name: 'Vanuatu',\r\n code: 'VUT',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Venezuela (Bolivarian Republic of)',\r\n code: 'VEN',\r\n numberSites: 0,\r\n },\r\n {\r\n name: 'Viet Nam',\r\n code: 'VNM',\r\n numberSites: 0,\r\n },\r\n { name: 'Virgin Islands (British)', code: 'VGB', numberSites: 0 },\r\n {\r\n name: 'Virgin Islands (U.S.)',\r\n code: 'VIR',\r\n numberSites: 0,\r\n },\r\n { name: 'Wallis and Futuna', code: 'WLF', numberSites: 0 },\r\n {\r\n name: 'Western Sahara',\r\n code: 'ESH',\r\n numberSites: 0,\r\n },\r\n { name: 'Yemen', code: 'YEM', numberSites: 0 },\r\n {\r\n name: 'Zambia',\r\n code: 'ZMB',\r\n numberSites: 0,\r\n },\r\n { name: 'Zimbabwe', code: 'ZWE', numberSites: 0 },\r\n];\r\n","export const rejectionReasonsIntercept = [\r\n {\r\n description:\r\n 'The Data Request is not seeking access to anonymized patient level data',\r\n code: '1',\r\n active: true,\r\n },\r\n {\r\n description:\r\n 'The Data Request did not meet the data contributor/sponsor policies for informed consent',\r\n code: '2',\r\n active: true,\r\n },\r\n {\r\n description:\r\n 'The Data Request required data that was not collected in the studies requested',\r\n code: '3',\r\n active: true,\r\n },\r\n {\r\n description:\r\n \"The Data Request competes with the data contributor/sponsor's publication plan\",\r\n code: '4',\r\n active: true,\r\n },\r\n {\r\n description:\r\n \"The data contributor or sponsor doesn't have the legal authority to provide the data\",\r\n code: '5',\r\n active: true,\r\n },\r\n {\r\n description:\r\n 'The data requested is not appropriate for the research proposal in the Data Request',\r\n code: '6',\r\n active: true,\r\n },\r\n {\r\n description:\r\n \"The Data Request's research proposal lacks clear scientific merit\",\r\n code: '7',\r\n active: true,\r\n },\r\n {\r\n description:\r\n \"The Data Request's project aim is commercial or litigious\",\r\n code: '8',\r\n active: true,\r\n },\r\n {\r\n description: 'The Data Request is Out of Scope',\r\n code: '9',\r\n active: true,\r\n },\r\n {\r\n description: 'The data requested is unavailable',\r\n code: '10',\r\n active: true,\r\n },\r\n {\r\n description:\r\n 'The data requested cannot be shared due to ongoing regulatory activities',\r\n code: '11',\r\n active: true,\r\n },\r\n {\r\n description: 'The data requested was not collected in English',\r\n code: '12',\r\n active: true,\r\n },\r\n {\r\n description: 'Other reason for non-approval (please explain below)',\r\n code: '13',\r\n active: true,\r\n },\r\n];\r\n","export const allowedFileUploadExtensionsIntercept = [\r\n '.doc',\r\n '.xls',\r\n '.csv',\r\n '.txt',\r\n '.pdf',\r\n '.rar',\r\n '.zip',\r\n '.7z',\r\n '.cab',\r\n '.tar',\r\n '.gz',\r\n '.bz2',\r\n '.zipx',\r\n '.docx',\r\n '.docm',\r\n '.dotx',\r\n '.dotm',\r\n '.xlsx',\r\n '.xlsm',\r\n '.xltx',\r\n '.xltm',\r\n '.xlsb',\r\n '.xlam',\r\n '.pptx',\r\n '.pptm',\r\n '.potx',\r\n '.potm',\r\n '.ppam',\r\n '.ppsx',\r\n '.ppsm',\r\n '.sldx',\r\n '.sldm',\r\n '.thmx',\r\n '.vsdx',\r\n '.vsdm',\r\n '.vssx',\r\n '.vssm',\r\n '.vstx',\r\n '.vstm',\r\n '.jpg',\r\n '.jpeg',\r\n '.gif',\r\n '.png',\r\n '.tif',\r\n '.tiff',\r\n '.sasbat',\r\n '.sas7bdat',\r\n '.r',\r\n '.py',\r\n '.pyw',\r\n '.sas',\r\n '.xpt',\r\n '.dta',\r\n '.sav',\r\n '.rtf',\r\n '.xml',\r\n '.eps',\r\n '.rmd',\r\n '.rds',\r\n '.rdata',\r\n '.pkl',\r\n];\r\n","export const disallowedPublicEmailDomainsIntercept = [\r\n 'gmail.com',\r\n 'hotmail.com',\r\n 'aol.com',\r\n 'yahoo.com',\r\n 'msn.com',\r\n 'hotmail.it',\r\n 'btinternet.com',\r\n 'mail.mil',\r\n 'Verizon.net',\r\n 'comcast.net',\r\n 'live.com',\r\n '163.com',\r\n '126.com',\r\n];\r\n","export const therapeuticAreaItemsIntercept = [\r\n {\r\n description: 'Infectious Diseases',\r\n code: 'AC0456DD-3CF0-48CB-93BD-F9F4948311AD',\r\n active: true,\r\n },\r\n {\r\n description: 'Gastroenterology',\r\n code: 'A68D10C2-2CCD-4603-A260-DA721941D779',\r\n active: true,\r\n },\r\n {\r\n description: 'Neurology',\r\n code: '2553E0CC-4638-44DF-93B0-2973FC09F0C6',\r\n active: true,\r\n },\r\n {\r\n description: 'Rheumatology',\r\n code: '0064F029-93DD-4591-B66A-E0C7A18C3ADF',\r\n active: true,\r\n },\r\n {\r\n description: 'Dermatology',\r\n code: 'C67221DA-6BC0-4209-9DDE-CAF160618603',\r\n active: true,\r\n },\r\n {\r\n description: 'Immunology',\r\n code: '07238C71-BCA5-4A11-84FE-DDC7548BDAAE',\r\n active: true,\r\n },\r\n {\r\n description: 'Methods',\r\n code: '76E7A0AA-E09A-4C95-A840-D16ED7119531',\r\n active: true,\r\n },\r\n {\r\n description: 'Cardiovascular',\r\n code: '7F648F75-04BA-491A-8C3B-26D28D7624A4',\r\n active: true,\r\n },\r\n {\r\n description: 'Psychiatry',\r\n code: 'FF66C281-325E-4DCD-ACEB-1B8A2D116508',\r\n active: true,\r\n },\r\n {\r\n description: 'Pulmonary',\r\n code: 'DA4A4863-4E24-4AC5-99D6-B14CD8A80872',\r\n active: true,\r\n },\r\n {\r\n description: 'Orthopedics',\r\n code: 'AD5C31B0-755D-423E-8563-880ED405BD53',\r\n active: true,\r\n },\r\n {\r\n description: 'Oncology',\r\n code: '414594CB-D676-4B1E-9812-1D147294AAF8',\r\n active: true,\r\n },\r\n {\r\n description: 'Cardiology',\r\n code: '5DCDC335-EF4A-4C4D-9E5F-E0E8825E7ADD',\r\n active: true,\r\n },\r\n {\r\n description: 'Endocrinology',\r\n code: '5EABAA0F-A595-4A67-8E02-51CA26776B49',\r\n active: true,\r\n },\r\n {\r\n description: 'Nephrology',\r\n code: '067B772A-3943-456C-9BB7-2EC6D9DC9343',\r\n active: true,\r\n },\r\n {\r\n description: 'Vaccines',\r\n code: 'CAF6A8A3-87EA-4B28-8FB0-8FAACCBBE8E5',\r\n active: true,\r\n },\r\n {\r\n description: 'Hematology',\r\n code: 'B23BD45E-44DD-4CAF-B4DA-BC595BF260F3',\r\n active: true,\r\n },\r\n {\r\n description: 'Training',\r\n code: '1909E4F4-6471-4684-9207-0D0080E2CC96',\r\n active: true,\r\n },\r\n {\r\n description: 'N/A',\r\n code: 'DDF54406-7022-4331-997C-439D5BD0E46E',\r\n active: true,\r\n },\r\n {\r\n description: 'Urology',\r\n code: 'D2E81B6E-8A3E-4A84-9791-37D10C777097',\r\n active: true,\r\n },\r\n {\r\n description: 'Opthamology',\r\n code: '5A937E19-1A11-4F16-9AEE-C7DD376A6F95',\r\n active: true,\r\n },\r\n {\r\n description: 'Gynecology',\r\n code: '2F4FA489-76A8-42E0-BDD1-02689EF785C0',\r\n active: true,\r\n },\r\n {\r\n description: 'Respiratory',\r\n code: 'DC2F2DBF-790C-4D1C-AB08-834FD19BF82A',\r\n active: true,\r\n },\r\n {\r\n description: 'AI technology',\r\n code: 'AC9D752E-7AC1-48C8-B492-D4A8282377A6',\r\n active: true,\r\n },\r\n {\r\n description: 'Alcohol dependence',\r\n code: 'D295C4F9-3E51-4DD8-91E0-1E437A86A495',\r\n active: true,\r\n },\r\n {\r\n description: 'Blockchain architecture',\r\n code: '0CC99E00-39A5-4899-A1D1-F04D2118158D',\r\n active: true,\r\n },\r\n {\r\n description: 'Clinical Trial design',\r\n code: 'E8A54E96-3A85-4B75-AE85-DD6738FEC373',\r\n active: true,\r\n },\r\n {\r\n description: 'Device',\r\n code: 'E8EE6D92-115E-41C9-890B-7469E2B1FF5E',\r\n active: true,\r\n },\r\n {\r\n description: 'Genomics',\r\n code: 'FE734D77-1F5A-4D04-9AC7-A553678D7711',\r\n active: true,\r\n },\r\n {\r\n description: 'Pharmacokinetic (PK) model',\r\n code: '33992960-E515-4C7B-9D6C-FF02D89C8D09',\r\n active: true,\r\n },\r\n];\r\n","export const partnersIntercept = [\r\n {\r\n name: 'addidev',\r\n code: '04CA586D-6A81-4ABC-8184-86DBCE073C1F',\r\n active: false,\r\n sso: true,\r\n identityprovider:\r\n 'https://adb2caddi.b2clogin.com/71873d2c-f9d0-44d0-aad5-1652dccfd856/v2.0/',\r\n displayname: 'ADWB DEV',\r\n },\r\n {\r\n name: 'addi',\r\n code: '1790F0E2-54AE-4AE9-8F12-51D61E077858',\r\n active: false,\r\n sso: true,\r\n identityprovider:\r\n 'https://aridhiadevelopmentmcab2c.b2clogin.com/117239ad-4d13-4708-832d-5e4cbdb50c69/v2.0/',\r\n displayname: 'ADWB',\r\n },\r\n {\r\n name: 'addiprod',\r\n code: 'A0A22C82-F7BD-4AAE-BEBF-74A5B0611D0A',\r\n active: true,\r\n sso: true,\r\n identityprovider:\r\n 'https://addib2c.b2clogin.com/c201a81c-a008-4c46-8128-ddebdd6ac1be/v2.0/',\r\n displayname: 'ADWB',\r\n },\r\n {\r\n name: 'addidev2',\r\n code: '71C17F5C-445E-4617-8340-AB269BED2A47',\r\n active: true,\r\n sso: true,\r\n identityprovider:\r\n 'https://aridhiadevelopmentmcab2c.b2clogin.com/117239ad-4d13-4708-832d-5e4cbdb50c69/v2.0/',\r\n displayname: 'ADWB',\r\n },\r\n];\r\n","export const accessibleRightsIntercept = [\r\n {\r\n rightsHostName: 'vivli',\r\n rightsHostUrl: 'https://vivli.org',\r\n rightsText:\r\n 'Study data may be accessed by completing a request form at https://vivli.org. It will then be reviewed according to the data contributor’s governance policy, see https://vivli.org/members/ourmembers/ for Vivli member’s review process. If approved, use of the data is governed by the data use agreement at https://vivli.org/resources/vivli-data-use-agreement/',\r\n active: true,\r\n },\r\n {\r\n rightsHostName: 'amr',\r\n rightsHostUrl: 'https://amr.vivli.org',\r\n rightsText:\r\n 'AMR surveillance data may be accessed by completing a request form at https://amr.vivli.org. More information about the available datasets and access process can be found at https://amr.vivli.org/resources.',\r\n active: true,\r\n },\r\n];\r\n","export const virtualMachineTypesIntercept = [\r\n {\r\n title: 'Standard Environment',\r\n jupyterNotebook: true,\r\n pythonR: true,\r\n stata: false,\r\n sas: null,\r\n machineSize: '2CPUx7GB',\r\n initialCost: 'No charge for 365 days',\r\n afterInitialPeriod: '$12/Day after 365 days, 2 concurrent logins',\r\n continuousExplanation:\r\n 'Can be extended by stopping the Research Environment when not in use',\r\n startTitle: 'Start Standard Environment',\r\n vmSize: 'Standard_DS2_v2',\r\n advanced: false,\r\n noCharge: 365,\r\n },\r\n {\r\n title: 'Premium Environment',\r\n jupyterNotebook: true,\r\n pythonR: true,\r\n stata: false,\r\n sas: false,\r\n machineSize: '4CPUx14GB',\r\n initialCost: 'No charge for 90 days',\r\n afterInitialPeriod: '$25/Day after 90 days, 2 concurrent logins',\r\n continuousExplanation: '',\r\n startTitle: 'Start Premium Environment',\r\n vmSize: 'Standard_DS3_v2',\r\n advanced: false,\r\n noCharge: 90,\r\n },\r\n {\r\n title: 'Large Environment',\r\n jupyterNotebook: true,\r\n pythonR: true,\r\n stata: false,\r\n sas: false,\r\n machineSize: '16CPUx64GB',\r\n initialCost: '$50/Day',\r\n afterInitialPeriod: '$50/Day',\r\n continuousExplanation: '',\r\n startTitle: 'Start Large Environment',\r\n vmSize: 'Standard_D16s_v3',\r\n advanced: true,\r\n noCharge: 0,\r\n },\r\n {\r\n title: 'Compute Optimized Environment',\r\n jupyterNotebook: true,\r\n pythonR: true,\r\n stata: false,\r\n sas: false,\r\n machineSize: '32CPUx64GB',\r\n initialCost: '$85/Day',\r\n afterInitialPeriod: '$85/Day',\r\n continuousExplanation: '',\r\n startTitle: 'Start Optimized Environment',\r\n vmSize: 'Standard_F32s_v2',\r\n advanced: true,\r\n noCharge: 0,\r\n },\r\n {\r\n title: 'Memory Optimized Environment',\r\n jupyterNotebook: true,\r\n pythonR: true,\r\n stata: false,\r\n sas: false,\r\n machineSize: '64CPUx128GB',\r\n initialCost: '$165/Day',\r\n afterInitialPeriod: '$165/Day',\r\n continuousExplanation: '',\r\n startTitle: 'Start Memory Optimized Environment',\r\n vmSize: 'Standard_F64s_v2',\r\n advanced: true,\r\n noCharge: 0,\r\n },\r\n {\r\n title: 'Compute Optimized (L) Environment',\r\n jupyterNotebook: true,\r\n pythonR: true,\r\n stata: false,\r\n sas: false,\r\n machineSize: '64CPUx504GB',\r\n initialCost: '$190/Day',\r\n afterInitialPeriod: '$190/Day',\r\n continuousExplanation: '',\r\n startTitle: 'Start Memory Optimized (L) Environment',\r\n vmSize: 'Standard_E64s_v4',\r\n advanced: true,\r\n noCharge: 0,\r\n },\r\n];\r\n","export const workflowStepNormsIntercept = [\r\n {\r\n normDescription: 'PreparationDays',\r\n workflowStepType: 'Preparation',\r\n code: 'F552D278-578D-4A5F-8B23-1EF70239098C',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'Draft',\r\n },\r\n {\r\n normDescription: 'FormCheckDays',\r\n workflowStepType: 'FormCheck',\r\n code: '6E6AEAD6-4B4F-4F56-8E5B-E7374B2667F4',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'SubmittedToVivli',\r\n },\r\n {\r\n normDescription: 'DcReviewDays',\r\n workflowStepType: 'DataContributorReview',\r\n code: '487D90C1-5B25-4176-8307-D31D80336862',\r\n active: true,\r\n days: 21,\r\n startingStatus: 'AwaitingDataProviderApproval',\r\n },\r\n {\r\n normDescription: 'DcRequestRevisionDays',\r\n workflowStepType: 'DcRequestRevision',\r\n code: 'A53FD17D-A24C-4608-9DA4-D81069F171B2',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'RevisionsRequestedByDataProvider',\r\n },\r\n {\r\n normDescription: 'DcRejectedDays',\r\n workflowStepType: 'DcRejected',\r\n code: '89A61527-35E4-4934-B5C4-CA73FFAF419A',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'RejectedByDataProvider',\r\n },\r\n {\r\n normDescription: 'IrpReviewDays',\r\n workflowStepType: 'IrpReview',\r\n code: 'C1DE15DE-701A-4731-8E1C-1C363E3BB874',\r\n active: true,\r\n days: 30,\r\n startingStatus: 'AwaitingIRPApproval',\r\n },\r\n {\r\n normDescription: 'IrpRequestRevisionDays',\r\n workflowStepType: 'IrpRequestRevision',\r\n code: '94528F66-6D34-4C6A-B1C8-59049D1E73A5',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'RevisionsRequestedByIRP',\r\n },\r\n {\r\n normDescription: 'IrpRejectedDays',\r\n workflowStepType: 'IrpRejected',\r\n code: 'DE29C80A-B0B0-41C0-8924-EB5352DAF526',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'RejectedByIRP',\r\n },\r\n {\r\n normDescription: 'DuaApprovalDays',\r\n workflowStepType: 'DuaApproval',\r\n code: '70937F5E-0A23-4347-9B8F-1CB0C96F75C0',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'AwaitingDUAValidation',\r\n },\r\n {\r\n normDescription: 'DataUploadDays',\r\n workflowStepType: 'DataUpload',\r\n code: '091E4EC1-3B35-4D82-AF28-081615807E3C',\r\n active: true,\r\n days: 30,\r\n startingStatus: 'DUAValidated',\r\n },\r\n {\r\n normDescription: 'AnalysisDays',\r\n workflowStepType: 'Analysis',\r\n code: '84469284-D9E4-4E9A-BFBC-BD2BA7779EC3',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'Fulfilled',\r\n },\r\n {\r\n normDescription: 'InactiveDays',\r\n workflowStepType: 'Inactive',\r\n code: '6409070C-8427-407F-84ED-35BF30E5EDF0',\r\n active: true,\r\n days: -1,\r\n startingStatus: 'Archived',\r\n },\r\n];\r\n","export const reportSpecsIntercept = [\r\n {\r\n name: 'Standard Display, 1 Data Request per Row (Vivli Admin)',\r\n accessType: 'Displayed',\r\n userType: 'VivliAdmin',\r\n reportGenerationType: 'RequestPerRow',\r\n code: 'B25257D5-9A12-49B1-8C28-F7928DD5F73C',\r\n active: true,\r\n default: true,\r\n reportColumns: [\r\n {\r\n columnPropertyName: 'VivliId',\r\n columnTitle: 'Vivli Id',\r\n wrapText: false,\r\n width: 150,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcher',\r\n columnTitle: 'Lead Researcher',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vivliOwner',\r\n columnTitle: 'Vivli Owner',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dataContributorsList',\r\n columnTitle: 'Data Contributors',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Contributors' },\r\n },\r\n {\r\n columnPropertyName: 'requestedStudiesCount',\r\n columnTitle: 'Total Studies Requested',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'currentStatus',\r\n columnTitle: 'Current Status',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.actionsRequired',\r\n columnTitle: 'Actions Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'activitiesRequired',\r\n columnTitle: 'Decisions and Uploads Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.highlightedDaysInCurrentWorkflowStep',\r\n columnTitle: 'Days in Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.currentWorkflowStepTargetDays',\r\n columnTitle: 'Target Days for Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.feedback',\r\n columnTitle: 'Feedback',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.requestReviewStatusList',\r\n columnTitle: 'Request Review Status',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.duaStatusList',\r\n columnTitle: 'DUA Status',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.dataUploadStatusList',\r\n columnTitle: 'Data Upload Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'resultsRemovalRequestsList',\r\n columnTitle: 'Results Export Requests',\r\n wrapText: false,\r\n width: 400,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Requests' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.publicationProgress',\r\n columnTitle: 'Publication Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.additionalNotes',\r\n columnTitle: 'Additional Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.internalNotes',\r\n columnTitle: 'Internal Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'remainingNoChargeDays',\r\n columnTitle: 'Remaining No-Charge Days',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.nextActionDate',\r\n columnTitle: 'Next Action Date',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.nextActionNotes',\r\n columnTitle: 'Next Action Notes',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.currentWorkflowStepStartDate',\r\n columnTitle: 'Start Date of Current Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'active',\r\n columnTitle: 'Active',\r\n wrapText: false,\r\n width: 100,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateModified',\r\n columnTitle: 'Date of Last Change',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.firstPublicationDate',\r\n columnTitle: 'Date First Published',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n ],\r\n },\r\n {\r\n name: 'Standard Export, 1 Data Request per Row (Vivli Admin)',\r\n accessType: 'Exported',\r\n userType: 'VivliAdmin',\r\n reportGenerationType: 'RequestPerRow',\r\n code: '451DB49E-166E-4D0F-8648-7C071C5F9962',\r\n active: true,\r\n default: false,\r\n reportColumns: [\r\n {\r\n columnPropertyName: 'VivliId',\r\n columnTitle: 'Vivli Id',\r\n wrapText: false,\r\n width: 150,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'researchTitle',\r\n columnTitle: 'Title',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcher',\r\n columnTitle: 'Lead Researcher',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherAffiliation',\r\n columnTitle: 'Lead Researcher Affiliation',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherTitle',\r\n columnTitle: 'Lead Researcher Title',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherEmail',\r\n columnTitle: 'Lead Researcher Email',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vivliOwner',\r\n columnTitle: 'Vivli Owner',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dataContributorsList',\r\n columnTitle: 'Data Contributors',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Contributors' },\r\n },\r\n {\r\n columnPropertyName: 'requestedStudiesCount',\r\n columnTitle: 'Total Studies Requested',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'currentStatus',\r\n columnTitle: 'Current Status',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'active',\r\n columnTitle: 'Active',\r\n wrapText: false,\r\n width: 100,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.requestReviewStatusList',\r\n columnTitle: 'Request Review Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.duaStatusList',\r\n columnTitle: 'DUA Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.dataUploadStatusList',\r\n columnTitle: 'Data Upload Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'resultsRemovalRequestsList',\r\n columnTitle: 'Results Export Requests',\r\n wrapText: false,\r\n width: 400,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Requests' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.publicationProgress',\r\n columnTitle: 'Publication Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.firstPublicationDate',\r\n columnTitle: 'Date First Published',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.additionalNotes',\r\n columnTitle: 'Additional Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.internalNotes',\r\n columnTitle: 'Internal Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vmSizeFromTitle',\r\n columnTitle: 'VM Size',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.billingRatePerDay',\r\n columnTitle: 'Billing Rate',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vmBillingStartDate',\r\n columnTitle: 'VM Billing Start Date',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.sasForVM',\r\n columnTitle: 'SAS',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'remainingNoChargeDays',\r\n columnTitle: 'Remaining No-Charge Days',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'billableDaysThisMonth',\r\n columnTitle: 'Billable Days For Period',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'billableDollarsThisMonth',\r\n columnTitle: 'Billable $ For Period',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.paymentRemindersStatusHistory',\r\n columnTitle: 'Payment Reminders, Status, History',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vmFreeDaysBooked',\r\n columnTitle: 'Research Environment No-Charge Days Banked',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.nextActionDate',\r\n columnTitle: 'Next Action Date',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.nextActionNotes',\r\n columnTitle: 'Next Action Notes',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.currentWorkflowStepStartDate',\r\n columnTitle: 'Start Date of Current Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.highlightedDaysInCurrentWorkflowStep',\r\n columnTitle: 'Days in Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.currentWorkflowStepTargetDays',\r\n columnTitle: 'Target Days for Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.actionsRequired',\r\n columnTitle: 'Actions Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'activitiesRequired',\r\n columnTitle: 'Decisions and Uploads Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.feedback',\r\n columnTitle: 'Feedback',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'mainPredictor',\r\n columnTitle: 'Main Predictor/Independent Variable',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'publicationPlan',\r\n columnTitle: 'Publication Plan',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'briefDescription',\r\n columnTitle: 'Brief Description',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'aimsObjectivesHypotheses',\r\n columnTitle: 'Aims, Objectives, Hypotheses',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'purposeOfAnalysisString',\r\n columnTitle: 'Purpose of Analysis',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'therapeuticArea',\r\n columnTitle: 'Therapeutic Area',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'requestedStudyIds',\r\n columnTitle: 'All Studies Included by Sponsor ID/NCT ID',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'dateModified',\r\n columnTitle: 'Date of Last Change',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateSubmittedToDataContributor',\r\n columnTitle: 'Date Submitted to Data Contributor',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n ],\r\n },\r\n {\r\n name: 'Full Export, 1 Requested Study per Row (Vivli Admin)',\r\n accessType: 'Exported',\r\n userType: 'VivliAdmin',\r\n reportGenerationType: 'RequestOrStudyPerRow',\r\n code: '493D5404-0328-4D47-8EAA-89C67348E846',\r\n active: true,\r\n default: false,\r\n reportColumns: [\r\n {\r\n columnPropertyName: 'VivliId',\r\n columnTitle: 'Vivli Id',\r\n wrapText: false,\r\n width: 150,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'researchTitle',\r\n columnTitle: 'Title',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcher',\r\n columnTitle: 'Lead Researcher',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherAffiliation',\r\n columnTitle: 'Lead Researcher Affiliation',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherTitle',\r\n columnTitle: 'Lead Researcher Title',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherEmail',\r\n columnTitle: 'Lead Researcher Email',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vivliOwner',\r\n columnTitle: 'Vivli Owner',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dataContributorsList',\r\n columnTitle: 'Data Contributors',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Contributors' },\r\n },\r\n {\r\n columnPropertyName: 'requestedStudiesCount',\r\n columnTitle: 'Total Studies Requested',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'currentStatus',\r\n columnTitle: 'Current Status',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'active',\r\n columnTitle: 'Active',\r\n wrapText: false,\r\n width: 100,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateModified',\r\n columnTitle: 'Date of Last Change',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'includedRequestedStudyContributorName',\r\n columnTitle: 'Requested Study Data Contributor',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'includedRequestedStudyNctId',\r\n columnTitle: 'Requested Study NCT ID',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'includedRequestedStudySponsorId',\r\n columnTitle: 'Requested Study Sponsor ID',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.requestReviewStatusList',\r\n columnTitle: 'Request Review Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.duaStatusList',\r\n columnTitle: 'DUA Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.dataUploadStatusList',\r\n columnTitle: 'Data Upload Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'resultsRemovalRequestsList',\r\n columnTitle: 'Results Export Requests',\r\n wrapText: false,\r\n width: 400,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Requests' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.publicationProgress',\r\n columnTitle: 'Publication Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.firstPublicationDate',\r\n columnTitle: 'Date First Published',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.additionalNotes',\r\n columnTitle: 'Additional Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.internalNotes',\r\n columnTitle: 'Internal Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vmSizeFromTitle',\r\n columnTitle: 'VM Size',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.billingRatePerDay',\r\n columnTitle: 'Billing Rate',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vmBillingStartDate',\r\n columnTitle: 'VM Billing Start Date',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.sasForVM',\r\n columnTitle: 'SAS',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'remainingNoChargeDays',\r\n columnTitle: 'Remaining No-Charge Days',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'billableDaysThisMonth',\r\n columnTitle: 'Billable Days For Period',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'billableDollarsThisMonth',\r\n columnTitle: 'Billable $ For Period',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.paymentRemindersStatusHistory',\r\n columnTitle: 'Payment Reminders, Status, History',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.vmFreeDaysBooked',\r\n columnTitle: 'Research Environment No-Charge Days Banked',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.nextActionDate',\r\n columnTitle: 'Next Action Date',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.nextActionNotes',\r\n columnTitle: 'Next Action Notes',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.currentWorkflowStepStartDate',\r\n columnTitle: 'Start Date of Current Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.highlightedDaysInCurrentWorkflowStep',\r\n columnTitle: 'Days in Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.currentWorkflowStepTargetDays',\r\n columnTitle: 'Target Days for Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.actionsRequired',\r\n columnTitle: 'Actions Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'activitiesRequired',\r\n columnTitle: 'Decisions and Uploads Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.feedback',\r\n columnTitle: 'Feedback',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'mainPredictor',\r\n columnTitle: 'Main Predictor/Independent Variable',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'publicationPlan',\r\n columnTitle: 'Publication Plan',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'briefDescription',\r\n columnTitle: 'Brief Description',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'aimsObjectivesHypotheses',\r\n columnTitle: 'Aims, Objectives, Hypotheses',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'purposeOfAnalysisString',\r\n columnTitle: 'Purpose of Analysis',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'therapeuticArea',\r\n columnTitle: 'Therapeutic Area',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateSubmittedToDataContributor',\r\n columnTitle: 'Date Submitted to Data Contributor',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n ],\r\n },\r\n {\r\n name: 'Standard Display, 1 Data Request per Row (Org Admin)',\r\n accessType: 'Displayed',\r\n userType: 'OrgAdmin',\r\n reportGenerationType: 'RequestPerRow',\r\n code: '4FBAF699-01C9-4AA4-8796-B0AC9093D185',\r\n active: true,\r\n default: true,\r\n reportColumns: [\r\n {\r\n columnPropertyName: 'VivliId',\r\n columnTitle: 'Vivli Id',\r\n wrapText: false,\r\n width: 150,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcher',\r\n columnTitle: 'Lead Researcher',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dataContributorsList',\r\n columnTitle: 'Data Contributors',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Contributors' },\r\n },\r\n {\r\n columnPropertyName: 'numberStudiesMyOrg',\r\n columnTitle: \"Number of My Organization's Studies\",\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'requestedStudiesCount',\r\n columnTitle: 'Total Studies Requested',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'currentStatus',\r\n columnTitle: 'Current Status',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'active',\r\n columnTitle: 'Active',\r\n wrapText: false,\r\n width: 100,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.actionsRequired',\r\n columnTitle: 'Actions Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'activitiesRequired',\r\n columnTitle: 'Decisions and Uploads Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.highlightedDaysInCurrentWorkflowStep',\r\n columnTitle: 'Days in Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.currentWorkflowStepTargetDays',\r\n columnTitle: 'Target Days for Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.feedback',\r\n columnTitle: 'Feedback',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.requestReviewStatusList',\r\n columnTitle: 'Request Review Status',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.duaStatusList',\r\n columnTitle: 'DUA Status',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.dataUploadStatusList',\r\n columnTitle: 'Data Upload Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'resultsRemovalRequestsList',\r\n columnTitle: 'Results Export Requests',\r\n wrapText: false,\r\n width: 400,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Requests' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.publicationProgress',\r\n columnTitle: 'Publication Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.additionalNotes',\r\n columnTitle: 'Additional Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateSubmittedToDataContributor',\r\n columnTitle: 'Date Submitted to Data Contributor',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateModified',\r\n columnTitle: 'Date of Last Change',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n ],\r\n },\r\n {\r\n name: 'Standard Export, 1 Data Request per Row (Org Admin)',\r\n accessType: 'Exported',\r\n userType: 'OrgAdmin',\r\n reportGenerationType: 'RequestPerRow',\r\n code: 'DF534BA5-7B99-475F-8F9B-CAB31723693A',\r\n active: true,\r\n default: false,\r\n reportColumns: [\r\n {\r\n columnPropertyName: 'VivliId',\r\n columnTitle: 'Vivli Id',\r\n wrapText: false,\r\n width: 150,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'researchTitle',\r\n columnTitle: 'Title',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcher',\r\n columnTitle: 'Lead Researcher',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherAffiliation',\r\n columnTitle: 'Lead Researcher Affiliation',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherTitle',\r\n columnTitle: 'Lead Researcher Title',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherEmail',\r\n columnTitle: 'Lead Researcher Email',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dataContributorsList',\r\n columnTitle: 'Data Contributors',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Contributors' },\r\n },\r\n {\r\n columnPropertyName: 'numberStudiesMyOrg',\r\n columnTitle: \"Number of My Organization's Studies\",\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'requestedStudiesCount',\r\n columnTitle: 'Total Studies Requested',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'currentStatus',\r\n columnTitle: 'Current Status',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'active',\r\n columnTitle: 'Active',\r\n wrapText: false,\r\n width: 100,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.actionsRequired',\r\n columnTitle: 'Actions Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'activitiesRequired',\r\n columnTitle: 'Decisions and Uploads Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.highlightedDaysInCurrentWorkflowStep',\r\n columnTitle: 'Days in Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.currentWorkflowStepTargetDays',\r\n columnTitle: 'Target Days for Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.feedback',\r\n columnTitle: 'Feedback',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.requestReviewStatusList',\r\n columnTitle: 'Request Review Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.duaStatusList',\r\n columnTitle: 'DUA Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.dataUploadStatusList',\r\n columnTitle: 'Data Upload Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'resultsRemovalRequestsList',\r\n columnTitle: 'Results Export Requests',\r\n wrapText: false,\r\n width: 400,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Requests' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.publicationProgress',\r\n columnTitle: 'Publication Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.firstPublicationDate',\r\n columnTitle: 'Date First Published',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.additionalNotes',\r\n columnTitle: 'Additional Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'mainPredictor',\r\n columnTitle: 'Main Predictor/Independent Variable',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'publicationPlan',\r\n columnTitle: 'Publication Plan',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'briefDescription',\r\n columnTitle: 'Brief Description',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'aimsObjectivesHypotheses',\r\n columnTitle: 'Aims, Objectives, Hypotheses',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'purposeOfAnalysisString',\r\n columnTitle: 'Purpose of Analysis',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'therapeuticArea',\r\n columnTitle: 'Therapeutic Area',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'requestedStudyIds',\r\n columnTitle: 'All Studies Included by Sponsor ID/NCT ID',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'dateModified',\r\n columnTitle: 'Date of Last Change',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateSubmittedToDataContributor',\r\n columnTitle: 'Date Submitted to Data Contributor',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n ],\r\n },\r\n {\r\n name: 'Full Export, 1 Requested Study per Row (Org Admin)',\r\n accessType: 'Exported',\r\n userType: 'OrgAdmin',\r\n reportGenerationType: 'RequestOrStudyPerRow',\r\n code: '18F550D7-7E98-4F7D-9B75-B04E78CA7B38',\r\n active: true,\r\n default: false,\r\n reportColumns: [\r\n {\r\n columnPropertyName: 'VivliId',\r\n columnTitle: 'Vivli Id',\r\n wrapText: false,\r\n width: 150,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'researchTitle',\r\n columnTitle: 'Title',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcher',\r\n columnTitle: 'Lead Researcher',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherAffiliation',\r\n columnTitle: 'Lead Researcher Affiliation',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherTitle',\r\n columnTitle: 'Lead Researcher Title',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'leadResearcherEmail',\r\n columnTitle: 'Lead Researcher Email',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dataContributorsList',\r\n columnTitle: 'Data Contributors',\r\n wrapText: false,\r\n width: 320,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Contributors' },\r\n },\r\n {\r\n columnPropertyName: 'numberStudiesMyOrg',\r\n columnTitle: \"Number of My Organization's Studies\",\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'requestedStudiesCount',\r\n columnTitle: 'Total Studies Requested',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'includedRequestedStudyContributorName',\r\n columnTitle: 'Requested Study Data Contributor',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'includedRequestedStudyNctId',\r\n columnTitle: 'Requested Study NCT ID',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'includedRequestedStudySponsorId',\r\n columnTitle: 'Requested Study Sponsor ID',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'currentStatus',\r\n columnTitle: 'Current Status',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'active',\r\n columnTitle: 'Active',\r\n wrapText: false,\r\n width: 100,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.actionsRequired',\r\n columnTitle: 'Actions Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'activitiesRequired',\r\n columnTitle: 'Decisions and Uploads Required',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.highlightedDaysInCurrentWorkflowStep',\r\n columnTitle: 'Days in Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName:\r\n 'statusUpdate.currentWorkflowStepTargetDays',\r\n columnTitle: 'Target Days for Current Workflow Step',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.feedback',\r\n columnTitle: 'Feedback',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.requestReviewStatusList',\r\n columnTitle: 'Request Review Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.duaStatusList',\r\n columnTitle: 'DUA Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: '' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.dataUploadStatusList',\r\n columnTitle: 'Data Upload Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'resultsRemovalRequestsList',\r\n columnTitle: 'Results Export Requests',\r\n wrapText: false,\r\n width: 400,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: { emptyMessage: 'No Requests' },\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.publicationProgress',\r\n columnTitle: 'Publication Status',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.firstPublicationDate',\r\n columnTitle: 'Date First Published',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'statusUpdate.additionalNotes',\r\n columnTitle: 'Additional Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'mainPredictor',\r\n columnTitle: 'Main Predictor/Independent Variable',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'publicationPlan',\r\n columnTitle: 'Publication Plan',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'briefDescription',\r\n columnTitle: 'Brief Description',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'aimsObjectivesHypotheses',\r\n columnTitle: 'Aims, Objectives, Hypotheses',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'purposeOfAnalysisString',\r\n columnTitle: 'Purpose of Analysis',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'therapeuticArea',\r\n columnTitle: 'Therapeutic Area',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateSubmittedToDataContributor',\r\n columnTitle: 'Date Submitted to Data Contributor',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n {\r\n columnPropertyName: 'dateModified',\r\n columnTitle: 'Date of Last Change',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: '',\r\n cellRendererParams: null,\r\n },\r\n ],\r\n },\r\n {\r\n name: 'Single Study Submissions (Vivli Admin)',\r\n dataType: 'ListingRequest',\r\n accessType: 'Displayed',\r\n category: 'Single Study Submissions',\r\n userType: 'VivliAdmin',\r\n reportGenerationType: 'RequestPerRow',\r\n code: '0D2985B9-B93E-42B8-94A8-16552ACCBA7A',\r\n active: true,\r\n default: true,\r\n reportColumns: [\r\n {\r\n columnPropertyName: 'nctId',\r\n columnTitle: 'NCT Id',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'sponsorProtocolId',\r\n columnTitle: 'Sponsor ID',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'requesterEmail',\r\n columnTitle: 'Requester email',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: 'GridCellLargeText'\r\n },\r\n {\r\n columnPropertyName: 'orgName',\r\n columnTitle: 'Contributor organization',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: {\r\n emptyMessage: 'No Contributors'\r\n }\r\n },\r\n {\r\n columnPropertyName: 'status',\r\n columnTitle: 'Status',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText'\r\n },\r\n {\r\n columnPropertyName: 'isDataUploaded',\r\n columnTitle: \"IPD Loaded (Y/N)\",\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'submittedDate',\r\n columnTitle: 'Date Study Submitted',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'postedDate',\r\n columnTitle: 'Date Posted',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'studyTitle',\r\n columnTitle: 'Study Title',\r\n wrapText: false,\r\n width: 500,\r\n cellRenderer: 'GridCellLargeText'\r\n },\r\n {\r\n columnPropertyName: 'uploadNotes',\r\n columnTitle: 'Data Upload Notes',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText'\r\n },\r\n {\r\n columnPropertyName: 'internalNotes',\r\n columnTitle: 'Internal Notes',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellLargeText'\r\n },\r\n {\r\n NextActionDate: 'nextActionDate',\r\n columnTitle: \"Next Action Date\",\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'nextActionNotes',\r\n columnTitle: 'Next Action Notes',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText'\r\n },\r\n {\r\n columnPropertyName: 'bypassDataContributorReview',\r\n columnTitle: 'Bypass Data Contributor Review',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'bypassIRPReview',\r\n columnTitle: 'Bypass IRP Review',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'rorIds',\r\n columnTitle: 'ROR IDs',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: \"GridCellList\"\r\n },\r\n {\r\n columnPropertyName: 'rorNames',\r\n columnTitle: 'ROR Names',\r\n wrapText: false,\r\n width: 300,\r\n cellRenderer: 'GridCellList'\r\n },\r\n {\r\n columnPropertyName: 'parentRorIds',\r\n columnTitle: 'Funding Organization(s) ROR IDs',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText'\r\n },\r\n {\r\n columnPropertyName: 'parentRorNames',\r\n columnTitle: 'Funding Organization(s) ROR Names',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellLargeText'\r\n },\r\n {\r\n columnPropertyName: 'grantIds',\r\n columnTitle: 'Funding Organization Grant IDs',\r\n wrapText: false,\r\n width: 150,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'dataRequests',\r\n columnTitle:'Requests',\r\n wrapText: false,\r\n width: 200,\r\n cellRenderer: 'GridCellList',\r\n cellRendererParams: {\r\n emptyMessage: 'No Requests'\r\n }\r\n },\r\n {\r\n columnPropertyName: 'dataRequestsCount',\r\n columnTitle: '# of requests',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropert: 'isEmbargoed',\r\n columnTitle: 'Embargo',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: ''\r\n },\r\n {\r\n columnPropertyName: 'downloadableStudyIPDDataPackage',\r\n columnTitle: 'Downloadable',\r\n wrapText: false,\r\n width: 0,\r\n cellRenderer: \"\"\r\n }\r\n ]\r\n }\r\n];\r\n","export const workflowStatusDescriptorDetailsIntercept = [\r\n {\r\n statusEnumVal: 'Draft',\r\n statusEnumString: 'Draft',\r\n displayName: 'Draft',\r\n allowableTransitionsTo: [\r\n {\r\n targetStatus: 'Submitted',\r\n targetStatusString: 'Submitted',\r\n vivliRolesAllowedForTransition: [],\r\n anyUserCanTransition: true,\r\n possibleWorkflowStatusCategories: ['ApprovedCategory'],\r\n },\r\n {\r\n targetStatus: 'Withdrawn',\r\n targetStatusString: 'Withdrawn',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n {\r\n vivliRole: '',\r\n transitionConstraintsForRole: ['Draft'],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['CancelledCategory'],\r\n },\r\n ],\r\n workflowType: 'ListingRequestWorkflow',\r\n possibleWorkflowStatusCategories: ['InitialCategory'],\r\n notificationDetail: {\r\n emailDescriptionText:\r\n 'from has been reset to the draft status.',\r\n emailLinkText:\r\n 'to access the study, and see the comments in the chat tab for information about any updates that need to be made.',\r\n emailSubjectText: 'has been reset to draft',\r\n notificationRecipientRules: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n {\r\n vivliRole: 'DatasetOwner',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n {\r\n vivliRole: 'RequesterNoRoleYet',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n {\r\n vivliRole: null,\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n ],\r\n },\r\n historyDetail: {\r\n tokenizedHistoryDescription:\r\n 'Status changed to Draft status (reset).',\r\n historyActionDescriptor: 'ListingRequestResetToDraft',\r\n },\r\n },\r\n {\r\n statusEnumVal: 'Submitted',\r\n statusEnumString: 'Submitted',\r\n displayName: 'Submitted to Vivli',\r\n allowableTransitionsTo: [\r\n {\r\n targetStatus: 'StudyInCuration',\r\n targetStatusString: 'StudyInCuration',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['ApprovedCategory'],\r\n },\r\n {\r\n targetStatus: 'Draft',\r\n targetStatusString: 'Draft',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['RejectedCategory'],\r\n },\r\n {\r\n targetStatus: 'Withdrawn',\r\n targetStatusString: 'Withdrawn',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['CancelledCategory'],\r\n },\r\n ],\r\n workflowType: 'ListingRequestWorkflow',\r\n possibleWorkflowStatusCategories: ['ApprovedCategory'],\r\n notificationDetail: {\r\n emailDescriptionText:\r\n 'from is now ready for your Vivli Admin review.',\r\n emailLinkText: 'to access it',\r\n emailSubjectText: 'is Ready For Review',\r\n notificationRecipientRules: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n ],\r\n },\r\n historyDetail: {\r\n tokenizedHistoryDescription:\r\n 'Status changed to Submitted to Vivli.',\r\n historyActionDescriptor: 'ListingRequestSubmitted',\r\n },\r\n },\r\n {\r\n statusEnumVal: 'StudyInCuration',\r\n statusEnumString: 'StudyInCuration',\r\n displayName: 'Study In Curation',\r\n allowableTransitionsTo: [\r\n {\r\n targetStatus: 'Approved',\r\n targetStatusString: 'Approved',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['ApprovedCategory'],\r\n },\r\n {\r\n targetStatus: 'Draft',\r\n targetStatusString: 'Draft',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['RejectedCategory'],\r\n },\r\n {\r\n targetStatus: 'Withdrawn',\r\n targetStatusString: 'Withdrawn',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['CancelledCategory'],\r\n },\r\n ],\r\n workflowType: 'ListingRequestWorkflow',\r\n possibleWorkflowStatusCategories: ['ApprovedCategory'],\r\n notificationDetail: {\r\n emailDescriptionText:\r\n 'from has been accepted and Vivli will begin preparing this study for posting.',\r\n emailLinkText: 'to access it.',\r\n emailSubjectText: 'has been accepted for processing by Vivli',\r\n notificationRecipientRules: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n {\r\n vivliRole: 'DatasetOwner',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n {\r\n vivliRole: 'RequesterNoRoleYet',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n ],\r\n },\r\n historyDetail: {\r\n tokenizedHistoryDescription: 'Status changed to Study In Curation.',\r\n historyActionDescriptor: 'ListingRequestStudyInCuration',\r\n },\r\n },\r\n {\r\n statusEnumVal: 'Approved',\r\n statusEnumString: 'Approved',\r\n displayName: 'Approved/Posted',\r\n allowableTransitionsTo: [\r\n {\r\n targetStatus: 'Draft',\r\n targetStatusString: 'Draft',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['RejectedCategory'],\r\n },\r\n {\r\n targetStatus: 'Withdrawn',\r\n targetStatusString: 'Withdrawn',\r\n vivliRolesAllowedForTransition: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n transitionConstraintsForRole: [],\r\n },\r\n ],\r\n anyUserCanTransition: false,\r\n possibleWorkflowStatusCategories: ['CancelledCategory'],\r\n },\r\n ],\r\n workflowType: 'ListingRequestWorkflow',\r\n possibleWorkflowStatusCategories: ['ApprovedCategory'],\r\n notificationDetail: {\r\n emailDescriptionText:\r\n 'from is now listed on the Vivli platform. You may now upload the study data to the Vivli Platform.',\r\n emailLinkText: 'to access it',\r\n emailSubjectText: 'has been approved and is now listed on Vivli',\r\n notificationRecipientRules: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n {\r\n vivliRole: 'DatasetOwner',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n {\r\n vivliRole: 'RequesterNoRoleYet',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n ],\r\n },\r\n historyDetail: {\r\n tokenizedHistoryDescription: 'Status changed to Approved/Posted.',\r\n historyActionDescriptor: 'ListingRequestApproved',\r\n },\r\n },\r\n {\r\n statusEnumVal: 'Withdrawn',\r\n statusEnumString: 'Withdrawn',\r\n displayName: null,\r\n allowableTransitionsTo: [],\r\n workflowType: 'ListingRequestWorkflow',\r\n possibleWorkflowStatusCategories: ['CancelledCategory'],\r\n notificationDetail: {\r\n emailDescriptionText: 'from has been withdrawn.',\r\n emailLinkText: 'to access it',\r\n emailSubjectText: 'has been withdrawn',\r\n notificationRecipientRules: [\r\n {\r\n vivliRole: 'VivliAdmin',\r\n recipientDescriptionText: null,\r\n recipientLinkText: null,\r\n recipientSubjectText: null,\r\n },\r\n ],\r\n },\r\n historyDetail: {\r\n tokenizedHistoryDescription: 'Status changed to Withdrawn.',\r\n historyActionDescriptor: 'ListingRequestWithdrawn',\r\n },\r\n },\r\n];\r\n","export const externalMenuItemsIntercept = [\r\n { name: 'Home', url: 'https://vivli.org/', menuItems: [] },\r\n {\r\n name: 'About',\r\n url: 'https://vivli.org/about',\r\n menuItems: [\r\n {\r\n name: 'Overview',\r\n url: 'https://vivli.org/overview',\r\n },\r\n {\r\n name: 'Why Share your clinical Research Data',\r\n url: 'https://vivli.org/why-share-your-clinical-research-data/',\r\n },\r\n {\r\n name: 'Board of Directors',\r\n url: 'https://vivli.org/about/board-directors/',\r\n },\r\n {\r\n name: 'Leadership Team',\r\n url: 'https://vivli.org/about/leadership-team/',\r\n },\r\n {\r\n name: 'Committees',\r\n url: 'https://vivli.org/about/vivli-committees/',\r\n },\r\n {\r\n name: 'Funders & Partners',\r\n url: 'https://vivli.org/about/funders/',\r\n },\r\n {\r\n name: 'Independent Review Panel',\r\n url: 'https://vivli.org/about/independent-review-panel/',\r\n },\r\n {\r\n name: 'NIH GREI Project',\r\n url: 'https://vivli.org/about/nih-grei-project/',\r\n },\r\n ],\r\n },\r\n {\r\n name: 'Members',\r\n url: 'https://vivli.org/Members',\r\n menuItems: [\r\n {\r\n name: 'Our Members',\r\n url: 'https://vivli.org/members/ourmembers/',\r\n },\r\n {\r\n name: 'Become a Member',\r\n url: 'https://vivli.org/members/become-a-member/',\r\n },\r\n {\r\n name: 'Why we support Vivli',\r\n url: 'https://vivli.org/members/why-we-support-vivli/',\r\n },\r\n {\r\n name: 'Enquiries about Vivli Member Studies',\r\n url: 'https://vivli.org/members/enquiries-about-studies-not-listed-on-the-vivli-platform/',\r\n },\r\n ],\r\n },\r\n {\r\n name: 'News & Events',\r\n url: 'https://vivli.org/news/',\r\n menuItems: [\r\n { name: 'Events', url: 'https://vivli.org/news/events/' },\r\n {\r\n name: 'News',\r\n url: 'https://vivli.org/news/news/',\r\n },\r\n { name: 'Blog', url: 'https://vivli.org/news/blog/' },\r\n {\r\n name: 'Webinars & Publications',\r\n url: 'https://vivli.org/resources/publications/',\r\n },\r\n ],\r\n },\r\n {\r\n name: 'Resources',\r\n url: 'https://vivli.org/resources/resources/',\r\n menuItems: [\r\n {\r\n name: 'How to Share Data',\r\n url: 'https://vivli.org/resources/sharedata/',\r\n },\r\n {\r\n name: 'How to request data',\r\n url: 'https://vivli.org/resources/requestdata/',\r\n },\r\n {\r\n name: 'Vivli Metrics',\r\n url: 'https://vivli.org/resources/platform_metrics/',\r\n },\r\n {\r\n name: 'How to Guides',\r\n url: 'https://vivli.org/resources/resources/',\r\n },\r\n {\r\n name: 'Public Disclosures',\r\n url: 'https://vivli.org/resources/public-disclosures/',\r\n },\r\n { name: 'FAQs', url: 'https://vivli.org/resources/faqs/' },\r\n ],\r\n },\r\n];\r\n","export const fileExtensionsIntercept = [\r\n {\r\n \"Extension\": \".doc\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xls\",\r\n \"WarnForDocumentUpload\": true,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".csv\",\r\n \"WarnForDocumentUpload\": true,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".txt\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".pdf\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".rar\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".zip\",\r\n \"WarnForDocumentUpload\": true,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".7z\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".cab\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".tar\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".gz\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".bz2\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".zipx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".docx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".docm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".dotx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".dotm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xlsx\",\r\n \"WarnForDocumentUpload\": true,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xlsm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xltx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xltm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xlsb\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xlam\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".pptx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".pptm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".potx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".potm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".ppam\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".ppsx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".ppsm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".sldx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".sldm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".thmx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".vsdx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".vsdm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".vssx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".vssm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".vstx\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".vstm\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".jpg\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".jpeg\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".gif\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".png\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".tif\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".tiff\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".sasbat\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".sas7bdat\",\r\n \"WarnForDocumentUpload\": true,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".r\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".py\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".pyw\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".sas\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xpt\",\r\n \"WarnForDocumentUpload\": true,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".dta\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".sav\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".rtf\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".xml\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".eps\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".rmd\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".rds\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".rdata\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n },\r\n {\r\n \"Extension\": \".pkl\",\r\n \"WarnForDocumentUpload\": false,\r\n \"AllowDocumentUpload\": true\r\n }\r\n];\r\n","import { countriesIntercept } from './countries.intercept';\r\nimport { rejectionReasonsIntercept } from './rejection-reasons.intercept';\r\nimport { allowedFileUploadExtensionsIntercept } from './allowed-file-upload-extensions.intercept';\r\nimport { disallowedPublicEmailDomainsIntercept } from './disallowed-public-email-domains.intercept';\r\nimport { therapeuticAreaItemsIntercept } from './therapeutic-area-items.intercept';\r\nimport { partnersIntercept } from './partners.intercept';\r\nimport { accessibleRightsIntercept } from './accessible-rights.intercept';\r\nimport { virtualMachineTypesIntercept } from './virtual-machine-types.intercept';\r\nimport { workflowStepNormsIntercept } from './workflow-step-norms.intercept';\r\nimport { reportSpecsIntercept } from './report-specs.intercept';\r\nimport { workflowStatusDescriptorDetailsIntercept } from './workflow-status-descriptor-details.intercept';\r\nimport { externalMenuItemsIntercept } from './external-menu-items.intercept';\r\nimport {fileExtensionsIntercept} from \"./file-extensions.intercept\";\r\n\r\nexport const vivliConfigIntercept = {\r\n _etag: null,\r\n _ts: 0,\r\n countries: countriesIntercept,\r\n rejectionReasons: rejectionReasonsIntercept,\r\n allowedFileUploadExtensions: allowedFileUploadExtensionsIntercept,\r\n fileExtensions: fileExtensionsIntercept,\r\n disallowedPublicEmailDomains: disallowedPublicEmailDomainsIntercept,\r\n therapeuticAreaItems: therapeuticAreaItemsIntercept,\r\n partners: partnersIntercept,\r\n accessibleRights: accessibleRightsIntercept,\r\n safetyConcernAgreement:\r\n '\\r\\n\\r\\n\\r\\n \\r\\n Data Request Safety Concern Agreement\\r\\n\\r\\n\\r\\n

\\r\\n Safety Concern Agreement\\r\\n

\\r\\n

\\r\\n Recipient agrees that it will inform Vivli within twenty-four (24) hours of any new information that might influence the evaluation of the risks of the product to which a Data Set pertains (collectively “Safety Concerns”)\\r\\n to permit Vivli to inform the relevant Data Contributor(s) of Safety Concerns identified as part of the Analysis. Recipient agrees that the Data Contributor(s) may take action regarding such Safety Concerns, including informing\\r\\n regulatory authorities or healthcare providers, or otherwise making the Safety Concerns public, including in advance of publication of the Analysis by Recipient.\\r\\n

\\r\\n\\r\\n',\r\n termsOfUseAgreement:\r\n '\\r\\n\\r\\n\\r\\n\\r\\n \\r\\n \\r\\n \\r\\n \\r\\n \\r\\n\\r\\n\\r\\n
\\r\\n

\\r\\n VIVLI TERMS OF USE\\r\\n

\\r\\n

\\r\\n Version 1.2\\r\\n

\\r\\n

\\r\\n January 29, 2019\\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n Vivli, Inc., (\"Vivli\") an independent non-profit entity, operates the Vivli Website and Platform (the \"Platform\") for the purpose of allowing users the ability to search and request certain data  that has been provided for such use by third-party contributors (\"Data Contributors\"). This data (the \"Data\") is available to a user (\"you\" or \"your\") upon request and approval for scientific, educational and research purposes only to the extent and on the terms set forth in the Data Use Agreement between you and Vivli (the \"Data Use Agreement\"). Access to data is further subject to approval by the individual Data Contributors, based upon their own data sharing policies, as set forth on each Vivli member\\'s page. The data may be accessed either in a secure research environment or downloadable - the format is determined by the Data Contributor. The terms set forth below (the \"Terms of Use\"), together with any related documents and approvals expressly incorporated into these terms by reference, including any Data Request, any Data Use Agreement and any additional terms that may apply from the Data Contributor (collectively, with the Terms of Use, the \"Agreements\"), constitute a binding legal agreement between you and Vivli.\\r\\n

\\r\\n

\\r\\n By accessing and using the Platform you agree to be bound by the Terms of Use.\\r\\n

\\r\\n

\\r\\n Acknowledgement of Proprietary Rights\\r\\n

\\r\\n

\\r\\n All information provided to you, including but not limited to, the data, content, documentation, code, and related materials on the Vivli is under the care, custody and control of Vivli, which is the owner or licensee thereof, and constitutes confidential and proprietary information.\\r\\n

\\r\\n

\\r\\n Terms of Use\\r\\n

\\r\\n

\\r\\n You agree, on behalf of self and the institution or organization you represent,\\r\\n

\\r\\n
    \\r\\n
  • \\r\\n to use the Platform in compliance with applicable laws and regulations;\\r\\n
  • \\r\\n
  • \\r\\n to not contain or introduce any virus, malware, spyware, or any obscene, illegal, defamatory, infringing, or other content deemed by Vivli in its sole discretion to be inappropriate;\\r\\n
  • \\r\\n
  • \\r\\n to use the Platform, including your secure research environment (if the data is accessed via the Research Environment), in accordance will all applicable terms and conditions included but not limited to the Terms of Use and any and all executed Data Use Agreements, as well as the terms set forth in your Data Use Request(s).\\r\\n
  • \\r\\n
\\r\\n

\\r\\n If you would like to proceed past the search functionality, you must login using your user ID and password. If you do not abide by all terms of the Agreements, attempt to circumvent passwords, share passwords, or attempt to conduct illegal activities, Vivli may have your access terminated from the Platform. Your access is entirely within the discretion of the Vivli administrator.\\r\\n

\\r\\n

\\r\\n You are prohibited from installing unapproved software onto the Platform including into your Research Environment. No software will be deemed approved unless you have obtained express authorization from Vivli. You may only add any scripts, tools and other software into your secure research environment if you attest to having the appropriate software license. This requirement is in addition to the approval of Vivli.\\r\\n

\\r\\n

\\r\\n For avoidance of doubt, unapproved software installations may include, by way of example only and not limitation, software with unknown or suspect pedigrees or software that Vivli considers in its sole discretion to be potentially malicious. In addition, you agree not to use peer-to-peer file sharing technology that enables unauthorized distribution, display, performance, or reproduction of copyrighted work.\\r\\n

\\r\\n

\\r\\n You may, with express permission from Vivli, and subject to any applicable terms in any of the Agreements, bring Data into your own secure research environment (\"Research Environment\") in which you have permission to use such Data, provided that prior to the bringing of any Data into such Research Environment, you must have clearly stated and attested in the data request form at the time of initiating such data request that you have such permission. Your request should include the description of the external data in such Research Environment, the origin of such data, the scientific validity and how the external data adds value to the research purpose. After a review process to determine whether to grant you permission to upload external data, Vivli  will be responsible for facilitating the data upload process.\\r\\n

\\r\\n

\\r\\n You agree to promptly report all security or similar incidents (e.g., lost password, denial of service, improper or suspicious acts) to Vivli via the Platform or via email (support@vivli.org). Vivli reserves the right to email all users with regards to Platform usage, including billing for secure research environment access, so long as the user has an active Platform account.\\r\\n

\\r\\n

\\r\\n Right to Limit\\r\\n

\\r\\n

\\r\\n Your use of the Platform and secure research environment may be subject to certain limitations. These limitations are designed to manage load on the system, promote equitable access, and prevent abuse. If Vivli reasonably believes that you have attempted to exceed or circumvent these limits, your ability to use the Platform and / or your secure research environment as well as any data therein may be temporarily or permanently restricted. Vivli and data contributors may monitor your use of the Platform and Research Environment to improve the service as well as to ensure your compliance with the Agreements.\\r\\n

\\r\\n

\\r\\n Your level of access to the Platform and your Research Environment, including any data secured therein is designed to ensure no more than that which is necessary for the purposes set forth in the Agreements. If you believe you are being granted access that you should not have, or do not have access you believed you should have, you must immediately notify the Vivli administrator.\\r\\n

\\r\\n

\\r\\n If your secure research environment has been unused for a period of 30 days or more, Vivli reserves the right to pause the secure research environment. Should this occur, you may restart your secure research environment at any time. You will be responsible for any charges incurred while the research environment was paused.\\r\\n

\\r\\n

\\r\\n Changes\\r\\n

\\r\\n

\\r\\n You agree that Vivli has the right, at its sole discretion, to modify or replace these Terms of Use. Your continued use of or access to the Platform following posting of any changes to these Terms of Use constitutes acceptance of those modified terms. New services or features offered through Vivli, including within the Platform and / or the secure research environment shall be subject to the Terms of Use and Agreements then in effect.\\r\\n

\\r\\n

\\r\\n Disclaimer of Warranties\\r\\n

\\r\\n

\\r\\n The Platform is provided on an \"as is\" and \"as-available\" basis. VIVLI HEREBY DISCLAIMS ALL WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. VIVLI MAKES NO WARRANTY THAT DATA WILL BE ERROR FREE OR THAT ACCESS THERETO WILL BE CONTINUOUS OR UNINTERRUPTED.\\r\\n

\\r\\n

\\r\\n Liability\\r\\n

\\r\\n

\\r\\n IN NO EVENT WILL VIVLI, ITS VENDORS, OR THE DATA CONTRIBUTORS BE LIABLE IN ANY MANNER WITH RESPECT TO THE VIVLI WEBSITE, THE PLATFORM, SECURE RESEARCH ENVIRONMENT, OR ANY SUBJECT MATTER ARISING FROM THESE TERMS OF USE, UNDER ANY CONTRACT, NEGLIGENCE, STRICT LIABILITY OR OTHER LEGAL OR EQUITABLE THEORY FOR: (1) ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES; (2) THE COST OF PROCUREMENT OF SUBSTITUTE PRODUCTS OR SERVICES; OR (3) FOR INTERRUPTION OF USE OR LOSS OR CORRUPTION OF DATA.\\r\\n

\\r\\n

\\r\\n YOU ACKNOWLEDGE THAT YOUR DATA USE AGREEMENT AND/OR OTHER AGREEMENT MAY CONTAIN ADDITIONAL TERMS AND OBLIGATIONS WITH REGARDS TO LIABILITY AND INDEMNIFICATION.\\r\\n

\\r\\n

\\r\\n No Waiver Rights\\r\\n

\\r\\n

\\r\\n Vivli\\'s failure to exercise or enforce any right or provision of these Terms of Use shall not constitute waiver of such right or provision.\\r\\n

\\r\\n

\\r\\n Service Termination\\r\\n

\\r\\n

\\r\\n If you wish to terminate use of the Platform you may do so by refraining from further use. With regard to the secure research environment, you are responsible for any charges incurred up to termination. In order to terminate a secure research environment, you must de-provision it. Details aabout the cost and charges of the secure research environment are available on the Vivli website and may be subject to change. Vivli reserves the right to refuse to provide the Platform or your Research Environment to you if Vivli determines in its sole discretion that you have violated these Terms of Use or any applicable law. All provisions of these Terms of Use which by their nature should survive termination shall survive termination, including warranty disclaimers and limitations of liability.\\r\\n

\\r\\n

\\r\\n Termination of Platform\\r\\n

\\r\\n

\\r\\n Vivli reserves the right to cease providing the Vivli Platform, including all individual secure research environment(s) at any time, for any reason in its sole discretion. Should Vivli choose to terminate its website, the Platform and / or the secure research environment, individual users shall retain access to any Data only to the extent set forth in any Data Contributor or Data Use Agreements signed by the user and Vivli.\\r\\n

\\r\\n

\\r\\n Applicable Law\\r\\n

\\r\\n

\\r\\n Your access to the Platform and the Data provided, is governed by, and subject to, all applicable state and federal laws of the United States, including those pertaining to personal data security and privacy. Your access to the Platform constitutes your consent to the retrieval and disclosure of the Data within the scope of your authorized access, subject to applicable law.\\r\\n

\\r\\n

\\r\\n THESE TERMS OF USE, AND YOUR USE AND ACCESS OF THE PLATFORM AND DATA, ARE GOVERNED BY THE LAWS OF THE STATE OF MASSACHUSETTS, WITHOUT REGARD TO ITS CONFLICT OF LAWS RULES. JURISDICTION AND VENUE FOR ANY CAUSE OF ACTION ARISING UNDER THESE TERMS OF USE SHALL BE IN SUFFOLK COUNTY, BOSTON, MASSACHUSETTS, U.S.A. THOUGH ADDITIONAL JURISDICTIONS MAY BE MANDATORY BASED ON APPLICABLE DATA BREACH LAWS.\\r\\n

\\r\\n

\\r\\n The Platform may be accessed from the United States, as well as from other countries around the world. Vivli makes no representation that the Platform Is appropriate or available for use in locations outside the United States. You agree to comply with any additional requirements of the country where you are accessing the Platform and not to access the Platform from any country or jurisdiction where its content is illegal or prohibited. You must obtain express, written consent of any Data Contributors outside your country of residence before accessing that Data Contributor\\'s data. If you choose to access the Platform from outside the United States, you do so on your own initiative and you are responsible for compliance with any applicable laws of the country outside the United States in addition to those that are applicable within the United States.\\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n

\\r\\n  \\r\\n

\\r\\n
\\r\\n

\\r\\n  \\r\\n

\\r\\n
\\r\\n
\\r\\n\\r\\n',\r\n amrTermsOfUseAgreement:\r\n 'Vivli, Inc., (“Vivli”) an independent non-profit entity, operates the Vivli AMR Website and the AMR Register (the “Platform”) for the purpose of allowing users the ability to search and request certain data that has been provided for such use by third-party contributors (“Data Contributors”). This data (the “Data”) is available to a user (“you” or “your”) upon request for public health, scientific, educational and research purposes. Access to this data may be further subject to approval by the individual Data Contributors, based upon their own data sharing policies if stipulated on their member’s page. The data may be accessed either via download or in a format as determined by the Data Contributor. The terms set forth below (the \"Terms of Use\"), together with any related documents and approvals expressly incorporated into these terms by reference, including any Data Request and any additional terms that may apply from the Data Contributor (collectively, with the Terms of Use, the “Agreements”), constitute a binding legal agreement.\\r\\n\\r\\nBy accessing and using the Platform, you agree to be bound by the Terms of Use.\\r\\n\\r\\nAcknowledgement of Proprietary Rights\\r\\n-------------------------------------\\r\\nAll information provided to you, including but not limited to, the data, content, documentation, code, and related materials on the AMR platform is under the care, custody and control of Vivli.\\r\\n\\r\\nTerms of Use\\r\\n------------\\r\\nYou agree, on behalf of self and the institution or organization you represent,\\r\\ni.\\tto use the Platform in compliance with applicable laws and regulations;\\r\\nii.\\tnot contain or introduce any virus, malware, spyware, or any obscene, illegal, defamatory, infringing, or other content deemed by Vivli in its sole discretion to be inappropriate;\\r\\niii.\\tto use the Platform in accordance with all applicable terms and conditions included but not limited to the Terms of Use and any additional policies and agreements that may be set forth by the individual data contributors\\r\\n\\r\\nIf you would like to proceed past the search functionality, you must login using your user ID and password. If you do not abide by all terms of the Agreements, attempt to circumvent passwords, share passwords, or attempt to conduct illegal activities, Vivli may have your access terminated from the Platform. Your access is entirely within the discretion of the Vivli administrator. \\r\\n\\r\\nYou agree to promptly report all security or similar incidents (e.g., lost password, denial of service, improper or suspicious acts) to Vivli via the Platform or via email (support@vivli.org). \\r\\n\\r\\nPublication\\r\\n-----------\\r\\nVivli shall make the following elements of the Data Request publicly available in the Data Repository after the Data Set associated with the Research Plan is made available to Recipient: the title of the Data Request, the name of the researcher and his or her affiliation, the purposes of analysis, a summary of the proposed research, and the Data Sets which have been requested.\\r\\n\\r\\nRight to Limit\\r\\n--------------\\r\\nYour use of the Platform may be subject to certain limitations. These limitations are designed to manage load on the system, promote equitable access, and prevent abuse. If Vivli reasonably believes that you have attempted to exceed or circumvent these limits, your ability to use the Platform as well as any data therein may be temporarily or permanently restricted. Vivli may monitor your use of the Platform to improve the service as well as to ensure your compliance. Your level of access to the Platform including any data secured therein is designed to ensure no more than that which is necessary for the purposes set forth in these Terms of Use. \\r\\n\\r\\nChanges\\r\\n-------\\r\\nYou agree that Vivli has the right, at its sole discretion, to modify or replace these Terms of Use. Your continued use of or access to the Platform following posting of any changes to these Terms of Use constitutes acceptance of those modified terms. New services or features offered through Vivli, including within the Platform shall be subject to the Terms of Use and Agreements then in effect.\\r\\n\\r\\nDisclaimer of Warranties\\r\\n------------------------\\r\\nThe Platform is provided on an \"as is\" and \"as-available\" basis. VIVLI HEREBY DISCLAIMS ALL WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON- INFRINGEMENT. VIVLI MAKES NO WARRANTY THAT DATA WILL BE ERROR FREE OR THAT ACCESS THERETO WILL BE CONTINUOUS OR UNINTERRUPTED.\\r\\n\\r\\nLiability\\r\\n---------\\r\\nIN NO EVENT WILL VIVLI, ITS VENDORS, OR THE DATA CONTRIBUTORS BE LIABLE IN ANY MANNER WITH RESPECT TO THE VIVLI AMR WEBSITE, THE PLATFORM, OR ANY SUBJECT MATTER ARISING FROM THESE TERMS OF USE, UNDER ANY CONTRACT, NEGLIGENCE, STRICT LIABILITY OR OTHER LEGAL OR EQUITABLE THEORY FOR: (1) ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES; (2) THE COST OF PROCUREMENT OF SUBSTITUTE PRODUCTS OR SERVICES; OR (3) FOR INTERRUPTION OF USE OR LOSS OR CORRUPTION OF DATA.\\r\\n\\r\\nNo Waiver Rights\\r\\n-----------------\\r\\nVivli\\'s failure to exercise or enforce any right or provision of these Terms of Use shall not constitute waiver of such right or provision.\\r\\n\\r\\nService Termination\\r\\n-------------------\\r\\nIf you wish to terminate use of the Platform you may do so by refraining from further use. VIVLI reserves the right to refuse to provide access to the Platform to you if Vivli determines in its sole discretion that you have violated these Terms of Use or any applicable law. All provisions of these Terms of Use which by their nature should survive termination including warranty disclaimers and limitations of liability.\\r\\n\\r\\nTermination of Platform\\r\\n-----------------------\\r\\nVivli reserves the right to cease providing the Platform at any time, for any reason in its sole discretion. Should Vivli choose to terminate its website, or the Platform, individual users shall retain access to any Data downloaded only for the purposes stated in these Terms of Use.\\r\\n\\r\\nApplicable Law\\r\\n--------------\\r\\nYour access to the Platform and the Data provided, is governed by, and subject to, all applicable state and federal laws of the United States, including those pertaining to personal data security and privacy. Your access to the Platform constitutes your consent to the retrieval and disclosure of the Data within the scope of your authorized access, subject to applicable law.\\r\\nTHESE TERMS OF USE, AND YOUR USE AND ACCESS OF THE PLATFORM AND DATA, ARE GOVERNED BY THE LAWS OF THE STATE OF MASSACHUSETTS, WITHOUT REGARD TO ITS CONFLICT OF LAWS RULES. JURISDICTION AND VENUE FOR ANY CAUSE OF ACTION ARISING UNDER THESE TERMS OF USE SHALL BE IN SUFFOLK COUNTY, BOSTON, MASSACHUSETTS, U.S.A. THOUGH ADDITIONAL JURISDICTIONS MAY BE MANDATORY BASED ON APPLICABLE DATA BREACH LAWS.\\r\\nThe Platform may be accessed from the United States, as well as from other countries around the world. VIVLI makes no representation that the Platform is appropriate or available for use in locations outside the United States. You agree to comply with any additional requirements of the country where you are accessing the Platform and not to access the Platform from any country or jurisdiction where its content is illegal or prohibited. If you choose to access the Platform from outside the United States, you do so on your own initiative and you are responsible for compliance with any applicable laws of the country outside the United States in addition to those that are applicable within the United States.\\r\\n',\r\n virtualMachineTypes: virtualMachineTypesIntercept,\r\n funders: [\r\n 'Doris Duke Charitable Foundation',\r\n 'GATES',\r\n 'Helmsley',\r\n 'NIH',\r\n 'Wellcome',\r\n 'Other',\r\n ],\r\n workflowStepNorms: workflowStepNormsIntercept,\r\n reportSpecs: reportSpecsIntercept,\r\n regionItems: [\r\n { name: 'North America', code: '1' },\r\n {\r\n name: 'Latin America and the Caribbean',\r\n code: '2',\r\n },\r\n { name: 'Africa/Middle East', code: '3' },\r\n { name: 'Asia', code: '4' },\r\n {\r\n name: 'Europe',\r\n code: '5',\r\n },\r\n { name: 'Oceania', code: '6' },\r\n ],\r\n workflowStatusDescriptorDetails: workflowStatusDescriptorDetailsIntercept,\r\n externalMenuItems: externalMenuItemsIntercept,\r\n schemaVersion: '1.0.0',\r\n documentType: 'VivliConfig',\r\n createdBy: null,\r\n updatedBy: null,\r\n createdDate: null,\r\n updatedDate: null,\r\n eTag: null,\r\n timestamp: '1970-01-01T00:00:00',\r\n location: null,\r\n tags: null,\r\n id: '0592c4a4-c126-4527-a020-b235eb59b2d7',\r\n name: null,\r\n type: null,\r\n};\r\n","import { IIntercepts } from './intercepts.interface';\r\nimport { vivliConfigIntercept } from './data/vivli-config/vivli-config.intercept';\r\nimport { IVivliConfiguration } from '@vivli/shared/infrastructure/interface';\r\n\r\nfunction parseObj(objToParse: unknown) {\r\n return JSON.parse(JSON.stringify(objToParse)) as T;\r\n}\r\n\r\nexport const intercepts: IIntercepts = {\r\n vivliConfig: parseObj(vivliConfigIntercept),\r\n};\r\n","import { RestApi } from '@vivli/core/infrastructure/rest';\r\nimport { Observable, of } from 'rxjs';\r\nimport {\r\n IExternalMenuItem,\r\n IVivliConfiguration,\r\n IVivliConfigurationApiService,\r\n} from '@vivli/shared/infrastructure/interface';\r\nimport { environment } from '@vivli/core/environments';\r\nimport { intercepts } from '@vivli/shared/intercepts';\r\n\r\nexport class VivliConfigurationApiService\r\n extends RestApi\r\n implements IVivliConfigurationApiService\r\n{\r\n getVivliConfig = (): Observable => {\r\n if (environment.useIntercepts) {\r\n return of(intercepts.vivliConfig);\r\n }\r\n\r\n return this.handleGet('/vivliConfig');\r\n };\r\n\r\n getExternalMenuItems = (): Observable => {\r\n return this.handleGet(\r\n '/vivliConfig/externalMenuItems',\r\n { bypassAuth: true }\r\n );\r\n };\r\n\r\n}\r\n","export const StudyMetadataPackageFilesConstant = [\r\n 'Protocol',\r\n 'CSR (may be redacted)',\r\n 'Statistical Analysis Plan',\r\n 'Data Dictionary',\r\n 'Annotated Case Report Form',\r\n 'Other',\r\n 'Unknown'\r\n];\r\n","export enum ApprovalStatusEnum {\r\n None = 'None',\r\n Approved = 'Approved',\r\n Rejected = 'Rejected',\r\n RevisionsRequested = 'RevisionsRequested',\r\n}\r\n","export enum DataRequestStatusEnum {\r\n None = 'None',\r\n Draft = 'Draft',\r\n Blinded = 'Blinded',\r\n SubmittedToVivli = 'SubmittedToVivli',\r\n RejectedByVivli = 'RejectedByVivli',\r\n AwaitingDataProviderApproval = 'AwaitingDataProviderApproval',\r\n AwaitingIRPApproval = 'AwaitingIRPApproval',\r\n RevisionsRequestedByDataProvider = 'RevisionsRequestedByDataProvider',\r\n RejectedByDataProvider = 'RejectedByDataProvider',\r\n RevisionsRequestedByIRP = 'RevisionsRequestedByIRP',\r\n RejectedByIRP = 'RejectedByIRP',\r\n Approved = 'Approved',\r\n PartiallyFulfilled = 'PartiallyFulfilled',\r\n Fulfilled = 'Fulfilled',\r\n Archived = 'Archived',\r\n Cancelled = 'Cancelled',\r\n AwaitingDUAValidation = 'AwaitingDUAValidation',\r\n DUAValidated = 'DUAValidated',\r\n DUAReturnedToRequester = 'DUAReturnedToRequester',\r\n}\r\n","export enum StudyRequestStatusEnum {\r\n New = 'New',\r\n IPDProvided = 'IPDProvided',\r\n}\r\n","export enum RequestedStudyTypeEnum {\r\n None = 'None',\r\n Listed = 'Listed',\r\n Unlisted = 'Unlisted',\r\n External = 'External',\r\n}\r\n","export enum AnalysisPurposeEnum {\r\n NewResearchTreatmentEffectiveness = 'NewResearchTreatmentEffectiveness',\r\n NewResearchTreatmentSafety = 'NewResearchTreatmentSafety',\r\n ConfirmingResearchTreatmentEffectiveness = 'ConfirmingResearchTreatmentEffectiveness',\r\n ConfirmingResearchTreatmentSafety = 'ConfirmingResearchTreatmentSafety',\r\n PreliminaryResearch = 'PreliminaryResearch',\r\n SummaryLevelDataMetaAnalysis = 'SummaryLevelDataMetaAnalysis',\r\n ParticipantLevelDataMetanalysis = 'ParticipantLevelDataMetanalysis',\r\n SupportClinicalTrialDesign = 'SupportClinicalTrialDesign',\r\n StatisticalMethods = 'StatisticalMethods',\r\n TrainingTesting = \"TrainingTesting\",\r\n Other = 'Other',\r\n}\r\n","export enum AmrAnalysisPurposeEnum {\r\n AmrTrendsForCountryRegion = \"AmrTrendsForCountryRegion\",\r\n AmrTrendsForPathogen = \"AmrTrendsForPathogen\",\r\n AmrTrendsForSpecificResistanceMechanism = \"AmrTrendsForSpecificResistanceMechanism\",\r\n AmrTrendsForInfectionTypeOrIndication = \"AmrTrendsForInfectionTypeOrIndication\",\r\n AmrTrendsOverDifferentYears = \"AmrTrendsOverDifferentYears\",\r\n PkPd = \"PkPd\",\r\n InformAntimicrobialStewardship = \"InformAntimicrobialStewardship\",\r\n Other = \"Other\"\r\n}\r\n","export enum ResearchTeamMemberRoleEnum {\r\n Lead = 'Lead',\r\n Statistician = 'Statistician',\r\n AdditionalResearcher = 'AdditionalResearcher',\r\n}\r\n","export enum VmAdminApprovalStatusEnum {\r\n None = 'None',\r\n NeedsApproval = 'NeedsApproval',\r\n NotApplicable = 'NotApplicable',\r\n Automatic = 'Automatic',\r\n Disapproved = 'Disapproved',\r\n Approved = 'Approved',\r\n}\r\n","export enum DuaDocumentStatusEnum {\r\n No_Status_Yet = 0,\r\n Waiting_For_Researcher_Acknowledgement = 1,\r\n Waiting_For_IO_Contact = 2,\r\n Waiting_For_IO_Signature = 3,\r\n Waiver_In_Negotiation = 4,\r\n DUA_Ready_Waiting_For_Request_Approval = 5,\r\n Executed = 6\r\n}\r\n","import {VmAdminApprovalStatusEnum} from \"@vivli/features/data-requests/infrastructure/enum\";\r\n\r\nconst VmAdminApprovalLabels = {\r\n [VmAdminApprovalStatusEnum.NeedsApproval]: 'Needs DUA Approval',\r\n [VmAdminApprovalStatusEnum.NotApplicable]: 'DUA Approval Not Applicable',\r\n [VmAdminApprovalStatusEnum.Approved]: 'Has DUA Approval',\r\n [VmAdminApprovalStatusEnum.Disapproved]: 'Denied DUA Approval',\r\n [VmAdminApprovalStatusEnum.Automatic]: 'Automatic DUA Approval'\r\n};\r\n\r\nconst menuVMAdminApprovalLabels = {\r\n [VmAdminApprovalStatusEnum.NeedsApproval]: 'DUA Approval Required',\r\n [VmAdminApprovalStatusEnum.Approved]: 'Has DUA Approval',\r\n [VmAdminApprovalStatusEnum.Automatic]: 'Has DUA Approval',\r\n [VmAdminApprovalStatusEnum.Disapproved]: 'DUA Approval Denied',\r\n [VmAdminApprovalStatusEnum.NotApplicable]: null,\r\n}\r\n\r\nconst phaseLabels = {\r\n phaseTable: [\r\n {value: '', label: ''},\r\n {value: 'NA', label: 'N/A'},\r\n {value: 'EarlyPhase1', label: 'Early Phase 1'},\r\n {value: 'Phase1', label: 'Phase 1'},\r\n {value: 'Phase1Phase2', label: 'Phase 1/Phase 2'},\r\n {value: 'Phase2', label: 'Phase 2'},\r\n {value: 'Phase2a', label: 'Phase 2a'},\r\n {value: 'Phase2b', label: 'Phase 2b'},\r\n {value: 'Phase2Phase3', label: 'Phase 2/Phase 3'},\r\n {value: 'Phase3', label: 'Phase 3'},\r\n {value: 'Phase3a', label: 'Phase 3a'},\r\n {value: 'Phase3b', label: 'Phase 3b'},\r\n {value: 'Phase4', label: 'Phase 4'},\r\n ],\r\n};\r\n\r\nexport const AdminApprovalConstant = {\r\n VmAdminApprovalLabels,\r\n menuVMAdminApprovalLabels,\r\n phaseLabels,\r\n}\r\n\r\n\r\n","import {IDataRequestHints} from \"@vivli/shared/infrastructure/interface\";\r\n\r\nexport const DataRequestHintsConstant: IDataRequestHints = {\r\n researchTeam:\r\n {\r\n sectionDescription: 'Please note that a statistician/data scientist with a degree in statistics or a related discipline should be part of the research team.\\n\\nFees, including licenses, are paid by the study sponsors for research team members to access data on the website and use the statistical software. The number of licenses for each research proposal may be limited to a maximum of five.\\n\\nFor this section, please include all researchers on your team. We should be notified where there is a change in membership of the research team.\\n\\nUp to 20 researchers can be entered.\\n\\n',\r\n leadResearcherTeamMemberDetail: {\r\n orcidId: 'ORCID iD # is a persistent digital identifier that distinguishes you from every other researcher and, through integration in key research workflows such as manuscript and grant submission, supports automated linkages between you and your professional activities ensuring that your work is recognized.\\n\\n',\r\n qualifications: 'Please make sure to include all educational and professional criteria relevant to the proposed research, for the lead researcher and statistician. It is particularly important to elaborate on the qualifications of the statistician. If the designated statistician does not have a degree in statistics or biostatistics but has conducted meta-analysis, please list these publications.',\r\n },\r\n researchTeamDetails: [\r\n {\r\n orcidId: 'ORCID iD # is a persistent digital identifier that distinguishes you from every other researcher and, through integration in key research workflows such as manuscript and grant submission, supports automated linkages between you and your professional activities ensuring that your work is recognized.\\n\\n',\r\n },\r\n ],\r\n statisticianTeamMemberDetail: {\r\n orcidId: 'ORCID iD # is a persistent digital identifier that distinguishes you from every other researcher and, through integration in key research workflows such as manuscript and grant submission, supports automated linkages between you and your professional activities ensuring that your work is recognized.\\n\\n',\r\n qualifications: 'Please make sure to include all educational and professional criteria relevant to the proposed research, for the lead researcher and statistician. It is particularly important to elaborate on the qualifications of the statistician. If the designated statistician does not have a degree in statistics or biostatistics but has conducted meta-analysis, please list these publications.',\r\n },\r\n },\r\n researchProposal: {\r\n sectionDescription: 'Provide a description of the desired outcome of the research you are proposing to carry out, the design of the study, the timeline and your plans to distribute and/or publish the results of your study.',\r\n laySummary: 'Please provide a plain English summary of the proposed research that is suitable for a general or lay audience, clarifies the design, and explains the relevance of the research project to science and public health. Please use the following sub-headings:\\n\\n- The background to the research\\n- Why does this research need to be done now?\\n- How many patients / members of the public are potentially affected?\\n- Provide references to prior work on the topic, if applicable\\n- Objective\\n- Provide a description of the specific aims of the project, including the specific hypotheses to be evaluated\\n- How the research will add to medical science or patient care\\n- How the research will be conducted\\n- What design and methods have you chosen and why? (in brief)\\n- How the findings will be interpreted and communicated to the public (publication plan)\\n- Provide a structured abstract for the proposed work\\n',\r\n purposeOfAnalysis: 'What is the purpose of the analysis being proposed? Please select all that apply.',\r\n researchProposalStudyDesign:\r\n {\r\n briefDescription: 'Please provide a brief description of the study design. For example: case-control, cohort, cross-sectional, historical controlled, hybrid designs, meta-analysis, or pooled analysis. Please also provide a description of the study population or populations for the proposed research. For example: the study arms from the requested clinical studies; intent-to-treat or per-protocol populations; the inclusion and exclusion criteria for any cohort or subgroup analysis.\\n\\nPlease describe the endpoints of the requested studies that will be analyzed. To ensure the use of the data aligns with the informed consent provided by clinical study participants, research proposals must relate to the intervention or disease that was the subject of the original clinical studies.\\n\\nPlease describe the specific outcomes\\' elements and how they will be categorized/defined for your study, including Domain (e.g., anxiety), Specific measurement (e.g., Hamilton Anxiety Rating Scale), Specific Metric (e.g., change from baseline), Method of Aggregation (e.g., mean), and Time-point(s) (e.g., 3 and 6 months):\\n\\nMain Predictor/Independent Variable and how it will be categorized/defined for your study:\\n\\nOther variables of interest that will be used in your analysis and how they will be categorized/defined in your study (i.e. genders, age groups, ethnic groups):\\n\\nProvide an estimation of key milestone dates for the proposed study, including anticipated project start date analysis completion date. Please note: if your data request is approved, the Terms of Use Agreement allows for access for a 12-month period, with the possibility of an extension.\\n\\n',\r\n elementsforOutcomes: 'Please describe the specific outcomes\\' elements and how they will be categorized/defined for your study, including Domain (e.g., anxiety), Specific measurement (e.g., Hamilton Anxiety Rating Scale), Specific Metric (e.g., change from baseline), Method of Aggregation (e.g., mean), and Time-point(s) (e.g., 3 and 6 months):\\n\\n',\r\n mainPredictorIndependentVariable: 'Main Predictor/Independent Variable and how it will be categorized/defined for your study:\\n\\n',\r\n otherVariablesOfInterest: 'Other variables of interest that will be used in your analysis and how they will be categorized/defined in your study (i.e. genders, age groups, ethnic groups):\\n\\n',\r\n },\r\n projectTimeline: {\r\n sectionDescription: 'Provide an estimation of key milestone dates for the proposed study, including anticipated project start date analysis completion date. Please note: if your data request is approved, the Terms of Use Agreement allows for access for a 12-month period, with the possibility of an extension.\\n\\n',\r\n },\r\n disseminationAndPublicationPlan: 'Provide a description of anticipated products and target audience, including expectation for study manuscripts and potentially suitable journals for submission of the completed research project. Include how the findings will be interpreted and communicated to the public (publication plan) You may provide a structured abstract for the proposed work.',\r\n },\r\n statisticalAnalysisPlan: {\r\n sectionDescription: 'Describe how you will analyze the clinical data that you have requested.',\r\n description: 'Describe how you will analyze the requested clinical study data, including descriptive, bivariate and multivariable analyses, and any other planned advanced analyses (such as propensity score methods, Kaplan-Meier or Cox modeling approaches, non-parametric testing). The following is provided as guidance for items to include in the statistical analysis plan:\\n\\n- Effect measure of interest (e.g. for inferential studies: risk or rate ratio, risk or rate difference, absolute difference; for descriptive studies: rate with confidence intervals)\\n- Methods to control for bias (e.g. restriction, matching, stratification, covariate adjustment)\\n- Assumptions and any planned adjustments for covariates or meta-regression or modelling of covariates\\n- The statistical approach (e.g. Bayesian or frequentist (classical), fixed or random effects)\\n- Meta-analysis approach where applicable (e.g. random effects meta-analysis, stratified meta-analysis)\\n- Statistical tests and methods (e.g. Fisher’s exact test, Kaplan-Meier curves, log-rank test to compare groups, multiplicity adjustments)\\n- Power to detect an effect, or the precision of the effect estimate given the sample size available\\n- Statistical power calculations and levels of significance\\n- Model fit tests, sensitivity or heterogeneity analyses (e.g. Chi-Squared Test, I squared statistic)\\n- Analysis of subgroups (e.g. by age, disease status, ethnicity, socioeconomic status, presence or absence or co-morbidities); different types of intervention (e.g. drug dose)\\n- Handling of missing data\\n',\r\n analysisLocation: 'Country/countries where the analysis will be conducted\\n',\r\n },\r\n funding: {\r\n sectionDescription: 'Provide information about the sources of funding.',\r\n },\r\n conflictsOfInterest: {\r\n sectionDescription: 'For each member of the research team, please provide information on financial relationships that could be perceived to influence the planning, conduct or interpretation of the proposed research.\\n\\nPlease include research grants from governments or government agencies, other grants or donations, funding from employers through employment contracts, other contracts, consultancies, honoraria and other payments that will be used for the proposed research. This should not be limited to financial relationships with the study sponsors involved in this initiative and other pharmaceutical or biotechnology companies within the last three years. It should include:\\n\\n- Board memberships\\n- Consultancies\\n- Employments\\n- Grants/grants pending\\n- Patents (planned, pending or issued)\\n- Royalties\\n- Stocks or shares (including options)\\n\\nPlease also include any other (e.g. non-financial real or potential conflicts of interest that could be perceived to influence the planning, conduct or interpretation of the proposed research. For example potential biases based on pre-existing personal views, academic or commercial competition, personal relationships or institutional affiliations.\\n\\nIf none, please enter “None.”\\n\\nFor each conflict, please summarize how real or potential conflicts of interest related to funding of the proposed research, other financial relationships or other real or potential conflicts of interest will be managed. For example through disclosure of interests when the research is presented and published.\\n\\n',\r\n },\r\n requirementsAndAttestations: {\r\n sectionDescription: 'Before submitting the request for data, you must check the box on this tab to certify that the information you are providing is complete and accurate.',\r\n hasAgreedToVivliDataAccessAgreement: 'Please check the box below to acknowledge that access to data will only be provided in the secure access data system. Select statistical software (e.g. STATA and R) is provided. There are controls to prevent the original study datasets from being downloaded.\\n\\n',\r\n hasCertifiedCompleteAndAccurate: 'Please check the box below to indicate that you as the Lead Researcher certify that the information provided is complete and accurate, and that you assume full responsibility for the research.',\r\n },\r\n otherInformation: 'This tab allows an opportunity to provide any other information that might be relevant to the research study, either entered on the form, or as an uploaded attachment.',\r\n};\r\n","import joi from 'joi';\r\n\r\nexport const requiredTemplateString = '{#label} is required.';\r\nexport const JoiValidationOptionsConstant: joi.ValidationOptions = {\r\n messages: {\r\n 'string.required': requiredTemplateString,\r\n 'string.empty': requiredTemplateString,\r\n 'array.min': requiredTemplateString,\r\n 'string.base': requiredTemplateString,\r\n },\r\n allowUnknown: true,\r\n errors: {\r\n wrap: {\r\n label: false\r\n }\r\n }\r\n};\r\nexport const OrcidRegex = /^\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]$/;\r\n\r\n\r\n","// Add new translation key values to amr-translations.constant,\r\n// default-translations.constant and translation-key.enum.\r\n// This allows you to use enum vals to look up constants easily\r\n// To retrieve values, get a function from the useTranslation hook,\r\n// as follows:\r\n// const {t} = useTranslation();\r\n// then pass the key to the function, e.g.\r\n// const translatedString = t(TranslationKeyEnum.welcomeMessage)\r\nexport const AmrTranslationsConstant: any = {\r\n isDefault: 'no',\r\n picoButton: 'BROWSE',\r\n studies: 'Datasets',\r\n study: 'dataset',\r\n Vivli: 'AMR',\r\n welcomeMessage: 'This is your view of AMR Register at a glance.' +\r\n '

' +\r\n 'To start a request for AMR surveillance datasets, navigate to the drop-down menu at\\n' +\r\n 'the top right of this page under your name, and select ‘Search.’' +\r\n '

' +\r\n 'If you are a data contributor, to view the data requests for your organization’s datasets\\n' +\r\n 'navigate to the ‘Data Requests’ tab on the left-hand side of this page.' +\r\n '

' +\r\n 'If you have any questions, please contact Vivli Support at '\r\n + '<0>amr@vivli.org' +\r\n '

' +\r\n 'Thanks!',\r\n studyID: 'Dataset ID',\r\n studyType: 'Data',\r\n fileUploadInstructions: 'data sets',\r\n update: 'Update dataset Data Package Below',\r\n title: 'Dataset Title',\r\n popUpWelcomeMessage:\r\n 'Welcome to the AMR Register, which offers an easy way to request antimicrobial resistance ' +\r\n 'surveillance datasets from a range of biotech and pharmaceutical companies.' +\r\n '

' +\r\n 'To search for datasets and then request them on the platform, you can BROWSE the details of all ' +\r\n 'the datasets, or use the SEARCH to filter the datasets to identify those that contain the ' +\r\n 'information you require. Filtered search allows you to select values from drop-down lists to identify the ' +\r\n 'datasets relevant for your research. All the drop-down filters allow you to select one or more values. The ' +\r\n 'number of matches will display on the bottom of the screen – click this number or the (magnifying glass symbol) ' +\r\n 'to display the list of datasets matching your criteria.' +\r\n '

' +\r\n 'More detailed guidance on all aspects of using the AMR Register is on the Resources Menu. You can also contact us at ' +\r\n //Translates to: 'amr@vivli.org.'\r\n '<2>amr@vivli.org.',\r\n chatHelperText: 'Requesters Chat will be seen by the requester of the data and Vivli',\r\n duaValidatedStatusString: 'Awaiting Data Package Upload',\r\n howToGuideLink: \"https://amr.vivli.org/resources/resources/\",\r\n privacyLink: \"https://amr.vivli.org/privacy/\",\r\n cookiePolicyLink: \"https://amr.vivli.org/vivli-cookie-policy/\",\r\n eeaDisclosurePolicyLink: \"https://amr.vivli.org/eea-disclosure/\",\r\n contactUsLink: \"https://amr.vivli.org/contact/\",\r\n vmResearchEnvironmentConfig: \"Alternative pricing applies for industry users of SAS, email support@vivli.org for details\",\r\n pathway2SubmitConfirmText: \"You are about to submit a data request containing datasets that must be requested from a partner platform. Once you submit this request it can be changed only by contacting Vivli at AMR@vivli.org. Press OK if you are sure you are ready to submit the request now.\",\r\n accessDataPackagesIPD: \"AMR surveillance data\",\r\n accessDPResearchEnvironment:\"\",\r\n};\r\n","// Add new translation key values to amr-translations.constant,\r\n// default-translations.constant and translation-string.enum.\r\n// This allows you to use enum vals to look up constants easily\r\n// To retrieve values, get a function from the useTranslation hook,\r\n// as follows:\r\n// const {t} = useTranslation();\r\n// then pass the key to the function, e.g.\r\n// const translatedString = t(TranslationStringEnum.welcomeMessage)\r\n\r\nexport const DefaultTranslationsConstant: any = {\r\n isDefault: 'yas',\r\n picoButton: 'PICO Beta',\r\n studies: 'Studies',\r\n study: 'study',\r\n Vivli: 'Vivli',\r\n welcomeMessage: 'This is your view of Vivli at a glance.' +\r\n '

' +\r\n 'Here you can view your organizational memberships and roles,\\n' +\r\n 'any pending requests that require your approval, as well as any studies awaiting\\n' +\r\n 'Data Package upload from your organization. You can also generate metrics for\\n' +\r\n 'data requests involving your organization\\'s studies.\\n' +\r\n '

' +\r\n 'If you have any questions, please contact Vivli Support.' +\r\n '

' +\r\n 'Thanks!',\r\n studyID: 'Study ID',\r\n studyType: 'IPD',\r\n fileUploadInstructions: 'studies',\r\n update: 'Upload study Data Package below',\r\n title: 'Study Title',\r\n popUpWelcomeMessage:\r\n 'Welcome to the Vivli platform, which offers an easy way to share, archive and ' +\r\n 'request anonymized data from completed clinical trials across a wide range of ' +\r\n 'stakeholders from academia, government, non-profits and foundations, biotech and ' +\r\n 'pharmaceutical companies.' +\r\n '

' +\r\n 'Share your studies: Vivli is here to make it as easy as possible to share your studies. ' +\r\n 'If you have one study to submit for sharing, click ' +\r\n //Translates to: 'here.'\r\n '<3>here. ' +\r\n 'For more information, see our webpage on ' +\r\n //Translates to: 'how to share data.'\r\n '<4>how to share data.' +\r\n '

' +\r\n 'Request studies: You can search for studies on the Search page under this popup and then request them on the platform. ' +\r\n 'For more information see our webpage on ' +\r\n //Translates to: 'how to request data.'\r\n '<5>how to request data.' +\r\n '

' +\r\n 'Search for studies: You can use the Search page under this popup to enter the name of a condition, a ' +\r\n 'treatment, an outcome, or the ID of a study you want to request. If you enter more than one term, ' +\r\n 'it will find studies that contain any of the terms. You can override this by combining terms with ' +\r\n 'an AND (e.g. asthma AND fluticasone) or, if the exact order is important, putting the terms in quotes ' +\r\n '(e.g. “multiple sclerosis”). The number of matches will display on the bottom of the screen – click ' +\r\n 'this number to display the list of studies.' +\r\n '

'+\r\n 'More detailed guidance on search and all aspects of using the Vivli Platform is on the ' +\r\n '<6>Resources Menu. ' +\r\n 'You can also contact us at ' +\r\n //Translates to: 'support@vivli.org.'\r\n '<0>support@vivli.org.' +\r\n '

' +\r\n 'If you cannot find a study on this Search page and you would like to request it from one of our members you can use the ' +\r\n //Translates to: 'Enquiry Form '\r\n '<1>Enquiry Form ' +\r\n 'to ask about study data availability.',\r\n chatHelperText: 'The chat with an organization\\'s name will only be seen by members of that organization. As with the Open Chat, the organization chat is only for a specific data request.'+\r\n '

' +\r\n 'Contributors chat will be seen by all contributors of data to this request and Vivli' +\r\n 'Requesters Chat will be seen by the requester of the data and Vivli',\r\n howToGuideLink: \"https://vivli.org/resources/resources/\",\r\n privacyLink: \"https://vivli.org/privacy/\",\r\n cookiePolicyLink: \"https://vivli.org/vivli-cookie-policy/\",\r\n eeaDisclosurePolicyLink: \"https://vivli.org/vivli-eea-disclosure/\",\r\n contactUsLink: \"https://vivli.org/contact/\",\r\n duaValidatedStatusString: 'DUA Validated and Awaiting Data Package Upload',\r\n vmResearchEnvironmentConfig:\r\n 'Academic license for SAS.
' + 'Alternative pricing applies for industry users of SAS, email '+\r\n '<0>support@vivli.org'+\r\n ' for details.',\r\n pathway2SubmitConfirmText: \"You are about to submit a data request containing studies whose data package or approval come from a Vivli Platform Provider. These studies must be requested through their Platform Provider. Once you submit this request, it can be changed only by contacting Vivli. Press OK if you are sure you are ready to submit the request now.\",\r\n IPD: \"IPD (Anonymized Individual Participant-level Data)\",\r\n accessDataPackagesIPD: \"anonymized Individual Participant Data (IPD)\",\r\n accessDPResearchEnvironment:\"placing the data into a secure research environment or (when allowed)\",\r\n};\r\n","import {IFacet} from \"@vivli/shared/infrastructure/interface\";\r\n\r\nexport const AmrFacetsConstant: IFacet[] = [\r\n {\r\n name: 'antimicrobials',\r\n arguments: {\r\n count: 200,\r\n sort: 'value'\r\n }\r\n },\r\n {\r\n name: 'groupingsOfResistancePatterns',\r\n arguments: {\r\n count: 50,\r\n sort: 'value'\r\n }\r\n },\r\n {\r\n name: 'organisms',\r\n arguments: {\r\n count: 1500,\r\n sort: 'value'\r\n }\r\n },\r\n {\r\n name: 'specimenSources',\r\n arguments: {\r\n count: 200,\r\n sort: 'value'\r\n }\r\n },\r\n {\r\n name: 'sampleTimes'\r\n },\r\n {\r\n name: 'countries',\r\n arguments: {\r\n count: 300,\r\n sort: 'value'\r\n }\r\n },\r\n { name: 'regions' },\r\n { name: 'yearsDataCollected' },\r\n {\r\n name: 'sponsorName',\r\n arguments: {\r\n count: 500,\r\n sort: 'value'\r\n }\r\n }\r\n]\r\n","import {IFacet} from \"@vivli/shared/infrastructure/interface\";\r\n\r\nexport const ClinicalTrialsFacetsConstant: IFacet[] = [\r\n { name: 'studyDesign' },\r\n {\r\n name: 'locationsOfStudySites',\r\n arguments: {\r\n count: 300,\r\n sort: 'value'\r\n }\r\n },\r\n { name: 'sponsorType' },\r\n { name: 'contributorType' },\r\n {\r\n name: 'sponsorName',\r\n arguments: {\r\n count: 500,\r\n sort: 'value'\r\n }\r\n },\r\n { name: 'studyType' },\r\n {\r\n name: 'actualEnrollment',\r\n arguments: {\r\n interval: 100\r\n }\r\n }\r\n]\r\n","export const InterventionalStudyOptionsConstant = [\r\n {label: 'Single Group', value: 'SingleGroup'},\r\n {label: 'Parallel Group', value: 'ParallelGroup'},\r\n {label: 'Parallel Group Randomized', value: 'ParallelGroupRandomized'},\r\n {label: 'Parallel Group Non-Randomized', value: 'ParallelGroupNonRandomized'},\r\n {label: 'Crossover', value: 'Crossover'},\r\n]\r\n","export const ObservationalStudyOptionsConstant = [\r\n {label: 'Case Crossover', value: 'CaseCrossover'},\r\n {label: 'Case Control', value: 'CaseControl'},\r\n {label: 'Cohort', value: 'Cohort'},\r\n {label: 'Cross-Sectional', value: 'Cross-sectional'},\r\n]\r\n","\r\n\r\nconst typeOfLables = {\r\n typeOfLable: [\r\n {value: 'VM', title: 'Virtual Machine'},\r\n {value: 'DataRequest', title: 'Data Request'},\r\n {value: 'Study', title: 'Study'},\r\n ],\r\n};\r\n\r\nexport const AdminConsoleConstant = {\r\n typeOfLables,\r\n}\r\n\r\n\r\n","export const AssetsConstant = {\r\n ACADEMIC_DATA_SHARING_GRAPHIC: '/assets/Academic_Data_Sharing_Graphic.png',\r\n AVATAR_ICON: '/assets/Ribbon_AvatarIcon_Inverse.svg',\r\n avatarInverseIcon: '/assets/Ribbon_AvatarIcon_Inverse.svg',\r\n VIVLI_LOGO: '/assets/Logo@2x.png',\r\n VIVLI_LOGO2: '/assets/vivli_logo2.png',\r\n VIVLI_AMR_LOGO: '/assets/vivli_amr_logo.png',\r\n VIVLI_AMR_RGB_LOGO: '/assets/Vivli_AMR_rgb.jpg',\r\n VIVLI_BACKGROUND: '/assets/background.jpg',\r\n VIVLI_BACKGROUND_PEOPLE: '/assets/background.jpg',\r\n PLUS_SYMBOL: '/assets/UI_PlusSymbol.svg',\r\n DASHBOARD_ICON_ACTIVE: '/assets/LeftNav_DashboardIcon-Active.svg',\r\n DASHBOARD_ICON_INACTIVE: '/assets/LeftNav_DashboardIcon-Inactive.svg',\r\n DATA_REQUESTS_ICON_ACTIVE: '/assets/LeftNav_DataRequestsIcon-Active.svg',\r\n DATA_REQUESTS_ICON_INACTIVE: '/assets/LeftNav_DataRequestsIcon-Inactive.svg',\r\n INVITATIONS_ICON_ACTIVE: '/assets/LeftNav_InvitationsIcon-Active.svg',\r\n INVITATIONS_ICON_INACTIVE: '/assets/LeftNav_InvitationsIcon-Inactive.svg',\r\n OFFICEBUILDING_ICON_ACTIVE:\r\n '/assets/LeftNav_OfficeBuildingIconSmall-Active.png',\r\n OFFICEBUILDING_ICON_INACTIVE:\r\n '/assets/LeftNav_OfficeBuildingIconSmall-Inactive.png',\r\n ORGANIZATIONS_ICON_ACTIVE: '/assets/LeftNav_OrganizationsIcon-Active.svg',\r\n ORGANIZATIONS_ICON_INACTIVE: '/assets/LeftNav_OrganizationsIcon-Inactive.svg',\r\n REQUESTS_ICON_ACTIVE: '/assets/LeftNav_RequestsIcon-Active.svg',\r\n REQUESTS_ICON_INACTIVE: '/assets/LeftNav_RequestsIcon-Inactive.svg',\r\n VM_ICON_ACTIVE: '/assets/LeftNav_VMIcon-Active.svg',\r\n VM_ICON_INACTIVE: '/assets/LeftNav_VMIcon-Inactive.svg',\r\n TRIALS_ICON_ACTIVE: '/assets/LeftNav_StudiesIcon-Active.svg',\r\n TRIALS_ICON_INACTIVE: '/assets/LeftNav_StudiesIcon-Inactive.svg',\r\n INFO_ICON: '/assets/Icons_InfoICon.svg',\r\n questionMarkIcon: '/assets/Icons_InfoICon.svg',\r\n INFO_BANG: '/assets/Icons_InfoBang.svg',\r\n FIELD_DROPDOWN_ARROW: '/assets/Icons_FieldDropdownArrow.svg',\r\n CLOSE_X_WHITE: '/assets/Icon_Close_X_White.svg',\r\n CLOSE_X_BLACK: '/assets/Icon_Close_X_Black.svg',\r\n PICO_CHECKMARK: '/assets/pico_checkmark@2x.png',\r\n PICO_CHECKMARK_BLACK: '/assets/pico_checkmark_black@2x.png',\r\n RED_X_ICON: '/assets/Icons_RedXIcon.svg',\r\n YELLOW_X_ICON: '/assets/Icons_YellowXIcon.svg',\r\n GREEN_CHECK_MARK: '/assets/Icons_GreenCheckMark.svg',\r\n WHITE_CHECK_MARK: '/assets/Icons_CheckMark.svg',\r\n BLACK_RIGHT_ARROW: '/assets/chevron_right_black.svg',\r\n WHITE_RIGHT_ARROW: '/assets/chevron_right_white.svg',\r\n REMOVE_RESEARCHER: '/assets/ICons_DeleteSectionSymbol.svg',\r\n WHITE_MAGNIFYING_GLASS: '/assets/Icon_White_Magnifying_Glass.png',\r\n DOWN_CHEVRON_WHITE: '/assets/Down_Chevron_White@2x.png',\r\n DOWN_CHEVRON_BLACK: '/assets/Down_Chevron_Black.svg',\r\n TERMS_UP_ARROW: '/assets/Icons_ParentTermsLevelUpArrow.svg',\r\n TERMS_DOWN_ARROW: '/assets/Icons_ChildrenTermsLevelDownArrow.svg',\r\n RIBBON_MY_REQUESTS: '/assets/Ribbon_MyRequestsIcon.svg',\r\n NAV_VM_ICON: '/assets/Nav_VM_Icon.svg',\r\n SIGN_WARNING: '/assets/Sign_Warning.svg',\r\n VM_BEING_PROVISIONED: '/assets/VM_Being_Provisioned.svg',\r\n VM_NOT_RUNNING: '/assets/VM_Not_Running.svg',\r\n VM_RUNNING: '/assets/VM_Running.svg',\r\n VM_INACTIVE_ICON: '/assets/VM-Inactive_Icon.svg',\r\n VM_CHECK_MARK: '/assets/Check_Mark.svg',\r\n SEARCH_HELP_IMAGE1: '/assets/search_help_text_image001.png',\r\n SEARCH_HELP_IMAGE2: '/assets/search_help_text_image002.png',\r\n SEARCH_HELP_IMAGE3: '/assets/search_help_text_image003.png',\r\n SEARCH_HELP_IMAGE4: '/assets/search_help_text_image004.png',\r\n SEARCH_HELP_IMAGE5: '/assets/search_help_text_image005.png',\r\n SEARCH_HELP_IMAGE6: '/assets/search_help_text_image006.png',\r\n LEFT_CARET: '/assets/leftCaret.png',\r\n RIGHT_CARET: '/assets/rightCaret.png',\r\n DOWNLOAD_ARROW: '/assets/Icons_Download.svg',\r\n DOWNLOAD_ARROW_WHITE: '/assets/Icons_Download_White.svg',\r\n BANNER_BACKGROUND: '/assets/COVID_Banner_blank.jpg',\r\n avatarIcon: '/assets/Ribbon_AvatarIcon.svg',\r\n downArrowWhiteIcon: '/assets/Ribbon_DownArrow_White.svg',\r\n downArrowDarkIcon: '/assets/Ribbon_DownArrow_Dark.svg',\r\n vivliTempLogo: '/assets/VivliTempLogo.png',\r\n editIconActive: '/assets/UI_EditSymbol-Active.svg',\r\n editIconInactive: '/assets/UI_EditSymbol-Inactive.svg',\r\n};\r\n","\r\nexport const DTISubmitStudyHeader = {\r\n SubmitStudyWithdraw : 'submitStudy_withdraw',\r\n SubmitStudySubmit : 'submitStudy_submit',\r\n SubmitStudySave : 'submitStudy_save',\r\n}\r\n\r\nexport const DTIConfirmDialogueModal = {\r\n ConfirmDialogTextInput : 'confirm-dialog-text-input',\r\n ModalConfirmOk : 'modal_confirm_ok',\r\n}\r\nexport const DTIMessageModal = {\r\n PopupContinueButton : 'PopupContinueButton',\r\n}\r\nexport const DTIActiveUserMenu = {\r\n MenuItemSearch : 'MenuItem_Search',\r\n MenuItemEditMyProfile : 'MenuItem_EditMyProfile',\r\n MenuItemChangePassword: 'MenuItem_ChangePassword',\r\n MenuItemLogOut: 'MenuItem_LogOut',\r\n MainMenu : 'main_menu'\r\n}\r\nexport const DTIEnquiryDiscussionGrid = {\r\n DiscussionCommentInput : 'discussion-comment-input',\r\n}\r\nexport const DTICommonConst = {\r\n OkButton : 'ok-button',\r\n CancelButton : 'cancel-button',\r\n EditButton : 'edit_dr_button',\r\n ApproveButton : 'data_request_approve_button',\r\n SoftRejectButton : 'data_request_soft_reject_button',\r\n ArchiveButton : 'archive_button',\r\n DraftButton : 'data_request_reset_to_draft_button',\r\n SaveButton : 'save-button',\r\n SubmitButton : 'RequestHeaderSubmitButton',\r\n ResetButton : 'reset_button',\r\n RequestStudyMenu : 'request_study_menu',\r\n ExportCsvButton : 'export_csv_button',\r\n ModalClose : 'modal_close',\r\n NavigationPanel : 'navigation_panel',\r\n HeaderApprovalButton: (ButtonText: any) => `${ButtonText}_button`,\r\n AddButton : 'add_button',\r\n MultiSelectCheckBox: 'MultiSelectCheckBox',\r\n DropdownValue: 'DropdownValue',\r\n AddStudy: 'AddStudy',\r\n RemoveButton: 'RemoveButton',\r\n}\r\nexport const DTICTFormFields = {\r\n PromptTextArea: 'PromptTextArea',\r\n SponsorProtocolId: 'SponsorProtocolId',\r\n Title: 'Title',\r\n Email: 'Email',\r\n OrcidId: 'OrcidId',\r\n FName: 'FName',\r\n LName: 'LName',\r\n RorId: 'RorId',\r\n RorName: 'RorName',\r\n JsonList: 'JsonList',\r\n ExternalUrl: 'ExternalUrl',\r\n FileType: 'FileType',\r\n DoiNumber: 'DoiNumber',\r\n PackageName: 'PackageName',\r\n PackageNumber: 'PackageNumber',\r\n FormCheckBox: (CheckBoxValue: any) => `${CheckBoxValue}`,\r\n Status: 'Status',\r\n StudyDoi: 'StudyDoi',\r\n AlternateDoi: 'AlternateDoi',\r\n VivliId: 'VivliId',\r\n Acronym: 'Acronym',\r\n OrgName: 'OrgName',\r\n LeadAgency: (Agency:any) => `${Agency}`,\r\n RegistryDetials: (Registry:any) => `${Registry}`,\r\n Collaborators: 'Collaborators',\r\n SecondaryId: 'SecondaryId',\r\n StudyDetails: (Details:any) => `${Details}`\r\n};\r\nexport const DTIResearchProposalForm = {\r\n ResearchProposalTitleTextBox : 'ResearchProposalTitleTextBox',\r\n ResearchProposalSummaryTextBox : 'ResearchProposalSummaryTextBox',\r\n BriefDescriptionTextBox : 'BriefDescriptionTextBox',\r\n ResearchProposalStudyDesignTextBox : 'ResearchProposalStudyDesignTextBox',\r\n ResearchProposalMainPredictorTextBox : 'ResearchProposalMainPredictorTextBox',\r\n ResearchProposalOtherVariablesTextBox : 'ResearchProposalOtherVariablesTextBox',\r\n ResearchProposalDisseminationPlanTextBox : 'ResearchProposalDisseminationPlanTextBox',\r\n}\r\nexport const DTIStatisticalAnalysisPlanForm = {\r\n StatisticalAnalysisPlanDescriptionTextBox : 'StatisticalAnalysisPlanDescriptionTextBox',\r\n}\r\nexport const DTIDuaValidationButton = {\r\n DataRequestBeginDuaValidationButton : 'data_request_begin_dua_validation_button'\r\n}\r\nexport const DTISignDocument = {\r\n IAgreeInput : 'i-agree-input',\r\n SignButton : 'sign-button',\r\n SignCancelButton : 'sign-cancel-button'\r\n}\r\nexport const DTISetTrackingButton = {\r\n TrackButton : 'track_button',\r\n}\r\nexport const DTIVmProvisionedConnect = {\r\n ConnectToEnvironmentButton : 'connect_to_environment_button',\r\n}\r\nexport const DTIAttestationsForm = {\r\n AttestationCheckBox : 'AttestationCheckBox',\r\n}\r\nexport const DTIRejectButton = {\r\n DataRequestRejectButton : 'data_request_reject_button',\r\n}\r\nexport const DTITeamMemberControlsForm = {\r\n LeadResearcherCheckbox : 'LeadResearcher_checkbox',\r\n}\r\nexport const DTIInternalLinkMenu = {\r\n HeaderFeedbackLink : 'header_feedbackLink,'\r\n}\r\nexport const DTILogoComponent = {\r\n HomePageLogo : 'home_page_logo',\r\n}\r\nexport const DTIEsign = {\r\n ESignButton : 'esign-button',\r\n}\r\nexport const DTISearchButton = {\r\n SearchGo : 'search_go',\r\n}\r\nexport const DTIWelcomeModal = {\r\n WelcomeModalButtonClose : 'WelcomeModal_ButtonClose',\r\n}\r\nexport const DTIRequestedStudyRow = {\r\n StudyRowUploadIpd : 'studyRow_uploadIpd',\r\n AdminstudyRowMakeIPDAvailable : 'adminstudyRow_makeIPDAvailable',\r\n}\r\nexport const DTIEnquiryLink = {\r\n HeaderEnquiry : 'header_enquiry',\r\n}\r\nexport const DTIQuickStudyLookupButton = {\r\n HeaderQuickStudyLookUp : 'header_quickStudyLookup',\r\n}\r\nexport const DTISignupLoginButton = {\r\n HeaderSignup : 'header_signup',\r\n HeaderLogin : 'header_login',\r\n}\r\nexport const DTIGrid = {\r\n AgGrid : 'ag-grid-component',\r\n}\r\nexport const DTIMyDataRequestsButton = {\r\n HeaderMyDataRequest : 'header_myDataRequests',\r\n}\r\nexport const DTIStudyDesignFilterGroup = {\r\n InterventionalOption : 'interventional-option',\r\n ObservationalOption : 'observational-option',\r\n}\r\nexport const DTISearchInput = {\r\n SearchBox : 'search-box',\r\n}\r\nexport const DTIStudyPhaseFilterGroup = {\r\n StudiesOption : 'studies-option',\r\n}\r\nexport const DTITeamMemberRow = {\r\n AdditionalResearcherAccount : 'additional_researcher_account',\r\n}\r\nexport const DTIOrganizationMembershipList = {\r\n OrgMemberRoles : 'org-member-roles-',\r\n OrgMemberRolesList : 'org-member-roles-list',\r\n OrgAdminRole : 'org-admin-role',\r\n IrpReviewerRole : 'irp-reviewer-role',\r\n DataContributorRole : 'data-contributor-role',\r\n CuratorRole : 'curator-role',\r\n}\r\nexport const DTIDataRequestStatusRenderer = {\r\n DataRequestStatus : 'dataRequestStatus_',\r\n}\r\nexport const DTIResetToDraftWithTitle = {\r\n ResetTitle : 'reset_title',\r\n DataRequest : 'data_request_',\r\n}\r\n\r\nexport const DTIResearchTeam = {\r\n RTDFirstName : (index: number) => `researchTeam.researchTeamDetails.${index}.firstName`,\r\n RTDLastName : (index: number) => `researchTeam.researchTeamDetails.${index}.lastName`,\r\n RTDOrcidId : (index: number) => `researchTeam.researchTeamDetails.${index}.orcidId`,\r\n RTDEmail : (index: number) => `researchTeam.researchTeamDetails.${index}.email`,\r\n RTDPosition : (index: number) => `researchTeam.researchTeamDetails.${index}.position`,\r\n RTDEmployerOrAffiliation : (index: number) => `researchTeam.researchTeamDetails.${index}.employerOrAffiliation`,\r\n RTDCountry : (index: number) => `researchTeam.researchTeamDetails.${index}.country` ,\r\n RTDEducationOrQualifications : (index: number) => `researchTeam.researchTeamDetails.${index}.educationOrQualifications`,\r\n RTDConflictsOfInterest : (index: number) => `researchTeam.researchTeamDetails.${index}.conflictsOfInterest`,\r\n RTDAdminApprovalStatus : (index: number) => `researchTeam.researchTeamDetails.${index}.adminApprovalStatus`,\r\n}\r\nexport const DTITab = {\r\n TabItem: (TabStatus: any) => `tabItem_${TabStatus}`,\r\n DataRequestTabs: (DRTab: any) => `${DRTab}_tab`,\r\n}\r\nexport const DTIDataRequest = {\r\n DataRequestTitle : 'dataRequestTitle_',\r\n DataRequestStatus : 'dataRequestStatus_',\r\n}\r\nexport const DTIDropdownMenu = {\r\n DropdownMenuItem : (DropdownItem: any) => `dropdown_menu_item_${DropdownItem}` ,\r\n}\r\nexport const DTIUserMenu = {\r\n MenuItem: (MenuName: any) => `menuitem_${MenuName}`,\r\n}\r\nexport const DTIStaticIds = {\r\n ResearchProposal : (Proposal: any) => `researchProposal.${Proposal}`,\r\n TestingCheckbox : 'Training/Testing_checkbox',\r\n AICheckbox: 'A.I.algorithm_checkbox',\r\n ResearchTeam: 'research_team',\r\n}\r\nexport const DTIRequestedStudiesFeature = {\r\n AddPlus: 'add_plus',\r\n}\r\nexport const DTIAddUnlistedStudyForm = {\r\n RequestStudies : (RS: any) => `Request_studies_${RS}`,\r\n}\r\nexport const DTIChatFeature = {\r\n Chat: (chat: any) => `chat_${chat}`,\r\n ChatMessage: (message: any) => `message-${message}`\r\n}\r\nexport const DTIOrgMemberRowRender = {\r\n OrgDetailsCancel: (cancel: any) => `orgDetails_cancel_${cancel}`,\r\n OrgDetailsActivate: (activate: any) => `orgDetails_activate_${activate}`,\r\n}\r\n","\r\nexport const DTIAMRCommonConst = {\r\n OkButton : 'OkButton',\r\n CancelButton : 'CancelButton',\r\n EditButton : 'EditButton',\r\n ApproveButton : 'ApproveButton',\r\n SoftRejectButton : 'SoftRejectButton',\r\n ArchiveButton : 'ArchiveButton',\r\n DraftButton : 'DraftButton',\r\n SaveButton : 'SaveButton',\r\n SubmitButton : 'SubmitButton',\r\n ResetButton : 'ResetButton',\r\n ExportCsvButton : 'ExportCsvButton',\r\n ModalClose : 'ModalClose',\r\n NavigationPanel : 'NavigationPanel',\r\n AddButton : 'AddButton',\r\n DeleteButton: 'DeleteButton',\r\n DownloadButton: 'DownloadButton',\r\n VerifyUpload: 'VerifyUpload',\r\n RequestStudyButton: 'RequestStudyButton',\r\n ViewDetailsButton: 'ViewDetailsButton',\r\n LoginButton: 'LoginButton',\r\n EnquiryFormButton: 'EnquiryFormButton',\r\n AddCitationButton: (CitationButton: any) => `${CitationButton}Button`\r\n}\r\nexport const DTIFormFields = {\r\n FormTitle: 'FormTitle',\r\n FormURL :'FormURL',\r\n FormPhase: 'FormPhase',\r\n FormCondition: 'FormCondition',\r\n FormIntervention: 'FormIntervention',\r\n FormSummary: 'FormSummary',\r\n FormAgeAbility: 'FormAgeAbility',\r\n FormSexEligibility: 'FormSexEligibility',\r\n FormHealthyVolunteer: 'FormHealthyVolunteer',\r\n FormEnrollment: 'FormEnrollment',\r\n FormLocation: 'FormLocation',\r\n FormLink: 'FormLink',\r\n FormStartDate: 'FormStartDate',\r\n FormCompletionDate: 'FormCompletionDate',\r\n FormTotalEnrollment: 'FormTotalEnrollment',\r\n FormStatus: 'FormStatus',\r\n FormStudyDoi: 'FromStudyDoi',\r\n FormAmrId: 'FromAmrId',\r\n FormSponsorId: 'FromSponsorId',\r\n FormStudyIpdDoi: 'FromStudyIpdDoi',\r\n FormOrgName: 'FromOrgName',\r\n FormVivliId: 'FromVivliId',\r\n FormSecondaryId: 'FromSecondaryId',\r\n FormLeadAgency: 'FromLeadAgency',\r\n FormAgencyClass: 'FromAgencyClass',\r\n FormAlternateDocumentUri: 'FromAlternateDocumentUri',\r\n FormExternalStudyUri: 'FromExternalStudyUri',\r\n FormDataAvailability: 'FromDataAvailability',\r\n FormDataAccessibility: 'FromDataAccessibility',\r\n FormAcronym: 'FromAcronym',\r\n UploadedByUserName: 'UploadedByUserName',\r\n Size: 'Size',\r\n Date: 'Date',\r\n FileName: 'FileName',\r\n DataCollectedFrom: 'DataCollectedFrom',\r\n LastUpdate: 'LastUpdate',\r\n NumberOfIsolates: 'NumberOfIsolates',\r\n PrimaryObjective: 'PrimaryObjective',\r\n AdditionalInformation: 'AdditionalInformation',\r\n Antimicrobials: 'Antimicrobials',\r\n Organisms: 'Organisms',\r\n Country: 'Country',\r\n SourceOfSample: 'SourceOfSample',\r\n TimingOfSample: 'TimingOfSample',\r\n ResistanceGroup: 'ResistanceGroup',\r\n PediatricsCheckBox: 'PediatricsCheckBox',\r\n GenotypeCheckBox: 'GenotypeCheckBox',\r\n DownloadCheckBox: 'DownLoadCheckBox',\r\n FormJournal: 'FormJournal',\r\n FormPages: 'FormPages',\r\n FormYear: 'FormYear',\r\n FormORCIDId: 'FormORCIDId',\r\n FormViews: 'FormViews',\r\n FormFileDownloads: 'FormFileDownloads',\r\n FormPackageDownloads: 'FormPackageDownloads',\r\n FormUsageData: 'FormUsageData',\r\n CollaboratorTitle: (title: any, index: number) => `${title}${index}`,\r\n FormLinkNct: (NctIndex: any) => `LinkNct${NctIndex}`,\r\n AuthorsName: (name: any) => `${name}Name`,\r\n FormLinkName: (LinkIndex: any) => `Link${LinkIndex}`,\r\n}\r\nexport const DTIAMRAgGrid = {\r\n AboutDataGrid: 'AboutDataGrid',\r\n StudyDesignGrid: 'StudyDesignGrid',\r\n CitationsGrid: 'CitationsGrid',\r\n}\r\nexport const DTIAMRDropDown ={\r\n DropdownMenu: (item: any) => `${item}DPValue`,\r\n}\r\nexport const DTIAMRTab = {\r\n Tab: (tab: any) => `${tab}Value`,\r\n}\r\nexport const DTIAMRSearchRowResult = {\r\n SearchRowResult: (index: any) => `SearchRowResult${index}`,\r\n}\r\n","import { IConfig } from '@vivli/shared/infrastructure/interface';\r\nimport { IAnonmyousApi } from '@vivli/core/infrastructure/interface';\r\nimport { AssignedAppTypeEnum } from '@vivli/shared/infrastructure/enum';\r\nimport {\r\n AmrTranslationsConstant,\r\n DefaultTranslationsConstant,\r\n} from '@vivli/shared/infrastructure/constants';\r\nimport { IStudy } from '@vivli/features/studies/infrastructure/interface';\r\nimport { RestApi } from '@vivli/core/infrastructure/rest';\r\nimport { Observable } from 'rxjs';\r\n\r\nconst getAssignedAppTypeTranslations = (\r\n assignedAppType: AssignedAppTypeEnum\r\n) => {\r\n if (assignedAppType === AssignedAppTypeEnum.Amr) {\r\n return AmrTranslationsConstant;\r\n }\r\n\r\n return DefaultTranslationsConstant;\r\n};\r\n\r\nexport class AnonmyousApiService extends RestApi implements IAnonmyousApi {\r\n getConfig = (): Observable => {\r\n return this.handleGet('/config', { bypassAuth: true });\r\n };\r\n\r\n getTranslations = (assignedAppType: AssignedAppTypeEnum): Observable => {\r\n const json = getAssignedAppTypeTranslations(assignedAppType);\r\n return new Observable((observer) => {\r\n observer.next(json);\r\n\r\n observer.complete();\r\n });\r\n };\r\n\r\n getStudyMetadata = (searchResultId: string): Observable => {\r\n return this.handleGet(`api/studies/${searchResultId}/metadata`, {\r\n bypassAuth: true,\r\n });\r\n };\r\n}\r\n","import {IApiWrapper} from \"@vivli/core/infrastructure/interface\";\r\nimport {AnonmyousApiService} from \"@vivli/core/infrastructure/service\";\r\nimport React from \"react\";\r\nimport {AnonymousApiServiceContext} from \"@vivli/core/infrastructure/context\";\r\n\r\nexport const AnonymousApiServiceContextWrapper = ({ children, options }: IApiWrapper) => {\r\n const provider = new AnonmyousApiService(options);\r\n\r\n return (\r\n provider && {children}\r\n )\r\n}\r\n","import {useEffect, useState} from \"react\";\r\nimport {IVivliConfiguration} from \"@vivli/shared/infrastructure/interface\";\r\nimport {useVivliConfigurationService} from \"@vivli/core/infrastructure/context\";\r\nimport {first} from \"rxjs/operators\";\r\n\r\nexport function useVivliConfig() {\r\n const [vivliConfig, setVivliConfig] = useState();\r\n\r\n const vivliConfigService = useVivliConfigurationService();\r\n\r\n useEffect(() => {\r\n const sub = vivliConfigService.getVivliConfig()\r\n .pipe(first(config => config !== null))\r\n .subscribe(setVivliConfig);\r\n\r\n return () => {\r\n sub.unsubscribe();\r\n }\r\n }, [])\r\n\r\n return vivliConfig;\r\n}\r\n","import { AssignedAppTypeEnum } from '@vivli/shared/infrastructure/enum';\r\nimport { StorageService } from '@vivli/shared/infrastructure/service';\r\n\r\nexport const getAssignedAppType = () => {\r\n return StorageService.getItem(\r\n 'assignedAppType',\r\n 'local'\r\n );\r\n};\r\n\r\nexport function useAssignedAppType(): AssignedAppTypeEnum {\r\n return getAssignedAppType();\r\n}\r\n","export function useAppEnvironment() {\r\n const domain = window.location.host.toLowerCase();\r\n\r\n // split the domain to grab the environment and type\r\n const envParts = domain.split('.');\r\n let activeEnv = envParts[0];\r\n const envType = envParts[envParts.length - 1];\r\n\r\n // assign a better name to the local url and prod url\r\n if (activeEnv === 'vivli') {\r\n activeEnv = 'local';\r\n } else if (activeEnv === 'search') {\r\n activeEnv = 'prod'\r\n }\r\n\r\n return {\r\n activeEnv,\r\n envType\r\n }\r\n}\r\n","import { AssignedAppTypeEnum } from '@vivli/shared/infrastructure/enum';\r\nimport { StorageService } from '@vivli/shared/infrastructure/service';\r\nimport { environment } from '@vivli/core/environments';\r\nimport { useMemo } from 'react';\r\n\r\n//hook that stores the AssignedAppType (amr or default). In deployed environments,\r\n//to access Amr mode in non-prod environments, browse to https://{domain}/mode/amr to run the app\r\n//in Prod, an Amr user will browse to a domain already containing \"amr\", as in\r\n//amr.search.vivli.org. This hook supports both usages, as well as an escape for\r\n//local dev amr testing that uses the environment file\r\n\r\nconst storeAppType = (assignedAppType: string) => {\r\n StorageService.setItem('assignedAppType', assignedAppType, 'local');\r\n};\r\n\r\nconst getAppType = () => {\r\n return StorageService.getItem('assignedAppType', 'local');\r\n};\r\n\r\nconst initLogic = () => {\r\n const loweredHost = window.location.host.toLowerCase();\r\n const isAutomation = environment.isAutomation;\r\n const isLocalUrl = loweredHost.includes('vivli.local');\r\n const isAmrUrl = loweredHost.includes(AssignedAppTypeEnum.Amr.toLowerCase());\r\n\r\n // escape for vivli.local and automation testing\r\n if (isLocalUrl || isAutomation) {\r\n const { assignedAppType } = environment;\r\n\r\n //store the assigned appType in local storage\r\n storeAppType(assignedAppType);\r\n\r\n return assignedAppType;\r\n }\r\n\r\n // parse host to see if it includes \"amr\" text\r\n const appTypeFromUrl = isAmrUrl ? AssignedAppTypeEnum.Amr : AssignedAppTypeEnum.Default;\r\n\r\n // return the currently stored type if it exists in local storage and matches the\r\n // type that matches the url\r\n const currentlyStoredAppType = getAppType();\r\n if (currentlyStoredAppType && currentlyStoredAppType === appTypeFromUrl) {\r\n return currentlyStoredAppType;\r\n }\r\n\r\n // determine what type we SHOULD be using and store it\r\n // initialize to default\r\n let assignedAppType = AssignedAppTypeEnum.Default;\r\n\r\n // use app type from url if different\r\n if (appTypeFromUrl !== assignedAppType) {\r\n assignedAppType = AssignedAppTypeEnum.Amr;\r\n }\r\n\r\n // store the assigned appType in local storage\r\n storeAppType(assignedAppType);\r\n\r\n // leaving for future testing - JM 2/16/23\r\n // const getItemTest = StorageService.getItem('assignedAppType', 'local');\r\n\r\n return assignedAppType;\r\n};\r\n\r\nexport function useAssignedAppTypeInitialization() {\r\n return useMemo(() => initLogic(), []);\r\n}\r\n","import {useEffect, useState} from \"react\";\r\nimport {IExternalMenuItem} from \"@vivli/shared/infrastructure/interface\";\r\nimport {useVivliConfigurationService} from \"@vivli/core/infrastructure/context\";\r\nimport {first} from \"rxjs/operators\";\r\n\r\nexport function useExternalMenuItemsHook() {\r\n const [externalMenuItems, setExternalMenuItems] = useState();\r\n\r\n const vivliConfigService = useVivliConfigurationService();\r\n\r\n useEffect(() => {\r\n const sub = vivliConfigService.getExternalMenuItems()\r\n .pipe(first())\r\n .subscribe(setExternalMenuItems);\r\n\r\n return () => {\r\n sub.unsubscribe();\r\n }\r\n }, [])\r\n\r\n return externalMenuItems;\r\n}\r\n","/**\n * @remix-run/router v1.6.3\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Actions represent the type of change to a location value.\n */\nvar Action;\n(function (Action) {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Action[\"Pop\"] = \"POP\";\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Action[\"Push\"] = \"PUSH\";\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\nconst PopStateEventType = \"popstate\";\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n let {\n initialEntries = [\"/\"],\n initialIndex,\n v5Compat = false\n } = options;\n let entries; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === \"string\" ? null : entry.state, index === 0 ? \"default\" : undefined));\n let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);\n let action = Action.Pop;\n let listener = null;\n function clampIndex(n) {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation() {\n return entries[index];\n }\n function createMemoryLocation(to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = createLocation(entries ? getCurrentLocation().pathname : \"/\", to, state, key);\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in memory history: \" + JSON.stringify(to));\n return location;\n }\n function createHref(to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n let history = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\"\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 1\n });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({\n action,\n location: nextLocation,\n delta: 0\n });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: nextLocation,\n delta\n });\n }\n },\n listen(fn) {\n listener = fn;\n return () => {\n listener = null;\n };\n }\n };\n return history;\n}\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createBrowserLocation(window, globalHistory) {\n let {\n pathname,\n search,\n hash\n } = window.location;\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createBrowserHref(window, to) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n return getUrlBasedHistory(createBrowserLocation, createBrowserHref, null, options);\n}\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n function createHashLocation(window, globalHistory) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = parsePath(window.location.hash.substr(1));\n return createLocation(\"\", {\n pathname,\n search,\n hash\n },\n // state defaults to `null` because `window.history.state` does\n globalHistory.state && globalHistory.state.usr || null, globalHistory.state && globalHistory.state.key || \"default\");\n }\n function createHashHref(window, to) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n function validateHashLocation(location, to) {\n warning(location.pathname.charAt(0) === \"/\", \"relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\");\n }\n return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);\n}\nfunction invariant(value, message) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location, index) {\n return {\n usr: location.state,\n key: location.key,\n idx: index\n };\n}\n/**\n * Creates a Location object with a unique key from the given Path\n */\nfunction createLocation(current, to, state, key) {\n if (state === void 0) {\n state = null;\n }\n let location = _extends({\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\"\n }, typeof to === \"string\" ? parsePath(to) : to, {\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: to && to.key || key || createKey()\n });\n return location;\n}\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nfunction createPath(_ref) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\"\n } = _ref;\n if (search && search !== \"?\") pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\") pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nfunction parsePath(path) {\n let parsedPath = {};\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n if (path) {\n parsedPath.pathname = path;\n }\n }\n return parsedPath;\n}\nfunction getUrlBasedHistory(getLocation, createHref, validateLocation, options) {\n if (options === void 0) {\n options = {};\n }\n let {\n window = document.defaultView,\n v5Compat = false\n } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener = null;\n let index = getIndex();\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), \"\");\n }\n function getIndex() {\n let state = globalHistory.state || {\n idx: null\n };\n return state.idx;\n }\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({\n action,\n location: history.location,\n delta\n });\n }\n }\n function push(to, state) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 1\n });\n }\n }\n function replace(to, state) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n if (v5Compat && listener) {\n listener({\n action,\n location: history.location,\n delta: 0\n });\n }\n }\n function createURL(to) {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base = window.location.origin !== \"null\" ? window.location.origin : window.location.href;\n let href = typeof to === \"string\" ? to : createPath(to);\n invariant(base, \"No window.location.(origin|href) available to create URL for href: \" + href);\n return new URL(href, base);\n }\n let history = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n }\n };\n return history;\n}\n//#endregion\n\nvar ResultType;\n(function (ResultType) {\n ResultType[\"data\"] = \"data\";\n ResultType[\"deferred\"] = \"deferred\";\n ResultType[\"redirect\"] = \"redirect\";\n ResultType[\"error\"] = \"error\";\n})(ResultType || (ResultType = {}));\nconst immutableRouteKeys = new Set([\"lazy\", \"caseSensitive\", \"path\", \"id\", \"index\", \"children\"]);\nfunction isIndexRoute(route) {\n return route.index === true;\n}\n// Walk the route tree generating unique IDs where necessary so we are working\n// solely with AgnosticDataRouteObject's within the Router\nfunction convertRoutesToDataRoutes(routes, mapRouteProperties, parentPath, manifest) {\n if (parentPath === void 0) {\n parentPath = [];\n }\n if (manifest === void 0) {\n manifest = {};\n }\n return routes.map((route, index) => {\n let treePath = [...parentPath, index];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(route.index !== true || !route.children, \"Cannot specify children on an index route\");\n invariant(!manifest[id], \"Found a route id collision on id \\\"\" + id + \"\\\". Route \" + \"id's must be globally unique within Data Router usages\");\n if (isIndexRoute(route)) {\n let indexRoute = _extends({}, route, mapRouteProperties(route), {\n id\n });\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute = _extends({}, route, mapRouteProperties(route), {\n id,\n children: undefined\n });\n manifest[id] = pathOrLayoutRoute;\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(route.children, mapRouteProperties, treePath, manifest);\n }\n return pathOrLayoutRoute;\n }\n });\n}\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/utils/match-routes\n */\nfunction matchRoutes(routes, locationArg, basename) {\n if (basename === void 0) {\n basename = \"/\";\n }\n let location = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n let pathname = stripBasename(location.pathname || \"/\", basename);\n if (pathname == null) {\n return null;\n }\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n matches = matchRouteBranch(branches[i],\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n safelyDecodeURI(pathname));\n }\n return matches;\n}\nfunction flattenRoutes(routes, branches, parentsMeta, parentPath) {\n if (branches === void 0) {\n branches = [];\n }\n if (parentsMeta === void 0) {\n parentsMeta = [];\n }\n if (parentPath === void 0) {\n parentPath = \"\";\n }\n let flattenRoute = (route, index, relativePath) => {\n let meta = {\n relativePath: relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route\n };\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(meta.relativePath.startsWith(parentPath), \"Absolute route path \\\"\" + meta.relativePath + \"\\\" nested under path \" + (\"\\\"\" + parentPath + \"\\\" is not valid. An absolute child route path \") + \"must start with the combined path of all its parent routes.\");\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n // Add the children before adding this route to the array so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true, \"Index routes must not have child routes. Please remove \" + (\"all child routes from route path \\\"\" + path + \"\\\".\"));\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta\n });\n };\n routes.forEach((route, index) => {\n var _route$path;\n // coarse-grain check for optional params\n if (route.path === \"\" || !((_route$path = route.path) != null && _route$path.includes(\"?\"))) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n return branches;\n}\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path) {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n let [first, ...rest] = segments;\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n let result = [];\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explodes _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(...restExploded.map(subpath => subpath === \"\" ? required : [required, subpath].join(\"/\")));\n // Then if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n // for absolute paths, ensure `/` instead of empty segment\n return result.map(exploded => path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded);\n}\nfunction rankRouteBranches(branches) {\n branches.sort((a, b) => a.score !== b.score ? b.score - a.score // Higher score first\n : compareIndexes(a.routesMeta.map(meta => meta.childrenIndex), b.routesMeta.map(meta => meta.childrenIndex)));\n}\nconst paramRe = /^:\\w+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = s => s === \"*\";\nfunction computeScore(path, index) {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n if (index) {\n initialScore += indexRouteValue;\n }\n return segments.filter(s => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === \"\" ? emptySegmentValue : staticSegmentValue), initialScore);\n}\nfunction compareIndexes(a, b) {\n let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n return siblings ?\n // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1] :\n // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\nfunction matchRouteBranch(branch, pathname) {\n let {\n routesMeta\n } = branch;\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname = matchedPathname === \"/\" ? pathname : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath({\n path: meta.relativePath,\n caseSensitive: meta.caseSensitive,\n end\n }, remainingPathname);\n if (!match) return null;\n Object.assign(matchedParams, match.params);\n let route = meta.route;\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),\n route\n });\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n return matches;\n}\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/utils/generate-path\n */\nfunction generatePath(originalPath, params) {\n if (params === void 0) {\n params = {};\n }\n let path = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(false, \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n path = path.replace(/\\*$/, \"/*\");\n }\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n const segments = path.split(/\\/+/).map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\";\n const starParam = params[star];\n // Apply the splat\n return starParam;\n }\n const keyMatch = segment.match(/^:(\\w+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key];\n if (optional === \"?\") {\n return param == null ? \"\" : param;\n }\n if (param == null) {\n invariant(false, \"Missing \\\":\" + key + \"\\\" param\");\n }\n return param;\n }\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter(segment => !!segment);\n return prefix + segments.join(\"/\");\n}\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/utils/match-path\n */\nfunction matchPath(pattern, pathname) {\n if (typeof pattern === \"string\") {\n pattern = {\n path: pattern,\n caseSensitive: false,\n end: true\n };\n }\n let [matcher, paramNames] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);\n let match = pathname.match(matcher);\n if (!match) return null;\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params = paramNames.reduce((memo, paramName, index) => {\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\\/+$/, \"$1\");\n }\n memo[paramName] = safelyDecodeURIComponent(captureGroups[index] || \"\", paramName);\n return memo;\n }, {});\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern\n };\n}\nfunction compilePath(path, caseSensitive, end) {\n if (caseSensitive === void 0) {\n caseSensitive = false;\n }\n if (end === void 0) {\n end = true;\n }\n warning(path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"), \"Route path \\\"\" + path + \"\\\" will be treated as if it were \" + (\"\\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\" because the `*` character must \") + \"always follow a `/` in the pattern. To get rid of this warning, \" + (\"please change the route path to \\\"\" + path.replace(/\\*$/, \"/*\") + \"\\\".\"));\n let paramNames = [];\n let regexpSource = \"^\" + path.replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^$?{}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:(\\w+)/g, (_, paramName) => {\n paramNames.push(paramName);\n return \"/([^\\\\/]+)\";\n });\n if (path.endsWith(\"*\")) {\n paramNames.push(\"*\");\n regexpSource += path === \"*\" || path === \"/*\" ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else ;\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n return [matcher, paramNames];\n}\nfunction safelyDecodeURI(value) {\n try {\n return decodeURI(value);\n } catch (error) {\n warning(false, \"The URL path \\\"\" + value + \"\\\" could not be decoded because it is is a \" + \"malformed URL segment. This is probably due to a bad percent \" + (\"encoding (\" + error + \").\"));\n return value;\n }\n}\nfunction safelyDecodeURIComponent(value, paramName) {\n try {\n return decodeURIComponent(value);\n } catch (error) {\n warning(false, \"The value for the URL param \\\"\" + paramName + \"\\\" will not be decoded because\" + (\" the string \\\"\" + value + \"\\\" is a malformed URL segment. This is probably\") + (\" due to a bad percent encoding (\" + error + \").\"));\n return value;\n }\n}\n/**\n * @private\n */\nfunction stripBasename(pathname, basename) {\n if (basename === \"/\") return pathname;\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\") ? basename.length - 1 : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n return pathname.slice(startIndex) || \"/\";\n}\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/utils/resolve-path\n */\nfunction resolvePath(to, fromPathname) {\n if (fromPathname === void 0) {\n fromPathname = \"/\";\n }\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\"\n } = typeof to === \"string\" ? parsePath(to) : to;\n let pathname = toPathname ? toPathname.startsWith(\"/\") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash)\n };\n}\nfunction resolvePathname(relativePath, fromPathname) {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n relativeSegments.forEach(segment => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\nfunction getInvalidPathError(char, field, dest, path) {\n return \"Cannot include a '\" + char + \"' character in a manually specified \" + (\"`to.\" + field + \"` field [\" + JSON.stringify(path) + \"]. Please separate it out to the \") + (\"`to.\" + dest + \"` field. Alternatively you may provide the full path as \") + \"a string in and the router will parse it for you.\";\n}\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \n */\nfunction getPathContributingMatches(matches) {\n return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);\n}\n/**\n * @private\n */\nfunction resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {\n if (isPathRelative === void 0) {\n isPathRelative = false;\n }\n let to;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = _extends({}, toArg);\n invariant(!to.pathname || !to.pathname.includes(\"?\"), getInvalidPathError(\"?\", \"pathname\", \"search\", to));\n invariant(!to.pathname || !to.pathname.includes(\"#\"), getInvalidPathError(\"#\", \"pathname\", \"hash\", to));\n invariant(!to.search || !to.search.includes(\"#\"), getInvalidPathError(\"#\", \"search\", \"hash\", to));\n }\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n let from;\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (isPathRelative || toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n if (toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n // Each leading .. segment means \"go up one route\" instead of \"go up one\n // URL segment\". This is a key difference from how works and a\n // major reason we call this a \"to\" value instead of a \"href\".\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n to.pathname = toSegments.join(\"/\");\n }\n // If there are more \"..\" segments than parent routes, resolve relative to\n // the root / URL.\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n let path = resolvePath(to, from);\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash = toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash = (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (!path.pathname.endsWith(\"/\") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {\n path.pathname += \"/\";\n }\n return path;\n}\n/**\n * @private\n */\nfunction getToPathname(to) {\n // Empty strings should be treated the same as / paths\n return to === \"\" || to.pathname === \"\" ? \"/\" : typeof to === \"string\" ? parsePath(to).pathname : to.pathname;\n}\n/**\n * @private\n */\nconst joinPaths = paths => paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n/**\n * @private\n */\nconst normalizePathname = pathname => pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n/**\n * @private\n */\nconst normalizeSearch = search => !search || search === \"?\" ? \"\" : search.startsWith(\"?\") ? search : \"?\" + search;\n/**\n * @private\n */\nconst normalizeHash = hash => !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n */\nconst json = function json(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n return new Response(JSON.stringify(data), _extends({}, responseInit, {\n headers\n }));\n};\nclass AbortedDeferredError extends Error {}\nclass DeferredData {\n constructor(data, responseInit) {\n this.pendingKeysSet = new Set();\n this.subscribers = new Set();\n this.deferredKeys = [];\n invariant(data && typeof data === \"object\" && !Array.isArray(data), \"defer() only accepts plain objects\");\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject;\n this.abortPromise = new Promise((_, r) => reject = r);\n this.controller = new AbortController();\n let onAbort = () => reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () => this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n this.data = Object.entries(data).reduce((acc, _ref) => {\n let [key, value] = _ref;\n return Object.assign(acc, {\n [key]: this.trackPromise(key, value)\n });\n }, {});\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n this.init = responseInit;\n }\n trackPromise(key, value) {\n if (!(value instanceof Promise)) {\n return value;\n }\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise = Promise.race([value, this.abortPromise]).then(data => this.onSettle(promise, key, null, data), error => this.onSettle(promise, key, error));\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n Object.defineProperty(promise, \"_tracked\", {\n get: () => true\n });\n return promise;\n }\n onSettle(promise, key, error, data) {\n if (this.controller.signal.aborted && error instanceof AbortedDeferredError) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n return Promise.reject(error);\n }\n this.pendingKeysSet.delete(key);\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n if (error) {\n Object.defineProperty(promise, \"_error\", {\n get: () => error\n });\n this.emit(false, key);\n return Promise.reject(error);\n }\n Object.defineProperty(promise, \"_data\", {\n get: () => data\n });\n this.emit(false, key);\n return data;\n }\n emit(aborted, settledKey) {\n this.subscribers.forEach(subscriber => subscriber(aborted, settledKey));\n }\n subscribe(fn) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n async resolveData(signal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise(resolve => {\n this.subscribe(aborted => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n get unwrappedData() {\n invariant(this.data !== null && this.done, \"Can only unwrap data on initialized and settled deferreds\");\n return Object.entries(this.data).reduce((acc, _ref2) => {\n let [key, value] = _ref2;\n return Object.assign(acc, {\n [key]: unwrapTrackedPromise(value)\n });\n }, {});\n }\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\nfunction isTrackedPromise(value) {\n return value instanceof Promise && value._tracked === true;\n}\nfunction unwrapTrackedPromise(value) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\nconst defer = function defer(data, init) {\n if (init === void 0) {\n init = {};\n }\n let responseInit = typeof init === \"number\" ? {\n status: init\n } : init;\n return new DeferredData(data, responseInit);\n};\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nconst redirect = function redirect(url, init) {\n if (init === void 0) {\n init = 302;\n }\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = {\n status: responseInit\n };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n return new Response(null, _extends({}, responseInit, {\n headers\n }));\n};\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n */\nclass ErrorResponse {\n constructor(status, statusText, data, internal) {\n if (internal === void 0) {\n internal = false;\n }\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nfunction isRouteErrorResponse(error) {\n return error != null && typeof error.status === \"number\" && typeof error.statusText === \"string\" && typeof error.internal === \"boolean\" && \"data\" in error;\n}\n\nconst validMutationMethodsArr = [\"post\", \"put\", \"patch\", \"delete\"];\nconst validMutationMethods = new Set(validMutationMethodsArr);\nconst validRequestMethodsArr = [\"get\", ...validMutationMethodsArr];\nconst validRequestMethods = new Set(validRequestMethodsArr);\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\nconst IDLE_NAVIGATION = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined\n};\nconst IDLE_FETCHER = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined\n};\nconst IDLE_BLOCKER = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined\n};\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\nconst defaultMapRouteProperties = route => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary)\n});\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Create a router and listen to history POP navigations\n */\nfunction createRouter(init) {\n const routerWindow = init.window ? init.window : typeof window !== \"undefined\" ? window : undefined;\n const isBrowser = typeof routerWindow !== \"undefined\" && typeof routerWindow.document !== \"undefined\" && typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n invariant(init.routes.length > 0, \"You must provide a non-empty routes array to createRouter\");\n let mapRouteProperties;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n // Routes keyed by ID\n let manifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(init.routes, mapRouteProperties, undefined, manifest);\n let inFlightDataRoutes;\n let basename = init.basename || \"/\";\n // Config driven behavior flags\n let future = _extends({\n v7_normalizeFormMethod: false,\n v7_prependBasename: false\n }, init.future);\n // Cleanup function for history\n let unlistenHistory = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialErrors = null;\n if (initialMatches == null) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname\n });\n let {\n matches,\n route\n } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = {\n [route.id]: error\n };\n }\n let initialized =\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n !initialMatches.some(m => m.route.lazy) && (\n // And we have to either have no loaders or have been provided hydrationData\n !initialMatches.some(m => m.route.loader) || init.hydrationData != null);\n let router;\n let state = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: init.hydrationData && init.hydrationData.loaderData || {},\n actionData: init.hydrationData && init.hydrationData.actionData || null,\n errors: init.hydrationData && init.hydrationData.errors || initialErrors,\n fetchers: new Map(),\n blockers: new Map()\n };\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction = Action.Pop;\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n // AbortController for the active navigation\n let pendingNavigationController;\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes = [];\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads = [];\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let ignoreNextHistoryUpdate = false;\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(_ref => {\n let {\n action: historyAction,\n location,\n delta\n } = _ref;\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (ignoreNextHistoryUpdate) {\n ignoreNextHistoryUpdate = false;\n return;\n }\n warning(blockerFunctions.size === 0 || delta != null, \"You are trying to use a blocker on a POP navigation to a location \" + \"that was not created by @remix-run/router. This will fail silently in \" + \"production. This can happen if you are navigating outside the router \" + \"via `window.history.pushState`/`window.location.hash` instead of using \" + \"router navigation APIs. This can also happen if you are using \" + \"createHashRouter and the user manually changes the URL.\");\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction\n });\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n ignoreNextHistoryUpdate = true;\n init.history.go(delta * -1);\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location\n });\n // Re-do the same POP navigation we just blocked\n init.history.go(delta);\n },\n reset() {\n deleteBlocker(blockerKey);\n updateState({\n blockers: new Map(router.state.blockers)\n });\n }\n });\n return;\n }\n return startNavigation(historyAction, location);\n });\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(Action.Pop, state.location);\n }\n return router;\n }\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n // Subscribe to state updates for the router\n function subscribe(fn) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n // Update our state and notify the calling context of the change\n function updateState(newState) {\n state = _extends({}, state, newState);\n subscribers.forEach(subscriber => subscriber(state));\n }\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(location, newState) {\n var _location$state, _location$state2;\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload = state.actionData != null && state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && state.navigation.state === \"loading\" && ((_location$state = location.state) == null ? void 0 : _location$state._isRedirect) !== true;\n let actionData;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData ? mergeLoaderData(state.loaderData, newState.loaderData, newState.matches || [], newState.errors) : state.loaderData;\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n for (let [key] of blockerFunctions) {\n deleteBlocker(key);\n }\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && ((_location$state2 = location.state) == null ? void 0 : _location$state2._isRedirect) !== true;\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n updateState(_extends({}, newState, {\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(location, newState.matches || state.matches),\n preventScrollReset,\n blockers: new Map(state.blockers)\n }));\n if (isUninterruptedRevalidation) ; else if (pendingAction === Action.Pop) ; else if (pendingAction === Action.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === Action.Replace) {\n init.history.replace(location, location.state);\n }\n // Reset stateful navigation vars\n pendingAction = Action.Pop;\n pendingPreventScrollReset = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n cancelledFetcherLoads = [];\n }\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(to, opts) {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, to, opts == null ? void 0 : opts.fromRouteId, opts == null ? void 0 : opts.relative);\n let {\n path,\n submission,\n error\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, false, normalizedPath, opts);\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = _extends({}, nextLocation, init.history.encodeLocation(nextLocation));\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n let historyAction = Action.Push;\n if (userReplace === true) {\n historyAction = Action.Replace;\n } else if (userReplace === false) ; else if (submission != null && isMutationMethod(submission.formMethod) && submission.formAction === state.location.pathname + state.location.search) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = Action.Replace;\n }\n let preventScrollReset = opts && \"preventScrollReset\" in opts ? opts.preventScrollReset === true : undefined;\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction\n });\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n deleteBlocker(blockerKey);\n updateState({\n blockers: new Map(state.blockers)\n });\n }\n });\n return;\n }\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace\n });\n }\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({\n revalidation: \"loading\"\n });\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true\n });\n return;\n }\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(pendingAction || state.historyAction, state.navigation.location, {\n overrideNavigation: state.navigation\n });\n }\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(historyAction, location, opts) {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation = (opts && opts.startUninterruptedRevalidation) === true;\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = matchRoutes(routesToUse, location, basename);\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error\n }\n });\n return;\n }\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial load will always\n // be \"same hash\". For example, on /page#hash and submit a
\n // which will default to a navigation to /page\n if (state.initialized && !isRevalidationRequired && isHashChangeOnly(state.location, location) && !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))) {\n completeNavigation(location, {\n matches\n });\n return;\n }\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(init.history, location, pendingNavigationController.signal, opts && opts.submission);\n let pendingActionData;\n let pendingError;\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingError = {\n [findNearestBoundary(matches).route.id]: opts.pendingError\n };\n } else if (opts && opts.submission && isMutationMethod(opts.submission.formMethod)) {\n // Call action if we received an action submission\n let actionOutput = await handleAction(request, location, opts.submission, matches, {\n replace: opts.replace\n });\n if (actionOutput.shortCircuited) {\n return;\n }\n pendingActionData = actionOutput.pendingActionData;\n pendingError = actionOutput.pendingActionError;\n let navigation = _extends({\n state: \"loading\",\n location\n }, opts.submission);\n loadingNavigation = navigation;\n // Create a GET request for the loaders\n request = new Request(request.url, {\n signal: request.signal\n });\n }\n // Call loaders\n let {\n shortCircuited,\n loaderData,\n errors\n } = await handleLoaders(request, location, matches, loadingNavigation, opts && opts.submission, opts && opts.fetcherSubmission, opts && opts.replace, pendingActionData, pendingError);\n if (shortCircuited) {\n return;\n }\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n completeNavigation(location, _extends({\n matches\n }, pendingActionData ? {\n actionData: pendingActionData\n } : {}, {\n loaderData,\n errors\n }));\n }\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(request, location, submission, matches, opts) {\n interruptActiveLoads();\n // Put us in a submitting state\n let navigation = _extends({\n state: \"submitting\",\n location\n }, submission);\n updateState({\n navigation\n });\n // Call our action and get the result\n let result;\n let actionMatch = getTargetMatch(matches, location);\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id\n })\n };\n } else {\n result = await callLoaderOrAction(\"action\", request, actionMatch, matches, manifest, mapRouteProperties, basename);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n }\n if (isRedirectResult(result)) {\n let replace;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n replace = result.location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(state, result, {\n submission,\n replace\n });\n return {\n shortCircuited: true\n };\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n // By default, all submissions are REPLACE navigations, but if the\n // action threw an error that'll be rendered in an errorElement, we fall\n // back to PUSH so that the user can use the back button to get back to\n // the pre-submission form location to try again\n if ((opts && opts.replace) !== true) {\n pendingAction = Action.Push;\n }\n return {\n // Send back an empty object we can use to clear out any prior actionData\n pendingActionData: {},\n pendingActionError: {\n [boundaryMatch.route.id]: result.error\n }\n };\n }\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n return {\n pendingActionData: {\n [actionMatch.route.id]: result.data\n }\n };\n }\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(request, location, matches, overrideNavigation, submission, fetcherSubmission, replace, pendingActionData, pendingError) {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation = overrideNavigation;\n if (!loadingNavigation) {\n let navigation = _extends({\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined\n }, submission);\n loadingNavigation = navigation;\n }\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission = submission || fetcherSubmission ? submission || fetcherSubmission : loadingNavigation.formMethod && loadingNavigation.formAction && loadingNavigation.formData && loadingNavigation.formEncType ? {\n formMethod: loadingNavigation.formMethod,\n formAction: loadingNavigation.formAction,\n formData: loadingNavigation.formData,\n formEncType: loadingNavigation.formEncType\n } : undefined;\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, activeSubmission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, routesToUse, basename, pendingActionData, pendingError);\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(routeId => !(matches && matches.some(m => m.route.id === routeId)) || matchesToLoad && matchesToLoad.some(m => m.route.id === routeId));\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, _extends({\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingError || null\n }, pendingActionData ? {\n actionData: pendingActionData\n } : {}, updatedFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {}));\n return {\n shortCircuited: true\n };\n }\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n if (!isUninterruptedRevalidation) {\n revalidatingFetchers.forEach(rf => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = {\n state: \"loading\",\n data: fetcher && fetcher.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n let actionData = pendingActionData || state.actionData;\n updateState(_extends({\n navigation: loadingNavigation\n }, actionData ? Object.keys(actionData).length === 0 ? {\n actionData: null\n } : {\n actionData\n } : {}, revalidatingFetchers.length > 0 ? {\n fetchers: new Map(state.fetchers)\n } : {}));\n }\n pendingNavigationLoadId = ++incrementingLoadId;\n revalidatingFetchers.forEach(rf => {\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(f => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n let {\n results,\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, request);\n if (request.signal.aborted) {\n return {\n shortCircuited: true\n };\n }\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n }\n revalidatingFetchers.forEach(rf => fetchControllers.delete(rf.key));\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect(results);\n if (redirect) {\n await startRedirectNavigation(state, redirect, {\n replace\n });\n return {\n shortCircuited: true\n };\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, matches, matchesToLoad, loaderResults, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe(aborted => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n return _extends({\n loaderData,\n errors\n }, shouldUpdateFetchers ? {\n fetchers: new Map(state.fetchers)\n } : {});\n }\n function getFetcher(key) {\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(key, routeId, href, opts) {\n if (isServer) {\n throw new Error(\"router.fetch() was called during the server render, but it shouldn't be. \" + \"You are likely calling a useFetcher() method in the body of your component. \" + \"Try moving it to a useEffect or a callback.\");\n }\n if (fetchControllers.has(key)) abortFetcher(key);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(state.location, state.matches, basename, future.v7_prependBasename, href, routeId, opts == null ? void 0 : opts.relative);\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n if (!matches) {\n setFetcherError(key, routeId, getInternalRouterError(404, {\n pathname: normalizedPath\n }));\n return;\n }\n let {\n path,\n submission\n } = normalizeNavigateOptions(future.v7_normalizeFormMethod, true, normalizedPath, opts);\n let match = getTargetMatch(matches, path);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, submission);\n return;\n }\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, {\n routeId,\n path\n });\n handleFetcherLoader(key, routeId, path, match, matches, submission);\n }\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(key, routeId, path, match, requestMatches, submission) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n if (!match.route.action && !match.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId\n });\n setFetcherError(key, routeId, error);\n return;\n }\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n let fetcher = _extends({\n state: \"submitting\"\n }, submission, {\n data: existingFetcher && existingFetcher.data,\n \" _hasFetcherDoneAnything \": true\n });\n state.fetchers.set(key, fetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n // Call the action for the fetcher\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal, submission);\n fetchControllers.set(key, abortController);\n let actionResult = await callLoaderOrAction(\"action\", fetchRequest, match, requestMatches, manifest, mapRouteProperties, basename);\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by ou our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n fetchRedirectIds.add(key);\n let loadingFetcher = _extends({\n state: \"loading\"\n }, submission, {\n data: undefined,\n \" _hasFetcherDoneAnything \": true\n });\n state.fetchers.set(key, loadingFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n return startRedirectNavigation(state, actionResult, {\n submission,\n isFetchActionRedirect: true\n });\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, {\n type: \"defer-action\"\n });\n }\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(init.history, nextLocation, abortController.signal);\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches = state.navigation.state !== \"idle\" ? matchRoutes(routesToUse, state.navigation.location, basename) : state.matches;\n invariant(matches, \"Didn't find any matches after fetcher action\");\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n let loadFetcher = _extends({\n state: \"loading\",\n data: actionResult.data\n }, submission, {\n \" _hasFetcherDoneAnything \": true\n });\n state.fetchers.set(key, loadFetcher);\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(init.history, state, matches, submission, nextLocation, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, routesToUse, basename, {\n [match.route.id]: actionResult.data\n }, undefined // No need to send through errors since we short circuit above\n );\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers.filter(rf => rf.key !== key).forEach(rf => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = {\n state: \"loading\",\n data: existingFetcher && existingFetcher.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(staleKey, revalidatingFetcher);\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n updateState({\n fetchers: new Map(state.fetchers)\n });\n let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach(rf => abortFetcher(rf.key));\n abortController.signal.addEventListener(\"abort\", abortPendingFetchRevalidations);\n let {\n results,\n loaderResults,\n fetcherResults\n } = await callLoadersAndMaybeResolveData(state.matches, matches, matchesToLoad, revalidatingFetchers, revalidationRequest);\n if (abortController.signal.aborted) {\n return;\n }\n abortController.signal.removeEventListener(\"abort\", abortPendingFetchRevalidations);\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach(r => fetchControllers.delete(r.key));\n let redirect = findRedirect(results);\n if (redirect) {\n return startRedirectNavigation(state, redirect);\n }\n // Process and commit output from loaders\n let {\n loaderData,\n errors\n } = processLoaderData(state, state.matches, matchesToLoad, loaderResults, undefined, revalidatingFetchers, fetcherResults, activeDeferreds);\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = {\n state: \"idle\",\n data: actionResult.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(key, doneFetcher);\n }\n let didAbortFetchLoads = abortStaleFetchLoads(loadId);\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (state.navigation.state === \"loading\" && loadId > pendingNavigationLoadId) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers)\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState(_extends({\n errors,\n loaderData: mergeLoaderData(state.loaderData, loaderData, matches, errors)\n }, didAbortFetchLoads || revalidatingFetchers.length > 0 ? {\n fetchers: new Map(state.fetchers)\n } : {}));\n isRevalidationRequired = false;\n }\n }\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(key, routeId, path, match, matches, submission) {\n let existingFetcher = state.fetchers.get(key);\n // Put this fetcher into it's loading state\n let loadingFetcher = _extends({\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined\n }, submission, {\n data: existingFetcher && existingFetcher.data,\n \" _hasFetcherDoneAnything \": true\n });\n state.fetchers.set(key, loadingFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n // Call the loader for this fetcher route match\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(init.history, path, abortController.signal);\n fetchControllers.set(key, abortController);\n let result = await callLoaderOrAction(\"loader\", fetchRequest, match, matches, manifest, mapRouteProperties, basename);\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result = (await resolveDeferredData(result, fetchRequest.signal, true)) || result;\n }\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n if (fetchRequest.signal.aborted) {\n return;\n }\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(state, result);\n return;\n }\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n state.fetchers.delete(key);\n // TODO: In remix, this would reset to IDLE_NAVIGATION if it was a catch -\n // do we need to behave any differently with our non-redirect errors?\n // What if it was a non-redirect Response?\n updateState({\n fetchers: new Map(state.fetchers),\n errors: {\n [boundaryMatch.route.id]: result.error\n }\n });\n return;\n }\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n // Put the fetcher back into an idle state\n let doneFetcher = {\n state: \"idle\",\n data: result.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(key, doneFetcher);\n updateState({\n fetchers: new Map(state.fetchers)\n });\n }\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(state, redirect, _temp) {\n let {\n submission,\n replace,\n isFetchActionRedirect\n } = _temp === void 0 ? {} : _temp;\n if (redirect.revalidate) {\n isRevalidationRequired = true;\n }\n let redirectLocation = createLocation(state.location, redirect.location, // TODO: This can be removed once we get rid of useTransition in Remix v2\n _extends({\n _isRedirect: true\n }, isFetchActionRedirect ? {\n _isFetchActionRedirect: true\n } : {}));\n invariant(redirectLocation, \"Expected a location on the redirect navigation\");\n // Check if this an absolute external redirect that goes to a new origin\n if (ABSOLUTE_URL_REGEX.test(redirect.location) && isBrowser) {\n let url = init.history.createURL(redirect.location);\n let isDifferentBasename = stripBasename(url.pathname, basename) == null;\n if (routerWindow.location.origin !== url.origin || isDifferentBasename) {\n if (replace) {\n routerWindow.location.replace(redirect.location);\n } else {\n routerWindow.location.assign(redirect.location);\n }\n return;\n }\n }\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n let redirectHistoryAction = replace === true ? Action.Replace : Action.Push;\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let {\n formMethod,\n formAction,\n formEncType,\n formData\n } = state.navigation;\n if (!submission && formMethod && formAction && formData && formEncType) {\n submission = {\n formMethod,\n formAction,\n formEncType,\n formData\n };\n }\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n if (redirectPreserveMethodStatusCodes.has(redirect.status) && submission && isMutationMethod(submission.formMethod)) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: _extends({}, submission, {\n formAction: redirect.location\n }),\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n } else if (isFetchActionRedirect) {\n // For a fetch action redirect, we kick off a new loading navigation\n // without the fetcher submission, but we send it along for shouldRevalidate\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation: {\n state: \"loading\",\n location: redirectLocation,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined\n },\n fetcherSubmission: submission,\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n } else {\n // Otherwise, we kick off a new loading navigation, preserving the\n // submission info for the duration of this navigation\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation: {\n state: \"loading\",\n location: redirectLocation,\n formMethod: submission ? submission.formMethod : undefined,\n formAction: submission ? submission.formAction : undefined,\n formEncType: submission ? submission.formEncType : undefined,\n formData: submission ? submission.formData : undefined\n },\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset\n });\n }\n }\n async function callLoadersAndMaybeResolveData(currentMatches, matches, matchesToLoad, fetchersToLoad, request) {\n // Call all navigation loaders and revalidating fetcher loaders in parallel,\n // then slice off the results into separate arrays so we can handle them\n // accordingly\n let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction(\"loader\", request, match, matches, manifest, mapRouteProperties, basename)), ...fetchersToLoad.map(f => {\n if (f.matches && f.match && f.controller) {\n return callLoaderOrAction(\"loader\", createClientSideRequest(init.history, f.path, f.controller.signal), f.match, f.matches, manifest, mapRouteProperties, basename);\n } else {\n let error = {\n type: ResultType.error,\n error: getInternalRouterError(404, {\n pathname: f.path\n })\n };\n return error;\n }\n })]);\n let loaderResults = results.slice(0, matchesToLoad.length);\n let fetcherResults = results.slice(matchesToLoad.length);\n await Promise.all([resolveDeferredResults(currentMatches, matchesToLoad, loaderResults, loaderResults.map(() => request.signal), false, state.loaderData), resolveDeferredResults(currentMatches, fetchersToLoad.map(f => f.match), fetcherResults, fetchersToLoad.map(f => f.controller ? f.controller.signal : null), true)]);\n return {\n results,\n loaderResults,\n fetcherResults\n };\n }\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.push(key);\n abortFetcher(key);\n }\n });\n }\n function setFetcherError(key, routeId, error) {\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error\n },\n fetchers: new Map(state.fetchers)\n });\n }\n function deleteFetcher(key) {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (fetchControllers.has(key) && !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n state.fetchers.delete(key);\n }\n function abortFetcher(key) {\n let controller = fetchControllers.get(key);\n invariant(controller, \"Expected fetch controller: \" + key);\n controller.abort();\n fetchControllers.delete(key);\n }\n function markFetchersDone(keys) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = {\n state: \"idle\",\n data: fetcher.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(key, doneFetcher);\n }\n }\n function markFetchRedirectsDone() {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n function abortStaleFetchLoads(landedId) {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, \"Expected fetcher: \" + key);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n function getBlocker(key, fn) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n return blocker;\n }\n function deleteBlocker(key) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key, newBlocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(blocker.state === \"unblocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"blocked\" || blocker.state === \"blocked\" && newBlocker.state === \"proceeding\" || blocker.state === \"blocked\" && newBlocker.state === \"unblocked\" || blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\", \"Invalid blocker state transition: \" + blocker.state + \" -> \" + newBlocker.state);\n state.blockers.set(key, newBlocker);\n updateState({\n blockers: new Map(state.blockers)\n });\n }\n function shouldBlockNavigation(_ref2) {\n let {\n currentLocation,\n nextLocation,\n historyAction\n } = _ref2;\n if (blockerFunctions.size === 0) {\n return;\n }\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({\n currentLocation,\n nextLocation,\n historyAction\n })) {\n return blockerKey;\n }\n }\n function cancelActiveDeferreds(predicate) {\n let cancelledRouteIds = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the component\n function enableScrollRestoration(positions, getPosition, getKey) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || (location => location.key);\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered \n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({\n restoreScrollPosition: y\n });\n }\n }\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n function saveScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollRestorationKey && getScrollPosition) {\n let userMatches = matches.map(m => createUseMatchesMatch(m, state.loaderData));\n let key = getScrollRestorationKey(location, userMatches) || location.key;\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n function getSavedScrollPosition(location, matches) {\n if (savedScrollPositions && getScrollRestorationKey && getScrollPosition) {\n let userMatches = matches.map(m => createUseMatchesMatch(m, state.loaderData));\n let key = getScrollRestorationKey(location, userMatches) || location.key;\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n function _internalSetRoutes(newRoutes) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(newRoutes, mapRouteProperties, undefined, manifest);\n }\n router = {\n get basename() {\n return basename;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: to => init.history.createHref(to),\n encodeLocation: to => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher,\n dispose,\n getBlocker,\n deleteBlocker,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes\n };\n return router;\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\nconst UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\nfunction createStaticHandler(routes, opts) {\n invariant(routes.length > 0, \"You must provide a non-empty routes array to createStaticHandler\");\n let manifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties;\n if (opts != null && opts.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts != null && opts.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = route => ({\n hasErrorBoundary: detectErrorBoundary(route)\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n let dataRoutes = convertRoutesToDataRoutes(routes, mapRouteProperties, undefined, manifest);\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n */\n async function query(request, _temp2) {\n let {\n requestContext\n } = _temp2 === void 0 ? {} : _temp2;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, {\n method\n });\n let {\n matches: methodNotAllowedMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, {\n pathname: location.pathname\n });\n let {\n matches: notFoundMatches,\n route\n } = getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n let result = await queryImpl(request, location, matches, requestContext);\n if (isResponse(result)) {\n return result;\n }\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return _extends({\n location,\n basename\n }, result);\n }\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n */\n async function queryRoute(request, _temp3) {\n let {\n routeId,\n requestContext\n } = _temp3 === void 0 ? {} : _temp3;\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, {\n method\n });\n } else if (!matches) {\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let match = routeId ? matches.find(m => m.route.id === routeId) : getTargetMatch(matches, location);\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, {\n pathname: location.pathname\n });\n }\n let result = await queryImpl(request, location, matches, requestContext, match);\n if (isResponse(result)) {\n return result;\n }\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n if (result.loaderData) {\n var _result$activeDeferre;\n let data = Object.values(result.loaderData)[0];\n if ((_result$activeDeferre = result.activeDeferreds) != null && _result$activeDeferre[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n return undefined;\n }\n async function queryImpl(request, location, matches, requestContext, routeMatch) {\n invariant(request.signal, \"query()/queryRoute() requests must contain an AbortController signal\");\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(request, matches, routeMatch || getTargetMatch(matches, location), requestContext, routeMatch != null);\n return result;\n }\n let result = await loadRouteData(request, matches, requestContext, routeMatch);\n return isResponse(result) ? result : _extends({}, result, {\n actionData: null,\n actionHeaders: {}\n });\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction, we throw\n // it to bail out and then return or throw here based on whether the user\n // returned or threw\n if (isQueryRouteResponse(e)) {\n if (e.type === ResultType.error && !isRedirectResponse(e.response)) {\n throw e.response;\n }\n return e.response;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n async function submit(request, matches, actionMatch, requestContext, isRouteRequest) {\n let result;\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n } else {\n result = await callLoaderOrAction(\"action\", request, actionMatch, matches, manifest, mapRouteProperties, basename, true, isRouteRequest, requestContext);\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted\");\n }\n }\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.status,\n headers: {\n Location: result.location\n }\n });\n }\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, {\n type: \"defer-action\"\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error\n };\n }\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: {\n [actionMatch.route.id]: result.data\n },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null\n };\n }\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(request, matches, requestContext, undefined, {\n [boundaryMatch.route.id]: result.error\n });\n // action status codes take precedence over loader status codes\n return _extends({}, context, {\n statusCode: isRouteErrorResponse(result.error) ? result.error.status : 500,\n actionData: null,\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal\n });\n let context = await loadRouteData(loaderRequest, matches, requestContext);\n return _extends({}, context, result.statusCode ? {\n statusCode: result.statusCode\n } : {}, {\n actionData: {\n [actionMatch.route.id]: result.data\n },\n actionHeaders: _extends({}, result.headers ? {\n [actionMatch.route.id]: result.headers\n } : {})\n });\n }\n async function loadRouteData(request, matches, requestContext, routeMatch, pendingActionError) {\n let isRouteRequest = routeMatch != null;\n // Short circuit if we have no loaders to run (queryRoute())\n if (isRouteRequest && !(routeMatch != null && routeMatch.route.loader) && !(routeMatch != null && routeMatch.route.lazy)) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch == null ? void 0 : routeMatch.route.id\n });\n }\n let requestMatches = routeMatch ? [routeMatch] : getLoaderMatchesUntilBoundary(matches, Object.keys(pendingActionError || {})[0]);\n let matchesToLoad = requestMatches.filter(m => m.route.loader || m.route.lazy);\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce((acc, m) => Object.assign(acc, {\n [m.route.id]: null\n }), {}),\n errors: pendingActionError || null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null\n };\n }\n let results = await Promise.all([...matchesToLoad.map(match => callLoaderOrAction(\"loader\", request, match, matches, manifest, mapRouteProperties, basename, true, isRouteRequest, requestContext))]);\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(method + \"() call aborted\");\n }\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(matches, matchesToLoad, results, pendingActionError, activeDeferreds);\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(matchesToLoad.map(match => match.route.id));\n matches.forEach(match => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n return _extends({}, context, {\n matches,\n activeDeferreds: activeDeferreds.size > 0 ? Object.fromEntries(activeDeferreds.entries()) : null\n });\n }\n return {\n dataRoutes,\n query,\n queryRoute\n };\n}\n//#endregion\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nfunction getStaticContextFromError(routes, context, error) {\n let newContext = _extends({}, context, {\n statusCode: 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error\n }\n });\n return newContext;\n}\nfunction isSubmissionNavigation(opts) {\n return opts != null && \"formData\" in opts;\n}\nfunction normalizeTo(location, matches, basename, prependBasename, to, fromRouteId, relative) {\n let contextualMatches;\n let activeRouteMatch;\n if (fromRouteId != null && relative !== \"path\") {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route. When using relative:path,\n // fromRouteId is ignored since that is always relative to the current\n // location path\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n // Resolve the relative path\n let path = resolveTo(to ? to : \".\", getPathContributingMatches(contextualMatches).map(m => m.pathnameBase), stripBasename(location.pathname, basename) || location.pathname, relative === \"path\");\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n // Add an ?index param for matched index routes if we don't already have one\n if ((to == null || to === \"\" || to === \".\") && activeRouteMatch && activeRouteMatch.route.index && !hasNakedIndexQuery(path.search)) {\n path.search = path.search ? path.search.replace(/^\\?/, \"?index&\") : \"?index\";\n }\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n return createPath(path);\n}\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(normalizeFormMethod, isFetcher, path, opts) {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return {\n path\n };\n }\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, {\n method: opts.formMethod\n })\n };\n }\n // Create a Submission on non-GET navigations\n let submission;\n if (opts.formData) {\n let formMethod = opts.formMethod || \"get\";\n submission = {\n formMethod: normalizeFormMethod ? formMethod.toUpperCase() : formMethod.toLowerCase(),\n formAction: stripHashFromPath(path),\n formEncType: opts && opts.formEncType || \"application/x-www-form-urlencoded\",\n formData: opts.formData\n };\n if (isMutationMethod(submission.formMethod)) {\n return {\n path,\n submission\n };\n }\n }\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n let searchParams = convertFormDataToSearchParams(opts.formData);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = \"?\" + searchParams;\n return {\n path: createPath(parsedPath),\n submission\n };\n}\n// Filter out all routes below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(matches, boundaryId) {\n let boundaryMatches = matches;\n if (boundaryId) {\n let index = matches.findIndex(m => m.route.id === boundaryId);\n if (index >= 0) {\n boundaryMatches = matches.slice(0, index);\n }\n }\n return boundaryMatches;\n}\nfunction getMatchesToLoad(history, state, matches, submission, location, isRevalidationRequired, cancelledDeferredRoutes, cancelledFetcherLoads, fetchLoadMatches, routesToUse, basename, pendingActionData, pendingError) {\n let actionResult = pendingError ? Object.values(pendingError)[0] : pendingActionData ? Object.values(pendingActionData)[0] : undefined;\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryId = pendingError ? Object.keys(pendingError)[0] : undefined;\n let boundaryMatches = getLoaderMatchesUntilBoundary(matches, boundaryId);\n let navigationMatches = boundaryMatches.filter((match, index) => {\n if (match.route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (match.route.loader == null) {\n return false;\n }\n // Always call the loader on new route instances and pending defer cancellations\n if (isNewLoader(state.loaderData, state.matches[index], match) || cancelledDeferredRoutes.some(id => id === match.route.id)) {\n return true;\n }\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n return shouldRevalidateLoader(match, _extends({\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params\n }, submission, {\n actionResult,\n defaultShouldRevalidate:\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired ||\n // Clicked the same link, resubmitted a GET form\n currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)\n }));\n });\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate if fetcher won't be present in the subsequent render\n if (!matches.some(m => m.route.id === f.routeId)) {\n return;\n }\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null\n });\n return;\n }\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n if (cancelledFetcherLoads.includes(key)) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n return;\n }\n // Revalidating fetchers are decoupled from the route matches since they\n // hit a static href, so they _always_ check shouldRevalidate and the\n // default is strictly if a revalidation is explicitly required (action\n // submissions, useRevalidator, X-Remix-Revalidate).\n let shouldRevalidate = shouldRevalidateLoader(fetcherMatch, _extends({\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params\n }, submission, {\n actionResult,\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n defaultShouldRevalidate: isRevalidationRequired\n }));\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController()\n });\n }\n });\n return [navigationMatches, revalidatingFetchers];\n}\nfunction isNewLoader(currentLoaderData, currentMatch, match) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\nfunction isNewRouteInstance(currentMatch, match) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n currentPath != null && currentPath.endsWith(\"*\") && currentMatch.params[\"*\"] !== match.params[\"*\"]\n );\n}\nfunction shouldRevalidateLoader(loaderMatch, arg) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n return arg.defaultShouldRevalidate;\n}\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(route, mapRouteProperties, manifest) {\n if (!route.lazy) {\n return;\n }\n let lazyRoute = await route.lazy();\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue = routeToUpdate[lazyRouteProperty];\n let isPropertyStaticallyDefined = staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n warning(!isPropertyStaticallyDefined, \"Route \\\"\" + routeToUpdate.id + \"\\\" has a static property \\\"\" + lazyRouteProperty + \"\\\" \" + \"defined but its lazy function is also returning a value for this property. \" + (\"The lazy route property \\\"\" + lazyRouteProperty + \"\\\" will be ignored.\"));\n if (!isPropertyStaticallyDefined && !immutableRouteKeys.has(lazyRouteProperty)) {\n routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];\n }\n }\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, _extends({}, mapRouteProperties(routeToUpdate), {\n lazy: undefined\n }));\n}\nasync function callLoaderOrAction(type, request, match, matches, manifest, mapRouteProperties, basename, isStaticRequest, isRouteRequest, requestContext) {\n if (isStaticRequest === void 0) {\n isStaticRequest = false;\n }\n if (isRouteRequest === void 0) {\n isRouteRequest = false;\n }\n let resultType;\n let result;\n let onReject;\n let runHandler = handler => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject;\n let abortPromise = new Promise((_, r) => reject = r);\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n return Promise.race([handler({\n request,\n params: match.params,\n context: requestContext\n }), abortPromise]);\n };\n try {\n let handler = match.route[type];\n if (match.route.lazy) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let values = await Promise.all([runHandler(handler), loadLazyRouteModule(match.route, mapRouteProperties, manifest)]);\n result = values[0];\n } else {\n // Load lazy route module, then run any returned handler\n await loadLazyRouteModule(match.route, mapRouteProperties, manifest);\n handler = match.route[type];\n if (handler) {\n // Handler still run even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return {\n type: ResultType.data,\n data: undefined\n };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname\n });\n } else {\n result = await runHandler(handler);\n }\n invariant(result !== undefined, \"You defined \" + (type === \"action\" ? \"an action\" : \"a loader\") + \" for route \" + (\"\\\"\" + match.route.id + \"\\\" but didn't return anything from your `\" + type + \"` \") + \"function. Please return a value or `null`.\");\n } catch (e) {\n resultType = ResultType.error;\n result = e;\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n if (isResponse(result)) {\n let status = result.status;\n // Process redirects\n if (redirectStatusCodes.has(status)) {\n let location = result.headers.get(\"Location\");\n invariant(location, \"Redirects returned/thrown from loaders/actions must have a Location header\");\n // Support relative routing in internal redirects\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n location = normalizeTo(new URL(request.url), matches.slice(0, matches.indexOf(match) + 1), basename, true, location);\n } else if (!isStaticRequest) {\n // Strip off the protocol+origin for same-origin + same-basename absolute\n // redirects. If this is a static request, we can let it go back to the\n // browser as-is\n let currentUrl = new URL(request.url);\n let url = location.startsWith(\"//\") ? new URL(currentUrl.protocol + location) : new URL(location);\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n location = url.pathname + url.search + url.hash;\n }\n }\n // Don't process redirects in the router during static requests requests.\n // Instead, throw the Response and let the server handle it with an HTTP\n // redirect. We also update the Location header in place in this flow so\n // basename and relative routing is taken into account\n if (isStaticRequest) {\n result.headers.set(\"Location\", location);\n throw result;\n }\n return {\n type: ResultType.redirect,\n status,\n location,\n revalidate: result.headers.get(\"X-Remix-Revalidate\") !== null\n };\n }\n // For SSR single-route requests, we want to hand Responses back directly\n // without unwrapping. We do this with the QueryRouteResponse wrapper\n // interface so we can know whether it was returned or thrown\n if (isRouteRequest) {\n // eslint-disable-next-line no-throw-literal\n throw {\n type: resultType || ResultType.data,\n response: result\n };\n }\n let data;\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n data = await result.json();\n } else {\n data = await result.text();\n }\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: new ErrorResponse(status, result.statusText, data),\n headers: result.headers\n };\n }\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers\n };\n }\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: result\n };\n }\n if (isDeferredData(result)) {\n var _result$init, _result$init2;\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: (_result$init = result.init) == null ? void 0 : _result$init.status,\n headers: ((_result$init2 = result.init) == null ? void 0 : _result$init2.headers) && new Headers(result.init.headers)\n };\n }\n return {\n type: ResultType.data,\n data: result\n };\n}\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(history, location, signal, submission) {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init = {\n signal\n };\n if (submission && isMutationMethod(submission.formMethod)) {\n let {\n formMethod,\n formEncType,\n formData\n } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n init.body = formEncType === \"application/x-www-form-urlencoded\" ? convertFormDataToSearchParams(formData) : formData;\n }\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n return new Request(url, init);\n}\nfunction convertFormDataToSearchParams(formData) {\n let searchParams = new URLSearchParams();\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, value instanceof File ? value.name : value);\n }\n return searchParams;\n}\nfunction processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds) {\n // Fill in loaderData/errors from our loaders\n let loaderData = {};\n let errors = null;\n let statusCode;\n let foundError = false;\n let loaderHeaders = {};\n // Process loader results into state.loaderData/state.errors\n results.forEach((result, index) => {\n let id = matchesToLoad[index].route.id;\n invariant(!isRedirectResult(result), \"Cannot handle redirect results in processLoaderData\");\n if (isErrorResult(result)) {\n // Look upwards from the matched route for the closest ancestor\n // error boundary, defaulting to the root match\n let boundaryMatch = findNearestBoundary(matches, id);\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError) {\n error = Object.values(pendingError)[0];\n pendingError = undefined;\n }\n errors = errors || {};\n // Prefer higher error values if lower errors bubble to the same boundary\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error) ? result.error.status : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n } else {\n loaderData[id] = result.data;\n }\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (result.statusCode != null && result.statusCode !== 200 && !foundError) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n });\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError) {\n errors = pendingError;\n loaderData[Object.keys(pendingError)[0]] = undefined;\n }\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders\n };\n}\nfunction processLoaderData(state, matches, matchesToLoad, results, pendingError, revalidatingFetchers, fetcherResults, activeDeferreds) {\n let {\n loaderData,\n errors\n } = processRouteLoaderData(matches, matchesToLoad, results, pendingError, activeDeferreds);\n // Process results from our revalidating fetchers\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let {\n key,\n match,\n controller\n } = revalidatingFetchers[index];\n invariant(fetcherResults !== undefined && fetcherResults[index] !== undefined, \"Did not find corresponding fetcher result\");\n let result = fetcherResults[index];\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n continue;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match == null ? void 0 : match.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = _extends({}, errors, {\n [boundaryMatch.route.id]: result.error\n });\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = {\n state: \"idle\",\n data: result.data,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n \" _hasFetcherDoneAnything \": true\n };\n state.fetchers.set(key, doneFetcher);\n }\n }\n return {\n loaderData,\n errors\n };\n}\nfunction mergeLoaderData(loaderData, newLoaderData, matches, errors) {\n let mergedLoaderData = _extends({}, newLoaderData);\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(matches, routeId) {\n let eligibleMatches = routeId ? matches.slice(0, matches.findIndex(m => m.route.id === routeId) + 1) : [...matches];\n return eligibleMatches.reverse().find(m => m.route.hasErrorBoundary === true) || matches[0];\n}\nfunction getShortCircuitMatches(routes) {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.find(r => r.index || !r.path || r.path === \"/\") || {\n id: \"__shim-error-route__\"\n };\n return {\n matches: [{\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route\n }],\n route\n };\n}\nfunction getInternalRouterError(status, _temp4) {\n let {\n pathname,\n routeId,\n method,\n type\n } = _temp4 === void 0 ? {} : _temp4;\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n if (status === 400) {\n statusText = \"Bad Request\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide a `loader` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = \"Route \\\"\" + routeId + \"\\\" does not match URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = \"No route matches URL \\\"\" + pathname + \"\\\"\";\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage = \"You made a \" + method.toUpperCase() + \" request to \\\"\" + pathname + \"\\\" but \" + (\"did not provide an `action` for route \\\"\" + routeId + \"\\\", \") + \"so there is no way to handle the request.\";\n } else if (method) {\n errorMessage = \"Invalid request method \\\"\" + method.toUpperCase() + \"\\\"\";\n }\n }\n return new ErrorResponse(status || 500, statusText, new Error(errorMessage), true);\n}\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(results) {\n for (let i = results.length - 1; i >= 0; i--) {\n let result = results[i];\n if (isRedirectResult(result)) {\n return result;\n }\n }\n}\nfunction stripHashFromPath(path) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath(_extends({}, parsedPath, {\n hash: \"\"\n }));\n}\nfunction isHashChangeOnly(a, b) {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\nfunction isDeferredResult(result) {\n return result.type === ResultType.deferred;\n}\nfunction isErrorResult(result) {\n return result.type === ResultType.error;\n}\nfunction isRedirectResult(result) {\n return (result && result.type) === ResultType.redirect;\n}\nfunction isDeferredData(value) {\n let deferred = value;\n return deferred && typeof deferred === \"object\" && typeof deferred.data === \"object\" && typeof deferred.subscribe === \"function\" && typeof deferred.cancel === \"function\" && typeof deferred.resolveData === \"function\";\n}\nfunction isResponse(value) {\n return value != null && typeof value.status === \"number\" && typeof value.statusText === \"string\" && typeof value.headers === \"object\" && typeof value.body !== \"undefined\";\n}\nfunction isRedirectResponse(result) {\n if (!isResponse(result)) {\n return false;\n }\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\nfunction isQueryRouteResponse(obj) {\n return obj && isResponse(obj.response) && (obj.type === ResultType.data || ResultType.error);\n}\nfunction isValidMethod(method) {\n return validRequestMethods.has(method.toLowerCase());\n}\nfunction isMutationMethod(method) {\n return validMutationMethods.has(method.toLowerCase());\n}\nasync function resolveDeferredResults(currentMatches, matchesToLoad, results, signals, isFetcher, currentLoaderData) {\n for (let index = 0; index < results.length; index++) {\n let result = results[index];\n let match = matchesToLoad[index];\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n let currentMatch = currentMatches.find(m => m.route.id === match.route.id);\n let isRevalidatingLoader = currentMatch != null && !isNewRouteInstance(currentMatch, match) && (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n if (isDeferredResult(result) && (isFetcher || isRevalidatingLoader)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n let signal = signals[index];\n invariant(signal, \"Expected an AbortSignal for revalidating fetcher deferred result\");\n await resolveDeferredData(result, signal, isFetcher).then(result => {\n if (result) {\n results[index] = result || results[index];\n }\n });\n }\n }\n}\nasync function resolveDeferredData(result, signal, unwrap) {\n if (unwrap === void 0) {\n unwrap = false;\n }\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e\n };\n }\n }\n return {\n type: ResultType.data,\n data: result.deferredData.data\n };\n}\nfunction hasNakedIndexQuery(search) {\n return new URLSearchParams(search).getAll(\"index\").some(v => v === \"\");\n}\n// Note: This should match the format exported by useMatches, so if you change\n// this please also change that :) Eventually we'll DRY this up\nfunction createUseMatchesMatch(match, loaderData) {\n let {\n route,\n pathname,\n params\n } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id],\n handle: route.handle\n };\n}\nfunction getTargetMatch(matches, location) {\n let search = typeof location === \"string\" ? parsePath(location).search : location.search;\n if (matches[matches.length - 1].route.index && hasNakedIndexQuery(search || \"\")) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\n//#endregion\n\nexport { AbortedDeferredError, Action, ErrorResponse, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, UNSAFE_DEFERRED_SYMBOL, DeferredData as UNSAFE_DeferredData, convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes, getPathContributingMatches as UNSAFE_getPathContributingMatches, invariant as UNSAFE_invariant, warning as UNSAFE_warning, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, createRouter, createStaticHandler, defer, generatePath, getStaticContextFromError, getToPathname, isDeferredData, isRouteErrorResponse, joinPaths, json, matchPath, matchRoutes, normalizePathname, parsePath, redirect, resolvePath, resolveTo, stripBasename };\n//# sourceMappingURL=router.js.map\n","/**\n * React Router v6.13.0\n *\n * Copyright (c) Remix Software Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE.md file in the root directory of this source tree.\n *\n * @license MIT\n */\nimport * as React from 'react';\nimport { UNSAFE_invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, UNSAFE_warning, resolveTo, parsePath, matchRoutes, Action, isRouteErrorResponse, createMemoryHistory, stripBasename, AbortedDeferredError, createRouter } from '@remix-run/router';\nexport { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from '@remix-run/router';\n\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n/**\n Not a true \"polyfill\" since we guard via the feature flag at runtime,\n but close enough :)\n\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nvar startTransitionImpl = React[START_TRANSITION];\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\nconst DataRouterContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterContext.displayName = \"DataRouter\";\n}\nconst DataRouterStateContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\nconst AwaitContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n AwaitContext.displayName = \"Await\";\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\n\nconst NavigationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n NavigationContext.displayName = \"Navigation\";\n}\nconst LocationContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n LocationContext.displayName = \"Location\";\n}\nconst RouteContext = /*#__PURE__*/React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false\n});\nif (process.env.NODE_ENV !== \"production\") {\n RouteContext.displayName = \"Route\";\n}\nconst RouteErrorContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") {\n RouteErrorContext.displayName = \"RouteError\";\n}\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/hooks/use-href\n */\nfunction useHref(to, _temp) {\n let {\n relative\n } = _temp === void 0 ? {} : _temp;\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useHref() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n hash,\n pathname,\n search\n } = useResolvedPath(to, {\n relative\n });\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname = pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n return navigator.createHref({\n pathname: joinedPathname,\n search,\n hash\n });\n}\n\n/**\n * Returns true if this component is a descendant of a .\n *\n * @see https://reactrouter.com/hooks/use-in-router-context\n */\nfunction useInRouterContext() {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/hooks/use-location\n */\nfunction useLocation() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useLocation() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/hooks/use-navigation-type\n */\nfunction useNavigationType() {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * .\n *\n * @see https://reactrouter.com/hooks/use-match\n */\nfunction useMatch(pattern) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useMatch() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n pathname\n } = useLocation();\n return React.useMemo(() => matchPath(pattern, pathname), [pathname, pattern]);\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\n\nconst navigateEffectWarning = \"You should call navigate() in a React.useEffect(), not when \" + \"your component is first rendered.\";\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(cb) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/hooks/use-navigate\n */\nfunction useNavigate() {\n let {\n isDataRoute\n } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\nfunction useNavigateUnstable() {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useNavigate() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let dataRouterContext = React.useContext(DataRouterContext);\n let {\n basename,\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === \"path\");\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname = path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);\n }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);\n return navigate;\n}\nconst OutletContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/hooks/use-outlet-context\n */\nfunction useOutletContext() {\n return React.useContext(OutletContext);\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by to render child routes.\n *\n * @see https://reactrouter.com/hooks/use-outlet\n */\nfunction useOutlet(context) {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return /*#__PURE__*/React.createElement(OutletContext.Provider, {\n value: context\n }, outlet);\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/hooks/use-params\n */\nfunction useParams() {\n let {\n matches\n } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? routeMatch.params : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/hooks/use-resolved-path\n */\nfunction useResolvedPath(to, _temp2) {\n let {\n relative\n } = _temp2 === void 0 ? {} : _temp2;\n let {\n matches\n } = React.useContext(RouteContext);\n let {\n pathname: locationPathname\n } = useLocation();\n let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));\n return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === \"path\"), [to, routePathnamesJson, locationPathname, relative]);\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an to render their child route's\n * element.\n *\n * @see https://reactrouter.com/hooks/use-routes\n */\nfunction useRoutes(routes, locationArg) {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nfunction useRoutesImpl(routes, locationArg, dataRouterState) {\n !useInRouterContext() ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n \"useRoutes() may be used only in the context of a component.\") : UNSAFE_invariant(false) : void 0;\n let {\n navigator\n } = React.useContext(NavigationContext);\n let {\n matches: parentMatches\n } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n if (process.env.NODE_ENV !== \"production\") {\n // You won't get a warning about 2 different under a \n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // \n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // } />\n // } />\n // \n //\n // function Blog() {\n // return (\n // \n // } />\n // \n // );\n // }\n let parentPath = parentRoute && parentRoute.path || \"\";\n warningOnce(parentPathname, !parentRoute || parentPath.endsWith(\"*\"), \"You rendered descendant (or called `useRoutes()`) at \" + (\"\\\"\" + parentPathname + \"\\\" (under ) but the \") + \"parent route path has no trailing \\\"*\\\". This means if you navigate \" + \"deeper, the parent won't match anymore and therefore the child \" + \"routes will never render.\\n\\n\" + (\"Please change the parent to .\"));\n }\n let locationFromContext = useLocation();\n let location;\n if (locationArg) {\n var _parsedLocationArg$pa;\n let parsedLocationArg = typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n !(parentPathnameBase === \"/\" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"When overriding the location using `` or `useRoutes(routes, location)`, \" + \"the location pathname must begin with the portion of the URL pathname that was \" + (\"matched by all parent routes. The current pathname base is \\\"\" + parentPathnameBase + \"\\\" \") + (\"but pathname \\\"\" + parsedLocationArg.pathname + \"\\\" was given in the `location` prop.\")) : UNSAFE_invariant(false) : void 0;\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n let pathname = location.pathname || \"/\";\n let remainingPathname = parentPathnameBase === \"/\" ? pathname : pathname.slice(parentPathnameBase.length) || \"/\";\n let matches = matchRoutes(routes, {\n pathname: remainingPathname\n });\n if (process.env.NODE_ENV !== \"production\") {\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(parentRoute || matches != null, \"No routes matched location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \") : void 0;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined, \"Matched leaf route at location \\\"\" + location.pathname + location.search + location.hash + \"\\\" \" + \"does not have an element or Component. This means it will render an with a \" + \"null value by default resulting in an \\\"empty\\\" page.\") : void 0;\n }\n let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname]),\n pathnameBase: match.pathnameBase === \"/\" ? parentPathnameBase : joinPaths([parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase])\n })), parentMatches, dataRouterState);\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return /*#__PURE__*/React.createElement(LocationContext.Provider, {\n value: {\n location: _extends({\n pathname: \"/\",\n search: \"\",\n hash: \"\",\n state: null,\n key: \"default\"\n }, location),\n navigationType: Action.Pop\n }\n }, renderedMatches);\n }\n return renderedMatches;\n}\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error) ? error.status + \" \" + error.statusText : error instanceof Error ? error.message : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = {\n padding: \"0.5rem\",\n backgroundColor: lightgrey\n };\n let codeStyles = {\n padding: \"2px 4px\",\n backgroundColor: lightgrey\n };\n let devInfo = null;\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\"Error handled by React Router default ErrorBoundary:\", error);\n devInfo = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"p\", null, \"\\uD83D\\uDCBF Hey developer \\uD83D\\uDC4B\"), /*#__PURE__*/React.createElement(\"p\", null, \"You can provide a way better UX than this when your app throws errors by providing your own \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"ErrorBoundary\"), \" or\", \" \", /*#__PURE__*/React.createElement(\"code\", {\n style: codeStyles\n }, \"errorElement\"), \" prop on your route.\"));\n }\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"h2\", null, \"Unexpected Application Error!\"), /*#__PURE__*/React.createElement(\"h3\", {\n style: {\n fontStyle: \"italic\"\n }\n }, message), stack ? /*#__PURE__*/React.createElement(\"pre\", {\n style: preStyles\n }, stack) : null, devInfo);\n}\nconst defaultErrorElement = /*#__PURE__*/React.createElement(DefaultErrorComponent, null);\nclass RenderErrorBoundary extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error\n };\n }\n static getDerivedStateFromError(error) {\n return {\n error: error\n };\n }\n static getDerivedStateFromProps(props, state) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (state.location !== props.location || state.revalidation !== \"idle\" && props.revalidation === \"idle\") {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error || state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation\n };\n }\n componentDidCatch(error, errorInfo) {\n console.error(\"React Router caught the following error during render\", error, errorInfo);\n }\n render() {\n return this.state.error ? /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: this.props.routeContext\n }, /*#__PURE__*/React.createElement(RouteErrorContext.Provider, {\n value: this.state.error,\n children: this.props.component\n })) : this.props.children;\n }\n}\nfunction RenderedRoute(_ref) {\n let {\n routeContext,\n match,\n children\n } = _ref;\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n return /*#__PURE__*/React.createElement(RouteContext.Provider, {\n value: routeContext\n }, children);\n}\nfunction _renderMatches(matches, parentMatches, dataRouterState) {\n var _dataRouterState2;\n if (parentMatches === void 0) {\n parentMatches = [];\n }\n if (dataRouterState === void 0) {\n dataRouterState = null;\n }\n if (matches == null) {\n var _dataRouterState;\n if ((_dataRouterState = dataRouterState) != null && _dataRouterState.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches;\n } else {\n return null;\n }\n }\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = (_dataRouterState2 = dataRouterState) == null ? void 0 : _dataRouterState2.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]));\n !(errorIndex >= 0) ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"Could not find a matching route for errors on route IDs: \" + Object.keys(errors).join(\",\")) : UNSAFE_invariant(false) : void 0;\n renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));\n }\n return renderedMatches.reduceRight((outlet, match, index) => {\n let error = match.route.id ? errors == null ? void 0 : errors[match.route.id] : null;\n // Only data routers handle errors\n let errorElement = null;\n if (dataRouterState) {\n errorElement = match.route.errorElement || defaultErrorElement;\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children;\n if (error) {\n children = errorElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `` in `` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = /*#__PURE__*/React.createElement(match.route.Component, null);\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return /*#__PURE__*/React.createElement(RenderedRoute, {\n match: match,\n routeContext: {\n outlet,\n matches,\n isDataRoute: dataRouterState != null\n },\n children: children\n });\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /*#__PURE__*/React.createElement(RenderErrorBoundary, {\n location: dataRouterState.location,\n revalidation: dataRouterState.revalidation,\n component: errorElement,\n error: error,\n children: getChildren(),\n routeContext: {\n outlet: null,\n matches,\n isDataRoute: true\n }\n }) : getChildren();\n }, null);\n}\nvar DataRouterHook;\n(function (DataRouterHook) {\n DataRouterHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterHook[\"UseNavigateStable\"] = \"useNavigate\";\n})(DataRouterHook || (DataRouterHook = {}));\nvar DataRouterStateHook;\n(function (DataRouterStateHook) {\n DataRouterStateHook[\"UseBlocker\"] = \"useBlocker\";\n DataRouterStateHook[\"UseLoaderData\"] = \"useLoaderData\";\n DataRouterStateHook[\"UseActionData\"] = \"useActionData\";\n DataRouterStateHook[\"UseRouteError\"] = \"useRouteError\";\n DataRouterStateHook[\"UseNavigation\"] = \"useNavigation\";\n DataRouterStateHook[\"UseRouteLoaderData\"] = \"useRouteLoaderData\";\n DataRouterStateHook[\"UseMatches\"] = \"useMatches\";\n DataRouterStateHook[\"UseRevalidator\"] = \"useRevalidator\";\n DataRouterStateHook[\"UseNavigateStable\"] = \"useNavigate\";\n DataRouterStateHook[\"UseRouteId\"] = \"useRouteId\";\n})(DataRouterStateHook || (DataRouterStateHook = {}));\nfunction getDataRouterConsoleError(hookName) {\n return hookName + \" must be used within a data router. See https://reactrouter.com/routers/picking-a-router.\";\n}\nfunction useDataRouterContext(hookName) {\n let ctx = React.useContext(DataRouterContext);\n !ctx ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return ctx;\n}\nfunction useDataRouterState(hookName) {\n let state = React.useContext(DataRouterStateContext);\n !state ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return state;\n}\nfunction useRouteContext(hookName) {\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n !thisRoute.route.id ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, hookName + \" can only be used on routes that contain a unique \\\"id\\\"\") : UNSAFE_invariant(false) : void 0;\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nfunction useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nfunction useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nfunction useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return {\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation\n };\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nfunction useMatches() {\n let {\n matches,\n loaderData\n } = useDataRouterState(DataRouterStateHook.UseMatches);\n return React.useMemo(() => matches.map(match => {\n let {\n pathname,\n params\n } = match;\n // Note: This structure matches that created by createUseMatchesMatch\n // in the @remix-run/router , so if you change this please also change\n // that :) Eventually we'll DRY this up\n return {\n id: match.route.id,\n pathname,\n params,\n data: loaderData[match.route.id],\n handle: match.route.handle\n };\n }), [matches, loaderData]);\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nfunction useLoaderData() {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n if (state.errors && state.errors[routeId] != null) {\n console.error(\"You cannot `useLoaderData` in an errorElement (routeId: \" + routeId + \")\");\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nfunction useRouteLoaderData(routeId) {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nfunction useActionData() {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n let route = React.useContext(RouteContext);\n !route ? process.env.NODE_ENV !== \"production\" ? UNSAFE_invariant(false, \"useActionData must be used inside a RouteContext\") : UNSAFE_invariant(false) : void 0;\n return Object.values((state == null ? void 0 : state.actionData) || {})[0];\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nfunction useRouteError() {\n var _state$errors;\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor value\n */\nfunction useAsyncValue() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._data;\n}\n\n/**\n * Returns the error from the nearest ancestor value\n */\nfunction useAsyncError() {\n let value = React.useContext(AwaitContext);\n return value == null ? void 0 : value._error;\n}\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nfunction useBlocker(shouldBlock) {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n let [blockerKey] = React.useState(() => String(++blockerId));\n let blockerFunction = React.useCallback(args => {\n return typeof shouldBlock === \"function\" ? !!shouldBlock(args) : !!shouldBlock;\n }, [shouldBlock]);\n let blocker = router.getBlocker(blockerKey, blockerFunction);\n\n // Cleanup on unmount\n React.useEffect(() => () => router.deleteBlocker(blockerKey), [router, blockerKey]);\n\n // Prefer the blocker from state since DataRouterContext is memoized so this\n // ensures we update on blocker state updates\n return state.blockers.get(blockerKey) || blocker;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable() {\n let {\n router\n } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n let navigate = React.useCallback(function (to, options) {\n if (options === void 0) {\n options = {};\n }\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(activeRef.current, navigateEffectWarning) : void 0;\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, _extends({\n fromRouteId: id\n }, options));\n }\n }, [router, id]);\n return navigate;\n}\nconst alreadyWarned = {};\nfunction warningOnce(key, cond, message) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n process.env.NODE_ENV !== \"production\" ? UNSAFE_warning(false, message) : void 0;\n }\n}\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nfunction RouterProvider(_ref) {\n let {\n fallbackElement,\n router,\n future\n } = _ref;\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/)\n let [state, setStateImpl] = React.useState(router.state);\n let {\n v7_startTransition\n } = future || {};\n let setState = React.useCallback(newState => {\n v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);\n }, [setStateImpl, v7_startTransition]);\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n let navigator = React.useMemo(() => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: n => router.navigate(n),\n push: (to, state, opts) => router.navigate(to, {\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n }),\n replace: (to, state, opts) => router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts == null ? void 0 : opts.preventScrollReset\n })\n };\n }, [router]);\n let basename = router.basename || \"/\";\n let dataRouterContext = React.useMemo(() => ({\n router,\n navigator,\n static: false,\n basename\n }), [router, navigator, basename]);\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a