{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/shared/auth/IAuthContext.ts","webpack:///./src/shared/Constants.ts","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/isRunningInOneNoteContext.js","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/themes/OfficeThemeID.js","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/themes/toOneNoteTheme.js","webpack:///./src/agave/getOutlookMode.ts","webpack:///./src/agave/auth/SSOThirdPartyAuthContext.ts","webpack:///./src/agave/officeJsWrapper/BaseOfficeJsWrapper.ts","webpack:///./src/agave/officeJsWrapper/OneNoteAgaveLogger.ts","webpack:///./src/agave/officeJsWrapper/OneNoteOfficeJsWrapper.ts","webpack:///./src/agave/officeJsWrapper/OutlookOfficeJsWrapper.ts","webpack:///./src/agave/officeJsWrapper/OfficeJsWrapper.ts","webpack:///./src/agave/hostIntegration/OfficeJSHostAdapter.tsx","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/themes/getCurrentTheme.js","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/themes/registerThemeChangedEvent.js","webpack:///./src/agave/index.ts","webpack:///./src/agave/auth/getO365AccessToken.ts","webpack:///./src/init/redirectToAuth.ts","webpack:///./node_modules/@microsoft/applicationinsights-shims/dist-esm/Helpers.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/node_modules/@microsoft/applicationinsights-shims/dist-esm/Helpers.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/applicationinsights-shims/dist-esm/Helpers.js","webpack:///./node_modules/@microsoft/1ds-core-js/node_modules/@microsoft/applicationinsights-shims/dist-esm/Helpers.js","webpack:///./src/shared/logger/getLoggingUserContextFromUserInformation.ts","webpack:///./src/AppIntegrationSetup.ts","webpack:///./src/shared/lib/getHostNameFromUrl.ts","webpack:///./src/localization/supportedLanguages.ts","webpack:///./src/localization/LocaleCompatibility.ts","webpack:///./src/shared/LocalizationActivity.ts","webpack:///./src/localization/LocalizationService.ts","webpack:///./src/shared/LoadingSpinner.ts","webpack:///./node_modules/@microsoft/applicationinsights-shims/dist-esm/Constants.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/node_modules/@microsoft/applicationinsights-shims/dist-esm/Constants.js","webpack:///./src/localization/locales lazy ^\\.\\/.*\\/index$ namespace object","webpack:///./src/shared/supportsCSSVariables.ts","webpack:///./src/shared/types.ts","webpack:///./src/LayoutSDKTelemetryCallbacks.ts","webpack:///./src/shared/auth/StickyNotesExchangeToken.ts","webpack:///./src/shared/Utils.ts","webpack:///./src/shared/auth/RefreshTokenForSdkActivity.ts","webpack:///./src/shared/auth/getAppTokenInfoForStickyNotes.ts","webpack:///./src/shared/auth/SetTokenInSdkActivity.ts","webpack:///./src/layoutSDK/getTokensForSDK.ts","webpack:///./src/layoutSDK/showSessionExpired.ts","webpack:///./src/layoutSDK/LayoutSDKWrapper.tsx","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/applicationinsights-shims/dist-esm/Constants.js","webpack:///./node_modules/@microsoft/1ds-core-js/node_modules/@microsoft/applicationinsights-shims/dist-esm/Constants.js","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/ErrorWithType.js","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/executeWithTimeout.js","webpack:///./src/agave/components/ExpandableMoreOptions/expandableMoreOptions.css?5b83","webpack:///./src/shared/CompileTimeConstants.ts","webpack:///./src/shared/shouldMockExternalApis.ts","webpack:///./src/agave/components/MoreOptions/defaultusericon.png","webpack:///./src/agave/auth/extractTokenFromAuthHeader.ts","webpack:///./src/agave/auth/getAuthTypeForAccountType.ts","webpack:///./src/agave/components/MoreOptions/moreOptions.css?5904","webpack:///./src/agave/components/AccountList/accountList.css?68db","webpack:///./node_modules/@notes/webintegrations-common/lib/Auth/AuthenticatedUserInfo/GetUserPhotoWithCacheFactory.js","webpack:///./node_modules/@notes/webintegrations-common/lib/Auth/AuthenticatedUserInfo/GetMsaGraphUserPhoto.js","webpack:///./node_modules/@notes/webintegrations-common/lib/Auth/AuthenticatedUserInfo/GetO365GraphUserPhoto.js","webpack:///./node_modules/@notes/webintegrations-common/lib/Auth/AuthenticatedUserInfo/GetUserPhotoWithCache.js","webpack:///./src/agave/layoutSDK/createLayoutSDKWrapper.tsx","webpack:///./src/agave/ui/stickyNotesFrame.ts","webpack:///./src/agave/teams/TeamsUtils.ts","webpack:///./src/agave/components/MoreOptions/MoreOptionsStyles.ts","webpack:///./src/agave/components/MoreOptions/MoreOptions.tsx","webpack:///./src/agave/components/ExpandableMoreOptions/ExpandableMoreOptionsStyles.ts","webpack:///./src/agave/components/ExpandableMoreOptions/ExpandableMoreOptions.tsx","webpack:///./src/agave/components/App/AppStyles.ts","webpack:///./src/agave/components/SessionExpired/SessionExpiredStyles.ts","webpack:///./src/agave/components/SessionExpired/SessionExpired.tsx","webpack:///./src/agave/components/App/App.tsx","webpack:///./src/agave/components/AccountButton/AccountButtonStyles.ts","webpack:///./src/agave/components/AccountButton/AccountButton.tsx","webpack:///./src/agave/components/AccountList/AccountListStyles.ts","webpack:///./src/agave/components/AccountList/AccountList.tsx","webpack:///./src/agave/components/SignIn/SignInStyles.ts","webpack:///./src/agave/components/SignIn/SignIn.tsx","webpack:///./node_modules/@notes/webintegrations-common/lib/Auth/Url/performSilentSignOut.js","webpack:///./src/agave/startApp.tsx","webpack:///./src/shared/uuid/getDeviceID.ts","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/generateGuid.js","webpack:///./src/shared/logger/constants.ts","webpack:///./src/shared/logger/eventProperties.ts","webpack:///./src/shared/logger/utils.ts","webpack:///./src/shared/logger/NotesIntegrationCommonLogger.ts","webpack:///./src/shared/logger/CommonLogger.ts","webpack:///./src/shared/logger/Log.ts","webpack:///./src/shared/caches.ts","webpack:///./node_modules/@notes/sticky-notes-layout/dist-es2015/sticky-notes-sdk/src/localization/locales lazy ^\\.\\/.*\\/strings\\.json$ namespace object","webpack:///./src/shared/GlobalVariables.ts","webpack:///./src/assets/agave/stickynotes16x16.png","webpack:///./src/assets/agave/stickynotes32x32.png","webpack:///./src/assets/agave/stickynotes64x64.png","webpack:///./src/assets/agave/stickynotes80x80.png","webpack:///./src/assets/agave/showallnotes_16.png","webpack:///./src/assets/agave/showallnotes_32.png","webpack:///./src/assets/agave/showallnotes_80.png","webpack:///./src/agave/components/ExpandableMoreOptions/stickyNotesSDKStyleOverrides.css?a4cb","webpack:///./src/agave/components/SignIn/signinnew.png","webpack:///./src/agave/components/SessionExpired/sessionexpiredlight.png","webpack:///./src/agave/components/SessionExpired/sessionexpireddark.png","webpack:///./src/lib/urlParserUtils.ts","webpack:///./src/agave/auth/getAuthTypeWithExtension.ts","webpack:///./src/shared/logger/Errors.ts","webpack:///./src/shared/auth/OAuthContext.ts","webpack:///./src/agave/auth/SSOFirstPartyAuthContext.ts","webpack:///./src/agave/auth/getAccessTokenInfo.ts","webpack:///./src/agave/auth/localStorageIsSignedInKey.ts","webpack:///./node_modules/@microsoft/applicationinsights-shims/dist-esm/TsLibShims.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/applicationinsights-shims/dist-esm/TsLibShims.js","webpack:///./node_modules/@microsoft/1ds-core-js/node_modules/@microsoft/applicationinsights-shims/dist-esm/TsLibShims.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/node_modules/@microsoft/applicationinsights-shims/dist-esm/TsLibShims.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/HelperFuncs.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/InternalConstants.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EnvUtils.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DbgExtensionUtils.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DiagnosticLogger.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/PerfManager.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/RandomHelper.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DataCacheHelper.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CookieMgr.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EventHelpers.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CoreUtils.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/TelemetryHelpers.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/dist-esm/src/RegisteredFileTypes.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/dist-esm/src/PrivacyGuardInternal.js","webpack:///./node_modules/@microsoft/1ds-privacy-guard-js/dist-esm/src/PrivacyGuardPlugin.js","webpack:///./node_modules/@microsoft/oteljs/dist/DataFieldHelper.js","webpack:///./node_modules/@microsoft/oteljs/node_modules/tslib/tslib.es6.js","webpack:///./node_modules/@microsoft/oteljs/dist/OTelNotifications.js","webpack:///./node_modules/@microsoft/oteljs/dist/TenantTokenManager.js","webpack:///./node_modules/@microsoft/oteljs/dist/TelemetryEventValidator.js","webpack:///./node_modules/@microsoft/oteljs/dist/SimpleTelemetryLogger.js","webpack:///./node_modules/@microsoft/oteljs/dist/Version.js","webpack:///./node_modules/@microsoft/oteljs/dist/Contracts.js","webpack:///./node_modules/@microsoft/oteljs/dist/Activity.js","webpack:///./node_modules/@microsoft/oteljs/dist/CorrelationVector.js","webpack:///./node_modules/@microsoft/oteljs/dist/InternalContracts.js","webpack:///./node_modules/@microsoft/oteljs/dist/TelemetryLogger.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/tslib/tslib.es6.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/HelperFuncs.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/InternalConstants.js","webpack:///./node_modules/@microsoft/oteljs-1ds/dist/InternalUtils.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EnvUtils.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/node_modules/@microsoft/dynamicproto-js/lib/dist/esm/dynamicproto-js.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DbgExtensionUtils.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DiagnosticLogger.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CookieMgr.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/RandomHelper.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DataCacheHelper.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EventHelpers.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CoreUtils.js","webpack:///./node_modules/@microsoft/oteljs-1ds/dist/DataModels.js","webpack:///./node_modules/@microsoft/oteljs-1ds/dist/OneDSHelper.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/PerfManager.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/W3cTraceParent.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/TelemetryHelpers.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ChannelController.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/Constants.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/BaseCore.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/NotificationManager.js","webpack:///./node_modules/@microsoft/1ds-core-js/dist-esm/src/Utils.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/AppInsightsCore.js","webpack:///./node_modules/@microsoft/1ds-core-js/node_modules/@microsoft/dynamicproto-js/lib/dist/esm/dynamicproto-js.js","webpack:///./node_modules/@microsoft/1ds-core-js/dist-esm/src/AppInsightsCore.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/dynamicproto-js/lib/dist/esm/dynamicproto-js.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/EventBatch.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/Serializer.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/RetryPolicy.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/KillSwitch.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/HttpManager.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/ClockSkewManager.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/Constants.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/TimeoutOverrideWrapper.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/PostChannel.js","webpack:///./node_modules/@microsoft/oteljs-1ds/node_modules/@microsoft/1ds-post-js/dist-esm/src/DataModels.js","webpack:///./node_modules/@microsoft/oteljs-1ds/dist/PerfManager.js","webpack:///./node_modules/@microsoft/oteljs-1ds/dist/ApplicationInsights.js","webpack:///./node_modules/@microsoft/oteljs-1ds/dist/OneDSSink.js","webpack:///./node_modules/@microsoft/oteljs-1ds/dist/Sampler.js","webpack:///./node_modules/@notes/aria-common-schema-logger/lib/lib/RingBuffer.js","webpack:///./node_modules/@notes/aria-common-schema-logger/lib/validation.js","webpack:///./node_modules/@notes/webintegrations-common/lib/shared/logging/AWTSessionState.js","webpack:///./node_modules/@notes/aria-common-schema-logger/lib/constants.js","webpack:///./node_modules/@notes/aria-common-schema-logger/lib/sessionLogging.js","webpack:///./node_modules/@notes/aria-common-schema-logger/lib/OTelLogger.js","webpack:///./src/shared/auth/MsaGetToken.ts","webpack:///./src/shared/auth/O365GetToken.ts","webpack:///./src/shared/auth/GetTokenFactory.ts","webpack:///./src/shared/auth/getSignInUrl.ts","webpack:///./src/shared/elementIds.ts","webpack:///./node_modules/@microsoft/dynamicproto-js/lib/dist/esm/dynamicproto-js.js","webpack:///./src/shared/auth/useImplicitAuthForMsa.ts","webpack:///./src/shared/auth/GetUserInfoFactory.ts","webpack:///./src/shared/auth/authLibFactories.ts"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","prefetchChunks","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","deferredPrefetch","apply","shift","deferredModules","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","forEach","undefined","link","document","createElement","nc","setAttribute","rel","as","href","jsonpScriptSrc","head","appendChild","installedModules","7","p","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","charset","timeout","src","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","setTimeout","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","err","console","jsonpArray","window","oldJsonpFunction","slice","startupResult","AuthMethod","Constants","sessionIdHeaderName","protocolAndHostName","location","hostname","stickyNotesOndcAppIdForOneNoteApi","stickyNotesOndcAppIdForLogging","sdkTelemetryEventName","notesFabricApiCreatedByApp","outlookO365ResourceUri","WELL_KNOWN_MICROSOFT_TENANT_ID","WELL_KNOWN_LOCALHOST_TENANT_ID","DOGFOOD_TEAMS_CHAT","MSA_T1_EXPORT_LINK","cancelledError","EDGE_HUB_QUERY_FIELD","SERVICE_WORKER_QUERY_FIELD","AUTH_QUERY_FIELD","HOST_APP_TYPES","EDGE_HUB","WEB_APP","RING_TYPE","INTERNAL","PRODUCTION","NEW_USER_TO_ON_ECOSYSTEM_TELEMETRY_FLUSH_EVENT","LOCAL_STORAGE_KEY_FOR_SHORELINE_FEED_USER","OfficeThemeID","isRunningInOneNoteContext","test","search","pathname","startsWith","parent","isRunningInOneNoteDotComInt","endsWith","oneNoteThemeFromSwatch","swatch","color","toLowerCase","warn","toOneNoteTheme","themeSwatches","themeId","Colorful","parseInt","replace","Black","primaryBackgroundColor","bodyBackgroundColor","OutlookMode","initialToken","this","accessToken","getAccessToken","getSubstrateNotesToken","refresh","logAndBuildError","getAuthMethod","HostSso","getSelectedHtmlAsync","shouldMockExternalApis","log","officeJs","getOfficeJsOrThrow","context","getSelectedDataAsync","CoercionType","Html","valueFormat","ValueFormat","Unformatted","asyncResult","status","AsyncResultStatus","Succeeded","getSelectedImageAsync","Image","getSelectedTextAsync","Text","setSelectedHtmlAsync","text","setSelectedDataAsync","coercionType","setSelectedTextAsync","getLogger","_namespace","getTelemetrySink","sendTelemetryEvent","getSSOTokenFirstParty","_upn","resource","ctx","OfficeCore","RequestContext","token","firstParty","authentication","sync","code","getAccountInfoCollection","displayName","upn","authType","navigateToClientURL","url","namespace","logToOneNote","info","logReportData","eventName","_isCriticalEvent","payloadNonPII","_payloadEUPIOnlyNonPII","telemetryEvent","logEvent","_eventName","_message","logUnexpected","errorInfo","errorDescription","_sessionCorrelationId","logLevel","payload","mappedPayload","entries","map","entry","isNonPII","tag","toString","OneNote","run","application","_ClientLog","catch","getPlatform","CommonLogger","getServiceTokenByUserEmail","email","policy","serviceTokens","_GetServiceTokenByUserEmail","then","headerValue","extractTokenFromAuthHeader","accountInfoCollection","_GetAccountInfoCollection","accounts","uniqueEmails","Set","account","has","add","getAuthTypeForAccountType","accountType","userName","open","navigateToPageWithClientUrl","mailbox","item","body","prependAsync","prependAsyncResult","maybeOfficeJs","Office","getInstance","host","HostType","Outlook","getHost","platform","isCurrentHostOutlook","isMediaDownloadDisabled","PlatformType","Universal","Mac","iOS","isAppleDevice","isOfficeOnline","OfficeOnline","registerInitializeFunction","initializeFunction","initialize","isSsoSupportedThirdParty","getSsoTokenThirdParty","alreadyTimedOut","timer","auth","getAccessTokenAsync","forceAddAccount","forceConsent","displayDialog","startAddress","options","callback","ui","displayDialogAsync","getLanguage","displayLanguage","getTheme","officeTheme","getHostName","getAccounts","shouldDisplayCopyToButtons","queryParams","UrlUtils","getQueryParamsAsObject","outlookMode","Read","Write","Log","logger","signIn","onBeginSignIn","height","width","promptBeforeOpen","JSON","stringify","dialog","closeDialogAndResolvePromise","close","addEventHandler","EventType","DialogMessageReceived","args","origin","parse","localStorageIsSignedInKey","keys","localStorage","setItem","getErrorAsString","DialogEventReceived","dialogEvent","tryGetAccessTokenInfoWithoutUserAction","accessTokenInfo","tryGetSSOTokenForOfficeAddin","ssoToken","decoded","decodeO365JwtToken","userInfo","authContext","insertNote","note","onThemeChanged","handler","Microsoft","addHandlerAsync","WebExtension","OfficeThemeChanged","themeChangedEventArgs","registerThemeChangedEvent","startApp","getO365AccessTokenInfoFromLocalStorage","credentials","localStorageKey","getItem","cred","jsonInStorage","access_token","expires_in","redirectToAuth","isMsaAccount","shouldStopExecution","_cachedGlobal","getGlobal","useCached","globalThis","self","global","throwTypeError","TypeError","objCreateFn","obj","func","tmpFunc","getOTelLoggingUserContextFromUserInformation","tenantId","userId","userObjectId","userCid","userType","OrgIdPUID","MSACID","init","bootEvent","desiredLocale","referrer","referrerDomain","a","initLocalization","initLogging","_windowObj","registerWindowOnErrorLogger","registerUnhandledRejectionLogger","logWebPerfData","LocalizationService","changeLocale","DEFAULT_LOCALE","LocaleCompatibility","languageModuleMap","matchedLocale","compatibility","start","Date","now","finishWithSuccess","finishWithFailure","errorBucket","Errors","getLocalizationActivityError","_locale","_localeInfo","isRtl","getSupportedLocale","rawLocale","bestSoFar","points","NO_MATCH","locale","supportedLocale","compatibilityValue","getLocaleCompatibilityValue","EXACT_MATCH","systemLocale","toLocaleLowerCase","split","desiredLang","desiredCulture","lang","culture","POOR_MATCH","GOOD_MATCH","supportedLocaleInfo","localizationActivity","translationsCache","currentLocalePromise","defaultLocalePromise","translations","currentLocaleData","defaultLocaleData","updateLocale","getSupportedLocaleInfo","htmlElement","getElementsByTagName","textDirection","getLocalizedString","id","str","showLoadingSpinner","getLoadingPlaceholder","style","display","hideLoadingSpinner","getElementById","strShimFunction","strShimObject","strShimUndefined","strShimPrototype","strShimHasOwnProperty","strDefault","ObjClass","ObjProto","ObjAssign","ObjCreate","ObjDefineProperty","ObjHasOwnProperty","webpackAsyncContext","req","ids","supportsCSSVariables","CSS","supports","ServiceWorkerStatus","navigationStart","performance","timing","loggedFirstSync","isEdgeHub","onTelemetry","handleSyncTelemetry","handleMainMounted","handleDetailMounted","handleDBLoaded","styleType","onSDKSignOut","onNoteDeleted","onNotesUpdated","_","totalNotes","pageCount","syncedNotesCount","end","Type","Duration","TTFS","Start","End","TotalNotes","flushEvent","CustomEvent","detail","MessageId","Value","dispatchEvent","logResourceDownloadTelemetry","navigationTiming","getEntriesByType","resourceTimings","navigationTimingTelemetry","startTime","fetchStart","requestStart","responseEnd","transferSize","workerStart","resourceTimingTelemetry","initiatorType","serviceWorkerStatus","navigator","serviceWorker","controller","CONTROLLED","SUPPORTED","UNSUPPORTED","ResourceDownloadTelemetry","totalNotesCount","getRefreshTokenForSdkError","getToken","exchangeTokenForStickyNotesTokens","outlookToken","forceRefresh","userInfoToken","exchangeToken","isMsa","GetTokenFactory","createMsa","tokenInfo","getAccessTokenInfoFromCookie","createO365","StickyNotesExchangeToken","getAppTokenInfoForStickyNotes","setTokenCase","getSetTokenInSdkError","refreshTokensForSDK","layoutSDK","getTokensForSDK","getInitialTokensForSDK","getTokensForSdkActivity","authContextOutlookToken","stickyNotesToken","mailboxHint","setMSAAccessToken","userPuid","setAADAccessToken","showSessionExpired","getAuthTypeWithExtension","onSDKUnauthorizedCallback","tokenRefreshLock","onSessionExpired","refreshToken","layoutSDKOptions","renderNoteItem","noteId","children","draggable","onDragStart","persist","notesSDK","getLocalNote","getAsHtml","stopPropagation","htmlContent","dataTransfer","effectAllowed","setData","createLayoutSDK","setupComplete","setup","ready","langCode","changeLanguage","renderElementId","render","theme","enableDarkMode","getUserProfilePicture","getGraphUserInfoToken","graphToken","setGraphToken","login","O365ExchangeToken","isO365ExchangeTokenError","failureCase","ResourceIsDisabled","showExchangeLicenseUnavailable","onDetailViewChanged","hostApp","disableMediaDownload","isFeedEnabled","enableOneNotePages","noteReferenceOpenHandler","isHtmlRenderingEnabled","telemetrySink","telemetrySDKCallbacks","userContextForLogging","initializeAllIcons","loggingOptions","userIdType","oMSTenantId","appId","hostSessionId","GlobalVariables","environmentSettings","sessionId","samplingDisabled","ring","LayoutSDK","appName","appVersion","version","onSignedOut","onUnauthorized","onNoteDeleting","uniqueUserId","storage","showAppName","showAppHeader","allowEmptyNotesCollection","isConnectedNotesEnabled","noteListItemRenderWrapper","isNoteRefCachingEnabled","isRelatedNotesSectionEnabled","refreshTokenActivity","refreshAccessToken","ErrorType","GetAuthInfoError","MissingChannelIdInContextError","MissingWikiPagesOnImportRetryError","MissingChannelName","WhiteSpacesOnlyChannelName","EmptyChannelName","WikiMigrationPagesUndefined","WikiMigrationTimeoutError","WikiMigrationImageUrlMissingApiPath","WikiMigrationImageTooLargeError","WikiMigrationImageExceedingPageSizeLimitError","WikiMigrationImageExceedingPageDataPartLimitError","WikiMigrationOneNotePageNotBuiltError","WikiMigrationSectionQuotaExceededError","CreateAndCachePromiseError","TimeoutError","_super","ErrorWithType","_this","previousErrorTypes","setPrototypeOf","getBucket","allErrorTypes","join","executeWithTimeout","ms","actionDescription","timeoutError","_a","hasTimedOut","timeoutId","error_1","label","trys","sent","CompileTimeConstants","isRunningLocally","isLocal","windowIsTopLevelFrame","header","substring","GetMsaGraphUserPhoto","getUserPhoto","_graphAccessToken","_dimensions","GetO365GraphUserPhoto","graphAccessToken","dimensions","response","responseDiagnostics","blob_1","fetch","method","headers","getResponseDiagnostics","HttpResponseError","blob","fileReader","FileReader","addEventListener","readAsDataURL","GetUserPhotoWithCache","userPhotoGetter","cache","getWithSoftCaching","createKey","createLayoutSDKWrapper","onDetailViewChangedHandler","onSessionExpiredHandler","wrapper","LayoutSDKWrapper","isFocused","DisableOneNotePagesInFeed","noteReference","webUrl","metadata","clientUrl","DisableHtmlRendering","TeamsUtils","show","getRenderElement","hide","getLayoutSDK","signOutAndDestructUI","signOut","focus","focusSDK","MoreOptionsWrapperDiv","div","colors","moreOptionsDivBackGroundColor","MoreOptionsUserPhotoImg","img","MoreOptionsProfileSectionsDiv","MoreOptionsUpnLabel","fontFamily","font","moreOptionsUpnLabelColor","MoreOptionsButton","button","signOutBtnTextColor","signOutBtnBackGroundColor","signOutBtnHoverColor","MoreOptionsButtonLabel","MoreOptionsAccountNameDiv","defaultUserIconSrc","getPhotoSrc","props","userPhotoSrc","signOutLocalizedString","alt","title","onClick","onSignOut","Icon","iconName","className","ExpandableMoreOptionsDiv","ExpandableMoreOptionsBtn","expandableMoreOptionsColor","ExpandableMoreOptionsBtnLTR","ExpandableMoreOptionsBtnRTL","ExpandableMoreOptionsBtnLabel","expandableMoreOptionsLabelColor","hideOptions","setState","expanded","toggleOptionsVisibility","state","getExpandableButton","expandableButton","setExpandableButtonRef","node","isRTL","moreOptionsTitleLocalizedString","ref","Callout","setInitialFocus","isBeakVisible","gapSpace","onDismiss","FocusTrapZone","isClickableOutsideFocusTrap","forceFocusInsideTrap","fontFamilyObject","fontFamilyAppleObject","lightTheme","signInTitleColor","signInDescriptionColor","signInBtnBackGroundColor","signInBtnTextColor","signInBtnHoverColor","selectAccountLabelColor","useAnotherAccountBtnTextColor","useAnotherAccountBtnBackGroundColor","useAnotherAccountBtnHoverColor","sessionExpiredTitleColor","sessionExpiredDescriptionColor","useAnotherAccountBtnBorder","darkTheme","SessionExpiredImg","SessionExpiredTextDiv","SessionExpiredTitleLabel","SessionExpiredDescriptionLabel","SessionExpiredBtnDiv","SessionExpiredReloadBtn","SessionExpiredLaterBtn","sessionExpiredPngLightsrc","sessionExpiredPngDarksrc","onLaterClick","onSessionExpiredLaterClick","titleString","descriptionString","reloadBtnString","laterBtnString","tabIndex","targetOrigin","protocol","officetargetOrigin","requestAuthenticationViaTeams","authUrl","AuthUrl","owlRequest","postMessage","isHostedOnTeams","userAgent","indexOf","elementIdToFocus","AccountButtonWrapper","AccountButtonEmailDiv","onAccountButtonPressed","signInToAccount","SignInBtnWrapperDiv","SignInButton","SelectAccountLabel","UseAnotherAccountButton","UseAnotherAccountLabelLTR","UseAnotherAccountLabelRTL","AccountWrapperDiv","localStorageInterval","accountInfo","onSignInComplete","showSignInDialog","onSignInButtonPressed","signInDialog","redirectUrlWithoutParam","redirectUrl","setDevParametersIfNeeded","signInUrl","getSignInUrl","mergeQueryParamsIntoUrl","signInWithWindowOpen","signInWithTeams","endSignIn","setLocalStorageAuthCompletionListener","cleanUpSignInWindow","_reject","signInWindow","handle","setInterval","closed","clearInterval","removeItem","signInLocalizedString","selectAccountLocalizedString","useAnotherAccountLocalizedString","SignInImg","SignInTextDiv","SignInTitleLabel","SignInDescriptionLabel","signInPngSrc","imageAltLocalizedString","titleLocalizedString","descriptionLocalizedString","isSessionExpired","onDetailViewChangeHandler","unboundedOnDetailViewChangeHandler","signInStatus","suppressWarning","stickyNotesFrame","iframe","getSignOutUrl","language","layoutSDKWrapper","initialStickyNotesFrameOnBoot","detailViewVisible","sessionExpired","componentDidUpdate","_prevProps","prevState","themeChange","updateNonReactElementVisibility","fetchAndSetUserPhoto","componentWillMount","componentDidMount","setFocus","ele","isDetailViewVisible","isDark","backgroundColor","updateHeight","shouldShowSDK","isVisible","appElement","documentElement","setProperty","palette","themePrimary","themeDarkAlt","themeDark","ConsoleLogger","AppIntegrationSetup","deviceID","generateGuid","Math","random","getDeviceID","localStorageAvailable","existingDeviceId","AriaTokens","OTelTokens","ONDC_NOTES_INTEGRATION_ARIA_TENANT","ONENOTE_NEXUS_TENANT_TOKEN","ONDC_NOTES_INTEGRATION_OTEL_TENANT","eventProperties","isExportable","buildContext","commonContext","SessionId","CorrelationId","correlationId","Ring","Version","Language","areLocalizationValuesReady","TextDirection","sink","rest","otelLoggerOptions","appID","tenantID","tenantNameSpace","nexusTenantToken","transmitProfile","officeApplicationNumber","otelLogger","OTelLogger","isInitialized","flushLogs","setAgaveHostApp","logONDCReportData","Context","otherProperties","finalContext","eventProps","eventFlags","buildEventFlags","finalItem","ExpirationDate","Perpetual","IsExportable","HostApp","logONDCUnexpected","logItem","setUserContext","otelUserContext","dataCategories","diagnosticLevel","samplingPolicy","sessionCorrelationId","commonLogger","Namespace","ShortEventName","ErrorCode1","errorCode1","ErrorCode2","errorCode2","ErrorTag","errorTag","SessionCorrelationId","audience","Dogfood","formattedMessage","LogMessageFormatter","format","Message","otelUserContextForLogging","loggerInstance","getDefaultEpochExpiryInSeconds","userInfoCacheConstantKey","userInfoCache","userPhotoCache","exchangeTokenCache","implicitAuthCache","clearCaches","clear","ExampleSettingOnlyTrueInInternal","EnvironmentSettings","settingsForClient","Locale","ServerSidePerfMetrics","GraphResourceUri","OutlookResourceUri","OneNoteResourceUri","SettingsForClient","isEdgeHubQueryParamPresent","isServiceWorkerEnabled","isMsaAccountLogin","shellApiError","shellLoadingError","getInitialTokenFetchError","oAuthToken","OAuth","substrateNotesToken","tryGetOAuthTokenInfoWithoutUserAction","tryGetOAuthTokenWithoutUserAction","oAuthTokenInfo","userInfoGetter","getUserInfo","getO365AccessToken","isTokenExpired","getMsaImplicitFlowCredentials","userInfoCacheWithExpiry","getWithExpiry","getSSOTokenFirstPartyForUser","Resource","GraphNotes","graphUserToken","MsaImplicitAuthScope","NotesInternalReadWrite","substrateToken","msaUser","getSSOTokenFirstPartyMsa","aadUser","setInCache","oneNoteToken","getSSOTokenFirstPartyOrgId","getAccessTokenSSO","scope","OfficeFirstPartyAuth","debugging","authFlow","load","tokenParams","authChallenge","behaviorParam","popup","getAccessTokenAADSSO","getAccessTokenMSASSO","getSSOTokenInfoONO","webAuth","getAuthContextAsync","authorityType","msaCommonAuthImplicitCredentials","o365CommonAuthAccessToken","extendStaticsFn","b","__proto__","Array","__extendsFn","__","constructor","String","__spreadArrayFn","to","from","il","_objDefineProperty","_objFreeze","freeze","_objKeys","seal","StringProto","_strTrim","_strEndsWith","_dataToISOString","_isArray","isArray","_objToString","_fnToString","_objFunctionString","rCamelCase","rNormalizeInvalid","rLeadingNumeric","_objGetPrototypeOf","isUndefined","isNullOrUndefined","isNotNullOrUndefined","prop","isObject","isFunction","normalizeJsName","isString","_all","letter","toUpperCase","match","objForEachKey","callbackfn","strEndsWith","searchLen","valLen","pos","lp","_strEndsWithPoly","strContains","isError","isBoolean","isPlainObject","proto","newProto","_getObjProto","arrForEach","arr","thisArg","len","idx","arrIndexOf","searchElement","fromIndex","max","abs","strTrim","_objKeysHasDontEnumBug","propertyIsEnumerable","_objKeysDontEnums","objKeys","objType","dontEnumsLength","objDefineAccessors","getProp","setProp","descriptor","configurable","set","_doNothing","objFreeze","dateNow","dt","getTime","setValue","field","valChk","srcChk","theValue","getCfgValue","defaultValue","isTruthy","throwError","_createProxyFunction","source","funcName","srcFunc","originalArguments","arguments","proxyFunctionAs","theFunc","overwriteTarget","_isTrident","_navUserAgentCheck","_enableMocks","getGlobalInst","gbl","hasWindow","Boolean","getWindow","getDocument","hasNavigator","getNavigator","getPerformance","hasJSON","getJSON","isIE","nav","dumpObj","objectTypeDump","propertyValueDump","stack","_aiNamespace","getDebugExt","config","disableDbgExt","_sanitizeDiagnosticText","_logToConsole","theConsole","logFunc","_InternalLogMessage","msgId","msg","isUserAct","properties","strProps","diagnosticText","dataType","DiagnosticLogger","identifier","queue","_loggingLevelConsole","_loggingLevelTelemetry","_maxInternalMessageLimit","_enableDebugExceptions","_messageCount","_messageLogged","_self","_logInternalMessage","severity","logMessage","messageKey","_debugExtMsg","throttleLimitMessage","throttleMessage","dbgExt","loggingLevelConsole","loggingLevelTelemetry","maxMessageLimit","_setDefaultsFromConfig","consoleLoggingLevel","telemetryLoggingLevel","maxInternalMessageLimit","throwInternal","resetInternalMessageCount","__ieDyn","_getLogger","_throwInternal","PerfEvent","payloadDetails","isAsync","theDetails_1","accessorDefined","childTime","childEvts","childEvt","exTime","ParentContextKey","ChildrenContextKey","PerfManager","manager","fire","perfEvent","doPerf","mgrSource","getSource","details","perfMgr","perfEvt","currentActive","ex","_mwcSeeded","_mwcW","_mwcZ","_mwcSeed","seedValue","_autoSeedMwc","random32","signed","getRandomValues","Uint32Array","mwcRandom32","floor","newId","maxLength","number","chars","charAt","_dataUid","_canAcceptData","_getCache","theCache","_createAccessor","createUniqueNamespace","includeVersion","createElmNodeData","accept","defValue","addDefault","kill","_supportsCookies","_allowUaSameSite","_parsedCookieValue","_doc","_cookieCache","_globalCookieConfig","_gblCookieMgr","inst","createCookieMgr","_isMgrEnabled","cookieMgr","isEnabled","_isIgnoredCookie","cookieMgrCfg","ignoreCookies","rootConfig","cookieMgrConfig","cookieDomain","cookiePath","cookieEnabled","_createCookieMgrConfig","_path","path","_domain","domain","_enabled","enabled","areCookiesSupported","gblManager","maxAgeSec","blockedCookies","_isBlockedCookie","values","_extractParts","_isIE","expireMs","expiry","setTime","_formatDate","location_1","checkForMock","mockLocation","getLocation","uaDisallowsSameSiteNone","setCookie","_setCookieValue","_formatCookieValue","getCookie","_getCookieValue","del","purge","delCookie","exception","thePart","theDate","cookieValue","theCookie","rRemoveEmptyNs","rRemoveTrailingEmptyNs","_guid","elmNodeData","eventNamespace","_normalizeNamespace","_getEvtNamespace","evtNamespace","theNamespace_1","parsedEvent","exec","sort","_getRegisteredEvents","evtName","aiEvts","registeredEvents","eventOn","handlerRef","useCapture","_doAttach","registeredEvent","guid","capture","w","doc","_canUseCookies","_cookieMgrs","generateW3CId","tmp","hexValues","oct","clockSequenceHi","CoreUtils","isTypeof","theType","isDate","isNumber","toISOString","date","getUTCFullYear","pad","num","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","toFixed","_toISOStringPoly","arrMap","results","arrReduce","initialValue","objCreate","disableCookies","_legacyCookieMgr","newGuid","uuid","perfNow","perf","randomValue","maxValue","mwcRandomSeed","legacyCanUseCookies","mgr","pluginStateData","_getPluginState","plugin","_chainId","_createInternalContext","telemetryChain","core","startAt","_nextProxy","_onComplete","proxy","createTelemetryProxyChain","_getNextProxyStart","_next","nextProxy","onComplete","completeDetails","diagLog","safeGetLogger","getCfg","getExtCfg","_getExtCfg","getConfig","extConfig","hasNext","getNext","setNext","nextPlugin","iterate","cb","that","_i","mergeDefault","theConfig","newConfig_1","objExtend","obj1","obj2","obj3","obj4","obj5","obj6","theArgs","extended","argLen","deep","arg","isArgArray","isArgObj","propOk","newValue","isNewArray","clone","cfgValue","createProcessTelemetryContext","internalContext","env","plugins","firstProxy","lastProxy_1","thePlugin","newProxy","chainId","hasProcessTelemetry","hasSetNext","proxyChain","getPlugin","processTelemetry","itemCtx","_processChain","_getTelCtx","pluginState","unload","unloadCtx","unloadState","hasRun","pluginCore","update","updateCtx","updateState","_id","_setNext","processPluginFn","hasRunContext","nextId","hasNextRun","createTelemetryPluginProxy","BaseTelemetryPlugin","_isinitialized","_rootCtx","_nextPlugin","_unloadHandlerContainer","_hooks","currentCtx","rootCtx","_setDefaults","pluginChain","_initDefaults","handlers","extensions","unloadDone","theUnloadCtx","createProcessTelemetryUnloadContext","theUnloadState","reason","_unloadCallback","oldHooks","fn","rm","updateDone","theUpdateCtx","createProcessTelemetryUpdateContext","theUpdateState","_doUpdate","_updateCallback","_addHook","hooks","concat","setInitialized","next","RegisteredFileTypes","RegisteredFileTypesTrie","isWord","word","find","RegisteredFileTypes_1","fileType","index","letterMap","_emailRegex","_directoryRegex","_formatRegex","PrivacyGuardInternal","_customLocalValues","_isEnabled","_scanForUrls","_enableAdvancedScans","_userNameParts","_fileTypesTrie","_base","makeIdentifierRegex","RegExp","generatePrettyNameParts","ignoredNameParts","nameParts_1","namePart","isContainedAsIsolatedWord","startCharIndex","lastCharIndex","nextChar","charCodeAt","isAlphaCharacter","char","containsAnyAlphabets","getEmailType","emailMatch","isStringInValue","valueToCheck","stringToLookup","startIndex","coreConfig","disableAdvancedScans","scanForUrls","updateCommonContext","setEnabled","freshCommonContext","UserName","IgnoredNameParts","UserNames","uname","UserAlias","stringIsolatedWord","concern","UserAliases","_b","_c","alias","MachineIds","_d","_e","machineId","stringValue","OutOfScopeIdentifiers","_f","_g","regexpValue","getAllPrivacyConcerns","baseTypeName","fieldName","fieldValue","characteristics","hasAlphabets","hasAtSign","hasBackslash","hasDash","hasDot","hasFileUrl","hasFileSharingConcern","hasFormatChars","hasForwardSlash","hasHttp","hasPercentage","hasSecurityAccessTokenConcern","hasSecuritySignatureConcern","hasUnderscore","currentCharIndex","currentChar","getAllTextCharacteristics","Concern","EventName","BaseType","FieldName","matches","concerns","getFilePathConcerns","previousDot","nextDot","nextUnderscore","nextSeparator","min","checkForFiles","hasEmailRegexMatch","commonPrivacyContextsResult","upperCaseValue","hasUserAlias","toMatch","checkForPrivacyContexts","anyMatchedParts","PrivacyGuardPlugin","priority","_pgInternal","_core","_iKey","_notificationEventName","_summaryEventName","_useFieldPrefix","_useAbsoluteFieldName","_concernsNotified","_eventsIgnored","_eventsInspected","_fieldsInspected","_manualConfig","_manualEnabled","_manualCommonContext","initInternal","configuration","notificationEventName","summaryEventName","iKey","useEventFieldPrefix","useAbsoluteFieldName","getStatsInternal","useFieldPrefix","PG_ConcernsNotified","PG_EventsIgnored","PG_EventsInspected","PG_FieldsInspected","ConcernsNotified","EventsIgnored","EventsInspected","FieldsInspected","DataConcernTypeToString","extensionConfig","reset","isPrivacyGuardEnabled","baseType","processObject","parentKey","toProcess","propKey","notifyConcerns","processNext","sendSummaryEvent","shouldResetSummary","pgEvent","ext","privTags","privLevel","track","concerns_1","PG_EventName","PG_FieldName","PG_TypeAsText","PG_BaseType","TypeAsText","_doTeardown","getStats","makeBooleanDataField","classification","makeDataField","makeInt64DataField","makeDoubleDataField","makeStringDataField","extendStatics","__assign","assign","_listeners","notificationHandler","fireEvent","listener","addListener","logNotification","level","category","logError","errorMessage","tenantTokens","setTenantTokens","telemetryProperties","ariaTenantToken","dnmToken","fillTenantTokens","indexOfCharacterAfterNamespace","namespaceCandidate","substr","storedTelemetryProperties","lastIndexOf","EventNameRegex","AlphanumericRegex","validateTelemetryEvent","isEventNameValid","eventContract","isNameValid","validateDataFields","dataFields","dataField","isFinite","validateInt","cloneEvent","localEvent","timestamp","SimpleTelemetryLogger","persistentDataFields","telemetrySinks","partAFields","eventQueue","addEventContentType","eventContentType","clonedEvent","sendTelemetryEventInternal","sendCustomerContent","customerContentEvent","customerContentVersion","sendDirectNumericEvent","directNumericEvent","eventType","customerContentType","enableQueue","processTelemetryEvent","sendNonStandardEvent","unshift","disableValidation","addSink","flushQueue","eventQueue_1","setTenantToken","setDNMToken","getFullFieldName","instanceName","addStringDataField","dataClassification","addBooleanDataField","addInt64DataField","Platform","Result","contract","isExpected","Activity","contractName","getFields","cV","duration","count","aggMode","success","User","primaryIdentityHash","primaryIdentitySpace","tenantGroup","isAnonymous","isSignedIn","AudienceGroup","App","Session","ecsETag","Capability","FeatureActionType","Copilot","Release","audienceGroup","featureActionType","isUserInitiated","featureName","capability","isThumbsUp","getCurrentMicroseconds","baseCv","createActivity","activityProperties","_ended","_startTime","cv","parentCv","createChildActivity","setResult","endNow","endTime","activity","newDataFields","errorGroup","CV","nextChild","TelemetryLogger","characters","getBaseCv","__extends","sendActivity","activityName","sendError","createCustomerContentActivity","checkValue","chkLen","functionsToProxy","theFuncName","theObject","addOneDSFields","fields","prependDataToken","validEvent","_loop_1","fieldClassification","fieldDataType","modifiedFieldName","CONTRACT_TOKEN","eventPropertyType","eventProperty","propertyType","fields_1","logInvalidField","isNonEmptyString","matchesEnum","enumType","includes","isValidAppPlatform","isValidReleaseAudienceGroup","isValidPrimaryIdentitySpace","isOtherIfDefined","areCoreFieldsValid","strict","isValid","validateField","validate","isValidGuid","theClass","supported","product","sendBeacon","withKeepAlive","isSupported","XDomainRequest","Obj","_objGetOwnProps","_dynamicNames","_hasOwnProperty","_isObjectOrArrayPrototype","_isObjectArrayOrFunctionPrototype","Function","curProto","_forEachProp","name_1","_isDynamicCandidate","skipOwn","_throwTypeError","_hasVisited","_getInstFunc","currentDynProtoProxy","instFunc","instFuncTable","canAddInst","objProto","visited","protoFunc","_getProtoFunc","_populatePrototype","baseInstFuncs","setInstanceFunc","instFuncs_1","dynProtoProxy","_createDynamicPrototype","_getObjName","unknownValue","dynamicProto","delegateFunc","classProto","thisTarget","thisProto","_checkPrototype","perfOptions","useBaseInst","instFuncs","_getInstanceFuncs","_instFuncProxy","funcHost","baseFuncs","baseProto","_getBaseFuncs","setInstFuncs","messageId","_getConfigValue","enableDebugExceptions","logInternalMessage","warnToConsole","errorToConsole","cookieCfg","nodeType","events","unRegFn","theEvent","theNamespace","namespaces","evtName_1","found_1","eventCache","evtType","regEvent","excludeEvents","added","OneDSEndpoint","oneDSHelperProperties","eventsProcessed","eventsSent","eventsDiscarded","_preprocessors","_optionalEventsEnabled","_diagnosticLevelChecker","processEvent","_helperPersistentOneDSDataFields","_oneDSSinkSessionId","_disableSinkOnInvalidCoreFields","begin","getOneDSTelemetryEvent","getOneDSEventInternal","getOneDSCustomerContent","internalEvent","preprocessors","_loop_2","preprocessor","state_2","preprocessEvent","eventTime","getTenantToken","time","sdk","seq","addPreprocessor","getOneDSPersistentDataFields","getPreprocessors","addPersistentDataFields","setOptionalEventsEnabled","setFullEventsEnabled","enableOptionalEvents","coreFields","app","user","session","release","isChildEvt","getCtx","setCtx","complete","invalidValue","processContext","initPlugins","lastPlugin","extA","extB","bHasProcess","createNew","setNextPlugin","teardown","_addChannelQueue","channelQueue","queueItem","chain","getProcessTelContext","TelemetryInitializerPlugin","_initializers","addTelemetryInitializer","telemetryInitializer","theInitializer","remove","initializer","doNotSendItem","telemetryInitializersCount","defaultInitConfig","_createPerfManager","notificationMgr","_validateExtensions","channelPriority","allExtensions","coreExtensions","extPriorities","extPriority","_isPluginPresent","exists","_runListeners","listeners","NotificationManager","perfEvtsSendAll","sendReason","AppInsightsCore","_notifyInvalidEvent","telemetryItem","getNotifyMgr","notificationManager","getPerfMgr","_validateTelemetryItem","BaseCore","_isInitialized","_eventQueue","_notificationManager","_perfManager","_cfgPerfManager","_cookieManager","_pluginChain","_configExtensions","_coreExtensions","_channelControl","_channelConfig","_channelQueue","_isUnloading","_telemetryInitializerPlugin","_internalLogsEventName","_evtNamespace","_unloadHandlers","_debugListener","_traceCtx","_internalLogPoller","_extensions","_createTelCtx","_getPluginChain","_initPluginChain","theExtensions","channels","extensionQueue_1","createChannelQueues","_setQueue","_processChannelQueue","theChannels","processFn","waiting","_runChainOnComplete","channelChain","chainCtx","getChannel","pluginIdentifier","flush","callBack","cbTimeout","doneIterating","cbTimer","doCallback","handled_1","createChannelControllerPlugin","_updateHook","_getPlugin","theExt","removeCb","pluginsToRemove","_removePlugins","removed","thePlugins","removeComplete","newConfigExtensions","newChannelConfig","newQueue","channel","_flushInternalLogs","instrumentationKey","baseData","_flushChannels","_logOrThrowError","_initDebugListener","enablePerfMgr","_initPerfManager","_initExtConfig","releaseQueue","getTransmissionControls","controls","getCookieMgr","setCookieMgr","createPerfMgr","setPerfMgr","eventCnt","pollInternalLogs","interval","diagnosticLogInterval","stopPollingInternalLogs","unloadComplete","flushComplete","processUnloadCtx","_doUnload","addPlugin","replaceExisting","addCb","existingPlugin","_addPlugin","removedPlugins_1","getTraceCtx","parentCtx","trace","getName","setName","getTraceId","traceId","setTraceId","getSpanId","spanId","setSpanId","getTraceFlags","traceFlags","setTraceFlags","newTraceFlags","setTraceCtx","traceCtx","_fieldTypeEventPropMap","isValueAssigned","getTenantId","apiKey","indexTenantId","isLatency","sanitizeProperty","stringifyObjects","propType","isArrayValid","kind","isValueKind","getCommonSchemaMetaData","encodedTypeValue","isDataType","getFieldValueType","extend","arrayValue","arrayIndex","setProcessTelemetryTimings","evt","timings","processTelemetryStart","pluginVersionStringArr","pluginVersionString","endpointUrl","propertyStorageOverride","getProperty","ver","getWParam","logger_1","trackStart","latency","itemExt","itemProperties","enumClass","EventsDiscardedReason","Unknown","NonRetryableStatus","InvalidEvent","SizeLimitExceeded","KillSwitch","QueueFull","_getEventMsfpc","intWeb","theEvents","msfpc","EventBatch","addEvents","_msfpc","Msfpc","addEvent","fromEvent","numEvents","cnt","MaxBeaconRecordSize","rCheckDot","Serializer","perfManager","valueSanitizer","enableCompoundKey","_checkForCompoundkey","_theSanitizer","_isReservedCache","_processPathKeys","srcObj","thePath","checkReserved","metadataPathKeys","metadataCallback","processSubKeys","srcValue","theMetaPathKeys","destObj","subKeys","keyLen","subKey","_isReservedField","handleField","newPath","createPayload","retryCnt","isTeardown","isSync","useSendBeacon","sendType","apiKeys","payloadBlob","overflow","sizeExceed","failedEvts","batches","isBeacon","appendPayload","theBatch","maxEventsPerBatch","canAddEvents","payloadEvents","eventsAdded","sizeExceeded","isBeaconPayload","requestMaxSize","recordMaxSize","joinCount","eventBlob","getEventBlob","blobLength","evts","eventData","serializedEvent","serializedExt","eventExt","serializedData","serializedBaseData","pathKeys","_addJSONPropertyMetaData","json","propKeys","propertyValue","metaData","f","metaTarget","newTarget","retryPolicyGetMillisToBackoffForRetry","retriesSoFar","waitDuration","randomBackoff","BaseBackoff","pow","_killedTokenDictionary","setKillSwitchTenants","killTokens","killDuration","killedTokens","_normalizeTenants","durationMs","isTenantKilled","tenantToken","killDictionary","ClockSkewManager","_allowRequestSending","_shouldAddClockSkewHeaders","_isFirstRequest","_clockSkewHeaderValue","_clockSkewSet","allowRequestSending","firstRequestSent","shouldAddClockSkewHeaders","getClockSkewHeaderValue","setClockSkew","timeDeltaInMillis","_eventActionMap","_collectorQsHeaders","_collectorHeaderToQs","_addCollectorHeaderQsMapping","qsName","headerName","allowQs","_getResponseText","xhr","responseText","_hasHeader","hasHeader","lowerHeader","_addRequestDetails","useHeaders","hdrs","useHdrs","HttpManager","maxConnections","maxRequestRetriesBeforeBackoff","actions","timeoutOverride","_responseHandlers","_postManager","_sendInterfaces","_cookieMgr","_xhrTimeout","_disableXhrSync","_urlString","_killSwitch","_paused","_clockSkewManager","_useBeacons","_outstandingRequests","_customHttpInterface","_queryStringParameters","_headers","_batchQueue","_serializer","_enableEventTimings","_useHeaders","_sendCredentials","_getSenderInterface","transports","syncSupport","transportType","sendPostFunc","_xdrSendPost","_xhrSendPost","_fetchSendPost","_beaconSendPost","_transport","_isSync","sendPOST","oncomplete","xdr","urlString","_doOnComplete","_handleCollectorResponse","ontimeout","onprogress","send","theUrl","ignoreResponse","responseHandled","requestInit","keepalive","_sendReason","headerMap","_appendHeader","theHeaders","getResponseHeader","_getAllResponseHeaders","headersString","getAllResponseHeaders","headerEntry","xhrComplete","responseTxt","disableXhrSync","xhrRequest","withCredentials","disabled","_wrapSetXhrProp","XMLHttpRequest","openXhr","setRequestHeader","thePayload","_thePayload","nav_1","droppedBatches_1","_sendBatchesNotification","_isBeaconPayload","_adjustSendType","_hasIdleConnection","_clearQueue","theQueue","_canSendPayload","theBatches","_createDebugBatches","_sendBatches","retryCount","orgBatches_1","isSynchronous_1","droppedBatches","serializationStart","sendInterface","isBeaconTransport","_doPayloadSend","isSynchronous","_buildRequestDetails","requestDetails","apiQsKeys","encodeURIComponent","_getMsfpc","wParam","_setTimingValue","serializationCompleted","useSendHook_1","sendHook","sendInterface_1","useHeaders_1","requestDetails_1","sendEventStart_1","batchLp","evtLp","orgPayloadData","sender","httpStatusCode","isRetrying","backOffTrans","shouldRetry","killToken","removedEvents","retryCount_1","_doAction","batchReason","_backOffTransmission","_clearBackOff","sendEventCompleted_1","sendEventCompleted","_addCompleteTimings","sendQueuedRequests","_handleRequestFinished","_retryRequestIfNeeded","sendListener","hookData_1","senderCalled_1","responseHandlers","webResult","sendSync","theAction_1","action","isSyncRequest_1","postChannel","httpInterface","channelConfig","avoidOptions","disableEventTimings","xhrTimeout","syncHttpInterface","beaconHttpInterface","alwaysUseXhrOverride","fetchSyncHttpInterface","theTransports","configTransports","addQueryStringParameter","addHeader","canSendRequest","isCompletelyIdle","setUnloading","addBatch","pause","resume","sendSynchronousBatch","batch","defaultSetTimeout","defaultClearTimeout","createTimeoutWrapper","argSetTimeout","argClearTimeout","PostChannel","_config","_xhrOverride","_httpManager","_autoFlushEventsLimit","_autoFlushBatchLimit","_delayedBatchReason","_timeoutWrapper","_isTeardownCalled","_flushCallbackQueue","_flushCallbackTimerId","_immediateQueueSize","_immediateQueueSizeLimit","_queueSize","_queueSizeLimit","_profiles","_currentProfile","_scheduledTimerId","_immediateTimerId","_currentBackoffCount","_timerCount","_batchQueues","_delayedBatchSendLatency","_optimizeObject","_isPageUnloadTriggered","_maxEventSendAttempts","_maxUnloadEventSendAttempts","_handleUnloadEvents","_releaseAllQueues","_handleShowEvents","_addEventToQueues","append","sendAttempt","evtLatency","queueSize","queueLimit","eventDropped","_addEventToProperQueue","dropLatency","dropNumber","currentLatency","eventBatch","_getEventBatch","droppedEvents","droppedCount","_notifyBatchEvents","_resetQueueCounts","_dropEventWithLatencyOrLess","_notifyEvents","_sendEventsForLatencyAndAbove","queued","_queueBatches","_hasEvents","_scheduleTimer","immediateTimeOut","_createTimer","timeOut","requeue","_requeueEvents","_sendingEvent","_eventsSentEvent","drop","_eventsDropped","rspFail","_eventsResponseFail","oth","_otherEvent","_initializeProfiles","iKeyMap","_setAutoLimits","theTimerFunc","timerMultiplier","_clearScheduledTimer","batchQueue","_performAutoFlush","doFlush","immediateQueue","normalQueue","eventsQueued","latencyToProcess","maxSendAttempts","_callNotification","notifyFunc","extraArgs","isSyncRequest","disableAutoBatchFlushLimit","MaxNumberEventPerBatch","extendedCore","setTimeoutOverride","clearTimeoutOverride","disableOptimizeObj","existingGetWParamMethod","wparam","ignoreMc1Ms0CookieProcessing","_hookWParam","eventsLimitInMem","immediateEventLimit","autoFlushEventsLimit","httpXHROverride","anonCookieName","payloadPreprocessor","payloadListener","overrideEndpointUrl","excludePageUnloadEvents","disablePageUnloadEvents","newNamespaces","pageUnloadAdded","visibilityState","pageShowAdded","disablePageShowEvents","ev","disableTelemetry","setEventQueueLimits","eventLimit","autoFlushLimit","addResponseHandler","responseHandler","_loadTransmitProfiles","profiles","profileName","profileValue","profLen","directValue","ceil","async","_flushImpl","_waitForIdleManager","cleared","setMsaAuthTicket","ticket","hasEvents","_setTransmitProfile","callbacks","_callbacks","handleSendBatches","handlePrivacyGuardNotification","_key","_value","requestProcessingStats","eventCount","privacyGuardStats","ApplicationInsights","_postChannel","channelConfiguration","setUploadFrequency","uploadFrequency","normalLatencyFrequency","realtimeLatencyFrequency","customProfiles","shutdown","OneDSSink","oneDSSinkProperties","_applicationInsights","errorReturn","tryCatch","_customerContentEvent","isHandled","nonStandardEventHandlers","canHandle","oneDSSink","applicationInsights","appInsightsConfig","enableWParam","disableCookiesUsage","stats","networkStats","originalPayload","modifiedPayload","actualPayload","notificationListener","addNotificationListener","getAppInsights","disableStatsTracking","Sampler","sampleRate","enableWithIdentifier","samplingKey","samplingValue","hash","getDjb2Hash","computeSamplingValue","enableWithSamplingValue","isNaN","enableWithRandomValue","byteArray","crypto","setSampleRate","getSamplingValue","isMeasuresEnabled","addSampleRateField","reportedSampleRate","RingBuffer","capacity","getNextIndex","buffer","tailIndex","toArray","namespaceRegex","nameRegex","propertyTests","logItemTests","assertValidProperties","tests","pattern","assertValidProperty","assertValidLogItem","AWTSessionState","DataBoundary","getPerformanceNavigationEntries","navigationEntries","performanceNavigationTimingEntries","PerformanceNavigationTiming","connection","mozConnection","webkitConnection","getNetworkType","effectiveType","defaultOtelLoggerOptions","isEUDBRoutingEnabled","samplingRate","isOptionalEventsEnabled","privacyGuard","otelSink","traceBuffer","optionsWithDefaults","createLogger","logSession","Started","Ended","flushLogsAndTeardown","SamplePolicy","getSamplePolicy","withLogger","createDataFields","traceEventFlags","logTriggerProperties","nonCriticalTraceEvents","flushTraceBuffer","createUnexpectedProperties","logTrace","TraceTime","sessionState","getSessionLogItem","activityEventFlags","useActivityNameInEventName","dataBoundary","endPointUrl","PUBLIC","getDataBoundary","getEndPointUrl","createOTelSink","addSinkToLogger","updatePrivacyGuardContext","getSessionId","flushingLogsCompleted","itemContext","sessionNamespace","sessionContext","perfNavigationEntries","fetchTime","SessionState","SessionFirstLaunchTime","NetworkType","SessionDuration","getSessionEndContext","buildCommonDataFields","privacyGuardConfig","defaultSink","sampler","domainValue","mailHrdApi","queryParam","telemetryRegion","fetchRequest","error_2","addQueryParam","Headers","ok","collectorUri","EMEA","EUDB","USGOV_DOD","USGOV_DOJ","GLOBAL","CUSTOMER_CONTENT","buildUserFields","buildPersistentDataFields","persistentPropertiesFromOptions","appFields","appPlatform","sessionFields","convertToOTelDataFields","persistentPropertiesFromOptionsForOtherSinks","buildCommonItemProperties","Critical","assertValidCommonProperties","primitiveProperties","hasLogger","isCriticalEvent","triggerProperties","dataCtx","Measure","msaSilentAuth","getAccessTokenForScopes","GraphUserRead","getOneNoteUserInfoToken","OneNoteUpdate","scopes","OutlookO365","getGraphToken","SilentAuthWithCacheFactory","ExchangeTokenWithCacheFactory","getForceSignInUrl","selectAccount","currentUrl","getMsaImplicitGrantSignInUrl","LOADING_PLACEHOLDER_ID","STICKY_NOTES_FRAME_ID","_gbl","_gblInst","USE_IMPLICIT_AUTH_FOR_MSA","GetUserInfoWithCache","GetGraphUserInfo","GetUserInfoFromO365JwtToken","createIfAuthenticated","GetUserInfoFactory","createGetUserInfo"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GACtBM,EAAiBN,EAAK,IAAM,GAGTO,EAAI,EAAGC,EAAW,GACpCD,EAAIJ,EAASM,OAAQF,IACzBL,EAAUC,EAASI,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBZ,IAAYY,EAAgBZ,IACpFM,EAASO,KAAKD,EAAgBZ,GAAS,IAExCY,E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,eAAe70B,KAAK,0FAFxB2K,EAAIkqB,eAAiBjqB,GAK3B,EAjBA,I,gCCPA,gOAKMkqB,EAAiC,WAAM,OAFVpkB,KAAKC,MAAQ,IACjB,MAKlBokB,EAA2B,WAI3BC,EAAgB,IAAI,IAAoDD,EAA0BD,GAElGG,EAAiB,IAAI,IAAoCF,EAA0BD,GACnFI,EAAqB,IAAI,IAAqD,gBAAiBJ,GAC/FK,EAAoB,IAAI,IAAkD,eAAgBL,GAEhG,SAASM,IACd,IAAIxqB,OAAO5K,KAAK,iCAChBg1B,EAAcK,QACdH,EAAmBG,QACnBF,EAAkBE,U,oBCvBpB,IAAI/vB,EAAM,CACT,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,uBAAwB,CACvB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,uBAAwB,CACvB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,uBAAwB,CACvB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,qBAAsB,CACrB,IACA,IAED,uBAAwB,CACvB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,4BAA6B,CAC5B,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,IAED,oBAAqB,CACpB,IACA,I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Q,QAAQ,EAErByQ,EAnL6B,GER7BiC,GAAsB,CAC7B,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,OACA,MACA,OACA,MACA,MACA,MACA,OACA,MACA,OACA,MACA,SACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,UACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,SACA,SACA,UACA,MACA,MACA,MACA,MACA,UACA,OACA,MACA,MACA,OACA,MACA,UACA,WACA,OACA,SACA,MACA,MACA,MACA,MACA,OACA,OACA,MACA,OACA,MACA,OACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,MACA,MACA,OACA,OACA,MACA,OACA,OACA,MACA,MACA,MACA,MACA,UACA,MACA,MACA,MACA,MACA,UACA,WACA,OACA,UACA,OACA,OACA,MACA,QACA,MACA,OAEAC,GAAyC,WACzC,SAASA,IACLt1C,KAAK0E,IAAM,GACX1E,KAAKu1C,QAAS,EACdv1C,KAAKyxB,eAAgB,EAqCzB,OAnCA6jB,EAAwB3+C,UAAU+H,OAAS,SAAU82C,GACjD,OAAOx1C,KAAKy1C,KAAKD,EAAM,EAAGx1C,OAE9Bs1C,EAAwB3+C,UAAU+X,KAAO,WACrC,IAAI1O,KAAKyxB,cAAT,CAGA,IAAK,IAAIme,EAAK,EAAG8F,EAAwBL,GAAqBzF,EAAK8F,EAAsBj/C,OAAQm5C,IAAM,CACnG,IAAI+F,EAAWD,EAAsB9F,GACrC5vC,KAAKqG,IAAIsvC,EAAU,EAAG31C,MAE1BA,KAAKyxB,eAAgB,IAEzB6jB,EAAwB3+C,UAAU0P,IAAM,SAAUmvC,EAAMI,EAAOC,GAC3D,GAAID,IAAUJ,EAAK/+C,OAOnB,OAHKo/C,EAAUnxC,IAAI8wC,EAAKnQ,OAAOuQ,MAC3BC,EA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OnW,GAAY+gF,EAAmBpoF,OAAOqH,EAAUkf,IAE3D,EAZA,GCPa8hE,EAAoB,SAAChhF,GAAuB,SAAmBrH,OAAOqH,EAAU","file":"stickynotesagave_b1715f0dfb47e732f661.min.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n \t\tvar prefetchChunks = data[3] || [];\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n \t\tdeferredPrefetch.push.apply(deferredPrefetch, prefetchChunks);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n \t\tif(deferredModules.length === 0) {\n \t\t\t// chunk prefetching for javascript\n \t\t\tdeferredPrefetch.forEach(function(chunkId) {\n \t\t\t\tif(installedChunks[chunkId] === undefined) {\n \t\t\t\t\tinstalledChunks[chunkId] = null;\n \t\t\t\t\tvar link = document.createElement('link');\n\n \t\t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\t\tlink.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t\t}\n \t\t\t\t\tlink.rel = \"prefetch\";\n \t\t\t\t\tlink.as = \"script\";\n \t\t\t\t\tlink.href = jsonpScriptSrc(chunkId);\n \t\t\t\t\tdocument.head.appendChild(link);\n \t\t\t\t}\n \t\t\t});\n \t\t\tdeferredPrefetch.length = 0;\n \t\t}\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t7: 0\n \t};\n\n \tvar deferredModules = [], deferredPrefetch = [];\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"\" + ({\"9\":\"vendors~commonlogger\",\"11\":\"vendors~textbox\"}[chunkId]||chunkId) + \"_\" + {\"9\":\"7b6144b6d1e114b14bec\",\"11\":\"3381901741d89a97d506\",\"12\":\"a9869fda36f397ece9f9\",\"13\":\"146e7efda9e23d3b59c6\",\"14\":\"ab630a3e7c1827b63cf9\",\"15\":\"7d6a77486d883c0df058\",\"16\":\"a99893405fdd527a1876\",\"17\":\"c376748f0bb39b4377d0\",\"18\":\"27a0ac11f3a4757d610b\",\"19\":\"7c354670aa1274387f0a\",\"20\":\"9a5319849bc866ee2316\",\"21\":\"6a0d3119f6888f8b8af4\",\"22\":\"cfb54fcb40299746d5cf\",\"23\":\"33376475bd496f0551f6\",\"24\":\"d9ed8149ae81cccc9b31\",\"25\":\"df21ab5b65d4ba16e69e\",\"26\":\"1a7e0831a7865ab9d403\",\"27\":\"74fe449a6bdc0231671d\",\"28\":\"8ea1d5dfd1e4a1a3af1f\",\"29\":\"33ed735d4462b23a084d\",\"30\":\"14be4d55b9f764bde186\",\"31\":\"18add887aa9d027411e7\",\"32\":\"ef581cde5cd128cbc221\",\"33\":\"fd31ba21a3d80867710d\",\"34\":\"ba4d683f36b14f51db8e\",\"35\":\"8718b3fcce3d17dd462a\",\"36\":\"2fcf1e7af1088f8546d3\",\"37\":\"11888305f0ba5e6e1259\",\"38\":\"110844f59e44c1fd10a3\",\"39\":\"59a86f403432f116b96e\",\"40\":\"bcfb22292f532f39b39c\",\"41\":\"b040130ef120a60c5435\",\"42\":\"9404f9bb6af2a2d5a2fe\",\"43\":\"73d665fe8c314e041e61\",\"44\":\"ac6d1faa6d361c640c99\",\"45\":\"786714904855a7b48bef\",\"46\":\"3d2fbbc4c6c8daadaacc\",\"47\":\"fafccee8e1066384deec\",\"48\":\"9576328dc6df22e08961\",\"49\":\"22263400b7b91738112c\",\"50\":\"03b5cd04bb9d7e538bca\",\"51\":\"4fcbab4a5761bbe29a86\",\"52\":\"38eac2ddd3436e1eb965\",\"53\":\"9207cb7ef1fdd58d4976\",\"54\":\"9c0e2aadcb87986e237f\",\"55\":\"afc9ece3f435f173b41f\",\"56\":\"f3702fb401319e7ec3dd\",\"57\":\"8e61d9ca44c09908a315\",\"58\":\"e5f09f8517e35c7e12ea\",\"59\":\"3ca16e53b69b0821621e\",\"60\":\"f64f5028fbb64c35abd1\",\"61\":\"5cb13233ef69cabb066d\",\"62\":\"26be7c78edaaf02fbf91\",\"63\":\"6e845d24ccd473fb93c7\",\"64\":\"0b81d1a12dd4787b7c2c\",\"65\":\"475f990222ed912b1541\",\"66\":\"7f0270fffb1552236184\",\"67\":\"0c6f9b041e36d3a98569\",\"68\":\"aa132af3566fae07f66a\",\"69\":\"3e839e3f511dedc0b00f\",\"70\":\"f784596edd3674e94655\",\"71\":\"4e6e30931a3ec3cc985c\",\"72\":\"b6a4edc53e0153cbab95\",\"73\":\"4dbcef37fb5a823b5a62\",\"74\":\"cb03b4196f4ec5c556a9\",\"75\":\"f2539ff18f66f5e13c4c\",\"76\":\"5aa4541ac1e83eccf63a\",\"77\":\"965cb61f98635a8b087c\",\"78\":\"6301968f7d797b47c0d5\",\"79\":\"5f8ac8709e8dc29687a7\",\"80\":\"e2bd459de40b51454d4e\",\"81\":\"f7d7d5de59be1a4c7039\",\"82\":\"6a587461c50994816668\",\"83\":\"88de8b8f9166ae178642\",\"84\":\"72150dc760e192f2a1ff\",\"85\":\"5dc2e1e1656d624640e8\",\"86\":\"0fc53655bc8c1a6ec65f\",\"87\":\"5cb0b904a6441eadffd1\",\"88\":\"5706380ac27b1535df22\",\"89\":\"65d6158bc89c75641897\",\"90\":\"7d720b205a8500c7dfd3\",\"91\":\"339ff8e29f33de9302fd\",\"92\":\"566a893fcc7358f3043e\",\"93\":\"dcf0087954cd64c7adf1\",\"94\":\"46cbb11e8ff83994083a\",\"95\":\"678c94fe6f7db58bd576\",\"96\":\"0f567b25e96eae9c40e4\",\"97\":\"0fa894714c5e231c55d5\",\"98\":\"a1b93d8b51dc8cc0e3ee\",\"99\":\"20211e46f3e7da933a01\",\"100\":\"b1a06658b7d7b563e9c9\",\"101\":\"39c5b987f41761dcb815\",\"102\":\"64ac03264aa7b31e17ee\",\"103\":\"b543a2a0f0b470d9083a\",\"104\":\"7bd9f9bb19ab8fb8b41e\",\"105\":\"f173bf9ad139fb3876ce\",\"106\":\"ba0c2b64837dd8b5f7f4\",\"107\":\"dec94cbfd56e896e2401\",\"108\":\"f9f7824c7446f2195aee\",\"109\":\"14737bcb9a226148e0ad\",\"110\":\"c3d6e8ac3b51abaa00a5\",\"111\":\"f57ca91102482a7760f3\",\"112\":\"b8026b93ff699380c598\",\"113\":\"4201e415f6cb8dd4227d\",\"114\":\"e4f817a8ebf841b9185b\",\"115\":\"cefeaefea9cf0f984f71\",\"116\":\"5d44717dbda8fe711477\",\"117\":\"baeb1d79083d30e52789\",\"118\":\"e82bebc3231711e7bf31\",\"119\":\"9693a423e5e61c8e2480\",\"120\":\"7bfbd84e6c73a89c69b6\",\"121\":\"4f97c4250e985542a0d8\",\"122\":\"bb488d46213890ccfad1\",\"123\":\"009d13c61b50dcc4693b\"}[chunkId] + \".min.js\"\n \t}\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 \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\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 \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \tvar startupResult = (function() {\n \t// add entry module to deferred list\n \tdeferredModules.push([1133,0,1]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n \t})();\n\n \twebpackJsonpCallback([[], {}, 0, [11]]);\n \treturn startupResult;\n","export enum AuthMethod {\r\n OAuth,\r\n HostSso,\r\n}\r\n\r\nexport interface IAuthContext {\r\n getAccessToken(): string,\r\n getSubstrateNotesToken(): string | undefined,\r\n refresh(): Promise,\r\n getAuthMethod(): AuthMethod\r\n}\r\n","export namespace Constants {\r\n export const sessionIdHeaderName: string = 'X-UserSessionId'\r\n\r\n export const protocolAndHostName: string = `https://${window.location.hostname}`\r\n\r\n export const stickyNotesOndcAppIdForOneNoteApi = 'StickyNotesONDCIntegration'\r\n export const stickyNotesOndcAppIdForLogging = 'StickyNotes_Web' // This is used for our GDPR export pipeline\r\n\r\n export const sdkTelemetryEventName = 'SDKTelemetryEvent'\r\n\r\n // These variables need to be kept in sync with\r\n // https://github.com/microsoft-notes/api/wiki/Client-Onboarding-Info\r\n export const notesFabricApiCreatedByApp = 'OneNote'\r\n\r\n export const outlookO365ResourceUri = 'https://outlook.office365.com'\r\n\r\n // NotesBeta constants\r\n export const WELL_KNOWN_MICROSOFT_TENANT_ID = '72f988bf-86f1-41af-91ab-2d7cd011db47'\r\n\r\n export const WELL_KNOWN_LOCALHOST_TENANT_ID = '2f6dd297-219b-4389-ad1c-33760bc2fe4c'\r\n\r\n // TODO(alkwa): please remove this after we leave MSIT dogfood and redirect towards an area where we want to collect feedback\r\n // tslint:disable-next-line:max-line-length\r\n export const DOGFOOD_TEAMS_CHAT = 'https://teams.microsoft.com/l/channel/19%3a4dcda2a3adf34b86a798da2602969847%40thread.skype/Sticky%2520Notes%2520in%2520OneNote%2520Online?groupId=8b8d22c3-6f9e-4c9a-9d3e-cf756a15d7e3&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47'\r\n\r\n export const MSA_T1_EXPORT_LINK = 'https://go.microsoft.com/fwlink/?linkid=2009717'\r\n\r\n export const cancelledError = 'CANCELLED'\r\n\r\n export const EDGE_HUB_QUERY_FIELD = 'isEdgeHub'\r\n\r\n export const SERVICE_WORKER_QUERY_FIELD = 'isSw'\r\n\r\n export const AUTH_QUERY_FIELD = 'auth'\r\n\r\n export const HOST_APP_TYPES = {\r\n EDGE_HUB: 'EdgeHub',\r\n WEB_APP: 'Hub',\r\n }\r\n\r\n export const RING_TYPE = {\r\n INTERNAL: 'internal',\r\n PRODUCTION: 'production',\r\n }\r\n\r\n export const NEW_USER_TO_ON_ECOSYSTEM_TELEMETRY_FLUSH_EVENT = 'flushNewUserTelemetry'\r\n\r\n export const LOCAL_STORAGE_KEY_FOR_SHORELINE_FEED_USER= 'isShoreLineFeedUser'\r\n}\r\n","export var isRunningInOneNoteContext = function () {\r\n // When run as an agave, OSF code in the the host adds a _host_Info query parameter\r\n if (/_host_Info=OneNote/.test(window.location.search)) {\r\n return true;\r\n }\r\n // When running under Win32 app, in a custom container (such as Meeting Notes & Home)\r\n if (/embeddingApp=win32/.test(window.location.search)) {\r\n return true;\r\n }\r\n // Some integrations run under the officeaddins microservice but potentially in a MS Teams frame\r\n if (window.location.pathname.startsWith('/officeaddins') && (!window.parent || window.parent === window)) {\r\n return true;\r\n }\r\n // OneNote.Com/stickynotes case\r\n var isRunningInOneNoteDotComInt = window.location.hostname.endsWith('onenote-int.com');\r\n var isRunningInOneNoteDotCom = window.location.hostname.endsWith('onenote.com');\r\n // Only if we're running locally and we're not running in onenote.com\r\n return isRunningInOneNoteDotCom || isRunningInOneNoteDotComInt;\r\n};\r\n//# sourceMappingURL=isRunningInOneNoteContext.js.map","export var OfficeThemeID;\r\n(function (OfficeThemeID) {\r\n OfficeThemeID[OfficeThemeID[\"Colorful\"] = 0] = \"Colorful\";\r\n OfficeThemeID[OfficeThemeID[\"DarkGrey\"] = 1] = \"DarkGrey\";\r\n OfficeThemeID[OfficeThemeID[\"Black\"] = 2] = \"Black\";\r\n OfficeThemeID[OfficeThemeID[\"White\"] = 3] = \"White\";\r\n})(OfficeThemeID || (OfficeThemeID = {}));\r\n//# sourceMappingURL=OfficeThemeID.js.map","import { OfficeThemeID } from './OfficeThemeID';\r\nfunction oneNoteThemeFromSwatch(swatch) {\r\n var color = swatch.toLowerCase();\r\n if (color === '#e6e6e6') {\r\n return 'Light';\r\n }\r\n else if (color === '#262626') {\r\n return 'Dark';\r\n }\r\n else {\r\n console.warn('Unknown OneNote theme, falling back to light');\r\n return 'Light';\r\n }\r\n}\r\nexport function toOneNoteTheme(themeSwatches) {\r\n if (themeSwatches) {\r\n // The most accurate way to determine the theme that the host is using is through the\r\n // themeId property, so we will prioritize looking for that\r\n // And in order to maintain backward compatibility with older clients such as\r\n // OneNote Win32 that may not have the C++ counterpart implementation of themeId\r\n // we will fall back to guessing the theme based on a particular swatch such as\r\n // the background color.\r\n if (themeSwatches.themeId !== undefined) {\r\n // Make sure we are forward compatible with any changes made around swatches\r\n var themeId = OfficeThemeID.Colorful;\r\n if (typeof themeSwatches.themeId === 'string') {\r\n // In past versions of Office clients, themeId use to be in the same format as a\r\n // color swatch, i.e. #000002 instead of decimal format but was later modified to\r\n // decimal. In order to stay backwards compatible we will still attempt to parse\r\n // the old format when this property exists.\r\n themeId = parseInt(themeSwatches.themeId.replace('#', ''), 10);\r\n }\r\n else if (typeof themeSwatches.themeId === 'number') {\r\n // In more recent Office client builds, themeId was converted to a number type\r\n themeId = themeSwatches.themeId;\r\n }\r\n else {\r\n console.warn(\"Unexpected type for themeId. Received: \" + typeof (themeSwatches.themeId));\r\n }\r\n return themeId === OfficeThemeID.Black ? 'Dark' : 'Light';\r\n }\r\n else if (themeSwatches.primaryBackgroundColor) {\r\n return oneNoteThemeFromSwatch(themeSwatches.primaryBackgroundColor);\r\n }\r\n else if (themeSwatches.bodyBackgroundColor) {\r\n return oneNoteThemeFromSwatch(themeSwatches.bodyBackgroundColor);\r\n }\r\n }\r\n console.warn('Could not get OneNote theme, falling back to light');\r\n return 'Light';\r\n}\r\n//# sourceMappingURL=toOneNoteTheme.js.map","import { UrlUtils } from '@notes/webintegrations-common'\r\nimport { Log } from '../shared/logger/Log'\r\n\r\nexport enum OutlookMode {\r\n Read,\r\n Write,\r\n}\r\n\r\nexport function getOutlookMode(): OutlookMode {\r\n const queryParams = UrlUtils.getQueryParamsAsObject(window.location.href)\r\n if (!queryParams.outlookMode) {\r\n Log.logger.warn('OutlookMode query param not found!')\r\n return OutlookMode.Read\r\n }\r\n\r\n return queryParams.outlookMode === 'read' ? OutlookMode.Read : OutlookMode.Write\r\n}\r\n","import { logAndBuildError } from '@notes/webintegrations-common'\r\nimport { AuthMethod, IAuthContext } from '../../shared/auth/IAuthContext'\r\n\r\nexport class SSOThirdPartyAuthContext implements IAuthContext {\r\n private accessToken: string\r\n\r\n constructor (initialToken: string) {\r\n this.accessToken = initialToken\r\n }\r\n\r\n getAccessToken(): string {\r\n return this.accessToken\r\n }\r\n\r\n getSubstrateNotesToken(): string | undefined {\r\n return undefined\r\n }\r\n\r\n async refresh(): Promise {\r\n throw logAndBuildError('Not implemented')\r\n }\r\n\r\n getAuthMethod(): AuthMethod {\r\n return AuthMethod.HostSso\r\n }\r\n}\r\n","import { TelemetrySink } from '@microsoft/oteljs'\r\nimport { ILogger } from '@notes/webintegrations-common'\r\nimport { Constants } from '../../shared/Constants'\r\nimport { shouldMockExternalApis } from '../../shared/shouldMockExternalApis'\r\nimport { IAccountInfo } from '../auth/IAccountInfo'\r\nimport { IOfficeJsWrapper } from './IOfficeJsWrapper'\r\nimport { getOfficeJsOrThrow } from './OfficeJsWrapper'\r\n\r\nexport class BaseOfficeJsWrapper implements IOfficeJsWrapper {\r\n public getSelectedHtmlAsync(): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.GETSELECTEDHTMLASYNC]`)\r\n return Promise.resolve('Mock HTML content from OfficeJsApi!')\r\n }\r\n\r\n return new Promise((resolve: (value: string) => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.document.getSelectedDataAsync(\r\n officeJs.CoercionType.Html,\r\n { valueFormat: officeJs.ValueFormat.Unformatted },\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for getSelectedDataAsync with HTML is not succeeded'))\r\n return\r\n }\r\n\r\n resolve(asyncResult.value as string)\r\n }\r\n )\r\n })\r\n }\r\n\r\n public getSelectedImageAsync(): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.GETSELECTEDIMAGEASYNC]`)\r\n return Promise.resolve('Mock content from OfficeJsApi!')\r\n }\r\n\r\n return new Promise((resolve: (value: string) => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.document.getSelectedDataAsync(\r\n officeJs.CoercionType.Image,\r\n { valueFormat: officeJs.ValueFormat.Unformatted },\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for getSelectedDataAsync with image is not succeeded'))\r\n return\r\n }\r\n\r\n resolve(asyncResult.value as string)\r\n }\r\n )\r\n })\r\n }\r\n\r\n public getSelectedTextAsync(): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.GETSELECTEDTEXTASYNC]`)\r\n return Promise.resolve('Mock content from OfficeJsApi!')\r\n }\r\n\r\n return new Promise((resolve: (result: string) => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.document.getSelectedDataAsync(\r\n officeJs.CoercionType.Text,\r\n { valueFormat: officeJs.ValueFormat.Unformatted },\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for getSelectedDataAsync with text is not succeeded'))\r\n return\r\n }\r\n\r\n resolve(asyncResult.value as string)\r\n }\r\n )\r\n })\r\n }\r\n\r\n public setSelectedHtmlAsync(text: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.SETSELECTEDHTMLASYNC] with ${text}`)\r\n return Promise.resolve()\r\n }\r\n\r\n return new Promise((resolve: () => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.document.setSelectedDataAsync(\r\n text,\r\n {\r\n coercionType: officeJs.CoercionType.Html,\r\n },\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for setSelectedDataAsync with HTML is not succeeded'))\r\n return\r\n }\r\n\r\n resolve()\r\n }\r\n )\r\n })\r\n }\r\n\r\n public setSelectedTextAsync(text: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.SETSELECTEDTEXTASYNC] with ${text}`)\r\n return Promise.resolve()\r\n }\r\n\r\n return new Promise((resolve: () => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.document.setSelectedDataAsync(\r\n text,\r\n {\r\n coercionType: officeJs.CoercionType.Text,\r\n },\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for setSelectedDataAsync is not succeeded'))\r\n return\r\n }\r\n\r\n resolve()\r\n }\r\n )\r\n })\r\n }\r\n\r\n public getLogger(_namespace: string): ILogger | undefined {\r\n return undefined\r\n }\r\n\r\n public getTelemetrySink(): TelemetrySink | undefined {\r\n // From aka.ms/oteljs: Note that since Office.sendTelemetryEvent is an internal API, it\r\n // does not have a type definition in office.d.ts. There is a bug on the Office Platform\r\n // team to add a type definition in office-with-first-party.d.ts. In the meantime, you\r\n // may have to declare var Office or otherwise avoid a TypeScript compiler complaint.\r\n if (shouldMockExternalApis()) {\r\n return undefined\r\n }\r\n // tslint:disable-next-line:no-any\r\n const officeJs = getOfficeJsOrThrow() as any\r\n return {\r\n sendTelemetryEvent: officeJs.sendTelemetryEvent,\r\n }\r\n }\r\n\r\n public async getSSOTokenFirstParty(_upn: string, resource: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n return Promise.resolve('MOCK_SSO_TOKEN')\r\n }\r\n\r\n try {\r\n const ctx = new OfficeCore.RequestContext()\r\n\r\n // tslint:disable-next-line:no-any\r\n const token = (ctx as any).firstParty.authentication.getAccessToken({ 'resource': resource })\r\n await ctx.sync()\r\n return token.value.accessToken\r\n } catch (e) {\r\n if (e.code === 'InteractiveFlowAborted' /*OfficeCore.ErrorCodes.interactiveFlowAborted*/) {\r\n throw new Error(Constants.cancelledError)\r\n }\r\n\r\n throw e\r\n }\r\n }\r\n\r\n public getAccountInfoCollection(): Promise {\r\n if (shouldMockExternalApis()) {\r\n const accounts: IAccountInfo[] = [\r\n {\r\n displayName: 'Mock Account',\r\n upn: 'first-account@microsoft.com',\r\n authType: 'o365',\r\n },\r\n {\r\n displayName: 'Mock Account',\r\n upn: 'second-account@outlook.com',\r\n authType: 'msa',\r\n },\r\n ]\r\n return Promise.resolve(accounts)\r\n }\r\n\r\n return Promise.resolve([])\r\n }\r\n\r\n public navigateToClientURL(url: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.NAVIGATETOCLIENTURL] ${url}`)\r\n return Promise.resolve()\r\n }\r\n\r\n throw new Error('navigateToClientURL not implemented for this host')\r\n }\r\n}\r\n","import { Args, IErrorCodeInfo, ILogger, PrimitiveProperties } from '@notes/webintegrations-common'\r\nimport { Constants } from '../../shared/Constants'\r\n\r\nexport class OneNoteAgaveLogger implements ILogger {\r\n private namespace: string\r\n\r\n constructor(namespace: string) {\r\n this.namespace = namespace\r\n }\r\n\r\n error(message: string, ..._args: Args): void {\r\n this.logToOneNote('Error', 'Exception' /*OneNote.LogLevel.Exception*/, { 'message': message })\r\n }\r\n\r\n info(message: string, ..._args: Args): void {\r\n this.logToOneNote('Info', 'Data' /*OneNote.LogLevel.Data*/, { 'message': message })\r\n }\r\n\r\n warn(message: string, ..._args: Args): void {\r\n this.logToOneNote('Warn', 'Warning' /*OneNote.LogLevel.Warning*/, { 'message': message })\r\n }\r\n\r\n logReportData(eventName: string, _isCriticalEvent: boolean, payloadNonPII?: PrimitiveProperties, _payloadEUPIOnlyNonPII?: PrimitiveProperties): void {\r\n if (eventName === 'CopyNoteToCanvas' || eventName === 'SignOut' || eventName === 'CreateNoteFromCanvasSelection' || eventName === 'NavigateToClientUrlFailed' || eventName === 'WebPerfData') {\r\n this.logToOneNote(eventName, 'Data' /*OneNote.LogLevel.data*/, payloadNonPII)\r\n } else if (eventName === Constants.sdkTelemetryEventName && payloadNonPII) {\r\n const telemetryEvent = payloadNonPII.telemetryEvent as string\r\n if (telemetryEvent) {\r\n delete payloadNonPII.telemetryEvent\r\n this.logToOneNote(telemetryEvent, 'Data' /*OneNote.LogLevel.data*/, payloadNonPII)\r\n }\r\n }\r\n }\r\n\r\n logEvent(_eventName: string, _message: string, ..._args: Args): void {\r\n // Not interested in these currently\r\n }\r\n\r\n logUnexpected(errorInfo: IErrorCodeInfo, errorDescription: string, _sessionCorrelationId?: string): void {\r\n this.logToOneNote(errorInfo.name + ' : ' + errorDescription, 'Exception' /*OneNote.LogLevel.Exception*/)\r\n }\r\n\r\n private logToOneNote(eventName: string, logLevel: string = 'Data', payload?: PrimitiveProperties): void {\r\n const mappedPayload = !payload ? [] : Object.entries(payload).map( ( entry: [string, string | number | boolean] ) => {\r\n const key = entry[0]\r\n const value = entry[1]\r\n return {\r\n isNonPII: true,\r\n tag: key,\r\n value: value.toString(),\r\n }\r\n })\r\n\r\n // tslint:disable\r\n OneNote.run((context: OneNote.RequestContext) => {\r\n (context.application as any)._ClientLog(\r\n logLevel,\r\n `${this.namespace}.${eventName}`,\r\n 'CriticalFlag' /*OneNote.EventFlag.criticalFlag*/,\r\n mappedPayload)\r\n return context.sync().catch(() => {\r\n // do nothing. To prevent unhandled promise rejection cycle\r\n // since we will attempt to log again if the rejection occurs\r\n })\r\n }).catch(() => {\r\n // do nothing. for the same reason as above\r\n })\r\n // tslint:enable\r\n }\r\n}\r\n","import { ILogger } from '@notes/webintegrations-common'\r\nimport { Constants } from '../../shared/Constants'\r\nimport { CommonLogger } from '../../shared/logger/CommonLogger'\r\nimport { shouldMockExternalApis } from '../../shared/shouldMockExternalApis'\r\nimport { extractTokenFromAuthHeader } from '../auth/extractTokenFromAuthHeader'\r\nimport { getAuthTypeForAccountType } from '../auth/getAuthTypeForAccountType'\r\nimport { IAccountInfo } from '../auth/IAccountInfo'\r\nimport { BaseOfficeJsWrapper } from './BaseOfficeJsWrapper'\r\nimport { OfficeJsWrapper } from './OfficeJsWrapper'\r\nimport { OneNoteAgaveLogger } from './OneNoteAgaveLogger'\r\n\r\nexport class OneNoteOfficeJsWrapper extends BaseOfficeJsWrapper {\r\n public getLogger(namespace: string): ILogger | undefined {\r\n /**\r\n * Now that we have an OTel based logger, we can leverage the same logger\r\n * even for agaves since the existing agave logger does not seem to log\r\n * all events. For now, we are enabling the OTel based logger only for\r\n * OfficeOnline and keeping the existing agave logger for other platforms\r\n * such as PC and Universal.\r\n */\r\n if (shouldMockExternalApis()) {\r\n return undefined\r\n } else if (OfficeJsWrapper.getPlatform() === 'OfficeOnline') {\r\n return new CommonLogger(namespace, this.getTelemetrySink())\r\n } else {\r\n return new OneNoteAgaveLogger(namespace)\r\n }\r\n }\r\n\r\n public async getSSOTokenFirstParty(upn: string, resource: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n return Promise.resolve('MOCK_SSO_TOKEN')\r\n }\r\n\r\n if (upn) {\r\n // tslint:disable-next-line:typedef\r\n return this.getServiceTokenByUserEmail(upn, resource, 'DELEGATION').catch((e) => {\r\n if (e.code === 'OperationAborted' /*OneNote.ErrorCodes.operationAborted*/) {\r\n throw new Error(Constants.cancelledError)\r\n }\r\n\r\n throw e\r\n })\r\n }\r\n\r\n return super.getSSOTokenFirstParty(upn, resource)\r\n }\r\n\r\n private getServiceTokenByUserEmail(email: string, resource: string, policy: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n return Promise.resolve('MOCK_TOKEN')\r\n }\r\n\r\n return OneNote.run((context: OneNote.RequestContext) => {\r\n // _GetServiceTokenByUserEmail is a first-party API for the OneNote application which is not exposed\r\n // through type declarations, so we cast to any to access it\r\n // tslint:disable-next-line:no-any\r\n const serviceTokens = (context.application as any)._GetServiceTokenByUserEmail(email, resource, policy)\r\n return context.sync().then(() => {\r\n if (serviceTokens && serviceTokens.value && serviceTokens.value.length > 0) {\r\n const token = serviceTokens.value[0].headerValue\r\n return extractTokenFromAuthHeader(token)\r\n }\r\n return ''\r\n })\r\n })\r\n }\r\n\r\n public getAccountInfoCollection(): Promise {\r\n if (shouldMockExternalApis()) {\r\n return Promise.resolve([])\r\n }\r\n\r\n return OneNote.run((context: OneNote.RequestContext) => {\r\n // _GetAccountInfoCollection is a first-party API for the OneNote application which is not exposed\r\n // through type declarations, so we cast to any to access it\r\n // tslint:disable-next-line:no-any\r\n const accountInfoCollection = (context.application as any)._GetAccountInfoCollection()\r\n return context.sync().then(() => {\r\n if (!accountInfoCollection || !accountInfoCollection.value || accountInfoCollection.value.length === 0) {\r\n return []\r\n }\r\n\r\n const accounts: IAccountInfo[] = []\r\n const uniqueEmails = new Set()\r\n for (const account of accountInfoCollection.value) {\r\n // For some accounts like ADAL & OrgId, the user might be signed in through\r\n // multiple mechanisms at the same time and in those cases we may get\r\n // duplicate email accounts with different types. Feed doesn't differentiate\r\n // between those so we will filter dupes out based on email address\r\n if (uniqueEmails.has(account.email)) {\r\n continue\r\n }\r\n uniqueEmails.add(account.email)\r\n const authType = getAuthTypeForAccountType(account.accountType)\r\n if (authType) {\r\n accounts.push({\r\n displayName: account.userName,\r\n upn: account.email,\r\n authType: authType,\r\n })\r\n }\r\n }\r\n\r\n return accounts\r\n }).catch(() => [])\r\n })\r\n }\r\n\r\n public async navigateToClientURL(url: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n window.open(url)\r\n return\r\n }\r\n\r\n await OneNote.run((context: OneNote.RequestContext) => {\r\n context.application.navigateToPageWithClientUrl(url)\r\n return context.sync()\r\n })\r\n }\r\n}\r\n","import { shouldMockExternalApis } from '../../shared/shouldMockExternalApis'\r\nimport { BaseOfficeJsWrapper } from './BaseOfficeJsWrapper'\r\nimport { getOfficeJsOrThrow } from './OfficeJsWrapper'\r\n\r\nexport class OutlookOfficeJsWrapper extends BaseOfficeJsWrapper {\r\n public getSelectedHtmlAsync(): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[OUTLOOKAGAVE.GETSELECTEDHTMLASYNC]`)\r\n return Promise.resolve('Mock HTML content from OutlookOfficeJsApi!')\r\n }\r\n\r\n return new Promise((resolve: (asyncValue: string) => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.mailbox.item?.getSelectedDataAsync(\r\n officeJs.CoercionType.Html,\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for getSelectedDataAsync with HTML is not succeeded'))\r\n return\r\n }\r\n\r\n resolve(asyncResult.value as string)\r\n }\r\n )\r\n })\r\n }\r\n\r\n public getSelectedImageAsync(): Promise {\r\n // Outlook doesn't handle CoercionType.Image\r\n return Promise.resolve('')\r\n }\r\n\r\n public getSelectedTextAsync(): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.GETSELECTEDTEXTASYNC]`)\r\n return Promise.resolve('Mock content from OutlookOfficeJsApi!')\r\n }\r\n\r\n return new Promise((resolve: (value: string) => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.mailbox.item?.getSelectedDataAsync(\r\n officeJs.CoercionType.Text,\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for getSelectedDataAsync with text is not succeeded'))\r\n return\r\n }\r\n\r\n resolve(asyncResult.value)\r\n }\r\n )\r\n })\r\n }\r\n\r\n public setSelectedHtmlAsync(text: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.SETSELECTEDHTMLASYNC] with ${text}`)\r\n return Promise.resolve()\r\n }\r\n\r\n return new Promise((resolve: () => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.mailbox.item?.setSelectedDataAsync(\r\n text,\r\n {\r\n coercionType: officeJs.CoercionType.Html,\r\n },\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n if (asyncResult.error.name === 'InvalidSelection') {\r\n return officeJs.context.mailbox.item?.body.prependAsync(text,\r\n {\r\n coercionType: officeJs.CoercionType.Html,\r\n },\r\n (prependAsyncResult: Office.AsyncResult) => {\r\n if (prependAsyncResult.error) {\r\n reject(prependAsyncResult.error)\r\n return\r\n }\r\n\r\n if (prependAsyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for prependDataAsync with HTML is not succeeded'))\r\n return\r\n }\r\n\r\n resolve()\r\n })\r\n }\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for setSelectedDataAsync with HTML is not succeeded'))\r\n return\r\n }\r\n\r\n resolve()\r\n }\r\n )\r\n })\r\n }\r\n\r\n public setSelectedTextAsync(text: string): Promise {\r\n if (shouldMockExternalApis()) {\r\n // tslint:disable-next-line:no-console\r\n console.log(`[AGAVE.SETSELECTEDTEXTASYNC] with ${text}`)\r\n return Promise.resolve()\r\n }\r\n\r\n return new Promise((resolve: () => void, reject: (errorText: Error) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.mailbox.item?.setSelectedDataAsync(\r\n text,\r\n {\r\n coercionType: officeJs.CoercionType.Text,\r\n },\r\n (asyncResult: Office.AsyncResult) => {\r\n if (asyncResult.error) {\r\n return officeJs.context.mailbox.item?.body.prependAsync(text,\r\n {\r\n coercionType: officeJs.CoercionType.Text,\r\n },\r\n (prependAsyncResult: Office.AsyncResult) => {\r\n if (prependAsyncResult.error) {\r\n reject(prependAsyncResult.error)\r\n return\r\n }\r\n\r\n if (prependAsyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for prependDataAsync with HTML is not succeeded'))\r\n return\r\n }\r\n\r\n resolve()\r\n })\r\n reject(asyncResult.error)\r\n return\r\n }\r\n\r\n if (asyncResult.status !== officeJs.AsyncResultStatus.Succeeded) {\r\n reject(new Error('status for setSelectedDataAsync is not succeeded'))\r\n return\r\n }\r\n\r\n resolve()\r\n }\r\n )\r\n })\r\n }\r\n}\r\n","import { shouldMockExternalApis } from '../../shared/shouldMockExternalApis'\r\nimport { BaseOfficeJsWrapper } from './BaseOfficeJsWrapper'\r\nimport { IOfficeJsWrapper } from './IOfficeJsWrapper'\r\nimport { OneNoteOfficeJsWrapper } from './OneNoteOfficeJsWrapper'\r\nimport { OutlookOfficeJsWrapper } from './OutlookOfficeJsWrapper'\r\n\r\n// This function is to help make OfficeJs code more typesafe\r\n// Instead of using the namespace directly in code, we should always use this getter function\r\n// that properly types Office as optional. It would only be present in an Agave context.\r\nfunction getOfficeJsInstance(): typeof Office | undefined {\r\n // tslint:disable-next-line:no-any\r\n return (window as any).Office as typeof Office | undefined\r\n}\r\n\r\n// NOTE: This code will fast-fail if imported in a non-mocking, non-agave context.\r\n// This is intended, as you should not import this file in a non-agave context!\r\nconst maybeOfficeJs = getOfficeJsInstance()\r\nconst shouldMockExternalApisVal = shouldMockExternalApis()\r\nif (!shouldMockExternalApisVal) {\r\n getOfficeJsOrThrow()\r\n}\r\n\r\nexport function getOfficeJsOrThrow(): typeof Office {\r\n if (!maybeOfficeJs) {\r\n throw new Error('Attempted to use OfficeJs in a non-mocking, non-addin context')\r\n }\r\n return maybeOfficeJs\r\n}\r\n\r\n// tslint:disable-next-line:no-unnecessary-class\r\nexport class OfficeJsWrapper {\r\n public static getInstance(): IOfficeJsWrapper {\r\n if (shouldMockExternalApis()) {\r\n return new BaseOfficeJsWrapper()\r\n }\r\n\r\n switch (getOfficeJsOrThrow().context.host) {\r\n case Office.HostType.Outlook:\r\n return new OutlookOfficeJsWrapper()\r\n case Office.HostType.OneNote:\r\n return new OneNoteOfficeJsWrapper()\r\n default:\r\n return new BaseOfficeJsWrapper()\r\n }\r\n }\r\n\r\n public static getHost(): string {\r\n if (shouldMockExternalApis()) {\r\n return 'MOCKHOST'\r\n }\r\n\r\n const officeJs = getOfficeJsOrThrow()\r\n\r\n if (!officeJs.context.host) {\r\n return 'UNKNOWNHOST'\r\n }\r\n\r\n return officeJs.context.host.toString()\r\n }\r\n\r\n public static getPlatform(): string {\r\n if (shouldMockExternalApis()) {\r\n return 'MOCKPLATFORM'\r\n }\r\n\r\n const officeJs = getOfficeJsOrThrow()\r\n\r\n if (!officeJs.context.platform) {\r\n return 'UNKNOWNPLATFORM'\r\n }\r\n\r\n return officeJs.context.platform.toString()\r\n }\r\n\r\n public static isCurrentHostOutlook(): boolean {\r\n if (shouldMockExternalApis()) {\r\n return false\r\n }\r\n\r\n const officeJs = getOfficeJsOrThrow()\r\n\r\n return officeJs.context.host === Office.HostType.Outlook\r\n }\r\n\r\n public static isMediaDownloadDisabled(): boolean {\r\n if (shouldMockExternalApis()) {\r\n return false\r\n }\r\n\r\n const platform = getOfficeJsOrThrow().context.platform\r\n return platform === Office.PlatformType.Universal || platform === Office.PlatformType.Mac || platform === Office.PlatformType.iOS\r\n }\r\n\r\n public static isAppleDevice(): boolean {\r\n if (shouldMockExternalApis()) {\r\n return false\r\n }\r\n const platform = getOfficeJsOrThrow().context.platform\r\n return platform === Office.PlatformType.iOS || platform === Office.PlatformType.Mac\r\n }\r\n\r\n public static isOfficeOnline(): boolean {\r\n if (shouldMockExternalApis()) {\r\n return false\r\n }\r\n const platform = getOfficeJsOrThrow().context.platform\r\n return platform === Office.PlatformType.OfficeOnline\r\n }\r\n\r\n public static registerInitializeFunction(initializeFunction: () => void): void {\r\n // If we're running in a mocked context, office.initialize isn't called, therefore we need to start\r\n // our app manually\r\n if (shouldMockExternalApis()) {\r\n initializeFunction()\r\n return\r\n }\r\n\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.initialize = () => {\r\n initializeFunction()\r\n }\r\n }\r\n\r\n public static isSsoSupportedThirdParty(): boolean {\r\n // For some reason, the below is returning false even though getAccessTokenAsync is working fine\r\n // Office.context.requirements.isSetSupported('IdentityAPI', 1.1)\r\n return shouldMockExternalApis() ? false : true\r\n }\r\n\r\n public static getSsoTokenThirdParty(): Promise {\r\n if (shouldMockExternalApis()) {\r\n return Promise.resolve('Mock SSO token from OfficeJsApi!')\r\n }\r\n\r\n return new Promise((resolve: (value: string) => void, reject: (errorText: Office.AsyncResult | string) => void) => {\r\n const officeJs = getOfficeJsOrThrow()\r\n\r\n // Currently, there's no documented way of checking if SSO is supported at runtime\r\n let alreadyTimedOut: boolean = false\r\n const timer = setTimeout(() => {\r\n alreadyTimedOut = true\r\n reject('getSsoTokenAsync timed out')\r\n }, 500)\r\n\r\n const singleSignOnOption: Office.AuthOptions = {\r\n forceAddAccount: false,\r\n forceConsent: false,\r\n }\r\n\r\n officeJs.context.auth.getAccessTokenAsync(singleSignOnOption, (result: Office.AsyncResult) => {\r\n if (!alreadyTimedOut) {\r\n clearTimeout(timer)\r\n result.status === officeJs.AsyncResultStatus.Succeeded\r\n ? resolve(result.value as string)\r\n : reject(result)\r\n }\r\n })\r\n })\r\n }\r\n\r\n public static displayDialog(startAddress: string, options?: Office.DialogOptions, callback?: (result: Office.AsyncResult) => void): void {\r\n if (shouldMockExternalApis()) {\r\n throw new Error('not implemented')\r\n }\r\n const officeJs = getOfficeJsOrThrow()\r\n officeJs.context.ui.displayDialogAsync(startAddress, options, callback)\r\n }\r\n\r\n public static getLanguage(): string {\r\n if (shouldMockExternalApis()) {\r\n return 'de-de'\r\n }\r\n\r\n const officeJs = getOfficeJsOrThrow()\r\n return officeJs.context.displayLanguage\r\n }\r\n}\r\n","import type { TelemetrySink } from '@microsoft/oteljs'\r\nimport { decodeO365JwtToken, getCurrentTheme, getErrorAsString, ILogger, logAndBuildError, OneNoteTheme, registerThemeChangedEvent } from '@notes/webintegrations-common'\r\nimport { Log } from '../../shared/logger/Log'\r\nimport { getSSOTokenFirstParty, tryGetOAuthTokenInfoWithoutUserAction } from '../auth/getAccessTokenInfo'\r\nimport { getSSOTokenInfoONO } from '../auth/getAccessTokenInfo'\r\nimport { IAccessTokenInfo } from '../auth/IAccessTokenInfo'\r\nimport { IAccountInfo } from '../auth/IAccountInfo'\r\nimport { localStorageIsSignedInKey, msaCommonAuthImplicitCredentials, o365CommonAuthAccessToken } from '../auth/localStorageIsSignedInKey'\r\nimport { SSOThirdPartyAuthContext } from '../auth/SSOThirdPartyAuthContext'\r\nimport { getOutlookMode, OutlookMode } from '../getOutlookMode'\r\nimport { OfficeJsWrapper } from '../officeJsWrapper/OfficeJsWrapper'\r\nimport { IHostIntegration } from './IHostIntegration'\r\n\r\nexport class OfficeJSHostAdapter implements IHostIntegration {\r\n public getTheme = () => {\r\n return getCurrentTheme()\r\n }\r\n\r\n public getHostName = () => {\r\n return OfficeJsWrapper.getHost()\r\n }\r\n\r\n public isAppleDevice = () => {\r\n return OfficeJsWrapper.isAppleDevice()\r\n }\r\n\r\n public isOfficeOnline = () => {\r\n return OfficeJsWrapper.isOfficeOnline()\r\n }\r\n\r\n public getLanguage = () => {\r\n return OfficeJsWrapper.getLanguage()\r\n }\r\n\r\n public getPlatform = () => {\r\n return OfficeJsWrapper.getPlatform()\r\n }\r\n\r\n public getAccounts = async (): Promise => {\r\n return await OfficeJsWrapper.getInstance().getAccountInfoCollection()\r\n }\r\n\r\n public shouldDisplayCopyToButtons = (): boolean => {\r\n return !OfficeJsWrapper.isCurrentHostOutlook() || getOutlookMode() === OutlookMode.Write\r\n }\r\n\r\n public getLogger = (namespace: string): ILogger | undefined => {\r\n return OfficeJsWrapper.getInstance().getLogger(namespace)\r\n }\r\n\r\n public getTelemetrySink = (): TelemetrySink | undefined => {\r\n if (this.getPlatform() === 'Universal') {\r\n /**\r\n * OfficeJS sink hasn't been implemented for UWP\r\n * from the native side, so we return undefined.\r\n * This check can be removed once OneNote UWP is deprecated.\r\n */\r\n return undefined\r\n }\r\n return OfficeJsWrapper.getInstance().getTelemetrySink()\r\n }\r\n\r\n public isMediaDownloadDisabled = (): boolean => {\r\n return OfficeJsWrapper.isMediaDownloadDisabled()\r\n }\r\n\r\n public signIn = (url: string, onBeginSignIn: (endSignIn: () => void) => void): Promise => {\r\n return new Promise((resolve: () => void, reject: (errorText: string) => void) => {\r\n // https://docs.microsoft.com/en-us/office/dev/add-ins/develop/dialog-api-in-office-add-ins\r\n OfficeJsWrapper.displayDialog(url, { height: 50, width: 50, promptBeforeOpen: false }, (result: Office.AsyncResult) => {\r\n if (result.error) {\r\n // The dialog could not open\r\n switch (result.error.code) {\r\n case 12009:\r\n reject('AuthError: Dialog was ignored by the user')\r\n break\r\n default:\r\n reject('AuthError: Unexpected error code when opening dialog: ' + JSON.stringify(result.error.code))\r\n break\r\n }\r\n return\r\n }\r\n\r\n const dialog: Office.Dialog = result.value\r\n const closeDialogAndResolvePromise = () => {\r\n dialog.close()\r\n resolve()\r\n }\r\n\r\n const dialogMessageReceivedCallback = (args: {message: string, origin: string | undefined}) => {\r\n try {\r\n if (args && args.message && args.origin === window.location.origin) {\r\n const authDataFromPopUp = JSON.parse(args.message)\r\n const allowedKeysSet = new Set([localStorageIsSignedInKey, msaCommonAuthImplicitCredentials, o365CommonAuthAccessToken])\r\n // Iterate through the keys and set the values in local storage\r\n Object.keys(authDataFromPopUp).forEach((key: string) => {\r\n if (allowedKeysSet.has(key)) {\r\n localStorage.setItem(key, JSON.stringify(authDataFromPopUp[key]))\r\n }\r\n })\r\n closeDialogAndResolvePromise()\r\n }\r\n } catch (error) {\r\n Log.logger.error(`AuthError: Error parsing auth data from popup: ${getErrorAsString(error)}`)\r\n dialog.close()\r\n reject('AuthError: Error parsing auth data from popup')\r\n }\r\n }\r\n\r\n onBeginSignIn(closeDialogAndResolvePromise)\r\n\r\n // Non-Edge expected flow for auth completion detection through the Dialog API\r\n dialog.addEventHandler(Office.EventType.DialogMessageReceived, dialogMessageReceivedCallback)\r\n\r\n dialog.addEventHandler(Office.EventType.DialogEventReceived, (dialogEvent: { error: number }) => {\r\n Log.logger.info(`I received an event from the dialog! Error: ${dialogEvent ? dialogEvent.error : 'NO ERROR'}`)\r\n dialog.close()\r\n switch (dialogEvent.error) {\r\n case 12006:\r\n reject('Dialog was closed by the user')\r\n break\r\n default:\r\n reject('Unexpected error came back from dialog: ' + JSON.stringify(dialogEvent))\r\n break\r\n }\r\n })\r\n })\r\n })\r\n }\r\n\r\n public tryGetAccessTokenInfoWithoutUserAction = async (): Promise => {\r\n let accessTokenInfo: IAccessTokenInfo | undefined = undefined\r\n try {\r\n if (this.isOfficeOnline()) {\r\n accessTokenInfo = await getSSOTokenInfoONO()\r\n }\r\n } catch (error) {\r\n Log.logger.error(`AuthError: SSO failed for user with error ${getErrorAsString(error)}, falling back to sign-in experience`)\r\n }\r\n if (accessTokenInfo) {\r\n return accessTokenInfo\r\n }\r\n\r\n accessTokenInfo = await tryGetOAuthTokenInfoWithoutUserAction()\r\n if (accessTokenInfo) {\r\n return accessTokenInfo\r\n }\r\n\r\n return await this.tryGetSSOTokenForOfficeAddin()\r\n }\r\n\r\n public getSSOTokenFirstParty = (upn: string, resource: string): Promise => {\r\n return OfficeJsWrapper.getInstance().getSSOTokenFirstParty(upn, resource)\r\n }\r\n\r\n private tryGetSSOTokenForOfficeAddin = async(): Promise => {\r\n if (!OfficeJsWrapper.isSsoSupportedThirdParty()) {\r\n Log.logger.info('SSO not supported, falling back to cookie')\r\n return undefined\r\n }\r\n\r\n Log.logger.info('SSO is supported. Attempting third-party SSO auth')\r\n try {\r\n const ssoToken = await OfficeJsWrapper.getSsoTokenThirdParty()\r\n if (ssoToken) {\r\n Log.logger.info('Got SSO token!')\r\n const decoded = decodeO365JwtToken(ssoToken)\r\n if (!decoded) {\r\n throw logAndBuildError('Unable to decode token returned from GetSSOTokenAsync')\r\n }\r\n\r\n return { userInfo: decoded, authContext: new SSOThirdPartyAuthContext(ssoToken) }\r\n }\r\n throw new Error('GetSSOTokenAsync returned no token')\r\n } catch (e) {\r\n Log.logger.warn(`Error trying to get SSO token (third-party): code ${e.code}`)\r\n }\r\n\r\n Log.logger.info('Attempting first-party SSO auth')\r\n try {\r\n const ssoToken = await getSSOTokenFirstParty(this)\r\n if (ssoToken) {\r\n return ssoToken\r\n }\r\n\r\n Log.logger.info('Unable to get SSO token (first-party)')\r\n } catch (e) {\r\n Log.logger.warn(`Error trying to get SSO token (first-party): code ${e.code}`)\r\n }\r\n\r\n return undefined\r\n }\r\n\r\n public insertNote = async (note: string): Promise => {\r\n return await OfficeJsWrapper.getInstance().setSelectedTextAsync(note)\r\n }\r\n\r\n public onThemeChanged = (handler: (newTheme: OneNoteTheme) => void): void => {\r\n try {\r\n registerThemeChangedEvent(handler)\r\n } catch (e) {\r\n Log.logger.warn('Unable to register for theme change events')\r\n }\r\n }\r\n\r\n public navigateToClientURL = async (url: string): Promise => {\r\n await OfficeJsWrapper.getInstance().navigateToClientURL(url)\r\n }\r\n}\r\n","import { isRunningInOneNoteContext } from '../isRunningInOneNoteContext';\r\nimport { toOneNoteTheme } from './toOneNoteTheme';\r\nexport function getCurrentTheme() {\r\n if (!isRunningInOneNoteContext()) {\r\n return 'Light';\r\n }\r\n var themeSwatches = Office.context.officeTheme;\r\n return toOneNoteTheme(themeSwatches);\r\n}\r\n//# sourceMappingURL=getCurrentTheme.js.map","import { isRunningInOneNoteContext } from '../isRunningInOneNoteContext';\r\nimport { toOneNoteTheme } from './toOneNoteTheme';\r\nexport function registerThemeChangedEvent(handler) {\r\n if (!isRunningInOneNoteContext()) {\r\n throw new Error('Attempted to register OfficeThemeChanged event outside of a OneNote context');\r\n }\r\n // We need to reference global OfficeJS structures that do not have public types (by design)\r\n // tslint:disable:no-any\r\n var context = Office.context;\r\n var Microsoft = window.Microsoft;\r\n return context.application.addHandlerAsync(Microsoft.Office.WebExtension.EventType.OfficeThemeChanged, function (themeChangedEventArgs) {\r\n handler(toOneNoteTheme(themeChangedEventArgs.officeTheme));\r\n });\r\n // tslint:enable:no-any\r\n}\r\n//# sourceMappingURL=registerThemeChangedEvent.js.map","import { OfficeJSHostAdapter } from './hostIntegration/OfficeJSHostAdapter'\r\nimport { OfficeJsWrapper } from './officeJsWrapper/OfficeJsWrapper'\r\nimport { startApp } from './startApp'\r\n\r\nOfficeJsWrapper.registerInitializeFunction(() => startApp(new OfficeJSHostAdapter()))\r\n","import { getErrorAsString, IAuthCookie } from '@notes/webintegrations-common'\r\nimport { Log } from '../../shared/logger/Log'\r\nimport { o365CommonAuthAccessToken } from './localStorageIsSignedInKey'\r\n\r\nexport function getO365AccessTokenInfoFromLocalStorage(): IAuthCookie | undefined {\r\n if (!localStorage) {\r\n Log.logger.error('Local storage is disabled. We will not be able to get o365 credentials.')\r\n return undefined\r\n }\r\n\r\n let credentials: string | null = null\r\n const localStorageKey = o365CommonAuthAccessToken\r\n try {\r\n credentials = localStorage.getItem(localStorageKey)\r\n } catch (error) {\r\n Log.logger.warn(`Cache ${localStorageKey}: Unable to get element ${getErrorAsString(error)}`)\r\n }\r\n if (!credentials) {\r\n Log.logger.info('Could not find o365 credentials in local storage.')\r\n return undefined\r\n }\r\n\r\n Log.logger.info('Found o365 credentials in local storage.')\r\n let jsonInStorage: IAuthCookie | null = null\r\n try {\r\n jsonInStorage = JSON.parse(credentials) as IAuthCookie\r\n } catch (error) {\r\n Log.logger.error(`Error parsing o365 credentials from local storage: ${getErrorAsString(error)}`)\r\n return undefined\r\n }\r\n if (isValidO365Credentials(jsonInStorage)) {\r\n return jsonInStorage\r\n }\r\n\r\n Log.logger.info('Found o365 credentials in local storage, but they did not have the expected properties.')\r\n return undefined\r\n}\r\n\r\nexport function isValidO365Credentials(cred: IAuthCookie): boolean {\r\n return !!(cred && cred.access_token && cred.expires_in)\r\n}\r\n","import { getForceSignInUrl, getMsaImplicitGrantSignInUrl } from '../shared/auth/getSignInUrl'\r\n\r\nexport const redirectToAuth = (isMsaAccount: boolean) => {\r\n // Redirect the user to login flow\r\n window.location.href = isMsaAccount ? getMsaImplicitGrantSignInUrl() : getForceSignInUrl(false)\r\n\r\n return {\r\n shouldStopExecution: true,\r\n userInfo: undefined,\r\n }\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjCreate, strShimFunction, strShimObject, strShimPrototype, strShimUndefined } from \"./Constants\";\r\nvar _cachedGlobal = null;\r\n/**\r\n * Returns the current global scope object, for a normal web page this will be the current\r\n * window, for a Web Worker this will be current worker global scope via \"self\". The internal\r\n * implementation returns the first available instance object in the following order\r\n * - globalThis (New standard)\r\n * - self (Will return the current window instance for supported browsers)\r\n * - window (fallback for older browser implementations)\r\n * - global (NodeJS standard)\r\n * - (When all else fails)\r\n * While the return type is a Window for the normal case, not all environments will support all\r\n * of the properties or functions.\r\n */\r\nexport function getGlobal(useCached) {\r\n if (useCached === void 0) { useCached = true; }\r\n var result = useCached === false ? null : _cachedGlobal;\r\n if (!result) {\r\n if (typeof globalThis !== strShimUndefined) {\r\n result = globalThis;\r\n }\r\n if (!result && typeof self !== strShimUndefined) {\r\n result = self;\r\n }\r\n if (!result && typeof window !== strShimUndefined) {\r\n result = window;\r\n }\r\n if (!result && typeof global !== strShimUndefined) {\r\n result = global;\r\n }\r\n _cachedGlobal = result;\r\n }\r\n return result;\r\n}\r\nexport function throwTypeError(message) {\r\n throw new TypeError(message);\r\n}\r\n/**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil\r\n * for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param obj Object to use as a prototype. May be null\r\n */\r\nexport function objCreateFn(obj) {\r\n var func = ObjCreate;\r\n // Use build in Object.create\r\n if (func) {\r\n // Use Object create method if it exists\r\n return func(obj);\r\n }\r\n if (obj == null) {\r\n return {};\r\n }\r\n var type = typeof obj;\r\n if (type !== strShimObject && type !== strShimFunction) {\r\n throwTypeError(\"Object prototype may only be an Object:\" + obj);\r\n }\r\n function tmpFunc() { }\r\n tmpFunc[strShimPrototype] = obj;\r\n return new tmpFunc();\r\n}\r\n//# sourceMappingURL=Helpers.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjCreate, strShimFunction, strShimObject, strShimPrototype, strShimUndefined } from \"./Constants\";\r\nvar _cachedGlobal = null;\r\n/**\r\n * Returns the current global scope object, for a normal web page this will be the current\r\n * window, for a Web Worker this will be current worker global scope via \"self\". The internal\r\n * implementation returns the first available instance object in the following order\r\n * - globalThis (New standard)\r\n * - self (Will return the current window instance for supported browsers)\r\n * - window (fallback for older browser implementations)\r\n * - global (NodeJS standard)\r\n * - (When all else fails)\r\n * While the return type is a Window for the normal case, not all environments will support all\r\n * of the properties or functions.\r\n */\r\nexport function getGlobal(useCached) {\r\n if (useCached === void 0) { useCached = true; }\r\n if (!_cachedGlobal || !useCached) {\r\n if (typeof globalThis !== strShimUndefined && globalThis) {\r\n _cachedGlobal = globalThis;\r\n }\r\n if (typeof self !== strShimUndefined && self) {\r\n _cachedGlobal = self;\r\n }\r\n if (typeof window !== strShimUndefined && window) {\r\n _cachedGlobal = window;\r\n }\r\n if (typeof global !== strShimUndefined && global) {\r\n _cachedGlobal = global;\r\n }\r\n }\r\n return _cachedGlobal;\r\n}\r\nexport function throwTypeError(message) {\r\n throw new TypeError(message);\r\n}\r\n/**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil\r\n * for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param obj Object to use as a prototype. May be null\r\n */\r\nexport function objCreateFn(obj) {\r\n var func = ObjCreate;\r\n // Use build in Object.create\r\n if (func) {\r\n // Use Object create method if it exists\r\n return func(obj);\r\n }\r\n if (obj == null) {\r\n return {};\r\n }\r\n var type = typeof obj;\r\n if (type !== strShimObject && type !== strShimFunction) {\r\n throwTypeError(\"Object prototype may only be an Object:\" + obj);\r\n }\r\n function tmpFunc() { }\r\n tmpFunc[strShimPrototype] = obj;\r\n return new tmpFunc();\r\n}\r\n//# sourceMappingURL=Helpers.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjCreate, strShimFunction, strShimObject, strShimPrototype, strShimUndefined } from \"./Constants\";\r\nvar _cachedGlobal = null;\r\n/**\r\n * Returns the current global scope object, for a normal web page this will be the current\r\n * window, for a Web Worker this will be current worker global scope via \"self\". The internal\r\n * implementation returns the first available instance object in the following order\r\n * - globalThis (New standard)\r\n * - self (Will return the current window instance for supported browsers)\r\n * - window (fallback for older browser implementations)\r\n * - global (NodeJS standard)\r\n * - (When all else fails)\r\n * While the return type is a Window for the normal case, not all environments will support all\r\n * of the properties or functions.\r\n */\r\nexport function getGlobal(useCached) {\r\n if (useCached === void 0) { useCached = true; }\r\n if (!_cachedGlobal || !useCached) {\r\n if (typeof globalThis !== strShimUndefined && globalThis) {\r\n _cachedGlobal = globalThis;\r\n }\r\n if (typeof self !== strShimUndefined && self) {\r\n _cachedGlobal = self;\r\n }\r\n if (typeof window !== strShimUndefined && window) {\r\n _cachedGlobal = window;\r\n }\r\n if (typeof global !== strShimUndefined && global) {\r\n _cachedGlobal = global;\r\n }\r\n }\r\n return _cachedGlobal;\r\n}\r\nexport function throwTypeError(message) {\r\n throw new TypeError(message);\r\n}\r\n/**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil\r\n * for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param obj Object to use as a prototype. May be null\r\n */\r\nexport function objCreateFn(obj) {\r\n var func = ObjCreate;\r\n // Use build in Object.create\r\n if (func) {\r\n // Use Object create method if it exists\r\n return func(obj);\r\n }\r\n if (obj == null) {\r\n return {};\r\n }\r\n var type = typeof obj;\r\n if (type !== strShimObject && type !== strShimFunction) {\r\n throwTypeError(\"Object prototype may only be an Object:\" + obj);\r\n }\r\n function tmpFunc() { }\r\n tmpFunc[strShimPrototype] = obj;\r\n return new tmpFunc();\r\n}\r\n//# sourceMappingURL=Helpers.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjCreate, strShimFunction, strShimObject, strShimPrototype, strShimUndefined } from \"./Constants\";\r\nvar _cachedGlobal = null;\r\n/**\r\n * Returns the current global scope object, for a normal web page this will be the current\r\n * window, for a Web Worker this will be current worker global scope via \"self\". The internal\r\n * implementation returns the first available instance object in the following order\r\n * - globalThis (New standard)\r\n * - self (Will return the current window instance for supported browsers)\r\n * - window (fallback for older browser implementations)\r\n * - global (NodeJS standard)\r\n * - (When all else fails)\r\n * While the return type is a Window for the normal case, not all environments will support all\r\n * of the properties or functions.\r\n */\r\nexport function getGlobal(useCached) {\r\n if (useCached === void 0) { useCached = true; }\r\n if (!_cachedGlobal || !useCached) {\r\n if (typeof globalThis !== strShimUndefined && globalThis) {\r\n _cachedGlobal = globalThis;\r\n }\r\n if (typeof self !== strShimUndefined && self) {\r\n _cachedGlobal = self;\r\n }\r\n if (typeof window !== strShimUndefined && window) {\r\n _cachedGlobal = window;\r\n }\r\n if (typeof global !== strShimUndefined && global) {\r\n _cachedGlobal = global;\r\n }\r\n }\r\n return _cachedGlobal;\r\n}\r\nexport function throwTypeError(message) {\r\n throw new TypeError(message);\r\n}\r\n/**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil\r\n * for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param obj Object to use as a prototype. May be null\r\n */\r\nexport function objCreateFn(obj) {\r\n var func = ObjCreate;\r\n // Use build in Object.create\r\n if (func) {\r\n // Use Object create method if it exists\r\n return func(obj);\r\n }\r\n if (obj == null) {\r\n return {};\r\n }\r\n var type = typeof obj;\r\n if (type !== strShimObject && type !== strShimFunction) {\r\n throwTypeError(\"Object prototype may only be an Object:\" + obj);\r\n }\r\n function tmpFunc() { }\r\n tmpFunc[strShimPrototype] = obj;\r\n return new tmpFunc();\r\n}\r\n//# sourceMappingURL=Helpers.js.map","import { AccountType, IUserContext } from '@notes/aria-common-schema-logger'\r\nimport { IAuthenticatedUserInfo } from '@notes/webintegrations-common'\r\n\r\nexport function getOTelLoggingUserContextFromUserInformation(userInfo: IAuthenticatedUserInfo | undefined): IUserContext | undefined {\r\n if (!userInfo) {\r\n return undefined\r\n }\r\n\r\n return {\r\n tenantId: userInfo.tenantId,\r\n userId: userInfo.authType === 'o365' ? userInfo.userObjectId!! : userInfo.userCid!!,\r\n userType: userInfo.authType === 'o365' ? AccountType.OrgIdPUID : AccountType.MSACID,\r\n }\r\n}\r\n","import {\r\n getErrorAsString,\r\n IAuthenticatedUserInfo,\r\n ILogger,\r\n logWebPerfData,\r\n registerUnhandledRejectionLogger,\r\n registerWebIntegrationsLogger,\r\n registerWindowOnErrorLogger} from '@notes/webintegrations-common'\r\nimport { initializeIcons } from '@uifabric/icons'\r\nimport { LocalizationService } from './localization/LocalizationService'\r\nimport { getHostNameFromUrl } from './shared/lib/getHostNameFromUrl'\r\nimport { EventName } from './shared/logger/EventName'\r\nimport { Log } from './shared/logger/Log'\r\n\r\n/*\r\n Sets up non visual parts of the Frame around the canvas. Today this includes\r\n localization and logging.\r\n*/\r\n\r\nexport class AppIntegrationSetup {\r\n public static async init(bootEvent: EventName, desiredLocale: string, userInfo?: IAuthenticatedUserInfo): Promise {\r\n // TODO(jogonzal): The referrer will always be login.microsoftonline if we had to auth\r\n // We need to persist this through the oauth state as a query param, however this is ok for\r\n // an initial implementation\r\n Log.logger.logReportData(bootEvent, false /* isCriticalEvent */, undefined /* payloadNonPII */, {\r\n referrer: document.referrer,\r\n referrerDomain: document.referrer ? getHostNameFromUrl(document.referrer) : '',\r\n authType: userInfo ? userInfo.authType : '',\r\n })\r\n\r\n // Initialize localization\r\n await this.initLocalization(desiredLocale)\r\n\r\n // Register UI fabric icons and pull the fonts from the default SharePoint cdn\r\n initializeIcons('https://res.cdn.office.net/files/fabric-cdn-prod_20241209.001/assets/icons/')\r\n }\r\n\r\n // tslint:disable-next-line:no-any\r\n public static initLogging(_windowObj: any, logger: ILogger | undefined): void {\r\n // We've chosen not to send data to aria\r\n console.warn('Warning: SDK Aria logging will be disabled for this session.')\r\n\r\n if (logger) {\r\n Log.initialize(logger)\r\n }\r\n\r\n // Registering logger for webintegrations-common library\r\n registerWebIntegrationsLogger(Log.logger)\r\n\r\n Log.logger.info('Performing initial setup')\r\n\r\n // Registering windowOnError and promise rejection loggers\r\n registerWindowOnErrorLogger()\r\n registerUnhandledRejectionLogger()\r\n\r\n // Logging web perf data\r\n logWebPerfData()\r\n }\r\n\r\n private static async initLocalization(desiredLocale: string): Promise {\r\n try {\r\n await LocalizationService.changeLocale(desiredLocale)\r\n } catch (error) {\r\n Log.logger.error('Error when changing locale ' + getErrorAsString(error))\r\n // if the locale doesn't match try again with the default locale\r\n await LocalizationService.changeLocale(LocalizationService.DEFAULT_LOCALE)\r\n }\r\n }\r\n}\r\n","export function getHostNameFromUrl(url: string): string {\r\n const a = document.createElement('a')\r\n a.href = url\r\n return a.hostname\r\n}\r\n","/**\r\n * Represents locales we support.\r\n * Should be kept in sync with https://setup.intlservices.microsoft.com/Home/ConfigSettings?TeamID=520\r\n */\r\n\r\nexport interface ILanguageInformation {\r\n isRtl?: boolean\r\n}\r\n\r\nconst supportedLanguages: { [languageCode: string]: ILanguageInformation } = {\r\n 'ar': {\r\n 'isRtl': true\r\n },\r\n 'bg': {},\r\n 'cs': {},\r\n 'cy': {},\r\n 'da': {},\r\n 'de': {},\r\n 'el': {},\r\n 'en-US': {},\r\n 'en-GB': {},\r\n 'es': {},\r\n 'et': {},\r\n 'eu': {},\r\n 'fi': {},\r\n 'fr': {},\r\n 'gu': {},\r\n 'he': {\r\n 'isRtl': true\r\n },\r\n 'hi': {},\r\n 'hr': {},\r\n 'hu': {},\r\n 'id': {},\r\n 'is': {},\r\n 'it': {},\r\n 'ja': {},\r\n 'ka': {},\r\n 'kk': {},\r\n 'ko': {},\r\n 'lt': {},\r\n 'lv': {},\r\n 'mr': {},\r\n 'ms': {},\r\n 'nb-NO': {},\r\n 'nl': {},\r\n 'pl': {},\r\n 'pt-BR': {},\r\n 'pt-PT': {},\r\n 'ro': {},\r\n 'ru': {},\r\n 'sk': {},\r\n 'sl': {},\r\n 'sr-Cyrl-RS': {},\r\n 'sr-Latn-RS': {},\r\n 'sv': {},\r\n 'th': {},\r\n 'tr': {},\r\n 'uk': {},\r\n 'vi': {},\r\n 'zh-Hans': {},\r\n 'zh-Hant': {}\r\n}\r\n\r\nexport const languageModuleMap: { [languageCode: string]: string }= {\r\n 'ar': 'ar',\r\n 'bg': 'bg',\r\n 'cs': 'cs',\r\n 'cy': 'cy',\r\n 'da': 'da',\r\n 'de': 'de',\r\n 'el': 'el',\r\n 'en-US': 'en-US',\r\n 'en-GB': 'en-GB',\r\n 'es': 'es',\r\n 'et': 'et',\r\n 'eu': 'eu',\r\n 'fi': 'fi',\r\n 'fr': 'fr',\r\n 'gu': 'gu',\r\n 'he': 'he',\r\n 'hi': 'hi',\r\n 'hr': 'hr',\r\n 'hu': 'hu',\r\n 'id': 'id',\r\n 'is': 'is',\r\n 'it': 'it',\r\n 'ja': 'ja',\r\n 'ka': 'ka',\r\n 'kk': 'kk',\r\n 'ko': 'ko',\r\n 'lt': 'lt',\r\n 'lv': 'lv',\r\n 'mr': 'mr',\r\n 'ms': 'ms',\r\n 'nb-NO': 'nb-NO',\r\n 'nl': 'nl',\r\n 'pl': 'pl',\r\n 'pt-BR': 'pt-BR',\r\n 'pt-PT': 'pt-PT',\r\n 'ro': 'ro',\r\n 'ru': 'ru',\r\n 'sk': 'sk',\r\n 'sl': 'sl',\r\n 'sr-Cyrl-RS': 'sr-Cyrl-RS',\r\n 'sr-Latn-RS': 'sr-Latn-RS',\r\n 'sv': 'sv',\r\n 'th': 'th',\r\n 'tr': 'tr',\r\n 'uk': 'uk',\r\n 'vi': 'vi',\r\n 'zh-Hans': 'zh-Hans',\r\n 'zh-Hant': 'zh-Hant',\r\n 'zh-CN': 'zh-Hans',\r\n 'zh-TW': 'zh-Hant'\r\n}\r\n\r\nexport default supportedLanguages","export enum LocaleCompatibility {\r\n EXACT_MATCH = 10,\r\n GOOD_MATCH = 5,\r\n POOR_MATCH = 1,\r\n NO_MATCH = 0\r\n}","import { LocaleCompatibility } from '../localization/LocaleCompatibility'\r\nimport { Errors } from './logger/Errors'\r\nimport { Log } from './logger/Log'\r\n\r\nexport class LocalizationActivity {\r\n private start: number\r\n private desiredLocale: string\r\n private matchedLocale: string\r\n private compatibility: LocaleCompatibility\r\n\r\n constructor(desiredLocale: string, matchedLocale: string, compatibility: LocaleCompatibility) {\r\n this.start = Date.now()\r\n this.desiredLocale = desiredLocale\r\n this.matchedLocale = matchedLocale\r\n this.compatibility = compatibility\r\n }\r\n\r\n public finishWithSuccess(): void {\r\n Log.logger.logReportData('LocalizationActivity', false /* isCriticalEvent */, {\r\n 'Success': true,\r\n 'SuccessRate': 1,\r\n 'Duration': Date.now() - this.start,\r\n 'DesiredLocale': this.desiredLocale,\r\n 'MatchedLocale': this.matchedLocale,\r\n 'Compatibility': LocaleCompatibility[this.compatibility],\r\n })\r\n }\r\n\r\n public finishWithFailure(errorBucket: string, error?: Error): void {\r\n Log.logger.logReportData('LocalizationActivity', false /* isCriticalEvent */, {\r\n 'Success': false,\r\n 'SuccessRate': 0,\r\n 'DesiredLocale': this.desiredLocale,\r\n 'MatchedLocale': this.matchedLocale,\r\n } /* payloadNonPII */, {\r\n 'ErrorName': error ? error.name : '',\r\n 'Duration': Date.now() - this.start,\r\n 'ErrorMessage': error ? error.message : '',\r\n 'ErrorBucket': errorBucket,\r\n 'Compatibility': LocaleCompatibility[this.compatibility],\r\n })\r\n\r\n Log.logger.logUnexpected(Errors.getLocalizationActivityError(errorBucket), errorBucket)\r\n }\r\n}\r\n","import supportedLanguages, { languageModuleMap } from './supportedLanguages'\r\nimport { ILocaleData } from './ILocaleData'\r\nimport { LocaleCompatibility } from './LocaleCompatibility'\r\nimport { LocalizationString } from './localization-strings'\r\nimport { ILanguageInformation } from './supportedLanguages'\r\nimport { Log } from '../shared/logger/Log'\r\nimport { LocalizationActivity } from '../shared/LocalizationActivity'\r\nexport type TextDirectionType = 'ltr' | 'rtl'\r\n\r\ninterface ILocaleWithCompatibility {\r\n locale: string,\r\n points: LocaleCompatibility\r\n}\r\n\r\nexport class LocalizationService {\r\n private static _locale: string\r\n private static _localeInfo: ILanguageInformation\r\n\r\n private static translationsCache: { [locale: string]: { [stringId: string]: string} } = {}\r\n public static readonly DEFAULT_LOCALE = 'en-US'\r\n\r\n static get areLocalizationValuesReady(): boolean {\r\n if (this._locale && this._localeInfo) {\r\n return true\r\n }\r\n return false\r\n }\r\n\r\n static get locale() {\r\n return this._locale\r\n }\r\n\r\n static get textDirection(): TextDirectionType {\r\n return this._localeInfo.isRtl ? 'rtl' : 'ltr'\r\n }\r\n\r\n static get isRtl(): boolean {\r\n return this._localeInfo.isRtl ? this._localeInfo.isRtl : false\r\n }\r\n\r\n /**\r\n * Gets supported locale from a rawLocale string\r\n */\r\n static getSupportedLocale(rawLocale: string): ILocaleWithCompatibility {\r\n // Supported languages (EOL) support specified in https://setup.intlservices.microsoft.com/Home/ConfigSettings?TeamID=520\r\n let bestSoFar: ILocaleWithCompatibility = { points: LocaleCompatibility.NO_MATCH, locale: LocalizationService.DEFAULT_LOCALE }\r\n for (const supportedLocale of Object.keys(supportedLanguages)) {\r\n const compatibilityValue = LocalizationService.getLocaleCompatibilityValue(supportedLocale, rawLocale)\r\n if (compatibilityValue === LocaleCompatibility.EXACT_MATCH) {\r\n return { locale: supportedLocale, points: LocaleCompatibility.EXACT_MATCH }\r\n }\r\n if (compatibilityValue > bestSoFar.points) {\r\n bestSoFar = { points: compatibilityValue, locale: supportedLocale }\r\n }\r\n }\r\n\r\n return bestSoFar\r\n }\r\n\r\n private static getLocaleCompatibilityValue(systemLocale: string, desiredLocale: string): LocaleCompatibility {\r\n if (!systemLocale || !desiredLocale) {\r\n return LocaleCompatibility.NO_MATCH\r\n }\r\n\r\n const [desiredLang, desiredCulture] = desiredLocale.toLocaleLowerCase().split('-')\r\n const [lang, culture] = systemLocale.toLocaleLowerCase().split('-')\r\n\r\n if (lang === desiredLang && culture === desiredCulture) {\r\n return LocaleCompatibility.EXACT_MATCH\r\n } else if (lang === desiredLang && !culture) {\r\n return LocaleCompatibility.GOOD_MATCH\r\n } else if (lang === desiredLang) {\r\n return LocaleCompatibility.POOR_MATCH\r\n }\r\n return LocaleCompatibility.NO_MATCH\r\n }\r\n\r\n static async changeLocale(locale: string): Promise {\r\n locale = languageModuleMap[locale] ?? locale\r\n const supportedLocaleInfo = LocalizationService.getSupportedLocale(locale)\r\n const localizationActivity = new LocalizationActivity(locale, supportedLocaleInfo.locale, supportedLocaleInfo.points)\r\n\r\n try {\r\n if (!LocalizationService.translationsCache[supportedLocaleInfo.locale]) {\r\n const currentLocalePromise = import(`./locales/${supportedLocaleInfo.locale}/index`) as Promise\r\n \r\n // This is done to prevent double-loading of the same set of strings\r\n const defaultLocalePromise = supportedLocaleInfo.locale === LocalizationService.DEFAULT_LOCALE\r\n ? Promise.resolve({ translations: {} })\r\n : import(`./locales/${LocalizationService.DEFAULT_LOCALE}/index`) as Promise\r\n \r\n const currentLocaleData = await currentLocalePromise\r\n const defaultLocaleData = await defaultLocalePromise\r\n \r\n LocalizationService.translationsCache[supportedLocaleInfo.locale] = { ...defaultLocaleData.translations, ...currentLocaleData.translations }\r\n LocalizationService.updateLocale(supportedLocaleInfo.locale)\r\n localizationActivity.finishWithSuccess()\r\n } else {\r\n LocalizationService.updateLocale(supportedLocaleInfo.locale)\r\n localizationActivity.finishWithFailure('LocaleShouldNotBeChangedMoreThanOnce')\r\n }\r\n } catch(ex) {\r\n localizationActivity.finishWithFailure('ErrorDuringLocalization', ex)\r\n }\r\n }\r\n\r\n private static updateLocale(locale: string) {\r\n LocalizationService._locale = locale\r\n LocalizationService._localeInfo = this.getSupportedLocaleInfo(locale)\r\n\r\n const htmlElement = document.getElementsByTagName('html')[0]\r\n if (htmlElement && htmlElement.setAttribute) {\r\n const lang = locale.split('-')[0]\r\n htmlElement.setAttribute('lang', lang)\r\n htmlElement.setAttribute('dir',LocalizationService.textDirection)\r\n }\r\n }\r\n\r\n static getLocalizedString(id: LocalizationString): string {\r\n const translations = LocalizationService.translationsCache[this._locale]\r\n if (!translations) {\r\n Log.logger.error('Translations for this locale have not been fetched yet! Be sure to await changeLocale before calling getLocalizedString!')\r\n return ''\r\n }\r\n\r\n const str = translations[id]\r\n if (!str) {\r\n Log.logger.error('The requested id has no matching localized string or fallback.')\r\n }\r\n return str || ''\r\n }\r\n\r\n static getSupportedLocaleInfo(locale: string): ILanguageInformation {\r\n return supportedLanguages[locale]\r\n }\r\n}","import { LOADING_PLACEHOLDER_ID } from './elementIds'\r\n\r\nexport function showLoadingSpinner(): void {\r\n getLoadingPlaceholder()!.style.display = 'block'\r\n}\r\n\r\nexport function hideLoadingSpinner(): void {\r\n getLoadingPlaceholder()!.style.display = 'none'\r\n}\r\n\r\nfunction getLoadingPlaceholder(): HTMLElement | null {\r\n return document.getElementById(LOADING_PLACEHOLDER_ID)\r\n}\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var strShimFunction = \"function\";\r\nexport var strShimObject = \"object\";\r\nexport var strShimUndefined = \"undefined\";\r\nexport var strShimPrototype = \"prototype\";\r\nexport var strShimHasOwnProperty = \"hasOwnProperty\";\r\nexport var strDefault = \"default\";\r\nexport var ObjClass = Object;\r\nexport var ObjProto = ObjClass[strShimPrototype];\r\nexport var ObjAssign = ObjClass[\"assign\"];\r\nexport var ObjCreate = ObjClass[\"create\"];\r\nexport var ObjDefineProperty = ObjClass[\"defineProperty\"];\r\nexport var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];\r\n//# sourceMappingURL=Constants.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var strShimFunction = \"function\";\r\nexport var strShimObject = \"object\";\r\nexport var strShimUndefined = \"undefined\";\r\nexport var strShimPrototype = \"prototype\";\r\nexport var strShimHasOwnProperty = \"hasOwnProperty\";\r\nexport var strDefault = \"default\";\r\nexport var ObjClass = Object;\r\nexport var ObjProto = ObjClass[strShimPrototype];\r\nexport var ObjAssign = ObjClass[\"assign\"];\r\nexport var ObjCreate = ObjClass[\"create\"];\r\nexport var ObjDefineProperty = ObjClass[\"defineProperty\"];\r\nexport var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];\r\n//# sourceMappingURL=Constants.js.map","var map = {\n\t\"./ar/index\": [\n\t\t428,\n\t\t12\n\t],\n\t\"./bg/index\": [\n\t\t429,\n\t\t13\n\t],\n\t\"./cs/index\": [\n\t\t430,\n\t\t14\n\t],\n\t\"./da/index\": [\n\t\t431,\n\t\t15\n\t],\n\t\"./de/index\": [\n\t\t432,\n\t\t16\n\t],\n\t\"./el/index\": [\n\t\t433,\n\t\t17\n\t],\n\t\"./en-GB/index\": [\n\t\t434,\n\t\t18\n\t],\n\t\"./en-US/index\": [\n\t\t435,\n\t\t19\n\t],\n\t\"./es/index\": [\n\t\t436,\n\t\t20\n\t],\n\t\"./et/index\": [\n\t\t437,\n\t\t21\n\t],\n\t\"./eu/index\": [\n\t\t438,\n\t\t22\n\t],\n\t\"./fi/index\": [\n\t\t439,\n\t\t23\n\t],\n\t\"./fr/index\": [\n\t\t440,\n\t\t24\n\t],\n\t\"./he/index\": [\n\t\t441,\n\t\t25\n\t],\n\t\"./hi/index\": [\n\t\t442,\n\t\t26\n\t],\n\t\"./hr/index\": [\n\t\t443,\n\t\t27\n\t],\n\t\"./hu/index\": [\n\t\t444,\n\t\t28\n\t],\n\t\"./id/index\": [\n\t\t445,\n\t\t29\n\t],\n\t\"./is/index\": [\n\t\t446,\n\t\t30\n\t],\n\t\"./it/index\": [\n\t\t447,\n\t\t31\n\t],\n\t\"./ja/index\": [\n\t\t448,\n\t\t32\n\t],\n\t\"./kk/index\": [\n\t\t449,\n\t\t33\n\t],\n\t\"./ko/index\": [\n\t\t450,\n\t\t34\n\t],\n\t\"./lt/index\": [\n\t\t451,\n\t\t35\n\t],\n\t\"./lv/index\": [\n\t\t452,\n\t\t36\n\t],\n\t\"./ms/index\": [\n\t\t453,\n\t\t37\n\t],\n\t\"./nb-NO/index\": [\n\t\t454,\n\t\t38\n\t],\n\t\"./nl/index\": [\n\t\t455,\n\t\t39\n\t],\n\t\"./pl/index\": [\n\t\t456,\n\t\t40\n\t],\n\t\"./pt-BR/index\": [\n\t\t457,\n\t\t41\n\t],\n\t\"./pt-PT/index\": [\n\t\t458,\n\t\t42\n\t],\n\t\"./ro/index\": [\n\t\t459,\n\t\t43\n\t],\n\t\"./ru/index\": [\n\t\t460,\n\t\t44\n\t],\n\t\"./sk/index\": [\n\t\t461,\n\t\t45\n\t],\n\t\"./sl/index\": [\n\t\t462,\n\t\t46\n\t],\n\t\"./sr-Cyrl-RS/index\": [\n\t\t463,\n\t\t47\n\t],\n\t\"./sr-Latn-RS/index\": [\n\t\t464,\n\t\t48\n\t],\n\t\"./sv/index\": [\n\t\t465,\n\t\t49\n\t],\n\t\"./th/index\": [\n\t\t466,\n\t\t50\n\t],\n\t\"./tr/index\": [\n\t\t467,\n\t\t51\n\t],\n\t\"./uk/index\": [\n\t\t468,\n\t\t52\n\t],\n\t\"./vi/index\": [\n\t\t469,\n\t\t53\n\t],\n\t\"./zh-Hans/index\": [\n\t\t470,\n\t\t54\n\t],\n\t\"./zh-Hant/index\": [\n\t\t471,\n\t\t55\n\t]\n};\nfunction webpackAsyncContext(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\treturn Promise.resolve().then(function() {\n\t\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\t\te.code = 'MODULE_NOT_FOUND';\n\t\t\tthrow e;\n\t\t});\n\t}\n\n\tvar ids = map[req], id = ids[0];\n\treturn __webpack_require__.e(ids[1]).then(function() {\n\t\treturn __webpack_require__(id);\n\t});\n}\nwebpackAsyncContext.keys = function webpackAsyncContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackAsyncContext.id = 193;\nmodule.exports = webpackAsyncContext;","export function supportsCSSVariables(): boolean {\r\n return window.CSS && CSS.supports('color', 'var(--color-var)')\r\n}\r\n","import { Timings } from './ClientPerfMetrics'\r\n\r\nexport interface IEnvironmentSettings {\r\n sessionId: string\r\n correlationId: string\r\n version: string\r\n ring: string\r\n ExampleSettingOnlyTrueInInternal: boolean\r\n DisableOneNotePagesInFeed?: boolean\r\n DisableHtmlRendering?: boolean\r\n DisableOTelLogging?: boolean\r\n RedirectToOutlookNotesFolder?: boolean\r\n}\r\n\r\nexport interface ISettingsForClient {\r\n Locale: string\r\n ServerSidePerfMetrics: Timings\r\n GraphResourceUri: string,\r\n OutlookResourceUri: string,\r\n OneNoteResourceUri: string,\r\n}\r\n\r\n/*\r\n Controlled: Service Worker is active, and it is intercepting the network requests.\r\n Supported: Service Worker is supported on client's browser, but it is not yet active.\r\n Unsupported: Service Worker is not supported on client's browser.\r\n*/\r\nexport enum ServiceWorkerStatus {\r\n CONTROLLED = 'Controlled',\r\n SUPPORTED = 'Supported',\r\n UNSUPPORTED = 'Unsupported',\r\n}\r\n","import {\r\n IDBNotesLoadedEvent,\r\n IDetailMountedEvent, IMainMountedEvent, ISyncTelemetryEvent, TelemetryEvent\r\n} from '@notes/sticky-notes-layout'\r\nimport { isEdgeHubQueryParamPresent } from './lib/urlParserUtils'\r\nimport { Constants } from './shared/Constants'\r\nimport { Log } from './shared/logger/Log'\r\nimport { getServiceWorkerStatus } from './shared/Utils'\r\n\r\nconst SYNC_TELEMETRY = 'SYNC_TELEMETRY'\r\nconst MAIN_MOUNTED = '@client:MAIN_MOUNTED'\r\nconst DETAIL_MOUNTED = '@client:DETAIL_MOUNTED'\r\nconst DB_NOTES_LOADED = 'DB_NOTES_LOADED'\r\nconst TELEMETRY_DELETE_NOTE = 'DELETE_NOTE'\r\nconst TELEMETRY_NOTE_CREATED = 'NOTE_CREATED'\r\nconst TELEMETRY_NOTE_CONTENT_UPDATED = 'NOTE_CONTENT_UPDATED'\r\nconst TELEMETRY_NOTE_VIEWED = 'NOTE_VIEWED'\r\nconst TELEMETRY_TOGGLE_BOLD = 'TOGGLE_BOLD'\r\nconst TELEMETRY_TOGGLE_ITALICS = 'TOGGLE_ITALICS'\r\nconst TELEMETRY_TOGGLE_UNDERLINE = 'TOGGLE_UNDERLINE'\r\nconst TELEMETRY_TOGGLE_STRIKETHROUGH = 'TOGGLE_STRIKETHROUGH'\r\nconst TELEMETRY_TOGGLE_LIST = 'TOGGLE_LIST'\r\nconst TELEMETRY_ADD_NOTE_IMAGE = 'ADD_NOTE_IMAGE'\r\nconst TELEMETRY_COLOR_CHANGED = 'COLOR_CHANGED'\r\nconst TELEMETRY_UPDATE_SEARCH_TERM = 'UPDATE_SEARCH_TERM'\r\nconst TELEMETRY_TOGGLE_COLLAPSED_SEARCH = 'TOGGLE_COLLAPSED_SEARCH'\r\nconst TELEMETRY_SEARCH_RESULT_SELECTED = 'SEARCH_RESULT_SELECTED'\r\n\r\nconst navigationStart = performance && performance.timing\r\n && performance.timing.navigationStart\r\n\r\nexport interface INotesCollection {\r\n count: () => number\r\n}\r\n\r\nexport class LayoutSDKTelemetryCallbacks {\r\n private loggedFirstSync: boolean = false\r\n private isEdgeHub: boolean = isEdgeHubQueryParamPresent()\r\n\r\n onSDKSignOut (): void {\r\n Log.logger.info('onSDKSignOut: the SDK has signed out')\r\n }\r\n\r\n onNoteDeleted(): void {\r\n Log.logger.info('onNoteDeleted: A note has been deleted')\r\n }\r\n\r\n onNotesUpdated(_: INotesCollection): void {\r\n // Do not do this! Notes are updated on every keystroke\r\n }\r\n\r\n private handleSyncTelemetry (event: ISyncTelemetryEvent): void {\r\n if (!this.loggedFirstSync) {\r\n const totalNotes = event.data.pageCount + event.data.syncedNotesCount\r\n if (event.start && event.end && navigationStart) {\r\n Log.logger.logReportData('FirstSync', false /* isCriticalEvent */, {\r\n Type: event.data.context,\r\n Duration: event.end - event.start,\r\n TTFS: event.end - navigationStart,\r\n Start: event.start,\r\n End: event.end,\r\n } /* payloadNonPII */, {\r\n TotalNotes: totalNotes,\r\n })\r\n }\r\n\r\n if (this.isEdgeHub) {\r\n const flushEvent = new CustomEvent(Constants.NEW_USER_TO_ON_ECOSYSTEM_TELEMETRY_FLUSH_EVENT, { detail: { MessageId: 'TotalSyncNotes', Value: totalNotes } })\r\n document.dispatchEvent(flushEvent)\r\n }\r\n\r\n this.loggedFirstSync = true\r\n }\r\n }\r\n\r\n private handleMainMounted (event: IMainMountedEvent): void {\r\n if (navigationStart) {\r\n Log.logger.logReportData('TTI', false /* isCriticalEvent */, {\r\n Duration: event.end - navigationStart,\r\n Start: navigationStart,\r\n End: event.end,\r\n })\r\n }\r\n this.logResourceDownloadTelemetry()\r\n }\r\n\r\n private logResourceDownloadTelemetry (): void {\r\n if (!performance) {\r\n return\r\n }\r\n\r\n const navigationTiming = performance.getEntriesByType('navigation')[0] as PerformanceNavigationTiming\r\n const resourceTimings = performance.getEntriesByType('resource') as PerformanceResourceTiming[]\r\n\r\n if (!navigationTiming || !resourceTimings) {\r\n return\r\n }\r\n\r\n const navigationTimingTelemetry = {\r\n name: navigationTiming.name,\r\n startTime: navigationTiming.startTime,\r\n fetchStart: navigationTiming.fetchStart,\r\n requestStart: navigationTiming.requestStart,\r\n responseEnd: navigationTiming.responseEnd,\r\n transferSize: navigationTiming.transferSize,\r\n workerStart: navigationTiming.workerStart,\r\n }\r\n const resourceTimingTelemetry = []\r\n for (const resource of resourceTimings) {\r\n if (resource.initiatorType === 'link' || resource.initiatorType === 'script' || resource.initiatorType === 'css') {\r\n resourceTimingTelemetry.push({\r\n name: resource.name,\r\n startTime: resource.startTime,\r\n fetchStart: resource.fetchStart,\r\n requestStart: resource.requestStart,\r\n responseEnd: resource.responseEnd,\r\n transferSize: resource.transferSize,\r\n workerStart: resource.workerStart,\r\n })\r\n }\r\n }\r\n const data = {\r\n navigationTimingTelemetry,\r\n resourceTimingTelemetry,\r\n serviceWorkerStatus: getServiceWorkerStatus(),\r\n }\r\n Log.logger.logReportData('ResourceDownloadTelemetry', false /* isCriticalEvent */, {\r\n ResourceDownloadTelemetry: JSON.stringify(data),\r\n })\r\n }\r\n\r\n private handleDetailMounted (event: IDetailMountedEvent): void {\r\n if (navigationStart) {\r\n Log.logger.logReportData('DetailRendered', false /* isCriticalEvent */, {\r\n Duration: event.end - navigationStart,\r\n Start: navigationStart,\r\n End: event.end,\r\n })\r\n }\r\n }\r\n\r\n private handleDBLoaded (event: IDBNotesLoadedEvent): void {\r\n Log.logger.logReportData('NotesLoadedFromDB', false /* isCriticalEvent */, {\r\n Duration: event.end - event.start,\r\n Start: event.start,\r\n End: event.end,\r\n TotalNotes: event.data.totalNotesCount,\r\n })\r\n\r\n if (this.isEdgeHub) {\r\n const flushEvent = new CustomEvent(Constants.NEW_USER_TO_ON_ECOSYSTEM_TELEMETRY_FLUSH_EVENT, { detail: { MessageId: 'TotalDbNotes', Value: event.data.totalNotesCount } })\r\n document.dispatchEvent(flushEvent)\r\n }\r\n }\r\n\r\n // tslint:disable-next-line:max-func-body-length\r\n onTelemetry = (event: TelemetryEvent) => {\r\n // Ideally, the Sticky Notes Web SDK should pass event name, but currently it does not.\r\n // We try to use the same event name as in the Web SDK, so we translate each event.type to\r\n // a corresponding event name used in logReportData in the Web SDK.\r\n // See all event names \r\n switch (event.type) {\r\n case SYNC_TELEMETRY:\r\n this.handleSyncTelemetry(event)\r\n break\r\n case MAIN_MOUNTED:\r\n this.handleMainMounted(event)\r\n break\r\n case DETAIL_MOUNTED:\r\n this.handleDetailMounted(event)\r\n break\r\n case DB_NOTES_LOADED:\r\n this.handleDBLoaded(event)\r\n break\r\n case TELEMETRY_DELETE_NOTE:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteDeleted' })\r\n break\r\n case TELEMETRY_NOTE_CREATED:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteCreated' })\r\n break\r\n case TELEMETRY_NOTE_VIEWED:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteViewed' })\r\n break\r\n case TELEMETRY_NOTE_CONTENT_UPDATED:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteContentUpdated' })\r\n break\r\n case TELEMETRY_TOGGLE_BOLD:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteInlineStyleToggled', styleType: 'Bold' })\r\n break\r\n case TELEMETRY_TOGGLE_ITALICS:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteInlineStyleToggled', styleType: 'Italic' })\r\n break\r\n case TELEMETRY_TOGGLE_UNDERLINE:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteInlineStyleToggled', styleType: 'Underline' })\r\n break\r\n case TELEMETRY_TOGGLE_STRIKETHROUGH:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteInlineStyleToggled', styleType: 'Strikethrough' })\r\n break\r\n case TELEMETRY_TOGGLE_LIST:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'NoteBlockStyleToggled', styleType: 'Bullet' })\r\n break\r\n case TELEMETRY_ADD_NOTE_IMAGE:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'ImageAddedToNote' })\r\n break\r\n case TELEMETRY_COLOR_CHANGED:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'ColorChanged' })\r\n break\r\n case TELEMETRY_UPDATE_SEARCH_TERM:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'SearchInitiated' })\r\n break\r\n case TELEMETRY_TOGGLE_COLLAPSED_SEARCH:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'SearchOpened' })\r\n break\r\n case TELEMETRY_SEARCH_RESULT_SELECTED:\r\n Log.logger.logReportData(Constants.sdkTelemetryEventName, false /* isCriticalEvent */, { telemetryEvent: 'SearchResultSelected' })\r\n break\r\n default:\r\n Log.logger.info('onTelemetry: ' + JSON.stringify(event))\r\n break\r\n }\r\n }\r\n}\r\n","import { getAccessTokenInfoFromCookie, IAuthenticatedUserInfo, isMsa, logAndBuildError } from '@notes/webintegrations-common'\r\nimport { GetTokenFactory } from './GetTokenFactory'\r\nimport { IGetToken } from './IGetToken'\r\n\r\nexport type StickyNotesTokenInfo = {\r\n outlookToken: string\r\n graphOrMailboxToken?: string\r\n}\r\n\r\nexport interface IStickyNotesExchangeToken {\r\n exchangeTokenForStickyNotesTokens(): Promise\r\n}\r\n\r\n/**\r\n * Responsible for exchanging the given token for the tokens required by Sticky Notes\r\n */\r\nexport class StickyNotesExchangeToken implements IStickyNotesExchangeToken {\r\n private getToken: IGetToken\r\n\r\n constructor(getToken: IGetToken) {\r\n this.getToken = getToken\r\n }\r\n\r\n /**\r\n * Given an authenticated user, returns tokens required for Sticky Notes\r\n */\r\n async exchangeTokenForStickyNotesTokens(): Promise {\r\n const outlookToken = await this.getToken.getSubstrateNotesToken()\r\n\r\n return {\r\n outlookToken,\r\n }\r\n }\r\n}\r\n\r\nexport namespace StickyNotesExchangeTokenFactory {\r\n export function create(userInfo: IAuthenticatedUserInfo, forceRefresh: boolean, userInfoToken?: string): IStickyNotesExchangeToken {\r\n let exchangeToken: IGetToken\r\n if (isMsa(userInfo.authType)) {\r\n exchangeToken = GetTokenFactory.createMsa(forceRefresh)\r\n } else {\r\n // TODO (machiam) Simplify this somehow\r\n // Convert optional token string into an auth context with an initial token and refresh info\r\n if (!userInfoToken) {\r\n const tokenInfo = getAccessTokenInfoFromCookie()\r\n if (!tokenInfo) {\r\n throw logAndBuildError('Unable to get tokenInfo from cookie when we detected user is o365')\r\n }\r\n userInfoToken = tokenInfo.access_token\r\n }\r\n exchangeToken = GetTokenFactory.createO365(userInfoToken, userInfo.tenantId!, forceRefresh)\r\n }\r\n\r\n return new StickyNotesExchangeToken(exchangeToken)\r\n }\r\n}\r\n","import { ServiceWorkerStatus } from './types'\r\n\r\nexport function getServiceWorkerStatus(): ServiceWorkerStatus {\r\n if (window.navigator && window.navigator.serviceWorker) {\r\n return window.navigator.serviceWorker.controller ? ServiceWorkerStatus.CONTROLLED : ServiceWorkerStatus.SUPPORTED\r\n } else {\r\n return ServiceWorkerStatus.UNSUPPORTED\r\n }\r\n}\r\n","import { AuthType } from '@notes/webintegrations-common'\r\nimport { Errors } from '../logger/Errors'\r\nimport { Log } from '../logger/Log'\r\n\r\nexport class RefreshTokenForSdkActivity {\r\n private start: number\r\n private authType: AuthType | undefined\r\n\r\n constructor(authType: AuthType | undefined) {\r\n this.start = Date.now()\r\n this.authType = authType\r\n }\r\n\r\n public finishWithSuccess(): void {\r\n Log.logger.logReportData('RefreshTokenForSdkActivity', false /* isCriticalEvent */, {\r\n 'Success': true,\r\n 'SuccessRate': 1,\r\n 'Duration': Date.now() - this.start,\r\n 'AuthType': this.authType ? this.authType : '',\r\n })\r\n }\r\n\r\n public finishWithFailure(errorBucket: string, error?: Error): void {\r\n Log.logger.logReportData('RefreshTokenForSdkActivity', false /* isCriticalEvent */, {\r\n 'Success': false,\r\n 'SuccessRate': 0,\r\n 'Duration': Date.now() - this.start,\r\n } /* payloadNonPII */, {\r\n 'ErrorName': error ? error.name : '',\r\n 'ErrorMessage': error ? error.message : '',\r\n 'ErrorBucket': errorBucket,\r\n 'AuthType': this.authType ? this.authType : '',\r\n })\r\n\r\n Log.logger.logUnexpected(Errors.getRefreshTokenForSdkError(errorBucket), errorBucket)\r\n }\r\n}\r\n","import {\r\n getAccessTokenInfoFromCookie,\r\n getErrorAsString,\r\n getMsaImplicitFlowCredentials,\r\n IAuthCookie,\r\n IAuthenticatedUserInfo,\r\n isTokenExpired,\r\n refreshAccessToken\r\n} from '@notes/webintegrations-common'\r\nimport { getAuthTypeWithExtension } from '../../agave/auth/getAuthTypeWithExtension'\r\nimport { Log } from '../logger/Log'\r\nimport { StickyNotesExchangeTokenFactory, StickyNotesTokenInfo } from './StickyNotesExchangeToken'\r\n\r\n/**\r\n * Given an authenticated user, gets the app tokens needed for Sticky Notes SDK\r\n */\r\nexport async function getAppTokenInfoForStickyNotes(userInfo: IAuthenticatedUserInfo, forceRefresh: boolean, userInfoToken?: string): Promise {\r\n const exchangeToken = StickyNotesExchangeTokenFactory.create(userInfo, forceRefresh, userInfoToken)\r\n return await exchangeToken.exchangeTokenForStickyNotesTokens()\r\n}\r\n\r\nexport async function tryGetOAuthToken(): Promise {\r\n const authType = getAuthTypeWithExtension()\r\n\r\n if (!authType) {\r\n Log.logger.info('User is not authenticated')\r\n return undefined\r\n }\r\n\r\n if (authType === 'o365') {\r\n let tokenInfo = getAccessTokenInfoFromCookie()\r\n if (!tokenInfo) {\r\n Log.logger.info('No access token cookie detected. Returning undefined')\r\n return undefined\r\n }\r\n\r\n if (isTokenExpired(tokenInfo.expires_in)) {\r\n try {\r\n await refreshAccessToken()\r\n } catch (error) {\r\n Log.logger.warn(`Error occurred while refreshing access token: ${getErrorAsString(error)}. Returning undefined`)\r\n return undefined\r\n }\r\n\r\n tokenInfo = getAccessTokenInfoFromCookie()\r\n if (!tokenInfo) {\r\n Log.logger.warn('No access token cookie detected even after refreshing an existing one. Returning undefined')\r\n return undefined\r\n }\r\n }\r\n\r\n return tokenInfo\r\n }\r\n\r\n if (authType === 'msa_implicit') {\r\n return getMsaImplicitFlowCredentials()\r\n }\r\n\r\n Log.logger.warn(`tryGetOAuthTokenWithoutUserAction got unsupported AuthType: ${authType}`)\r\n return undefined\r\n}\r\n","import { AuthType, getErrorAsString } from '@notes/webintegrations-common'\r\nimport { Errors } from '../logger/Errors'\r\nimport { Log } from '../logger/Log'\r\n\r\nexport type SetTokenCase = 'refresh' | 'initialSetToken'\r\n\r\nexport class SetTokenInSdkActivity {\r\n private start: number\r\n private authType: AuthType\r\n private setTokenCase: SetTokenCase\r\n\r\n constructor(authType: AuthType, setTokenCase: SetTokenCase) {\r\n this.start = Date.now()\r\n this.authType = authType\r\n this.setTokenCase = setTokenCase\r\n }\r\n\r\n public finishWithSuccess(): void {\r\n Log.logger.logReportData('SetTokenInSdkActivity', false /* isCriticalEvent */, {\r\n 'Success': true,\r\n 'SuccessRate': 1,\r\n 'Duration': Date.now() - this.start,\r\n } /* payloadNonPII */, {\r\n 'AuthType': this.authType,\r\n 'SetTokenCase': this.setTokenCase,\r\n })\r\n }\r\n\r\n public finishWithFailure(errorBucket: string, error?: Error): void {\r\n Log.logger.logReportData('SetTokenInSdkActivity', false /* isCriticalEvent */, {\r\n 'Success': false,\r\n 'SuccessRate': 0,\r\n 'Duration': Date.now() - this.start,\r\n } /* payloadNonPII */, {\r\n 'ErrorName': error ? error.name : '',\r\n 'ErrorMessage': getErrorAsString(error),\r\n 'ErrorBucket': errorBucket,\r\n 'AuthType': this.authType,\r\n 'SetTokenCase': this.setTokenCase,\r\n })\r\n\r\n Log.logger.logUnexpected(Errors.getSetTokenInSdkError(errorBucket), errorBucket)\r\n }\r\n}\r\n","import { LayoutSDK } from '@notes/sticky-notes-layout'\r\nimport { getErrorAsString, IAuthenticatedUserInfo, isMsa } from '@notes/webintegrations-common'\r\nimport { getAppTokenInfoForStickyNotes } from '../shared/auth/getAppTokenInfoForStickyNotes'\r\nimport { IAuthContext } from '../shared/auth/IAuthContext'\r\nimport { SetTokenCase, SetTokenInSdkActivity } from '../shared/auth/SetTokenInSdkActivity'\r\nimport { Log } from '../shared/logger/Log'\r\n\r\nexport async function refreshTokensForSDK(layoutSDK: LayoutSDK, userInfo: IAuthenticatedUserInfo, authContext?: IAuthContext): Promise {\r\n return await getTokensForSDK(layoutSDK, userInfo, 'refresh', authContext)\r\n}\r\n\r\nexport async function getInitialTokensForSDK(layoutSDK: LayoutSDK, userInfo: IAuthenticatedUserInfo, authContext?: IAuthContext): Promise {\r\n return await getTokensForSDK(layoutSDK, userInfo, 'initialSetToken', authContext)\r\n}\r\n\r\nasync function getTokensForSDK(layoutSDK: LayoutSDK, userInfo: IAuthenticatedUserInfo, setTokenCase: SetTokenCase, authContext?: IAuthContext): Promise {\r\n const getTokensForSdkActivity = new SetTokenInSdkActivity(userInfo.authType, setTokenCase)\r\n\r\n let outlookToken: string\r\n const authContextOutlookToken: string | undefined = authContext ? authContext.getSubstrateNotesToken() : undefined\r\n\r\n if (authContextOutlookToken) {\r\n Log.logger.info('Found tokens for SDK in auth context. Skip getting tokens.')\r\n\r\n outlookToken = authContextOutlookToken\r\n } else {\r\n Log.logger.info('Getting tokens for SDK...')\r\n try {\r\n const stickyNotesToken = await getAppTokenInfoForStickyNotes(userInfo, setTokenCase === 'refresh' /* forceRefresh */, authContext && authContext.getAccessToken())\r\n outlookToken = stickyNotesToken.outlookToken\r\n } catch (error) {\r\n getTokensForSdkActivity.finishWithFailure('ErrorWhenGettingAppToken', error)\r\n Log.logger.error(`AuthError: Getting initial notes token failed with error: ${getErrorAsString(error)}`)\r\n throw error\r\n }\r\n }\r\n\r\n try {\r\n if (isMsa(userInfo.authType)) {\r\n // If CID is available, send as mailbox hint, otherwise fallback to upn\r\n const mailboxHint = userInfo.userCid ? `CID:${userInfo.userCid}` : userInfo.upn\r\n await layoutSDK.setMSAAccessToken(outlookToken, mailboxHint)\r\n } else {\r\n // If PUID and TID are available, send as mailbox hint, otherwise fallback to upn\r\n const mailboxHint = userInfo.userPuid && userInfo.tenantId ? `PUID:${userInfo.userPuid}@${userInfo.tenantId}` : userInfo.upn\r\n await layoutSDK.setAADAccessToken(outlookToken, mailboxHint)\r\n }\r\n\r\n Log.logger.info('Successfully set tokens in SDK')\r\n getTokensForSdkActivity.finishWithSuccess()\r\n } catch (error) {\r\n getTokensForSdkActivity.finishWithFailure('ErrorWhenSettingTokenInSdk', error)\r\n Log.logger.error(`AuthError: Error when setting token in sdk: ${getErrorAsString(error)}`)\r\n throw error\r\n }\r\n}\r\n","import { LayoutSDK } from '@notes/sticky-notes-layout'\r\nimport { AuthType } from '@notes/webintegrations-common'\r\nimport { getAuthTypeWithExtension } from '../agave/auth/getAuthTypeWithExtension'\r\nimport { getForceSignInUrl, getMsaImplicitGrantSignInUrl } from '../shared/auth/getSignInUrl'\r\n\r\nexport function showSessionExpired(layoutSDK: LayoutSDK): void {\r\n const authType: AuthType | undefined = getAuthTypeWithExtension()\r\n layoutSDK.showSessionExpired(authType === 'msa_implicit' ? getMsaImplicitGrantSignInUrl() : getForceSignInUrl(false))\r\n}\r\n","import { ILoggingOptions, initializeAllIcons, LayoutSDK } from '@notes/sticky-notes-layout'\r\nimport LayoutSDKOptions from '@notes/sticky-notes-layout/dist-es2015/sticky-notes-layout/src/LayoutSDKOptions'\r\nimport {\r\n getErrorAsString,\r\n IAuthenticatedUserInfo,\r\n isMsa,\r\n logAndBuildError,\r\n O365ExchangeTokenError,\r\n O365ExchangeTokenFailureCase,\r\n OneNoteTheme,\r\n refreshAccessToken,\r\n} from '@notes/webintegrations-common'\r\nimport * as React from 'react'\r\nimport { tryGetOAuthTokenWithoutUserAction } from '../agave/auth/getAccessTokenInfo'\r\nimport { redirectToAuth } from '../init/redirectToAuth'\r\nimport { LayoutSDKTelemetryCallbacks } from '../LayoutSDKTelemetryCallbacks'\r\nimport { isMsaAccountLogin } from '../lib/urlParserUtils'\r\nimport { GetTokenFactory } from '../shared/auth/GetTokenFactory'\r\nimport { IAuthContext } from '../shared/auth/IAuthContext'\r\nimport { RefreshTokenForSdkActivity } from '../shared/auth/RefreshTokenForSdkActivity'\r\nimport { Constants } from '../shared/Constants'\r\nimport { GlobalVariables } from '../shared/GlobalVariables'\r\nimport { getOTelLoggingUserContextFromUserInformation } from '../shared/logger/getLoggingUserContextFromUserInformation'\r\nimport { Log } from '../shared/logger/Log'\r\nimport { shouldMockExternalApis } from '../shared/shouldMockExternalApis'\r\nimport { getInitialTokensForSDK, refreshTokensForSDK } from './getTokensForSDK'\r\nimport { showSessionExpired } from './showSessionExpired'\r\n\r\n/**\r\n * A wrapper for the LayoutSDK that simplifies its interface for Sticky Notes integrations, setting common\r\n * parameters/callbacks, and exposing common methods\r\n *\r\n * TODO (machiam): Suggestion from jogonzal:\r\n *\r\n * Idea: If the LayoutSdkWrapper is a \"stricter\" wrapper, then all of the function calls that happen for the LayoutSdk should happen through it, like for example:\r\n * StickyNotesFrame should have a reference to the wrapper, not to the LayoutSdk itself\r\n * Instead of calling getLayoutSDK() to know if the user is signed in or not here,\r\n * we should create a method in the frame called \"isSignedIn()\" in the frame that checks if the instance of LayoutSdkWrapper is defined\r\n * Instead of calling getLayoutSDK() and then .createNote(), StickyNotesFrame would expose\r\n * methods that call the wrapper, that way all calls to the LayoutSdk happen through the wrapper (and the getLayoutSDK() method doesn't have to exist)\r\n */\r\nexport class LayoutSDKWrapper {\r\n userInfo: IAuthenticatedUserInfo | undefined\r\n readonly layoutSDK: LayoutSDK\r\n\r\n // We want to leverage a lock on requesting tokens in the case where we are\r\n // getting a new token and another action on the client side has occurred\r\n // which requires an access token but we are already in the middle of getting\r\n // a new one. We should drop this second request and lift the lock when we\r\n // apply the token from the first onSDKUnauthorized request\r\n tokenRefreshLock: boolean\r\n\r\n authContext?: IAuthContext\r\n\r\n private setupComplete: boolean\r\n onSessionExpired?: () => void\r\n\r\n constructor(options: CreateOptions) {\r\n this.userInfo = options.userInfo\r\n this.layoutSDK = this.createLayoutSDK(options)\r\n this.tokenRefreshLock = false\r\n this.setupComplete = false\r\n this.onSessionExpired = options.onSessionExpired\r\n }\r\n\r\n // The following order is enforced to ensure the LayoutSDK is initialized properly:\r\n // 1) Await ready\r\n // 2) Await render\r\n // 3) Await login (this is a separate method to allow callers to execute code between these calls)\r\n async setup(options?: { renderElementId?: string, langCode?: string, authContext?: IAuthContext, theme?: OneNoteTheme, platform?: string }): Promise {\r\n this.authContext = options && options.authContext\r\n await this.layoutSDK.ready\r\n if (options && options.langCode) {\r\n this.layoutSDK.changeLanguage(options.langCode)\r\n }\r\n if (options && options.renderElementId) {\r\n await this.layoutSDK.render(options.renderElementId)\r\n }\r\n if (options && options.theme === 'Dark') {\r\n this.layoutSDK.enableDarkMode(true)\r\n } else {\r\n this.layoutSDK.enableDarkMode(false)\r\n }\r\n\r\n // tslint:disable-next-line:no-floating-promises\r\n this.getUserProfilePicture()\r\n\r\n this.setupComplete = true\r\n }\r\n\r\n // Fetch Profile Picture for user\r\n async getUserProfilePicture(): Promise {\r\n if (this.userInfo && this.userInfo?.authType && !isMsa(this.userInfo.authType)) {\r\n const tokenInfo = await tryGetOAuthTokenWithoutUserAction()\r\n if (!tokenInfo || !tokenInfo.access_token) {\r\n Log.logger.warn('UserInfo was successfully retrieved, but was unable to get tokenInfo. Aborting photo fetch!')\r\n return\r\n }\r\n try {\r\n const tokenGetter = GetTokenFactory.createO365(tokenInfo.access_token, this.userInfo.tenantId!, false /* forceRefresh */)\r\n const graphToken = await tokenGetter.getGraphUserInfoToken()\r\n if (graphToken && this.userInfo && this.userInfo.tenantId) {\r\n this.layoutSDK.setGraphToken(graphToken)\r\n }\r\n } catch (e) {\r\n Log.logger.warn('Fetching of profile picture failed')\r\n }\r\n }\r\n }\r\n\r\n async login(): Promise {\r\n if (!this.setupComplete) {\r\n throw logAndBuildError('setup() MUST be called before login(). Aborting!')\r\n }\r\n\r\n // Either sync sticky notes, or show an error dialog\r\n if (this.userInfo) {\r\n try {\r\n await this.getInitialTokensForSDK(this.layoutSDK, this.userInfo, this.authContext)\r\n } catch (error) {\r\n if (O365ExchangeTokenError.isO365ExchangeTokenError(error)) {\r\n if (error.failureCase === O365ExchangeTokenFailureCase.ResourceIsDisabled) {\r\n Log.logger.error(`The user appears to not have an exchange subscription - showing the error. ${getErrorAsString(error)}`)\r\n this.layoutSDK.showExchangeLicenseUnavailable()\r\n } else {\r\n Log.logger.error(`A generic exchange token error ${error.failureCase} was thrown - showing reload banner`)\r\n this.onSessionExpired !== undefined ? this.onSessionExpired() : showSessionExpired(this.layoutSDK)\r\n }\r\n return\r\n }\r\n\r\n Log.logger.error(`Error getting tokens for SDK initially! Showing session expired banner. ${getErrorAsString(error)}`)\r\n this.onSessionExpired !== undefined ? this.onSessionExpired() : showSessionExpired(this.layoutSDK)\r\n }\r\n } else {\r\n // Only when running locally, we tolerate no user information here. Else we show the reload banner\r\n if (!shouldMockExternalApis()) {\r\n Log.logger.error(`Showing session expired banner because the user information was undefined`)\r\n this.onSessionExpired !== undefined ? this.onSessionExpired() : showSessionExpired(this.layoutSDK)\r\n }\r\n }\r\n }\r\n\r\n private createLayoutSDK(options: CreateOptions): LayoutSDK {\r\n const { userInfo, onDetailViewChanged, hostApp, disableMediaDownload, isEdgeHub, isFeedEnabled,\r\n enableOneNotePages, noteReferenceOpenHandler, isHtmlRenderingEnabled, telemetrySink } = options\r\n const telemetrySDKCallbacks = new LayoutSDKTelemetryCallbacks()\r\n const userContextForLogging = getOTelLoggingUserContextFromUserInformation(userInfo)\r\n initializeAllIcons()\r\n const loggingOptions: ILoggingOptions | undefined = userContextForLogging ? {\r\n userId: userContextForLogging.userId,\r\n userIdType: userInfo?.authType === 'o365' ? 'UserObjectId' : 'MSACID',\r\n oMSTenantId: userContextForLogging.tenantId,\r\n appId: Constants.stickyNotesOndcAppIdForLogging,\r\n hostApp: hostApp,\r\n hostSessionId: GlobalVariables.environmentSettings.sessionId,\r\n samplingDisabled: GlobalVariables.environmentSettings.ring === Constants.RING_TYPE.INTERNAL || userContextForLogging.tenantId === Constants.WELL_KNOWN_MICROSOFT_TENANT_ID,\r\n } : undefined\r\n return new LayoutSDK({\r\n appName: Constants.notesFabricApiCreatedByApp,\r\n authType: userInfo?.authType,\r\n appVersion: GlobalVariables.environmentSettings.version,\r\n onSignedOut: telemetrySDKCallbacks.onSDKSignOut,\r\n onUnauthorized: this.onSDKUnauthorizedCallback,\r\n onNoteDeleting: telemetrySDKCallbacks.onNoteDeleted,\r\n onNotesUpdated: telemetrySDKCallbacks.onNotesUpdated,\r\n uniqueUserId: userInfo ? userInfo.upn : undefined,\r\n onDetailViewChanged,\r\n onTelemetry: telemetrySDKCallbacks.onTelemetry,\r\n storage: true,\r\n sync: !!userInfo,\r\n showAppName: false,\r\n showAppHeader: true,\r\n loggingOptions,\r\n disableMediaDownload,\r\n allowEmptyNotesCollection: true,\r\n isFeedEnabled: !!isFeedEnabled, /* Default to false so feed is not enabled in ONDC/SN */\r\n isEdgeHub: isEdgeHub,\r\n isConnectedNotesEnabled: !isEdgeHub,\r\n enableOneNotePages: !!enableOneNotePages,\r\n noteListItemRenderWrapper: this.renderNoteItem,\r\n noteReferenceOpenHandler: noteReferenceOpenHandler,\r\n isHtmlRenderingEnabled: !!isHtmlRenderingEnabled,\r\n telemetrySink: telemetrySink,\r\n isNoteRefCachingEnabled: true,\r\n isRelatedNotesSectionEnabled: false,\r\n })\r\n }\r\n\r\n // This can't be extracted into its own function as it has a circular reference to LayoutSDK\r\n onSDKUnauthorizedCallback = async (): Promise => {\r\n Log.logger.info('OnSDKUnauthorized called - attempting to refresh token...')\r\n\r\n if (this.tokenRefreshLock) {\r\n Log.logger.info('onSDKUnauthorizedCallback already called and still working')\r\n return\r\n }\r\n\r\n if (!this.userInfo) {\r\n // TODO: what should we show in the UI for this error path?\r\n // \"Something went horribly wrong, please contact support.\"\r\n // THIS IS A DEAD END\r\n logAndBuildError('OnSdkUnauthorized should not be called if no user information is present')\r\n this.onSessionExpired !== undefined ? this.onSessionExpired() : showSessionExpired(this.layoutSDK)\r\n return\r\n }\r\n\r\n this.tokenRefreshLock = true\r\n try {\r\n await this.refreshToken()\r\n Log.logger.info('Successfully refreshed the token')\r\n this.tokenRefreshLock = false\r\n } catch (e) {\r\n Log.logger.error(`Error occurred while refreshing access token in active session: ${getErrorAsString(e)}, redirect user to sign in.`)\r\n if (!this.layoutSDK.layoutSDKOptions.isEdgeHub) {\r\n this.onSessionExpired !== undefined ? this.onSessionExpired() : showSessionExpired(this.layoutSDK)\r\n } else {\r\n const isMsaAccount: boolean = isMsaAccountLogin()\r\n redirectToAuth(isMsaAccount)\r\n }\r\n }\r\n }\r\n\r\n private async refreshToken(): Promise {\r\n const authType = this.userInfo && this.userInfo.authType\r\n const refreshTokenActivity = new RefreshTokenForSdkActivity(authType)\r\n\r\n if (!this.userInfo || !authType) {\r\n refreshTokenActivity.finishWithFailure('Attempted to refresh when current userInfo is not present!')\r\n throw logAndBuildError('While attempting to refresh, the current userInfo should be present!')\r\n }\r\n\r\n // In the case of msa_implicit, we do not need to refresh the original root access token\r\n // In the case of o365, we need to refresh before we exchange tokens\r\n // In the case of msa, we need to refresh using the auth context\r\n if (authType === 'o365' || (isMsa(authType) && this.authContext)) {\r\n try {\r\n if (this.authContext) {\r\n await this.authContext.refresh()\r\n } else {\r\n await refreshAccessToken()\r\n }\r\n } catch (error) {\r\n refreshTokenActivity.finishWithFailure(`Failed to refresh ${authType} token`, error)\r\n throw logAndBuildError(`Failed to refresh token! ${getErrorAsString(error)}`)\r\n }\r\n }\r\n\r\n try {\r\n await this.refreshTokensForSDK(this.layoutSDK, this.userInfo!, this.authContext)\r\n refreshTokenActivity.finishWithSuccess()\r\n } catch (error) {\r\n refreshTokenActivity.finishWithFailure('Failed to get tokens for SDK', error)\r\n throw logAndBuildError(`Failed to get tokens for sdk! ${getErrorAsString(error)}`)\r\n }\r\n }\r\n\r\n // Needed for mocking in tests\r\n async refreshTokensForSDK(layoutSDK: LayoutSDK, userInfo: IAuthenticatedUserInfo, authContext?: IAuthContext): Promise {\r\n return await refreshTokensForSDK(layoutSDK, userInfo, authContext)\r\n }\r\n\r\n // Needed for mocking in tests\r\n async getInitialTokensForSDK(layoutSDK: LayoutSDK, userInfo: IAuthenticatedUserInfo, authContext?: IAuthContext): Promise {\r\n return await getInitialTokensForSDK(layoutSDK, userInfo, authContext)\r\n }\r\n\r\n private renderNoteItem = (noteId: string, children?: React.ReactNode): JSX.Element => {\r\n const dragStart = async (event: React.DragEvent) => {\r\n // React creates synthetic events that wrap native events\r\n // These synthetic events are recycled and therefore can become invalid\r\n // when passed into async contexts.\r\n // event.persist() tells React that we plan on using this asynchronously\r\n // which will ensure it doesn't get recycled for other events\r\n // That doesn't mean we are responsible for garbage collection.\r\n event.persist()\r\n\r\n const note = await this.layoutSDK.notesSDK.getLocalNote(noteId)\r\n if (!note) {\r\n event.stopPropagation()\r\n return\r\n }\r\n // If we are dragging an empty note, let's cancel the event early on so that\r\n // we don't show the drag visual and confuse the user if we know the drop\r\n // will be a no op beforehand\r\n const htmlContent = await note.getAsHtml()\r\n if (!htmlContent) {\r\n event.stopPropagation()\r\n return\r\n }\r\n\r\n // Since everything looks good, let's set our intent from this event\r\n // effectAllowed could be used by the target of the drag over or drop events\r\n // to show some visual. In OneNote UWP for example, 'copy' will show a\r\n // Copy icon under the cursor while dragging to indicate to the user that when\r\n // they drop this note, it will be copied into the canvas.\r\n // One alternative would be 'move' which would show a 'Cut' icon that will\r\n // delete the note from the Feed when dropped elsewhere if that event is\r\n // successful (The feed would still have to implement that deletion)\r\n event.dataTransfer.effectAllowed = 'copy'\r\n event.dataTransfer.setData('text/html', htmlContent)\r\n }\r\n\r\n return (\r\n
\r\n { children }\r\n
\r\n )\r\n }\r\n}\r\n\r\ntype CreateOptions = {\r\n userInfo: IAuthenticatedUserInfo | undefined\r\n hostApp: string\r\n onSessionExpired?: () => void\r\n} & Partial\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var strShimFunction = \"function\";\r\nexport var strShimObject = \"object\";\r\nexport var strShimUndefined = \"undefined\";\r\nexport var strShimPrototype = \"prototype\";\r\nexport var strShimHasOwnProperty = \"hasOwnProperty\";\r\nexport var strDefault = \"default\";\r\nexport var ObjClass = Object;\r\nexport var ObjProto = ObjClass[strShimPrototype];\r\nexport var ObjAssign = ObjClass[\"assign\"];\r\nexport var ObjCreate = ObjClass[\"create\"];\r\nexport var ObjDefineProperty = ObjClass[\"defineProperty\"];\r\nexport var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];\r\n//# sourceMappingURL=Constants.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var strShimFunction = \"function\";\r\nexport var strShimObject = \"object\";\r\nexport var strShimUndefined = \"undefined\";\r\nexport var strShimPrototype = \"prototype\";\r\nexport var strShimHasOwnProperty = \"hasOwnProperty\";\r\nexport var strDefault = \"default\";\r\nexport var ObjClass = Object;\r\nexport var ObjProto = ObjClass[strShimPrototype];\r\nexport var ObjAssign = ObjClass[\"assign\"];\r\nexport var ObjCreate = ObjClass[\"create\"];\r\nexport var ObjDefineProperty = ObjClass[\"defineProperty\"];\r\nexport var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];\r\n//# sourceMappingURL=Constants.js.map","import { __assign, __extends, __read, __spread } from \"tslib\";\r\n/**\r\n * Lists all errors related to the Auth Experience\r\n */\r\nvar AuthErrorType = {\r\n GetAuthInfoError: 'GetAuthInfoError',\r\n};\r\n/**\r\n * Lists all errors related to TeamNotes Scenarios\r\n */\r\nvar TeamNotesErrorType = {\r\n MissingChannelIdInContextError: 'MissingChannelIdError',\r\n MissingWikiPagesOnImportRetryError: 'MissingWikiPagesOnImportRetryError',\r\n MissingChannelName: 'MissingChannelName',\r\n WhiteSpacesOnlyChannelName: 'WhiteSpacesOnlyChannelName',\r\n EmptyChannelName: 'EmptyChannelName',\r\n WikiMigrationPagesUndefined: 'WikiMigrationPagesUndefined',\r\n WikiMigrationTimeoutError: 'WikiMigrationTimeoutError',\r\n WikiMigrationImageUrlMissingApiPath: 'WikiMigrationImageUrlMissingApiPath',\r\n WikiMigrationImageTooLargeError: 'WikiMigrationImageTooLargeError',\r\n WikiMigrationImageExceedingPageSizeLimitError: 'WikiMigrationImageExceedingPageSizeLimitError',\r\n WikiMigrationImageExceedingPageDataPartLimitError: 'WikiMigrationImageExceedingPageDataPartLimitError',\r\n WikiMigrationOneNotePageNotBuiltError: 'WikiMigrationOneNotePageNotBuiltError',\r\n WikiMigrationSectionQuotaExceededError: 'WikiMigrationSectionQuotaExceededError',\r\n};\r\n/**\r\n * Lists common scenario errors found across our repo\r\n */\r\nvar CommonErrorType = {\r\n CreateAndCachePromiseError: 'CreateAndCachePromiseError',\r\n TimeoutError: 'TimeoutError',\r\n};\r\n/**\r\n * Lists errors found across our repo\r\n */\r\nexport var ErrorType = __assign(__assign(__assign({}, AuthErrorType), TeamNotesErrorType), CommonErrorType);\r\nvar ErrorWithType = /** @class */ (function (_super) {\r\n __extends(ErrorWithType, _super);\r\n /**\r\n * @constructor\r\n * @param {string} message Describes the details or root cause for this error\r\n * @param {ErrorType} errorType This will be used for bucketizing, categorizing and/or identifying the type of this error.\r\n */\r\n function ErrorWithType(message, errorType) {\r\n var _this = _super.call(this, message) || this;\r\n _this.errorType = errorType;\r\n _this.previousErrorTypes = [];\r\n // For an object extending a native type like Error, need to set the prototype explicitly\r\n Object.setPrototypeOf(_this, ErrorWithType.prototype);\r\n return _this;\r\n }\r\n ErrorWithType.prototype.getBucket = function () {\r\n var allErrorTypes = __spread(this.previousErrorTypes, [this.errorType]);\r\n // Deduplicate error types by inserting them in a set and deconstructing the result to an array.\r\n // Join the resulting array into a dash separated string.\r\n return __spread(new Set(allErrorTypes)).join('-');\r\n };\r\n return ErrorWithType;\r\n}(Error));\r\nexport { ErrorWithType };\r\n// tslint:disable-next-line: no-any\r\nexport var isErrorWithType = function (error) { return error instanceof ErrorWithType; };\r\n//# sourceMappingURL=ErrorWithType.js.map","import { __awaiter, __generator } from \"tslib\";\r\nimport { ErrorType, ErrorWithType } from './ErrorWithType';\r\nimport { Log } from './logging/Log';\r\nexport var timeoutErrorName = 'TimeoutError';\r\nexport function executeWithTimeout(ms, promise, actionDescription) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var timeoutError;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n timeoutError = new ErrorWithType(\"Timed out during \" + actionDescription, ErrorType.TimeoutError);\r\n timeoutError.name = timeoutErrorName;\r\n // tslint:disable-next-line: no-any\r\n return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {\r\n var hasTimedOut, timeoutId, result, error_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n hasTimedOut = false;\r\n timeoutId = setTimeout(function () {\r\n hasTimedOut = true;\r\n Log.logger.warn('A timeout ocurred!');\r\n reject(timeoutError);\r\n }, ms);\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, promise];\r\n case 2:\r\n result = _a.sent();\r\n clearTimeout(timeoutId);\r\n if (hasTimedOut) {\r\n Log.logger.warn('Resolve was hit after timeout');\r\n }\r\n resolve(result);\r\n return [3 /*break*/, 4];\r\n case 3:\r\n error_1 = _a.sent();\r\n clearTimeout(timeoutId);\r\n reject(error_1);\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}\r\n//# sourceMappingURL=executeWithTimeout.js.map","// extracted by mini-css-extract-plugin\nmodule.exports = {\"ChevronDownImage\":\"expandableMoreOptions__ChevronDownImage___W6-i7\"};","declare const __IsLocal__: boolean\r\n\r\nexport namespace CompileTimeConstants {\r\n // TODO alkwa add back in __isAutomation__\r\n export const isLocal = __IsLocal__\r\n}\r\n","import { CompileTimeConstants } from './CompileTimeConstants'\r\n\r\nexport function shouldMockExternalApis(): boolean {\r\n const isRunningLocally = CompileTimeConstants.isLocal\r\n\r\n // Agave case\r\n if (window.location.pathname.startsWith('/officeaddins')) {\r\n const windowIsTopLevelFrame = !window.parent || window.parent === window\r\n return isRunningLocally && windowIsTopLevelFrame\r\n }\r\n\r\n // OneNote.Com/stickynotes case\r\n const isRunningInOneNoteDotComInt = window.location.hostname.endsWith('onenote-int.com')\r\n const isRunningInOneNoteDotCom = window.location.hostname.endsWith('onenote.com')\r\n\r\n // Only if we're running locally and we're not running in onenote.com\r\n return !( isRunningInOneNoteDotCom || isRunningInOneNoteDotComInt ) && isRunningLocally\r\n}\r\n","module.exports = __webpack_public_path__ + \"img/defaultusericon.png?08cddf65cc7d3bda5ebaba09ba11e9f5\";"," export function extractTokenFromAuthHeader(header: string): string {\r\n if (header.startsWith('Bearer ')) {\r\n return header.substring(7, header.length)\r\n } else if (header.startsWith('Authorization: Passport1.4 from-PP=\\'t=')) {\r\n return header.substring(38, header.length - 1) // also remove a trailing quote\r\n } else if (header.startsWith('Authorization: Passport1.4 from-PP=\\'')) {\r\n return header.substring(36, header.length - 1) // also remove a trailing quote\r\n } else {\r\n return header\r\n }\r\n}\r\n","import { AuthType } from '@notes/webintegrations-common'\r\n\r\nexport const getAuthTypeForAccountType = (accountType: string /*OneNote.AccountType*/): AuthType | undefined => {\r\n switch (accountType) {\r\n case 'LiveId' /*OneNote.AccountType.liveId*/:\r\n return 'msa'\r\n case 'OrgId' /*OneNote.AccountType.orgId*/:\r\n case 'ADAL'/*OneNote.AccountType.adal*/:\r\n return 'o365'\r\n default:\r\n return undefined\r\n }\r\n}\r\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"SignOutIcon\":\"moreOptions__SignOutIcon___mR6Vd\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"useAnotherAccountIcon\":\"accountList__useAnotherAccountIcon___7AiXs\"};","import { GetMsaGraphUserPhoto } from './GetMsaGraphUserPhoto';\r\nimport { GetO365GraphUserPhoto } from './GetO365GraphUserPhoto';\r\nimport { GetUserPhotoWithCache } from './GetUserPhotoWithCache';\r\nexport var GetUserPhotoWithCacheFactory;\r\n(function (GetUserPhotoWithCacheFactory) {\r\n function create(cache, authType) {\r\n if (authType === 'o365') {\r\n return new GetUserPhotoWithCache(new GetO365GraphUserPhoto(), cache);\r\n }\r\n // The cache is not needed in the MSA case as the operation is not supported\r\n return new GetMsaGraphUserPhoto();\r\n }\r\n GetUserPhotoWithCacheFactory.create = create;\r\n})(GetUserPhotoWithCacheFactory || (GetUserPhotoWithCacheFactory = {}));\r\n//# sourceMappingURL=GetUserPhotoWithCacheFactory.js.map","import { Log } from '../../shared/logging/Log';\r\nvar GetMsaGraphUserPhoto = /** @class */ (function () {\r\n function GetMsaGraphUserPhoto() {\r\n }\r\n GetMsaGraphUserPhoto.prototype.getUserPhoto = function (_graphAccessToken, _dimensions) {\r\n Log.logger.info('getUserPhoto returning undefined for MSA as the operation is not supported by Graph yet');\r\n return Promise.resolve(undefined);\r\n };\r\n return GetMsaGraphUserPhoto;\r\n}());\r\nexport { GetMsaGraphUserPhoto };\r\n//# sourceMappingURL=GetMsaGraphUserPhoto.js.map","import { __awaiter, __generator } from \"tslib\";\r\nimport { getResponseDiagnostics } from '../../Http/Response/getResponseDiagnostics';\r\nimport { HttpResponseError } from '../../Http/Response/HttpResponseError';\r\nimport { getErrorAsString } from '../../shared/getErrorAsString';\r\nimport { logAndBuildError } from '../../shared/logAndBuildError';\r\nimport { Log } from '../../shared/logging/Log';\r\nvar GetO365GraphUserPhoto = /** @class */ (function () {\r\n function GetO365GraphUserPhoto() {\r\n }\r\n GetO365GraphUserPhoto.prototype.getUserPhoto = function (graphAccessToken, dimensions) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var url, response, responseDiagnostics, error, blob_1, error_1;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n url = dimensions ?\r\n \"https://graph.microsoft.com/v1.0/me/photos/\" + dimensions + \"/$value\" :\r\n 'https://graph.microsoft.com/v1.0/me/photo/$value' // Largest available size\r\n ;\r\n return [4 /*yield*/, fetch(url, {\r\n method: 'GET',\r\n headers: {\r\n 'Authorization': \"Bearer \" + graphAccessToken,\r\n 'Content-Type': 'image/jpg',\r\n },\r\n credentials: 'omit',\r\n })];\r\n case 1:\r\n response = _a.sent();\r\n if (response.status === 404) {\r\n Log.logger.info('User does not have a photo. Returning undefined.');\r\n return [2 /*return*/, undefined];\r\n }\r\n if (response.status !== 200) {\r\n responseDiagnostics = getResponseDiagnostics(response);\r\n error = new HttpResponseError(responseDiagnostics, response.status);\r\n Log.logger.warn(\"Graph /me/photo(s) call failed: \" + responseDiagnostics);\r\n throw error;\r\n }\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 4, , 5]);\r\n return [4 /*yield*/, response.blob()\r\n // tslint:disable-next-line: no-any\r\n ];\r\n case 3:\r\n blob_1 = _a.sent();\r\n // tslint:disable-next-line: no-any\r\n return [2 /*return*/, new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {\r\n var fileReader;\r\n return __generator(this, function (_a) {\r\n fileReader = new FileReader();\r\n fileReader.addEventListener('load', function () {\r\n if (typeof fileReader.result === 'string' && fileReader.result) {\r\n Log.logger.info('Successfully decoded photo blob as base64');\r\n resolve(fileReader.result);\r\n }\r\n else {\r\n reject('FileReader unexpectedly did not load a base64 string when reading blob.');\r\n }\r\n });\r\n fileReader.readAsDataURL(blob_1);\r\n return [2 /*return*/];\r\n });\r\n }); })];\r\n case 4:\r\n error_1 = _a.sent();\r\n throw logAndBuildError(getErrorAsString(error_1));\r\n case 5: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n return GetO365GraphUserPhoto;\r\n}());\r\nexport { GetO365GraphUserPhoto };\r\n//# sourceMappingURL=GetO365GraphUserPhoto.js.map","import { __awaiter, __generator } from \"tslib\";\r\nimport { getWithSoftCaching } from '../Cache/getWithSoftCaching';\r\nvar key = 'UserPhoto';\r\nvar GetUserPhotoWithCache = /** @class */ (function () {\r\n function GetUserPhotoWithCache(userPhotoGetter, cache) {\r\n this.userPhotoGetter = userPhotoGetter;\r\n this.cache = cache;\r\n }\r\n GetUserPhotoWithCache.prototype.getUserPhoto = function (graphAccessToken, dimensions) {\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*/, getWithSoftCaching(function () { return _this.userPhotoGetter.getUserPhoto(graphAccessToken, dimensions); }, this.cache, this.createKey(dimensions))];\r\n case 1: return [2 /*return*/, _a.sent()];\r\n }\r\n });\r\n });\r\n };\r\n GetUserPhotoWithCache.prototype.createKey = function (dimensions) {\r\n return key + '-' + (dimensions || 'default');\r\n };\r\n return GetUserPhotoWithCache;\r\n}());\r\nexport { GetUserPhotoWithCache };\r\n//# sourceMappingURL=GetUserPhotoWithCache.js.map","import { NoteReference, NoteReferenceOpenHandlerResult } from '@notes/sticky-notes-layout'\r\nimport { IAuthenticatedUserInfo } from '@notes/webintegrations-common'\r\nimport { LayoutSDKWrapper } from '../../layoutSDK/LayoutSDKWrapper'\r\nimport { GlobalVariables } from '../../shared/GlobalVariables'\r\nimport { Log } from '../../shared/logger/Log'\r\nimport { IHostIntegration } from '../hostIntegration/IHostIntegration'\r\n\r\nexport type LayoutSDKWrapperOptions = {\r\n host: IHostIntegration,\r\n userInfo: IAuthenticatedUserInfo,\r\n onDetailViewChangedHandler?: ((isFocused: boolean) => void)\r\n onSessionExpiredHandler?: (() => void)\r\n}\r\n\r\nexport function createLayoutSDKWrapper({ host, userInfo, onDetailViewChangedHandler, onSessionExpiredHandler }: LayoutSDKWrapperOptions): LayoutSDKWrapper {\r\n const hostApp = `${host.getHostName()}-${host.getPlatform()}`\r\n\r\n const noteReferenceOpenHandler = (noteReference: NoteReference): NoteReferenceOpenHandlerResult => {\r\n const webUrl = noteReference.metadata.webUrl\r\n const clientUrl = noteReference.metadata.clientUrl\r\n if (clientUrl !== undefined && webUrl !== undefined) {\r\n host.navigateToClientURL(clientUrl).catch(() => {\r\n if (host.isOfficeOnline()) {\r\n window.open(webUrl)\r\n } else {\r\n Log.logger.logReportData('NavigateToClientUrlFailed', true /* isCriticalEvent */)\r\n }\r\n })\r\n return 'HANDLED'\r\n }\r\n return 'UNHANDLED'\r\n }\r\n\r\n const wrapper = new LayoutSDKWrapper({\r\n userInfo,\r\n onDetailViewChanged: (isFocused: boolean) => {\r\n if (onDetailViewChangedHandler) {\r\n onDetailViewChangedHandler(isFocused)\r\n }\r\n return\r\n },\r\n onSessionExpired: onSessionExpiredHandler,\r\n hostApp,\r\n disableMediaDownload: host.isMediaDownloadDisabled(),\r\n isFeedEnabled: true,\r\n enableOneNotePages: !GlobalVariables.environmentSettings.DisableOneNotePagesInFeed,\r\n noteReferenceOpenHandler: noteReferenceOpenHandler,\r\n isHtmlRenderingEnabled: (!GlobalVariables.environmentSettings.DisableHtmlRendering),\r\n telemetrySink: host.getTelemetrySink(),\r\n })\r\n\r\n // Setup an event handler for theme changes\r\n host.onThemeChanged(() => {\r\n wrapper.layoutSDK.enableDarkMode(host.getTheme() === 'Dark')\r\n })\r\n\r\n return wrapper\r\n}\r\n","import { LayoutSDK } from '@notes/sticky-notes-layout'\r\nimport * as ReactDOM from 'react-dom'\r\n\r\n/**\r\n * Manages the div that the LayoutSDK will render itself onto. This is done instead of using a React\r\n * component because of LayoutSDK quirks, notably it's limited abilities to destruct/hide itself.\r\n *\r\n * Usage: StickyNotesFrame should be created if the user is authenticated, and instances destructed and\r\n * no StickyNotesFrame created when the user is signed-out.\r\n */\r\nexport class StickyNotesFrame {\r\n private layoutSDK: LayoutSDK | undefined\r\n private renderElementId: string\r\n\r\n constructor(layoutSDK: LayoutSDK | undefined, renderElementId: string) {\r\n this.layoutSDK = layoutSDK\r\n this.renderElementId = renderElementId\r\n }\r\n\r\n show(): void {\r\n this.getRenderElement().style.display = ''\r\n }\r\n\r\n hide(): void {\r\n this.getRenderElement().style.display = 'none'\r\n }\r\n\r\n getLayoutSDK(): LayoutSDK | undefined {\r\n return this.layoutSDK\r\n }\r\n\r\n signOutAndDestructUI(): void {\r\n ReactDOM.unmountComponentAtNode(this.getRenderElement())\r\n if (this.layoutSDK) {\r\n this.layoutSDK.signOut()\r\n }\r\n }\r\n\r\n focus(): void {\r\n if (this.layoutSDK) {\r\n this.layoutSDK.focusSDK()\r\n }\r\n }\r\n\r\n private getRenderElement(): HTMLDivElement {\r\n return document.getElementById(this.renderElementId)! as HTMLDivElement\r\n }\r\n}\r\n","/* TODO (stefhan): Agaves should be platform agnostic. This is currently not a very extensible solution and was a short-term\r\nfix for authentication in Teams desktop. We should be posting a message to WAC (Agaves' direct parent), who should post the message to\r\nits parent in turn (in this case, Wopi). We should not rely on Agaves to implement user-agent conditional logic and should instead rely on WAC to\r\nhandle authentication based upon if and where WAC is embedded.\r\n*/\r\n\r\nexport namespace TeamsUtils {\r\n // If you are testing this locally for Teams Desktop App, make sure to override this with WOPI hostname or \"*\".\r\n // You may experience unintended behavior otherwise. (stefhan | anbinm)\r\n const targetOrigin = `${window.location.protocol}//${window.location.hostname}`\r\n let officetargetOrigin = `${window.location.protocol}//www.microsoft365.com`\r\n if (window.location.hostname === 'www.onenote.osi.office365.us') {\r\n officetargetOrigin = `${window.location.protocol}//www.office365.us`\r\n }\r\n if (window.location.hostname === 'www.onenote.osi.office365.us') {\r\n officetargetOrigin = `${window.location.protocol}//www.ohome.apps.mil`\r\n }\r\n if (window.location.hostname === 'www.onenote.osi.eaglex.ic.gov') {\r\n officetargetOrigin = `${window.location.protocol}//www.ohome.eaglex.ic.gov`\r\n }\r\n if (window.location.hostname === 'www.onenote.osi.microsoft.scloud') {\r\n officetargetOrigin = `${window.location.protocol}//www.ohome.microsoft.scloud`\r\n }\r\n\r\n export function requestAuthenticationViaTeams(authUrl: string): void {\r\n const request = {\r\n MessageId: 'AcquireOAuthTokenTeams',\r\n AuthUrl: authUrl,\r\n }\r\n\r\n const owlRequest = JSON.stringify({ 'MessageId':'AcquireOAuthTokenTeams','Values':{ 'AuthUrl':authUrl } })\r\n window.parent.parent.window.postMessage(owlRequest, officetargetOrigin)\r\n window.parent.parent.window.postMessage(request, targetOrigin)\r\n }\r\n\r\n export function isHostedOnTeams(): boolean {\r\n return navigator.userAgent.indexOf('Teams') >= 0\r\n }\r\n}\r\n","import styledComponents from 'styled-components'\r\nimport { IThemeProps } from '../App/AppStyles'\r\n\r\n// tslint:disable:variable-name\r\nexport const MoreOptionsWrapperDiv = styledComponents.div`\r\n overflow: hidden;\r\n background: ${(p: IThemeProps) => p.theme.colors.moreOptionsDivBackGroundColor};\r\n`\r\nexport const MoreOptionsUserPhotoImg = styledComponents.img`\r\n display: inline-block;\r\n width: 25px;\r\n height: 25px;\r\n border-radius: 50%;\r\n margin-left: 20px;\r\n margin-right: 20px;\r\n padding-top: 8px;\r\n padding-bottom: 8px;\r\n`\r\nexport const MoreOptionsProfileSectionsDiv = styledComponents.div`\r\n position: absolute;\r\n display: inline-block;\r\n padding-top: 10px;\r\n padding-bottom: 10px;\r\n`\r\nexport const MoreOptionsUpnLabel = styledComponents.label`\r\n display: block;\r\n max-width: 164px;\r\n height: 20px;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 14px;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-align: center;\r\n align-items: center;\r\n color: ${(p: IThemeProps) => p.theme.colors.moreOptionsUpnLabelColor}\r\n`\r\nexport const MoreOptionsButtonImg = styledComponents.img`\r\n width: 16px;\r\n height: 16px;\r\n padding-left: 20px;\r\n padding-right: 20px;\r\n display: inline-block;\r\n margin-top: auto;\r\n margin-bottom: auto;\r\n cursor: inherit;\r\n`\r\nexport const MoreOptionsButton = styledComponents.button`\r\n display: inline-flex;\r\n vertical-align: middle;\r\n width: 100%;\r\n height: 40px;\r\n font-size: 14px;\r\n align-items: center;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n color: ${(p: IThemeProps) => p.theme.colors.signOutBtnTextColor};\r\n background: ${(p: IThemeProps) => p.theme.colors.signOutBtnBackGroundColor};\r\n border: none;\r\n text-align: left;\r\n cursor: pointer;\r\n\r\n&:hover {\r\n background: ${(p: IThemeProps) => p.theme.colors.signOutBtnHoverColor};\r\n @media (forced-colors: active) {\r\n background-color: highlight;\r\n color: highlighttext;\r\n forced-color-adjust: none;\r\n outline-color: buttontext;\r\n }\r\n}\r\n`\r\nexport const MoreOptionsButtonLabel = styledComponents.label`\r\n display: inline-block;\r\n margin-top: auto;\r\n margin-bottom: auto;\r\n cursor: inherit;\r\n max-width: 180px;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-align: left;\r\n`\r\nexport const MoreOptionsAccountNameDiv = styledComponents.div`\r\n width: 300px;\r\n height: 40px;\r\n background: ${(p: IThemeProps) => p.theme.colors.moreOptionsDivBackGroundColor}\r\n`\r\n","import { Icon } from 'office-ui-fabric-react/lib/Icon'\r\nimport * as React from 'react'\r\nimport { LocalizationService } from '../../../localization/LocalizationService'\r\nimport * as css from './moreOptions.css'\r\n// tslint:disable-next-line:max-line-length\r\nimport { MoreOptionsAccountNameDiv, MoreOptionsButton, MoreOptionsButtonLabel, MoreOptionsProfileSectionsDiv, MoreOptionsUpnLabel, MoreOptionsUserPhotoImg, MoreOptionsWrapperDiv } from './MoreOptionsStyles'\r\nimport { Props } from './props'\r\n\r\nconst defaultUserIconSrc = require('./defaultusericon.png')\r\n\r\nexport class MoreOptions extends React.Component {\r\n\r\n getPhotoSrc(): string {\r\n return this.props.userPhotoSrc || defaultUserIconSrc\r\n }\r\n\r\n render(): JSX.Element {\r\n const { userInfo } = this.props\r\n const signOutLocalizedString = LocalizationService.getLocalizedString('stickyNotes.agave.moreOptions.signOut')\r\n\r\n return (\r\n \r\n \r\n \r\n \r\n { userInfo.upn }\r\n \r\n \r\n
\r\n \r\n \r\n { signOutLocalizedString }\r\n \r\n
\r\n
\r\n )\r\n }\r\n}\r\n","import styledComponents from 'styled-components'\r\nimport { IThemeProps } from '../App/AppStyles'\r\n\r\n// tslint:disable:variable-name\r\n\r\nexport const ExpandableMoreOptionsDiv = styledComponents.div`\r\n padding-bottom: 1px;\r\n`\r\nexport const ExpandableMoreOptionsBtn = styledComponents.button`\r\n display: inline-flex;\r\n vertical-align: middle;\r\n position: relative;\r\n z-index: 10;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 14px;\r\n background: ${(p: IThemeProps) => p.theme.colors.expandableMoreOptionsColor};\r\n border: none;\r\n cursor: pointer;\r\n`\r\nexport const ExpandableMoreOptionsBtnLTR = styledComponents(ExpandableMoreOptionsBtn)`\r\n left: 12px;\r\n`\r\nexport const ExpandableMoreOptionsBtnRTL = styledComponents(ExpandableMoreOptionsBtn)`\r\n right: 12px;\r\n`\r\nexport const ExpandableMoreOptionsBtnLabel = styledComponents.label`\r\n margin-top: auto;\r\n margin-bottom: auto;\r\n max-width: 180px;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-align: left;\r\n cursor: inherit;\r\n color: ${(p: IThemeProps) => p.theme.colors.expandableMoreOptionsLabelColor};\r\n`\r\n","// tslint:disable:jsx-no-multiline-js\r\n\r\nimport { Callout } from 'office-ui-fabric-react/lib/Callout'\r\nimport { FocusTrapZone } from 'office-ui-fabric-react/lib/FocusTrapZone'\r\nimport { Icon } from 'office-ui-fabric-react/lib/Icon'\r\nimport * as React from 'react'\r\nimport { LocalizationService } from '../../../localization/LocalizationService'\r\nimport { MoreOptions } from '../MoreOptions/MoreOptions'\r\nimport * as css from './expandableMoreOptions.css'\r\nimport { ExpandableMoreOptionsBtnLabel,ExpandableMoreOptionsBtnLTR, ExpandableMoreOptionsBtnRTL, ExpandableMoreOptionsDiv } from './ExpandableMoreOptionsStyles'\r\nimport { Props } from './props'\r\nimport './stickyNotesSDKStyleOverrides.css'\r\n\r\nconst defaultUserIconSrc = require('../MoreOptions/defaultusericon.png')\r\n\r\ntype State = {\r\n expanded: boolean\r\n expandableButton: HTMLButtonElement | null\r\n}\r\n\r\nexport class ExpandableMoreOptions extends React.Component {\r\n constructor(props: Props) {\r\n super(props)\r\n this.state = { expanded: false, expandableButton: null }\r\n }\r\n\r\n hideOptions = () => this.setState({ expanded: false })\r\n toggleOptionsVisibility = () => this.setState({ expanded: !this.state.expanded })\r\n\r\n getExpandableButton = () => (this.state.expandableButton || document.body)\r\n setExpandableButtonRef = (node: HTMLButtonElement) => this.setState({ expandableButton: node })\r\n\r\n getPhotoSrc(): string {\r\n return this.props.userPhotoSrc || defaultUserIconSrc\r\n }\r\n\r\n render(): JSX.Element {\r\n const { expanded } = this.state\r\n const isRTL = LocalizationService.isRtl\r\n const moreOptionsTitleLocalizedString = LocalizationService.getLocalizedString('stickyNotes.agave.expandableMoreOptions.btnTitle')\r\n\r\n return (\r\n \r\n { isRTL ? \r\n \r\n { this.props.userInfo.upn }\r\n \r\n \r\n :\r\n \r\n \r\n { this.props.userInfo.upn }\r\n \r\n \r\n }\r\n { expanded ?\r\n \r\n \r\n \r\n \r\n :\r\n undefined\r\n }\r\n \r\n )\r\n }\r\n}\r\n","interface IFontFamily {\r\n font: string\r\n}\r\n\r\nconst fontFamilyObject: IFontFamily = {\r\n font: 'Segoe UI',\r\n}\r\nexport const fontFamilyAppleObject: IFontFamily = {\r\n font: 'SF Pro Text',\r\n}\r\nexport interface ITheme {\r\n colors: {\r\n signInTitleColor: string\r\n signInDescriptionColor: string\r\n signInBtnBackGroundColor: string\r\n signInBtnTextColor: string\r\n signInBtnHoverColor: string\r\n selectAccountLabelColor: string\r\n useAnotherAccountBtnTextColor: string\r\n useAnotherAccountBtnBackGroundColor: string\r\n useAnotherAccountBtnHoverColor: string\r\n expandableMoreOptionsColor: string\r\n expandableMoreOptionsLabelColor: string\r\n moreOptionsDivBackGroundColor: string\r\n moreOptionsUpnLabelColor: string\r\n signOutBtnTextColor: string\r\n signOutBtnBackGroundColor: string\r\n signOutBtnHoverColor: string\r\n sessionExpiredTitleColor: string\r\n sessionExpiredDescriptionColor: string\r\n }\r\n useAnotherAccountBtnBorder: string\r\n fontFamily: IFontFamily\r\n}\r\n\r\nexport interface IThemeProps {\r\n theme: ITheme\r\n}\r\n\r\nexport const lightTheme: ITheme = {\r\n colors: {\r\n signInTitleColor: '#333333',\r\n signInDescriptionColor: '#666666',\r\n signInBtnBackGroundColor: '#7719AA',\r\n signInBtnTextColor: '#FFFFFF',\r\n signInBtnHoverColor: '#5C1384',\r\n selectAccountLabelColor: '#666666',\r\n useAnotherAccountBtnTextColor: '#252423',\r\n useAnotherAccountBtnBackGroundColor: '#FFFFFF',\r\n useAnotherAccountBtnHoverColor: '#F3F2F1',\r\n expandableMoreOptionsColor: '#F9F8F7',\r\n expandableMoreOptionsLabelColor: '#605E5C',\r\n moreOptionsDivBackGroundColor: '#FFFFFF',\r\n moreOptionsUpnLabelColor: '#605E5C',\r\n signOutBtnBackGroundColor: '#FFFFFF',\r\n signOutBtnTextColor: '#605E5C',\r\n signOutBtnHoverColor: '#E1E1E1',\r\n sessionExpiredTitleColor: '#333333',\r\n sessionExpiredDescriptionColor: '#666666',\r\n },\r\n useAnotherAccountBtnBorder : '1px solid #E1DFDD',\r\n fontFamily: fontFamilyObject,\r\n}\r\n\r\nexport const darkTheme: ITheme = {\r\n colors: {\r\n signInTitleColor: '#E1E1E1',\r\n signInDescriptionColor: '#E1E1E1',\r\n signInBtnBackGroundColor: '#C0AAE4',\r\n signInBtnTextColor: '#000000',\r\n signInBtnHoverColor: '#AC7CEB',\r\n selectAccountLabelColor: '#E1E1E1',\r\n useAnotherAccountBtnTextColor: '#E1E1E1',\r\n useAnotherAccountBtnBackGroundColor: '#1E1E1E',\r\n useAnotherAccountBtnHoverColor: '#000000',\r\n expandableMoreOptionsColor: '#1E1E1E',\r\n expandableMoreOptionsLabelColor: '#E1E1E1',\r\n moreOptionsDivBackGroundColor: '#2D2D2D',\r\n moreOptionsUpnLabelColor: '#FFFFFF',\r\n signOutBtnBackGroundColor: '#2D2D2D',\r\n signOutBtnTextColor: '#FFFFFF',\r\n signOutBtnHoverColor: '#404040',\r\n sessionExpiredTitleColor: '#E1E1E1',\r\n sessionExpiredDescriptionColor: '#E1E1E1',\r\n },\r\n useAnotherAccountBtnBorder : '1px solid #E1E1E1',\r\n fontFamily: fontFamilyObject ,\r\n}\r\n","import styledComponents from 'styled-components'\r\nimport { IThemeProps } from '../App/AppStyles'\r\n\r\n// tslint:disable:variable-name\r\nexport const SessionExpiredImg = styledComponents.img`\r\n margin-top: 40px;\r\n margin-bottom: 48px;\r\n display: block;\r\n margin-left: auto;\r\n margin-right: auto;\r\n width: 150px;\r\n height: 150px;\r\n`\r\nexport const SessionExpiredTextDiv = styledComponents.div`\r\n display: block;\r\n text-align: center;\r\n padding-left: 20px;\r\n padding-right: 20px;\r\n`\r\nexport const SessionExpiredTitleLabel = styledComponents.label`\r\n position: relative;\r\n display: block;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 16px;\r\n line-height: 16px;\r\n text-align: center;\r\n color: ${(p: IThemeProps) => p.theme.colors.sessionExpiredTitleColor};\r\n margin-top: 49px;\r\n`\r\nexport const SessionExpiredDescriptionLabel = styledComponents.label`\r\n position: relative;\r\n width: 272px;\r\n top: 12px;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 14px;\r\n line-height: 20px;\r\n text-align: center;\r\n color: ${(p: IThemeProps) => p.theme.colors.sessionExpiredDescriptionColor};\r\n margin-top: 89px;\r\n`\r\nexport const SessionExpiredBtnDiv = styledComponents.div`\r\n padding-left: 58px;\r\n padding-right: 58px;\r\n padding-top: 70px;\r\n display: inline-flex;\r\n`\r\nexport const SessionExpiredReloadBtn = styledComponents.button`\r\n display: flex;\r\n flex-direction: row;\r\n padding: 3px 24px;\r\n position: static;\r\n width: 96px;\r\n background: ${(p: IThemeProps) => p.theme.colors.signInBtnBackGroundColor};\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 14px;\r\n line-height: 20px;\r\n text-align: center;\r\n color: ${(p: IThemeProps) => p.theme.colors.signInBtnTextColor};\r\n cursor: pointer;\r\n &:hover {\r\n background-color: ${(p: IThemeProps) => p.theme.colors.signInBtnHoverColor};\r\n }\r\n`\r\nexport const SessionExpiredLaterBtn = styledComponents.button`\r\n display: flex;\r\n flex-direction: row;\r\n padding: 3px 30px;\r\n position: static;\r\n width: 96px;\r\n margin-left: 12px;\r\n background: ${(p: IThemeProps) => p.theme.colors.useAnotherAccountBtnBackGroundColor};\r\n border: ${(p: IThemeProps) => p.theme.useAnotherAccountBtnBorder};\r\n box-sizing: border-box;\r\n border-radius: 2px;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 14px;\r\n line-height: 20px;\r\n text-align: center;\r\n color: ${(p: IThemeProps) => p.theme.colors.useAnotherAccountBtnTextColor};\r\n cursor: pointer;\r\n &:hover {\r\n background-color: ${(p: IThemeProps) => p.theme.colors.useAnotherAccountBtnHoverColor};\r\n }\r\n`\r\n","import * as React from 'react'\r\nimport { LocalizationService } from '../../../localization/LocalizationService'\r\nimport { darkTheme } from '../App/AppStyles'\r\nimport { Props } from './props'\r\nimport {\r\n SessionExpiredBtnDiv,\r\n SessionExpiredDescriptionLabel,\r\n SessionExpiredImg,\r\n SessionExpiredLaterBtn,\r\n SessionExpiredReloadBtn,\r\n SessionExpiredTextDiv,\r\n SessionExpiredTitleLabel\r\n} from './SessionExpiredStyles'\r\nconst sessionExpiredPngLightsrc = require('./sessionexpiredlight.png')\r\nconst sessionExpiredPngDarksrc = require('./sessionexpireddark.png')\r\nexport class SessionExpired extends React.Component {\r\n onLaterClick = () => {\r\n this.props.onSessionExpiredLaterClick()\r\n }\r\n render(): JSX.Element {\r\n const titleString = LocalizationService.getLocalizedString('stickyNotes.agave.sessionExpired.title')\r\n const descriptionString = LocalizationService.getLocalizedString('stickyNotes.agave.sessionExpired.description')\r\n const reloadBtnString = LocalizationService.getLocalizedString('stickyNotes.agave.sessionExpired.reload')\r\n const laterBtnString = LocalizationService.getLocalizedString('stickyNotes.agave.sessionExpired.later')\r\n const { theme } = this.props\r\n return(\r\n
\r\n { theme === darkTheme ? : }\r\n \r\n { titleString }\r\n { descriptionString }\r\n \r\n \r\n { reloadBtnString }\r\n \r\n { laterBtnString }\r\n \r\n \r\n
\r\n )\r\n }\r\n\r\n}\r\n","import { getErrorAsString, GetUserPhotoWithCacheFactory, IAuthenticatedUserInfo, isMsa, performSilentSignOut } from '@notes/webintegrations-common'\r\nimport * as React from 'react'\r\nimport { ThemeProvider } from 'styled-components'\r\nimport { GetTokenFactory } from '../../../shared/auth/GetTokenFactory'\r\nimport { userPhotoCache } from '../../../shared/caches'\r\nimport { STICKY_NOTES_FRAME_ID } from '../../../shared/elementIds'\r\nimport { hideLoadingSpinner, showLoadingSpinner } from '../../../shared/LoadingSpinner'\r\nimport { Log } from '../../../shared/logger/Log'\r\nimport { shouldMockExternalApis } from '../../../shared/shouldMockExternalApis'\r\nimport { tryGetOAuthTokenInfoWithoutUserAction, tryGetOAuthTokenWithoutUserAction } from '../../auth/getAccessTokenInfo'\r\nimport { IAccessTokenInfo } from '../../auth/IAccessTokenInfo'\r\nimport { IAccountInfo } from '../../auth/IAccountInfo'\r\nimport { createLayoutSDKWrapper } from '../../layoutSDK/createLayoutSDKWrapper'\r\nimport { StickyNotesFrame } from '../../ui/stickyNotesFrame'\r\nimport { ExpandableMoreOptions } from '../ExpandableMoreOptions/ExpandableMoreOptions'\r\nimport { SessionExpired } from '../SessionExpired/SessionExpired'\r\nimport { SignIn } from '../SignIn/SignIn'\r\nimport { darkTheme, fontFamilyAppleObject, ITheme, lightTheme } from './AppStyles'\r\nimport { Props } from './props'\r\n\r\ntype State = {\r\n signInStatus: 'NOT_IN_PROGRESS' | 'GET_USERINFO' | 'EXCHANGE_TOKEN'\r\n userInfo: IAuthenticatedUserInfo | undefined\r\n userPhotoSrc: string | undefined\r\n stickyNotesFrame: StickyNotesFrame\r\n accounts: IAccountInfo[]\r\n detailViewVisible: boolean\r\n theme: ITheme\r\n isSessionExpired: boolean\r\n suppressWarning: boolean\r\n}\r\n\r\nlet elementIdToFocus: string\r\n\r\nexport class App extends React.Component {\r\n constructor(props: Props) {\r\n super(props)\r\n this.state = {\r\n signInStatus: 'NOT_IN_PROGRESS',\r\n userInfo: props.userInfo,\r\n userPhotoSrc: undefined,\r\n stickyNotesFrame: props.initialStickyNotesFrameOnBoot,\r\n accounts: [],\r\n detailViewVisible: false,\r\n theme: lightTheme,\r\n isSessionExpired: props.sessionExpired,\r\n suppressWarning: false,\r\n }\r\n }\r\n\r\n async componentDidUpdate(_prevProps: Props, prevState: State): Promise {\r\n if (this.props.host.getTheme() !== _prevProps.host.getTheme()) {\r\n if (this.props.host.getTheme() === 'Dark') {\r\n this.setState({ theme : darkTheme })\r\n } else {\r\n this.setState({ theme : lightTheme })\r\n }\r\n this.themeChange(this.props.host.getTheme() === 'Dark')\r\n }\r\n this.updateNonReactElementVisibility()\r\n if (this.props.sessionExpired && (this.props.sessionExpired !== _prevProps.sessionExpired)) {\r\n this.setState({ isSessionExpired : this.props.sessionExpired })\r\n }\r\n if (!prevState.userInfo && this.state.userInfo) {\r\n await this.fetchAndSetUserPhoto(this.state.userInfo)\r\n }\r\n }\r\n\r\n async componentWillMount(): Promise {\r\n if (shouldMockExternalApis()) {\r\n return\r\n }\r\n if (this.props.host.isAppleDevice()) {\r\n this.state.theme.fontFamily = fontFamilyAppleObject\r\n }\r\n if (this.props.host.getTheme() === 'Dark') {\r\n this.setState({ theme: darkTheme })\r\n }\r\n this.setState({\r\n accounts: await this.props.host.getAccounts(),\r\n })\r\n }\r\n\r\n async componentDidMount(): Promise {\r\n // if sdk is not called, set focus to element id being rendered\r\n if (elementIdToFocus !== undefined) {\r\n this.setFocus()\r\n }\r\n this.updateNonReactElementVisibility()\r\n this.themeChange(this.props.host.getTheme() === 'Dark')\r\n if (this.state.userInfo) {\r\n await this.fetchAndSetUserPhoto(this.state.userInfo)\r\n }\r\n }\r\n\r\n setFocus(): void {\r\n const ele = document.getElementById(elementIdToFocus)\r\n if (ele) {\r\n ele.focus()\r\n }\r\n }\r\n\r\n onSessionExpired = (): void => {\r\n this.setState({ isSessionExpired : true })\r\n }\r\n unboundedOnDetailViewChangeHandler(isDetailViewVisible: boolean): void {\r\n this.setState({ detailViewVisible: isDetailViewVisible })\r\n }\r\n // binding as this will be called from createLayoutSDKWrapper\r\n onDetailViewChangeHandler = this.unboundedOnDetailViewChangeHandler.bind(this)\r\n\r\n themeChange(isDark: boolean): void {\r\n const ele = document.getElementById('app')\r\n if (ele) {\r\n isDark ? ele.style.backgroundColor = '#1E1E1E' : ele.style.backgroundColor = '#F9F8F7'\r\n }\r\n }\r\n onSessionExpiredLaterClick = () => {\r\n this.setState({ isSessionExpired: false, signInStatus: 'NOT_IN_PROGRESS', suppressWarning: true })\r\n this.state.stickyNotesFrame.focus()\r\n }\r\n // Glue code to ensure that the elements not in this component tree is only visible when we are in a matching state\r\n updateNonReactElementVisibility(): void {\r\n const { signInStatus, stickyNotesFrame } = this.state\r\n this.updateHeight(this.shouldShowSDK())\r\n this.shouldShowSDK() ? stickyNotesFrame.show() : stickyNotesFrame.hide()\r\n signInStatus === 'GET_USERINFO' ? showLoadingSpinner() : hideLoadingSpinner()\r\n }\r\n\r\n updateHeight( isVisible: boolean): void {\r\n const ele = document.getElementById('app')\r\n if (ele) {\r\n isVisible ? ele.style.height = 'auto' : ele.style.height = '100%'\r\n }\r\n }\r\n shouldShowSDK(): boolean {\r\n return ((this.state.signInStatus === 'EXCHANGE_TOKEN' || !!this.state.userInfo) && !this.state.isSessionExpired )\r\n }\r\n\r\n async fetchAndSetUserPhoto(userInfo: IAuthenticatedUserInfo): Promise {\r\n if (isMsa(userInfo.authType)) {\r\n Log.logger.info('Using a placeholder user photo as the Graph photo endpoint is not supported with MSA')\r\n return\r\n }\r\n\r\n const tokenInfo = await tryGetOAuthTokenWithoutUserAction()\r\n if (!tokenInfo || !tokenInfo.access_token) {\r\n Log.logger.warn('UserInfo was successfully retrieved, but was unable to get tokenInfo. Aborting photo fetch!')\r\n return\r\n }\r\n\r\n try {\r\n const tokenGetter = GetTokenFactory.createO365(tokenInfo.access_token, userInfo.tenantId!, false /* forceRefresh */)\r\n const graphToken = await tokenGetter.getGraphUserInfoToken()\r\n const userPhotoGetter = GetUserPhotoWithCacheFactory.create(userPhotoCache, userInfo.authType)\r\n const userPhotoSrc = await userPhotoGetter.getUserPhoto(graphToken, '48x48')\r\n\r\n Log.logger.info('Successfully got user photo!')\r\n this.setState({ userPhotoSrc })\r\n } catch (error) {\r\n Log.logger.warn(`Error thrown when trying to get user photo. Using default photo. Error: ${getErrorAsString(error)}`)\r\n }\r\n }\r\n\r\n onSignOut = async() => {\r\n Log.logger.logReportData('SignOut', false /* isCriticalEvent */)\r\n const oldStickyNotesFrame = this.state.stickyNotesFrame\r\n oldStickyNotesFrame.signOutAndDestructUI()\r\n\r\n performSilentSignOut()\r\n\r\n const accounts = await this.props.host.getAccounts()\r\n this.setState({ userInfo: undefined, userPhotoSrc: undefined, accounts: accounts, isSessionExpired: false, suppressWarning: false })\r\n }\r\n\r\n onSignInComplete = async (accessTokenInfo: IAccessTokenInfo | undefined) => {\r\n const language = this.props.host.getLanguage()\r\n\r\n this.setState({ signInStatus: 'GET_USERINFO' })\r\n\r\n if (!accessTokenInfo) {\r\n accessTokenInfo = await tryGetOAuthTokenInfoWithoutUserAction()\r\n }\r\n\r\n if (accessTokenInfo) {\r\n const userInfo = accessTokenInfo.userInfo\r\n const layoutSDKWrapper = createLayoutSDKWrapper({\r\n host: this.props.host,\r\n userInfo: accessTokenInfo.userInfo,\r\n onDetailViewChangedHandler: this.onDetailViewChangeHandler,\r\n onSessionExpiredHandler: this.onSessionExpired,\r\n })\r\n const stickyNotesFrame = new StickyNotesFrame(layoutSDKWrapper.layoutSDK, STICKY_NOTES_FRAME_ID)\r\n await layoutSDKWrapper.setup({\r\n renderElementId: STICKY_NOTES_FRAME_ID,\r\n langCode: language,\r\n authContext: accessTokenInfo && accessTokenInfo.authContext,\r\n theme: this.props.host.getTheme(),\r\n platform: this.props.host.getPlatform(),\r\n })\r\n this.setState({ signInStatus: 'EXCHANGE_TOKEN' })\r\n await layoutSDKWrapper.login()\r\n stickyNotesFrame.focus()\r\n this.setState({\r\n signInStatus: 'NOT_IN_PROGRESS',\r\n userInfo,\r\n userPhotoSrc: undefined,\r\n stickyNotesFrame,\r\n })\r\n } else {\r\n this.setState({ signInStatus: 'NOT_IN_PROGRESS' })\r\n Log.logger.error('AuthError: Access token info was undefined after user signed-in successfully!')\r\n }\r\n }\r\n\r\n render(): JSX.Element | null {\r\n // NOTE: The Sticky Notes SDK UI is not managed using the React lifecycle as the SDK is not exposed\r\n // as a React component. We manage it using StickyNotesFrame, and the element it renders in is hardcoded\r\n // as inline HTML. See `componentDidUpdate` to see how this is being managed.\r\n const { userInfo, signInStatus, userPhotoSrc, accounts, detailViewVisible, isSessionExpired, suppressWarning } = this.state\r\n\r\n if (detailViewVisible) {\r\n return null\r\n }\r\n\r\n if (userInfo && !isSessionExpired) {\r\n return (\r\n \r\n \r\n )\r\n }\r\n\r\n if (signInStatus === 'NOT_IN_PROGRESS' && ( !isSessionExpired || suppressWarning)) {\r\n elementIdToFocus = 'sign-in-panel'\r\n return (\r\n \r\n \r\n )\r\n }\r\n\r\n if (isSessionExpired && !suppressWarning) {\r\n elementIdToFocus = 'session-expired-panel'\r\n return (\r\n \r\n \r\n \r\n )\r\n }\r\n\r\n return null\r\n }\r\n}\r\n","import styledComponents from 'styled-components'\r\nimport { IThemeProps } from '../App/AppStyles'\r\n\r\n// tslint:disable:variable-name\r\nexport const AccountButtonWrapper = styledComponents.button`\r\n margin-top: 12px;\r\n height: 32px;\r\n width: 248px;\r\n padding: 0px 6px;\r\n background-color: ${(p: IThemeProps) => p.theme.colors.signInBtnBackGroundColor};\r\n border-radius: 2px;\r\n border: none;\r\n align-items: center;\r\n font-size: 13px;\r\n line-height: 15px;\r\n color: ${(p: IThemeProps) => p.theme.colors.signInBtnTextColor};\r\n cursor: pointer;\r\n\r\n &:hover {\r\n background-color: ${(p: IThemeProps) => p.theme.colors.signInBtnHoverColor};\r\n }\r\n`\r\nexport const AccountButtonEmailDiv = styledComponents.div`\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font}\r\n font-size: 12px;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n`\r\n","import * as React from 'react'\r\nimport { AccountButtonEmailDiv, AccountButtonWrapper } from './AccountButtonStyles'\r\nimport { Props } from './props'\r\n\r\nexport class AccountButton extends React.Component {\r\n onAccountButtonPressed = () => {\r\n const { account, signInToAccount } = this.props\r\n signInToAccount(account)\r\n }\r\n\r\n render(): JSX.Element {\r\n const account = this.props.account\r\n\r\n return (\r\n \r\n { account.upn }\r\n \r\n )\r\n }\r\n}\r\n","import styledComponents from 'styled-components'\r\nimport { IThemeProps } from '../App/AppStyles'\r\n\r\n// tslint:disable:variable-name\r\nexport const SignInBtnWrapperDiv = styledComponents.div`\r\n margin-top: 68px;\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: center;\r\n align-items: center;\r\n`\r\nexport const SignInButton = styledComponents.button`\r\n width: 248px;\r\n background-color: ${(p: IThemeProps) => p.theme.colors.signInBtnBackGroundColor};\r\n height: 32px;\r\n border-radius: 2px;\r\n border: none;\r\n padding: 0px;\r\n align-items: center;\r\n font-size: 13px;\r\n color: ${(p: IThemeProps) => p.theme.colors.signInBtnTextColor};\r\n cursor: pointer;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n\r\n @media (forced-colors: active) {\r\n background-color: highlight;\r\n color: highlighttext;\r\n forced-color-adjust: none;\r\n outline-color: buttontext;\r\n }\r\n &:hover {\r\n background-color: ${(p: IThemeProps) => p.theme.colors.signInBtnHoverColor};\r\n }\r\n`\r\nexport const SelectAccountLabel = styledComponents.label`\r\n width: 100%;\r\n height: 20px;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 13px;\r\n text-align: center;\r\n padding: 10px;\r\n color: ${(p: IThemeProps) => p.theme.colors.selectAccountLabelColor};\r\n`\r\nexport const UseAnotherAccountButton = styledComponents.button`\r\n margin-top: 12px;\r\n height: 32px;\r\n width: 248px;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 13px;\r\n line-height: 20px;\r\n text-align: center;\r\n background-color: ${(p: IThemeProps) => p.theme.colors.useAnotherAccountBtnBackGroundColor};\r\n color: ${(p: IThemeProps) => p.theme.colors.useAnotherAccountBtnTextColor};\r\n flex: none\r\n align-self: center;\r\n box-sizing: border-box;\r\n border: ${(p: IThemeProps) => p.theme.useAnotherAccountBtnBorder};\r\n cursor: pointer;\r\n\r\n &:hover {\r\n background-color: ${(p: IThemeProps) => p.theme.colors.useAnotherAccountBtnHoverColor};\r\n }\r\n`\r\nexport const UseAnotherAccountLabelLTR = styledComponents.label`\r\n padding-left: 10px;\r\n cursor: pointer;\r\n`\r\nexport const UseAnotherAccountLabelRTL = styledComponents.label`\r\n padding-right: 10px;\r\n cursor: pointer;\r\n`\r\nexport const AccountWrapperDiv = styledComponents(SignInBtnWrapperDiv)`\r\n margin-top: 40px;\r\n`\r\n","import { getErrorAsString, getSignInUrl, setDevParametersIfNeeded, UrlUtils } from '@notes/webintegrations-common'\r\nimport { Icon } from 'office-ui-fabric-react/lib/Icon'\r\nimport * as React from 'react'\r\nimport { LocalizationService } from '../../../localization/LocalizationService'\r\nimport { USE_IMPLICIT_AUTH_FOR_MSA } from '../../../shared/auth/useImplicitAuthForMsa'\r\nimport { Constants } from '../../../shared/Constants'\r\nimport { Log } from '../../../shared/logger/Log'\r\nimport { shouldMockExternalApis } from '../../../shared/shouldMockExternalApis'\r\nimport { getSSOTokenFirstPartyForUser } from '../../auth/getAccessTokenInfo'\r\nimport { IAccountInfo } from '../../auth/IAccountInfo'\r\nimport { localStorageIsSignedInKey } from '../../auth/localStorageIsSignedInKey'\r\nimport { TeamsUtils } from '../../teams/TeamsUtils'\r\nimport { AccountButton } from '../AccountButton/AccountButton'\r\nimport * as css from './accountList.css'\r\nimport { AccountWrapperDiv, SelectAccountLabel, SignInBtnWrapperDiv, SignInButton, UseAnotherAccountButton, UseAnotherAccountLabelLTR, UseAnotherAccountLabelRTL } from './AccountListStyles'\r\nimport { Props } from './props'\r\n// tslint:disable:max-line-length\r\n\r\nlet localStorageInterval: number | undefined = undefined\r\n\r\nexport class AccountList extends React.Component {\r\n signInToAccount = async (accountInfo: IAccountInfo) => {\r\n let accessTokenInfo = undefined\r\n if (!shouldMockExternalApis()) {\r\n try {\r\n accessTokenInfo = await getSSOTokenFirstPartyForUser(this.props.host, accountInfo.upn, accountInfo.authType)\r\n } catch (e) {\r\n if (e.message === Constants.cancelledError) {\r\n Log.logger.warn('User was not signed in. SSO was cancelled.')\r\n return\r\n }\r\n\r\n Log.logger.warn(`Unable to get SSO access tokens for a specific user. ${JSON.stringify(e)}`)\r\n }\r\n }\r\n\r\n if (accessTokenInfo) {\r\n const { onSignInComplete } = this.props\r\n await onSignInComplete(accessTokenInfo)\r\n } else {\r\n // Fall back to pre-populated sign in dialog\r\n await this.showSignInDialog(accountInfo.upn)\r\n }\r\n }\r\n\r\n onSignInButtonPressed = async () => {\r\n await this.showSignInDialog()\r\n }\r\n\r\n showSignInDialog = async (upn?: string) => {\r\n const { onSignInComplete } = this.props\r\n try {\r\n Log.logger.info('Opening OAuth dialog')\r\n await this.signInDialog(upn)\r\n Log.logger.info('OAuth dialog closed because user signed-in successfully')\r\n await onSignInComplete(undefined)\r\n } catch (error) {\r\n Log.logger.warn(`User was not signed in. Reason: ${getErrorAsString(error)}`)\r\n }\r\n }\r\n\r\n signInDialog = async (upn?: string): Promise => {\r\n Log.logger.info('Attempting to open a dialog for signing in...')\r\n const redirectUrlWithoutParam = `${Constants.protocolAndHostName}/officeaddins/stickynotes/closeofficedialog`\r\n const redirectUrl = setDevParametersIfNeeded(redirectUrlWithoutParam)\r\n let signInUrl = getSignInUrl(redirectUrl, USE_IMPLICIT_AUTH_FOR_MSA, 1, 'consent')\r\n if (upn) {\r\n signInUrl = UrlUtils.mergeQueryParamsIntoUrl(signInUrl, { 'login_hint': upn })\r\n }\r\n\r\n if (shouldMockExternalApis()) {\r\n await this.signInWithWindowOpen(signInUrl)\r\n } else if (TeamsUtils.isHostedOnTeams()) {\r\n await this.signInWithTeams(signInUrl)\r\n } else {\r\n const onBeginSignIn = (endSignIn: () => void) => this.setLocalStorageAuthCompletionListener(endSignIn)\r\n\r\n await this.props.host.signIn(signInUrl, onBeginSignIn)\r\n this.cleanUpSignInWindow()\r\n }\r\n }\r\n\r\n signInWithWindowOpen = async (signInUrl: string): Promise => {\r\n return new Promise((resolve: () => void, _reject: () => void) => {\r\n const signInWindow = window.open(signInUrl, '', 'width=500,height=500')!\r\n const authCompletedListener = () => {\r\n signInWindow.close()\r\n resolve()\r\n }\r\n\r\n this.setLocalStorageAuthCompletionListener(authCompletedListener)\r\n\r\n const handle = setInterval(() => {\r\n if (signInWindow.closed) {\r\n this.cleanUpSignInWindow()\r\n clearInterval(handle)\r\n\r\n // This is not perfect, as this could be caused by the user closing the\r\n // window (and we actually want to reject), but for local development,\r\n // this is good enough\r\n resolve()\r\n }\r\n }, 500)\r\n })\r\n }\r\n\r\n signInWithTeams = async (signInUrl: string): Promise => {\r\n return new Promise((resolve: () => void, _reject: () => void) => {\r\n TeamsUtils.requestAuthenticationViaTeams(signInUrl)\r\n const authCompletedListener = () => {\r\n this.cleanUpSignInWindow()\r\n resolve()\r\n }\r\n\r\n this.setLocalStorageAuthCompletionListener(authCompletedListener)\r\n })\r\n }\r\n\r\n cleanUpSignInWindow = () => {\r\n Log.logger.info('Sign in window was completed.')\r\n localStorage.removeItem(localStorageIsSignedInKey)\r\n if (localStorageInterval) {\r\n clearInterval(localStorageInterval)\r\n localStorageInterval = undefined\r\n }\r\n }\r\n\r\n setLocalStorageAuthCompletionListener = (callback: () => void) => {\r\n // Workaround auth completion detection for Edge-only. This is executed before adding the event\r\n // handler to the Dialog API so we always clear the timeout in both Edge and non-Edge cases\r\n // TODO this should be common code somewhere since most agaves will need this\r\n if (!localStorageInterval) {\r\n localStorageInterval = window.setInterval(() => {\r\n if (localStorage.getItem(localStorageIsSignedInKey)) {\r\n Log.logger.info('localStorage detected that authentication is complete')\r\n callback()\r\n }\r\n }, 500)\r\n }\r\n }\r\n\r\n render(): JSX.Element {\r\n const accounts = this.props.accounts\r\n const isRTL: boolean = LocalizationService.isRtl\r\n if (accounts.length === 0) {\r\n const signInLocalizedString = LocalizationService.getLocalizedString('stickyNotes.agave.accountList.signInLabel')\r\n\r\n return (\r\n \r\n { signInLocalizedString }\r\n \r\n \r\n )\r\n } else {\r\n const selectAccountLocalizedString = LocalizationService.getLocalizedString('stickyNotes.agave.accountList.selectAccount')\r\n const useAnotherAccountLocalizedString = LocalizationService.getLocalizedString('stickyNotes.agave.accountList.useAnotherAccount')\r\n\r\n return (\r\n \r\n { selectAccountLocalizedString }\r\n { accounts.map((account: IAccountInfo) => ) }\r\n \r\n \r\n { isRTL ? { useAnotherAccountLocalizedString } : { useAnotherAccountLocalizedString } }\r\n \r\n \r\n )\r\n }\r\n }\r\n}\r\n","import styledComponents from 'styled-components'\r\nimport { IThemeProps } from '../App/AppStyles'\r\n\r\n// tslint:disable:variable-name\r\nexport const SignInImg = styledComponents.img`\r\n display: block;\r\n margin-top: 48px;\r\n max-width: 40%;\r\n margin-left: auto;\r\n margin-right: auto;\r\n`\r\nexport const SignInTextDiv = styledComponents.div`\r\n display: block;\r\n text-align: center;\r\n padding-left: 20px;\r\n padding-right: 20px;\r\n`\r\nexport const SignInTitleLabel = styledComponents.label`\r\n display: block;\r\n margin-top: 50px;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 18px;\r\n line-height: 24px;\r\n text-align: center;\r\n color: ${(p: IThemeProps) => p.theme.colors.signInTitleColor};\r\n`\r\nexport const SignInDescriptionLabel = styledComponents.label`\r\n display: block;\r\n margin-top: 16px;\r\n font-family: ${(p: IThemeProps) => p.theme.fontFamily.font};\r\n font-size: 14px;\r\n line-height: 24px;\r\n text-align: center;\r\n color: ${(p: IThemeProps) => p.theme.colors.signInDescriptionColor};\r\n`\r\n","import * as React from 'react'\r\nimport { LocalizationService } from '../../../localization/LocalizationService'\r\nimport { AccountList } from '../AccountList/AccountList'\r\nimport { Props } from './props'\r\nimport { SignInDescriptionLabel, SignInImg, SignInTextDiv, SignInTitleLabel } from './SignInStyles'\r\n\r\nconst signInPngSrc = require('./signinnew.png')\r\n\r\nexport class SignIn extends React.Component {\r\n render(): JSX.Element {\r\n const imageAltLocalizedString = LocalizationService.getLocalizedString('stickyNotes.agave.signIn.imageAlt')\r\n const titleLocalizedString = LocalizationService.getLocalizedString('stickyNotes.agave.signIn.title')\r\n const descriptionLocalizedString = LocalizationService.getLocalizedString('stickyNotes.agave.signIn.description')\r\n\r\n const { host, accounts, onSignInComplete } = this.props\r\n return (\r\n
\r\n \r\n \r\n { titleLocalizedString }\r\n { descriptionLocalizedString }\r\n \r\n \r\n
\r\n )\r\n }\r\n}\r\n","import { getSignOutUrl } from './getSignOutUrl';\r\n/**\r\n * Signs the user out silently (i.e., without showing UI)\r\n */\r\nexport function performSilentSignOut() {\r\n var iframe = document.createElement('iframe');\r\n iframe.style.display = 'none';\r\n iframe.src = getSignOutUrl();\r\n document.body.appendChild(iframe);\r\n}\r\n//# sourceMappingURL=performSilentSignOut.js.map","import { ConsoleLogger, getErrorAsString, IAuthenticatedUserInfo, ILogger } from '@notes/webintegrations-common'\r\nimport { loadTheme } from 'office-ui-fabric-react/lib/Styling'\r\nimport * as React from 'react'\r\nimport * as ReactDOM from 'react-dom'\r\nimport { AppIntegrationSetup } from '../AppIntegrationSetup'\r\nimport { STICKY_NOTES_FRAME_ID } from '../shared/elementIds'\r\nimport { Log } from '../shared/logger/Log'\r\nimport { shouldMockExternalApis } from '../shared/shouldMockExternalApis'\r\nimport { supportsCSSVariables } from '../shared/supportsCSSVariables'\r\nimport { App } from './components/App/App'\r\nimport { IHostIntegration } from './hostIntegration/IHostIntegration'\r\nimport { createLayoutSDKWrapper } from './layoutSDK/createLayoutSDKWrapper'\r\nimport { StickyNotesFrame } from './ui/stickyNotesFrame'\r\n\r\nrequire('../assets/agave/stickynotes16x16.png')\r\nrequire('../assets/agave/stickynotes32x32.png')\r\nrequire('../assets/agave/stickynotes64x64.png')\r\nrequire('../assets/agave/stickynotes80x80.png')\r\nrequire('../assets/agave/showallnotes_16.png')\r\nrequire('../assets/agave/showallnotes_32.png')\r\nrequire('../assets/agave/showallnotes_80.png')\r\n\r\nimport '../shared/webIntegrationTweaks.css'\r\nimport './agave.css'\r\nimport { IAccessTokenInfo } from './auth/IAccessTokenInfo'\r\n\r\nconst APP_ELEMENT_ID = 'app'\r\nlet sessionExpired = false\r\n\r\nexport async function startApp(host: IHostIntegration): Promise {\r\n // override CSS for OneNote as host\r\n if (host.getTheme() === 'Dark') {\r\n document.documentElement.style.setProperty('--oneNotePurple','#C0AAE4')\r\n document.documentElement.style.setProperty('--chevronColor','#E1E1E1')\r\n }\r\n if (supportsCSSVariables()) {\r\n require('./oneNoteLayoutSDK.css')\r\n if (host.getTheme() === 'Dark') {\r\n document.documentElement.style.setProperty('--n-fluent-icon','#C0AAE4')\r\n } else {\r\n document.documentElement.style.setProperty('--n-fluent-icon','#7719aa')\r\n }\r\n loadTheme({\r\n palette: {\r\n // addnote hover\r\n themePrimary: 'var(--oneNotePurple)',\r\n // filter hover\r\n themeDarkAlt: 'var(--oneNotePurple)',\r\n // filter active\r\n themeDark: 'var(--oneNotePurple)',\r\n },\r\n })\r\n }\r\n const namespace = 'NotesFeedAgave'\r\n const logger: ILogger | undefined = shouldMockExternalApis() ? new ConsoleLogger(namespace) : host.getLogger(namespace)\r\n AppIntegrationSetup.initLogging(window, logger)\r\n\r\n let accessTokenInfo: IAccessTokenInfo | undefined = undefined\r\n if (!shouldMockExternalApis()) {\r\n try {\r\n accessTokenInfo = await host.tryGetAccessTokenInfoWithoutUserAction()\r\n } catch (error) {\r\n Log.logger.error(`Failed to get user information. Showing the \"reload the page\" banner. ${getErrorAsString(error)}`)\r\n }\r\n }\r\n\r\n const userInfo = accessTokenInfo && accessTokenInfo.userInfo\r\n const desiredLocale = host.getLanguage()\r\n await AppIntegrationSetup.init('StickyNotesAgaveBoot', desiredLocale, userInfo)\r\n\r\n function onDetailViewChangedHandler(isDetailViewVisible: boolean): void {\r\n const appElement = document.getElementById('app')\r\n if (appElement) {\r\n if (isDetailViewVisible) {\r\n appElement.style.display = 'none'\r\n } else {\r\n appElement.style.display = 'block'\r\n }\r\n }\r\n }\r\n function onSessionExpiredHandler(): void {\r\n sessionExpired = true\r\n render(host, stickyNotesFrame, userInfo)\r\n }\r\n const layoutSDKWrapper = userInfo ? createLayoutSDKWrapper({ host, userInfo, onDetailViewChangedHandler, onSessionExpiredHandler }) : undefined\r\n const stickyNotesFrame = new StickyNotesFrame(layoutSDKWrapper && layoutSDKWrapper.layoutSDK, STICKY_NOTES_FRAME_ID)\r\n if (layoutSDKWrapper) {\r\n await layoutSDKWrapper.setup({\r\n renderElementId: STICKY_NOTES_FRAME_ID,\r\n langCode: desiredLocale,\r\n authContext: accessTokenInfo && accessTokenInfo.authContext,\r\n theme: host.getTheme(),\r\n platform: host.getPlatform(),\r\n })\r\n await layoutSDKWrapper.login()\r\n }\r\n stickyNotesFrame.focus()\r\n render(host, stickyNotesFrame, userInfo)\r\n}\r\n\r\nfunction render(\r\n host: IHostIntegration,\r\n stickyNotesFrame: StickyNotesFrame,\r\n userInfo: IAuthenticatedUserInfo | undefined): void | Element | React.Component {\r\n const appElement = document.getElementById(APP_ELEMENT_ID)\r\n return ReactDOM.render(\r\n ,\r\n appElement\r\n )\r\n}\r\n","import { generateGuid } from '@notes/webintegrations-common'\r\n\r\nlet deviceID: string | undefined\r\n\r\nexport function localStorageAvailable(): boolean {\r\n try {\r\n const storageTest = 'tniStorageTest'\r\n localStorage.setItem(storageTest, storageTest)\r\n localStorage.removeItem(storageTest)\r\n return true\r\n } catch (e) {\r\n // tslint:disable-next-line:no-console\r\n console.info('[getDeviceID] local storage unavailable')\r\n return false\r\n }\r\n}\r\n\r\nexport function getDeviceID(): string {\r\n const deviceIdKey = 'snDeviceId'\r\n // tslint:disable-next-line:no-typeof-undefined\r\n if (typeof(deviceID) === 'undefined') {\r\n if (localStorageAvailable()) {\r\n const existingDeviceId = localStorage.getItem(deviceIdKey)\r\n if (!existingDeviceId) {\r\n deviceID = generateGuid()\r\n localStorage.setItem(deviceIdKey, deviceID)\r\n } else {\r\n deviceID = existingDeviceId\r\n }\r\n } else {\r\n deviceID = generateGuid()\r\n }\r\n }\r\n\r\n return deviceID\r\n}\r\n\r\nexport function overrideDeviceID(id: string): void {\r\n deviceID = id\r\n}\r\n","export function generateGuid() {\r\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n var r = Math.random() * 16 | 0;\r\n var v = c === 'x' ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n}\r\n//# sourceMappingURL=generateGuid.js.map","export namespace AriaTokens {\r\n export const ONDC_NOTES_INTEGRATION_ARIA_TENANT = '41701a0d2ecf4ad6a3d47b4352bf3937-72a6ba9b-e632-47e4-9ccc-5052f6190c5c-6927'\r\n}\r\n\r\nexport namespace OTelTokens {\r\n export const ONENOTE_NEXUS_TENANT_TOKEN = 1718\r\n export const ONDC_NOTES_INTEGRATION_OTEL_TENANT = '6c530cfc6dd549f2a4a3e0e3c8cfdd22-28a36521-61fe-4559-a47b-5d98803a2f60-7312'\r\n}\r\n","import { EventName } from './EventName'\r\n\r\n// We list all of the properties of events that we log\r\nexport interface IEventProperties {\r\n // Indicates an event is exportable for GDPR\r\n isExportable?: boolean\r\n}\r\n\r\nexport const eventProperties: { [key in EventName]?: IEventProperties } = {\r\n 'SettingsButtonClicked': { isExportable: true },\r\n 'FeedbackButtonClicked': { isExportable: true },\r\n 'OpenInAppClicked': { isExportable: true },\r\n 'SDKTelemetryEvent': { isExportable: false }, // Not exporting these one, as they are exported from the SDK\r\n 'NewShoreLineFeedUser': { isExportable: false },\r\n 'NewONEcosytemShoreLineFeedUser': { isExportable: false },\r\n 'AppBootStarted': { isExportable: false },\r\n}\r\n","import { IPrimitiveProperties } from '@notes/aria-common-schema-logger'\r\nimport { PrimitiveProperties } from '@notes/webintegrations-common'\r\nimport { LocalizationService } from '../../localization/LocalizationService'\r\nimport { GlobalVariables } from '../GlobalVariables'\r\n\r\nexport function buildContext(context: PrimitiveProperties = {}): PrimitiveProperties {\r\n const commonContext = {\r\n SessionId: GlobalVariables.environmentSettings.sessionId,\r\n CorrelationId: GlobalVariables.environmentSettings.correlationId,\r\n Ring: GlobalVariables.environmentSettings.ring,\r\n Version: GlobalVariables.environmentSettings.version,\r\n Language: LocalizationService.areLocalizationValuesReady ? LocalizationService.locale : 'LOCALE NOT AVAILABLE YET',\r\n TextDirection: LocalizationService.areLocalizationValuesReady ? LocalizationService.textDirection : 'TEXT DIRECTION NOT AVAILABLE YET',\r\n }\r\n return {\r\n ...context,\r\n ...commonContext,\r\n }\r\n}\r\n\r\nexport function buildEnvironmentSettingsContext(): IPrimitiveProperties {\r\n const environmentSettings = GlobalVariables.environmentSettings\r\n return {\r\n SessionId: environmentSettings.sessionId,\r\n CorrelationId: environmentSettings.correlationId,\r\n Ring: environmentSettings.ring,\r\n Version: environmentSettings.version,\r\n }\r\n}\r\n","import { DataCategories, DiagnosticLevel, EventFlags, SamplingPolicy, TelemetrySink } from '@microsoft/oteljs'\r\nimport {\r\n ExpirationDate,\r\n IOTelLoggerOptions,\r\n IUserContext,\r\n OTelLogger} from '@notes/aria-common-schema-logger'\r\nimport { isEdgeHubQueryParamPresent } from '../../lib/urlParserUtils'\r\nimport { OTelTokens } from './constants'\r\nimport { EventName } from './EventName'\r\nimport { eventProperties } from './eventProperties'\r\nimport {\r\n INotesIntegrationLogItem,\r\n INotesIntegrationOTelLoggerOptions,\r\n INotesIntegrationUnexpectedLogItem,\r\n IONDCLogger\r\n } from './types'\r\nimport { buildContext } from './utils'\r\n\r\nexport class NotesIntegrationCommonLogger implements IONDCLogger {\r\n private hostApp?: string\r\n private otelLogger: OTelLogger\r\n private isInitialized: boolean\r\n\r\n constructor(\r\n options: INotesIntegrationOTelLoggerOptions,\r\n userInfo?: IUserContext | undefined,\r\n sink?: TelemetrySink | undefined) {\r\n const { appName, ...rest } = options\r\n const isEUDBRoutingEnabled = true\r\n\r\n const otelLoggerOptions: IOTelLoggerOptions = {\r\n ...rest,\r\n appID: appName,\r\n tenantID: OTelTokens.ONDC_NOTES_INTEGRATION_OTEL_TENANT,\r\n tenantNameSpace: 'Office.OneNoteIntegrations.OneNoteDotComNotesIntegration',\r\n nexusTenantToken: OTelTokens.ONENOTE_NEXUS_TENANT_TOKEN,\r\n transmitProfile: 'NEAR_REAL_TIME',\r\n /**\r\n * Office OneNoteIntegrations has been onboarded to HRD as part of the work item below.\r\n * VSO: https://office.visualstudio.com/OC/_workitems/edit/9171957\r\n */\r\n officeApplicationNumber: 164,\r\n }\r\n this.otelLogger = new OTelLogger(\r\n otelLoggerOptions,\r\n buildContext(),\r\n isEUDBRoutingEnabled,\r\n userInfo,\r\n sink,\r\n undefined,\r\n false\r\n // We need not enable logging of Optional events for ONDC since each event in ONDC is explicitly marked as RequiredServiceData\r\n )\r\n\r\n if (sink) {\r\n this.isInitialized = true\r\n }\r\n\r\n if (!this.isInitialized) {\r\n // This will ensure that the telemetry is routed to the default\r\n // data boundary till the user context is set.\r\n this.otelLogger.flushLogs()\r\n this.isInitialized = true\r\n }\r\n this.hostApp = isEdgeHubQueryParamPresent() ? 'EdgeHub' : undefined\r\n }\r\n\r\n setAgaveHostApp(hostApp: string): void {\r\n this.hostApp = hostApp\r\n }\r\n\r\n logONDCReportData(eventName: EventName, item: INotesIntegrationLogItem): void {\r\n const { Context, ...otherProperties } = item\r\n const finalContext = buildContext(Context)\r\n const eventProps = eventProperties[eventName]\r\n const eventFlags = this.buildEventFlags()\r\n const finalItem = {\r\n ...otherProperties,\r\n Context: finalContext,\r\n ExpirationDate: ExpirationDate.Perpetual,\r\n IsExportable: !!(eventProps && eventProps.isExportable),\r\n HostApp: this.hostApp,\r\n }\r\n\r\n this.otelLogger.logReportData(finalItem, eventFlags)\r\n }\r\n\r\n logONDCUnexpected(logItem: INotesIntegrationUnexpectedLogItem): void {\r\n const { Context, ...otherProperties } = logItem\r\n const finalContext = buildContext(Context)\r\n const eventFlags = this.buildEventFlags()\r\n const item = {\r\n ...otherProperties,\r\n Context: finalContext,\r\n ExpirationDate: ExpirationDate.Perpetual,\r\n IsExportable: false, // We don't export errors\r\n HostApp: this.hostApp,\r\n }\r\n this.otelLogger.logUnexpected(item, eventFlags)\r\n }\r\n\r\n setUserContext(otelUserContext: IUserContext): void {\r\n this.otelLogger.setUserContext(otelUserContext)\r\n .then(() => {\r\n // After setting the user context, a new OTel sink will be created\r\n // if the existing sink was an instance of OneDSSink. This is done\r\n // to ensure that the telemetry is routed to the correct data boundary.\r\n // The current OTel sink will be shut down thereafter.\r\n // If the existing sink was an instance of Office.js Sink, then continue\r\n // using the same sink, which correctly routes telemetry to EU/ROW, and\r\n // is hence EUDB compliant.\r\n this.isInitialized = true\r\n })\r\n .catch ((error: Error) => {\r\n // tslint:disable-next-line:no-console\r\n console.warn('Failed to set the user Context ' + error)\r\n })\r\n }\r\n\r\n private buildEventFlags(): Partial {\r\n /**\r\n * We checked with our privacy drivers and have received an approval\r\n * to change the diagnostic level to RequiredServiceData\r\n * given that OneNoteDotComNotesIntegration is a web based experience.\r\n */\r\n return {\r\n dataCategories: DataCategories.ProductServiceUsage,\r\n diagnosticLevel: DiagnosticLevel.RequiredServiceData,\r\n samplingPolicy: SamplingPolicy.CriticalUsage,\r\n }\r\n }\r\n}\r\n","import { TelemetrySink } from '@microsoft/oteljs'\r\nimport { Audience, IUserContext } from '@notes/aria-common-schema-logger'\r\nimport { Args, IAuthenticatedUserInfo, IErrorCodeInfo, ILogger, LogMessageFormatter, PrimitiveProperties } from '@notes/webintegrations-common'\r\nimport { Constants } from '../Constants'\r\nimport { GlobalVariables } from '../GlobalVariables'\r\nimport { getDeviceID } from '../uuid/getDeviceID'\r\nimport { EventName } from './EventName'\r\nimport { getOTelLoggingUserContextFromUserInformation } from './getLoggingUserContextFromUserInformation'\r\nimport { NotesIntegrationCommonLogger } from './NotesIntegrationCommonLogger'\r\n\r\nexport class CommonLogger implements ILogger {\r\n private namespace: string\r\n private commonLogger: NotesIntegrationCommonLogger\r\n\r\n constructor(namespace: string, sink?: TelemetrySink | undefined) {\r\n this.namespace = namespace\r\n\r\n const userInfo: IUserContext | undefined = undefined\r\n this.commonLogger = new NotesIntegrationCommonLogger({\r\n appName: Constants.stickyNotesOndcAppIdForLogging,\r\n appVersion: GlobalVariables.environmentSettings.version,\r\n audience: Audience.Dogfood, // TODO: specify correct audience\r\n deviceID: getDeviceID(),\r\n namespace: this.namespace,\r\n }, userInfo, sink)\r\n }\r\n\r\n /**\r\n * Logs an error.\r\n */\r\n error(message: string, ...args: Args): void {\r\n const formattedMessage = LogMessageFormatter.format(message, args)\r\n\r\n this.commonLogger.logONDCReportData('DiagnosticError', {\r\n Namespace: this.namespace,\r\n ShortEventName: 'DiagnosticError',\r\n Context: { Message: formattedMessage },\r\n })\r\n }\r\n\r\n /**\r\n * Logs information.\r\n */\r\n info(message: string, ...args: Args): void {\r\n const formattedMessage = LogMessageFormatter.format(message, args)\r\n\r\n this.commonLogger.logONDCReportData('DiagnosticInfo', {\r\n Namespace: this.namespace,\r\n ShortEventName: 'DiagnosticInfo',\r\n Context: { Message: formattedMessage },\r\n })\r\n }\r\n\r\n /**\r\n * Logs a warning.\r\n */\r\n warn(message: string, ...args: Args): void {\r\n const formattedMessage = LogMessageFormatter.format(message, args)\r\n\r\n this.commonLogger.logONDCReportData('DiagnosticWarn', {\r\n Namespace: this.namespace,\r\n ShortEventName: 'DiagnosticWarn',\r\n Context: { Message: formattedMessage },\r\n })\r\n }\r\n\r\n /**\r\n * Implements OneNote Common Schema ReportData logging.\r\n * Logs to Aria using the shared Sticky Notes tenant\r\n * DO NOT INCLUDE PII !!!\r\n */\r\n logReportData(eventName: EventName, _isCriticalEvent: boolean, payloadNonPII?: PrimitiveProperties, _payloadEUPIOnlyNonPII?: PrimitiveProperties): void {\r\n this.commonLogger.logONDCReportData(eventName, {\r\n Namespace: this.namespace,\r\n ShortEventName: eventName,\r\n Context: payloadNonPII,\r\n })\r\n }\r\n\r\n /**\r\n * Logs a unique event with a message.\r\n */\r\n logEvent(eventName: EventName, message: string, ...args: Args): void {\r\n const formattedMessage = LogMessageFormatter.format(message, args)\r\n\r\n this.commonLogger.logONDCReportData(eventName, {\r\n Namespace: this.namespace,\r\n ShortEventName: eventName,\r\n Context: { Message: formattedMessage },\r\n })\r\n }\r\n\r\n logUnexpected = (errorInfo: IErrorCodeInfo, errorDescription: string, sessionCorrelationId?: string) => {\r\n this.commonLogger.logONDCUnexpected({\r\n Namespace: this.namespace,\r\n ShortEventName: errorInfo.name,\r\n ErrorCode1: errorInfo.errorCode1,\r\n ErrorCode2: errorInfo.errorCode2,\r\n ErrorTag: errorInfo.errorTag,\r\n ErrorType: errorDescription,\r\n SessionCorrelationId: sessionCorrelationId,\r\n })\r\n }\r\n\r\n setUserContext(userInfo: IAuthenticatedUserInfo): void {\r\n // if we are using new middleware for getting user context info\r\n const otelUserContextForLogging = getOTelLoggingUserContextFromUserInformation(userInfo)\r\n if (otelUserContextForLogging) {\r\n this.commonLogger.setUserContext(otelUserContextForLogging)\r\n }\r\n }\r\n\r\n}\r\n","import { ILogger } from '@notes/webintegrations-common'\r\n\r\n/**\r\n * Domain-specific log wrapper over the more project-agnostic\r\n * logging classes. Anything coupled to our build system can be\r\n * safely used here.\r\n */\r\nexport class Log {\r\n private static loggerInstance: ILogger\r\n\r\n static get logger(): ILogger {\r\n if (!this.loggerInstance) {\r\n throw new Error('Logger has not been initialized. Call Log.initialize!')\r\n }\r\n return Log.loggerInstance\r\n }\r\n\r\n static initialize(logger: ILogger): void {\r\n if (!this.loggerInstance) {\r\n Log.loggerInstance = logger\r\n } else {\r\n Log.loggerInstance.warn('Attempted to initialize logger after it has already been initialized. This is a no-op.')\r\n }\r\n }\r\n}\r\n","import { IAuthenticatedUserInfo, IExchangeTokenApiOutput, IImplicitCredentials, LocalStorageCacheWithExpiry } from '@notes/webintegrations-common'\r\nimport { Log } from './logger/Log'\r\n\r\nconst getEpochNowInSeconds = () => Date.now() / 1000\r\nconst thirtyMinutesInSeconds = 1800\r\nconst getDefaultEpochExpiryInSeconds = () => getEpochNowInSeconds() + thirtyMinutesInSeconds\r\n\r\n// For now, even though we get back expires_in from implicit grant, we just hardcode an expiry threshold for simplicity\r\n// TODO (machiam) Set up default caches in the lib so that we don't use different values per integration (I believe they can and should be shared)\r\nexport const userInfoCacheConstantKey = 'UserInfo'\r\n\r\n// userInfoCache is used in first party sso flow as well. We remember userInfoCache for the agave host to know which upn (or account) Sticky Notes\r\n// have been using in past sessions. Without userInfoCache, the first party sso flow will fallback to an active account.\r\nexport const userInfoCache = new LocalStorageCacheWithExpiry(userInfoCacheConstantKey, getDefaultEpochExpiryInSeconds)\r\n\r\nexport const userPhotoCache = new LocalStorageCacheWithExpiry(userInfoCacheConstantKey, getDefaultEpochExpiryInSeconds)\r\nexport const exchangeTokenCache = new LocalStorageCacheWithExpiry('ExchangeToken', getDefaultEpochExpiryInSeconds)\r\nexport const implicitAuthCache = new LocalStorageCacheWithExpiry('ImplicitAuth', getDefaultEpochExpiryInSeconds)\r\n\r\nexport function clearCaches(): void {\r\n Log.logger.warn('clearing local storage tokens')\r\n userInfoCache.clear()\r\n exchangeTokenCache.clear()\r\n implicitAuthCache.clear()\r\n}\r\n","var map = {\n\t\"./af/strings.json\": [\n\t\t472,\n\t\t56\n\t],\n\t\"./am/strings.json\": [\n\t\t473,\n\t\t57\n\t],\n\t\"./ar/strings.json\": [\n\t\t474,\n\t\t58\n\t],\n\t\"./az/strings.json\": [\n\t\t475,\n\t\t59\n\t],\n\t\"./be/strings.json\": [\n\t\t476,\n\t\t60\n\t],\n\t\"./bg/strings.json\": [\n\t\t477,\n\t\t61\n\t],\n\t\"./bn-BD/strings.json\": [\n\t\t478,\n\t\t62\n\t],\n\t\"./bs/strings.json\": [\n\t\t479,\n\t\t63\n\t],\n\t\"./ca/strings.json\": [\n\t\t480,\n\t\t64\n\t],\n\t\"./cs/strings.json\": [\n\t\t481,\n\t\t65\n\t],\n\t\"./da/strings.json\": [\n\t\t482,\n\t\t66\n\t],\n\t\"./de/strings.json\": [\n\t\t483,\n\t\t67\n\t],\n\t\"./el/strings.json\": [\n\t\t484,\n\t\t68\n\t],\n\t\"./en-GB/strings.json\": [\n\t\t486,\n\t\t69\n\t],\n\t\"./en/strings.json\": [\n\t\t485,\n\t\t70\n\t],\n\t\"./es-MX/strings.json\": [\n\t\t488,\n\t\t71\n\t],\n\t\"./es/strings.json\": [\n\t\t487,\n\t\t72\n\t],\n\t\"./et/strings.json\": [\n\t\t489,\n\t\t73\n\t],\n\t\"./eu/strings.json\": [\n\t\t490,\n\t\t74\n\t],\n\t\"./fa/strings.json\": [\n\t\t491,\n\t\t75\n\t],\n\t\"./fi/strings.json\": [\n\t\t492,\n\t\t76\n\t],\n\t\"./fil/strings.json\": [\n\t\t493,\n\t\t77\n\t],\n\t\"./fr-CA/strings.json\": [\n\t\t495,\n\t\t78\n\t],\n\t\"./fr/strings.json\": [\n\t\t494,\n\t\t79\n\t],\n\t\"./gl/strings.json\": [\n\t\t496,\n\t\t80\n\t],\n\t\"./ha-Latn-NG/strings.json\": [\n\t\t497,\n\t\t81\n\t],\n\t\"./he/strings.json\": [\n\t\t498,\n\t\t82\n\t],\n\t\"./hi/strings.json\": [\n\t\t499,\n\t\t83\n\t],\n\t\"./hr/strings.json\": [\n\t\t500,\n\t\t84\n\t],\n\t\"./hu/strings.json\": [\n\t\t501,\n\t\t85\n\t],\n\t\"./id/strings.json\": [\n\t\t502,\n\t\t86\n\t],\n\t\"./is/strings.json\": [\n\t\t503,\n\t\t87\n\t],\n\t\"./it/strings.json\": [\n\t\t504,\n\t\t88\n\t],\n\t\"./ja/strings.json\": [\n\t\t505,\n\t\t89\n\t],\n\t\"./kk/strings.json\": [\n\t\t506,\n\t\t90\n\t],\n\t\"./km-KH/strings.json\": [\n\t\t507,\n\t\t91\n\t],\n\t\"./kn/strings.json\": [\n\t\t508,\n\t\t92\n\t],\n\t\"./ko/strings.json\": [\n\t\t509,\n\t\t93\n\t],\n\t\"./lo/strings.json\": [\n\t\t510,\n\t\t94\n\t],\n\t\"./lt/strings.json\": [\n\t\t511,\n\t\t95\n\t],\n\t\"./lv/strings.json\": [\n\t\t512,\n\t\t96\n\t],\n\t\"./mk/strings.json\": [\n\t\t513,\n\t\t97\n\t],\n\t\"./ml/strings.json\": [\n\t\t514,\n\t\t98\n\t],\n\t\"./ms/strings.json\": [\n\t\t515,\n\t\t99\n\t],\n\t\"./nb-NO/strings.json\": [\n\t\t516,\n\t\t100\n\t],\n\t\"./nl/strings.json\": [\n\t\t517,\n\t\t101\n\t],\n\t\"./nn-NO/strings.json\": [\n\t\t518,\n\t\t102\n\t],\n\t\"./pl/strings.json\": [\n\t\t519,\n\t\t103\n\t],\n\t\"./pt-BR/strings.json\": [\n\t\t520,\n\t\t104\n\t],\n\t\"./pt-PT/strings.json\": [\n\t\t521,\n\t\t105\n\t],\n\t\"./ro/strings.json\": [\n\t\t522,\n\t\t106\n\t],\n\t\"./ru/strings.json\": [\n\t\t523,\n\t\t107\n\t],\n\t\"./sk/strings.json\": [\n\t\t524,\n\t\t108\n\t],\n\t\"./sl/strings.json\": [\n\t\t525,\n\t\t109\n\t],\n\t\"./sq/strings.json\": [\n\t\t526,\n\t\t110\n\t],\n\t\"./sr-Cyrl-RS/strings.json\": [\n\t\t527,\n\t\t111\n\t],\n\t\"./sr-Latn-RS/strings.json\": [\n\t\t528,\n\t\t112\n\t],\n\t\"./sv/strings.json\": [\n\t\t529,\n\t\t113\n\t],\n\t\"./sw/strings.json\": [\n\t\t530,\n\t\t114\n\t],\n\t\"./ta/strings.json\": [\n\t\t531,\n\t\t115\n\t],\n\t\"./te/strings.json\": [\n\t\t532,\n\t\t116\n\t],\n\t\"./th/strings.json\": [\n\t\t533,\n\t\t117\n\t],\n\t\"./tr/strings.json\": [\n\t\t534,\n\t\t118\n\t],\n\t\"./uk/strings.json\": [\n\t\t535,\n\t\t119\n\t],\n\t\"./uz-Latn-UZ/strings.json\": [\n\t\t536,\n\t\t120\n\t],\n\t\"./vi/strings.json\": [\n\t\t537,\n\t\t121\n\t],\n\t\"./zh-Hans/strings.json\": [\n\t\t538,\n\t\t122\n\t],\n\t\"./zh-Hant/strings.json\": [\n\t\t539,\n\t\t123\n\t]\n};\nfunction webpackAsyncContext(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\treturn Promise.resolve().then(function() {\n\t\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\t\te.code = 'MODULE_NOT_FOUND';\n\t\t\tthrow e;\n\t\t});\n\t}\n\n\tvar ids = map[req], id = ids[0];\n\treturn __webpack_require__.e(ids[1]).then(function() {\n\t\treturn __webpack_require__.t(id, 3);\n\t});\n}\nwebpackAsyncContext.keys = function webpackAsyncContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackAsyncContext.id = 399;\nmodule.exports = webpackAsyncContext;","import { shouldMockExternalApis } from './shouldMockExternalApis'\r\nimport { IEnvironmentSettings, ISettingsForClient } from './types'\r\n\r\ndeclare const EnvironmentSettings: IEnvironmentSettings\r\ndeclare const SettingsForClient: ISettingsForClient\r\n\r\nexport namespace GlobalVariables {\r\n function getEnvironmentSettings(): IEnvironmentSettings {\r\n // When running locally, we want to allow for the global variables to not be present\r\n // tslint:disable-next-line:no-typeof-undefined\r\n if (shouldMockExternalApis() || typeof(EnvironmentSettings) === 'undefined') {\r\n return {\r\n version: 'LOCALTESTVERSION',\r\n ring: 'LOCALRING',\r\n ExampleSettingOnlyTrueInInternal: true,\r\n correlationId: '02db5f19-df21-4fad-bf66-77859ce509b1',\r\n sessionId: 'd5d6b170-6ddb-4a41-825f-a117b7efbd85',\r\n }\r\n } else {\r\n return EnvironmentSettings\r\n }\r\n }\r\n\r\n export const environmentSettings: IEnvironmentSettings = getEnvironmentSettings()\r\n\r\n function getSettingsForClient(): ISettingsForClient {\r\n // tslint:disable-next-line:no-typeof-undefined\r\n if (shouldMockExternalApis() || typeof(SettingsForClient) === 'undefined') {\r\n return {\r\n Locale: 'de-de', // You can change this to change the value of the local language\r\n ServerSidePerfMetrics: { 'Start' : 0 },\r\n GraphResourceUri: 'https://graph.microsoft.com',\r\n OutlookResourceUri: 'https://outlook.office365.com',\r\n OneNoteResourceUri: 'https://onenote.com/',\r\n }\r\n }\r\n return SettingsForClient\r\n }\r\n\r\n export const settingsForClient: ISettingsForClient = getSettingsForClient()\r\n}\r\n","module.exports = __webpack_public_path__ + \"img/stickynotes16x16.png?0f03b94641571af9a5dd4b7dd88743af\";","module.exports = __webpack_public_path__ + \"img/stickynotes32x32.png?7b3d48cdea6742fbe5df48d7d6e6c43d\";","module.exports = __webpack_public_path__ + \"img/stickynotes64x64.png?1e69305726907c22bc370d1a5a21d19f\";","module.exports = __webpack_public_path__ + \"img/stickynotes80x80.png?55c0b1e109cb3f108142e59a12d1aef6\";","module.exports = __webpack_public_path__ + \"img/showallnotes_16.png?85b96e5881f24f748f26057e709d2e69\";","module.exports = __webpack_public_path__ + \"img/showallnotes_32.png?1fa366a18e73934ebe01d9a96437d585\";","module.exports = __webpack_public_path__ + \"img/showallnotes_80.png?887acc14bab9ea71a5061b6d002c2dbc\";","// extracted by mini-css-extract-plugin\nmodule.exports = {\"stickyNotesFrame\":\"stickyNotesSDKStyleOverrides__stickyNotesFrame___f2hUP\",\"n-noteEditViewContainer\":\"stickyNotesSDKStyleOverrides__n-noteEditViewContainer___zHSuH\"};","module.exports = __webpack_public_path__ + \"img/signinnew.png?90ac242c150b5e60da4cfc14fe3485fa\";","module.exports = __webpack_public_path__ + \"img/sessionexpiredlight.png?93b51b86767435ae5a577748afe53a10\";","module.exports = __webpack_public_path__ + \"img/sessionexpireddark.png?2628f79a3a339cf302ae937cc2ab76de\";","import { UrlUtils } from '@notes/webintegrations-common'\r\nimport { Constants } from '../shared/Constants'\r\n\r\nconst ONENOTE_MEMORY_ENDPOINT = 'www.onenote.com/memory/feed'\r\n\r\nexport const isEdgeHubQueryParamPresent = (): boolean => {\r\n const queryParams = UrlUtils.getQueryParamsAsObject(window.location.href)\r\n return (queryParams && queryParams[Constants.EDGE_HUB_QUERY_FIELD] && queryParams[Constants.EDGE_HUB_QUERY_FIELD].startsWith('true')) || window.location.href.indexOf(ONENOTE_MEMORY_ENDPOINT) !== -1\r\n}\r\n\r\nexport const isServiceWorkerEnabled = (): boolean => {\r\n return window.location.href.indexOf(ONENOTE_MEMORY_ENDPOINT) !== -1\r\n}\r\n\r\nexport const isMsaAccountLogin = (): boolean => {\r\n const queryParams = UrlUtils.getQueryParamsAsObject(window.location.href)\r\n\r\n if (queryParams && queryParams[Constants.AUTH_QUERY_FIELD]) {\r\n return queryParams[Constants.AUTH_QUERY_FIELD] === '1'\r\n }\r\n\r\n return false\r\n}\r\n","import { AuthType, getAuthType } from '@notes/webintegrations-common'\r\nimport { USE_IMPLICIT_AUTH_FOR_MSA } from '../../shared/auth/useImplicitAuthForMsa'\r\nimport { getO365AccessTokenInfoFromLocalStorage } from './getO365AccessToken'\r\n\r\n/**\r\n * This is a temporary function to get the auth type if access token is present in local storage\r\n * The getAuthType function in webintegrations-common is updated but due to issues in the pipeline\r\n * the changes are not yet available in the npm.\r\n * https://office.visualstudio.com/OneNote/_git/OneNote-WebIntegrations-Common/pullrequest/2842465\r\n *\r\n * TODO: Remove this function once the changes are available in webintegrations-common package\r\n * @returns AuthType\r\n */\r\nexport function getAuthTypeWithExtension(): AuthType | undefined {\r\n const authType = getAuthType(USE_IMPLICIT_AUTH_FOR_MSA)\r\n if (authType) {\r\n return authType\r\n } else if (getO365AccessTokenInfoFromLocalStorage()) {\r\n return 'o365'\r\n }\r\n return undefined\r\n}\r\n","import { IErrorCodeInfo } from '@notes/webintegrations-common'\r\n\r\nexport namespace Errors {\r\n export const shellApiError: IErrorCodeInfo = {\r\n name: 'ShellApiError',\r\n errorCode1: 0xDC000007,\r\n errorCode2: 0xDC000007,\r\n errorTag: 'ShellApiError',\r\n }\r\n\r\n export function getLocalizationActivityError(errorTag: string): IErrorCodeInfo {\r\n return {\r\n name: 'LocalizationError',\r\n errorCode1: 0xDC000008,\r\n errorCode2: 0xDC000008,\r\n errorTag: errorTag,\r\n }\r\n }\r\n\r\n export const shellLoadingError: IErrorCodeInfo = {\r\n name: 'ShellLoadingError',\r\n errorCode1: 0xDC000009,\r\n errorCode2: 0xDC000009,\r\n errorTag: 'ShellLoadingError',\r\n }\r\n\r\n export function getSetTokenInSdkError(errorTag: string): IErrorCodeInfo {\r\n return {\r\n name: 'SetTokenInSdkError',\r\n errorCode1: 0xDC000010,\r\n errorCode2: 0xDC000010,\r\n errorTag: errorTag,\r\n }\r\n }\r\n\r\n export function getRefreshTokenForSdkError(errorTag: string): IErrorCodeInfo {\r\n return {\r\n name: 'RefreshTokenForSdkError',\r\n errorCode1: 0xDC000011,\r\n errorCode2: 0xDC000011,\r\n errorTag: errorTag,\r\n }\r\n }\r\n\r\n export function getInitialTokenFetchError(errorTag: string): IErrorCodeInfo {\r\n return {\r\n name: 'InitialTokenFetchError',\r\n errorCode1: 0xDC000012,\r\n errorCode2: 0xDC000012,\r\n errorTag: errorTag,\r\n }\r\n }\r\n}\r\n","import { refreshAccessToken } from '@notes/webintegrations-common'\r\nimport { AuthMethod, IAuthContext } from '../../shared/auth/IAuthContext'\r\n\r\nexport class OAuthContext implements IAuthContext {\r\n private accessToken: string\r\n\r\n constructor (initialToken: string) {\r\n this.accessToken = initialToken\r\n }\r\n\r\n getAccessToken(): string {\r\n return this.accessToken\r\n }\r\n\r\n getSubstrateNotesToken(): string | undefined {\r\n return undefined\r\n }\r\n\r\n async refresh(): Promise {\r\n const oAuthToken = await refreshAccessToken()\r\n this.accessToken = oAuthToken.access_token\r\n }\r\n\r\n getAuthMethod(): AuthMethod {\r\n return AuthMethod.OAuth\r\n }\r\n}\r\n","import { IAuthenticatedUserInfo, logAndBuildError } from '@notes/webintegrations-common'\r\nimport { AuthMethod, IAuthContext } from '../../shared/auth/IAuthContext'\r\nimport { IHostIntegration } from '../hostIntegration/IHostIntegration'\r\nimport { getSSOTokenFirstParty } from './getAccessTokenInfo'\r\n\r\nexport class SSOFirstPartyAuthContext implements IAuthContext {\r\n private accessToken: string\r\n private substrateNotesToken: string | undefined\r\n private host: IHostIntegration\r\n\r\n private readonly userInfo: IAuthenticatedUserInfo\r\n constructor (host: IHostIntegration, initialToken: string, userInfo: IAuthenticatedUserInfo, substrateNotesToken?: string) {\r\n this.host = host\r\n this.accessToken = initialToken\r\n this.userInfo = userInfo\r\n this.substrateNotesToken = substrateNotesToken\r\n }\r\n\r\n getAccessToken(): string {\r\n return this.accessToken\r\n }\r\n\r\n getSubstrateNotesToken(): string | undefined {\r\n return this.substrateNotesToken\r\n }\r\n\r\n async refresh(): Promise {\r\n const ssoToken = await getSSOTokenFirstParty(this.host)\r\n if (!ssoToken) {\r\n throw logAndBuildError('Unable to refresh SSO token (first-party)')\r\n }\r\n\r\n if (ssoToken.userInfo.upn !== this.userInfo.upn) {\r\n throw logAndBuildError('Unable to refresh SSO token (first-party): account has changed since initial access')\r\n }\r\n\r\n this.accessToken = ssoToken.authContext.getAccessToken()\r\n this.substrateNotesToken = ssoToken.authContext.getSubstrateNotesToken()\r\n }\r\n\r\n getAuthMethod(): AuthMethod {\r\n return AuthMethod.HostSso\r\n }\r\n}\r\n","import {\r\n AuthType,\r\n decodeO365JwtToken,\r\n getAccessTokenInfoFromCookie,\r\n getErrorAsString,\r\n getMsaImplicitFlowCredentials,\r\n isMsa,\r\n isTokenExpired,\r\n logAndBuildError,\r\n MsaImplicitAuthScope,\r\n refreshAccessToken,\r\n Resource,\r\n} from '@notes/webintegrations-common'\r\nimport { IAuthCookie } from '@notes/webintegrations-common/lib/Auth/Cookie/IAuthCookie'\r\nimport { createGetUserInfo } from '../../shared/auth/authLibFactories'\r\nimport { OAuthContext } from '../../shared/auth/OAuthContext'\r\nimport { userInfoCache, userInfoCacheConstantKey } from '../../shared/caches'\r\nimport { Log } from '../../shared/logger/Log'\r\nimport { IHostIntegration } from '../hostIntegration/IHostIntegration'\r\nimport { getAuthTypeWithExtension } from './getAuthTypeWithExtension'\r\nimport { getO365AccessTokenInfoFromLocalStorage } from './getO365AccessToken'\r\nimport { IAccessTokenInfo } from './IAccessTokenInfo'\r\nimport { IAuthResult, IBehaviorOptions, ITokenParameters } from './ISSOTokenInfo'\r\nimport { SSOFirstPartyAuthContext } from './SSOFirstPartyAuthContext'\r\n\r\nexport async function tryGetOAuthTokenInfoWithoutUserAction(): Promise {\r\n const oAuthTokenInfo = await tryGetOAuthTokenWithoutUserAction()\r\n if (!oAuthTokenInfo) {\r\n Log.logger.error('AuthError: No access token cookie detected. Returning undefined')\r\n return undefined\r\n }\r\n\r\n const authType = getAuthTypeWithExtension()\r\n if (!authType) {\r\n throw logAndBuildError('AuthError: Unable to get user info getter as the user is unexpectedly unauthenticated!')\r\n }\r\n const userInfoGetter = createGetUserInfo(authType)\r\n\r\n try {\r\n const userInfo = await userInfoGetter.getUserInfo(oAuthTokenInfo.access_token, authType)\r\n return { userInfo, authContext: new OAuthContext(oAuthTokenInfo.access_token) }\r\n } catch (error) {\r\n Log.logger.error(`AuthError: Unexpectedly ran into an error trying to get user info: ${getErrorAsString(error)}. Returning undefined`)\r\n return undefined\r\n }\r\n}\r\n\r\nexport async function tryGetOAuthTokenWithoutUserAction(): Promise {\r\n const authType = getAuthTypeWithExtension()\r\n\r\n if (!authType) {\r\n Log.logger.info('User is not authenticated')\r\n return undefined\r\n }\r\n\r\n if (authType === 'o365') {\r\n let tokenInfo = getAccessTokenInfoFromCookie() ?? getO365AccessTokenInfoFromLocalStorage()\r\n if (!tokenInfo) {\r\n Log.logger.info('No access token cookie detected. Returning undefined')\r\n return undefined\r\n }\r\n\r\n if (isTokenExpired(tokenInfo.expires_in)) {\r\n try {\r\n await refreshAccessToken()\r\n } catch (error) {\r\n Log.logger.warn(`Error occurred while refreshing access token: ${getErrorAsString(error)}. Returning undefined`)\r\n return undefined\r\n }\r\n\r\n tokenInfo = getAccessTokenInfoFromCookie()\r\n if (!tokenInfo) {\r\n Log.logger.warn('No access token cookie detected even after refreshing an existing one. Returning undefined')\r\n return undefined\r\n }\r\n }\r\n\r\n return tokenInfo\r\n }\r\n\r\n if (authType === 'msa_implicit') {\r\n return getMsaImplicitFlowCredentials()\r\n }\r\n\r\n Log.logger.warn(`tryGetOAuthTokenWithoutUserAction got unsupported AuthType: ${authType}`)\r\n return undefined\r\n}\r\n\r\nasync function getSSOTokenFirstPartyMsa(host: IHostIntegration, upn: string, authType: AuthType): Promise {\r\n Log.logger.info('Getting SSO access tokens for MSA')\r\n\r\n // The first-party SSO API always appends /User.Read to any resource with the graph URL\r\n // and does not recommend using an explicit scope when making the request\r\n Log.logger.info(`Getting SSO access token for ${Resource.GraphNotes}`)\r\n const graphUserToken = await host.getSSOTokenFirstParty(upn, Resource.GraphNotes)\r\n\r\n // Getting substrate token\r\n Log.logger.info(`Getting SSO access token for ${MsaImplicitAuthScope.NotesInternalReadWrite}`)\r\n const substrateToken = await host.getSSOTokenFirstParty(upn, MsaImplicitAuthScope.NotesInternalReadWrite)\r\n\r\n const userInfoGetter = createGetUserInfo(authType)\r\n const msaUser = await userInfoGetter.getUserInfo(graphUserToken, authType)\r\n return { userInfo: msaUser, authContext: new SSOFirstPartyAuthContext(host, graphUserToken, msaUser, substrateToken) }\r\n}\r\n\r\nasync function getSSOTokenFirstPartyOrgId(host: IHostIntegration, upn: string): Promise {\r\n Log.logger.info('Getting SSO access tokens for OrgId')\r\n\r\n // Get access token for the graph. This will trigger any policies (e.g. 2FA).\r\n Log.logger.info(`Getting SSO graph access token for ${Resource.GraphNotes}`)\r\n const graphToken = await host.getSSOTokenFirstParty(upn, Resource.GraphNotes)\r\n const aadUser = decodeO365JwtToken(graphToken)\r\n if (!aadUser) {\r\n Log.logger.info('Unable to get SSO user info')\r\n return undefined\r\n }\r\n\r\n // Make sure we cache userInfo. userInfoCache is required to be set since the next time\r\n // we call getSSOTokenFirstParty, we will try to get a token from an existing userInfo.upn\r\n // Failing to cache this value will potentially cause us switching an account and resync notes.\r\n userInfoCache.setInCache(userInfoCacheConstantKey, aadUser)\r\n\r\n // Get access token for OneNote. This is used to exchange for other access tokens.\r\n Log.logger.info(`Getting SSO OneNote access token for ${Resource.OneNote}`)\r\n const oneNoteToken = await host.getSSOTokenFirstParty(upn, Resource.OneNote)\r\n return { userInfo: aadUser, authContext: new SSOFirstPartyAuthContext(host, oneNoteToken, aadUser) }\r\n}\r\n\r\nexport async function getSSOTokenFirstParty(host: IHostIntegration): Promise {\r\n\r\n // userInfoCache expires after 30 mins which does not work for SSO scenario as a host session\r\n // could be longer than 30 mins. We only use upn and authType from userInfoCache\r\n // hence, we will just ignore the expiry.\r\n const userInfoCacheWithExpiry = userInfoCache.getWithExpiry(userInfoCacheConstantKey)\r\n const userInfo = userInfoCacheWithExpiry && userInfoCacheWithExpiry.value\r\n if (!userInfo || !userInfo.upn || !userInfo.authType) {\r\n Log.logger.info('No cached user info. Not attempting to get SSO token (first-party)')\r\n return undefined\r\n }\r\n\r\n const upn = userInfo.upn\r\n const authType = userInfo.authType\r\n\r\n Log.logger.info(`Getting SSO token first party by asking the host for our cached userInfo upn with type ${authType}`)\r\n return getSSOTokenFirstPartyForUser(host, upn, authType)\r\n}\r\n\r\nexport function getSSOTokenFirstPartyForUser(host: IHostIntegration, upn: string, authType: AuthType): Promise {\r\n if (isMsa(authType)) {\r\n return getSSOTokenFirstPartyMsa(host, upn, authType)\r\n } else {\r\n return getSSOTokenFirstPartyOrgId(host, upn)\r\n }\r\n}\r\n\r\ndeclare var OfficeFirstPartyAuth: {\r\n getAccessToken(tokenParams: ITokenParameters, behavior: IBehaviorOptions): Promise;\r\n load(replyUrl?: string): Promise;\r\n debugging: boolean;\r\n authFlow: string;\r\n}\r\n\r\n/* For ONO SSO, we need to determine the userType for scope and currently only way is to\r\n call getAuthContextAsync API in OfficeJs which was added for OfficeFirstPartyAuth and not intended\r\n to be called by add-ins. Adding the type here as we do not have the types defined in Office */\r\n/* tslint:disable */\r\ndeclare module Office {\r\n interface Context {\r\n webAuth: WebAuth\r\n }\r\n interface WebAuth {\r\n authContext: AuthContext\r\n getAuthContextAsync: (callback: (context: Office.AuthContext) => void) => void\r\n }\r\n interface AuthContext {\r\n value: Value\r\n status: string\r\n }\r\n interface Value {\r\n authorityType: string\r\n }\r\n var context: Context\r\n}\r\n/* tslint:enable */\r\nexport function getUserAuthType(): Promise {\r\n return new Promise((resolve: (value: string) => void, reject: (value: string) => void) => {\r\n Office.context.webAuth.getAuthContextAsync((c: Office.AuthContext) => {\r\n if ('succeeded' === c.status) {\r\n return resolve(c.value.authorityType)\r\n }\r\n Log.logger.error('Failed to get the userType for SSO')\r\n return reject('undefined')\r\n })\r\n })\r\n}\r\n\r\nexport async function getAccessTokenSSO(scope: string): Promise {\r\n OfficeFirstPartyAuth.debugging = true\r\n OfficeFirstPartyAuth.authFlow = 'authcode'\r\n try {\r\n await OfficeFirstPartyAuth.load()\r\n } catch (err) {\r\n Log.logger.error(`Failed to load first Party Auth with error : ${getErrorAsString(err)}`)\r\n return undefined\r\n }\r\n const tokenParams = {\r\n resource: scope,\r\n authChallenge: '',\r\n policy: '',\r\n }\r\n const behaviorParam = {\r\n popup: false,\r\n forceRefresh: false,\r\n }\r\n\r\n const token = await OfficeFirstPartyAuth.getAccessToken(tokenParams, behaviorParam)\r\n if (!token) {\r\n Log.logger.info('Failed to acquire Access Token for SSO')\r\n return undefined\r\n }\r\n\r\n return token.accessToken\r\n}\r\n\r\nexport async function getAccessTokenAADSSO(): Promise {\r\n return await getAccessTokenSSO('https://www.onenote.com/')\r\n}\r\n\r\nexport async function getAccessTokenMSASSO(): Promise {\r\n return await getAccessTokenSSO('User.Read')\r\n}\r\n\r\nexport async function getSSOTokenInfoONO(): Promise {\r\n // Default user is assumed to be aad\r\n let userType = 'aad'\r\n try {\r\n userType = await getUserAuthType()\r\n } catch (error) {\r\n Log.logger.error(`Error retrieving userAuthType with error: ${getErrorAsString(error)}.`)\r\n }\r\n let token = undefined\r\n let authType: AuthType = 'o365'\r\n if (userType === 'msa') {\r\n token = await getAccessTokenMSASSO()\r\n authType = 'msa_implicit'\r\n } else {\r\n token = await getAccessTokenAADSSO()\r\n authType = 'o365'\r\n }\r\n\r\n if (!token) {\r\n return undefined\r\n }\r\n\r\n const userInfoGetter = createGetUserInfo(authType)\r\n try {\r\n const userInfo = await userInfoGetter.getUserInfo(token, authType)\r\n return { userInfo, authContext: new OAuthContext(token) }\r\n } catch (error) {\r\n Log.logger.error(`AuthError: Unexpectedly ran into an error trying to get user info: ${getErrorAsString(error)}. Returning undefined `)\r\n return undefined\r\n }\r\n}\r\n","// Used as part of a workaround where Edge windows incorrectly think Office.js is running\r\n// outside of an Office application\r\n// https://office.visualstudio.com/OC/_workitems/edit/2615502\r\nexport const localStorageIsSignedInKey = 'StickyNotesAgaveIsSignedIn'\r\nexport const msaCommonAuthImplicitCredentials = 'MsaCommonAuthImplicitCredentials'\r\nexport const o365CommonAuthAccessToken = 'O365CommonAuthAccessToken'\r\n","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjAssign, ObjClass, ObjCreate, ObjDefineProperty, ObjHasOwnProperty, ObjProto, strDefault, strShimFunction, strShimHasOwnProperty, strShimPrototype } from \"./Constants\";\r\nimport { getGlobal, objCreateFn, throwTypeError } from \"./Helpers\";\r\n// Most of these functions have been directly shamelessly \"lifted\" from the https://github.com/@microsoft/tslib and\r\n// modified to be ES3 compatible and applying several minification and tree-shaking techniques so that Application Insights\r\n// can successfully use TypeScript \"importHelpers\" which imports tslib during compilation but it will use these at runtime\r\n// Which is also why all of the functions have not been included as Application Insights currently doesn't use or require\r\n// them.\r\nexport var SymbolObj = (getGlobal() || {})[\"Symbol\"];\r\nexport var ReflectObj = (getGlobal() || {})[\"Reflect\"];\r\nexport var __hasSymbol = !!SymbolObj;\r\nexport var __hasReflect = !!ReflectObj;\r\nvar strDecorate = \"decorate\";\r\nvar strMetadata = \"metadata\";\r\nvar strGetOwnPropertySymbols = \"getOwnPropertySymbols\";\r\nvar strIterator = \"iterator\";\r\nexport var __objAssignFnImpl = function (t) {\r\n // tslint:disable-next-line: ban-comma-operator\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) {\r\n if (ObjProto[strShimHasOwnProperty].call(s, p)) {\r\n t[p] = s[p];\r\n }\r\n }\r\n }\r\n return t;\r\n};\r\nexport var __assignFn = ObjAssign || __objAssignFnImpl;\r\n// tslint:disable-next-line: only-arrow-functions\r\nvar extendStaticsFn = function (d, b) {\r\n extendStaticsFn = ObjClass[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n ({ __proto__: [] } instanceof Array && function (d, b) {\r\n d.__proto__ = b;\r\n }) ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d, b) {\r\n for (var p in b) {\r\n if (b[strShimHasOwnProperty](p)) {\r\n d[p] = b[p];\r\n }\r\n }\r\n };\r\n return extendStaticsFn(d, b);\r\n};\r\nexport function __extendsFn(d, b) {\r\n if (typeof b !== strShimFunction && b !== null) {\r\n throwTypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n }\r\n extendStaticsFn(d, b);\r\n function __() {\r\n this.constructor = d;\r\n }\r\n // tslint:disable-next-line: ban-comma-operator\r\n d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());\r\n}\r\nexport function __restFn(s, e) {\r\n var t = {};\r\n for (var k in s) {\r\n if (ObjHasOwnProperty.call(s, k) && e.indexOf(k) < 0) {\r\n t[k] = s[k];\r\n }\r\n }\r\n if (s != null && typeof ObjClass[strGetOwnPropertySymbols] === strShimFunction) {\r\n for (var i = 0, p = ObjClass[strGetOwnPropertySymbols](s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && ObjProto[\"propertyIsEnumerable\"].call(s, p[i])) {\r\n t[p[i]] = s[p[i]];\r\n }\r\n }\r\n }\r\n return t;\r\n}\r\nexport function __decorateFn(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = ObjClass[\"getOwnPropertyDescriptor\"](target, key) : desc, d;\r\n if (__hasReflect && typeof ReflectObj[strDecorate] === strShimFunction) {\r\n r = ReflectObj[strDecorate](decorators, target, key, desc);\r\n }\r\n else {\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n // eslint-disable-next-line no-cond-assign\r\n if (d = decorators[i]) {\r\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n }\r\n }\r\n }\r\n // tslint:disable-next-line:ban-comma-operator\r\n return c > 3 && r && ObjDefineProperty(target, key, r), r;\r\n}\r\nexport function __paramFn(paramIndex, decorator) {\r\n return function (target, key) {\r\n decorator(target, key, paramIndex);\r\n };\r\n}\r\nexport function __metadataFn(metadataKey, metadataValue) {\r\n if (__hasReflect && ReflectObj[strMetadata] === strShimFunction) {\r\n return ReflectObj[strMetadata](metadataKey, metadataValue);\r\n }\r\n}\r\nexport function __exportStarFn(m, o) {\r\n for (var p in m) {\r\n if (p !== strDefault && !ObjHasOwnProperty.call(o, p)) {\r\n __createBindingFn(o, m, p);\r\n }\r\n }\r\n}\r\nexport function __createBindingFn(o, m, k, k2) {\r\n if (k2 === undefined) {\r\n k2 = k;\r\n }\r\n if (!!ObjCreate) {\r\n ObjDefineProperty(o, k2, {\r\n enumerable: true,\r\n get: function () {\r\n return m[k];\r\n }\r\n });\r\n }\r\n else {\r\n o[k2] = m[k];\r\n }\r\n}\r\nexport function __valuesFn(o) {\r\n var s = typeof SymbolObj === strShimFunction && SymbolObj[strIterator], m = s && o[s], i = 0;\r\n if (m) {\r\n return m.call(o);\r\n }\r\n if (o && typeof o.length === \"number\") {\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) {\r\n o = void 0;\r\n }\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n }\r\n throwTypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\nexport function __readFn(o, n) {\r\n var m = typeof SymbolObj === strShimFunction && o[SymbolObj[strIterator]];\r\n if (!m) {\r\n return o;\r\n }\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) {\r\n ar.push(r.value);\r\n }\r\n }\r\n catch (error) {\r\n e = {\r\n error: error\r\n };\r\n }\r\n finally {\r\n try {\r\n // tslint:disable-next-line:no-conditional-assignment\r\n if (r && !r.done && (m = i[\"return\"])) {\r\n m.call(i);\r\n }\r\n }\r\n finally {\r\n if (e) {\r\n // eslint-disable-next-line no-unsafe-finally\r\n throw e.error;\r\n }\r\n }\r\n }\r\n return ar;\r\n}\r\n/** @deprecated */\r\nexport function __spreadArraysFn() {\r\n var theArgs = arguments;\r\n // Calculate new total size\r\n for (var s = 0, i = 0, il = theArgs.length; i < il; i++) {\r\n s += theArgs[i].length;\r\n }\r\n // Create new full array\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\r\n for (var a = theArgs[i], j = 0, jl = a.length; j < jl; j++, k++) {\r\n r[k] = a[j];\r\n }\r\n }\r\n return r;\r\n}\r\nexport function __spreadArrayFn(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {\r\n to[j] = from[i];\r\n }\r\n return to;\r\n}\r\nexport function __makeTemplateObjectFn(cooked, raw) {\r\n if (ObjDefineProperty) {\r\n ObjDefineProperty(cooked, \"raw\", { value: raw });\r\n }\r\n else {\r\n cooked.raw = raw;\r\n }\r\n return cooked;\r\n}\r\nexport function __importStarFn(mod) {\r\n if (mod && mod.__esModule) {\r\n return mod;\r\n }\r\n var result = {};\r\n if (mod != null) {\r\n for (var k in mod) {\r\n if (k !== strDefault && Object.prototype.hasOwnProperty.call(mod, k)) {\r\n __createBindingFn(result, mod, k);\r\n }\r\n }\r\n }\r\n // Set default module\r\n if (!!ObjCreate) {\r\n ObjDefineProperty(result, strDefault, { enumerable: true, value: mod });\r\n }\r\n else {\r\n result[strDefault] = mod;\r\n }\r\n return result;\r\n}\r\nexport function __importDefaultFn(mod) {\r\n return (mod && mod.__esModule) ? mod : { strDefault: mod };\r\n}\r\n//# sourceMappingURL=TsLibShims.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjAssign, ObjClass, ObjCreate, ObjDefineProperty, ObjHasOwnProperty, ObjProto, strDefault, strShimFunction, strShimHasOwnProperty, strShimPrototype } from \"./Constants\";\r\nimport { getGlobal, objCreateFn, throwTypeError } from \"./Helpers\";\r\n// Most of these functions have been directly shamelessly \"lifted\" from the https://github.com/@microsoft/tslib and\r\n// modified to be ES3 compatible and applying several minification and tree-shaking techniques so that Application Insights\r\n// can successfully use TypeScript \"importHelpers\" which imports tslib during compilation but it will use these at runtime\r\n// Which is also why all of the functions have not been included as Application Insights currently doesn't use or require\r\n// them.\r\nexport var SymbolObj = (getGlobal() || {})[\"Symbol\"];\r\nexport var ReflectObj = (getGlobal() || {})[\"Reflect\"];\r\nexport var __hasSymbol = !!SymbolObj;\r\nexport var __hasReflect = !!ReflectObj;\r\nvar strDecorate = \"decorate\";\r\nvar strMetadata = \"metadata\";\r\nvar strGetOwnPropertySymbols = \"getOwnPropertySymbols\";\r\nvar strIterator = \"iterator\";\r\nexport var __objAssignFnImpl = function (t) {\r\n // tslint:disable-next-line: ban-comma-operator\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) {\r\n if (ObjProto[strShimHasOwnProperty].call(s, p)) {\r\n t[p] = s[p];\r\n }\r\n }\r\n }\r\n return t;\r\n};\r\nexport var __assignFn = ObjAssign || __objAssignFnImpl;\r\n// tslint:disable-next-line: only-arrow-functions\r\nvar extendStaticsFn = function (d, b) {\r\n extendStaticsFn = ObjClass[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d, b) {\r\n for (var p in b) {\r\n if (b[strShimHasOwnProperty](p)) {\r\n d[p] = b[p];\r\n }\r\n }\r\n };\r\n return extendStaticsFn(d, b);\r\n};\r\nexport function __extendsFn(d, b) {\r\n if (typeof b !== strShimFunction && b !== null) {\r\n throwTypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n }\r\n extendStaticsFn(d, b);\r\n function __() { this.constructor = d; }\r\n // tslint:disable-next-line: ban-comma-operator\r\n d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());\r\n}\r\nexport function __restFn(s, e) {\r\n var t = {};\r\n for (var k in s) {\r\n if (ObjHasOwnProperty.call(s, k) && e.indexOf(k) < 0) {\r\n t[k] = s[k];\r\n }\r\n }\r\n if (s != null && typeof ObjClass[strGetOwnPropertySymbols] === strShimFunction) {\r\n for (var i = 0, p = ObjClass[strGetOwnPropertySymbols](s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && ObjProto[\"propertyIsEnumerable\"].call(s, p[i])) {\r\n t[p[i]] = s[p[i]];\r\n }\r\n }\r\n }\r\n return t;\r\n}\r\nexport function __decorateFn(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = ObjClass[\"getOwnPropertyDescriptor\"](target, key) : desc, d;\r\n if (__hasReflect && typeof ReflectObj[strDecorate] === strShimFunction) {\r\n r = ReflectObj[strDecorate](decorators, target, key, desc);\r\n }\r\n else {\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n // eslint-disable-next-line no-cond-assign\r\n if (d = decorators[i]) {\r\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n }\r\n }\r\n }\r\n // tslint:disable-next-line:ban-comma-operator\r\n return c > 3 && r && ObjDefineProperty(target, key, r), r;\r\n}\r\nexport function __paramFn(paramIndex, decorator) {\r\n return function (target, key) {\r\n decorator(target, key, paramIndex);\r\n };\r\n}\r\nexport function __metadataFn(metadataKey, metadataValue) {\r\n if (__hasReflect && ReflectObj[strMetadata] === strShimFunction) {\r\n return ReflectObj[strMetadata](metadataKey, metadataValue);\r\n }\r\n}\r\nexport function __exportStarFn(m, o) {\r\n for (var p in m) {\r\n if (p !== strDefault && !ObjHasOwnProperty.call(o, p)) {\r\n __createBindingFn(o, m, p);\r\n }\r\n }\r\n}\r\nexport function __createBindingFn(o, m, k, k2) {\r\n if (k2 === undefined) {\r\n k2 = k;\r\n }\r\n if (ObjCreate) {\r\n ObjDefineProperty(o, k2, {\r\n enumerable: true,\r\n get: function () {\r\n return m[k];\r\n }\r\n });\r\n }\r\n else {\r\n o[k2] = m[k];\r\n }\r\n}\r\nexport function __valuesFn(o) {\r\n var s = typeof SymbolObj === strShimFunction && SymbolObj[strIterator], m = s && o[s], i = 0;\r\n if (m) {\r\n return m.call(o);\r\n }\r\n if (o && typeof o.length === \"number\") {\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) {\r\n o = void 0;\r\n }\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n }\r\n throwTypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\nexport function __readFn(o, n) {\r\n var m = typeof SymbolObj === strShimFunction && o[SymbolObj[strIterator]];\r\n if (!m) {\r\n return o;\r\n }\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) {\r\n ar.push(r.value);\r\n }\r\n }\r\n catch (error) {\r\n e = {\r\n error: error\r\n };\r\n }\r\n finally {\r\n try {\r\n // tslint:disable-next-line:no-conditional-assignment\r\n if (r && !r.done && (m = i[\"return\"])) {\r\n m.call(i);\r\n }\r\n }\r\n finally {\r\n if (e) {\r\n // eslint-disable-next-line no-unsafe-finally\r\n throw e.error;\r\n }\r\n }\r\n }\r\n return ar;\r\n}\r\n/** @deprecated */\r\nexport function __spreadArraysFn() {\r\n var theArgs = arguments;\r\n // Calculate new total size\r\n for (var s = 0, i = 0, il = theArgs.length; i < il; i++) {\r\n s += theArgs[i].length;\r\n }\r\n // Create new full array\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\r\n for (var a = theArgs[i], j = 0, jl = a.length; j < jl; j++, k++) {\r\n r[k] = a[j];\r\n }\r\n }\r\n return r;\r\n}\r\nexport function __spreadArrayFn(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {\r\n to[j] = from[i];\r\n }\r\n return to;\r\n}\r\nexport function __makeTemplateObjectFn(cooked, raw) {\r\n if (ObjDefineProperty) {\r\n ObjDefineProperty(cooked, \"raw\", { value: raw });\r\n }\r\n else {\r\n cooked.raw = raw;\r\n }\r\n return cooked;\r\n}\r\nexport function __importStarFn(mod) {\r\n if (mod && mod.__esModule) {\r\n return mod;\r\n }\r\n var result = {};\r\n if (mod != null) {\r\n for (var k in mod) {\r\n if (k !== strDefault && Object.prototype.hasOwnProperty.call(mod, k)) {\r\n __createBindingFn(result, mod, k);\r\n }\r\n }\r\n }\r\n // Set default module\r\n if (ObjCreate) {\r\n ObjDefineProperty(result, strDefault, { enumerable: true, value: mod });\r\n }\r\n else {\r\n result[strDefault] = mod;\r\n }\r\n return result;\r\n}\r\nexport function __importDefaultFn(mod) {\r\n return (mod && mod.__esModule) ? mod : { strDefault: mod };\r\n}\r\n//# sourceMappingURL=TsLibShims.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjAssign, ObjClass, ObjCreate, ObjDefineProperty, ObjHasOwnProperty, ObjProto, strDefault, strShimFunction, strShimHasOwnProperty, strShimPrototype } from \"./Constants\";\r\nimport { getGlobal, objCreateFn, throwTypeError } from \"./Helpers\";\r\n// Most of these functions have been directly shamelessly \"lifted\" from the https://github.com/@microsoft/tslib and\r\n// modified to be ES3 compatible and applying several minification and tree-shaking techniques so that Application Insights\r\n// can successfully use TypeScript \"importHelpers\" which imports tslib during compilation but it will use these at runtime\r\n// Which is also why all of the functions have not been included as Application Insights currently doesn't use or require\r\n// them.\r\nexport var SymbolObj = (getGlobal() || {})[\"Symbol\"];\r\nexport var ReflectObj = (getGlobal() || {})[\"Reflect\"];\r\nexport var __hasSymbol = !!SymbolObj;\r\nexport var __hasReflect = !!ReflectObj;\r\nvar strDecorate = \"decorate\";\r\nvar strMetadata = \"metadata\";\r\nvar strGetOwnPropertySymbols = \"getOwnPropertySymbols\";\r\nvar strIterator = \"iterator\";\r\nexport var __objAssignFnImpl = function (t) {\r\n // tslint:disable-next-line: ban-comma-operator\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) {\r\n if (ObjProto[strShimHasOwnProperty].call(s, p)) {\r\n t[p] = s[p];\r\n }\r\n }\r\n }\r\n return t;\r\n};\r\nexport var __assignFn = ObjAssign || __objAssignFnImpl;\r\n// tslint:disable-next-line: only-arrow-functions\r\nvar extendStaticsFn = function (d, b) {\r\n extendStaticsFn = ObjClass[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d, b) {\r\n for (var p in b) {\r\n if (b[strShimHasOwnProperty](p)) {\r\n d[p] = b[p];\r\n }\r\n }\r\n };\r\n return extendStaticsFn(d, b);\r\n};\r\nexport function __extendsFn(d, b) {\r\n if (typeof b !== strShimFunction && b !== null) {\r\n throwTypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n }\r\n extendStaticsFn(d, b);\r\n function __() { this.constructor = d; }\r\n // tslint:disable-next-line: ban-comma-operator\r\n d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());\r\n}\r\nexport function __restFn(s, e) {\r\n var t = {};\r\n for (var k in s) {\r\n if (ObjHasOwnProperty.call(s, k) && e.indexOf(k) < 0) {\r\n t[k] = s[k];\r\n }\r\n }\r\n if (s != null && typeof ObjClass[strGetOwnPropertySymbols] === strShimFunction) {\r\n for (var i = 0, p = ObjClass[strGetOwnPropertySymbols](s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && ObjProto[\"propertyIsEnumerable\"].call(s, p[i])) {\r\n t[p[i]] = s[p[i]];\r\n }\r\n }\r\n }\r\n return t;\r\n}\r\nexport function __decorateFn(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = ObjClass[\"getOwnPropertyDescriptor\"](target, key) : desc, d;\r\n if (__hasReflect && typeof ReflectObj[strDecorate] === strShimFunction) {\r\n r = ReflectObj[strDecorate](decorators, target, key, desc);\r\n }\r\n else {\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n // eslint-disable-next-line no-cond-assign\r\n if (d = decorators[i]) {\r\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n }\r\n }\r\n }\r\n // tslint:disable-next-line:ban-comma-operator\r\n return c > 3 && r && ObjDefineProperty(target, key, r), r;\r\n}\r\nexport function __paramFn(paramIndex, decorator) {\r\n return function (target, key) {\r\n decorator(target, key, paramIndex);\r\n };\r\n}\r\nexport function __metadataFn(metadataKey, metadataValue) {\r\n if (__hasReflect && ReflectObj[strMetadata] === strShimFunction) {\r\n return ReflectObj[strMetadata](metadataKey, metadataValue);\r\n }\r\n}\r\nexport function __exportStarFn(m, o) {\r\n for (var p in m) {\r\n if (p !== strDefault && !ObjHasOwnProperty.call(o, p)) {\r\n __createBindingFn(o, m, p);\r\n }\r\n }\r\n}\r\nexport function __createBindingFn(o, m, k, k2) {\r\n if (k2 === undefined) {\r\n k2 = k;\r\n }\r\n if (ObjCreate) {\r\n ObjDefineProperty(o, k2, {\r\n enumerable: true,\r\n get: function () {\r\n return m[k];\r\n }\r\n });\r\n }\r\n else {\r\n o[k2] = m[k];\r\n }\r\n}\r\nexport function __valuesFn(o) {\r\n var s = typeof SymbolObj === strShimFunction && SymbolObj[strIterator], m = s && o[s], i = 0;\r\n if (m) {\r\n return m.call(o);\r\n }\r\n if (o && typeof o.length === \"number\") {\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) {\r\n o = void 0;\r\n }\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n }\r\n throwTypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\nexport function __readFn(o, n) {\r\n var m = typeof SymbolObj === strShimFunction && o[SymbolObj[strIterator]];\r\n if (!m) {\r\n return o;\r\n }\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) {\r\n ar.push(r.value);\r\n }\r\n }\r\n catch (error) {\r\n e = {\r\n error: error\r\n };\r\n }\r\n finally {\r\n try {\r\n // tslint:disable-next-line:no-conditional-assignment\r\n if (r && !r.done && (m = i[\"return\"])) {\r\n m.call(i);\r\n }\r\n }\r\n finally {\r\n if (e) {\r\n // eslint-disable-next-line no-unsafe-finally\r\n throw e.error;\r\n }\r\n }\r\n }\r\n return ar;\r\n}\r\n/** @deprecated */\r\nexport function __spreadArraysFn() {\r\n var theArgs = arguments;\r\n // Calculate new total size\r\n for (var s = 0, i = 0, il = theArgs.length; i < il; i++) {\r\n s += theArgs[i].length;\r\n }\r\n // Create new full array\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\r\n for (var a = theArgs[i], j = 0, jl = a.length; j < jl; j++, k++) {\r\n r[k] = a[j];\r\n }\r\n }\r\n return r;\r\n}\r\nexport function __spreadArrayFn(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {\r\n to[j] = from[i];\r\n }\r\n return to;\r\n}\r\nexport function __makeTemplateObjectFn(cooked, raw) {\r\n if (ObjDefineProperty) {\r\n ObjDefineProperty(cooked, \"raw\", { value: raw });\r\n }\r\n else {\r\n cooked.raw = raw;\r\n }\r\n return cooked;\r\n}\r\nexport function __importStarFn(mod) {\r\n if (mod && mod.__esModule) {\r\n return mod;\r\n }\r\n var result = {};\r\n if (mod != null) {\r\n for (var k in mod) {\r\n if (k !== strDefault && Object.prototype.hasOwnProperty.call(mod, k)) {\r\n __createBindingFn(result, mod, k);\r\n }\r\n }\r\n }\r\n // Set default module\r\n if (ObjCreate) {\r\n ObjDefineProperty(result, strDefault, { enumerable: true, value: mod });\r\n }\r\n else {\r\n result[strDefault] = mod;\r\n }\r\n return result;\r\n}\r\nexport function __importDefaultFn(mod) {\r\n return (mod && mod.__esModule) ? mod : { strDefault: mod };\r\n}\r\n//# sourceMappingURL=TsLibShims.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { ObjAssign, ObjClass, ObjCreate, ObjDefineProperty, ObjHasOwnProperty, ObjProto, strDefault, strShimFunction, strShimHasOwnProperty, strShimPrototype } from \"./Constants\";\r\nimport { getGlobal, objCreateFn, throwTypeError } from \"./Helpers\";\r\n// Most of these functions have been directly shamelessly \"lifted\" from the https://github.com/@microsoft/tslib and\r\n// modified to be ES3 compatible and applying several minification and tree-shaking techniques so that Application Insights\r\n// can successfully use TypeScript \"importHelpers\" which imports tslib during compilation but it will use these at runtime\r\n// Which is also why all of the functions have not been included as Application Insights currently doesn't use or require\r\n// them.\r\nexport var SymbolObj = (getGlobal() || {})[\"Symbol\"];\r\nexport var ReflectObj = (getGlobal() || {})[\"Reflect\"];\r\nexport var __hasSymbol = !!SymbolObj;\r\nexport var __hasReflect = !!ReflectObj;\r\nvar strDecorate = \"decorate\";\r\nvar strMetadata = \"metadata\";\r\nvar strGetOwnPropertySymbols = \"getOwnPropertySymbols\";\r\nvar strIterator = \"iterator\";\r\nexport var __objAssignFnImpl = function (t) {\r\n // tslint:disable-next-line: ban-comma-operator\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) {\r\n if (ObjProto[strShimHasOwnProperty].call(s, p)) {\r\n t[p] = s[p];\r\n }\r\n }\r\n }\r\n return t;\r\n};\r\nexport var __assignFn = ObjAssign || __objAssignFnImpl;\r\n// tslint:disable-next-line: only-arrow-functions\r\nvar extendStaticsFn = function (d, b) {\r\n extendStaticsFn = ObjClass[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d, b) {\r\n for (var p in b) {\r\n if (b[strShimHasOwnProperty](p)) {\r\n d[p] = b[p];\r\n }\r\n }\r\n };\r\n return extendStaticsFn(d, b);\r\n};\r\nexport function __extendsFn(d, b) {\r\n if (typeof b !== strShimFunction && b !== null) {\r\n throwTypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n }\r\n extendStaticsFn(d, b);\r\n function __() { this.constructor = d; }\r\n // tslint:disable-next-line: ban-comma-operator\r\n d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());\r\n}\r\nexport function __restFn(s, e) {\r\n var t = {};\r\n for (var k in s) {\r\n if (ObjHasOwnProperty.call(s, k) && e.indexOf(k) < 0) {\r\n t[k] = s[k];\r\n }\r\n }\r\n if (s != null && typeof ObjClass[strGetOwnPropertySymbols] === strShimFunction) {\r\n for (var i = 0, p = ObjClass[strGetOwnPropertySymbols](s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && ObjProto[\"propertyIsEnumerable\"].call(s, p[i])) {\r\n t[p[i]] = s[p[i]];\r\n }\r\n }\r\n }\r\n return t;\r\n}\r\nexport function __decorateFn(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = ObjClass[\"getOwnPropertyDescriptor\"](target, key) : desc, d;\r\n if (__hasReflect && typeof ReflectObj[strDecorate] === strShimFunction) {\r\n r = ReflectObj[strDecorate](decorators, target, key, desc);\r\n }\r\n else {\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n // eslint-disable-next-line no-cond-assign\r\n if (d = decorators[i]) {\r\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n }\r\n }\r\n }\r\n // tslint:disable-next-line:ban-comma-operator\r\n return c > 3 && r && ObjDefineProperty(target, key, r), r;\r\n}\r\nexport function __paramFn(paramIndex, decorator) {\r\n return function (target, key) {\r\n decorator(target, key, paramIndex);\r\n };\r\n}\r\nexport function __metadataFn(metadataKey, metadataValue) {\r\n if (__hasReflect && ReflectObj[strMetadata] === strShimFunction) {\r\n return ReflectObj[strMetadata](metadataKey, metadataValue);\r\n }\r\n}\r\nexport function __exportStarFn(m, o) {\r\n for (var p in m) {\r\n if (p !== strDefault && !ObjHasOwnProperty.call(o, p)) {\r\n __createBindingFn(o, m, p);\r\n }\r\n }\r\n}\r\nexport function __createBindingFn(o, m, k, k2) {\r\n if (k2 === undefined) {\r\n k2 = k;\r\n }\r\n if (ObjCreate) {\r\n ObjDefineProperty(o, k2, {\r\n enumerable: true,\r\n get: function () {\r\n return m[k];\r\n }\r\n });\r\n }\r\n else {\r\n o[k2] = m[k];\r\n }\r\n}\r\nexport function __valuesFn(o) {\r\n var s = typeof SymbolObj === strShimFunction && SymbolObj[strIterator], m = s && o[s], i = 0;\r\n if (m) {\r\n return m.call(o);\r\n }\r\n if (o && typeof o.length === \"number\") {\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) {\r\n o = void 0;\r\n }\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n }\r\n throwTypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\nexport function __readFn(o, n) {\r\n var m = typeof SymbolObj === strShimFunction && o[SymbolObj[strIterator]];\r\n if (!m) {\r\n return o;\r\n }\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) {\r\n ar.push(r.value);\r\n }\r\n }\r\n catch (error) {\r\n e = {\r\n error: error\r\n };\r\n }\r\n finally {\r\n try {\r\n // tslint:disable-next-line:no-conditional-assignment\r\n if (r && !r.done && (m = i[\"return\"])) {\r\n m.call(i);\r\n }\r\n }\r\n finally {\r\n if (e) {\r\n // eslint-disable-next-line no-unsafe-finally\r\n throw e.error;\r\n }\r\n }\r\n }\r\n return ar;\r\n}\r\n/** @deprecated */\r\nexport function __spreadArraysFn() {\r\n var theArgs = arguments;\r\n // Calculate new total size\r\n for (var s = 0, i = 0, il = theArgs.length; i < il; i++) {\r\n s += theArgs[i].length;\r\n }\r\n // Create new full array\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\r\n for (var a = theArgs[i], j = 0, jl = a.length; j < jl; j++, k++) {\r\n r[k] = a[j];\r\n }\r\n }\r\n return r;\r\n}\r\nexport function __spreadArrayFn(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {\r\n to[j] = from[i];\r\n }\r\n return to;\r\n}\r\nexport function __makeTemplateObjectFn(cooked, raw) {\r\n if (ObjDefineProperty) {\r\n ObjDefineProperty(cooked, \"raw\", { value: raw });\r\n }\r\n else {\r\n cooked.raw = raw;\r\n }\r\n return cooked;\r\n}\r\nexport function __importStarFn(mod) {\r\n if (mod && mod.__esModule) {\r\n return mod;\r\n }\r\n var result = {};\r\n if (mod != null) {\r\n for (var k in mod) {\r\n if (k !== strDefault && Object.prototype.hasOwnProperty.call(mod, k)) {\r\n __createBindingFn(result, mod, k);\r\n }\r\n }\r\n }\r\n // Set default module\r\n if (ObjCreate) {\r\n ObjDefineProperty(result, strDefault, { enumerable: true, value: mod });\r\n }\r\n else {\r\n result[strDefault] = mod;\r\n }\r\n return result;\r\n}\r\nexport function __importDefaultFn(mod) {\r\n return (mod && mod.__esModule) ? mod : { strDefault: mod };\r\n}\r\n//# sourceMappingURL=TsLibShims.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { ObjAssign, ObjClass, ObjDefineProperty, ObjHasOwnProperty, ObjProto, strShimFunction, strShimObject, strShimPrototype, strShimUndefined, throwTypeError } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_APPLY, _DYN_CALL, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_REPLACE } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly\r\n// Added to help with minfication\r\nvar strToISOString = \"toISOString\";\r\nvar cStrEndsWith = \"endsWith\";\r\nvar cStrStartsWith = \"startsWith\";\r\nvar strIndexOf = \"indexOf\";\r\nvar strMap = \"map\";\r\nvar strReduce = \"reduce\";\r\nvar cStrTrim = \"trim\";\r\nvar strToString = \"toString\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strConstructor = \"constructor\";\r\nvar _objDefineProperty = ObjDefineProperty;\r\nvar _objFreeze = ObjClass.freeze;\r\nvar _objSeal = ObjClass.seal;\r\nvar _objKeys = ObjClass.keys;\r\nvar StringProto = String[strShimPrototype];\r\nvar _strTrim = StringProto[cStrTrim];\r\nvar _strEndsWith = StringProto[cStrEndsWith];\r\nvar _strStartsWith = StringProto[cStrStartsWith];\r\nvar DateProto = Date[strShimPrototype];\r\nvar _dataToISOString = DateProto[strToISOString];\r\nvar _isArray = Array.isArray;\r\nvar _objToString = ObjProto[strToString];\r\nvar _fnToString = ObjHasOwnProperty[strToString];\r\n// Cache what this browser reports as the object function constructor (as a string)\r\nvar _objFunctionString = _fnToString[_DYN_CALL /* @min:%2ecall */](ObjClass);\r\nvar rCamelCase = /-([a-z])/g;\r\nvar rNormalizeInvalid = /([^\\w\\d_$])/g;\r\nvar rLeadingNumeric = /^(\\d+[\\w\\d_$])/;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Object[\"getPrototypeOf\"];\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nexport function _getObjProto(target) {\r\n if (target) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n // target[Constructor] May break if the constructor has been changed or removed\r\n var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];\r\n if (newProto) {\r\n return newProto;\r\n }\r\n }\r\n return null;\r\n}\r\nexport function objToString(obj) {\r\n return _objToString[_DYN_CALL /* @min:%2ecall */](obj);\r\n}\r\nexport function isTypeof(value, theType) {\r\n return typeof value === theType;\r\n}\r\nexport function isUndefined(value) {\r\n return value === undefined || typeof value === strShimUndefined;\r\n}\r\nexport function isNotUndefined(value) {\r\n return !isUndefined(value);\r\n}\r\nexport function isNullOrUndefined(value) {\r\n return (value === null || isUndefined(value));\r\n}\r\nexport function isNotNullOrUndefined(value) {\r\n return !isNullOrUndefined(value);\r\n}\r\nexport function hasOwnProperty(obj, prop) {\r\n return !!(obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, prop));\r\n}\r\nexport function isObject(value) {\r\n // Changing to inline for performance\r\n return !!(value && typeof value === strShimObject);\r\n}\r\nexport function isFunction(value) {\r\n // Changing to inline for performance\r\n return !!(value && typeof value === strShimFunction);\r\n}\r\nexport function isPromiseLike(value) {\r\n return value && isFunction(value.then);\r\n}\r\n/**\r\n * Validates that the string name conforms to the JS IdentifierName specification and if not\r\n * normalizes the name so that it would. This method does not identify or change any keywords\r\n * meaning that if you pass in a known keyword the same value will be returned.\r\n * This is a simplified version\r\n * @param name The name to validate\r\n */\r\nexport function normalizeJsName(name) {\r\n var value = name;\r\n if (value && isString(value)) {\r\n // CamelCase everything after the \"-\" and remove the dash\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rCamelCase, function (_all, letter) {\r\n return letter.toUpperCase();\r\n });\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rNormalizeInvalid, \"_\");\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rLeadingNumeric, function (_all, match) {\r\n return \"_\" + match;\r\n });\r\n }\r\n return value;\r\n}\r\n/**\r\n * This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a\r\n * performance optimization to avoid the creation of a new array for large objects\r\n * @param target The target object to find and process the keys\r\n * @param callbackfn The function to call with the details\r\n */\r\nexport function objForEachKey(target, callbackfn) {\r\n if (target) {\r\n for (var prop in target) {\r\n if (ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](target, prop)) {\r\n callbackfn[_DYN_CALL /* @min:%2ecall */](target, prop, target[prop]);\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function strEndsWith(value, search) {\r\n var result = false;\r\n if (value && search && !(result = value === search)) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);\r\n }\r\n return result;\r\n}\r\n/**\r\n * The _strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function _strEndsWithPoly(value, search) {\r\n var result = false;\r\n var searchLen = search ? search[_DYN_LENGTH /* @min:%2elength */] : 0;\r\n var valLen = value ? value[_DYN_LENGTH /* @min:%2elength */] : 0;\r\n if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {\r\n var pos = valLen - 1;\r\n for (var lp = searchLen - 1; lp >= 0; lp--) {\r\n if (value[pos] != search[lp]) {\r\n return false;\r\n }\r\n pos--;\r\n }\r\n result = true;\r\n }\r\n return result;\r\n}\r\n/**\r\n * The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param checkValue - The characters to be searched for at the start of the value.\r\n * @returns true if the given search value is found at the start of the string, otherwise false.\r\n */\r\nexport function strStartsWith(value, checkValue) {\r\n var result = false;\r\n if (value && checkValue && !(result = value === checkValue)) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);\r\n }\r\n return result;\r\n}\r\n/**\r\n * The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param checkValue - The characters to be searched for at the start of the value.\r\n * @returns true if the given search value is found at the start of the string, otherwise false.\r\n */\r\nexport function _strStartsWithPoly(value, checkValue) {\r\n // Using helper for performance and because string startsWith() is not available on IE\r\n var result = false;\r\n var chkLen = checkValue ? checkValue[_DYN_LENGTH /* @min:%2elength */] : 0;\r\n if (value && chkLen && value[_DYN_LENGTH /* @min:%2elength */] >= chkLen && !(result = value === checkValue)) {\r\n for (var lp = 0; lp < chkLen; lp++) {\r\n if (value[lp] !== checkValue[lp]) {\r\n return false;\r\n }\r\n }\r\n result = true;\r\n }\r\n return result;\r\n}\r\n/**\r\n * A simple wrapper (for minification support) to check if the value contains the search string.\r\n * @param value - The string value to check for the existence of the search value\r\n * @param search - The value search within the value\r\n */\r\nexport function strContains(value, search) {\r\n if (value && search) {\r\n return value[_DYN_INDEX_OF /* @min:%2eindexOf */](search) !== -1;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Check if an object is of type Date\r\n */\r\nexport function isDate(obj) {\r\n return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === \"[object Date]\");\r\n}\r\n/**\r\n * Check if an object is of type Array with optional generic T, the generic type is not validated\r\n * and exists to help with TypeScript validation only.\r\n */\r\nexport var isArray = _isArray || _isArrayPoly;\r\nfunction _isArrayPoly(obj) {\r\n return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === \"[object Array]\");\r\n}\r\n/**\r\n * Check if an object is of type Error\r\n */\r\nexport function isError(obj) {\r\n return !!(obj && _objToString[_DYN_CALL /* @min:%2ecall */](obj) === \"[object Error]\");\r\n}\r\n/**\r\n * Checks if the type of value is a string.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a string, false otherwise.\r\n */\r\nexport function isString(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"string\";\r\n}\r\n/**\r\n * Checks if the type of value is a number.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a number, false otherwise.\r\n */\r\nexport function isNumber(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"number\";\r\n}\r\n/**\r\n * Checks if the type of value is a boolean.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a boolean, false otherwise.\r\n */\r\nexport function isBoolean(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"boolean\";\r\n}\r\n/**\r\n * Checks if the type of value is a Symbol.\r\n * This only returns a boolean as returning value is Symbol will cause issues for older TypeScript consumers\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a Symbol, false otherwise.\r\n */\r\nexport function isSymbol(value) {\r\n return typeof value === \"symbol\";\r\n}\r\n/**\r\n * Checks if the type of the value is a normal plain object (not a null or data)\r\n * @param value\r\n */\r\nexport function isPlainObject(value) {\r\n var result = false;\r\n if (value && typeof value === \"object\") {\r\n // Inlining _objGetPrototypeOf for performance to avoid an additional function call\r\n var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);\r\n if (!proto) {\r\n // No prototype found so this is a plain Object eg. 'Object.create(null)'\r\n result = true;\r\n }\r\n else {\r\n // Objects that have a prototype are plain only if they were created using the Object global (native) function\r\n if (proto[strConstructor] && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](proto, strConstructor)) {\r\n proto = proto[strConstructor];\r\n }\r\n result = typeof proto === strShimFunction && _fnToString[_DYN_CALL /* @min:%2ecall */](proto) === _objFunctionString;\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\nexport function toISOString(date) {\r\n if (date) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);\r\n }\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\nexport function _toISOStringPoly(date) {\r\n if (date && date.getUTCFullYear) {\r\n var pad = function (num) {\r\n var r = String(num);\r\n if (r[_DYN_LENGTH /* @min:%2elength */] === 1) {\r\n r = \"0\" + r;\r\n }\r\n return r;\r\n };\r\n return date.getUTCFullYear()\r\n + \"-\" + pad(date.getUTCMonth() + 1)\r\n + \"-\" + pad(date.getUTCDate())\r\n + \"T\" + pad(date.getUTCHours())\r\n + \":\" + pad(date.getUTCMinutes())\r\n + \":\" + pad(date.getUTCSeconds())\r\n + \".\" + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)\r\n + \"Z\";\r\n }\r\n}\r\n/**\r\n * Performs the specified action for each element in an array. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype\r\n * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would\r\n * cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop\r\n * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\nexport function arrForEach(arr, callbackfn, thisArg) {\r\n var len = arr[_DYN_LENGTH /* @min:%2elength */];\r\n try {\r\n for (var idx = 0; idx < len; idx++) {\r\n if (idx in arr) {\r\n if (callbackfn[_DYN_CALL /* @min:%2ecall */](thisArg || arr, arr[idx], idx, arr) === -1) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype\r\n * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would\r\n * cause a testing requirement to test with and without the implementations\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\nexport function arrIndexOf(arr, searchElement, fromIndex) {\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strIndexOf]) {\r\n return arr[strIndexOf](searchElement, fromIndex);\r\n }\r\n var len = arr[_DYN_LENGTH /* @min:%2elength */];\r\n var from = fromIndex || 0;\r\n try {\r\n for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {\r\n if (lp in arr && arr[lp] === searchElement) {\r\n return lp;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n }\r\n return -1;\r\n}\r\n/**\r\n * Calls a defined callback function on each element of an array, and returns an array that contains the results. This helper exists\r\n * to avoid adding a polyfil for older browsers that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page\r\n * checks for presence/absence of the prototype implementation. Note: For consistency this will not use the Array.prototype.xxxx\r\n * implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\nexport function arrMap(arr, callbackfn, thisArg) {\r\n var results;\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strMap]) {\r\n return arr[strMap](callbackfn, thisArg);\r\n }\r\n var len = arr[_DYN_LENGTH /* @min:%2elength */];\r\n var _this = thisArg || arr;\r\n results = new Array(len);\r\n try {\r\n for (var lp = 0; lp < len; lp++) {\r\n if (lp in arr) {\r\n results[lp] = callbackfn[_DYN_CALL /* @min:%2ecall */](_this, arr[lp], arr);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n }\r\n return results;\r\n}\r\n/**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is\r\n * provided as an argument in the next call to the callback function. This helper exists to avoid adding a polyfil for older browsers that do not define\r\n * Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype implementation. Note: For consistency\r\n * this will not use the Array.prototype.xxxx implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\nexport function arrReduce(arr, callbackfn, initialValue) {\r\n var value;\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strReduce]) {\r\n return arr[strReduce](callbackfn, initialValue);\r\n }\r\n var len = arr[_DYN_LENGTH /* @min:%2elength */];\r\n var lp = 0;\r\n // Specifically checking the number of passed arguments as the value could be anything\r\n if (arguments[_DYN_LENGTH /* @min:%2elength */] >= 3) {\r\n value = arguments[2];\r\n }\r\n else {\r\n while (lp < len && !(lp in arr)) {\r\n lp++;\r\n }\r\n value = arr[lp++];\r\n }\r\n while (lp < len) {\r\n if (lp in arr) {\r\n value = callbackfn(value, arr[lp], lp, arr);\r\n }\r\n lp++;\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * helper method to trim strings (IE8 does not implement String.prototype.trim)\r\n */\r\nexport function strTrim(str) {\r\n if (str) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE /* @min:%2ereplace */] ? str[_DYN_REPLACE /* @min:%2ereplace */](/^\\s+|(?=\\s)\\s+$/g, STR_EMPTY) : str);\r\n }\r\n return str;\r\n}\r\nvar _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable(\"toString\");\r\nvar _objKeysDontEnums = [\r\n \"toString\",\r\n \"toLocaleString\",\r\n \"valueOf\",\r\n \"hasOwnProperty\",\r\n \"isPrototypeOf\",\r\n \"propertyIsEnumerable\",\r\n \"constructor\"\r\n];\r\n/**\r\n * Returns the names of the enumerable string properties and methods of an object. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Object.keys eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.keys implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param obj Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\r\n */\r\nexport function objKeys(obj) {\r\n var objType = typeof obj;\r\n if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {\r\n throwTypeError(\"objKeys called on non-object\");\r\n }\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (!_objKeysHasDontEnumBug && _objKeys) {\r\n return _objKeys(obj);\r\n }\r\n var result = [];\r\n for (var prop in obj) {\r\n if (obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, prop)) {\r\n result[_DYN_PUSH /* @min:%2epush */](prop);\r\n }\r\n }\r\n if (_objKeysHasDontEnumBug) {\r\n var dontEnumsLength = _objKeysDontEnums[_DYN_LENGTH /* @min:%2elength */];\r\n for (var lp = 0; lp < dontEnumsLength; lp++) {\r\n if (obj && ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](obj, _objKeysDontEnums[lp])) {\r\n result[_DYN_PUSH /* @min:%2epush */](_objKeysDontEnums[lp]);\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Try to define get/set object property accessors for the target object/prototype, this will provide compatibility with\r\n * existing API definition when run within an ES5+ container that supports accessors but still enable the code to be loaded\r\n * and executed in an ES3 container, providing basic IE8 compatibility.\r\n * @param target The object on which to define the property.\r\n * @param prop The name of the property to be defined or modified.\r\n * @param getProp The getter function to wire against the getter.\r\n * @param setProp The setter function to wire against the setter.\r\n * @returns True if it was able to create the accessors otherwise false\r\n */\r\nexport function objDefineAccessors(target, prop, getProp, setProp) {\r\n if (_objDefineProperty) {\r\n try {\r\n var descriptor = {\r\n enumerable: true,\r\n configurable: true\r\n };\r\n if (getProp) {\r\n descriptor.get = getProp;\r\n }\r\n if (setProp) {\r\n descriptor.set = setProp;\r\n }\r\n _objDefineProperty(target, prop, descriptor);\r\n return true;\r\n }\r\n catch (e) {\r\n // IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw\r\n // We will just ignore this here.\r\n }\r\n }\r\n return false;\r\n}\r\nfunction _doNothing(value) {\r\n return value;\r\n}\r\nexport function deepFreeze(obj) {\r\n if (_objFreeze) {\r\n objForEachKey(obj, function (name, value) {\r\n if (isArray(value) || isObject(value)) {\r\n _objFreeze(value);\r\n }\r\n });\r\n }\r\n return objFreeze(obj);\r\n}\r\nexport var objFreeze = _objFreeze || _doNothing;\r\nexport var objSeal = _objSeal || _doNothing;\r\n/**\r\n * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)\r\n * https://caniuse.com/#search=Date.now\r\n */\r\nexport function dateNow() {\r\n var dt = Date;\r\n return dt.now ? dt.now() : new dt().getTime();\r\n}\r\n/**\r\n * Returns the name of object if it's an Error. Otherwise, returns empty string.\r\n */\r\nexport function getExceptionName(object) {\r\n if (isError(object)) {\r\n return object[_DYN_NAME /* @min:%2ename */];\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk\r\n * function will only be called if the new value is no equal to the original value.\r\n * @param target - The target object\r\n * @param field - The key of the target\r\n * @param value - The value to set\r\n * @param valChk - [Optional] Callback to check the value that if supplied will be called check if the new value can be set\r\n * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)\r\n * @returns The existing or new value, depending what was set\r\n */\r\nexport function setValue(target, field, value, valChk, srcChk) {\r\n var theValue = value;\r\n if (target) {\r\n theValue = target[field];\r\n if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {\r\n theValue = value;\r\n target[field] = theValue;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it\r\n * @param target - The target object to return or set the default value\r\n * @param field - The key for the field to set on the target\r\n * @param defValue - [Optional] The value to set if not already present, when not provided a empty object will be added\r\n */\r\nexport function getSetValue(target, field, defValue) {\r\n var theValue;\r\n if (target) {\r\n theValue = target[field];\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n // Supports having the default as null\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n target[field] = theValue;\r\n }\r\n }\r\n else {\r\n // Expanded for performance so we only check defValue if required\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Get the mapped config value, if null or undefined any supplied defaultValue will be returned.\r\n * @param field - The name of the field as the named enum value (number) or the string name.\r\n * @param defaultValue - The default value to return if the config field is not present, null or undefined.\r\n */\r\nexport function getCfgValue(theValue, defaultValue) {\r\n return !isNullOrUndefined(theValue) ? theValue : defaultValue;\r\n}\r\nexport function isNotTruthy(value) {\r\n return !value;\r\n}\r\nexport function isTruthy(value) {\r\n return !!value;\r\n}\r\nexport function throwError(message) {\r\n throw new Error(message);\r\n}\r\nfunction _createProxyFunction(source, funcName) {\r\n var srcFunc = null;\r\n var src = null;\r\n if (isFunction(source)) {\r\n srcFunc = source;\r\n }\r\n else {\r\n src = source;\r\n }\r\n return function () {\r\n // Capture the original arguments passed to the method\r\n var originalArguments = arguments;\r\n if (srcFunc) {\r\n src = srcFunc();\r\n }\r\n if (src) {\r\n return src[funcName][_DYN_APPLY /* @min:%2eapply */](src, originalArguments);\r\n }\r\n };\r\n}\r\n/**\r\n * Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from\r\n * the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential\r\n * implementation issues by assigning prototype functions as instance ones\r\n *\r\n * This method is the primary method used to \"update\" the snippet proxy with the ultimate implementations.\r\n *\r\n * Special ES3 Notes:\r\n * Updates (setting) of direct property values on the target or indirectly on the source object WILL NOT WORK PROPERLY, updates to the\r\n * properties of \"referenced\" object will work (target.context.newValue = 10 => will be reflected in the source.context as it's the\r\n * same object). ES3 Failures: assigning target.myProp = 3 -> Won't change source.myProp = 3, likewise the reverse would also fail.\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param chkSet - An optional callback to determine whether a specific property/function should be proxied\r\n */\r\nexport function proxyAssign(target, source, chkSet) {\r\n if (target && source && isObject(target) && isObject(source)) {\r\n var _loop_1 = function (field) {\r\n if (isString(field)) {\r\n var value = source[field];\r\n if (isFunction(value)) {\r\n if (!chkSet || chkSet(field, true, source, target)) {\r\n // Create a proxy function rather than just copying the (possible) prototype to the new object as an instance function\r\n target[field] = _createProxyFunction(source, field);\r\n }\r\n }\r\n else if (!chkSet || chkSet(field, false, source, target)) {\r\n if (hasOwnProperty(target, field)) {\r\n // Remove any previous instance property\r\n delete target[field];\r\n }\r\n if (!objDefineAccessors(target, field, function () {\r\n return source[field];\r\n }, function (theValue) {\r\n source[field] = theValue;\r\n })) {\r\n // Unable to create an accessor, so just assign the values as a fallback\r\n // -- this will (mostly) work for objects\r\n // -- but will fail for accessing primitives (if the source changes it) and all types of \"setters\" as the source won't be modified\r\n target[field] = value;\r\n }\r\n }\r\n }\r\n };\r\n // effectively apply/proxy full source to the target instance\r\n for (var field in source) {\r\n _loop_1(field);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param name - The function name that will be added on the target\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param theFunc - The function name on the source that will be proxied on the target\r\n * @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {\r\n if (target && name && source) {\r\n if (overwriteTarget !== false || isUndefined(target[name])) {\r\n target[name] = _createProxyFunction(source, theFunc);\r\n }\r\n }\r\n}\r\n/**\r\n * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param functionsToProxy - An array of function names that will be proxied on the target\r\n * @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {\r\n if (target && source && isObject(target) && isArray(functionsToProxy)) {\r\n arrForEach(functionsToProxy, function (theFuncName) {\r\n if (isString(theFuncName)) {\r\n proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);\r\n }\r\n });\r\n }\r\n return target;\r\n}\r\n/**\r\n * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.\r\n * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance\r\n * @param defaults Simple helper\r\n */\r\nexport function createClassFromInterface(defaults) {\r\n return /** @class */ (function () {\r\n function class_1() {\r\n var _this_1 = this;\r\n if (defaults) {\r\n objForEachKey(defaults, function (field, value) {\r\n _this_1[field] = value;\r\n });\r\n }\r\n }\r\n return class_1;\r\n }());\r\n}\r\n/**\r\n * A helper function to assist with JIT performance for objects that have properties added / removed dynamically\r\n * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this\r\n * function after you have finished \"updating\" the object, calling this within loops reduces or defeats the benefits.\r\n * This helps when iterating using for..in, objKeys() and objForEach()\r\n * @param theObject - The object to be optimized if possible\r\n */\r\nexport function optimizeObject(theObject) {\r\n // V8 Optimization to cause the JIT compiler to create a new optimized object for looking up the own properties\r\n // primarily for object with <= 19 properties for >= 20 the effect is reduced or non-existent\r\n if (theObject && ObjAssign) {\r\n theObject = ObjClass(ObjAssign({}, theObject));\r\n }\r\n return theObject;\r\n}\r\nexport function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {\r\n // Variables\r\n var theArgs = arguments;\r\n var extended = theArgs[0] || {};\r\n var argLen = theArgs[_DYN_LENGTH /* @min:%2elength */];\r\n var deep = false;\r\n var idx = 1;\r\n // Check for \"Deep\" flag\r\n if (argLen > 0 && isBoolean(extended)) {\r\n deep = extended;\r\n extended = theArgs[idx] || {};\r\n idx++;\r\n }\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if (!isObject(extended)) {\r\n extended = {};\r\n }\r\n // Loop through each remaining object and conduct a merge\r\n for (; idx < argLen; idx++) {\r\n var arg = theArgs[idx];\r\n var isArgArray = isArray(arg);\r\n var isArgObj = isObject(arg);\r\n for (var prop in arg) {\r\n var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty[_DYN_CALL /* @min:%2ecall */](arg, prop)));\r\n if (!propOk) {\r\n continue;\r\n }\r\n var newValue = arg[prop];\r\n var isNewArray = void 0;\r\n // If deep merge and property is an object, merge properties\r\n if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {\r\n // Grab the current value of the extended object\r\n var clone = extended[prop];\r\n if (isNewArray) {\r\n if (!isArray(clone)) {\r\n // We can't \"merge\" an array with a non-array so overwrite the original\r\n clone = [];\r\n }\r\n }\r\n else if (!isPlainObject(clone)) {\r\n // We can't \"merge\" an object with a non-object\r\n clone = {};\r\n }\r\n // Never move the original objects always clone them\r\n newValue = objExtend(deep, clone, newValue);\r\n }\r\n // Assign the new (or previous) value (unless undefined)\r\n if (newValue !== undefined) {\r\n extended[prop] = newValue;\r\n }\r\n }\r\n }\r\n return extended;\r\n}\r\n//# sourceMappingURL=HelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_CHANNELS = \"channels\";\r\nexport var STR_CORE = \"core\";\r\nexport var STR_CREATE_PERF_MGR = \"createPerfMgr\";\r\nexport var STR_DISABLED = \"disabled\";\r\nexport var STR_EXTENSION_CONFIG = \"extensionConfig\";\r\nexport var STR_EXTENSIONS = \"extensions\";\r\nexport var STR_PROCESS_TELEMETRY = \"processTelemetry\";\r\nexport var STR_PRIORITY = \"priority\";\r\nexport var STR_EVENTS_SENT = \"eventsSent\";\r\nexport var STR_EVENTS_DISCARDED = \"eventsDiscarded\";\r\nexport var STR_EVENTS_SEND_REQUEST = \"eventsSendRequest\";\r\nexport var STR_PERF_EVENT = \"perfEvent\";\r\nexport var STR_ERROR_TO_CONSOLE = \"errorToConsole\";\r\nexport var STR_WARN_TO_CONSOLE = \"warnToConsole\";\r\nexport var STR_GET_PERF_MGR = \"getPerfMgr\";\r\n//# sourceMappingURL=InternalConstants.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { getGlobal, strShimObject, strShimPrototype, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_CALL, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_NAME, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_USER_AGENT } from \"../__DynamicConstants\";\r\nimport { isString, isUndefined, strContains } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n/**\r\n * This file exists to hold environment utilities that are required to check and\r\n * validate the current operating environment. Unless otherwise required, please\r\n * only use defined methods (functions) in this class so that users of these\r\n * functions/properties only need to include those that are used within their own modules.\r\n */\r\nvar strWindow = \"window\";\r\nvar strDocument = \"document\";\r\nvar strDocumentMode = \"documentMode\";\r\nvar strNavigator = \"navigator\";\r\nvar strHistory = \"history\";\r\nvar strLocation = \"location\";\r\nvar strConsole = \"console\";\r\nvar strPerformance = \"performance\";\r\nvar strJSON = \"JSON\";\r\nvar strCrypto = \"crypto\";\r\nvar strMsCrypto = \"msCrypto\";\r\nvar strReactNative = \"ReactNative\";\r\nvar strMsie = \"msie\";\r\nvar strTrident = \"trident/\";\r\nvar strXMLHttpRequest = \"XMLHttpRequest\";\r\nvar _isTrident = null;\r\nvar _navUserAgentCheck = null;\r\nvar _enableMocks = false;\r\nvar _useXDomainRequest = null;\r\nvar _beaconsSupported = null;\r\nfunction _hasProperty(theClass, property) {\r\n var supported = false;\r\n if (theClass) {\r\n try {\r\n supported = property in theClass;\r\n if (!supported) {\r\n var proto = theClass[strShimPrototype];\r\n if (proto) {\r\n supported = property in proto;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do Nothing\r\n }\r\n if (!supported) {\r\n try {\r\n var tmp = new theClass();\r\n supported = !isUndefined(tmp[property]);\r\n }\r\n catch (e) {\r\n // Do Nothing\r\n }\r\n }\r\n }\r\n return supported;\r\n}\r\n/**\r\n * Enable the lookup of test mock objects if requested\r\n * @param enabled\r\n */\r\nexport function setEnableEnvMocks(enabled) {\r\n _enableMocks = enabled;\r\n}\r\n/**\r\n * Return the named global object if available, will return null if the object is not available.\r\n * @param name The globally named object\r\n */\r\nexport function getGlobalInst(name) {\r\n var gbl = getGlobal();\r\n if (gbl && gbl[name]) {\r\n return gbl[name];\r\n }\r\n // Test workaround, for environments where .window (when global == window) doesn't return the base window\r\n if (name === strWindow && hasWindow()) {\r\n // tslint:disable-next-line: no-angle-bracket-type-assertion\r\n return window;\r\n }\r\n return null;\r\n}\r\n/**\r\n * Checks if window object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a window\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: window is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasWindow() {\r\n return Boolean(typeof window === strShimObject && window);\r\n}\r\n/**\r\n * Returns the global window object if it is present otherwise null.\r\n * This helper is used to access the window object without causing an exception\r\n * \"Uncaught ReferenceError: window is not defined\"\r\n */\r\nexport function getWindow() {\r\n if (hasWindow()) {\r\n return window;\r\n }\r\n // Return the global instance or null\r\n return getGlobalInst(strWindow);\r\n}\r\n/**\r\n * Checks if document object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a document\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: document is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasDocument() {\r\n return Boolean(typeof document === strShimObject && document);\r\n}\r\n/**\r\n * Returns the global document object if it is present otherwise null.\r\n * This helper is used to access the document object without causing an exception\r\n * \"Uncaught ReferenceError: document is not defined\"\r\n */\r\nexport function getDocument() {\r\n if (hasDocument()) {\r\n return document;\r\n }\r\n return getGlobalInst(strDocument);\r\n}\r\n/**\r\n * Checks if navigator object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a navigator\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: navigator is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasNavigator() {\r\n return Boolean(typeof navigator === strShimObject && navigator);\r\n}\r\n/**\r\n * Returns the global navigator object if it is present otherwise null.\r\n * This helper is used to access the navigator object without causing an exception\r\n * \"Uncaught ReferenceError: navigator is not defined\"\r\n */\r\nexport function getNavigator() {\r\n if (hasNavigator()) {\r\n return navigator;\r\n }\r\n return getGlobalInst(strNavigator);\r\n}\r\n/**\r\n * Checks if history object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: history is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasHistory() {\r\n return Boolean(typeof history === strShimObject && history);\r\n}\r\n/**\r\n * Returns the global history object if it is present otherwise null.\r\n * This helper is used to access the history object without causing an exception\r\n * \"Uncaught ReferenceError: history is not defined\"\r\n */\r\nexport function getHistory() {\r\n if (hasHistory()) {\r\n return history;\r\n }\r\n return getGlobalInst(strHistory);\r\n}\r\n/**\r\n * Returns the global location object if it is present otherwise null.\r\n * This helper is used to access the location object without causing an exception\r\n * \"Uncaught ReferenceError: location is not defined\"\r\n */\r\nexport function getLocation(checkForMock) {\r\n if (checkForMock && _enableMocks) {\r\n var mockLocation = getGlobalInst(\"__mockLocation\");\r\n if (mockLocation) {\r\n return mockLocation;\r\n }\r\n }\r\n if (typeof location === strShimObject && location) {\r\n return location;\r\n }\r\n return getGlobalInst(strLocation);\r\n}\r\n/**\r\n * Returns the global console object\r\n */\r\nexport function getConsole() {\r\n if (typeof console !== strShimUndefined) {\r\n return console;\r\n }\r\n return getGlobalInst(strConsole);\r\n}\r\n/**\r\n * Returns the performance object if it is present otherwise null.\r\n * This helper is used to access the performance object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getPerformance() {\r\n return getGlobalInst(strPerformance);\r\n}\r\n/**\r\n * Checks if JSON object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: JSON is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasJSON() {\r\n return Boolean((typeof JSON === strShimObject && JSON) || getGlobalInst(strJSON) !== null);\r\n}\r\n/**\r\n * Returns the global JSON object if it is present otherwise null.\r\n * This helper is used to access the JSON object without causing an exception\r\n * \"Uncaught ReferenceError: JSON is not defined\"\r\n */\r\nexport function getJSON() {\r\n if (hasJSON()) {\r\n return JSON || getGlobalInst(strJSON);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Returns the crypto object if it is present otherwise null.\r\n * This helper is used to access the crypto object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getCrypto() {\r\n return getGlobalInst(strCrypto);\r\n}\r\n/**\r\n * Returns the crypto object if it is present otherwise null.\r\n * This helper is used to access the crypto object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getMsCrypto() {\r\n return getGlobalInst(strMsCrypto);\r\n}\r\n/**\r\n * Returns whether the environment is reporting that we are running in a React Native Environment\r\n */\r\nexport function isReactNative() {\r\n // If running in React Native, navigator.product will be populated\r\n var nav = getNavigator();\r\n if (nav && nav.product) {\r\n return nav.product === strReactNative;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Identifies whether the current environment appears to be IE\r\n */\r\nexport function isIE() {\r\n var nav = getNavigator();\r\n if (nav && (nav[_DYN_USER_AGENT /* @min:%2euserAgent */] !== _navUserAgentCheck || _isTrident === null)) {\r\n // Added to support test mocking of the user agent\r\n _navUserAgentCheck = nav[_DYN_USER_AGENT /* @min:%2euserAgent */];\r\n var userAgent = (_navUserAgentCheck || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));\r\n }\r\n return _isTrident;\r\n}\r\n/**\r\n * Gets IE version returning the document emulation mode if we are running on IE, or null otherwise\r\n */\r\nexport function getIEVersion(userAgentStr) {\r\n if (userAgentStr === void 0) { userAgentStr = null; }\r\n if (!userAgentStr) {\r\n var navigator_1 = getNavigator() || {};\r\n userAgentStr = navigator_1 ? (navigator_1[_DYN_USER_AGENT /* @min:%2euserAgent */] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() : STR_EMPTY;\r\n }\r\n var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n // Also check for documentMode in case X-UA-Compatible meta tag was included in HTML.\r\n if (strContains(ua, strMsie)) {\r\n var doc = getDocument() || {};\r\n return Math.max(parseInt(ua[_DYN_SPLIT /* @min:%2esplit */](strMsie)[1]), (doc[strDocumentMode] || 0));\r\n }\r\n else if (strContains(ua, strTrident)) {\r\n var tridentVer = parseInt(ua[_DYN_SPLIT /* @min:%2esplit */](strTrident)[1]);\r\n if (tridentVer) {\r\n return tridentVer + 4;\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Returns string representation of an object suitable for diagnostics logging.\r\n */\r\nexport function dumpObj(object) {\r\n var objectTypeDump = Object[strShimPrototype].toString[_DYN_CALL /* @min:%2ecall */](object);\r\n var propertyValueDump = STR_EMPTY;\r\n if (objectTypeDump === \"[object Error]\") {\r\n propertyValueDump = \"{ stack: '\" + object.stack + \"', message: '\" + object.message + \"', name: '\" + object[_DYN_NAME /* @min:%2ename */] + \"'\";\r\n }\r\n else if (hasJSON()) {\r\n propertyValueDump = getJSON().stringify(object);\r\n }\r\n return objectTypeDump + propertyValueDump;\r\n}\r\nexport function isSafari(userAgentStr) {\r\n if (!userAgentStr || !isString(userAgentStr)) {\r\n var navigator_2 = getNavigator() || {};\r\n userAgentStr = navigator_2 ? (navigator_2[_DYN_USER_AGENT /* @min:%2euserAgent */] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() : STR_EMPTY;\r\n }\r\n var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n return (ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"safari\") >= 0);\r\n}\r\n/**\r\n * Checks if HTML5 Beacons are supported in the current environment.\r\n * @returns True if supported, false otherwise.\r\n */\r\nexport function isBeaconsSupported() {\r\n if (_beaconsSupported === null) {\r\n _beaconsSupported = hasNavigator() && Boolean(getNavigator().sendBeacon);\r\n }\r\n return _beaconsSupported;\r\n}\r\n/**\r\n * Checks if the Fetch API is supported in the current environment.\r\n * @param withKeepAlive - [Optional] If True, check if fetch is available and it supports the keepalive feature, otherwise only check if fetch is supported\r\n * @returns True if supported, otherwise false\r\n */\r\nexport function isFetchSupported(withKeepAlive) {\r\n var isSupported = false;\r\n try {\r\n isSupported = !!getGlobalInst(\"fetch\");\r\n var request = getGlobalInst(\"Request\");\r\n if (isSupported && withKeepAlive && request) {\r\n isSupported = _hasProperty(request, \"keepalive\");\r\n }\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nexport function useXDomainRequest() {\r\n if (_useXDomainRequest === null) {\r\n _useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);\r\n if (_useXDomainRequest && isXhrSupported()) {\r\n _useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), \"withCredentials\");\r\n }\r\n }\r\n return _useXDomainRequest;\r\n}\r\n/**\r\n * Checks if XMLHttpRequest is supported\r\n * @returns True if supported, otherwise false\r\n */\r\nexport function isXhrSupported() {\r\n var isSupported = false;\r\n try {\r\n var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);\r\n isSupported = !!xmlHttpRequest;\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nfunction _getNamedValue(values, name) {\r\n if (values) {\r\n for (var i = 0; i < values[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var value = values[i];\r\n if (value[_DYN_NAME /* @min:%2ename */]) {\r\n if (value[_DYN_NAME /* @min:%2ename */] === name) {\r\n return value;\r\n }\r\n }\r\n }\r\n }\r\n return {};\r\n}\r\n/**\r\n * Helper function to fetch the named meta-tag from the page.\r\n * @param name\r\n */\r\nexport function findMetaTag(name) {\r\n var doc = getDocument();\r\n if (doc && name) {\r\n // Look for a meta-tag\r\n return _getNamedValue(doc.querySelectorAll(\"meta\"), name).content;\r\n }\r\n return null;\r\n}\r\n/**\r\n * Helper function to fetch the named server timing value from the page response (first navigation event).\r\n * @param name\r\n */\r\nexport function findNamedServerTiming(name) {\r\n var value;\r\n var perf = getPerformance();\r\n if (perf) {\r\n // Try looking for a server-timing header\r\n var navPerf = perf.getEntriesByType(\"navigation\") || [];\r\n value = _getNamedValue((navPerf[_DYN_LENGTH /* @min:%2elength */] > 0 ? navPerf[0] : {}).serverTiming, name).description;\r\n }\r\n return value;\r\n}\r\n//# sourceMappingURL=EnvUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { _DYN_APPLY, _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { getGlobalInst } from \"./EnvUtils\";\r\nvar listenerFuncs = [\"eventsSent\", \"eventsDiscarded\", \"eventsSendRequest\", \"perfEvent\"];\r\nvar _aiNamespace = null;\r\nvar _debugListener;\r\nfunction _listenerProxyFunc(name, config) {\r\n return function () {\r\n var args = arguments;\r\n var dbgExt = getDebugExt(config);\r\n if (dbgExt) {\r\n var listener = dbgExt.listener;\r\n if (listener && listener[name]) {\r\n listener[name][_DYN_APPLY /* @min:%2eapply */](listener, args);\r\n }\r\n }\r\n };\r\n}\r\nfunction _getExtensionNamespace() {\r\n // Cache the lookup of the global namespace object\r\n var target = getGlobalInst(\"Microsoft\");\r\n if (target) {\r\n _aiNamespace = target[\"ApplicationInsights\"];\r\n }\r\n return _aiNamespace;\r\n}\r\nexport function getDebugExt(config) {\r\n var ns = _aiNamespace;\r\n if (!ns && config.disableDbgExt !== true) {\r\n ns = _aiNamespace || _getExtensionNamespace();\r\n }\r\n return ns ? ns[\"ChromeDbgExt\"] : null;\r\n}\r\nexport function getDebugListener(config) {\r\n if (!_debugListener) {\r\n _debugListener = {};\r\n for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);\r\n }\r\n }\r\n return _debugListener;\r\n}\r\n//# sourceMappingURL=DbgExtensionUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_DIAG_LOG, _DYN_ENABLE_DEBUG_EXCEPTI4, _DYN_LOGGER, _DYN_LOG_INTERNAL_MESSAGE, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_PUSH, _DYN_REPLACE } from \"../__DynamicConstants\";\r\nimport { getDebugExt } from \"./DbgExtensionUtils\";\r\nimport { dumpObj, getConsole, getJSON, hasJSON } from \"./EnvUtils\";\r\nimport { getCfgValue, isFunction, isUndefined } from \"./HelperFuncs\";\r\nimport { STR_EMPTY, STR_ERROR_TO_CONSOLE, STR_WARN_TO_CONSOLE } from \"./InternalConstants\";\r\n/**\r\n * For user non actionable traces use AI Internal prefix.\r\n */\r\nvar AiNonUserActionablePrefix = \"AI (Internal): \";\r\n/**\r\n * Prefix of the traces in portal.\r\n */\r\nvar AiUserActionablePrefix = \"AI: \";\r\n/**\r\n * Session storage key for the prefix for the key indicating message type already logged\r\n */\r\nvar AIInternalMessagePrefix = \"AITR_\";\r\nfunction _sanitizeDiagnosticText(text) {\r\n if (text) {\r\n return \"\\\"\" + text[_DYN_REPLACE /* @min:%2ereplace */](/\\\"/g, STR_EMPTY) + \"\\\"\";\r\n }\r\n return STR_EMPTY;\r\n}\r\nfunction _logToConsole(func, message) {\r\n var theConsole = getConsole();\r\n if (!!theConsole) {\r\n var logFunc = \"log\";\r\n if (theConsole[func]) {\r\n logFunc = func;\r\n }\r\n if (isFunction(theConsole[logFunc])) {\r\n theConsole[logFunc](message);\r\n }\r\n }\r\n}\r\nvar _InternalLogMessage = /** @class */ (function () {\r\n function _InternalLogMessage(msgId, msg, isUserAct, properties) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var _self = this;\r\n _self[_DYN_MESSAGE_ID /* @min:%2emessageId */] = msgId;\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] =\r\n (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +\r\n msgId;\r\n var strProps = STR_EMPTY;\r\n if (hasJSON()) {\r\n strProps = getJSON().stringify(properties);\r\n }\r\n var diagnosticText = (msg ? \" message:\" + _sanitizeDiagnosticText(msg) : STR_EMPTY) +\r\n (properties ? \" props:\" + _sanitizeDiagnosticText(strProps) : STR_EMPTY);\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] += diagnosticText;\r\n }\r\n _InternalLogMessage.dataType = \"MessageData\";\r\n return _InternalLogMessage;\r\n}());\r\nexport { _InternalLogMessage };\r\nexport function safeGetLogger(core, config) {\r\n return (core || {})[_DYN_LOGGER /* @min:%2elogger */] || new DiagnosticLogger(config);\r\n}\r\nvar DiagnosticLogger = /** @class */ (function () {\r\n function DiagnosticLogger(config) {\r\n this.identifier = \"DiagnosticLogger\";\r\n /**\r\n * The internal logging queue\r\n */\r\n this.queue = [];\r\n /**\r\n * Count of internal messages sent\r\n */\r\n var _messageCount = 0;\r\n /**\r\n * Holds information about what message types were already logged to console or sent to server.\r\n */\r\n var _messageLogged = {};\r\n var _loggingLevelConsole;\r\n var _loggingLevelTelemetry;\r\n var _maxInternalMessageLimit;\r\n var _enableDebugExceptions;\r\n dynamicProto(DiagnosticLogger, this, function (_self) {\r\n _setDefaultsFromConfig(config || {});\r\n _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };\r\n _self.telemetryLoggingLevel = function () { return _loggingLevelTelemetry; };\r\n _self.maxInternalMessageLimit = function () { return _maxInternalMessageLimit; };\r\n _self[_DYN_ENABLE_DEBUG_EXCEPTI4 /* @min:%2eenableDebugExceptions */] = function () { return _enableDebugExceptions; };\r\n /**\r\n * This method will throw exceptions in debug mode or attempt to log the error as a console warning.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\n _self.throwInternal = function (severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);\r\n if (_enableDebugExceptions) {\r\n throw dumpObj(message);\r\n }\r\n else {\r\n // Get the logging function and fallback to warnToConsole of for some reason errorToConsole doesn't exist\r\n var logFunc = severity === 1 /* eLoggingSeverity.CRITICAL */ ? STR_ERROR_TO_CONSOLE : STR_WARN_TO_CONSOLE;\r\n if (!isUndefined(message[_DYN_MESSAGE /* @min:%2emessage */])) {\r\n if (isUserAct) {\r\n // check if this message type was already logged to console for this page view and if so, don't log it again\r\n var messageKey = +message[_DYN_MESSAGE_ID /* @min:%2emessageId */];\r\n if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {\r\n _self[logFunc](message[_DYN_MESSAGE /* @min:%2emessage */]);\r\n _messageLogged[messageKey] = true;\r\n }\r\n }\r\n else {\r\n // Only log traces if the console Logging Level is >= the throwInternal severity level\r\n if (_loggingLevelConsole >= severity) {\r\n _self[logFunc](message[_DYN_MESSAGE /* @min:%2emessage */]);\r\n }\r\n }\r\n _logInternalMessage(severity, message);\r\n }\r\n else {\r\n _debugExtMsg(\"throw\" + (severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"Critical\" : \"Warning\"), message);\r\n }\r\n }\r\n };\r\n /**\r\n * This will write a warning to the console if possible\r\n * @param message {string} - The warning message\r\n */\r\n _self[STR_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */] = function (message) {\r\n _logToConsole(\"warn\", message);\r\n _debugExtMsg(\"warning\", message);\r\n };\r\n /**\r\n * This will write an error to the console if possible\r\n * @param message {string} - The error message\r\n */\r\n _self[STR_ERROR_TO_CONSOLE /* @min:%2eerrorToConsole */] = function (message) {\r\n _logToConsole(\"error\", message);\r\n _debugExtMsg(\"error\", message);\r\n };\r\n /**\r\n * Resets the internal message count\r\n */\r\n _self.resetInternalMessageCount = function () {\r\n _messageCount = 0;\r\n _messageLogged = {};\r\n };\r\n /**\r\n * Logs a message to the internal queue.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The message to log.\r\n */\r\n _self[_DYN_LOG_INTERNAL_MESSAGE /* @min:%2elogInternalMessage */] = _logInternalMessage;\r\n function _logInternalMessage(severity, message) {\r\n if (_areInternalMessagesThrottled()) {\r\n return;\r\n }\r\n // check if this message type was already logged for this session and if so, don't log it again\r\n var logMessage = true;\r\n var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID /* @min:%2emessageId */];\r\n // if the session storage is not available, limit to only one message type per page view\r\n if (_messageLogged[messageKey]) {\r\n logMessage = false;\r\n }\r\n else {\r\n _messageLogged[messageKey] = true;\r\n }\r\n if (logMessage) {\r\n // Push the event in the internal queue\r\n if (severity <= _loggingLevelTelemetry) {\r\n _self.queue[_DYN_PUSH /* @min:%2epush */](message);\r\n _messageCount++;\r\n _debugExtMsg((severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"error\" : \"warn\"), message);\r\n }\r\n // When throttle limit reached, send a special event\r\n if (_messageCount === _maxInternalMessageLimit) {\r\n var throttleLimitMessage = \"Internal events throttle limit per PageView reached for this app.\";\r\n var throttleMessage = new _InternalLogMessage(23 /* _eInternalMessageId.MessageLimitPerPVExceeded */, throttleLimitMessage, false);\r\n _self.queue[_DYN_PUSH /* @min:%2epush */](throttleMessage);\r\n if (severity === 1 /* eLoggingSeverity.CRITICAL */) {\r\n _self[STR_ERROR_TO_CONSOLE /* @min:%2eerrorToConsole */](throttleLimitMessage);\r\n }\r\n else {\r\n _self[STR_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](throttleLimitMessage);\r\n }\r\n }\r\n }\r\n }\r\n function _setDefaultsFromConfig(config) {\r\n _loggingLevelConsole = getCfgValue(config.loggingLevelConsole, 0);\r\n _loggingLevelTelemetry = getCfgValue(config.loggingLevelTelemetry, 1);\r\n _maxInternalMessageLimit = getCfgValue(config.maxMessageLimit, 25);\r\n _enableDebugExceptions = getCfgValue(config[_DYN_ENABLE_DEBUG_EXCEPTI4 /* @min:%2eenableDebugExceptions */], false);\r\n }\r\n function _areInternalMessagesThrottled() {\r\n return _messageCount >= _maxInternalMessageLimit;\r\n }\r\n function _debugExtMsg(name, data) {\r\n var dbgExt = getDebugExt(config || {});\r\n if (dbgExt && dbgExt[_DYN_DIAG_LOG /* @min:%2ediagLog */]) {\r\n dbgExt[_DYN_DIAG_LOG /* @min:%2ediagLog */](name, data);\r\n }\r\n }\r\n });\r\n }\r\n// Removed Stub for DiagnosticLogger.prototype.enableDebugExceptions.\r\n// Removed Stub for DiagnosticLogger.prototype.consoleLoggingLevel.\r\n// Removed Stub for DiagnosticLogger.prototype.telemetryLoggingLevel.\r\n// Removed Stub for DiagnosticLogger.prototype.maxInternalMessageLimit.\r\n// Removed Stub for DiagnosticLogger.prototype.throwInternal.\r\n// Removed Stub for DiagnosticLogger.prototype.warnToConsole.\r\n// Removed Stub for DiagnosticLogger.prototype.errorToConsole.\r\n// Removed Stub for DiagnosticLogger.prototype.resetInternalMessageCount.\r\n// Removed Stub for DiagnosticLogger.prototype.logInternalMessage.\r\n // This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n // this will be removed when ES3 support is dropped.\n DiagnosticLogger.__ieDyn=1;\n\n return DiagnosticLogger;\r\n}());\r\nexport { DiagnosticLogger };\r\nfunction _getLogger(logger) {\r\n return (logger || new DiagnosticLogger());\r\n}\r\n/**\r\n * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in\r\n * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better\r\n * support minification as logger.throwInternal() will not compress the publish \"throwInternal\" used throughout\r\n * the code.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\nexport function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n _getLogger(logger).throwInternal(severity, msgId, msg, properties, isUserAct);\r\n}\r\n/**\r\n * This is a helper method which will call warnToConsole on the passed logger with the provided message.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\nexport function _warnToConsole(logger, message) {\r\n _getLogger(logger)[STR_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](message);\r\n}\r\n/**\r\n * Logs a message to the internal queue.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The message to log.\r\n */\r\nexport function _logInternalMessage(logger, severity, message) {\r\n _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE /* @min:%2elogInternalMessage */](severity, message);\r\n}\r\n//# sourceMappingURL=DiagnosticLogger.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_COMPLETE, _DYN_GET_CTX, _DYN_IS_ASYNC, _DYN_IS_CHILD_EVT, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_CTX, _DYN_TIME } from \"../__DynamicConstants\";\r\nimport { dateNow, isArray, isFunction, objDefineAccessors } from \"./HelperFuncs\";\r\nimport { STR_GET_PERF_MGR, STR_PERF_EVENT } from \"./InternalConstants\";\r\nvar strExecutionContextKey = \"ctx\";\r\nvar strParentContextKey = \"ParentContextKey\";\r\nvar strChildrenContextKey = \"ChildrenContextKey\";\r\nvar _defaultPerfManager = null;\r\nvar PerfEvent = /** @class */ (function () {\r\n function PerfEvent(name, payloadDetails, isAsync) {\r\n var _self = this;\r\n var accessorDefined = false;\r\n _self.start = dateNow();\r\n _self[_DYN_NAME /* @min:%2ename */] = name;\r\n _self[_DYN_IS_ASYNC /* @min:%2eisAsync */] = isAsync;\r\n _self[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */] = function () { return false; };\r\n if (isFunction(payloadDetails)) {\r\n // Create an accessor to minimize the potential performance impact of executing the payloadDetails callback\r\n var theDetails_1;\r\n accessorDefined = objDefineAccessors(_self, \"payload\", function () {\r\n // Delay the execution of the payloadDetails until needed\r\n if (!theDetails_1 && isFunction(payloadDetails)) {\r\n theDetails_1 = payloadDetails();\r\n // clear it out now so the referenced objects can be garbage collected\r\n payloadDetails = null;\r\n }\r\n return theDetails_1;\r\n });\r\n }\r\n _self[_DYN_GET_CTX /* @min:%2egetCtx */] = function (key) {\r\n if (key) {\r\n // The parent and child links are located directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {\r\n return _self[key];\r\n }\r\n return (_self[strExecutionContextKey] || {})[key];\r\n }\r\n return null;\r\n };\r\n _self[_DYN_SET_CTX /* @min:%2esetCtx */] = function (key, value) {\r\n if (key) {\r\n // Put the parent and child links directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent[strParentContextKey]) {\r\n // Simple assumption, if we are setting a parent then we must be a child\r\n if (!_self[key]) {\r\n _self[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */] = function () { return true; };\r\n }\r\n _self[key] = value;\r\n }\r\n else if (key === PerfEvent[strChildrenContextKey]) {\r\n _self[key] = value;\r\n }\r\n else {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n }\r\n };\r\n _self[_DYN_COMPLETE /* @min:%2ecomplete */] = function () {\r\n var childTime = 0;\r\n var childEvts = _self[_DYN_GET_CTX /* @min:%2egetCtx */](PerfEvent[strChildrenContextKey]);\r\n if (isArray(childEvts)) {\r\n for (var lp = 0; lp < childEvts[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var childEvt = childEvts[lp];\r\n if (childEvt) {\r\n childTime += childEvt[_DYN_TIME /* @min:%2etime */];\r\n }\r\n }\r\n }\r\n _self[_DYN_TIME /* @min:%2etime */] = dateNow() - _self.start;\r\n _self.exTime = _self[_DYN_TIME /* @min:%2etime */] - childTime;\r\n _self[_DYN_COMPLETE /* @min:%2ecomplete */] = function () { };\r\n if (!accessorDefined && isFunction(payloadDetails)) {\r\n // If we couldn't define the property set during complete -- to minimize the perf impact until after the time\r\n _self.payload = payloadDetails();\r\n }\r\n };\r\n }\r\n PerfEvent.ParentContextKey = \"parent\";\r\n PerfEvent.ChildrenContextKey = \"childEvts\";\r\n return PerfEvent;\r\n}());\r\nexport { PerfEvent };\r\nvar PerfManager = /** @class */ (function () {\r\n function PerfManager(manager) {\r\n /**\r\n * General bucket used for execution context set and retrieved via setCtx() and getCtx.\r\n * Defined as private so it can be visualized via the DebugPlugin\r\n */\r\n this.ctx = {};\r\n dynamicProto(PerfManager, this, function (_self) {\r\n _self.create = function (src, payloadDetails, isAsync) {\r\n // TODO (@MSNev): at some point we will want to add additional configuration to \"select\" which events to instrument\r\n // for now this is just a simple do everything.\r\n return new PerfEvent(src, payloadDetails, isAsync);\r\n };\r\n _self.fire = function (perfEvent) {\r\n if (perfEvent) {\r\n perfEvent[_DYN_COMPLETE /* @min:%2ecomplete */]();\r\n if (manager && isFunction(manager[STR_PERF_EVENT /* @min:%2eperfEvent */])) {\r\n manager[STR_PERF_EVENT /* @min:%2eperfEvent */](perfEvent);\r\n }\r\n }\r\n };\r\n _self[_DYN_SET_CTX /* @min:%2esetCtx */] = function (key, value) {\r\n if (key) {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n };\r\n _self[_DYN_GET_CTX /* @min:%2egetCtx */] = function (key) {\r\n return (_self[strExecutionContextKey] || {})[key];\r\n };\r\n });\r\n }\r\n// Removed Stub for PerfManager.prototype.create.\r\n// Removed Stub for PerfManager.prototype.fire.\r\n// Removed Stub for PerfManager.prototype.setCtx.\r\n// Removed Stub for PerfManager.prototype.getCtx.\r\n // This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n // this will be removed when ES3 support is dropped.\n PerfManager.__ieDyn=1;\n\n return PerfManager;\r\n}());\r\nexport { PerfManager };\r\nvar doPerfActiveKey = \"CoreUtils.doPerf\";\r\n/**\r\n * Helper function to wrap a function with a perf event\r\n * @param mgrSource - The Performance Manager or a Performance provider source (may be null)\r\n * @param getSource - The callback to create the source name for the event (if perf monitoring is enabled)\r\n * @param func - The function to call and measure\r\n * @param details - A function to return the payload details\r\n * @param isAsync - Is the event / function being call asynchronously or synchronously\r\n */\r\nexport function doPerf(mgrSource, getSource, func, details, isAsync) {\r\n if (mgrSource) {\r\n var perfMgr = mgrSource;\r\n if (perfMgr[STR_GET_PERF_MGR]) {\r\n // Looks like a perf manager provider object\r\n perfMgr = perfMgr[STR_GET_PERF_MGR]();\r\n }\r\n if (perfMgr) {\r\n var perfEvt = void 0;\r\n var currentActive = perfMgr[_DYN_GET_CTX /* @min:%2egetCtx */](doPerfActiveKey);\r\n try {\r\n perfEvt = perfMgr.create(getSource(), details, isAsync);\r\n if (perfEvt) {\r\n if (currentActive && perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */](PerfEvent[strParentContextKey], currentActive);\r\n if (currentActive[_DYN_GET_CTX /* @min:%2egetCtx */] && currentActive[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n var children = currentActive[_DYN_GET_CTX /* @min:%2egetCtx */](PerfEvent[strChildrenContextKey]);\r\n if (!children) {\r\n children = [];\r\n currentActive[_DYN_SET_CTX /* @min:%2esetCtx */](PerfEvent[strChildrenContextKey], children);\r\n }\r\n children[_DYN_PUSH /* @min:%2epush */](perfEvt);\r\n }\r\n }\r\n // Set this event as the active event now\r\n perfMgr[_DYN_SET_CTX /* @min:%2esetCtx */](doPerfActiveKey, perfEvt);\r\n return func(perfEvt);\r\n }\r\n }\r\n catch (ex) {\r\n if (perfEvt && perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */](\"exception\", ex);\r\n }\r\n }\r\n finally {\r\n // fire the perf event\r\n if (perfEvt) {\r\n perfMgr.fire(perfEvt);\r\n }\r\n // Reset the active event to the previous value\r\n perfMgr[_DYN_SET_CTX /* @min:%2esetCtx */](doPerfActiveKey, currentActive);\r\n }\r\n }\r\n }\r\n return func();\r\n}\r\n/**\r\n * Set the global performance manager to use when there is no core instance or it has not been initialized yet.\r\n * @param perfManager - The IPerfManager instance to use when no performance manager is supplied.\r\n */\r\nexport function setGblPerfMgr(perfManager) {\r\n _defaultPerfManager = perfManager;\r\n}\r\n/**\r\n * Get the current global performance manager that will be used with no performance manager is supplied.\r\n * @returns - The current default manager\r\n */\r\nexport function getGblPerfMgr() {\r\n return _defaultPerfManager;\r\n}\r\n//# sourceMappingURL=PerfManager.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { getCrypto, getMsCrypto, isIE } from \"./EnvUtils\";\r\nimport { dateNow } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nvar UInt32Mask = 0x100000000;\r\nvar MaxUInt32 = 0xffffffff;\r\n// MWC based Random generator (for IE)\r\nvar _mwcSeeded = false;\r\nvar _mwcW = 123456789;\r\nvar _mwcZ = 987654321;\r\n// Takes any integer\r\nfunction _mwcSeed(seedValue) {\r\n if (seedValue < 0) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n seedValue >>>= 0;\r\n }\r\n _mwcW = (123456789 + seedValue) & MaxUInt32;\r\n _mwcZ = (987654321 - seedValue) & MaxUInt32;\r\n _mwcSeeded = true;\r\n}\r\nfunction _autoSeedMwc() {\r\n // Simple initialization using default Math.random() - So we inherit any entropy from the browser\r\n // and bitwise XOR with the current milliseconds\r\n try {\r\n var now = dateNow() & 0x7fffffff;\r\n _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);\r\n }\r\n catch (e) {\r\n // Don't crash if something goes wrong\r\n }\r\n}\r\n/**\r\n * Generate a random value between 0 and maxValue, max value should be limited to a 32-bit maximum.\r\n * So maxValue(16) will produce a number from 0..16 (range of 17)\r\n * @param maxValue\r\n */\r\nexport function randomValue(maxValue) {\r\n if (maxValue > 0) {\r\n return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;\r\n }\r\n return 0;\r\n}\r\n/**\r\n * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function random32(signed) {\r\n var value = 0;\r\n var c = getCrypto() || getMsCrypto();\r\n if (c && c.getRandomValues) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;\r\n }\r\n if (value === 0 && isIE()) {\r\n // For IE 6, 7, 8 (especially on XP) Math.random is not very random\r\n if (!_mwcSeeded) {\r\n // Set the seed for the Mwc algorithm\r\n _autoSeedMwc();\r\n }\r\n // Don't use Math.random for IE\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = mwcRandom32() & MaxUInt32;\r\n }\r\n if (value === 0) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = Math.floor((UInt32Mask * Math.random()) | 0);\r\n }\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Seed the MWC random number generator with the specified seed or a random value\r\n * @param value - optional the number to used as the seed, if undefined, null or zero a random value will be chosen\r\n */\r\nexport function mwcRandomSeed(value) {\r\n if (!value) {\r\n _autoSeedMwc();\r\n }\r\n else {\r\n _mwcSeed(value);\r\n }\r\n}\r\n/**\r\n * Generate a random 32-bit number between (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), using MWC (Multiply with carry)\r\n * instead of Math.random() defaults to un-signed.\r\n * Used as a replacement random generator for IE to avoid issues with older IE instances.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function mwcRandom32(signed) {\r\n _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;\r\n _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;\r\n var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Generate random base64 id string.\r\n * The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)\r\n * @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22\r\n */\r\nexport function newId(maxLength) {\r\n if (maxLength === void 0) { maxLength = 22; }\r\n var base64chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n // Start with an initial random number, consuming the value in reverse byte order\r\n var number = random32() >>> 0; // Make sure it's a +ve number\r\n var chars = 0;\r\n var result = STR_EMPTY;\r\n while (result[_DYN_LENGTH /* @min:%2elength */] < maxLength) {\r\n chars++;\r\n result += base64chars.charAt(number & 0x3F);\r\n number >>>= 6; // Zero fill with right shift\r\n if (chars === 5) {\r\n // 5 base64 characters === 30 bits so we don't have enough bits for another base64 char\r\n // So add on another 30 bits and make sure it's +ve\r\n number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;\r\n chars = 0; // We need to reset the number every 5 chars (30 bits)\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=RandomHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { ObjDefineProperty } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_NODE_TYPE } from \"../__DynamicConstants\";\r\nimport { normalizeJsName } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { newId } from \"./RandomHelper\";\r\nvar _objDefineProperty = ObjDefineProperty;\r\nvar version = '2.8.10';\r\nvar instanceName = \".\" + newId(6);\r\nvar _dataUid = 0;\r\nfunction _createAccessor(target, prop, value) {\r\n if (_objDefineProperty) {\r\n try {\r\n _objDefineProperty(target, prop, {\r\n value: value,\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return true;\r\n }\r\n catch (e) {\r\n // IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw\r\n // We will just ignore this here.\r\n }\r\n }\r\n return false;\r\n}\r\n// Accepts only:\r\n// - Node\r\n// - Node.ELEMENT_NODE\r\n// - Node.DOCUMENT_NODE\r\n// - Object\r\n// - Any\r\nfunction _canAcceptData(target) {\r\n return target[_DYN_NODE_TYPE /* @min:%2enodeType */] === 1 || target[_DYN_NODE_TYPE /* @min:%2enodeType */] === 9 || !(+target[_DYN_NODE_TYPE /* @min:%2enodeType */]);\r\n}\r\nfunction _getCache(data, target) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n theCache = {};\r\n try {\r\n if (_canAcceptData(target)) {\r\n if (!_createAccessor(target, data.id, theCache)) {\r\n // Environment doesn't support accessor, so just use direct assignment\r\n target[data.id] = theCache;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Not all environments allow extending all objects, so just ignore the cache in those cases\r\n }\r\n }\r\n return theCache;\r\n}\r\nexport function createUniqueNamespace(name, includeVersion) {\r\n if (includeVersion === void 0) { includeVersion = false; }\r\n return normalizeJsName(name + (_dataUid++) + (includeVersion ? \".\" + version : STR_EMPTY) + instanceName);\r\n}\r\nexport function createElmNodeData(name) {\r\n var data = {\r\n id: createUniqueNamespace(\"_aiData-\" + (name || STR_EMPTY) + \".\" + version),\r\n accept: function (target) {\r\n return _canAcceptData(target);\r\n },\r\n get: function (target, name, defValue, addDefault) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n if (addDefault) {\r\n // Side effect is adds the cache\r\n theCache = _getCache(data, target);\r\n theCache[normalizeJsName(name)] = defValue;\r\n }\r\n return defValue;\r\n }\r\n return theCache[normalizeJsName(name)];\r\n },\r\n kill: function (target, name) {\r\n if (target && target[name]) {\r\n try {\r\n delete target[name];\r\n }\r\n catch (e) {\r\n // Just cleaning up, so if this fails -- ignore\r\n }\r\n }\r\n }\r\n };\r\n return data;\r\n}\r\n//# sourceMappingURL=DataCacheHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { _DYN_COOKIE_CFG, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_LOGGER, _DYN_SET_ENABLED, _DYN_SPLIT, _DYN_SUBSTRING, _DYN_USER_AGENT } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { dumpObj, getDocument, getLocation, getNavigator, isIE } from \"./EnvUtils\";\r\nimport { arrForEach, dateNow, getExceptionName, isArray, isFunction, isNotNullOrUndefined, isNullOrUndefined, isString, isTruthy, isUndefined, objForEachKey, setValue, strContains, strEndsWith, strTrim } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nvar strToGMTString = \"toGMTString\";\r\nvar strToUTCString = \"toUTCString\";\r\nvar strCookie = \"cookie\";\r\nvar strExpires = \"expires\";\r\nvar strEnabled = \"enabled\";\r\nvar strIsCookieUseDisabled = \"isCookieUseDisabled\";\r\nvar strDisableCookiesUsage = \"disableCookiesUsage\";\r\nvar strConfigCookieMgr = \"_ckMgr\";\r\nvar _supportsCookies = null;\r\nvar _allowUaSameSite = null;\r\nvar _parsedCookieValue = null;\r\nvar _doc = getDocument();\r\nvar _cookieCache = {};\r\nvar _globalCookieConfig = {};\r\n/**\r\n * @ignore\r\n * DO NOT USE or export from the module, this is exposed as public to support backward compatibility of previous static utility methods only.\r\n * If you want to manager cookies either use the ICookieMgr available from the core instance via getCookieMgr() or create\r\n * your own instance of the CookieMgr and use that.\r\n * Using this directly for enabling / disabling cookie handling will not only affect your usage but EVERY user of cookies.\r\n * Example, if you are using a shared component that is also using Application Insights you will affect their cookie handling.\r\n * @param logger - The DiagnosticLogger to use for reporting errors.\r\n */\r\nexport function _gblCookieMgr(config, logger) {\r\n // Stash the global instance against the BaseCookieMgr class\r\n var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];\r\n if (!inst) {\r\n // Note: not using the getSetValue() helper as that would require always creating a temporary cookieMgr\r\n // that ultimately is never used\r\n inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);\r\n _globalCookieConfig[strConfigCookieMgr] = inst;\r\n }\r\n return inst;\r\n}\r\nfunction _isMgrEnabled(cookieMgr) {\r\n if (cookieMgr) {\r\n return cookieMgr.isEnabled();\r\n }\r\n return true;\r\n}\r\nfunction _createCookieMgrConfig(rootConfig) {\r\n var cookieMgrCfg = rootConfig[_DYN_COOKIE_CFG /* @min:%2ecookieCfg */] = rootConfig[_DYN_COOKIE_CFG /* @min:%2ecookieCfg */] || {};\r\n // Sets the values from the root config if not already present on the cookieMgrCfg\r\n setValue(cookieMgrCfg, \"domain\", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);\r\n setValue(cookieMgrCfg, \"path\", rootConfig.cookiePath || \"/\", null, isNullOrUndefined);\r\n if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {\r\n // Set the enabled from the provided setting or the legacy root values\r\n var cookieEnabled = void 0;\r\n if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {\r\n cookieEnabled = !rootConfig[strIsCookieUseDisabled];\r\n }\r\n if (!isUndefined(rootConfig[strDisableCookiesUsage])) {\r\n cookieEnabled = !rootConfig[strDisableCookiesUsage];\r\n }\r\n cookieMgrCfg[strEnabled] = cookieEnabled;\r\n }\r\n return cookieMgrCfg;\r\n}\r\nfunction _isIgnoredCookie(cookieMgrCfg, name) {\r\n if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {\r\n return cookieMgrCfg.ignoreCookies[_DYN_INDEX_OF /* @min:%2eindexOf */](name) !== -1;\r\n }\r\n return false;\r\n}\r\nfunction _isBlockedCookie(cookieMgrCfg, name) {\r\n if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {\r\n if (cookieMgrCfg.blockedCookies[_DYN_INDEX_OF /* @min:%2eindexOf */](name) !== -1) {\r\n return true;\r\n }\r\n }\r\n return _isIgnoredCookie(cookieMgrCfg, name);\r\n}\r\n/**\r\n * Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation\r\n * associated with the configuration or a legacy default.\r\n * @param core\r\n * @param config\r\n * @returns\r\n */\r\nexport function safeGetCookieMgr(core, config) {\r\n var cookieMgr;\r\n if (core) {\r\n // Always returns an instance\r\n cookieMgr = core.getCookieMgr();\r\n }\r\n else if (config) {\r\n var cookieCfg = config[_DYN_COOKIE_CFG /* @min:%2ecookieCfg */];\r\n if (cookieCfg[strConfigCookieMgr]) {\r\n cookieMgr = cookieCfg[strConfigCookieMgr];\r\n }\r\n else {\r\n cookieMgr = createCookieMgr(config);\r\n }\r\n }\r\n if (!cookieMgr) {\r\n // Get or initialize the default global (legacy) cookie manager if we couldn't find one\r\n cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\r\n return cookieMgr;\r\n}\r\nexport function createCookieMgr(rootConfig, logger) {\r\n var _a;\r\n var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);\r\n var _path = cookieMgrConfig.path || \"/\";\r\n var _domain = cookieMgrConfig.domain;\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n var _enabled = cookieMgrConfig[strEnabled] !== false;\r\n var cookieMgr = (_a = {\r\n isEnabled: function () {\r\n var enabled = _enabled && areCookiesSupported(logger);\r\n // Using an indirect lookup for any global cookie manager to support tree shaking for SDK's\r\n // that don't use the \"applicationinsights-core\" version of the default cookie function\r\n var gblManager = _globalCookieConfig[strConfigCookieMgr];\r\n if (enabled && gblManager && cookieMgr !== gblManager) {\r\n // Make sure the GlobalCookie Manager instance (if not this instance) is also enabled.\r\n // As the global (deprecated) functions may have been called (for backward compatibility)\r\n enabled = _isMgrEnabled(gblManager);\r\n }\r\n return enabled;\r\n }\r\n },\r\n _a[_DYN_SET_ENABLED /* @min:setEnabled */] = function (value) {\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n _enabled = value !== false;\r\n },\r\n _a.set = function (name, value, maxAgeSec, domain, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {\r\n var values = {};\r\n var theValue = strTrim(value || STR_EMPTY);\r\n var idx = theValue[_DYN_INDEX_OF /* @min:%2eindexOf */](\";\");\r\n if (idx !== -1) {\r\n theValue = strTrim(value[_DYN_SUBSTRING /* @min:%2esubstring */](0, idx));\r\n values = _extractParts(value[_DYN_SUBSTRING /* @min:%2esubstring */](idx + 1));\r\n }\r\n // Only update domain if not already present (isUndefined) and the value is truthy (not null, undefined or empty string)\r\n setValue(values, \"domain\", domain || _domain, isTruthy, isUndefined);\r\n if (!isNullOrUndefined(maxAgeSec)) {\r\n var _isIE = isIE();\r\n if (isUndefined(values[strExpires])) {\r\n var nowMs = dateNow();\r\n // Only add expires if not already present\r\n var expireMs = nowMs + (maxAgeSec * 1000);\r\n // Sanity check, if zero or -ve then ignore\r\n if (expireMs > 0) {\r\n var expiry = new Date();\r\n expiry.setTime(expireMs);\r\n setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);\r\n }\r\n }\r\n if (!_isIE) {\r\n // Only replace if not already present\r\n setValue(values, \"max-age\", STR_EMPTY + maxAgeSec, null, isUndefined);\r\n }\r\n }\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol === \"https:\") {\r\n setValue(values, \"secure\", null, null, isUndefined);\r\n // Only set same site if not also secure\r\n if (_allowUaSameSite === null) {\r\n _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT /* @min:%2euserAgent */]);\r\n }\r\n if (_allowUaSameSite) {\r\n setValue(values, \"SameSite\", \"None\", null, isUndefined);\r\n }\r\n }\r\n setValue(values, \"path\", path || _path, null, isUndefined);\r\n var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;\r\n setCookieFn(name, _formatCookieValue(theValue, values));\r\n result = true;\r\n }\r\n return result;\r\n },\r\n _a.get = function (name) {\r\n var value = STR_EMPTY;\r\n if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {\r\n value = (cookieMgrConfig.getCookie || _getCookieValue)(name);\r\n }\r\n return value;\r\n },\r\n _a.del = function (name, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr)) {\r\n // Only remove the cookie if the manager and cookie support has not been disabled\r\n result = cookieMgr.purge(name, path);\r\n }\r\n return result;\r\n },\r\n _a.purge = function (name, path) {\r\n var _a;\r\n var result = false;\r\n if (areCookiesSupported(logger)) {\r\n // Setting the expiration date in the past immediately removes the cookie\r\n var values = (_a = {},\r\n _a[\"path\"] = path ? path : \"/\",\r\n _a[strExpires] = \"Thu, 01 Jan 1970 00:00:01 GMT\",\r\n _a);\r\n if (!isIE()) {\r\n // Set max age to expire now\r\n values[\"max-age\"] = \"0\";\r\n }\r\n var delCookie = cookieMgrConfig.delCookie || _setCookieValue;\r\n delCookie(name, _formatCookieValue(STR_EMPTY, values));\r\n result = true;\r\n }\r\n return result;\r\n },\r\n _a);\r\n // Associated this cookie manager with the config\r\n cookieMgr[strConfigCookieMgr] = cookieMgr;\r\n return cookieMgr;\r\n}\r\n/*\r\n* Helper method to tell if document.cookie object is supported by the runtime\r\n*/\r\nexport function areCookiesSupported(logger) {\r\n if (_supportsCookies === null) {\r\n _supportsCookies = false;\r\n try {\r\n var doc = _doc || {};\r\n _supportsCookies = doc[strCookie] !== undefined;\r\n }\r\n catch (e) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 68 /* _eInternalMessageId.CannotAccessCookie */, \"Cannot access document.cookie - \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return _supportsCookies;\r\n}\r\nfunction _extractParts(theValue) {\r\n var values = {};\r\n if (theValue && theValue[_DYN_LENGTH /* @min:%2elength */]) {\r\n var parts = strTrim(theValue)[_DYN_SPLIT /* @min:%2esplit */](\";\");\r\n arrForEach(parts, function (thePart) {\r\n thePart = strTrim(thePart || STR_EMPTY);\r\n if (thePart) {\r\n var idx = thePart[_DYN_INDEX_OF /* @min:%2eindexOf */](\"=\");\r\n if (idx === -1) {\r\n values[thePart] = null;\r\n }\r\n else {\r\n values[strTrim(thePart[_DYN_SUBSTRING /* @min:%2esubstring */](0, idx))] = strTrim(thePart[_DYN_SUBSTRING /* @min:%2esubstring */](idx + 1));\r\n }\r\n }\r\n });\r\n }\r\n return values;\r\n}\r\nfunction _formatDate(theDate, func) {\r\n if (isFunction(theDate[func])) {\r\n return theDate[func]();\r\n }\r\n return null;\r\n}\r\nfunction _formatCookieValue(value, values) {\r\n var cookieValue = value || STR_EMPTY;\r\n objForEachKey(values, function (name, theValue) {\r\n cookieValue += \"; \" + name + (!isNullOrUndefined(theValue) ? \"=\" + theValue : STR_EMPTY);\r\n });\r\n return cookieValue;\r\n}\r\nfunction _getCookieValue(name) {\r\n var cookieValue = STR_EMPTY;\r\n if (_doc) {\r\n var theCookie = _doc[strCookie] || STR_EMPTY;\r\n if (_parsedCookieValue !== theCookie) {\r\n _cookieCache = _extractParts(theCookie);\r\n _parsedCookieValue = theCookie;\r\n }\r\n cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);\r\n }\r\n return cookieValue;\r\n}\r\nfunction _setCookieValue(name, cookieValue) {\r\n if (_doc) {\r\n _doc[strCookie] = name + \"=\" + cookieValue;\r\n }\r\n}\r\nexport function uaDisallowsSameSiteNone(userAgent) {\r\n if (!isString(userAgent)) {\r\n return false;\r\n }\r\n // Cover all iOS based browsers here. This includes:\r\n // - Safari on iOS 12 for iPhone, iPod Touch, iPad\r\n // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad\r\n // - Chrome on iOS 12 for iPhone, iPod Touch, iPad\r\n // All of which are broken by SameSite=None, because they use the iOS networking stack\r\n if (strContains(userAgent, \"CPU iPhone OS 12\") || strContains(userAgent, \"iPad; CPU OS 12\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes:\r\n // - Safari on Mac OS X\r\n // This does not include:\r\n // - Internal browser on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strContains(userAgent, \"Version/\") && strContains(userAgent, \"Safari\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X internal browsers that use the Mac OS networking stack. This includes:\r\n // - Internal browser on Mac OS X\r\n // This does not include:\r\n // - Safari on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strEndsWith(userAgent, \"AppleWebKit/605.1.15 (KHTML, like Gecko)\")) {\r\n return true;\r\n }\r\n // Cover Chrome 50-69, because some versions are broken by SameSite=None, and none in this range require it.\r\n // Note: this covers some pre-Chromium Edge versions, but pre-Chromim Edge does not require SameSite=None, so this is fine.\r\n // Note: this regex applies to Windows, Mac OS X, and Linux, deliberately.\r\n if (strContains(userAgent, \"Chrome/5\") || strContains(userAgent, \"Chrome/6\")) {\r\n return true;\r\n }\r\n // Unreal Engine runs Chromium 59, but does not advertise as Chrome until 4.23. Treat versions of Unreal\r\n // that don't specify their Chrome version as lacking support for SameSite=None.\r\n if (strContains(userAgent, \"UnrealEngine\") && !strContains(userAgent, \"Chrome\")) {\r\n return true;\r\n }\r\n // UCBrowser < 12.13.2 ignores Set-Cookie headers with SameSite=None\r\n // NB: this rule isn't complete - you need regex to make a complete rule.\r\n // See: https://www.chromium.org/updates/same-site/incompatible-clients\r\n if (strContains(userAgent, \"UCBrowser/12\") || strContains(userAgent, \"UCBrowser/11\")) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=CookieMgr.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { _DYN_HANDLER, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_REPLACE, _DYN_SPLICE, _DYN_SPLIT, _DYN_TYPE } from \"../__DynamicConstants\";\r\nimport { createElmNodeData, createUniqueNamespace } from \"./DataCacheHelper\";\r\nimport { getDocument, getWindow } from \"./EnvUtils\";\r\nimport { arrForEach, arrIndexOf, isArray, objForEachKey, objKeys } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// Added to help with minfication\r\nvar strOnPrefix = \"on\";\r\nvar strAttachEvent = \"attachEvent\";\r\nvar strAddEventHelper = \"addEventListener\";\r\nvar strDetachEvent = \"detachEvent\";\r\nvar strRemoveEventListener = \"removeEventListener\";\r\nvar strEvents = \"events\";\r\nvar strVisibilityChangeEvt = \"visibilitychange\";\r\nvar strPageHide = \"pagehide\";\r\nvar strPageShow = \"pageshow\";\r\nvar strUnload = \"unload\";\r\nvar strBeforeUnload = \"beforeunload\";\r\nvar strPageHideNamespace = createUniqueNamespace(\"aiEvtPageHide\");\r\nvar strPageShowNamespace = createUniqueNamespace(\"aiEvtPageShow\");\r\nvar rRemoveEmptyNs = /\\.[\\.]+/g;\r\nvar rRemoveTrailingEmptyNs = /[\\.]+$/;\r\nvar _guid = 1;\r\nvar elmNodeData = createElmNodeData(\"events\");\r\nvar eventNamespace = /^([^.]*)(?:\\.(.+)|)/;\r\nfunction _normalizeNamespace(name) {\r\n if (name && name[_DYN_REPLACE /* @min:%2ereplace */]) {\r\n return name[_DYN_REPLACE /* @min:%2ereplace */](/^[\\s\\.]+|(?=[\\s\\.])[\\.\\s]+$/g, STR_EMPTY);\r\n }\r\n return name;\r\n}\r\nfunction _getEvtNamespace(eventName, evtNamespace) {\r\n var _a;\r\n if (evtNamespace) {\r\n var theNamespace_1 = STR_EMPTY;\r\n if (isArray(evtNamespace)) {\r\n theNamespace_1 = STR_EMPTY;\r\n arrForEach(evtNamespace, function (name) {\r\n name = _normalizeNamespace(name);\r\n if (name) {\r\n if (name[0] !== \".\") {\r\n name = \".\" + name;\r\n }\r\n theNamespace_1 += name;\r\n }\r\n });\r\n }\r\n else {\r\n theNamespace_1 = _normalizeNamespace(evtNamespace);\r\n }\r\n if (theNamespace_1) {\r\n if (theNamespace_1[0] !== \".\") {\r\n theNamespace_1 = \".\" + theNamespace_1;\r\n }\r\n // We may only have the namespace and not an eventName\r\n eventName = (eventName || STR_EMPTY) + theNamespace_1;\r\n }\r\n }\r\n var parsedEvent = (eventNamespace.exec(eventName || STR_EMPTY) || []);\r\n return _a = {},\r\n _a[_DYN_TYPE /* @min:type */] = parsedEvent[1],\r\n _a.ns = ((parsedEvent[2] || STR_EMPTY).replace(rRemoveEmptyNs, \".\").replace(rRemoveTrailingEmptyNs, STR_EMPTY)[_DYN_SPLIT /* @min:%2esplit */](\".\").sort()).join(\".\"),\r\n _a;\r\n}\r\n/**\r\n * Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by\r\n * applications to remove their own events\r\n * @param target - The EventTarget that has registered events\r\n * @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n */\r\nexport function __getRegisteredEvents(target, eventName, evtNamespace) {\r\n var theEvents = [];\r\n var eventCache = elmNodeData.get(target, strEvents, {}, false);\r\n var evtName = _getEvtNamespace(eventName, evtNamespace);\r\n objForEachKey(eventCache, function (evtType, registeredEvents) {\r\n arrForEach(registeredEvents, function (value) {\r\n var _a;\r\n if (!evtName[_DYN_TYPE /* @min:%2etype */] || evtName[_DYN_TYPE /* @min:%2etype */] === value.evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n if (!evtName.ns || evtName.ns === evtName.ns) {\r\n theEvents[_DYN_PUSH /* @min:%2epush */]((_a = {},\r\n _a[_DYN_NAME /* @min:name */] = value.evtName[_DYN_TYPE /* @min:%2etype */] + (value.evtName.ns ? \".\" + value.evtName.ns : STR_EMPTY),\r\n _a.handler = value[_DYN_HANDLER /* @min:%2ehandler */],\r\n _a));\r\n }\r\n }\r\n });\r\n });\r\n return theEvents;\r\n}\r\n// Exported for internal unit testing only\r\nfunction _getRegisteredEvents(target, evtName, addDefault) {\r\n if (addDefault === void 0) { addDefault = true; }\r\n var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);\r\n var registeredEvents = aiEvts[evtName];\r\n if (!registeredEvents) {\r\n registeredEvents = aiEvts[evtName] = [];\r\n }\r\n return registeredEvents;\r\n}\r\nfunction _doDetach(obj, evtName, handlerRef, useCapture) {\r\n if (obj && evtName && evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n if (obj[strRemoveEventListener]) {\r\n obj[strRemoveEventListener](evtName[_DYN_TYPE /* @min:%2etype */], handlerRef, useCapture);\r\n }\r\n else if (obj[strDetachEvent]) {\r\n obj[strDetachEvent](strOnPrefix + evtName[_DYN_TYPE /* @min:%2etype */], handlerRef);\r\n }\r\n }\r\n}\r\nfunction _doAttach(obj, evtName, handlerRef, useCapture) {\r\n var result = false;\r\n if (obj && evtName && evtName[_DYN_TYPE /* @min:%2etype */] && handlerRef) {\r\n if (obj[strAddEventHelper]) {\r\n // all browsers except IE before version 9\r\n obj[strAddEventHelper](evtName[_DYN_TYPE /* @min:%2etype */], handlerRef, useCapture);\r\n result = true;\r\n }\r\n else if (obj[strAttachEvent]) {\r\n // IE before version 9\r\n obj[strAttachEvent](strOnPrefix + evtName[_DYN_TYPE /* @min:%2etype */], handlerRef);\r\n result = true;\r\n }\r\n }\r\n return result;\r\n}\r\nfunction _doUnregister(target, events, evtName, unRegFn) {\r\n var idx = events[_DYN_LENGTH /* @min:%2elength */];\r\n while (idx--) {\r\n var theEvent = events[idx];\r\n if (theEvent) {\r\n if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {\r\n if (!unRegFn || unRegFn(theEvent)) {\r\n _doDetach(target, theEvent.evtName, theEvent[_DYN_HANDLER /* @min:%2ehandler */], theEvent.capture);\r\n // Remove the registered event\r\n events[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\nfunction _unregisterEvents(target, evtName, unRegFn) {\r\n if (evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n _doUnregister(target, _getRegisteredEvents(target, evtName[_DYN_TYPE /* @min:%2etype */]), evtName, unRegFn);\r\n }\r\n else {\r\n var eventCache = elmNodeData.get(target, strEvents, {});\r\n objForEachKey(eventCache, function (evtType, events) {\r\n _doUnregister(target, events, evtName, unRegFn);\r\n });\r\n // Cleanup\r\n if (objKeys(eventCache)[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n elmNodeData.kill(target, strEvents);\r\n }\r\n }\r\n}\r\nexport function mergeEvtNamespace(theNamespace, namespaces) {\r\n var newNamespaces;\r\n if (namespaces) {\r\n if (isArray(namespaces)) {\r\n newNamespaces = [theNamespace].concat(namespaces);\r\n }\r\n else {\r\n newNamespaces = [theNamespace, namespaces];\r\n }\r\n // resort the namespaces so they are always in order\r\n newNamespaces = (_getEvtNamespace(\"xx\", newNamespaces).ns)[_DYN_SPLIT /* @min:%2esplit */](\".\");\r\n }\r\n else {\r\n newNamespaces = theNamespace;\r\n }\r\n return newNamespaces;\r\n}\r\n/**\r\n * Binds the specified function to an event, so that the function gets called whenever the event fires on the object\r\n * @param obj Object to add the event too.\r\n * @param eventName String that specifies any of the standard DHTML Events without \"on\" prefix, if may also include an optional (dot \".\" prefixed)\r\n * namespaces \"click\" \"click.mynamespace\" in addition to specific namespaces.\r\n * @param handlerRef Pointer that specifies the function to call when event fires\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n * @param useCapture [Optional] Defaults to false\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\nexport function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {\r\n var _a;\r\n if (useCapture === void 0) { useCapture = false; }\r\n var result = false;\r\n if (target) {\r\n try {\r\n var evtName = _getEvtNamespace(eventName, evtNamespace);\r\n result = _doAttach(target, evtName, handlerRef, useCapture);\r\n if (result && elmNodeData.accept(target)) {\r\n var registeredEvent = (_a = {\r\n guid: _guid++,\r\n evtName: evtName\r\n },\r\n _a[_DYN_HANDLER /* @min:handler */] = handlerRef,\r\n _a.capture = useCapture,\r\n _a);\r\n _getRegisteredEvents(target, evtName.type)[_DYN_PUSH /* @min:%2epush */](registeredEvent);\r\n }\r\n }\r\n catch (e) {\r\n // Just Ignore any error so that we don't break any execution path\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Removes an event handler for the specified event\r\n * @param Object to remove the event from\r\n * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n * @param useCapture [Optional] Defaults to false\r\n */\r\nexport function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n if (target) {\r\n try {\r\n var evtName_1 = _getEvtNamespace(eventName, evtNamespace);\r\n var found_1 = false;\r\n _unregisterEvents(target, evtName_1, function (regEvent) {\r\n if ((evtName_1.ns && !handlerRef) || regEvent[_DYN_HANDLER /* @min:%2ehandler */] === handlerRef) {\r\n found_1 = true;\r\n return true;\r\n }\r\n return false;\r\n });\r\n if (!found_1) {\r\n // fallback to try and remove as requested\r\n _doDetach(target, evtName_1, handlerRef, useCapture);\r\n }\r\n }\r\n catch (e) {\r\n // Just Ignore any error so that we don't break any execution path\r\n }\r\n }\r\n}\r\n/**\r\n * Binds the specified function to an event, so that the function gets called whenever the event fires on the object\r\n * @param obj Object to add the event too.\r\n * @param eventNameWithoutOn String that specifies any of the standard DHTML Events without \"on\" prefix and optional (dot \".\" prefixed) namespaces \"click\" \"click.mynamespace\".\r\n * @param handlerRef Pointer that specifies the function to call when event fires\r\n * @param useCapture [Optional] Defaults to false\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\nexport function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);\r\n}\r\n/**\r\n * Removes an event handler for the specified event\r\n * @param Object to remove the event from\r\n * @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param useCapture [Optional] Defaults to false\r\n */\r\nexport function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);\r\n}\r\n/**\r\n * Trys to add an event handler for the specified event to the window, body and document\r\n * @param eventName {string} - The name of the event\r\n * @param callback {any} - The callback function that needs to be executed for the given event\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @return {boolean} - true if the handler was successfully added\r\n */\r\nexport function addEventHandler(eventName, callback, evtNamespace) {\r\n var result = false;\r\n var w = getWindow();\r\n if (w) {\r\n result = eventOn(w, eventName, callback, evtNamespace);\r\n result = eventOn(w[\"body\"], eventName, callback, evtNamespace) || result;\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n result = eventOn(doc, eventName, callback, evtNamespace) || result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Trys to remove event handler(s) for the specified event/namespace to the window, body and document\r\n * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param callback {any} - - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n */\r\nexport function removeEventHandler(eventName, callback, evtNamespace) {\r\n var w = getWindow();\r\n if (w) {\r\n eventOff(w, eventName, callback, evtNamespace);\r\n eventOff(w[\"body\"], eventName, callback, evtNamespace);\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n eventOff(doc, eventName, callback, evtNamespace);\r\n }\r\n}\r\n/**\r\n * Bind the listener to the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nfunction _addEventListeners(events, listener, excludeEvents, evtNamespace) {\r\n var added = false;\r\n if (listener && events && events[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(events, function (name) {\r\n if (name) {\r\n if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {\r\n added = addEventHandler(name, listener, evtNamespace) || added;\r\n }\r\n }\r\n });\r\n }\r\n return added;\r\n}\r\n/**\r\n * Bind the listener to the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addEventListeners(events, listener, excludeEvents, evtNamespace) {\r\n var added = false;\r\n if (listener && events && isArray(events)) {\r\n added = _addEventListeners(events, listener, excludeEvents, evtNamespace);\r\n if (!added && excludeEvents && excludeEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Failed to add any listeners and we excluded some, so just attempt to add the excluded events\r\n added = _addEventListeners(events, listener, null, evtNamespace);\r\n }\r\n }\r\n return added;\r\n}\r\n/**\r\n * Remove the listener from the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n */\r\nexport function removeEventListeners(events, listener, evtNamespace) {\r\n if (events && isArray(events)) {\r\n arrForEach(events, function (name) {\r\n if (name) {\r\n removeEventHandler(name, listener, evtNamespace);\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,\r\n * this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden\r\n * it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is\r\n * just navigating to a different Tab and may come back (without unloading the page). As such you may also\r\n * need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.\r\n * @param listener - The event callback to call when a page unload event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {\r\n // Hook the unload event for the document, window and body to ensure that the client events are flushed to the server\r\n // As just hooking the window does not always fire (on chrome) for page navigation's.\r\n return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);\r\n}\r\n/**\r\n * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,\r\n * addEventListeners, addPageUnloadEventListener or addPageHideEventListener.\r\n * @param listener - The specific event callback to to be removed\r\n * @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function removePageUnloadEventListener(listener, evtNamespace) {\r\n removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);\r\n}\r\n/**\r\n * Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call\r\n * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The event callback to call when a page hide event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed\r\n * based on this namespace. This call also adds an additional unique \"pageshow\" namespace to the events\r\n * so that only the matching \"removePageHideEventListener\" can remove these events.\r\n * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageHideEventListener(listener, excludeEvents, evtNamespace) {\r\n function _handlePageVisibility(evt) {\r\n var doc = getDocument();\r\n if (listener && doc && doc.visibilityState === \"hidden\") {\r\n listener(evt);\r\n }\r\n }\r\n // add the unique page show namespace to any provided namespace so we can only remove the ones added by \"pagehide\"\r\n var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);\r\n var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);\r\n if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {\r\n pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;\r\n }\r\n if (!pageUnloadAdded && excludeEvents) {\r\n // Failed to add any listeners and we where requested to exclude some, so just call again without excluding anything\r\n pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);\r\n }\r\n return pageUnloadAdded;\r\n}\r\n/**\r\n * Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener\r\n * as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\r\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\r\n */\r\nexport function removePageHideEventListener(listener, evtNamespace) {\r\n // add the unique page show namespace to any provided namespace so we only remove the ones added by \"pagehide\"\r\n var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);\r\n removeEventListeners([strPageHide], listener, newNamespaces);\r\n removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);\r\n}\r\n/**\r\n * Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call\r\n * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The event callback to call when a page is show event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely\r\n * identified and removed based on this namespace. This call also adds an additional unique \"pageshow\" namespace to the events\r\n * so that only the matching \"removePageShowEventListener\" can remove these events.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageShowEventListener(listener, excludeEvents, evtNamespace) {\r\n function _handlePageVisibility(evt) {\r\n var doc = getDocument();\r\n if (listener && doc && doc.visibilityState === \"visible\") {\r\n listener(evt);\r\n }\r\n }\r\n // add the unique page show namespace to any provided namespace so we can only remove the ones added by \"pageshow\"\r\n var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);\r\n var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);\r\n pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;\r\n if (!pageShowAdded && excludeEvents) {\r\n // Failed to add any listeners and we where requested to exclude some, so just call again without excluding anything\r\n pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);\r\n }\r\n return pageShowAdded;\r\n}\r\n/**\r\n * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener\r\n * as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\r\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\r\n */\r\nexport function removePageShowEventListener(listener, evtNamespace) {\r\n // add the unique page show namespace to any provided namespace so we only remove the ones added by \"pageshow\"\r\n var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);\r\n removeEventListeners([strPageShow], listener, newNamespaces);\r\n removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);\r\n}\r\n//# sourceMappingURL=EventHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { objCreateFn, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { _DYN_LENGTH, _DYN_PUSH, _DYN_SET_ENABLED, _DYN_SUBSTR, _DYN_SUBSTRING } from \"../__DynamicConstants\";\r\nimport { _gblCookieMgr } from \"./CookieMgr\";\r\nimport { getPerformance, isIE } from \"./EnvUtils\";\r\nimport { addEventHandler, attachEvent, detachEvent } from \"./EventHelpers\";\r\nimport { arrForEach, arrIndexOf, arrMap, arrReduce, dateNow, hasOwnProperty, isArray, isBoolean, isDate, isError, isFunction, isNullOrUndefined, isNumber, isObject, isString, isTypeof, isUndefined, objDefineAccessors, objKeys, strTrim, toISOString } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { mwcRandom32, mwcRandomSeed, newId, random32, randomValue } from \"./RandomHelper\";\r\nvar _cookieMgrs = null;\r\nvar _canUseCookies; // legacy supported config\r\n// Added to help with minfication\r\nexport var Undefined = strShimUndefined;\r\nexport function newGuid() {\r\n var uuid = generateW3CId();\r\n return uuid[_DYN_SUBSTRING /* @min:%2esubstring */](0, 8) + \"-\" + uuid[_DYN_SUBSTRING /* @min:%2esubstring */](8, 12) + \"-\" + uuid[_DYN_SUBSTRING /* @min:%2esubstring */](12, 16) + \"-\" + uuid[_DYN_SUBSTRING /* @min:%2esubstring */](16, 20) + \"-\" + uuid[_DYN_SUBSTRING /* @min:%2esubstring */](20);\r\n}\r\n/**\r\n * Return the current value of the Performance Api now() function (if available) and fallback to dateNow() if it is unavailable (IE9 or less)\r\n * https://caniuse.com/#search=performance.now\r\n */\r\nexport function perfNow() {\r\n var perf = getPerformance();\r\n if (perf && perf.now) {\r\n return perf.now();\r\n }\r\n return dateNow();\r\n}\r\n/**\r\n * The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function strEndsWith(value, search) {\r\n if (value && search) {\r\n var len = value[_DYN_LENGTH /* @min:%2elength */];\r\n var start = len - search[_DYN_LENGTH /* @min:%2elength */];\r\n return value[_DYN_SUBSTRING /* @min:%2esubstring */](start >= 0 ? start : 0, len) === search;\r\n }\r\n return false;\r\n}\r\n/**\r\n * generate W3C trace id\r\n */\r\nexport function generateW3CId() {\r\n var hexValues = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\r\n // rfc4122 version 4 UUID without dashes and with lowercase letters\r\n var oct = STR_EMPTY, tmp;\r\n for (var a = 0; a < 4; a++) {\r\n tmp = random32();\r\n oct +=\r\n hexValues[tmp & 0xF] +\r\n hexValues[tmp >> 4 & 0xF] +\r\n hexValues[tmp >> 8 & 0xF] +\r\n hexValues[tmp >> 12 & 0xF] +\r\n hexValues[tmp >> 16 & 0xF] +\r\n hexValues[tmp >> 20 & 0xF] +\r\n hexValues[tmp >> 24 & 0xF] +\r\n hexValues[tmp >> 28 & 0xF];\r\n }\r\n // \"Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively\"\r\n var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];\r\n return oct[_DYN_SUBSTR /* @min:%2esubstr */](0, 8) + oct[_DYN_SUBSTR /* @min:%2esubstr */](9, 4) + \"4\" + oct[_DYN_SUBSTR /* @min:%2esubstr */](13, 3) + clockSequenceHi + oct[_DYN_SUBSTR /* @min:%2esubstr */](16, 3) + oct[_DYN_SUBSTR /* @min:%2esubstr */](19, 12);\r\n}\r\n/**\r\n * Provides a collection of utility functions, included for backward compatibility with previous releases.\r\n * @deprecated Marking this instance as deprecated in favor of direct usage of the helper functions\r\n * as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items\r\n * in your resulting code.\r\n */\r\nexport var CoreUtils = {\r\n _canUseCookies: undefined,\r\n isTypeof: isTypeof,\r\n isUndefined: isUndefined,\r\n isNullOrUndefined: isNullOrUndefined,\r\n hasOwnProperty: hasOwnProperty,\r\n isFunction: isFunction,\r\n isObject: isObject,\r\n isDate: isDate,\r\n isArray: isArray,\r\n isError: isError,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isBoolean: isBoolean,\r\n toISOString: toISOString,\r\n arrForEach: arrForEach,\r\n arrIndexOf: arrIndexOf,\r\n arrMap: arrMap,\r\n arrReduce: arrReduce,\r\n strTrim: strTrim,\r\n objCreate: objCreateFn,\r\n objKeys: objKeys,\r\n objDefineAccessors: objDefineAccessors,\r\n addEventHandler: addEventHandler,\r\n dateNow: dateNow,\r\n isIE: isIE,\r\n disableCookies: disableCookies,\r\n newGuid: newGuid,\r\n perfNow: perfNow,\r\n newId: newId,\r\n randomValue: randomValue,\r\n random32: random32,\r\n mwcRandomSeed: mwcRandomSeed,\r\n mwcRandom32: mwcRandom32,\r\n generateW3CId: generateW3CId\r\n};\r\nvar GuidRegex = /[xy]/g;\r\nexport var EventHelper = {\r\n Attach: attachEvent,\r\n AttachEvent: attachEvent,\r\n Detach: detachEvent,\r\n DetachEvent: detachEvent\r\n};\r\n/**\r\n * Helper to support backward compatibility for users that use the legacy cookie handling functions and the use the internal\r\n * CoreUtils._canUseCookies global flag to enable/disable cookies usage.\r\n * Note: This has the following deliberate side-effects\r\n * - Creates the global (legacy) cookie manager if it does not already exist\r\n * - Attempts to add \"listeners\" to the CoreUtils._canUseCookies property to support the legacy usage\r\n * @param config\r\n * @param logger\r\n * @returns\r\n */\r\nexport function _legacyCookieMgr(config, logger) {\r\n var cookieMgr = _gblCookieMgr(config, logger);\r\n var legacyCanUseCookies = CoreUtils._canUseCookies;\r\n if (_cookieMgrs === null) {\r\n _cookieMgrs = [];\r\n _canUseCookies = legacyCanUseCookies;\r\n // Dynamically create get/set property accessors for backward compatibility for enabling / disabling cookies\r\n // this WILL NOT work for ES3 browsers (< IE8)\r\n objDefineAccessors(CoreUtils, \"_canUseCookies\", function () {\r\n return _canUseCookies;\r\n }, function (value) {\r\n _canUseCookies = value;\r\n arrForEach(_cookieMgrs, function (mgr) {\r\n mgr[_DYN_SET_ENABLED /* @min:%2esetEnabled */](value);\r\n });\r\n });\r\n }\r\n if (arrIndexOf(_cookieMgrs, cookieMgr) === -1) {\r\n _cookieMgrs[_DYN_PUSH /* @min:%2epush */](cookieMgr);\r\n }\r\n if (isBoolean(legacyCanUseCookies)) {\r\n cookieMgr[_DYN_SET_ENABLED /* @min:%2esetEnabled */](legacyCanUseCookies);\r\n }\r\n if (isBoolean(_canUseCookies)) {\r\n cookieMgr[_DYN_SET_ENABLED /* @min:%2esetEnabled */](_canUseCookies);\r\n }\r\n return cookieMgr;\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().disable()\r\n * Force the SDK not to store and read any data from cookies.\r\n */\r\nexport function disableCookies() {\r\n _legacyCookieMgr()[_DYN_SET_ENABLED /* @min:%2esetEnabled */](false);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().isEnabled()\r\n * Helper method to tell if document.cookie object is available and whether it can be used.\r\n */\r\nexport function canUseCookies(logger) {\r\n return _legacyCookieMgr(null, logger).isEnabled();\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().get()\r\n * helper method to access userId and sessionId cookie\r\n */\r\nexport function getCookie(logger, name) {\r\n return _legacyCookieMgr(null, logger).get(name);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().set()\r\n * helper method to set userId and sessionId cookie\r\n */\r\nexport function setCookie(logger, name, value, domain) {\r\n _legacyCookieMgr(null, logger).set(name, value, null, domain);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().del()\r\n * Deletes a cookie by setting it's expiration time in the past.\r\n * @param name - The name of the cookie to delete.\r\n */\r\nexport function deleteCookie(logger, name) {\r\n return _legacyCookieMgr(null, logger).del(name);\r\n}\r\n//# sourceMappingURL=CoreUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { _DYN_CALL, _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_INITIALIZE, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_SPAN_ID, _DYN_TEARDOWN, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { createElmNodeData } from \"./DataCacheHelper\";\r\nimport { arrForEach, isFunction } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { isValidSpanId, isValidTraceId } from \"./W3cTraceParent\";\r\nvar pluginStateData = createElmNodeData(\"plugin\");\r\nexport function _getPluginState(plugin) {\r\n return pluginStateData.get(plugin, \"state\", {}, true);\r\n}\r\n/**\r\n * Initialize the queue of plugins\r\n * @param plugins - The array of plugins to initialize and setting of the next plugin\r\n * @param config The current config for the instance\r\n * @param core THe current core instance\r\n * @param extensions The extensions\r\n */\r\nexport function initializePlugins(processContext, extensions) {\r\n // Set the next plugin and identified the uninitialized plugins\r\n var initPlugins = [];\r\n var lastPlugin = null;\r\n var proxy = processContext[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n var pluginState;\r\n while (proxy) {\r\n var thePlugin = proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (thePlugin) {\r\n if (lastPlugin &&\r\n isFunction(lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */]) &&\r\n isFunction(thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](thePlugin);\r\n }\r\n var isInitialized = false;\r\n if (isFunction(thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */])) {\r\n isInitialized = thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]();\r\n }\r\n else {\r\n pluginState = _getPluginState(thePlugin);\r\n isInitialized = pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */];\r\n }\r\n if (!isInitialized) {\r\n initPlugins[_DYN_PUSH /* @min:%2epush */](thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n }\r\n // Now initialize the plugins\r\n arrForEach(initPlugins, function (thePlugin) {\r\n var core = processContext[STR_CORE]();\r\n thePlugin[_DYN_INITIALIZE /* @min:%2einitialize */](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n pluginState = _getPluginState(thePlugin);\r\n // Only add the core to the state if the plugin didn't set it (doesn't extent from BaseTelemetryPlugin)\r\n if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {\r\n pluginState[STR_CORE] = core;\r\n }\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = true;\r\n delete pluginState[_DYN_TEARDOWN /* @min:%2eteardown */];\r\n });\r\n}\r\nexport function sortPlugins(plugins) {\r\n // Sort by priority\r\n return plugins.sort(function (extA, extB) {\r\n var result = 0;\r\n if (extB) {\r\n var bHasProcess = isFunction(extB[STR_PROCESS_TELEMETRY]);\r\n if (isFunction(extA[STR_PROCESS_TELEMETRY])) {\r\n result = bHasProcess ? extA[STR_PRIORITY] - extB[STR_PRIORITY] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n }\r\n else {\r\n result = extA ? 1 : -1;\r\n }\r\n return result;\r\n });\r\n // sort complete\r\n}\r\n/**\r\n * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any\r\n * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.\r\n * @param components - The components you want to unload\r\n * @param unloadCtx - This is the context that should be used during unloading.\r\n * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.\r\n * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.\r\n * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.\r\n */\r\nexport function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {\r\n var idx = 0;\r\n function _doUnload() {\r\n while (idx < components[_DYN_LENGTH /* @min:%2elength */]) {\r\n var component = components[idx++];\r\n if (component) {\r\n var func = component._doUnload || component[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */];\r\n if (isFunction(func)) {\r\n if (func[_DYN_CALL /* @min:%2ecall */](component, unloadCtx, unloadState, _doUnload) === true) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return _doUnload();\r\n}\r\n/**\r\n * Creates a IDistributedTraceContext which optionally also \"sets\" the value on a parent\r\n * @param parentCtx - An optional parent distributed trace instance\r\n * @returns A new IDistributedTraceContext instance that uses an internal temporary object\r\n */\r\nexport function createDistributedTraceContext(parentCtx) {\r\n var trace = {};\r\n return {\r\n getName: function () {\r\n return trace[_DYN_NAME /* @min:%2ename */];\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace[_DYN_NAME /* @min:%2ename */] = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace[_DYN_TRACE_ID /* @min:%2etraceId */];\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace[_DYN_TRACE_ID /* @min:%2etraceId */] = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace[_DYN_SPAN_ID /* @min:%2espanId */];\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace[_DYN_SPAN_ID /* @min:%2espanId */] = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */];\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { _DYN_CALL, _DYN_CONFIG, _DYN_CREATE_NEW, _DYN_DIAG_LOG, _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_IDENTIFIER, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_UPDATE } from \"../__DynamicConstants\";\r\nimport { _throwInternal, safeGetLogger } from \"./DiagnosticLogger\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nimport { arrForEach, isArray, isFunction, isNullOrUndefined, isObject, isUndefined, objExtend, objForEachKey, objFreeze, objKeys, proxyFunctions } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_DISABLED, STR_EMPTY, STR_EXTENSION_CONFIG, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { _getPluginState } from \"./TelemetryHelpers\";\r\nvar strTelemetryPluginChain = \"TelemetryPluginChain\";\r\nvar strHasRunFlags = \"_hasRun\";\r\nvar strGetTelCtx = \"_getTelCtx\";\r\nvar _chainId = 0;\r\nfunction _getNextProxyStart(proxy, core, startAt) {\r\n while (proxy) {\r\n if (proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]() === startAt) {\r\n return proxy;\r\n }\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n // This wasn't found in the existing chain so create an isolated one with just this plugin\r\n return createTelemetryProxyChain([startAt], core[_DYN_CONFIG /* @min:%2econfig */] || {}, core);\r\n}\r\n/**\r\n * @ignore\r\n * @param telemetryChain\r\n * @param config\r\n * @param core\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n * @returns\r\n */\r\nfunction _createInternalContext(telemetryChain, config, core, startAt) {\r\n // We have a special case where we want to start execution from this specific plugin\r\n // or we simply reuse the existing telemetry plugin chain (normal execution case)\r\n var _nextProxy = null; // By Default set as no next plugin\r\n var _onComplete = [];\r\n if (startAt !== null) {\r\n // There is no next element (null) vs not defined (undefined) so use the full chain\r\n _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;\r\n }\r\n var context = {\r\n _next: _moveNext,\r\n ctx: {\r\n core: function () {\r\n return core;\r\n },\r\n diagLog: function () {\r\n return safeGetLogger(core, config);\r\n },\r\n getCfg: function () {\r\n return config;\r\n },\r\n getExtCfg: _getExtCfg,\r\n getConfig: _getConfig,\r\n hasNext: function () {\r\n return !!_nextProxy;\r\n },\r\n getNext: function () {\r\n return _nextProxy;\r\n },\r\n setNext: function (nextPlugin) {\r\n _nextProxy = nextPlugin;\r\n },\r\n iterate: _iterateChain,\r\n onComplete: _addOnComplete\r\n }\r\n };\r\n function _addOnComplete(onComplete, that) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n if (onComplete) {\r\n _onComplete[_DYN_PUSH /* @min:%2epush */]({\r\n func: onComplete,\r\n self: !isUndefined(that) ? that : context.ctx,\r\n args: args\r\n });\r\n }\r\n }\r\n function _moveNext() {\r\n var nextProxy = _nextProxy;\r\n // Automatically move to the next plugin\r\n _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT /* @min:%2egetNext */]() : null;\r\n if (!nextProxy) {\r\n var onComplete = _onComplete;\r\n if (onComplete && onComplete[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(onComplete, function (completeDetails) {\r\n try {\r\n completeDetails.func[_DYN_CALL /* @min:%2ecall */](completeDetails.self, completeDetails.args);\r\n }\r\n catch (e) {\r\n _throwInternal(core[_DYN_LOGGER /* @min:%2elogger */], 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected Exception during onComplete - \" + dumpObj(e));\r\n }\r\n });\r\n _onComplete = [];\r\n }\r\n }\r\n return nextProxy;\r\n }\r\n function _getExtCfg(identifier, defaultValue, mergeDefault) {\r\n if (defaultValue === void 0) { defaultValue = {}; }\r\n if (mergeDefault === void 0) { mergeDefault = 0 /* GetExtCfgMergeType.None */; }\r\n var theConfig;\r\n if (config) {\r\n var extConfig = config[STR_EXTENSION_CONFIG /* @min:%2eextensionConfig */];\r\n if (extConfig && identifier) {\r\n theConfig = extConfig[identifier];\r\n }\r\n }\r\n if (!theConfig) {\r\n // Just use the defaults\r\n theConfig = defaultValue;\r\n }\r\n else if (isObject(defaultValue)) {\r\n if (mergeDefault !== 0 /* GetExtCfgMergeType.None */) {\r\n // Merge the defaults and configured values\r\n var newConfig_1 = objExtend(true, defaultValue, theConfig);\r\n if (config && mergeDefault === 2 /* GetExtCfgMergeType.MergeDefaultFromRootOrDefault */) {\r\n // Enumerate over the defaultValues and if not already populated attempt to\r\n // find a value from the root config\r\n objForEachKey(defaultValue, function (field) {\r\n // for each unspecified field, set the default value\r\n if (isNullOrUndefined(newConfig_1[field])) {\r\n var cfgValue = config[field];\r\n if (!isNullOrUndefined(cfgValue)) {\r\n newConfig_1[field] = cfgValue;\r\n }\r\n }\r\n });\r\n }\r\n theConfig = newConfig_1;\r\n }\r\n }\r\n return theConfig;\r\n }\r\n function _getConfig(identifier, field, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n var theValue;\r\n var extConfig = _getExtCfg(identifier, null);\r\n if (extConfig && !isNullOrUndefined(extConfig[field])) {\r\n theValue = extConfig[field];\r\n }\r\n else if (config && !isNullOrUndefined(config[field])) {\r\n theValue = config[field];\r\n }\r\n return !isNullOrUndefined(theValue) ? theValue : defaultValue;\r\n }\r\n function _iterateChain(cb) {\r\n // Keep processing until we reach the end of the chain\r\n var nextPlugin;\r\n while (!!(nextPlugin = context._next())) {\r\n var plugin = nextPlugin[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (plugin) {\r\n // callback with the current on\r\n cb(plugin);\r\n }\r\n }\r\n }\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryContext(telemetryChain, config, core, startAt) {\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(env) {\r\n var nextPlugin = internalContext._next();\r\n // Run the next plugin which will call \"processNext()\"\r\n nextPlugin && nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, context);\r\n return !nextPlugin;\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), config, core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for handling the unloading of the chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {\r\n var config = core[_DYN_CONFIG /* @min:%2econfig */] || {};\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(unloadState) {\r\n var nextPlugin = internalContext._next();\r\n nextPlugin && nextPlugin.unload(context, unloadState);\r\n return !nextPlugin;\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for updating the configuration\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {\r\n var config = core[_DYN_CONFIG /* @min:%2econfig */] || {};\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(updateState) {\r\n return context.iterate(function (plugin) {\r\n if (isFunction(plugin[_DYN_UPDATE /* @min:%2eupdate */])) {\r\n plugin[_DYN_UPDATE /* @min:%2eupdate */](context, updateState);\r\n }\r\n });\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates an execution chain from the array of plugins\r\n * @param plugins - The array of plugins that will be executed in this order\r\n * @param defItemCtx - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n */\r\nexport function createTelemetryProxyChain(plugins, config, core, startAt) {\r\n var firstProxy = null;\r\n var add = startAt ? false : true;\r\n if (isArray(plugins) && plugins[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Create the proxies and wire up the next plugin chain\r\n var lastProxy_1 = null;\r\n arrForEach(plugins, function (thePlugin) {\r\n if (!add && startAt === thePlugin) {\r\n add = true;\r\n }\r\n if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Only add plugins that are processors\r\n var newProxy = createTelemetryPluginProxy(thePlugin, config, core);\r\n if (!firstProxy) {\r\n firstProxy = newProxy;\r\n }\r\n if (lastProxy_1) {\r\n // Set this new proxy as the next for the previous one\r\n lastProxy_1._setNext(newProxy);\r\n }\r\n lastProxy_1 = newProxy;\r\n }\r\n });\r\n }\r\n if (startAt && !firstProxy) {\r\n // Special case where the \"startAt\" was not in the original list of plugins\r\n return createTelemetryProxyChain([startAt], config, core);\r\n }\r\n return firstProxy;\r\n}\r\n/**\r\n * Create the processing telemetry proxy instance, the proxy is used to abstract the current plugin to allow monitoring and\r\n * execution plugins while passing around the dynamic execution state (IProcessTelemetryContext), the proxy instance no longer\r\n * contains any execution state and can be reused between requests (this was not the case for 2.7.2 and earlier with the\r\n * TelemetryPluginChain class).\r\n * @param plugin - The plugin instance to proxy\r\n * @param config - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n * @returns\r\n */\r\nexport function createTelemetryPluginProxy(plugin, config, core) {\r\n var nextProxy = null;\r\n var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */]);\r\n var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */]);\r\n var chainId;\r\n if (plugin) {\r\n chainId = plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] + \"-\" + plugin[STR_PRIORITY /* @min:%2epriority */] + \"-\" + _chainId++;\r\n }\r\n else {\r\n chainId = \"Unknown-0-\" + _chainId++;\r\n }\r\n var proxyChain = {\r\n getPlugin: function () {\r\n return plugin;\r\n },\r\n getNext: function () {\r\n return nextProxy;\r\n },\r\n processTelemetry: _processTelemetry,\r\n unload: _unloadPlugin,\r\n update: _updatePlugin,\r\n _id: chainId,\r\n _setNext: function (nextPlugin) {\r\n nextProxy = nextPlugin;\r\n }\r\n };\r\n function _getTelCtx() {\r\n var itemCtx;\r\n // Looks like a plugin didn't pass the (optional) context, so create a new one\r\n if (plugin && isFunction(plugin[strGetTelCtx])) {\r\n // This plugin extends from the BaseTelemetryPlugin so lets use it\r\n itemCtx = plugin[strGetTelCtx]();\r\n }\r\n if (!itemCtx) {\r\n // Create a temporary one\r\n itemCtx = createProcessTelemetryContext(proxyChain, config, core);\r\n }\r\n return itemCtx;\r\n }\r\n function _processChain(itemCtx, processPluginFn, name, details, isAsync) {\r\n var hasRun = false;\r\n var identifier = plugin ? plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] : strTelemetryPluginChain;\r\n var hasRunContext = itemCtx[strHasRunFlags];\r\n if (!hasRunContext) {\r\n // Assign and populate\r\n hasRunContext = itemCtx[strHasRunFlags] = {};\r\n }\r\n // Ensure that we keep the context in sync\r\n itemCtx.setNext(nextProxy);\r\n if (plugin) {\r\n doPerf(itemCtx[STR_CORE /* @min:%2ecore */](), function () { return identifier + \":\" + name; }, function () {\r\n // Mark this component as having run\r\n hasRunContext[chainId] = true;\r\n try {\r\n // Set a flag on the next plugin so we know if it was attempted to be executed\r\n var nextId = nextProxy ? nextProxy._id : STR_EMPTY;\r\n if (nextId) {\r\n hasRunContext[nextId] = false;\r\n }\r\n hasRun = processPluginFn(itemCtx);\r\n }\r\n catch (error) {\r\n var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;\r\n if (hasNextRun) {\r\n // The next plugin after us has already run so set this one as complete\r\n hasRun = true;\r\n }\r\n if (!nextProxy || !hasNextRun) {\r\n // Either we have no next plugin or the current one did not attempt to call the next plugin\r\n // Which means the current one is the root of the failure so log/report this failure\r\n _throwInternal(itemCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, \"Plugin [\" + identifier + \"] failed during \" + name + \" - \" + dumpObj(error) + \", run flags: \" + dumpObj(hasRunContext));\r\n }\r\n }\r\n }, details, isAsync);\r\n }\r\n return hasRun;\r\n }\r\n function _processTelemetry(env, itemCtx) {\r\n itemCtx = itemCtx || _getTelCtx();\r\n function _callProcessTelemetry(itemCtx) {\r\n if (!plugin || !hasProcessTelemetry) {\r\n return false;\r\n }\r\n var pluginState = _getPluginState(plugin);\r\n if (pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] || pluginState[STR_DISABLED]) {\r\n return false;\r\n }\r\n // Ensure that we keep the context in sync (for processNext()), just in case a plugin\r\n // doesn't calls processTelemetry() instead of itemContext.processNext() or some\r\n // other form of error occurred\r\n if (hasSetNext) {\r\n // Backward compatibility setting the next plugin on the instance\r\n plugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](nextProxy);\r\n }\r\n plugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, itemCtx);\r\n // Process Telemetry is expected to call itemCtx.processNext() or nextPlugin.processTelemetry()\r\n return true;\r\n }\r\n if (!_processChain(itemCtx, _callProcessTelemetry, \"processTelemetry\", function () { return ({ item: env }); }, !(env.sync))) {\r\n // The underlying plugin is either not defined, not enabled or does not have a processTelemetry implementation\r\n // so we still want the next plugin to be executed.\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](env);\r\n }\r\n }\r\n function _unloadPlugin(unloadCtx, unloadState) {\r\n function _callTeardown() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE /* @min:%2ecore */];\r\n // Only teardown the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */]) {\r\n // Handle plugins that don't extend from the BaseTelemetryPlugin\r\n pluginState[STR_CORE /* @min:%2ecore */] = null;\r\n pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] = true;\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = false;\r\n if (plugin[_DYN_TEARDOWN /* @min:%2eteardown */] && plugin[_DYN_TEARDOWN /* @min:%2eteardown */](unloadCtx, unloadState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(unloadCtx, _callTeardown, \"unload\", function () { }, unloadState[_DYN_IS_ASYNC /* @min:%2eisAsync */])) {\r\n // Only called if we hasRun was not true\r\n unloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);\r\n }\r\n }\r\n function _updatePlugin(updateCtx, updateState) {\r\n function _callUpdate() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE /* @min:%2ecore */];\r\n // Only update the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */]) {\r\n if (plugin[_DYN_UPDATE /* @min:%2eupdate */] && plugin[_DYN_UPDATE /* @min:%2eupdate */](updateCtx, updateState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(updateCtx, _callUpdate, \"update\", function () { }, false)) {\r\n // Only called if we hasRun was not true\r\n updateCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](updateState);\r\n }\r\n }\r\n return objFreeze(proxyChain);\r\n}\r\n/**\r\n * This class will be removed!\r\n * @deprecated use createProcessTelemetryContext() instead\r\n */\r\nvar ProcessTelemetryContext = /** @class */ (function () {\r\n /**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n */\r\n function ProcessTelemetryContext(pluginChain, config, core, startAt) {\r\n var _self = this;\r\n var context = createProcessTelemetryContext(pluginChain, config, core, startAt);\r\n // Proxy all functions of the context to this object\r\n proxyFunctions(_self, context, objKeys(context));\r\n }\r\n return ProcessTelemetryContext;\r\n}());\r\nexport { ProcessTelemetryContext };\r\n//# sourceMappingURL=ProcessTelemetryContext.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_CREATE_NEW, _DYN_DIAG_LOG, _DYN_GET_NEXT, _DYN_GET_PROCESS_TEL_CONT0, _DYN_INITIALIZE, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_UPDATE, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { arrForEach, isArray, isFunction, isNullOrUndefined, proxyFunctionAs, setValue } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_EXTENSION_CONFIG, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext } from \"./ProcessTelemetryContext\";\r\nimport { createUnloadHandlerContainer } from \"./UnloadHandlerContainer\";\r\nvar strGetPlugin = \"getPlugin\";\r\n/**\r\n * BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins\r\n * can avoid implementation the same set of boiler plate code as well as provide a base\r\n * implementation so that new default implementations can be added without breaking all plugins.\r\n */\r\nvar BaseTelemetryPlugin = /** @class */ (function () {\r\n function BaseTelemetryPlugin() {\r\n var _self = this; // Setting _self here as it's used outside of the dynamicProto as well\r\n // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()\r\n var _isinitialized;\r\n var _rootCtx; // Used as the root context, holding the current config and initialized core\r\n var _nextPlugin; // Used for backward compatibility where plugins don't call the main pipeline\r\n var _unloadHandlerContainer;\r\n var _hooks;\r\n _initDefaults();\r\n dynamicProto(BaseTelemetryPlugin, _self, function (_self) {\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, core, extensions, pluginChain) {\r\n _setDefaults(config, core, pluginChain);\r\n _isinitialized = true;\r\n };\r\n _self[_DYN_TEARDOWN /* @min:%2eteardown */] = function (unloadCtx, unloadState) {\r\n var _a;\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self[STR_CORE /* @min:%2ecore */];\r\n if (!core || (unloadCtx && core !== unloadCtx[STR_CORE /* @min:%2ecore */]())) {\r\n // Do Nothing as either the plugin is not initialized or was not initialized by the current core\r\n return;\r\n }\r\n var result;\r\n var unloadDone = false;\r\n var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUnloadState = unloadState || (_a = {\r\n reason: 0 /* TelemetryUnloadReason.ManualTeardown */\r\n },\r\n _a[_DYN_IS_ASYNC /* @min:isAsync */] = false,\r\n _a);\r\n function _unloadCallback() {\r\n if (!unloadDone) {\r\n unloadDone = true;\r\n _unloadHandlerContainer.run(theUnloadCtx, unloadState);\r\n var oldHooks = _hooks;\r\n _hooks = [];\r\n // Remove all instrumentation hooks\r\n arrForEach(oldHooks, function (fn) {\r\n fn.rm();\r\n });\r\n if (result === true) {\r\n theUnloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](theUnloadState);\r\n }\r\n _initDefaults();\r\n }\r\n }\r\n if (!_self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */] || _self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {\r\n _unloadCallback();\r\n }\r\n else {\r\n // Tell the caller that we will be calling processNext()\r\n result = true;\r\n }\r\n return result;\r\n };\r\n _self[_DYN_UPDATE /* @min:%2eupdate */] = function (updateCtx, updateState) {\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self[STR_CORE /* @min:%2ecore */];\r\n if (!core || (updateCtx && core !== updateCtx[STR_CORE /* @min:%2ecore */]())) {\r\n // Do Nothing\r\n return;\r\n }\r\n var result;\r\n var updateDone = false;\r\n var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUpdateState = updateState || {\r\n reason: 0 /* TelemetryUpdateReason.Unknown */\r\n };\r\n function _updateCallback() {\r\n if (!updateDone) {\r\n updateDone = true;\r\n _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n }\r\n }\r\n if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {\r\n _updateCallback();\r\n }\r\n else {\r\n result = true;\r\n }\r\n return result;\r\n };\r\n _self._addHook = function (hooks) {\r\n if (hooks) {\r\n if (isArray(hooks)) {\r\n _hooks = _hooks.concat(hooks);\r\n }\r\n else {\r\n _hooks[_DYN_PUSH /* @min:%2epush */](hooks);\r\n }\r\n }\r\n };\r\n proxyFunctionAs(_self, \"_addUnloadCb\", function () { return _unloadHandlerContainer; }, \"add\");\r\n });\r\n // These are added after the dynamicProto so that are not moved to the prototype\r\n _self[_DYN_DIAG_LOG /* @min:%2ediagLog */] = function (itemCtx) {\r\n return _getTelCtx(itemCtx)[_DYN_DIAG_LOG /* @min:%2ediagLog */]();\r\n };\r\n _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () {\r\n return _isinitialized;\r\n };\r\n _self.setInitialized = function (isInitialized) {\r\n _isinitialized = isInitialized;\r\n };\r\n // _self.getNextPlugin = () => DO NOT IMPLEMENT\r\n // Sub-classes of this base class *should* not be relying on this value and instead\r\n // should use processNext() function. If you require access to the plugin use the\r\n // IProcessTelemetryContext.getNext().getPlugin() while in the pipeline, Note getNext() may return null.\r\n _self[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */] = function (next) {\r\n _nextPlugin = next;\r\n };\r\n _self[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = function (env, itemCtx) {\r\n if (itemCtx) {\r\n // Normal core execution sequence\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](env);\r\n }\r\n else if (_nextPlugin && isFunction(_nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Looks like backward compatibility or out of band processing. And as it looks\r\n // like a ITelemetryPlugin or ITelemetryPluginChain, just call processTelemetry\r\n _nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, null);\r\n }\r\n };\r\n _self._getTelCtx = _getTelCtx;\r\n function _getTelCtx(currentCtx) {\r\n if (currentCtx === void 0) { currentCtx = null; }\r\n var itemCtx = currentCtx;\r\n if (!itemCtx) {\r\n var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self[STR_CORE /* @min:%2ecore */]);\r\n // tslint:disable-next-line: prefer-conditional-expression\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // Looks like a chain object\r\n itemCtx = rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](null, _nextPlugin[strGetPlugin]);\r\n }\r\n else {\r\n itemCtx = rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](null, _nextPlugin);\r\n }\r\n }\r\n return itemCtx;\r\n }\r\n function _setDefaults(config, core, pluginChain) {\r\n if (config) {\r\n // Make sure the extensionConfig exists\r\n setValue(config, STR_EXTENSION_CONFIG, [], null, isNullOrUndefined);\r\n }\r\n if (!pluginChain && core) {\r\n // Get the first plugin from the core\r\n pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 /* @min:%2egetProcessTelContext */]()[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n var nextPlugin = _nextPlugin;\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // If it looks like a proxy/chain then get the plugin\r\n nextPlugin = _nextPlugin[strGetPlugin]();\r\n }\r\n // Support legacy plugins where core was defined as a property\r\n _self[STR_CORE /* @min:%2ecore */] = core;\r\n _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);\r\n }\r\n function _initDefaults() {\r\n _isinitialized = false;\r\n _self[STR_CORE /* @min:%2ecore */] = null;\r\n _rootCtx = null;\r\n _nextPlugin = null;\r\n _hooks = [];\r\n _unloadHandlerContainer = createUnloadHandlerContainer();\r\n }\r\n }\r\n// Removed Stub for BaseTelemetryPlugin.prototype.initialize.\r\n// Removed Stub for BaseTelemetryPlugin.prototype.teardown.\r\n// Removed Stub for BaseTelemetryPlugin.prototype.update.\r\n// Removed Stub for BaseTelemetryPlugin.prototype._addUnloadCb.\r\n// Removed Stub for BaseTelemetryPlugin.prototype._addHook.\r\n // This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n // this will be removed when ES3 support is dropped.\n BaseTelemetryPlugin.__ieDyn=1;\n\n return BaseTelemetryPlugin;\r\n}());\r\nexport { BaseTelemetryPlugin };\r\n//# sourceMappingURL=BaseTelemetryPlugin.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.10\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { _DYN_DIAG_LOG, _DYN_PUSH } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nimport { arrForEach } from \"./HelperFuncs\";\r\nexport function createUnloadHandlerContainer() {\r\n var handlers = [];\r\n function _addHandler(handler) {\r\n if (handler) {\r\n handlers[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n }\r\n function _runHandlers(unloadCtx, unloadState) {\r\n arrForEach(handlers, function (handler) {\r\n try {\r\n handler(unloadCtx, unloadState);\r\n }\r\n catch (e) {\r\n _throwInternal(unloadCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected error calling unload handler - \" + dumpObj(e));\r\n }\r\n });\r\n handlers = [];\r\n }\r\n return {\r\n add: _addHandler,\r\n run: _runHandlers\r\n };\r\n}\r\n//# sourceMappingURL=UnloadHandlerContainer.js.map","/*\n * 1DS JS SDK Privacy Guard plugin, 3.2.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* RegisteredFileTypes.ts\r\n* @author Sid Dahiya (sidahiy)\r\n* @copyright Microsoft 2020\r\n* File containing an exhaustive list of known file types that Privacy Guard is searching for.\r\n*/\r\nexport var RegisteredFileTypes = [\r\n \"ACCDA\",\r\n \"ACCDB\",\r\n \"ACCDC\",\r\n \"ACCDE\",\r\n \"ACCDR\",\r\n \"ACCDT\",\r\n \"ACCDU\",\r\n \"ACCDW\",\r\n \"ACCFT\",\r\n \"ADE\",\r\n \"ADN\",\r\n \"ADP\",\r\n \"AVI\",\r\n \"BMP\",\r\n \"CSV\",\r\n \"DOC\",\r\n \"DOCX\",\r\n \"DOT\",\r\n \"DOTX\",\r\n \"ERR\",\r\n \"FON\",\r\n \"GIF\",\r\n \"HTML\",\r\n \"ISO\",\r\n \"JPEG\",\r\n \"JPG\",\r\n \"LACCDB\",\r\n \"LDB\",\r\n \"LOG\",\r\n \"MAD\",\r\n \"MAF\",\r\n \"MAG\",\r\n \"MAM\",\r\n \"MAQ\",\r\n \"MAR\",\r\n \"MAS\",\r\n \"MAT\",\r\n \"MAU\",\r\n \"MAV\",\r\n \"MAW\",\r\n \"MDA\",\r\n \"MDBHTML\",\r\n \"MDE\",\r\n \"MDN\",\r\n \"MDT\",\r\n \"MDW\",\r\n \"MOV\",\r\n \"MP3\",\r\n \"MPD\",\r\n \"MPG\",\r\n \"MPP\",\r\n \"MPT\",\r\n \"MPW\",\r\n \"MPX\",\r\n \"MSG\",\r\n \"OLS\",\r\n \"ONE\",\r\n \"ONEPKG\",\r\n \"ONETOC\",\r\n \"ONETOC2\",\r\n \"OST\",\r\n \"PDF\",\r\n \"PNG\",\r\n \"POT\",\r\n \"POTHTML\",\r\n \"POTX\",\r\n \"PPA\",\r\n \"PPS\",\r\n \"PPSX\",\r\n \"PPT\",\r\n \"PPTHTML\",\r\n \"PPTMHTML\",\r\n \"PPTX\",\r\n \"PPTXML\",\r\n \"PST\",\r\n \"PUB\",\r\n \"PWZ\",\r\n \"RTF\",\r\n \"SLDM\",\r\n \"SLDX\",\r\n \"SLK\",\r\n \"THMX\",\r\n \"TIF\",\r\n \"TIFF\",\r\n \"TSX\",\r\n \"TTF\",\r\n \"TXT\",\r\n \"VDW\",\r\n \"VDX\",\r\n \"VHD\",\r\n \"VSD\",\r\n \"VSDM\",\r\n \"VSDX\",\r\n \"VSIX\",\r\n \"VSL\",\r\n \"VSS\",\r\n \"VSSM\",\r\n \"VSSX\",\r\n \"VST\",\r\n \"VSTM\",\r\n \"VSTX\",\r\n \"VSU\",\r\n \"VSW\",\r\n \"VSX\",\r\n \"WAV\",\r\n \"WIZHTML\",\r\n \"WMA\",\r\n \"WMV\",\r\n \"WPL\",\r\n \"XLS\",\r\n \"XLSHTML\",\r\n \"XLSMHTML\",\r\n \"XLSX\",\r\n \"XLTHTML\",\r\n \"XLTM\",\r\n \"XLTX\",\r\n \"XLW\",\r\n \"XLXML\",\r\n \"XPS\",\r\n \"ZIP\" // application/x-zip-compressed\r\n];\r\nvar RegisteredFileTypesTrie = /** @class */ (function () {\r\n function RegisteredFileTypesTrie() {\r\n this.map = {};\r\n this.isWord = false;\r\n this.isInitialized = false;\r\n }\r\n RegisteredFileTypesTrie.prototype.search = function (word) {\r\n return this.find(word, 0, this);\r\n };\r\n RegisteredFileTypesTrie.prototype.init = function () {\r\n if (this.isInitialized) {\r\n return;\r\n }\r\n for (var _i = 0, RegisteredFileTypes_1 = RegisteredFileTypes; _i < RegisteredFileTypes_1.length; _i++) {\r\n var fileType = RegisteredFileTypes_1[_i];\r\n this.add(fileType, 0, this);\r\n }\r\n this.isInitialized = true;\r\n };\r\n RegisteredFileTypesTrie.prototype.add = function (word, index, letterMap) {\r\n if (index === word.length) {\r\n letterMap.isWord = true;\r\n return;\r\n }\r\n if (!letterMap.map[word.charAt(index)]) {\r\n letterMap.map[word.charAt(index)] = new RegisteredFileTypesTrie();\r\n }\r\n return this.add(word, index + 1, letterMap.map[word.charAt(index)]);\r\n };\r\n RegisteredFileTypesTrie.prototype.find = function (word, index, letterMap) {\r\n if (index === word.length) {\r\n if (letterMap.isWord) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n if (letterMap.map[word[index]]) {\r\n return this.find(word, index + 1, letterMap.map[word.charAt(index)]);\r\n }\r\n return false;\r\n };\r\n return RegisteredFileTypesTrie;\r\n}());\r\nexport { RegisteredFileTypesTrie };\r\n//# sourceMappingURL=RegisteredFileTypes.js.map","/*\n * 1DS JS SDK Privacy Guard plugin, 3.2.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* PrivacyGuardPlugin.ts\r\n* @author Sid Dahiya (sidahiy)\r\n* @copyright Microsoft 2020\r\n* File containing the implementation for Privacy Guard plugin.\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrIndexOf, strEndsWith, throwError } from \"@microsoft/1ds-core-js\";\r\nimport { RegisteredFileTypesTrie } from \"./RegisteredFileTypes\";\r\n/* Regular Expressions */\r\nvar _emailRegex = /([A-Z0-9_]|\\.|%2E){1,50}(@|_AT_|%40)([A-Z0-9_]{1,50}(\\.|_|%2E))+(COM|ORG|GOV|EDU)/;\r\nvar _directoryRegex = /([A-Z]:|\\\\)(\\\\\\\\{0,1}\\w+)+/;\r\nvar _formatRegex = /(()|(\\{\\\\RTF)|(<\\?XML)|(MIME-VERSION)|( 0) {\r\n for (var _i = 0, _a = freshCommonContext.UserNames; _i < _a.length; _i++) {\r\n var uname = _a[_i];\r\n if (containsAnyAlphabets(uname)) {\r\n // User Name is not converted to Upper as it may be used in parts where case matters.\r\n // For example, 'Awesome Username' is valid username, but 'awesome' should not match\r\n // here.\r\n generatePrettyNameParts(uname, freshCommonContext.IgnoredNameParts);\r\n }\r\n }\r\n }\r\n if (freshCommonContext.UserAlias && containsAnyAlphabets(freshCommonContext.UserAlias)) {\r\n _customLocalValues.push({\r\n stringIsolatedWord: freshCommonContext.UserAlias.replace(/[^a-zA-Z]/g, \"\").toUpperCase(),\r\n concern: 19 /* DataConcernType.UserAlias */\r\n });\r\n }\r\n if (freshCommonContext.UserAliases && freshCommonContext.UserAliases.length > 0) {\r\n for (var _b = 0, _c = freshCommonContext.UserAliases; _b < _c.length; _b++) {\r\n var alias = _c[_b];\r\n if (containsAnyAlphabets(alias)) {\r\n _customLocalValues.push({\r\n stringIsolatedWord: alias.replace(/[^a-zA-Z]/g, \"\").toUpperCase(),\r\n concern: 19 /* DataConcernType.UserAlias */\r\n });\r\n }\r\n }\r\n }\r\n if (freshCommonContext.MachineIds && freshCommonContext.MachineIds.length > 0) {\r\n for (var _d = 0, _e = freshCommonContext.MachineIds; _d < _e.length; _d++) {\r\n var machineId = _e[_d];\r\n _customLocalValues.push({\r\n stringValue: machineId.toUpperCase(),\r\n concern: 14 /* DataConcernType.MachineName */\r\n });\r\n }\r\n }\r\n if (_enableAdvancedScans && freshCommonContext.OutOfScopeIdentifiers && freshCommonContext.OutOfScopeIdentifiers.length > 0) {\r\n for (var _f = 0, _g = freshCommonContext.OutOfScopeIdentifiers; _f < _g.length; _f++) {\r\n var identifier = _g[_f];\r\n _customLocalValues.push({\r\n regexpValue: makeIdentifierRegex(identifier.toUpperCase()),\r\n concern: 15 /* DataConcernType.OutOfScopeIdentifier */\r\n });\r\n }\r\n }\r\n };\r\n function makeIdentifierRegex(identifier) {\r\n identifier = identifier.replace(/[.*+\\-?^${}()|[\\]\\\\]/g, \"\\\\$&\"); // $& means the whole matched string\r\n identifier = identifier.replace(/\\-/g, \"-?\");\r\n return new RegExp(identifier);\r\n }\r\n function generatePrettyNameParts(userName, ignoredNameParts) {\r\n var nameParts = userName.split(\" \");\r\n for (var _i = 0, nameParts_1 = nameParts; _i < nameParts_1.length; _i++) {\r\n var namePart = nameParts_1[_i];\r\n if (namePart.length >= 4 &&\r\n (!ignoredNameParts || (ignoredNameParts && arrIndexOf(ignoredNameParts, namePart) === -1))) {\r\n _userNameParts.push(namePart);\r\n }\r\n }\r\n }\r\n _self.getAllPrivacyConcerns = function (eventName, baseTypeName, fieldName, fieldValue) {\r\n var results = [];\r\n if (fieldValue.length > 1000) { // Maximum performant length\r\n fieldValue = fieldValue.substring(0, 1000);\r\n }\r\n var characteristics = getAllTextCharacteristics(fieldValue);\r\n if (!characteristics.hasAlphabets) {\r\n return results;\r\n }\r\n if (characteristics.hasForwardSlash && _enableAdvancedScans && _scanForUrls && (characteristics.hasHttp || characteristics.hasFileUrl)) {\r\n results.push({ Concern: 18 /* DataConcernType.Url */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n if (characteristics.hasFileUrl && _scanForUrls) {\r\n results.push({ Concern: 8 /* DataConcernType.FileSharingUrl */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n if (characteristics.hasFileSharingConcern) {\r\n results.push({ Concern: 8 /* DataConcernType.FileSharingUrl */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n if (characteristics.hasSecurityAccessTokenConcern) {\r\n results.push({ Concern: 22 /* DataConcernType.AccessToken */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n if (characteristics.hasSecuritySignatureConcern) {\r\n results.push({ Concern: 23 /* DataConcernType.Signature */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n if (characteristics.hasBackslash) {\r\n var concern = getFilePathConcerns(eventName, baseTypeName, fieldName, characteristics.valueToCheck);\r\n if (concern) {\r\n results = results.concat(concern);\r\n }\r\n }\r\n if (characteristics.hasFormatChars) {\r\n if (_formatRegex.test(characteristics.valueToCheck)) {\r\n results.push({ Concern: 1 /* DataConcernType.Content */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n }\r\n if (characteristics.hasDot) {\r\n var concern = checkForFiles(eventName, baseTypeName, fieldName, characteristics.valueToCheck);\r\n if (concern) {\r\n results.push(concern);\r\n }\r\n }\r\n var hasEmailRegexMatch = false;\r\n if (characteristics.hasAtSign && (characteristics.hasDot || characteristics.hasUnderscore || characteristics.hasPercentage)) {\r\n hasEmailRegexMatch = _emailRegex.test(characteristics.valueToCheck);\r\n if (hasEmailRegexMatch) {\r\n var emailMatch = characteristics.valueToCheck.match(_emailRegex)[0];\r\n if (hasEmailRegexMatch) {\r\n results.push({ Concern: getEmailType(emailMatch), EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n }\r\n }\r\n var commonPrivacyContextsResult = checkForPrivacyContexts(eventName, baseTypeName, fieldName, characteristics.valueToCheck);\r\n if (commonPrivacyContextsResult[0] && commonPrivacyContextsResult[0].length > 0) {\r\n results = results.concat(commonPrivacyContextsResult[0]);\r\n }\r\n var hasUserAlias = commonPrivacyContextsResult[1];\r\n if (!hasEmailRegexMatch) {\r\n if (!hasUserAlias && (_userNameParts !== undefined && _userNameParts.length > 0)) {\r\n var anyMatchedParts = false;\r\n for (var index = 0; index < _userNameParts.length; index++) {\r\n var namePart = _userNameParts[index];\r\n if (!isContainedAsIsolatedWord(fieldValue, namePart)) {\r\n continue;\r\n }\r\n anyMatchedParts = true;\r\n break;\r\n }\r\n if (anyMatchedParts) {\r\n results.push({ Concern: 21 /* DataConcernType.UserName */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n }\r\n if ((characteristics.valueToCheck.length > 10) &&\r\n ((strEndsWith(characteristics.valueToCheck, \"_SSPI\") && !strEndsWith(characteristics.valueToCheck, \"*_SSPI\")) ||\r\n (strEndsWith(characteristics.valueToCheck, \"_AD\") && !strEndsWith(characteristics.valueToCheck, \"*_AD\")))) {\r\n results.push({ Concern: getEmailType(characteristics.valueToCheck), EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n }\r\n return results;\r\n };\r\n function isContainedAsIsolatedWord(value, word) {\r\n if ((!value || value.length === 0) || (!word || word.length === 0)) {\r\n return false;\r\n }\r\n var startCharIndex = value.indexOf(word) - 1;\r\n var lastCharIndex = startCharIndex + word.length + 1;\r\n if (startCharIndex >= -1 && lastCharIndex >= 0) {\r\n var nextChar = value.charCodeAt(lastCharIndex);\r\n if (startCharIndex > -1) {\r\n return (!isAlphaCharacter(value.charCodeAt(startCharIndex)) && !isAlphaCharacter(nextChar));\r\n }\r\n else {\r\n return !isAlphaCharacter(nextChar);\r\n }\r\n }\r\n return false;\r\n }\r\n function isAlphaCharacter(char) {\r\n return (char >= 65 && char <= 90) || (char >= 97 && char <= 122);\r\n }\r\n function containsAnyAlphabets(value) {\r\n for (var index = 0; index < value.length; index++) {\r\n if (isAlphaCharacter(value.charCodeAt(index))) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n function checkForPrivacyContexts(eventName, baseTypeName, fieldName, upperCaseValue) {\r\n var concerns = [];\r\n var hasUserAlias = false;\r\n for (var index = 0; index < _customLocalValues.length; index++) {\r\n var toMatch = _customLocalValues[index];\r\n var stringValue = toMatch.stringValue;\r\n if (stringValue && upperCaseValue.indexOf(stringValue) !== -1) {\r\n concerns.push({ Concern: toMatch.concern, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n else {\r\n var stringIsolatedWord = toMatch.stringIsolatedWord;\r\n if (stringIsolatedWord && isContainedAsIsolatedWord(upperCaseValue, stringIsolatedWord)) {\r\n concerns.push({ Concern: toMatch.concern, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n hasUserAlias = hasUserAlias || toMatch.concern === 19 /* DataConcernType.UserAlias */;\r\n }\r\n else {\r\n var regexpValue = toMatch.regexpValue;\r\n if (regexpValue && regexpValue.test(upperCaseValue)) {\r\n concerns.push({ Concern: toMatch.concern, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n }\r\n }\r\n }\r\n return [concerns, hasUserAlias];\r\n }\r\n function getEmailType(emailMatch) {\r\n if (emailMatch.match(/MICROSOFT(\\.|_|%2E)COM/) || emailMatch.match(/LINKEDIN(\\.|_|%2E)COM/)) {\r\n return 11 /* DataConcernType.InternalEmailAddress */;\r\n }\r\n return 5 /* DataConcernType.ExternalEmailAddress */;\r\n }\r\n function checkForFiles(eventName, baseTypeName, fieldName, fieldValue) {\r\n var previousDot = fieldValue.indexOf(\".\");\r\n while ((previousDot !== -1) && (fieldValue.length > previousDot)) {\r\n var nextDot = fieldValue.indexOf(\".\", previousDot + 1);\r\n var nextUnderscore = fieldValue.indexOf(\"_\", previousDot + 1);\r\n var nextSeparator = fieldValue.length;\r\n if (nextDot > 0 && nextUnderscore > 0) {\r\n nextSeparator = Math.min(nextUnderscore, nextDot);\r\n }\r\n else if (nextDot > 0) {\r\n nextSeparator = nextDot;\r\n }\r\n else if (nextUnderscore > 0) {\r\n nextSeparator = nextUnderscore;\r\n }\r\n var length = nextSeparator - previousDot;\r\n if (length >= 3 && length <= 5) {\r\n // Get the string after '.' so we have a shorter string to match.\r\n if (_fileTypesTrie.search(fieldValue.substring(previousDot + 1, previousDot + length))) {\r\n return { Concern: 7 /* DataConcernType.FileNameOrExtension */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName };\r\n }\r\n }\r\n previousDot = nextDot;\r\n }\r\n return null;\r\n }\r\n function getFilePathConcerns(eventName, baseTypeName, fieldName, value) {\r\n var matches = value.match(_directoryRegex);\r\n if (!matches) {\r\n return null;\r\n }\r\n var concerns = [];\r\n var match = matches[0]; // We don't want to look at the subgroups, just the first match.\r\n if (match.length > 4 && match.search(/:\\\\U00/) === -1 && match.search(/(\\\\)+SOFTWARE(\\\\)+MICROSOFT(\\\\)+/) === -1) {\r\n concerns.push({ Concern: 4 /* DataConcernType.Directory */, EventName: eventName, BaseType: baseTypeName, FieldName: fieldName });\r\n }\r\n return concerns;\r\n }\r\n function getAllTextCharacteristics(value) {\r\n var props = {\r\n hasAlphabets: false,\r\n hasAtSign: false,\r\n hasBackslash: false,\r\n hasDash: false,\r\n hasDot: false,\r\n hasFileUrl: false,\r\n hasFileSharingConcern: false,\r\n hasFormatChars: false,\r\n hasForwardSlash: false,\r\n hasHttp: false,\r\n hasPercentage: false,\r\n hasSecurityAccessTokenConcern: false,\r\n hasSecuritySignatureConcern: false,\r\n hasUnderscore: false,\r\n valueToCheck: value.toUpperCase()\r\n };\r\n var valueToCheck = props.valueToCheck;\r\n for (var currentCharIndex = 0; currentCharIndex < valueToCheck.length; currentCharIndex++) {\r\n var currentChar = valueToCheck.charAt(currentCharIndex);\r\n if (!props.hasAlphabets) {\r\n props.hasAlphabets = isAlphaCharacter(valueToCheck.charCodeAt(currentCharIndex));\r\n }\r\n switch (currentChar) {\r\n case \"@\":\r\n if (!props.hasAtSign) {\r\n props.hasAtSign = (currentCharIndex < valueToCheck.length - 3); // Nothing after `@`, so skip checking for emails.\r\n }\r\n break;\r\n case \"\\\\\":\r\n if (!props.hasBackslash) {\r\n props.hasBackslash = true;\r\n }\r\n break;\r\n case \"-\":\r\n if (!props.hasDash) {\r\n props.hasDash = true;\r\n }\r\n break;\r\n case \"\\.\":\r\n if (!props.hasDot) {\r\n props.hasDot = (currentCharIndex < valueToCheck.length - 2); // Not enough characters after `.` for checking\r\n }\r\n break;\r\n case \"<\":\r\n case \"{\":\r\n if (!props.hasFormatChars) {\r\n props.hasFormatChars = true;\r\n }\r\n break;\r\n case \"/\":\r\n if (!props.hasForwardSlash) {\r\n props.hasForwardSlash = true;\r\n }\r\n if (props.hasHttp && _scanForUrls && !props.hasFileSharingConcern) {\r\n if (currentCharIndex < (valueToCheck.length - 16)) {\r\n props.hasFileSharingConcern = isStringInValue(valueToCheck, \"WOPI.ASHX/FILES\", currentCharIndex + 1);\r\n if (props.hasFileSharingConcern) {\r\n currentCharIndex = currentCharIndex + 14;\r\n }\r\n }\r\n if (!props.hasFileSharingConcern && currentCharIndex < (valueToCheck.length - 12)) {\r\n props.hasFileSharingConcern = isStringInValue(valueToCheck, \"WOPI/FILES/\", currentCharIndex + 1);\r\n if (props.hasFileSharingConcern) {\r\n currentCharIndex = currentCharIndex + 10;\r\n }\r\n }\r\n }\r\n break;\r\n case \"_\":\r\n if (!props.hasUnderscore) {\r\n props.hasUnderscore = true;\r\n }\r\n if (!props.hasAtSign && currentCharIndex < (valueToCheck.length - 4)) {\r\n props.hasAtSign = valueToCheck.charAt(currentCharIndex + 1) === \"A\" &&\r\n valueToCheck.charAt(currentCharIndex + 2) === \"T\" &&\r\n valueToCheck.charAt(currentCharIndex + 3) === \"_\";\r\n if (props.hasAtSign) {\r\n currentCharIndex = currentCharIndex + 2;\r\n }\r\n }\r\n break;\r\n case \"A\":\r\n if (props.hasForwardSlash && props.hasHttp && !props.hasSecurityAccessTokenConcern) {\r\n if (currentCharIndex < (valueToCheck.length - 14)) {\r\n props.hasSecurityAccessTokenConcern = isStringInValue(valueToCheck, \"WSACCESSKEYID\", currentCharIndex + 1);\r\n if (props.hasSecurityAccessTokenConcern) {\r\n currentCharIndex = currentCharIndex + 12;\r\n }\r\n }\r\n if (!props.hasSecurityAccessTokenConcern && currentCharIndex < (valueToCheck.length - 12)) {\r\n props.hasSecurityAccessTokenConcern = isStringInValue(valueToCheck, \"CCESS_TOKEN\", currentCharIndex + 1);\r\n if (props.hasSecurityAccessTokenConcern) {\r\n currentCharIndex = currentCharIndex + 10;\r\n }\r\n }\r\n }\r\n break;\r\n case \"D\":\r\n if (props.hasForwardSlash && props.hasHttp && _scanForUrls && !props.hasFileSharingConcern && currentCharIndex < (valueToCheck.length - 12)) {\r\n props.hasFileSharingConcern = isStringInValue(valueToCheck, \"ROPBOX.COM/\", currentCharIndex + 1);\r\n if (props.hasFileSharingConcern) {\r\n currentCharIndex = currentCharIndex + 10;\r\n }\r\n }\r\n break;\r\n case \"F\":\r\n if (!props.hasFileUrl && currentCharIndex < (valueToCheck.length - 7)) {\r\n props.hasFileUrl = isStringInValue(valueToCheck, \"ILE://\", currentCharIndex + 1);\r\n if (props.hasFileUrl) {\r\n currentCharIndex = currentCharIndex + 5;\r\n }\r\n }\r\n break;\r\n case \"%\":\r\n if (!props.hasPercentage) {\r\n props.hasPercentage = true;\r\n }\r\n if (!props.hasAtSign && currentCharIndex < (valueToCheck.length - 3)) {\r\n props.hasAtSign = valueToCheck.charAt(currentCharIndex + 1) === \"4\" &&\r\n valueToCheck.charAt(currentCharIndex + 2) === \"0\";\r\n if (props.hasAtSign) {\r\n currentCharIndex = currentCharIndex + 1;\r\n }\r\n }\r\n break;\r\n case \"M\":\r\n if (!props.hasFormatChars && currentCharIndex < (valueToCheck.length - 12)) {\r\n props.hasFormatChars = isStringInValue(valueToCheck, \"IME-VERSION\", currentCharIndex + 1);\r\n if (props.hasFormatChars) {\r\n currentCharIndex = currentCharIndex + 10;\r\n }\r\n }\r\n break;\r\n case \"H\":\r\n if (!props.hasHttp && currentCharIndex < (valueToCheck.length - 8)) {\r\n props.hasHttp = isStringInValue(valueToCheck, \"TTP://\", currentCharIndex + 1) || isStringInValue(valueToCheck, \"TTPS://\", currentCharIndex + 1);\r\n if (props.hasHttp) {\r\n currentCharIndex = currentCharIndex + 5;\r\n }\r\n }\r\n break;\r\n case \"S\":\r\n if (props.hasForwardSlash && props.hasHttp &&\r\n !props.hasSecuritySignatureConcern && currentCharIndex < (valueToCheck.length - 9)) {\r\n props.hasSecuritySignatureConcern = isStringInValue(valueToCheck, \"IGNATURE\", currentCharIndex + 1);\r\n if (props.hasSecuritySignatureConcern) {\r\n currentCharIndex = currentCharIndex + 7;\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n return props;\r\n }\r\n function isStringInValue(valueToCheck, stringToLookup, startIndex) {\r\n if (startIndex < 0 || (startIndex + stringToLookup.length) >= valueToCheck.length) {\r\n return false;\r\n }\r\n for (var index = 0; index < stringToLookup.length; index++) {\r\n if (valueToCheck[startIndex + index] !== stringToLookup[index]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n });\r\n }\r\n /**\r\n * Starts the Privacy Guard plugin\r\n * @param config The core configuration.\r\n */\r\n PrivacyGuardInternal.prototype.initialize = function (coreConfig) {\r\n // Make sure we have a config definition for this identifier\r\n };\r\n// Removed Stub for PrivacyGuardInternal.prototype.updateCommonContext.\r\n// Removed Stub for PrivacyGuardInternal.prototype.isEnabled.\r\n// Removed Stub for PrivacyGuardInternal.prototype.setEnabled.\r\n// Removed Stub for PrivacyGuardInternal.prototype.getAllPrivacyConcerns.\r\n return PrivacyGuardInternal;\r\n}());\r\nexport { PrivacyGuardInternal };\r\n//# sourceMappingURL=PrivacyGuardInternal.js.map","/*\n * 1DS JS SDK Privacy Guard plugin, 3.2.9\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\n/**\r\n* PrivacyGuardPlugin.ts\r\n* @author Sid Dahiya (sidahiy)\r\n* @copyright Microsoft 2020\r\n* File containing the implementation for Privacy Guard plugin.\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin, _throwInternal, doPerf, isNullOrUndefined, isObject, isString, objForEachKey } from \"@microsoft/1ds-core-js\";\r\nimport { PrivacyGuardInternal } from \"./PrivacyGuardInternal\";\r\nvar PrivacyGuardPlugin = /** @class */ (function (_super) {\r\n __extends(PrivacyGuardPlugin, _super);\r\n function PrivacyGuardPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"PrivacyGuardPlugin\";\r\n _this.priority = 499;\r\n _this.version = '3.2.9';\r\n // Manually set configuration that is not reset during teardown / unload\r\n var _manualConfig = null;\r\n var _manualEnabled = null;\r\n var _manualCommonContext = null;\r\n // Automatic defaults set during construction and reset during teardown / unload via _initDefaults()\r\n var _pgInternal;\r\n var _core;\r\n var _iKey;\r\n var _notificationEventName;\r\n var _summaryEventName;\r\n var _useFieldPrefix;\r\n var _useAbsoluteFieldName;\r\n var _concernsNotified;\r\n var _eventsIgnored;\r\n var _eventsInspected;\r\n var _fieldsInspected;\r\n dynamicProto(PrivacyGuardPlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (coreConfig, core, extensions) {\r\n _base.initialize(coreConfig, core, extensions);\r\n var configuration = coreConfig.extensionConfig[_self.identifier];\r\n if (!configuration) {\r\n _throwInternal(core.logger, 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, 'Configuration not provided, PrivacyGuard disabled.');\r\n _base.setInitialized(false);\r\n }\r\n else {\r\n _core = core;\r\n initInternal(_manualConfig || configuration);\r\n // Reapply any manually set values\r\n if (!isNullOrUndefined(_manualEnabled)) {\r\n _self.setEnabled(_manualEnabled);\r\n }\r\n if (!isNullOrUndefined(_manualCommonContext)) {\r\n _self.updateCommonContext(_manualCommonContext);\r\n }\r\n }\r\n };\r\n _self.reset = function (configuration) {\r\n _manualConfig = configuration;\r\n if (_manualConfig) { // Support \"clearing\" as this is not reset during unloading\r\n initInternal(_manualConfig);\r\n }\r\n };\r\n function initInternal(configuration) {\r\n _pgInternal = new PrivacyGuardInternal();\r\n _pgInternal.initialize(configuration);\r\n if (configuration.notificationEventName && isString(configuration.notificationEventName)) {\r\n _notificationEventName = configuration.notificationEventName;\r\n }\r\n if (configuration.summaryEventName && isString(configuration.summaryEventName)) {\r\n _summaryEventName = configuration.summaryEventName;\r\n }\r\n if (configuration.iKey && isString(configuration.iKey)) {\r\n _iKey = configuration.iKey;\r\n }\r\n _pgInternal.setEnabled(configuration.enabled !== false);\r\n _useFieldPrefix = configuration.useEventFieldPrefix !== false;\r\n _useAbsoluteFieldName = configuration.useAbsoluteFieldName === true;\r\n }\r\n _self.isEnabled = function () {\r\n return _pgInternal && _pgInternal.isEnabled();\r\n };\r\n _self.isPrivacyGuardEnabled = function () {\r\n return _self.isEnabled();\r\n };\r\n _self.setEnabled = function (enabled) {\r\n _manualEnabled = enabled;\r\n return _pgInternal && _pgInternal.setEnabled(enabled);\r\n };\r\n _self.updateCommonContext = function (freshCommonContext) {\r\n _manualCommonContext = freshCommonContext;\r\n if (_pgInternal) {\r\n _pgInternal.updateCommonContext(_manualCommonContext);\r\n }\r\n };\r\n _self.processTelemetry = function (event, itemCtx) {\r\n doPerf(_core, function () { return \"PrivacyGuard:_processTelemetry\"; }, function () {\r\n if (_self.isEnabled() && event.name !== _notificationEventName && event.name !== _summaryEventName) {\r\n if (event.data) {\r\n _eventsInspected++;\r\n var baseType;\r\n // Office Telemetry JS SDK uses event.baseType, while CS 2.0 used event.data.baseType.\r\n if (isString(event.baseType)) {\r\n baseType = event.baseType;\r\n }\r\n else if (event.data && event.data.baseType && isString(event.data.baseType)) {\r\n baseType = event.data.baseType;\r\n }\r\n var concerns = processObject(event.name, baseType, \"\", event.data);\r\n if (concerns.length > 0) {\r\n _self.notifyConcerns(concerns);\r\n }\r\n }\r\n else {\r\n // Account for any event who's data might be empty.\r\n // We do not count Summary and Notification event in this metric.\r\n _eventsIgnored++;\r\n }\r\n }\r\n });\r\n _self.processNext(event, itemCtx);\r\n };\r\n function processObject(eventName, baseTypeName, parentKey, toProcess) {\r\n if (!_self.isEnabled()) {\r\n return [];\r\n }\r\n var concerns = [];\r\n if (isNullOrUndefined(toProcess)) {\r\n return concerns;\r\n }\r\n objForEachKey(toProcess, function (propKey, theValue) {\r\n var fieldName = propKey;\r\n if (_useAbsoluteFieldName && parentKey && parentKey.length > 0) {\r\n fieldName = parentKey + \".\" + propKey;\r\n }\r\n if (isString(theValue)) {\r\n _fieldsInspected++;\r\n concerns = concerns.concat(_pgInternal.getAllPrivacyConcerns(eventName, baseTypeName, fieldName, theValue));\r\n }\r\n else if (theValue && isObject(theValue)) {\r\n concerns = concerns.concat(processObject(eventName, baseTypeName, fieldName, theValue));\r\n }\r\n });\r\n return concerns;\r\n }\r\n _self.sendSummaryEvent = function (shouldResetSummary) {\r\n var pgEvent = {\r\n name: _summaryEventName,\r\n ext: {\r\n metadata: {\r\n privTags: 33554432,\r\n privLevel: 110\r\n }\r\n }\r\n };\r\n pgEvent.data = getStatsInternal(_useFieldPrefix);\r\n if (_iKey) {\r\n pgEvent.iKey = _iKey;\r\n }\r\n _core.track(pgEvent);\r\n if (shouldResetSummary) {\r\n _concernsNotified = 0;\r\n _eventsIgnored = 0;\r\n _eventsInspected = 0;\r\n _fieldsInspected = 0;\r\n }\r\n };\r\n _self.notifyConcerns = function (concerns) {\r\n for (var _i = 0, concerns_1 = concerns; _i < concerns_1.length; _i++) {\r\n var concern = concerns_1[_i];\r\n var pgEvent = {\r\n name: _notificationEventName,\r\n ext: {\r\n metadata: {\r\n privTags: 33554432,\r\n privLevel: 110\r\n }\r\n }\r\n };\r\n if (_useFieldPrefix) {\r\n pgEvent.data = {\r\n PG_EventName: concern.EventName,\r\n PG_FieldName: concern.FieldName,\r\n PG_TypeAsText: DataConcernTypeToString(concern.Concern),\r\n PG_BaseType: concern.BaseType\r\n };\r\n }\r\n else {\r\n pgEvent.data = {\r\n EventName: concern.EventName,\r\n FieldName: concern.FieldName,\r\n TypeAsText: DataConcernTypeToString(concern.Concern),\r\n BaseType: concern.BaseType\r\n };\r\n }\r\n if (_iKey) {\r\n pgEvent.iKey = _iKey;\r\n }\r\n _core.track(pgEvent);\r\n _concernsNotified++;\r\n }\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _initDefaults();\r\n };\r\n _self.getStats = function () {\r\n return getStatsInternal(false);\r\n };\r\n function getStatsInternal(useFieldPrefix) {\r\n if (useFieldPrefix) {\r\n return {\r\n PG_ConcernsNotified: _concernsNotified,\r\n PG_EventsIgnored: _eventsIgnored,\r\n PG_EventsInspected: _eventsInspected,\r\n PG_FieldsInspected: _fieldsInspected\r\n };\r\n }\r\n else {\r\n return {\r\n ConcernsNotified: _concernsNotified,\r\n EventsIgnored: _eventsIgnored,\r\n EventsInspected: _eventsInspected,\r\n FieldsInspected: _fieldsInspected\r\n };\r\n }\r\n }\r\n function _initDefaults() {\r\n _pgInternal = null;\r\n _core = null;\r\n _iKey = null;\r\n _notificationEventName = \"PrivacyConcern\";\r\n _summaryEventName = \"PrivacyGuardSummary\";\r\n _useFieldPrefix = true;\r\n _useAbsoluteFieldName = false;\r\n _concernsNotified = 0;\r\n _eventsIgnored = 0;\r\n _eventsInspected = 0;\r\n _fieldsInspected = 0;\r\n }\r\n function DataConcernTypeToString(type) {\r\n switch (type) {\r\n case 0 /* DataConcernType.None */:\r\n return \"None\";\r\n case 6 /* DataConcernType.FieldNameImpliesLocation */:\r\n return \"FieldNameImpliesLocation\";\r\n case 11 /* DataConcernType.InternalEmailAddress */:\r\n return \"InternalEmailAddress\";\r\n case 15 /* DataConcernType.OutOfScopeIdentifier */:\r\n return \"OutOfScopeIdentifier\";\r\n case 14 /* DataConcernType.MachineName */:\r\n return \"MachineName\";\r\n case 20 /* DataConcernType.UserDomain */:\r\n return \"UserDomain\";\r\n case 12 /* DataConcernType.IpAddress */:\r\n return \"IPAddress\";\r\n case 5 /* DataConcernType.ExternalEmailAddress */:\r\n return \"ExternalEmailAddress\";\r\n case 21 /* DataConcernType.UserName */:\r\n return \"UserName\";\r\n case 19 /* DataConcernType.UserAlias */:\r\n return \"UserAlias\";\r\n case 4 /* DataConcernType.Directory */:\r\n return \"Directory\";\r\n case 18 /* DataConcernType.Url */:\r\n return \"Url\";\r\n case 7 /* DataConcernType.FileNameOrExtension */:\r\n return \"FileNameOrExtension\";\r\n case 1 /* DataConcernType.Content */:\r\n return \"Content\";\r\n case 8 /* DataConcernType.FileSharingUrl */:\r\n return \"FileSharingUrl\";\r\n case 17 /* DataConcernType.Security */:\r\n return \"Security\";\r\n case 22 /* DataConcernType.AccessToken */:\r\n return \"AccessToken\";\r\n case 23 /* DataConcernType.Signature */:\r\n return \"Signature\";\r\n default:\r\n break;\r\n }\r\n return \"Missing String value for \" + type;\r\n }\r\n });\r\n return _this;\r\n }\r\n /**\r\n * Starts the Privacy Guard plugin\r\n * @param config The core configuration.\r\n */\r\n PrivacyGuardPlugin.prototype.initialize = function (coreConfig, core, extensions) {\r\n // Make sure we have a config definition for this identifier\r\n };\r\n// Removed Stub for PrivacyGuardPlugin.prototype.processTelemetry.\r\n// Removed Stub for PrivacyGuardPlugin.prototype.updateCommonContext.\r\n// Removed Stub for PrivacyGuardPlugin.prototype.isEnabled.\r\n// Removed Stub for PrivacyGuardPlugin.prototype.isPrivacyGuardEnabled.\r\n// Removed Stub for PrivacyGuardPlugin.prototype.setEnabled.\r\n// Removed Stub for PrivacyGuardPlugin.prototype.sendSummaryEvent.\r\n// Removed Stub for PrivacyGuardPlugin.prototype.reset.\r\n// Removed Stub for PrivacyGuardPlugin.prototype.getStats.\r\n// Removed Stub for PrivacyGuardPlugin.prototype.notifyConcerns.\r\n return PrivacyGuardPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { PrivacyGuardPlugin };\r\n//# sourceMappingURL=PrivacyGuardPlugin.js.map","/**\r\n * Make a boolean data field.\r\n * @param name - The name of the data field\r\n * @param value - The value of the data field\r\n */\r\nexport function makeBooleanDataField(name, value, classification) {\r\n return makeDataField(name, 1 /* DataFieldType.Boolean */, value, classification);\r\n}\r\n/**\r\n * Make a data field corresponding to the Aria Int64 data type. Note that\r\n * JavaScript doesn't actually support Int64 precision on large numbers.\r\n * @param name - The name of the data field\r\n * @param value - The value of the data field\r\n */\r\nexport function makeInt64DataField(name, value, classification) {\r\n return makeDataField(name, 2 /* DataFieldType.Int64 */, value, classification);\r\n}\r\n/**\r\n * Make a double data field\r\n * @param name - The name of the data field\r\n * @param value - The value of the data field\r\n */\r\nexport function makeDoubleDataField(name, value, classification) {\r\n return makeDataField(name, 3 /* DataFieldType.Double */, value, classification);\r\n}\r\n/**\r\n * Make a string data field\r\n * @param name - The name of the data field\r\n * @param value - The value of the data field\r\n */\r\nexport function makeStringDataField(name, value, classification) {\r\n return makeDataField(name, 0 /* DataFieldType.String */, value, classification);\r\n}\r\n/**\r\n * Make a GUID data field\r\n * !!!WARNING: Only the 1DS Sink has support for Guid types.\r\n * @param name - The name of the data field\r\n * @param value - The value of the data field\r\n */\r\nexport function makeGuidDataField(name, value, classification) {\r\n return makeDataField(name, 4 /* DataFieldType.Guid */, value, classification);\r\n}\r\nfunction makeDataField(name, dataType, value, classification) {\r\n return {\r\n name: name,\r\n dataType: dataType,\r\n value: value,\r\n classification: classification ? classification : 4 /* DataClassification.SystemMetadata */\r\n };\r\n}\r\n//# sourceMappingURL=DataFieldHelper.js.map","/******************************************************************************\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\nexport function __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\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 var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\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\nexport function __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\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\n/** @deprecated */\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\n/** @deprecated */\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 __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\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\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\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 (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\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __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\nexport function __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\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","function getNotificationHandler() {\r\n var _listeners = [];\r\n return {\r\n /**\r\n * Fires an event to its listeners\r\n * @param args - The parameters of the event\r\n */\r\n fireEvent: function (args) {\r\n _listeners.forEach(function (listener) { return listener(args); });\r\n },\r\n /**\r\n * Add an event listener\r\n * @param listener - The listener that can process events\r\n */\r\n addListener: function (listener) {\r\n if (listener) {\r\n _listeners.push(listener);\r\n }\r\n }\r\n };\r\n}\r\nvar notificationHandler = getNotificationHandler();\r\n/**\r\n * Returns a list of notification event listeners. You can add an event listener:\r\n * onNotification().addListener(event =\\> \\{\r\n * console.log(event!.message + ' ' + event!.level); \\});\r\n *\r\n * DO NOT trigger telemetry events on these notifications, as doing so may\r\n * create an infinite loop of telemetry events.\r\n */\r\nexport function onNotification() {\r\n return notificationHandler;\r\n}\r\n/**\r\n * Internal function: log a notification\r\n * @param level - The level of notification to log\r\n * @param category - The category of the notification\r\n * @param message - A function that returns a message to log\r\n */\r\nexport function logNotification(level, category, message) {\r\n notificationHandler.fireEvent({ level: level, category: category, message: message });\r\n}\r\n/**\r\n * Internal function: log an error\r\n * @param category - The category of the notification\r\n * @param message - A message that will precede the message from error object\r\n * @param error - An error object, from which an error message might be obtained\r\n */\r\nexport function logError(category, message, error) {\r\n logNotification(0 /* LogLevel.Error */, category, function () {\r\n var errorMessage = error instanceof Error ? error.message : '';\r\n return \"\".concat(message, \": \").concat(errorMessage);\r\n });\r\n}\r\n//# sourceMappingURL=OTelNotifications.js.map","import { logNotification } from './OTelNotifications';\r\nvar NAMESPACE_SEPARATOR = '.';\r\nvar tenantTokens = {};\r\nexport function setTenantTokens(namespace, telemetryProperties) {\r\n if (\r\n // Starts with \"Office.\" and doesn't end with \".\"\r\n namespace.substring(0, 7) === 'Office' + NAMESPACE_SEPARATOR &&\r\n namespace[namespace.length - 1] !== NAMESPACE_SEPARATOR) {\r\n if (tenantTokens[namespace]) {\r\n if (telemetryProperties.ariaTenantToken) {\r\n tenantTokens[namespace].ariaTenantToken = telemetryProperties.ariaTenantToken;\r\n }\r\n if (telemetryProperties.dnmToken) {\r\n tenantTokens[namespace].dnmToken = telemetryProperties.dnmToken;\r\n }\r\n }\r\n else {\r\n tenantTokens[namespace] = telemetryProperties;\r\n }\r\n }\r\n else {\r\n logNotification(0 /* LogLevel.Error */, 0 /* Category.Core */, function () {\r\n return \"Namespace: \".concat(namespace);\r\n });\r\n return;\r\n }\r\n}\r\n/**\r\n * Gets the tenant tokens corresponding to an event\r\n * Strategy: Search for the whole string, then substrings that could be the namespace\r\n * @param eventName - The event name\r\n * @returns - The corresponding tenant tokens, or undefined if none found\r\n */\r\nexport function fillTenantTokens(eventName, telemetryProperties) {\r\n var indexOfCharacterAfterNamespace = eventName.length;\r\n while (indexOfCharacterAfterNamespace > 0) {\r\n var namespaceCandidate = eventName.substr(0, indexOfCharacterAfterNamespace);\r\n if (tenantTokens[namespaceCandidate]) {\r\n var storedTelemetryProperties = tenantTokens[namespaceCandidate];\r\n telemetryProperties.ariaTenantToken = storedTelemetryProperties.ariaTenantToken;\r\n telemetryProperties.dnmToken = storedTelemetryProperties.dnmToken;\r\n return true;\r\n }\r\n indexOfCharacterAfterNamespace = eventName.lastIndexOf(NAMESPACE_SEPARATOR, indexOfCharacterAfterNamespace - 1);\r\n }\r\n return false;\r\n}\r\nexport function clear() {\r\n tenantTokens = {};\r\n}\r\n//# sourceMappingURL=TenantTokenManager.js.map","var INT64_MAX = 9007199254740991;\r\nvar INT64_MIN = -INT64_MAX;\r\nvar MaxEventNameLength = 98; // Client Code = 100 limit; Aria Compact SDK = 98 limit.\r\n// Starts with \"Office\", and then at least two more alphanumeric tokens that start with capital letters\r\n// Tokens are separated by periods.\r\nvar EventNameRegex = /^Office(\\.[A-Z][a-zA-Z0-9]*){2,}$/;\r\n// Contains alphanumeric or _ or .\r\n// Must be between 1 and 95 characters long (5 characters reserved for 'Data.')\r\nvar AlphanumericRegex = /^[a-zA-Z0-9_\\.]{1,95}$/;\r\nexport function validateTelemetryEvent(telemetryEvent) {\r\n if (!isEventNameValid(telemetryEvent.eventName)) {\r\n throw new Error('Invalid eventName');\r\n }\r\n var eventContract = telemetryEvent.eventContract;\r\n if (eventContract) {\r\n if (eventContract.name && !isNameValid(eventContract.name)) {\r\n throw new Error('Invalid eventContract');\r\n }\r\n validateDataFields(eventContract.dataFields);\r\n }\r\n validateDataFields(telemetryEvent.dataFields);\r\n}\r\nfunction isEventNameValid(eventName) {\r\n if (!eventName || eventName.length > MaxEventNameLength) {\r\n return false;\r\n }\r\n return EventNameRegex.test(eventName);\r\n}\r\nfunction isNameValid(name) {\r\n return AlphanumericRegex.test(name);\r\n}\r\nfunction validateDataFields(dataFields) {\r\n if (!dataFields) {\r\n return;\r\n }\r\n dataFields.forEach(function (dataField) {\r\n if (typeof dataField.name !== 'string' || !isNameValid(dataField.name)) {\r\n throw new Error('Invalid dataField name');\r\n }\r\n if (dataField.dataType === 2 /* DataFieldType.Int64 */) {\r\n validateInt(dataField.value);\r\n }\r\n });\r\n}\r\nexport function validateInt(value) {\r\n if (typeof value !== 'number' || !isFinite(value) || Math.floor(value) !== value || value < INT64_MIN || value > INT64_MAX) {\r\n throw new Error(\"Invalid integer \".concat(JSON.stringify(value)));\r\n }\r\n}\r\n//# sourceMappingURL=TelemetryEventValidator.js.map","import { __assign } from \"tslib\";\r\nimport { fillTenantTokens, setTenantTokens } from './TenantTokenManager';\r\nimport { validateTelemetryEvent } from './TelemetryEventValidator';\r\nimport { logNotification, logError } from './OTelNotifications';\r\nimport { oteljsVersion } from './Version';\r\nimport { makeStringDataField, makeInt64DataField } from './DataFieldHelper';\r\nvar CUSTOMER_CONTENT_VERSION = 2;\r\nvar MAX_EVENT_QUEUE_LENGTH = 1000;\r\n/**\r\n * Use this as the Nexus tenant token when Nexus logging is not needed or relevant\r\n */\r\nexport var SuppressNexus = -1;\r\n/**\r\n * Clone a telemetry event; generally so we don't modify the input telemetry event\r\n * Also initializes telemetryProperties and dataFields if they aren't already set\r\n * @param telemetryEvent - The event to clone\r\n */\r\nexport function cloneEvent(telemetryEvent) {\r\n var localEvent = {\r\n eventName: telemetryEvent.eventName,\r\n eventFlags: telemetryEvent.eventFlags || {},\r\n telemetryProperties: !!telemetryEvent.telemetryProperties ? __assign({}, telemetryEvent.telemetryProperties) : {},\r\n dataFields: !!telemetryEvent.dataFields ? telemetryEvent.dataFields.slice() : [],\r\n timestamp: telemetryEvent.timestamp || new Date().getTime()\r\n };\r\n if (!!telemetryEvent.eventContract) {\r\n localEvent.eventContract = { name: telemetryEvent.eventContract.name, dataFields: telemetryEvent.eventContract.dataFields.slice() };\r\n }\r\n return localEvent;\r\n}\r\n/**\r\n * SimpleTelemetryLogger is the base implementation of a telemetry logger.\r\n * It exposes sendTelemetryEvent, which is used to log a telemetry event.\r\n *\r\n * Add a sink by calling addSink() or modifying the telemetrySinks list.\r\n * If no sinks are attached, it keeps a queue of events, but starts silently\r\n */\r\nvar SimpleTelemetryLogger = /** @class */ (function () {\r\n /**\r\n * Creates a telemetry logger\r\n * @param parent - A parent telemetry logger that this telemetry logger should inherit from\r\n * This telemetry logger will send telemetry to the same sinks\r\n * and will send the same persistent data fields as the parent logger\r\n * @param persistentDataFields - Data fields to send with every event\r\n */\r\n function SimpleTelemetryLogger(parent, persistentDataFields, config) {\r\n var _a, _b, _c;\r\n /**\r\n * A list of sinks that telemetry events will be forwarded to\r\n */\r\n this.telemetrySinks = [];\r\n /**\r\n * @internal Internal variable; do not use publicly.\r\n * 'Data.' will be prepended to each field.\r\n */\r\n this.persistentDataFields = [];\r\n /**\r\n * A list of Part A data fields that should be added to every event. In the 1DS Sink,\r\n * part A data fields will be sent without 'Data.'. On native clients, these fields\r\n * will still get added as 'Data.Foo'.\r\n */\r\n this.partAFields = [];\r\n this.eventQueue = [];\r\n this.config = config || {};\r\n if (parent) {\r\n this.telemetrySinks = parent.telemetrySinks;\r\n (_a = this.persistentDataFields).push.apply(_a, parent.persistentDataFields);\r\n this.config = __assign(__assign({}, parent.getConfig()), this.config);\r\n (_b = this.partAFields).push.apply(_b, parent.partAFields);\r\n }\r\n if (persistentDataFields) {\r\n (_c = this.persistentDataFields).push.apply(_c, persistentDataFields);\r\n }\r\n }\r\n SimpleTelemetryLogger.prototype.addEventContentType = function (dataFields, eventContentType) {\r\n dataFields.push(makeInt64DataField('EventContent.Type', eventContentType));\r\n };\r\n /**\r\n * SendTelemetryEvent is the basic way to send a telemetry event.\r\n * This should be used for sending telemetry about discrete events that happened\r\n * For telemetry that includes duration and/or success/failure, the Activity API may be more appropriate.\r\n * @param telemetryEvent - The telemetry event to send\r\n */\r\n SimpleTelemetryLogger.prototype.sendTelemetryEvent = function (telemetryEvent) {\r\n var clonedEvent = cloneEvent(telemetryEvent);\r\n var telemetryProperties = clonedEvent.telemetryProperties;\r\n // Nexus is no longer supported by OTelJS\r\n telemetryProperties.nexusTenantToken = SuppressNexus;\r\n // If either one is missing, we try to fill both\r\n var ariaTenantToken = telemetryProperties.ariaTenantToken;\r\n if (!ariaTenantToken) {\r\n var success = fillTenantTokens(clonedEvent.eventName, telemetryProperties);\r\n if (!success && !ariaTenantToken) {\r\n logNotification(0 /* LogLevel.Error */, 0 /* Category.Core */, function () { return 'No tenant token: ' + telemetryEvent.eventName; });\r\n return;\r\n }\r\n }\r\n this.sendTelemetryEventInternal(clonedEvent, 1 /* EventType.SendTelemetryEvent */);\r\n };\r\n /**\r\n * Sends customer content to an appropriate compliant endpoint\r\n * @param event - The event to send\r\n * @param customerContentType - The type of customer content\r\n */\r\n SimpleTelemetryLogger.prototype.sendCustomerContent = function (customerContentEvent) {\r\n var clonedEvent = cloneEvent(customerContentEvent);\r\n var telemetryProperties = clonedEvent.telemetryProperties;\r\n var customerContentVersion = telemetryProperties.customerContentVersion;\r\n if (!customerContentVersion || customerContentVersion > CUSTOMER_CONTENT_VERSION) {\r\n telemetryProperties.customerContentVersion = CUSTOMER_CONTENT_VERSION;\r\n }\r\n // Suppress any tenant tokens that were passed in; the event must go to the customer content tenant.\r\n telemetryProperties.ariaTenantToken = undefined;\r\n telemetryProperties.nexusTenantToken = undefined;\r\n telemetryProperties.dnmToken = undefined;\r\n this.addEventContentType(clonedEvent.dataFields, 2 /* ContentType.CustomerContent */);\r\n return this.sendTelemetryEventInternal(clonedEvent, 2 /* EventType.CustomerContent */);\r\n };\r\n /**\r\n * Send a direct numerical measurement to the a DNM tenant\r\n * @param directNumericEvent - the event to send\r\n */\r\n SimpleTelemetryLogger.prototype.sendDirectNumericEvent = function (directNumericEvent) {\r\n var clonedEvent = cloneEvent(directNumericEvent);\r\n var telemetryProperties = clonedEvent.telemetryProperties;\r\n if (!telemetryProperties.dnmToken) {\r\n var success = fillTenantTokens(clonedEvent.eventName, telemetryProperties);\r\n if (!success && !telemetryProperties.dnmToken) {\r\n logNotification(0 /* LogLevel.Error */, 0 /* Category.Core */, function () { return 'No dnm token: ' + clonedEvent.eventName; });\r\n return;\r\n }\r\n }\r\n this.addEventContentType(clonedEvent.dataFields, 1 /* ContentType.AnonymousData */);\r\n this.sendTelemetryEventInternal(clonedEvent, 3 /* EventType.DirectNumericEvent */);\r\n };\r\n /**\r\n * Internal method to send a telemetry event\r\n * @param event - The telemetry event to send.\r\n * Note that it may be a CustomerContentEvent by virtue of having a customerContentVersion and customerContentType.\r\n */\r\n SimpleTelemetryLogger.prototype.sendTelemetryEventInternal = function (telemetryEvent, eventType) {\r\n if (eventType !== 2 /* EventType.CustomerContent */ &&\r\n (telemetryEvent.telemetryProperties.customerContentVersion || telemetryEvent.telemetryProperties.customerContentType)) {\r\n logNotification(0 /* LogLevel.Error */, 0 /* Category.Core */, function () { return 'Customer content'; });\r\n return;\r\n }\r\n try {\r\n if (this.telemetrySinks.length === 0) {\r\n if (this.config.enableQueue && this.eventQueue.length < MAX_EVENT_QUEUE_LENGTH) {\r\n this.eventQueue.push([telemetryEvent, eventType]);\r\n }\r\n else {\r\n logNotification(1 /* LogLevel.Warning */, 0 /* Category.Core */, function () { return 'No telemetry sinks are attached.'; });\r\n }\r\n return;\r\n }\r\n this.processTelemetryEvent(telemetryEvent, eventType);\r\n }\r\n catch (error) {\r\n logError(0 /* Category.Core */, 'SendTelemetryEvent', error);\r\n return;\r\n }\r\n this.telemetrySinks.forEach(function (telemetrySink) {\r\n try {\r\n if (eventType === 3 /* EventType.DirectNumericEvent */ || eventType === 2 /* EventType.CustomerContent */) {\r\n if (telemetrySink.sendNonStandardEvent) {\r\n telemetrySink.sendNonStandardEvent(telemetryEvent, eventType);\r\n }\r\n }\r\n else {\r\n telemetrySink.sendTelemetryEvent(telemetryEvent);\r\n }\r\n }\r\n catch (_e) {\r\n // Sinks should handle their own errors;\r\n }\r\n });\r\n };\r\n /**\r\n * Processes a telemetry event, but does not send it\r\n * Adds persistent data fields\r\n * Validates the event\r\n * Throws if the event is invalid\r\n * @param telemetryEvent - The telemetry event to process\r\n */\r\n SimpleTelemetryLogger.prototype.processTelemetryEvent = function (telemetryEvent, eventType) {\r\n var _a, _b;\r\n var _c;\r\n // The last-added data field wins, if the same-named data field is added more than once.\r\n // Persistent data fields should have lower priority than per-event data fields\r\n if (telemetryEvent.dataFields) {\r\n (_c = telemetryEvent.dataFields) === null || _c === void 0 ? void 0 : _c.unshift(makeStringDataField('OTelJS.Version', oteljsVersion));\r\n // Do not add logger persistent data fields to DNM events\r\n // All Part C fields should be explicitly added\r\n if (eventType !== 3 /* EventType.DirectNumericEvent */ && this.persistentDataFields) {\r\n (_a = telemetryEvent.dataFields).unshift.apply(_a, this.persistentDataFields);\r\n }\r\n }\r\n if (this.partAFields.length > 0) {\r\n var eventContract = telemetryEvent.eventContract || {\r\n name: '',\r\n dataFields: []\r\n };\r\n (_b = eventContract.dataFields).push.apply(_b, this.partAFields);\r\n telemetryEvent.eventContract = eventContract;\r\n }\r\n if (!this.config.disableValidation) {\r\n validateTelemetryEvent(telemetryEvent);\r\n }\r\n };\r\n /**\r\n * Adds a telemetry sink, to which events will be sent\r\n * @param sink - The telemetry sink to add\r\n */\r\n SimpleTelemetryLogger.prototype.addSink = function (sink) {\r\n this.telemetrySinks.push(sink);\r\n this.flushQueue();\r\n };\r\n /**\r\n * Flush the queue of telemetry events that were accumulated before a sink was attached.\r\n * The queue is emptied whether or not a sink is attached.\r\n *\r\n * Note that all events are sent at once. If an event throttler is enabled on a telemetry sink,\r\n * it may be triggered; you may choose to only connect the event throttler after flushing the queue.\r\n */\r\n SimpleTelemetryLogger.prototype.flushQueue = function () {\r\n var eventQueue = this.eventQueue;\r\n this.eventQueue = [];\r\n if (this.telemetrySinks.length > 0) {\r\n for (var _i = 0, eventQueue_1 = eventQueue; _i < eventQueue_1.length; _i++) {\r\n var _a = eventQueue_1[_i], telemetryEvent = _a[0], eventType = _a[1];\r\n this.sendTelemetryEventInternal(telemetryEvent, eventType);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a tenant token for a single namespace. Events within the namespace will be sent to the corresponding tenant.\r\n * @param namespace - The namespace to which the tokens apply, such as Office.System.\r\n * @param ariaTenantToken - The Aria tenant token\r\n * @param nexusTenantToken - The Nexus tenant token\r\n */\r\n SimpleTelemetryLogger.prototype.setTenantToken = function (namespace, ariaTenantToken, nexusTenantToken) {\r\n setTenantTokens(namespace, { ariaTenantToken: ariaTenantToken, nexusTenantToken: nexusTenantToken });\r\n };\r\n /**\r\n * Sets a tenant token for a single namespace for DNM. Events within the namespace will be sent to the corresponding tenant.\r\n * @param namespace - The namespace to which the tokens apply, such as Office.System.\r\n * @param dnmToken - The Aria tenant token for direct numerical measurement events\r\n */\r\n SimpleTelemetryLogger.prototype.setDNMToken = function (namespace, dnmToken) {\r\n setTenantTokens(namespace, { dnmToken: dnmToken });\r\n };\r\n /**\r\n * Clone a telemetry event; generally so we don't modify the input telemetry event\r\n * Also sets dataFields to [] if it isn't already set\r\n * @param telemetryEvent - The event to clone\r\n */\r\n SimpleTelemetryLogger.prototype.cloneEvent = function (telemetryEvent) {\r\n return cloneEvent(telemetryEvent);\r\n };\r\n /**\r\n * Gets the currently applied configuration\r\n */\r\n SimpleTelemetryLogger.prototype.getConfig = function () {\r\n return this.config;\r\n };\r\n return SimpleTelemetryLogger;\r\n}());\r\nexport { SimpleTelemetryLogger };\r\n//# sourceMappingURL=SimpleTelemetryLogger.js.map","export var oteljsVersion = '4.14.0';\r\n//# sourceMappingURL=Version.js.map","import { makeBooleanDataField, makeInt64DataField, makeStringDataField } from './DataFieldHelper';\r\nfunction getFullFieldName(instanceName, fieldName) {\r\n return instanceName ? instanceName + '.' + fieldName : fieldName;\r\n}\r\n/**\r\n * Adds a data field from a contract to the data fields array.\r\n * If the data field value is empty, the field is skipped.\r\n * @param instanceName - The name of the contract instance. Empty if no instance.\r\n * @param fieldName - The name of the field to add\r\n * @param value - The value\r\n * @param dataFields - The array of data fields to which a field will be added\r\n */\r\nfunction addStringDataField(dataFields, instanceName, fieldName, value, dataClassification) {\r\n if (dataClassification === void 0) { dataClassification = 4 /* DataClassification.SystemMetadata */; }\r\n if (value) {\r\n dataFields.push(makeStringDataField(\"\".concat(getFullFieldName(instanceName, fieldName)), value, dataClassification));\r\n }\r\n}\r\nfunction addBooleanDataField(dataFields, instanceName, fieldName, value) {\r\n if (typeof value === 'boolean') {\r\n dataFields.push(makeBooleanDataField(\"\".concat(getFullFieldName(instanceName, fieldName)), value));\r\n }\r\n}\r\nfunction addInt64DataField(dataFields, instanceName, fieldName, value) {\r\n if (typeof value === 'number') {\r\n dataFields.push(makeInt64DataField(\"\".concat(getFullFieldName(instanceName, fieldName)), value));\r\n }\r\n}\r\nexport var Result = {\r\n /* Gets data fields for the Office.System.Result contract */\r\n getFields: function (contract) {\r\n var instanceName = 'Activity.Result';\r\n var contractName = 'Office.System.Result';\r\n var dataFields = [];\r\n addInt64DataField(dataFields, instanceName, 'Code', contract.code);\r\n addStringDataField(dataFields, instanceName, 'Type', contract.type);\r\n addInt64DataField(dataFields, instanceName, 'Tag', contract.tag);\r\n addBooleanDataField(dataFields, instanceName, 'IsExpected', contract.isExpected);\r\n dataFields.push(makeStringDataField('zC.Activity.Result', contractName));\r\n return dataFields;\r\n }\r\n}; // Result\r\nexport var Activity = {\r\n contractName: 'Office.System.Activity',\r\n /* Gets data fields for the Office.System.Activity contract */\r\n getFields: function (contract) {\r\n var instanceName = 'Activity';\r\n var dataFields = [];\r\n addStringDataField(dataFields, instanceName, 'CV', contract.cV);\r\n addInt64DataField(dataFields, instanceName, 'Duration', contract.duration);\r\n addInt64DataField(dataFields, instanceName, 'Count', contract.count);\r\n addInt64DataField(dataFields, instanceName, 'AggMode', contract.aggMode);\r\n addBooleanDataField(dataFields, instanceName, 'Success', contract.success);\r\n if (contract.result) {\r\n dataFields.push.apply(dataFields, Result.getFields(contract.result));\r\n }\r\n dataFields.push(makeStringDataField('zC.Activity', this.contractName));\r\n return dataFields;\r\n }\r\n}; // Activity\r\nexport var User = {\r\n /* Gets data fields for the Office.System.User contract */\r\n getFields: function (contract) {\r\n var instanceName = 'User';\r\n var dataFields = [];\r\n addStringDataField(dataFields, instanceName, 'PrimaryIdentityHash', contract.primaryIdentityHash);\r\n addStringDataField(dataFields, instanceName, 'PrimaryIdentitySpace', contract.primaryIdentitySpace);\r\n addStringDataField(dataFields, instanceName, 'TenantId', contract.tenantId, 1 /* DataClassification.EssentialServiceMetadata */);\r\n addStringDataField(dataFields, instanceName, 'TenantGroup', contract.tenantGroup, 1 /* DataClassification.EssentialServiceMetadata */);\r\n addBooleanDataField(dataFields, instanceName, 'IsAnonymous', contract.isAnonymous);\r\n addBooleanDataField(dataFields, instanceName, 'IsSignedIn', contract.isSignedIn);\r\n return dataFields;\r\n }\r\n}; // User\r\nexport var Funnel = {\r\n /* Gets data fields for the Office.System.Funnel contract */\r\n getFields: function (instanceName, contract) {\r\n var dataFields = [];\r\n addStringDataField(dataFields, instanceName, 'Name', contract.name);\r\n addStringDataField(dataFields, instanceName, 'State', contract.state);\r\n return dataFields;\r\n }\r\n}; // Funnel\r\nexport var UserAction = {\r\n /* Gets data fields for the Office.System.UserAction contract */\r\n getFields: function (contract) {\r\n var instanceName = 'UserAction';\r\n var dataFields = [];\r\n addInt64DataField(dataFields, instanceName, 'Id', contract.id);\r\n addStringDataField(dataFields, instanceName, 'Name', contract.name);\r\n addStringDataField(dataFields, instanceName, 'CommandSurface', contract.commandSurface);\r\n addStringDataField(dataFields, instanceName, 'ParentName', contract.parentName);\r\n addStringDataField(dataFields, instanceName, 'TriggerMethod', contract.triggerMethod);\r\n addInt64DataField(dataFields, instanceName, 'TimeOffsetMs', contract.timeOffsetMs);\r\n return dataFields;\r\n }\r\n}; // UserAction\r\nexport var Platform;\r\n(function (Platform) {\r\n Platform[\"Web\"] = \"Web\";\r\n Platform[\"Desktop\"] = \"Desktop\";\r\n Platform[\"Universal\"] = \"Universal\";\r\n Platform[\"Mobile\"] = \"Mobile\";\r\n Platform[\"Win32\"] = \"Win32\";\r\n Platform[\"iOS\"] = \"iOS\";\r\n Platform[\"Android\"] = \"Android\";\r\n})(Platform || (Platform = {}));\r\nexport var App = {\r\n /* Gets data fields for the Office.System.App contract */\r\n getFields: function (contract) {\r\n var instanceName = 'App';\r\n var dataFields = [];\r\n addStringDataField(dataFields, instanceName, 'Name', contract.name, 1 /* DataClassification.EssentialServiceMetadata */);\r\n addStringDataField(dataFields, instanceName, 'Platform', contract.platform, 1 /* DataClassification.EssentialServiceMetadata */);\r\n addStringDataField(dataFields, instanceName, 'Version', contract.version, 1 /* DataClassification.EssentialServiceMetadata */);\r\n return dataFields;\r\n }\r\n}; // App\r\nexport var Session = {\r\n /* Gets data fields for the Office.System.Session contract */\r\n getFields: function (contract) {\r\n var instanceName = 'Session';\r\n var dataFields = [];\r\n addStringDataField(dataFields, instanceName, 'Id', contract.id, 1 /* DataClassification.EssentialServiceMetadata */);\r\n addStringDataField(dataFields, instanceName, 'EcsETag', contract.ecsETag, 1 /* DataClassification.EssentialServiceMetadata */);\r\n return dataFields;\r\n }\r\n}; // Session\r\nexport var HealthQosError = {\r\n /**\r\n * Gets data fields for the Health contract\r\n * See https://aka.ms/asha/docs for documentation on usage and parameters.\r\n * Generally, use sendHealthQosError() instead of using this contract directly.\r\n */\r\n getFields: function (contract) {\r\n var dataFields = [];\r\n dataFields.push(makeStringDataField('Pillar', contract.pillar));\r\n dataFields.push(makeStringDataField('Veto', contract.veto));\r\n dataFields.push(makeBooleanDataField('IsIntentional', contract.isIntentional));\r\n dataFields.push(makeBooleanDataField('IsInternal', contract.isInternal));\r\n dataFields.push(makeBooleanDataField('AlertOnPillar', contract.alertOnPillar));\r\n dataFields.push(makeBooleanDataField('IsSessionEndingError', contract.isSessionEndingError));\r\n addBooleanDataField(dataFields, undefined, 'InStaging', contract.inStaging);\r\n return dataFields;\r\n }\r\n}; // HealthQosError\r\nexport var AudienceGroup;\r\n(function (AudienceGroup) {\r\n AudienceGroup[\"Automation\"] = \"Automation\";\r\n AudienceGroup[\"Dogfood\"] = \"Dogfood\";\r\n AudienceGroup[\"Microsoft\"] = \"Microsoft\";\r\n AudienceGroup[\"Insiders\"] = \"Insiders\";\r\n AudienceGroup[\"Production\"] = \"Production\";\r\n})(AudienceGroup || (AudienceGroup = {}));\r\nexport var Release = {\r\n /* Gets data fields for the Office.System.Release contract */\r\n getFields: function (contract) {\r\n var instanceName = 'Release';\r\n var dataFields = [];\r\n addStringDataField(dataFields, instanceName, 'AudienceGroup', contract.audienceGroup, 1 /* DataClassification.EssentialServiceMetadata */);\r\n return dataFields;\r\n }\r\n}; // Release\r\n// Source of truth is https://office.visualstudio.com/OE/_git/UnifiedEventSchema?version=GBmain&path=/src/Copilot.tml\r\n// Compiled with TML compiler, and manually modified to add enums and zC field\r\nexport var Copilot;\r\n(function (Copilot) {\r\n var contractName = 'Office.System.Copilot';\r\n var instanceName = 'Copilot';\r\n var FeatureActionType;\r\n (function (FeatureActionType) {\r\n FeatureActionType[\"IsEnabled\"] = \"IsEnabled\";\r\n FeatureActionType[\"IsSeen\"] = \"IsSeen\";\r\n FeatureActionType[\"IsTried\"] = \"IsTried\";\r\n FeatureActionType[\"IsKept\"] = \"IsKept\";\r\n FeatureActionType[\"IsRejected\"] = \"IsRejected\";\r\n })(FeatureActionType = Copilot.FeatureActionType || (Copilot.FeatureActionType = {}));\r\n var Capability;\r\n (function (Capability) {\r\n Capability[\"ContentGeneration\"] = \"Content Generation\";\r\n Capability[\"Commanding\"] = \"Commanding\";\r\n Capability[\"QAandSummaries\"] = \"QA and Summaries\";\r\n Capability[\"Collaboration\"] = \"Collaboration\";\r\n Capability[\"Suggestions\"] = \"Suggestions\";\r\n })(Capability = Copilot.Capability || (Copilot.Capability = {}));\r\n /* Gets data fields for the Office.System.Copilot contract */\r\n function getFields(contract) {\r\n var dataFields = [];\r\n if (contract.featureActionType !== undefined) {\r\n dataFields.push(makeStringDataField(\"\".concat(instanceName, \".FeatureActionType\"), contract.featureActionType));\r\n }\r\n if (contract.isUserInitiated !== undefined) {\r\n dataFields.push(makeBooleanDataField(\"\".concat(instanceName, \".IsUserInitiated\"), contract.isUserInitiated));\r\n }\r\n if (contract.featureName !== undefined) {\r\n dataFields.push(makeStringDataField(\"\".concat(instanceName, \".FeatureName\"), contract.featureName));\r\n }\r\n if (contract.capability !== undefined) {\r\n dataFields.push(makeStringDataField(\"\".concat(instanceName, \".Capability\"), contract.capability));\r\n }\r\n if (contract.isThumbsUp !== undefined) {\r\n dataFields.push(makeBooleanDataField(\"\".concat(instanceName, \".IsThumbsUp\"), contract.isThumbsUp));\r\n }\r\n dataFields.push(makeStringDataField(\"zC.\".concat(instanceName), contractName));\r\n return dataFields;\r\n }\r\n Copilot.getFields = getFields;\r\n})(Copilot || (Copilot = {})); // Copilot\r\n//# sourceMappingURL=Contracts.js.map","import { Activity } from './Contracts';\r\nimport { logNotification } from './OTelNotifications';\r\nimport { cloneEvent } from './SimpleTelemetryLogger';\r\n// Currently we only send one activity at a time\r\nvar ACTIVITY_COUNT = 1;\r\n// Currently we do not aggregate activities in OTelJS\r\nvar ACTIVITY_AGGMODE = 0;\r\nvar getCurrentMicroseconds = function () {\r\n return Date.now() * 1000;\r\n};\r\nif (typeof window === 'object' && typeof window.performance === 'object' && 'now' in window.performance) {\r\n getCurrentMicroseconds = function () {\r\n return Math.floor(window.performance.now()) * 1000;\r\n };\r\n}\r\nexport var createActivity = function (activityProperties) {\r\n var _startTime = getCurrentMicroseconds();\r\n var _ended;\r\n var clonedEvent = cloneEvent(activityProperties.telemetryEvent);\r\n return {\r\n cv: activityProperties.parentCv.getNext(),\r\n eventName: activityProperties.telemetryEvent.eventName,\r\n dataFields: clonedEvent.dataFields,\r\n eventFlags: clonedEvent.eventFlags,\r\n telemetryProperties: clonedEvent.telemetryProperties,\r\n /**\r\n * Creates an activity parented to this one.\r\n * @param telemetryEvent - The underlying telemetry event for this activity\r\n */\r\n createChildActivity: function (telemetryEvent) {\r\n return createActivity({\r\n telemetryEvent: telemetryEvent,\r\n sendTelemetryEvent: activityProperties.sendTelemetryEvent,\r\n parentCv: this.cv\r\n });\r\n },\r\n /**\r\n * Sets the result of the activity. Does not end it.\r\n * @param resultCode - The result code, e.g. 0 for success\r\n * @param resultType - Optional: The result type, e.g. \"HRESULT\"\r\n * @param resultTag - Optional: The result tag\r\n */\r\n setResult: function (code, type, tag) {\r\n this.result = { code: code, type: type, tag: tag };\r\n },\r\n /**\r\n * Ends the activity; records the duration and sends a telemetry event.\r\n */\r\n endNow: function () {\r\n if (_ended) {\r\n logNotification(0 /* LogLevel.Error */, 0 /* Category.Core */, function () { return 'Already ended'; });\r\n return;\r\n }\r\n if (this.success === undefined && this.result === undefined) {\r\n // The Activity dashboard shows these activities as 'unresolved'\r\n // but developers generally should avoid leaving activities in this state.\r\n logNotification(1 /* LogLevel.Warning */, 0 /* Category.Core */, function () { return 'Activity does not have success or result set'; });\r\n }\r\n var endTime = getCurrentMicroseconds();\r\n var duration = endTime - _startTime;\r\n _ended = true;\r\n // Fill the event contract\r\n var activity = {\r\n duration: duration,\r\n count: ACTIVITY_COUNT,\r\n aggMode: ACTIVITY_AGGMODE,\r\n cV: this.cv.value,\r\n success: this.success,\r\n result: this.result\r\n };\r\n var newDataFields = this.eventContract && this.eventContract.dataFields ? this.eventContract.dataFields : [];\r\n newDataFields.push.apply(newDataFields, Activity.getFields(activity));\r\n this.eventContract = {\r\n name: Activity.contractName,\r\n dataFields: newDataFields\r\n };\r\n return activityProperties.sendTelemetryEvent(this);\r\n }\r\n };\r\n};\r\n//# sourceMappingURL=Activity.js.map","// The \"base CV\" has a hash without any child numbers\r\nvar baseCv;\r\n/**\r\n * Implementation of correlation vector\r\n */\r\nvar CV = /** @class */ (function () {\r\n function CV(value) {\r\n this.value = value;\r\n this.nextChild = 0;\r\n }\r\n /**\r\n * The index of the next child\r\n */\r\n CV.prototype.getNext = function () {\r\n return new CV(\"\".concat(this.value, \".\").concat(++this.nextChild));\r\n };\r\n return CV;\r\n}());\r\nexport { CV };\r\n/**\r\n * Gets a base correlation vector for this session\r\n * @returns A base correlation vector, with a value of a 22-character string\r\n */\r\nexport function getBaseCv() {\r\n if (!baseCv) {\r\n var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\r\n var hashLength = 22;\r\n var result = [];\r\n for (var i = 0; i < hashLength; i++) {\r\n // (security is not a concern here and secure crypto function is not available on all platform)\r\n // eslint-disable-next-line no-restricted-properties\r\n result.push(characters.charAt(Math.floor(Math.random() * characters.length)));\r\n }\r\n baseCv = new CV(result.join(''));\r\n }\r\n return baseCv;\r\n}\r\n//# sourceMappingURL=CorrelationVector.js.map","import { makeInt64DataField, makeStringDataField } from './DataFieldHelper';\r\nexport var Error = {\r\n /**\r\n * Gets data fields for the Error Contract\r\n * @param contract - The object containing data fields pertaining to the Error Contract\r\n */\r\n getFields: function (contract) {\r\n var instanceName = 'Error';\r\n var dataFields = [];\r\n dataFields.push(makeStringDataField(\"\".concat(instanceName, \".ErrorGroup\"), contract.errorGroup));\r\n dataFields.push(makeInt64DataField(\"\".concat(instanceName, \".Tag\"), contract.tag));\r\n if (contract.code !== undefined) {\r\n dataFields.push(makeInt64DataField(\"\".concat(instanceName, \".Code\"), contract.code));\r\n }\r\n if (contract.id !== undefined) {\r\n dataFields.push(makeInt64DataField(\"\".concat(instanceName, \".Id\"), contract.id));\r\n }\r\n if (contract.count !== undefined) {\r\n dataFields.push(makeInt64DataField(\"\".concat(instanceName, \".Count\"), contract.count));\r\n }\r\n return dataFields;\r\n }\r\n}; // Error\r\n//# sourceMappingURL=InternalContracts.js.map","import { __extends } from \"tslib\";\r\nimport { SimpleTelemetryLogger } from './SimpleTelemetryLogger';\r\nimport { createActivity } from './Activity';\r\nimport { Error } from './InternalContracts';\r\nimport { Activity } from './Contracts';\r\nimport { getBaseCv } from './CorrelationVector';\r\n/**\r\n * A TelemetryLogger that includes more advanced functions than the SimpleTelemetryLogger,\r\n * specifically activities and errors.\r\n */\r\nvar TelemetryLogger = /** @class */ (function (_super) {\r\n __extends(TelemetryLogger, _super);\r\n function TelemetryLogger(parent, persistentDataFields, config) {\r\n var _this = _super.call(this, parent, persistentDataFields, config) || this;\r\n _this.baseCv = getBaseCv();\r\n return _this;\r\n }\r\n /**\r\n * Creates a new activity. The caller is responsible for setting the result and calling endNow.\r\n * @param telemetryEvent - The underlying telemetry event for this activity\r\n */\r\n TelemetryLogger.prototype.createActivity = function (telemetryEvent) {\r\n return createActivity({\r\n sendTelemetryEvent: this.sendTelemetryEvent.bind(this),\r\n telemetryEvent: telemetryEvent,\r\n parentCv: this.baseCv\r\n });\r\n };\r\n /**\r\n * Advanced usage: Sends an activity. The caller is responsible for setting all of the activity parameters.\r\n * @param activityName - The name of the activity\r\n * @param activity - The activity contract\r\n * @param dataFields - Optional additional data fields\r\n * @param eventFlags - Event flags\r\n */\r\n TelemetryLogger.prototype.sendActivity = function (activityName, activity, dataFields, eventFlags) {\r\n return this.sendTelemetryEvent({\r\n eventName: activityName,\r\n eventContract: {\r\n name: Activity.contractName,\r\n dataFields: Activity.getFields(activity)\r\n },\r\n dataFields: dataFields,\r\n eventFlags: eventFlags\r\n });\r\n };\r\n /**\r\n * Sends an event with the Error data contract. A convenience wrapper around sendTelemetryEvent, with\r\n * an Error as a data field.\r\n * @param error - an ErrorEvent that represents the error\r\n */\r\n TelemetryLogger.prototype.sendError = function (error) {\r\n var dataFields = Error.getFields(error.error);\r\n if (error.dataFields != null) {\r\n dataFields.push.apply(dataFields, error.dataFields);\r\n }\r\n return this.sendTelemetryEvent({\r\n eventName: error.eventName,\r\n dataFields: dataFields,\r\n eventFlags: error.eventFlags\r\n });\r\n };\r\n /**\r\n * Creates a customer content activity, which should be ended by the caller by calling endNow().\r\n * @param telemetryEvent - the underlying telemetry event for the activity\r\n * @param customerContentType - the type of the customer content\r\n */\r\n TelemetryLogger.prototype.createCustomerContentActivity = function (customerContentEvent) {\r\n return createActivity({\r\n sendTelemetryEvent: this.sendCustomerContent.bind(this),\r\n telemetryEvent: customerContentEvent,\r\n parentCv: this.baseCv\r\n });\r\n };\r\n return TelemetryLogger;\r\n}(SimpleTelemetryLogger));\r\nexport { TelemetryLogger };\r\n//# sourceMappingURL=TelemetryLogger.js.map","/******************************************************************************\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\nexport function __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\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 var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\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\nexport function __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\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\n/** @deprecated */\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\n/** @deprecated */\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 __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\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\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\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 (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\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __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\nexport function __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\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { strShimUndefined, strShimObject, strShimFunction, throwTypeError, ObjClass, ObjProto, ObjAssign, ObjHasOwnProperty, ObjDefineProperty, strShimPrototype } from \"@microsoft/applicationinsights-shims\";\r\nimport { strEmpty } from \"./InternalConstants\";\r\n// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly\r\n// Added to help with minfication\r\nvar strToISOString = \"toISOString\";\r\nvar cStrEndsWith = \"endsWith\";\r\nvar cStrStartsWith = \"startsWith\";\r\nvar strIndexOf = \"indexOf\";\r\nvar strMap = \"map\";\r\nvar strReduce = \"reduce\";\r\nvar cStrTrim = \"trim\";\r\nvar strToString = \"toString\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strConstructor = \"constructor\";\r\nvar _objDefineProperty = ObjDefineProperty;\r\nvar _objFreeze = ObjClass.freeze;\r\nvar _objSeal = ObjClass.seal;\r\nvar _objKeys = ObjClass.keys;\r\nvar StringProto = String[strShimPrototype];\r\nvar _strTrim = StringProto[cStrTrim];\r\nvar _strEndsWith = StringProto[cStrEndsWith];\r\nvar _strStartsWith = StringProto[cStrStartsWith];\r\nvar DateProto = Date[strShimPrototype];\r\nvar _dataToISOString = DateProto[strToISOString];\r\nvar _isArray = Array.isArray;\r\nvar _objToString = ObjProto[strToString];\r\nvar _fnToString = ObjHasOwnProperty[strToString];\r\n// Cache what this browser reports as the object function constructor (as a string)\r\nvar _objFunctionString = _fnToString.call(ObjClass);\r\nvar rCamelCase = /-([a-z])/g;\r\nvar rNormalizeInvalid = /([^\\w\\d_$])/g;\r\nvar rLeadingNumeric = /^(\\d+[\\w\\d_$])/;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Object[\"getPrototypeOf\"];\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nexport function _getObjProto(target) {\r\n if (target) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n // target[Constructor] May break if the constructor has been changed or removed\r\n var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];\r\n if (newProto) {\r\n return newProto;\r\n }\r\n }\r\n return null;\r\n}\r\nexport function objToString(obj) {\r\n return _objToString.call(obj);\r\n}\r\nexport function isTypeof(value, theType) {\r\n return typeof value === theType;\r\n}\r\nexport function isUndefined(value) {\r\n return value === undefined || typeof value === strShimUndefined;\r\n}\r\nexport function isNotUndefined(value) {\r\n return !isUndefined(value);\r\n}\r\nexport function isNullOrUndefined(value) {\r\n return (value === null || isUndefined(value));\r\n}\r\nexport function isNotNullOrUndefined(value) {\r\n return !isNullOrUndefined(value);\r\n}\r\nexport function hasOwnProperty(obj, prop) {\r\n return !!(obj && ObjHasOwnProperty.call(obj, prop));\r\n}\r\nexport function isObject(value) {\r\n // Changing to inline for performance\r\n return !!(value && typeof value === strShimObject);\r\n}\r\nexport function isFunction(value) {\r\n // Changing to inline for performance\r\n return !!(value && typeof value === strShimFunction);\r\n}\r\nexport function isPromiseLike(value) {\r\n return value && isFunction(value.then);\r\n}\r\n/**\r\n * Validates that the string name conforms to the JS IdentifierName specification and if not\r\n * normalizes the name so that it would. This method does not identify or change any keywords\r\n * meaning that if you pass in a known keyword the same value will be returned.\r\n * This is a simplified version\r\n * @param name The name to validate\r\n */\r\nexport function normalizeJsName(name) {\r\n var value = name;\r\n if (value && isString(value)) {\r\n // CamelCase everything after the \"-\" and remove the dash\r\n value = value.replace(rCamelCase, function (_all, letter) {\r\n return letter.toUpperCase();\r\n });\r\n value = value.replace(rNormalizeInvalid, \"_\");\r\n value = value.replace(rLeadingNumeric, function (_all, match) {\r\n return \"_\" + match;\r\n });\r\n }\r\n return value;\r\n}\r\n/**\r\n * This is a helper function for the equivalent of arForEach(objKeys(target), callbackFn), this is a\r\n * performance optimization to avoid the creation of a new array for large objects\r\n * @param target The target object to find and process the keys\r\n * @param callbackfn The function to call with the details\r\n */\r\nexport function objForEachKey(target, callbackfn) {\r\n if (target) {\r\n for (var prop in target) {\r\n if (ObjHasOwnProperty.call(target, prop)) {\r\n callbackfn.call(target, prop, target[prop]);\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function strEndsWith(value, search) {\r\n var result = false;\r\n if (value && search && !(result = value === search)) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);\r\n }\r\n return result;\r\n}\r\n/**\r\n * The _strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function _strEndsWithPoly(value, search) {\r\n var result = false;\r\n var searchLen = search ? search.length : 0;\r\n var valLen = value ? value.length : 0;\r\n if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {\r\n var pos = valLen - 1;\r\n for (var lp = searchLen - 1; lp >= 0; lp--) {\r\n if (value[pos] != search[lp]) {\r\n return false;\r\n }\r\n pos--;\r\n }\r\n result = true;\r\n }\r\n return result;\r\n}\r\n/**\r\n * The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param checkValue - The characters to be searched for at the start of the value.\r\n * @returns true if the given search value is found at the start of the string, otherwise false.\r\n */\r\nexport function strStartsWith(value, checkValue) {\r\n var result = false;\r\n if (value && checkValue && !(result = value === checkValue)) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n result = _strStartsWith ? value[cStrStartsWith](checkValue) : _strStartsWithPoly(value, checkValue);\r\n }\r\n return result;\r\n}\r\n/**\r\n * The strStartsWith() method determines whether a string starts with the characters of the specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param checkValue - The characters to be searched for at the start of the value.\r\n * @returns true if the given search value is found at the start of the string, otherwise false.\r\n */\r\nexport function _strStartsWithPoly(value, checkValue) {\r\n // Using helper for performance and because string startsWith() is not available on IE\r\n var result = false;\r\n var chkLen = checkValue ? checkValue.length : 0;\r\n if (value && chkLen && value.length >= chkLen && !(result = value === checkValue)) {\r\n for (var lp = 0; lp < chkLen; lp++) {\r\n if (value[lp] !== checkValue[lp]) {\r\n return false;\r\n }\r\n }\r\n result = true;\r\n }\r\n return result;\r\n}\r\n/**\r\n * A simple wrapper (for minification support) to check if the value contains the search string.\r\n * @param value - The string value to check for the existence of the search value\r\n * @param search - The value search within the value\r\n */\r\nexport function strContains(value, search) {\r\n if (value && search) {\r\n return value.indexOf(search) !== -1;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Check if an object is of type Date\r\n */\r\nexport function isDate(obj) {\r\n return !!(obj && _objToString.call(obj) === \"[object Date]\");\r\n}\r\n/**\r\n * Check if an object is of type Array with optional generic T, the generic type is not validated\r\n * and exists to help with TypeScript validation only.\r\n */\r\nexport var isArray = _isArray || _isArrayPoly;\r\nfunction _isArrayPoly(obj) {\r\n return !!(obj && _objToString.call(obj) === \"[object Array]\");\r\n}\r\n/**\r\n * Check if an object is of type Error\r\n */\r\nexport function isError(obj) {\r\n return !!(obj && _objToString.call(obj) === \"[object Error]\");\r\n}\r\n/**\r\n * Checks if the type of value is a string.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a string, false otherwise.\r\n */\r\nexport function isString(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"string\";\r\n}\r\n/**\r\n * Checks if the type of value is a number.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a number, false otherwise.\r\n */\r\nexport function isNumber(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"number\";\r\n}\r\n/**\r\n * Checks if the type of value is a boolean.\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a boolean, false otherwise.\r\n */\r\nexport function isBoolean(value) {\r\n // Changing to inline for performance\r\n return typeof value === \"boolean\";\r\n}\r\n/**\r\n * Checks if the type of value is a Symbol.\r\n * This only returns a boolean as returning value is Symbol will cause issues for older TypeScript consumers\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a Symbol, false otherwise.\r\n */\r\nexport function isSymbol(value) {\r\n return typeof value === \"symbol\";\r\n}\r\n/**\r\n * Checks if the type of the value is a normal plain object (not a null or data)\r\n * @param value\r\n */\r\nexport function isPlainObject(value) {\r\n var result = false;\r\n if (value && typeof value === \"object\") {\r\n // Inlining _objGetPrototypeOf for performance to avoid an additional function call\r\n var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);\r\n if (!proto) {\r\n // No prototype found so this is a plain Object eg. 'Object.create(null)'\r\n result = true;\r\n }\r\n else {\r\n // Objects that have a prototype are plain only if they were created using the Object global (native) function\r\n if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {\r\n proto = proto[strConstructor];\r\n }\r\n result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\nexport function toISOString(date) {\r\n if (date) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);\r\n }\r\n}\r\n/**\r\n * Convert a date to I.S.O. format in IE8\r\n */\r\nexport function _toISOStringPoly(date) {\r\n if (date && date.getUTCFullYear) {\r\n var pad = function (num) {\r\n var r = String(num);\r\n if (r.length === 1) {\r\n r = \"0\" + r;\r\n }\r\n return r;\r\n };\r\n return date.getUTCFullYear()\r\n + \"-\" + pad(date.getUTCMonth() + 1)\r\n + \"-\" + pad(date.getUTCDate())\r\n + \"T\" + pad(date.getUTCHours())\r\n + \":\" + pad(date.getUTCMinutes())\r\n + \":\" + pad(date.getUTCSeconds())\r\n + \".\" + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)\r\n + \"Z\";\r\n }\r\n}\r\n/**\r\n * Performs the specified action for each element in an array. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype\r\n * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would\r\n * cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop\r\n * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\nexport function arrForEach(arr, callbackfn, thisArg) {\r\n var len = arr.length;\r\n try {\r\n for (var idx = 0; idx < len; idx++) {\r\n if (idx in arr) {\r\n if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype\r\n * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would\r\n * cause a testing requirement to test with and without the implementations\r\n * @param searchElement The value to locate in the array.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\nexport function arrIndexOf(arr, searchElement, fromIndex) {\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strIndexOf]) {\r\n return arr[strIndexOf](searchElement, fromIndex);\r\n }\r\n var len = arr.length;\r\n var from = fromIndex || 0;\r\n try {\r\n for (var lp = Math.max(from >= 0 ? from : len - Math.abs(from), 0); lp < len; lp++) {\r\n if (lp in arr && arr[lp] === searchElement) {\r\n return lp;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n }\r\n return -1;\r\n}\r\n/**\r\n * Calls a defined callback function on each element of an array, and returns an array that contains the results. This helper exists\r\n * to avoid adding a polyfil for older browsers that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page\r\n * checks for presence/absence of the prototype implementation. Note: For consistency this will not use the Array.prototype.xxxx\r\n * implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\r\n */\r\nexport function arrMap(arr, callbackfn, thisArg) {\r\n var results;\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strMap]) {\r\n return arr[strMap](callbackfn, thisArg);\r\n }\r\n var len = arr.length;\r\n var _this = thisArg || arr;\r\n results = new Array(len);\r\n try {\r\n for (var lp = 0; lp < len; lp++) {\r\n if (lp in arr) {\r\n results[lp] = callbackfn.call(_this, arr[lp], arr);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n }\r\n return results;\r\n}\r\n/**\r\n * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is\r\n * provided as an argument in the next call to the callback function. This helper exists to avoid adding a polyfil for older browsers that do not define\r\n * Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype implementation. Note: For consistency\r\n * this will not use the Array.prototype.xxxx implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.\r\n * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.\r\n */\r\nexport function arrReduce(arr, callbackfn, initialValue) {\r\n var value;\r\n if (arr) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (arr[strReduce]) {\r\n return arr[strReduce](callbackfn, initialValue);\r\n }\r\n var len = arr.length;\r\n var lp = 0;\r\n // Specifically checking the number of passed arguments as the value could be anything\r\n if (arguments.length >= 3) {\r\n value = arguments[2];\r\n }\r\n else {\r\n while (lp < len && !(lp in arr)) {\r\n lp++;\r\n }\r\n value = arr[lp++];\r\n }\r\n while (lp < len) {\r\n if (lp in arr) {\r\n value = callbackfn(value, arr[lp], lp, arr);\r\n }\r\n lp++;\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * helper method to trim strings (IE8 does not implement String.prototype.trim)\r\n */\r\nexport function strTrim(str) {\r\n if (str) {\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str.replace ? str.replace(/^\\s+|\\s+$/g, \"\") : str);\r\n }\r\n return str;\r\n}\r\nvar _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable(\"toString\");\r\nvar _objKeysDontEnums = [\r\n \"toString\",\r\n \"toLocaleString\",\r\n \"valueOf\",\r\n \"hasOwnProperty\",\r\n \"isPrototypeOf\",\r\n \"propertyIsEnumerable\",\r\n \"constructor\"\r\n];\r\n/**\r\n * Returns the names of the enumerable string properties and methods of an object. This helper exists to avoid adding a polyfil for older browsers\r\n * that do not define Object.keys eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.keys implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @param obj Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.\r\n */\r\nexport function objKeys(obj) {\r\n var objType = typeof obj;\r\n if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {\r\n throwTypeError(\"objKeys called on non-object\");\r\n }\r\n // For Performance try and use the native instance, using string lookup of the function to easily pass the ES3 build checks and minification\r\n if (!_objKeysHasDontEnumBug && _objKeys) {\r\n return _objKeys(obj);\r\n }\r\n var result = [];\r\n for (var prop in obj) {\r\n if (obj && ObjHasOwnProperty.call(obj, prop)) {\r\n result.push(prop);\r\n }\r\n }\r\n if (_objKeysHasDontEnumBug) {\r\n var dontEnumsLength = _objKeysDontEnums.length;\r\n for (var lp = 0; lp < dontEnumsLength; lp++) {\r\n if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {\r\n result.push(_objKeysDontEnums[lp]);\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Try to define get/set object property accessors for the target object/prototype, this will provide compatibility with\r\n * existing API definition when run within an ES5+ container that supports accessors but still enable the code to be loaded\r\n * and executed in an ES3 container, providing basic IE8 compatibility.\r\n * @param target The object on which to define the property.\r\n * @param prop The name of the property to be defined or modified.\r\n * @param getProp The getter function to wire against the getter.\r\n * @param setProp The setter function to wire against the setter.\r\n * @returns True if it was able to create the accessors otherwise false\r\n */\r\nexport function objDefineAccessors(target, prop, getProp, setProp) {\r\n if (_objDefineProperty) {\r\n try {\r\n var descriptor = {\r\n enumerable: true,\r\n configurable: true\r\n };\r\n if (getProp) {\r\n descriptor.get = getProp;\r\n }\r\n if (setProp) {\r\n descriptor.set = setProp;\r\n }\r\n _objDefineProperty(target, prop, descriptor);\r\n return true;\r\n }\r\n catch (e) {\r\n // IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw\r\n // We will just ignore this here.\r\n }\r\n }\r\n return false;\r\n}\r\nfunction _doNothing(value) {\r\n return value;\r\n}\r\nexport function deepFreeze(obj) {\r\n if (_objFreeze) {\r\n objForEachKey(obj, function (name, value) {\r\n if (isArray(value) || isObject(value)) {\r\n _objFreeze(value);\r\n }\r\n });\r\n }\r\n return objFreeze(obj);\r\n}\r\nexport var objFreeze = _objFreeze || _doNothing;\r\nexport var objSeal = _objSeal || _doNothing;\r\n/**\r\n * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)\r\n * https://caniuse.com/#search=Date.now\r\n */\r\nexport function dateNow() {\r\n var dt = Date;\r\n return dt.now ? dt.now() : new dt().getTime();\r\n}\r\n/**\r\n * Returns the name of object if it's an Error. Otherwise, returns empty string.\r\n */\r\nexport function getExceptionName(object) {\r\n if (isError(object)) {\r\n return object.name;\r\n }\r\n return strEmpty;\r\n}\r\n/**\r\n * Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk\r\n * function will only be called if the new value is no equal to the original value.\r\n * @param target - The target object\r\n * @param field - The key of the target\r\n * @param value - The value to set\r\n * @param valChk - [Optional] Callback to check the value that if supplied will be called check if the new value can be set\r\n * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)\r\n * @returns The existing or new value, depending what was set\r\n */\r\nexport function setValue(target, field, value, valChk, srcChk) {\r\n var theValue = value;\r\n if (target) {\r\n theValue = target[field];\r\n if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {\r\n theValue = value;\r\n target[field] = theValue;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it\r\n * @param target - The target object to return or set the default value\r\n * @param field - The key for the field to set on the target\r\n * @param defValue - [Optional] The value to set if not already present, when not provided a empty object will be added\r\n */\r\nexport function getSetValue(target, field, defValue) {\r\n var theValue;\r\n if (target) {\r\n theValue = target[field];\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n // Supports having the default as null\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n target[field] = theValue;\r\n }\r\n }\r\n else {\r\n // Expanded for performance so we only check defValue if required\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n }\r\n return theValue;\r\n}\r\nexport function isNotTruthy(value) {\r\n return !value;\r\n}\r\nexport function isTruthy(value) {\r\n return !!value;\r\n}\r\nexport function throwError(message) {\r\n throw new Error(message);\r\n}\r\nfunction _createProxyFunction(source, funcName) {\r\n var srcFunc = null;\r\n var src = null;\r\n if (isFunction(source)) {\r\n srcFunc = source;\r\n }\r\n else {\r\n src = source;\r\n }\r\n return function () {\r\n // Capture the original arguments passed to the method\r\n var originalArguments = arguments;\r\n if (srcFunc) {\r\n src = srcFunc();\r\n }\r\n if (src) {\r\n return src[funcName].apply(src, originalArguments);\r\n }\r\n };\r\n}\r\n/**\r\n * Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from\r\n * the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential\r\n * implementation issues by assigning prototype functions as instance ones\r\n *\r\n * This method is the primary method used to \"update\" the snippet proxy with the ultimate implementations.\r\n *\r\n * Special ES3 Notes:\r\n * Updates (setting) of direct property values on the target or indirectly on the source object WILL NOT WORK PROPERLY, updates to the\r\n * properties of \"referenced\" object will work (target.context.newValue = 10 => will be reflected in the source.context as it's the\r\n * same object). ES3 Failures: assigning target.myProp = 3 -> Won't change source.myProp = 3, likewise the reverse would also fail.\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param chkSet - An optional callback to determine whether a specific property/function should be proxied\r\n */\r\nexport function proxyAssign(target, source, chkSet) {\r\n if (target && source && isObject(target) && isObject(source)) {\r\n var _loop_1 = function (field) {\r\n if (isString(field)) {\r\n var value = source[field];\r\n if (isFunction(value)) {\r\n if (!chkSet || chkSet(field, true, source, target)) {\r\n // Create a proxy function rather than just copying the (possible) prototype to the new object as an instance function\r\n target[field] = _createProxyFunction(source, field);\r\n }\r\n }\r\n else if (!chkSet || chkSet(field, false, source, target)) {\r\n if (hasOwnProperty(target, field)) {\r\n // Remove any previous instance property\r\n delete target[field];\r\n }\r\n if (!objDefineAccessors(target, field, function () {\r\n return source[field];\r\n }, function (theValue) {\r\n source[field] = theValue;\r\n })) {\r\n // Unable to create an accessor, so just assign the values as a fallback\r\n // -- this will (mostly) work for objects\r\n // -- but will fail for accessing primitives (if the source changes it) and all types of \"setters\" as the source won't be modified\r\n target[field] = value;\r\n }\r\n }\r\n }\r\n };\r\n // effectively apply/proxy full source to the target instance\r\n for (var field in source) {\r\n _loop_1(field);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Creates a proxy function on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param name - The function name that will be added on the target\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param theFunc - The function name on the source that will be proxied on the target\r\n * @param overwriteTarget - If `false` this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {\r\n if (target && name && source) {\r\n if (overwriteTarget !== false || isUndefined(target[name])) {\r\n target[name] = _createProxyFunction(source, theFunc);\r\n }\r\n }\r\n}\r\n/**\r\n * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.\r\n *\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param functionsToProxy - An array of function names that will be proxied on the target\r\n * @param overwriteTarget - If false this will not replace any pre-existing name otherwise (the default) it will overwrite any existing name\r\n */\r\nexport function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {\r\n if (target && source && isObject(target) && isArray(functionsToProxy)) {\r\n arrForEach(functionsToProxy, function (theFuncName) {\r\n if (isString(theFuncName)) {\r\n proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);\r\n }\r\n });\r\n }\r\n return target;\r\n}\r\n/**\r\n * Simpler helper to create a dynamic class that implements the interface and populates the values with the defaults.\r\n * Only instance properties (hasOwnProperty) values are copied from the defaults to the new instance\r\n * @param defaults Simple helper\r\n */\r\nexport function createClassFromInterface(defaults) {\r\n return /** @class */ (function () {\r\n function class_1() {\r\n var _this_1 = this;\r\n if (defaults) {\r\n objForEachKey(defaults, function (field, value) {\r\n _this_1[field] = value;\r\n });\r\n }\r\n }\r\n return class_1;\r\n }());\r\n}\r\n/**\r\n * A helper function to assist with JIT performance for objects that have properties added / removed dynamically\r\n * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this\r\n * function after you have finished \"updating\" the object, calling this within loops reduces or defeats the benefits.\r\n * This helps when iterating using for..in, objKeys() and objForEach()\r\n * @param theObject - The object to be optimized if possible\r\n */\r\nexport function optimizeObject(theObject) {\r\n // V8 Optimization to cause the JIT compiler to create a new optimized object for looking up the own properties\r\n // primarily for object with <= 19 properties for >= 20 the effect is reduced or non-existent\r\n if (theObject && ObjAssign) {\r\n theObject = ObjClass(ObjAssign({}, theObject));\r\n }\r\n return theObject;\r\n}\r\nexport function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {\r\n // Variables\r\n var theArgs = arguments;\r\n var extended = theArgs[0] || {};\r\n var argLen = theArgs.length;\r\n var deep = false;\r\n var idx = 1;\r\n // Check for \"Deep\" flag\r\n if (argLen > 0 && isBoolean(extended)) {\r\n deep = extended;\r\n extended = theArgs[idx] || {};\r\n idx++;\r\n }\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if (!isObject(extended)) {\r\n extended = {};\r\n }\r\n // Loop through each remaining object and conduct a merge\r\n for (; idx < argLen; idx++) {\r\n var arg = theArgs[idx];\r\n var isArgArray = isArray(arg);\r\n var isArgObj = isObject(arg);\r\n for (var prop in arg) {\r\n var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));\r\n if (!propOk) {\r\n continue;\r\n }\r\n var newValue = arg[prop];\r\n var isNewArray = void 0;\r\n // If deep merge and property is an object, merge properties\r\n if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {\r\n // Grab the current value of the extended object\r\n var clone = extended[prop];\r\n if (isNewArray) {\r\n if (!isArray(clone)) {\r\n // We can't \"merge\" an array with a non-array so overwrite the original\r\n clone = [];\r\n }\r\n }\r\n else if (!isPlainObject(clone)) {\r\n // We can't \"merge\" an object with a non-object\r\n clone = {};\r\n }\r\n // Never move the original objects always clone them\r\n newValue = objExtend(deep, clone, newValue);\r\n }\r\n // Assign the new (or previous) value (unless undefined)\r\n if (newValue !== undefined) {\r\n extended[prop] = newValue;\r\n }\r\n }\r\n }\r\n return extended;\r\n}\r\n//# sourceMappingURL=HelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\nexport var strEmpty = \"\";\r\nexport var strProcessTelemetry = \"processTelemetry\";\r\nexport var strPriority = \"priority\";\r\nexport var strSetNextPlugin = \"setNextPlugin\";\r\nexport var strIsInitialized = \"isInitialized\";\r\nexport var strTeardown = \"teardown\";\r\nexport var strCore = \"core\";\r\nexport var strUpdate = \"update\";\r\nexport var strDisabled = \"disabled\";\r\nexport var strDoTeardown = \"_doTeardown\";\r\nexport var strProcessNext = \"processNext\";\r\nexport var strResume = \"resume\";\r\nexport var strPause = \"pause\";\r\nexport var strNotificationListener = \"NotificationListener\";\r\nexport var strAddNotificationListener = \"add\" + strNotificationListener;\r\nexport var strRemoveNotificationListener = \"remove\" + strNotificationListener;\r\nexport var strEventsSent = \"eventsSent\";\r\nexport var strEventsDiscarded = \"eventsDiscarded\";\r\nexport var strEventsSendRequest = \"eventsSendRequest\";\r\nexport var strPerfEvent = \"perfEvent\";\r\n//# sourceMappingURL=InternalConstants.js.map","import { isBoolean, isString, isNullOrUndefined } from '@microsoft/1ds-core-js';\r\nimport { logError, logNotification, Platform, AudienceGroup } from '@microsoft/oteljs';\r\n// Constants\r\nvar DATA_TOKEN = 'Data.';\r\nvar CONTRACT_TOKEN = 'zC.';\r\nexport var RELEASE_AUDIENCEGROUP = 'Release.AudienceGroup';\r\nexport var WAC_RING = 'WAC.Ring';\r\nexport var APP_NAME = 'App.Name';\r\nexport var APP_PLATFORM = 'App.Platform';\r\nexport var APP_VERSION = 'App.Version';\r\nvar USER_PRIMARYIDENTITYHASH = 'User.PrimaryIdentityHash';\r\nvar USER_PRIMARYIDENTITYSPACE = 'User.PrimaryIdentitySpace';\r\nvar USER_TENANTID = 'User.TenantId';\r\nvar USER_ISANONYMOUS = 'User.IsAnonymous';\r\nvar USER_ISSIGNEDIN = 'User.IsSignedIn';\r\nvar SESSION_ID = 'Session.Id';\r\n/**\r\n * Aria token for Office.Telemetry\r\n */\r\nexport var ARIA_OFFICE_TELEMETRY_TOKEN = 'f998cc5ba4d448d6a1e8e913ff18be94-dd122e0a-fcf8-4dc5-9dbb-6afac5325183-7405'; // Office.Telemetry\r\nexport var CUSTOMER_CONTENT_TENANT_TOKEN = 'b22a201c3f1d41d28ccc399ba6cc9ca2-1972c77f-1f79-4283-a0f9-b4ddc4646f55-7121';\r\nexport var voidValue = undefined;\r\n/**\r\n * Add OTelJS DataField fields to a 1DS data object\r\n * @param data The object to hold 1DS fields\r\n * @param fields The DataField fields to add\r\n * @param options The IOneDSFieldOptions for changing how fields are added\r\n * @return true if event is valid, false is event is invalid\r\n */\r\nexport function addOneDSFields(data, fields, prependDataToken, eventType) {\r\n var validEvent = true;\r\n if (fields) {\r\n var _loop_1 = function (field) {\r\n var fieldClassification = field.classification;\r\n var fieldDataType = field.dataType;\r\n var fieldName = field.name;\r\n // We can usually only send SystemMetadata or EssentialServiceMetadata\r\n // CustomerContent is also possible if it's enabled\r\n // We drop events with other fields\r\n if (fieldClassification &&\r\n !(fieldClassification === 4 /* DataClassification.SystemMetadata */ ||\r\n fieldClassification === 1 /* DataClassification.EssentialServiceMetadata */ ||\r\n (eventType === 2 /* EventType.CustomerContent */ && fieldClassification === 32 /* DataClassification.CustomerContent */) ||\r\n (eventType === 3 /* EventType.DirectNumericEvent */ && fieldClassification === 2048 /* DataClassification.DirectMeasurementData */))) {\r\n validEvent = false;\r\n return \"break\";\r\n }\r\n // Part C Direct Numeric fields can only be of boolean, double, or int64 data type\r\n // Prepend data token indicates that the field is a Part C field\r\n if (eventType === 3 /* EventType.DirectNumericEvent */ &&\r\n prependDataToken &&\r\n fieldDataType !== 3 /* DataFieldType.Double */ &&\r\n fieldDataType !== 1 /* DataFieldType.Boolean */ &&\r\n fieldDataType !== 2 /* DataFieldType.Int64 */ &&\r\n fieldName !== 'OTelJS.Version' &&\r\n fieldName !== 'OTelJS.Sink') {\r\n logNotification(0 /* LogLevel.Error */, 1 /* Category.Sink */, function () { return 'DNM: Invalid field type ' + fieldName; });\r\n validEvent = false;\r\n return \"break\";\r\n }\r\n var modifiedFieldName = void 0;\r\n if (prependDataToken) {\r\n if (fieldName.substr(0, 3) === CONTRACT_TOKEN) {\r\n modifiedFieldName = CONTRACT_TOKEN + DATA_TOKEN + fieldName.substr(3);\r\n }\r\n else {\r\n modifiedFieldName = DATA_TOKEN + fieldName;\r\n }\r\n }\r\n else {\r\n modifiedFieldName = fieldName;\r\n }\r\n var eventPropertyType = void 0;\r\n switch (fieldDataType) {\r\n case 3 /* DataFieldType.Double */:\r\n eventPropertyType = 6 /* EventPropertyType.Double */;\r\n break;\r\n case 2 /* DataFieldType.Int64 */:\r\n eventPropertyType = 4 /* EventPropertyType.Int64 */;\r\n break;\r\n case 4 /* DataFieldType.Guid */:\r\n eventPropertyType = 8 /* EventPropertyType.Guid */;\r\n break;\r\n case 0 /* DataFieldType.String */:\r\n // Strings and booleans are set directly, not as IEventProperties -\r\n // tables get created with the appropriate data types on the collector side.\r\n // This helps to save about 25% of the event size!\r\n // The 1DS SDK assigns a default type of Double to any numbers, so we still\r\n // to send the data types for those values.\r\n // Limit the maximum allowed string length on a data field to avoid accidentally going over\r\n // the maximum allowed serialized size for a 1DS event and having the event dropped.\r\n // That and 1ds-post v2.4.4 and v3.0.0 have a bug that will put the code into an infinite\r\n // loop if that condition is trigged.\r\n // Some callers erroneously pass a non-string value here, which we pass on to the SDK as-is.\r\n data[modifiedFieldName] = typeof field.value === 'string' ? field.value.substr(0, 25000) : field.value;\r\n return \"continue\";\r\n case 1 /* DataFieldType.Boolean */:\r\n default:\r\n data[modifiedFieldName] = field.value;\r\n return \"continue\";\r\n }\r\n var eventProperty = {\r\n value: field.value,\r\n propertyType: eventPropertyType\r\n };\r\n data[modifiedFieldName] = eventProperty;\r\n };\r\n for (var _i = 0, fields_1 = fields; _i < fields_1.length; _i++) {\r\n var field = fields_1[_i];\r\n var state_1 = _loop_1(field);\r\n if (state_1 === \"break\")\r\n break;\r\n }\r\n }\r\n return validEvent;\r\n}\r\nexport function tryCatch(func, errorReturn) {\r\n try {\r\n return func();\r\n }\r\n catch (error) {\r\n logError(1 /* Category.Sink */, '1DS Sink', error);\r\n return errorReturn;\r\n }\r\n}\r\n/**\r\n * Get a properly formatted timestamp\r\n * @param event - Telemetry event to calculate timestamp for\r\n */\r\nexport function getTimestamp(event) {\r\n var timestampLocal;\r\n if (event.timestamp) {\r\n timestampLocal = new Date(event.timestamp);\r\n }\r\n else {\r\n timestampLocal = new Date();\r\n }\r\n return timestampLocal;\r\n}\r\nexport function preprocessEvent(telemetryEvent, preprocessors) {\r\n var _loop_2 = function (i) {\r\n var preprocessor = preprocessors[i];\r\n if (!preprocessor.processEvent(telemetryEvent)) {\r\n logNotification(2 /* LogLevel.Info */, 1 /* Category.Sink */, function () {\r\n return \"\".concat(telemetryEvent.eventName, \" suppressed by \").concat(preprocessor.name);\r\n });\r\n return { value: false };\r\n }\r\n };\r\n for (var i = 0; i < preprocessors.length; i++) {\r\n var state_2 = _loop_2(i);\r\n if (typeof state_2 === \"object\")\r\n return state_2.value;\r\n }\r\n return true;\r\n}\r\nfunction logInvalidField(fieldName) {\r\n logNotification(0 /* LogLevel.Error */, 1 /* Category.Sink */, function () {\r\n return 'Invalid ' + fieldName;\r\n });\r\n}\r\nfunction isNonEmptyString(value) {\r\n return isString(value) && value != '';\r\n}\r\nfunction matchesEnum(value, enumType) {\r\n return Object.values(enumType).includes(value);\r\n}\r\nfunction isValidAppPlatform(value) {\r\n return matchesEnum(value, Platform);\r\n}\r\nfunction isValidReleaseAudienceGroup(value) {\r\n return matchesEnum(value, AudienceGroup);\r\n}\r\nfunction isValidPrimaryIdentitySpace(value) {\r\n // In v5 we can save some bytes and iterate through the PrimaryIdentitySpace enum directly.\r\n // Currently that list has a bunch of deprecated values.\r\n return [\r\n \"MSACID\" /* PrimaryIdentitySpace.MSACID */,\r\n \"MSAPUID\" /* PrimaryIdentitySpace.MSAPUID */,\r\n \"OrgIdCID\" /* PrimaryIdentitySpace.OrgIdCID */,\r\n \"OrgIdPUID\" /* PrimaryIdentitySpace.OrgIdPUID */,\r\n \"UserObjectId\" /* PrimaryIdentitySpace.UserObjectId */,\r\n \"Other\" /* PrimaryIdentitySpace.Other */\r\n ].includes(value);\r\n}\r\nfunction isOtherIfDefined(value) {\r\n return !value || value == \"Other\" /* PrimaryIdentitySpace.Other */;\r\n}\r\nexport function areCoreFieldsValid(data, strict) {\r\n var isValid = true;\r\n function validateField(fieldName, validate) {\r\n if (!validate(data[fieldName])) {\r\n logInvalidField(fieldName);\r\n isValid = false;\r\n }\r\n }\r\n function isValidGuid(value) {\r\n // If not strict, use \"i\" for case-insensitive match\r\n var regexpFlags = strict ? '' : 'i';\r\n var guid = new RegExp('^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$', regexpFlags);\r\n return guid.test(value);\r\n }\r\n validateField(APP_NAME, isNonEmptyString);\r\n validateField(APP_PLATFORM, strict ? isValidAppPlatform : isNonEmptyString);\r\n validateField(APP_VERSION, isNonEmptyString);\r\n validateField(SESSION_ID, isValidGuid);\r\n if (strict) {\r\n validateField(RELEASE_AUDIENCEGROUP, isValidReleaseAudienceGroup);\r\n validateField(USER_ISSIGNEDIN, isBoolean);\r\n if (data[USER_ISSIGNEDIN]) {\r\n validateField(USER_PRIMARYIDENTITYHASH, isNonEmptyString);\r\n validateField(USER_PRIMARYIDENTITYSPACE, isValidPrimaryIdentitySpace);\r\n if ([\"OrgIdCID\" /* PrimaryIdentitySpace.OrgIdCID */, \"OrgIdPUID\" /* PrimaryIdentitySpace.OrgIdPUID */, \"UserObjectId\" /* PrimaryIdentitySpace.UserObjectId */].includes(data[USER_PRIMARYIDENTITYSPACE])) {\r\n validateField(USER_TENANTID, isValidGuid);\r\n }\r\n else {\r\n validateField(USER_TENANTID, isNullOrUndefined);\r\n }\r\n }\r\n else {\r\n validateField(USER_PRIMARYIDENTITYSPACE, isOtherIfDefined);\r\n validateField(USER_TENANTID, isNullOrUndefined);\r\n }\r\n }\r\n else {\r\n // If IsAnonymous is false or unset, then User fields must be defined.\r\n // If IsAnonymous is true, we don't check user fields.\r\n if (!data[USER_ISANONYMOUS] && data[USER_ISSIGNEDIN] !== false) {\r\n validateField(USER_PRIMARYIDENTITYHASH, isNonEmptyString);\r\n validateField(USER_PRIMARYIDENTITYSPACE, isNonEmptyString);\r\n if (data[USER_TENANTID]) {\r\n validateField(USER_TENANTID, isValidGuid);\r\n }\r\n }\r\n }\r\n // IsAnonymous and IsSignedIn cannot have the same value\r\n if (!isNullOrUndefined(data[USER_ISANONYMOUS]) && data[USER_ISSIGNEDIN] === data[USER_ISANONYMOUS]) {\r\n logInvalidField(USER_ISANONYMOUS);\r\n isValid = false;\r\n }\r\n return isValid;\r\n}\r\n//# sourceMappingURL=InternalUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { getGlobal, strShimUndefined, strShimObject, strShimPrototype } from \"@microsoft/applicationinsights-shims\";\r\nimport { strEmpty } from \"./InternalConstants\";\r\nimport { isString, isUndefined, strContains } from \"./HelperFuncs\";\r\n/**\r\n * This file exists to hold environment utilities that are required to check and\r\n * validate the current operating environment. Unless otherwise required, please\r\n * only use defined methods (functions) in this class so that users of these\r\n * functions/properties only need to include those that are used within their own modules.\r\n */\r\nvar strWindow = \"window\";\r\nvar strDocument = \"document\";\r\nvar strDocumentMode = \"documentMode\";\r\nvar strNavigator = \"navigator\";\r\nvar strHistory = \"history\";\r\nvar strLocation = \"location\";\r\nvar strConsole = \"console\";\r\nvar strPerformance = \"performance\";\r\nvar strJSON = \"JSON\";\r\nvar strCrypto = \"crypto\";\r\nvar strMsCrypto = \"msCrypto\";\r\nvar strReactNative = \"ReactNative\";\r\nvar strMsie = \"msie\";\r\nvar strTrident = \"trident/\";\r\nvar strXMLHttpRequest = \"XMLHttpRequest\";\r\nvar _isTrident = null;\r\nvar _navUserAgentCheck = null;\r\nvar _enableMocks = false;\r\nvar _useXDomainRequest = null;\r\nvar _beaconsSupported = null;\r\nfunction _hasProperty(theClass, property) {\r\n var supported = false;\r\n if (theClass) {\r\n try {\r\n supported = property in theClass;\r\n if (!supported) {\r\n var proto = theClass[strShimPrototype];\r\n if (proto) {\r\n supported = property in proto;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do Nothing\r\n }\r\n if (!supported) {\r\n try {\r\n var tmp = new theClass();\r\n supported = !isUndefined(tmp[property]);\r\n }\r\n catch (e) {\r\n // Do Nothing\r\n }\r\n }\r\n }\r\n return supported;\r\n}\r\n/**\r\n * Enable the lookup of test mock objects if requested\r\n * @param enabled\r\n */\r\nexport function setEnableEnvMocks(enabled) {\r\n _enableMocks = enabled;\r\n}\r\n/**\r\n * Return the named global object if available, will return null if the object is not available.\r\n * @param name The globally named object\r\n */\r\nexport function getGlobalInst(name) {\r\n var gbl = getGlobal();\r\n if (gbl && gbl[name]) {\r\n return gbl[name];\r\n }\r\n // Test workaround, for environments where .window (when global == window) doesn't return the base window\r\n if (name === strWindow && hasWindow()) {\r\n // tslint:disable-next-line: no-angle-bracket-type-assertion\r\n return window;\r\n }\r\n return null;\r\n}\r\n/**\r\n * Checks if window object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a window\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: window is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasWindow() {\r\n return Boolean(typeof window === strShimObject && window);\r\n}\r\n/**\r\n * Returns the global window object if it is present otherwise null.\r\n * This helper is used to access the window object without causing an exception\r\n * \"Uncaught ReferenceError: window is not defined\"\r\n */\r\nexport function getWindow() {\r\n if (hasWindow()) {\r\n return window;\r\n }\r\n // Return the global instance or null\r\n return getGlobalInst(strWindow);\r\n}\r\n/**\r\n * Checks if document object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a document\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: document is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasDocument() {\r\n return Boolean(typeof document === strShimObject && document);\r\n}\r\n/**\r\n * Returns the global document object if it is present otherwise null.\r\n * This helper is used to access the document object without causing an exception\r\n * \"Uncaught ReferenceError: document is not defined\"\r\n */\r\nexport function getDocument() {\r\n if (hasDocument()) {\r\n return document;\r\n }\r\n return getGlobalInst(strDocument);\r\n}\r\n/**\r\n * Checks if navigator object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a navigator\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: navigator is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasNavigator() {\r\n return Boolean(typeof navigator === strShimObject && navigator);\r\n}\r\n/**\r\n * Returns the global navigator object if it is present otherwise null.\r\n * This helper is used to access the navigator object without causing an exception\r\n * \"Uncaught ReferenceError: navigator is not defined\"\r\n */\r\nexport function getNavigator() {\r\n if (hasNavigator()) {\r\n return navigator;\r\n }\r\n return getGlobalInst(strNavigator);\r\n}\r\n/**\r\n * Checks if history object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: history is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasHistory() {\r\n return Boolean(typeof history === strShimObject && history);\r\n}\r\n/**\r\n * Returns the global history object if it is present otherwise null.\r\n * This helper is used to access the history object without causing an exception\r\n * \"Uncaught ReferenceError: history is not defined\"\r\n */\r\nexport function getHistory() {\r\n if (hasHistory()) {\r\n return history;\r\n }\r\n return getGlobalInst(strHistory);\r\n}\r\n/**\r\n * Returns the global location object if it is present otherwise null.\r\n * This helper is used to access the location object without causing an exception\r\n * \"Uncaught ReferenceError: location is not defined\"\r\n */\r\nexport function getLocation(checkForMock) {\r\n if (checkForMock && _enableMocks) {\r\n var mockLocation = getGlobalInst(\"__mockLocation\");\r\n if (mockLocation) {\r\n return mockLocation;\r\n }\r\n }\r\n if (typeof location === strShimObject && location) {\r\n return location;\r\n }\r\n return getGlobalInst(strLocation);\r\n}\r\n/**\r\n * Returns the global console object\r\n */\r\nexport function getConsole() {\r\n if (typeof console !== strShimUndefined) {\r\n return console;\r\n }\r\n return getGlobalInst(strConsole);\r\n}\r\n/**\r\n * Returns the performance object if it is present otherwise null.\r\n * This helper is used to access the performance object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getPerformance() {\r\n return getGlobalInst(strPerformance);\r\n}\r\n/**\r\n * Checks if JSON object is available, this is required as we support the API running without a\r\n * window /document (eg. Node server, electron webworkers) and if we attempt to assign a history\r\n * object to a local variable or pass as an argument an \"Uncaught ReferenceError: JSON is not defined\"\r\n * exception will be thrown.\r\n * Defined as a function to support lazy / late binding environments.\r\n */\r\nexport function hasJSON() {\r\n return Boolean((typeof JSON === strShimObject && JSON) || getGlobalInst(strJSON) !== null);\r\n}\r\n/**\r\n * Returns the global JSON object if it is present otherwise null.\r\n * This helper is used to access the JSON object without causing an exception\r\n * \"Uncaught ReferenceError: JSON is not defined\"\r\n */\r\nexport function getJSON() {\r\n if (hasJSON()) {\r\n return JSON || getGlobalInst(strJSON);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Returns the crypto object if it is present otherwise null.\r\n * This helper is used to access the crypto object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getCrypto() {\r\n return getGlobalInst(strCrypto);\r\n}\r\n/**\r\n * Returns the crypto object if it is present otherwise null.\r\n * This helper is used to access the crypto object from the current\r\n * global instance which could be window or globalThis for a web worker\r\n */\r\nexport function getMsCrypto() {\r\n return getGlobalInst(strMsCrypto);\r\n}\r\n/**\r\n * Returns whether the environment is reporting that we are running in a React Native Environment\r\n */\r\nexport function isReactNative() {\r\n // If running in React Native, navigator.product will be populated\r\n var nav = getNavigator();\r\n if (nav && nav.product) {\r\n return nav.product === strReactNative;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Identifies whether the current environment appears to be IE\r\n */\r\nexport function isIE() {\r\n var nav = getNavigator();\r\n if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {\r\n // Added to support test mocking of the user agent\r\n _navUserAgentCheck = nav.userAgent;\r\n var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();\r\n _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));\r\n }\r\n return _isTrident;\r\n}\r\n/**\r\n * Gets IE version returning the document emulation mode if we are running on IE, or null otherwise\r\n */\r\nexport function getIEVersion(userAgentStr) {\r\n if (userAgentStr === void 0) { userAgentStr = null; }\r\n if (!userAgentStr) {\r\n var navigator_1 = getNavigator() || {};\r\n userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty).toLowerCase() : strEmpty;\r\n }\r\n var ua = (userAgentStr || strEmpty).toLowerCase();\r\n // Also check for documentMode in case X-UA-Compatible meta tag was included in HTML.\r\n if (strContains(ua, strMsie)) {\r\n var doc = getDocument() || {};\r\n return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));\r\n }\r\n else if (strContains(ua, strTrident)) {\r\n var tridentVer = parseInt(ua.split(strTrident)[1]);\r\n if (tridentVer) {\r\n return tridentVer + 4;\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Returns string representation of an object suitable for diagnostics logging.\r\n */\r\nexport function dumpObj(object) {\r\n var objectTypeDump = Object[strShimPrototype].toString.call(object);\r\n var propertyValueDump = strEmpty;\r\n if (objectTypeDump === \"[object Error]\") {\r\n propertyValueDump = \"{ stack: '\" + object.stack + \"', message: '\" + object.message + \"', name: '\" + object.name + \"'\";\r\n }\r\n else if (hasJSON()) {\r\n propertyValueDump = getJSON().stringify(object);\r\n }\r\n return objectTypeDump + propertyValueDump;\r\n}\r\nexport function isSafari(userAgentStr) {\r\n if (!userAgentStr || !isString(userAgentStr)) {\r\n var navigator_2 = getNavigator() || {};\r\n userAgentStr = navigator_2 ? (navigator_2.userAgent || strEmpty).toLowerCase() : strEmpty;\r\n }\r\n var ua = (userAgentStr || strEmpty).toLowerCase();\r\n return (ua.indexOf(\"safari\") >= 0);\r\n}\r\n/**\r\n * Checks if HTML5 Beacons are supported in the current environment.\r\n * @returns True if supported, false otherwise.\r\n */\r\nexport function isBeaconsSupported() {\r\n if (_beaconsSupported === null) {\r\n _beaconsSupported = hasNavigator() && Boolean(getNavigator().sendBeacon);\r\n }\r\n return _beaconsSupported;\r\n}\r\n/**\r\n * Checks if the Fetch API is supported in the current environment.\r\n * @param withKeepAlive - [Optional] If True, check if fetch is available and it supports the keepalive feature, otherwise only check if fetch is supported\r\n * @returns True if supported, otherwise false\r\n */\r\nexport function isFetchSupported(withKeepAlive) {\r\n var isSupported = false;\r\n try {\r\n isSupported = !!getGlobalInst(\"fetch\");\r\n var request = getGlobalInst(\"Request\");\r\n if (isSupported && withKeepAlive && request) {\r\n isSupported = _hasProperty(request, \"keepalive\");\r\n }\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nexport function useXDomainRequest() {\r\n if (_useXDomainRequest === null) {\r\n _useXDomainRequest = (typeof XDomainRequest !== strShimUndefined);\r\n if (_useXDomainRequest && isXhrSupported()) {\r\n _useXDomainRequest = _useXDomainRequest && !_hasProperty(getGlobalInst(strXMLHttpRequest), \"withCredentials\");\r\n }\r\n }\r\n return _useXDomainRequest;\r\n}\r\n/**\r\n * Checks if XMLHttpRequest is supported\r\n * @returns True if supported, otherwise false\r\n */\r\nexport function isXhrSupported() {\r\n var isSupported = false;\r\n try {\r\n var xmlHttpRequest = getGlobalInst(strXMLHttpRequest);\r\n isSupported = !!xmlHttpRequest;\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nfunction _getNamedValue(values, name) {\r\n if (values) {\r\n for (var i = 0; i < values.length; i++) {\r\n var value = values[i];\r\n if (value.name) {\r\n if (value.name === name) {\r\n return value;\r\n }\r\n }\r\n }\r\n }\r\n return {};\r\n}\r\n/**\r\n * Helper function to fetch the named meta-tag from the page.\r\n * @param name\r\n */\r\nexport function findMetaTag(name) {\r\n var doc = getDocument();\r\n if (doc && name) {\r\n // Look for a meta-tag\r\n return _getNamedValue(doc.querySelectorAll(\"meta\"), name).content;\r\n }\r\n return null;\r\n}\r\n/**\r\n * Helper function to fetch the named server timing value from the page response (first navigation event).\r\n * @param name\r\n */\r\nexport function findNamedServerTiming(name) {\r\n var value;\r\n var perf = getPerformance();\r\n if (perf) {\r\n // Try looking for a server-timing header\r\n var navPerf = perf.getEntriesByType(\"navigation\") || [];\r\n value = _getNamedValue((navPerf.length > 0 ? navPerf[0] : {}).serverTiming, name).description;\r\n }\r\n return value;\r\n}\r\n//# sourceMappingURL=EnvUtils.js.map","/*!\n * Microsoft Dynamic Proto Utility, 1.1.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Constructor = 'constructor';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Prototype = 'prototype';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strFunction = 'function';\r\n/**\r\n * Used to define the name of the instance function lookup table\r\n * @ignore\r\n */\r\nvar DynInstFuncTable = '_dynInstFuncs';\r\n/**\r\n * Name used to tag the dynamic prototype function\r\n * @ignore\r\n */\r\nvar DynProxyTag = '_isDynProxy';\r\n/**\r\n * Name added to a prototype to define the dynamic prototype \"class\" name used to lookup the function table\r\n * @ignore\r\n */\r\nvar DynClassName = '_dynClass';\r\n/**\r\n * Prefix added to the classname to avoid any name clashes with other instance level properties\r\n * @ignore\r\n */\r\nvar DynClassNamePrefix = '_dynCls$';\r\n/**\r\n * A tag which is used to check if we have already to attempted to set the instance function if one is not present\r\n * @ignore\r\n */\r\nvar DynInstChkTag = '_dynInstChk';\r\n/**\r\n * A tag which is used to check if we are allows to try and set an instance function is one is not present. Using the same\r\n * tag name as the function level but a different const name for readability only.\r\n */\r\nvar DynAllowInstChkTag = DynInstChkTag;\r\n/**\r\n * The global (imported) instances where the global performance options are stored\r\n */\r\nvar DynProtoDefaultOptions = '_dfOpts';\r\n/**\r\n * Value used as the name of a class when it cannot be determined\r\n * @ignore\r\n */\r\nvar UnknownValue = '_unknown_';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * The polyfill version of __proto__ so that it doesn't cause issues for anyone not expecting it to exist\r\n */\r\nvar DynProtoBaseProto = \"_dyn\" + str__Proto;\r\n/**\r\n * Track the current prototype for IE8 as you can't look back to get the prototype\r\n */\r\nvar DynProtoCurrent = \"_dynInstProto\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strUseBaseInst = 'useBaseInst';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strSetInstFuncs = 'setInstFuncs';\r\nvar Obj = Object;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Obj[\"getPrototypeOf\"];\r\n/**\r\n * Pre-lookup to check for the existence of this function\r\n */\r\nvar _objGetOwnProps = Obj[\"getOwnPropertyNames\"];\r\n/**\r\n * Internal Global used to generate a unique dynamic class name, every new class will increase this value\r\n * @ignore\r\n */\r\nvar _dynamicNames = 0;\r\n/**\r\n * Helper to check if the object contains a property of the name\r\n * @ignore\r\n */\r\nfunction _hasOwnProperty(obj, prop) {\r\n return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype or Array prototype\r\n * @ignore\r\n */\r\nfunction _isObjectOrArrayPrototype(target) {\r\n return target && (target === Obj[Prototype] || target === Array[Prototype]);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype, Array prototype or Function prototype\r\n * @ignore\r\n */\r\nfunction _isObjectArrayOrFunctionPrototype(target) {\r\n return _isObjectOrArrayPrototype(target) || target === Function[Prototype];\r\n}\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n var newProto;\r\n if (target) {\r\n // This method doesn't exist in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);\r\n // Using the pre-calculated value as IE8 doesn't support looking up the prototype of a prototype and thus fails for more than 1 base class\r\n newProto = target[DynProtoBaseProto] || curProto;\r\n if (!_hasOwnProperty(target, DynProtoBaseProto)) {\r\n // As this prototype doesn't have this property then this is from an inherited class so newProto is the base to return so save it\r\n // so we can look it up value (which for a multiple hierarchy dynamicProto will be the base class)\r\n delete target[DynProtoCurrent]; // Delete any current value allocated to this instance so we pick up the value from prototype hierarchy\r\n newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];\r\n target[DynProtoCurrent] = curProto;\r\n }\r\n }\r\n return newProto;\r\n}\r\n/**\r\n * Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6\r\n * are not enumerable.\r\n * @param target\r\n */\r\nfunction _forEachProp(target, func) {\r\n var props = [];\r\n if (_objGetOwnProps) {\r\n props = _objGetOwnProps(target);\r\n }\r\n else {\r\n for (var name_1 in target) {\r\n if (typeof name_1 === \"string\" && _hasOwnProperty(target, name_1)) {\r\n props.push(name_1);\r\n }\r\n }\r\n }\r\n if (props && props.length > 0) {\r\n for (var lp = 0; lp < props.length; lp++) {\r\n func(props[lp]);\r\n }\r\n }\r\n}\r\n/**\r\n * Helper function to check whether the provided function name is a potential candidate for dynamic\r\n * callback and prototype generation.\r\n * @param target The target object, may be a prototype or class object\r\n * @param funcName The function name\r\n * @param skipOwn Skips the check for own property\r\n * @ignore\r\n */\r\nfunction _isDynamicCandidate(target, funcName, skipOwn) {\r\n return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));\r\n}\r\n/**\r\n * Helper to throw a TypeError exception\r\n * @param message the message\r\n * @ignore\r\n */\r\nfunction _throwTypeError(message) {\r\n throw new TypeError(\"DynamicProto: \" + message);\r\n}\r\n/**\r\n * Returns a collection of the instance functions that are defined directly on the thisTarget object, it does\r\n * not return any inherited functions\r\n * @param thisTarget The object to get the instance functions from\r\n * @ignore\r\n */\r\nfunction _getInstanceFuncs(thisTarget) {\r\n // Get the base proto\r\n var instFuncs = {};\r\n // Save any existing instance functions\r\n _forEachProp(thisTarget, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {\r\n // Create an instance callback for passing the base function to the caller\r\n instFuncs[name] = thisTarget[name];\r\n }\r\n });\r\n return instFuncs;\r\n}\r\n/**\r\n * Returns whether the value is included in the array\r\n * @param values The array of values\r\n * @param value The value\r\n */\r\nfunction _hasVisited(values, value) {\r\n for (var lp = values.length - 1; lp >= 0; lp--) {\r\n if (values[lp] === value) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Returns an object that contains callback functions for all \"base/super\" functions, this is used to \"save\"\r\n * enabling calling super.xxx() functions without requiring that the base \"class\" has defined a prototype references\r\n * @param target The current instance\r\n * @ignore\r\n */\r\nfunction _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {\r\n function _instFuncProxy(target, funcHost, funcName) {\r\n var theFunc = funcHost[funcName];\r\n if (theFunc[DynProxyTag] && useBaseInst) {\r\n // grab and reuse the hosted looking function (if available) otherwise the original passed function\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;\r\n }\r\n }\r\n return function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n return theFunc.apply(target, arguments);\r\n };\r\n }\r\n // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced)\r\n var baseFuncs = {};\r\n _forEachProp(instFuncs, function (name) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);\r\n });\r\n // Get the base prototype functions\r\n var baseProto = _getObjProto(classProto);\r\n var visited = [];\r\n // Don't include base object functions for Object, Array or Function\r\n while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {\r\n // look for prototype functions\r\n _forEachProp(baseProto, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the \r\n // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return\r\n // the Object prototype methods while bypassing the check\r\n if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);\r\n }\r\n });\r\n // We need to find all possible functions that might be overloaded by walking the entire prototype chain\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(baseProto);\r\n baseProto = _getObjProto(baseProto);\r\n }\r\n return baseFuncs;\r\n}\r\nfunction _getInstFunc(target, funcName, proto, currentDynProtoProxy) {\r\n var instFunc = null;\r\n // We need to check whether the class name is defined directly on this prototype otherwise\r\n // it will walk the proto chain and return any parent proto classname.\r\n if (target && _hasOwnProperty(proto, DynClassName)) {\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];\r\n if (!instFunc) {\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\r\n // We have the instance function, lets check it we can speed up further calls\r\n // by adding the instance function back directly on the instance (avoiding the dynamic func lookup)\r\n if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {\r\n // If the instance already has an instance function we can't replace it\r\n var canAddInst = !_hasOwnProperty(target, funcName);\r\n // Get current prototype\r\n var objProto = _getObjProto(target);\r\n var visited = [];\r\n // Lookup the function starting at the top (instance level prototype) and traverse down, if the first matching function\r\n // if nothing is found or if the first hit is a dynamic proto instance then we can safely add an instance shortcut\r\n while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {\r\n var protoFunc = objProto[funcName];\r\n if (protoFunc) {\r\n canAddInst = (protoFunc === currentDynProtoProxy);\r\n break;\r\n }\r\n // We need to find all possible initial functions to ensure that we don't bypass a valid override function\r\n visited.push(objProto);\r\n objProto = _getObjProto(objProto);\r\n }\r\n try {\r\n if (canAddInst) {\r\n // This instance doesn't have an instance func and the class hierarchy does have a higher level prototype version\r\n // so it's safe to directly assign for any subsequent calls (for better performance)\r\n target[funcName] = instFunc;\r\n }\r\n // Block further attempts to set the instance function for any\r\n instFunc[DynInstChkTag] = 1;\r\n }\r\n catch (e) {\r\n // Don't crash if the object is readonly or the runtime doesn't allow changing this\r\n // And set a flag so we don't try again for any function\r\n instFuncTable[DynAllowInstChkTag] = false;\r\n }\r\n }\r\n }\r\n return instFunc;\r\n}\r\nfunction _getProtoFunc(funcName, proto, currentDynProtoProxy) {\r\n var protoFunc = proto[funcName];\r\n // Check that the prototype function is not a self reference -- try to avoid stack overflow!\r\n if (protoFunc === currentDynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (typeof protoFunc !== strFunction) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc;\r\n}\r\n/**\r\n * Add the required dynamic prototype methods to the the class prototype\r\n * @param proto - The class prototype\r\n * @param className - The instance classname\r\n * @param target - The target instance\r\n * @param baseInstFuncs - The base instance functions\r\n * @param setInstanceFunc - Flag to allow prototype function to reset the instance function if one does not exist\r\n * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n // Use the instance or prototype function\r\n var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);\r\n // eslint-disable-next-line prefer-rest-params\r\n return instFunc.apply(this, arguments);\r\n };\r\n // Tag this function as a proxy to support replacing dynamic proxy elements (primary use case is for unit testing\r\n // via which can dynamically replace the prototype function reference)\r\n dynProtoProxy[DynProxyTag] = 1;\r\n return dynProtoProxy;\r\n }\r\n if (!_isObjectOrArrayPrototype(proto)) {\r\n var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};\r\n var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {}); // fetch and assign if as it may not exist yet\r\n // Set whether we are allow to lookup instances, if someone has set to false then do not re-enable\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;\r\n }\r\n _forEachProp(target, function (name) {\r\n // Only add overridden functions\r\n if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {\r\n // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function\r\n instFuncs_1[name] = target[name];\r\n delete target[name];\r\n // Add a dynamic proto if one doesn't exist or if a prototype function exists and it's not a dynamic one\r\n if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {\r\n proto[name] = _createDynamicPrototype(proto, name);\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Checks whether the passed prototype object appears to be correct by walking the prototype hierarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whether the passed prototype instance is in the hierarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n // As this is primarily a coding time check, don't bother checking if running in IE8 or lower\r\n var visited = [];\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(thisProto);\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\r\n }\r\n // If objGetPrototypeOf doesn't exist then just assume everything is ok.\r\n return true;\r\n}\r\n/**\r\n * Gets the current prototype name using the ES6 name if available otherwise falling back to a use unknown as the name.\r\n * It's not critical for this to return a name, it's used to decorate the generated unique name for easier debugging only.\r\n * @param target\r\n * @param unknownValue\r\n * @ignore\r\n */\r\nfunction _getObjName(target, unknownValue) {\r\n if (_hasOwnProperty(target, Prototype)) {\r\n // Look like a prototype\r\n return target.name || unknownValue || UnknownValue;\r\n }\r\n return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;\r\n}\r\n/**\r\n * Helper function when creating dynamic (inline) functions for classes, this helper performs the following tasks :-\r\n * - Saves references to all defined base class functions\r\n * - Calls the delegateFunc with the current target (this) and a base object reference that can be used to call all \"super\" functions.\r\n * - Will populate the class prototype for all overridden functions to support class extension that call the prototype instance.\r\n * Callers should use this helper when declaring all function within the constructor of a class, as mentioned above the delegateFunc is\r\n * passed both the target \"this\" and an object that can be used to call any base (super) functions, using this based object in place of\r\n * super.XXX() (which gets expanded to _super.prototype.XXX()) provides a better minification outcome and also ensures the correct \"this\"\r\n * context is maintained as TypeScript creates incorrect references using super.XXXX() for dynamically defined functions i.e. Functions\r\n * defined in the constructor or some other function (rather than declared as complete typescript functions).\r\n * ### Usage\r\n * ```typescript\r\n * import dynamicProto from \"@microsoft/dynamicproto-js\";\r\n * class ExampleClass extends BaseClass {\r\n * constructor() {\r\n * dynamicProto(ExampleClass, this, (_self, base) => {\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.newFunc = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * ...\r\n * }\r\n * }\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.myFunction = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * // Call the base version of the function that we are overriding\r\n * base.myFunction();\r\n * }\r\n * ...\r\n * }\r\n * _self.initialize = () => {\r\n * ...\r\n * }\r\n * // Warnings: While the following will work as _self is simply a reference to\r\n * // this, if anyone overrides myFunction() the overridden will be called first\r\n * // as the normal JavaScript method resolution will occur and the defined\r\n * // _self.initialize() function is actually gets removed from the instance and\r\n * // a proxy prototype version is created to reference the created method.\r\n * _self.initialize();\r\n * });\r\n * }\r\n * }\r\n * ```\r\n * @typeparam DPType This is the generic type of the class, used to keep intellisense valid\r\n * @typeparam DPCls The type that contains the prototype of the current class\r\n * @param theClass - This is the current class instance which contains the prototype for the current class\r\n * @param target - The current \"this\" (target) reference, when the class has been extended this.prototype will not be the 'theClass' value.\r\n * @param delegateFunc - The callback function (closure) that will create the dynamic function\r\n * @param options - Additional options to configure how the dynamic prototype operates\r\n */\r\nfunction dynamicProto(theClass, target, delegateFunc, options) {\r\n // Make sure that the passed theClass argument looks correct\r\n if (!_hasOwnProperty(theClass, Prototype)) {\r\n _throwTypeError(\"theClass is an invalid class definition.\");\r\n }\r\n // Quick check to make sure that the passed theClass argument looks correct (this is a common copy/paste error)\r\n var classProto = theClass[Prototype];\r\n if (!_checkPrototype(classProto, target)) {\r\n _throwTypeError(\"[\" + _getObjName(theClass) + \"] is not in class hierarchy of [\" + _getObjName(target) + \"]\");\r\n }\r\n var className = null;\r\n if (_hasOwnProperty(classProto, DynClassName)) {\r\n // Only grab the class name if it's defined on this prototype (i.e. don't walk the prototype chain)\r\n className = classProto[DynClassName];\r\n }\r\n else {\r\n // As not all browser support name on the prototype creating a unique dynamic one if we have not already\r\n // assigned one, so we can use a simple string as the lookup rather than an object for the dynamic instance\r\n // function table lookup.\r\n className = DynClassNamePrefix + _getObjName(theClass, \"_\") + \"$\" + _dynamicNames;\r\n _dynamicNames++;\r\n classProto[DynClassName] = className;\r\n }\r\n var perfOptions = dynamicProto[DynProtoDefaultOptions];\r\n var useBaseInst = !!perfOptions[strUseBaseInst];\r\n if (useBaseInst && options && options[strUseBaseInst] !== undefined) {\r\n useBaseInst = !!options[strUseBaseInst];\r\n }\r\n // Get the current instance functions\r\n var instFuncs = _getInstanceFuncs(target);\r\n // Get all of the functions for any base instance (before they are potentially overridden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);\r\n // Execute the delegate passing in both the current target \"this\" and \"base\" function references\r\n // Note casting the same type as we don't actually have the base class here and this will provide some intellisense support\r\n delegateFunc(target, baseFuncs);\r\n // Don't allow setting instance functions for older IE instances\r\n var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];\r\n if (setInstanceFunc && options) {\r\n setInstanceFunc = !!options[strSetInstFuncs];\r\n }\r\n // Populate the Prototype for any overridden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);\r\n}\r\n/**\r\n * Exposes the default global options to allow global configuration, if the global values are disabled these will override\r\n * any passed values. This is primarily exposed to support unit-testing without the need for individual classes to expose\r\n * their internal usage of dynamic proto.\r\n */\r\nvar perfDefaults = {\r\n setInstFuncs: true,\r\n useBaseInst: true\r\n};\r\n// And expose for testing\r\ndynamicProto[DynProtoDefaultOptions] = perfDefaults;\n\nexport { dynamicProto as default };\n//# sourceMappingURL=dynamicproto-js.js.map\n","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { getGlobalInst } from \"./EnvUtils\";\r\nvar listenerFuncs = [\"eventsSent\", \"eventsDiscarded\", \"eventsSendRequest\", \"perfEvent\"];\r\nvar _aiNamespace = null;\r\nvar _debugListener;\r\nfunction _listenerProxyFunc(name, config) {\r\n return function () {\r\n var args = arguments;\r\n var dbgExt = getDebugExt(config);\r\n if (dbgExt) {\r\n var listener = dbgExt.listener;\r\n if (listener && listener[name]) {\r\n listener[name].apply(listener, args);\r\n }\r\n }\r\n };\r\n}\r\nfunction _getExtensionNamespace() {\r\n // Cache the lookup of the global namespace object\r\n var target = getGlobalInst(\"Microsoft\");\r\n if (target) {\r\n _aiNamespace = target[\"ApplicationInsights\"];\r\n }\r\n return _aiNamespace;\r\n}\r\nexport function getDebugExt(config) {\r\n var ns = _aiNamespace;\r\n if (!ns && config.disableDbgExt !== true) {\r\n ns = _aiNamespace || _getExtensionNamespace();\r\n }\r\n return ns ? ns[\"ChromeDbgExt\"] : null;\r\n}\r\nexport function getDebugListener(config) {\r\n if (!_debugListener) {\r\n _debugListener = {};\r\n for (var lp = 0; lp < listenerFuncs.length; lp++) {\r\n _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);\r\n }\r\n }\r\n return _debugListener;\r\n}\r\n//# sourceMappingURL=DbgExtensionUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { hasJSON, getJSON, getConsole, dumpObj } from \"./EnvUtils\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isFunction, isNullOrUndefined, isUndefined } from \"./HelperFuncs\";\r\nimport { getDebugExt } from \"./DbgExtensionUtils\";\r\nimport { strEmpty } from \"./InternalConstants\";\r\n/**\r\n * For user non actionable traces use AI Internal prefix.\r\n */\r\nvar AiNonUserActionablePrefix = \"AI (Internal): \";\r\n/**\r\n * Prefix of the traces in portal.\r\n */\r\nvar AiUserActionablePrefix = \"AI: \";\r\n/**\r\n * Session storage key for the prefix for the key indicating message type already logged\r\n */\r\nvar AIInternalMessagePrefix = \"AITR_\";\r\nvar strErrorToConsole = \"errorToConsole\";\r\nvar strWarnToConsole = \"warnToConsole\";\r\nfunction _sanitizeDiagnosticText(text) {\r\n if (text) {\r\n return \"\\\"\" + text.replace(/\\\"/g, strEmpty) + \"\\\"\";\r\n }\r\n return strEmpty;\r\n}\r\nfunction _logToConsole(func, message) {\r\n var theConsole = getConsole();\r\n if (!!theConsole) {\r\n var logFunc = \"log\";\r\n if (theConsole[func]) {\r\n logFunc = func;\r\n }\r\n if (isFunction(theConsole[logFunc])) {\r\n theConsole[logFunc](message);\r\n }\r\n }\r\n}\r\nvar _InternalLogMessage = /** @class */ (function () {\r\n function _InternalLogMessage(msgId, msg, isUserAct, properties) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var _self = this;\r\n _self.messageId = msgId;\r\n _self.message =\r\n (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +\r\n msgId;\r\n var strProps = strEmpty;\r\n if (hasJSON()) {\r\n strProps = getJSON().stringify(properties);\r\n }\r\n var diagnosticText = (msg ? \" message:\" + _sanitizeDiagnosticText(msg) : strEmpty) +\r\n (properties ? \" props:\" + _sanitizeDiagnosticText(strProps) : strEmpty);\r\n _self.message += diagnosticText;\r\n }\r\n _InternalLogMessage.dataType = \"MessageData\";\r\n return _InternalLogMessage;\r\n}());\r\nexport { _InternalLogMessage };\r\nexport function safeGetLogger(core, config) {\r\n return (core || {}).logger || new DiagnosticLogger(config);\r\n}\r\nvar DiagnosticLogger = /** @class */ (function () {\r\n function DiagnosticLogger(config) {\r\n this.identifier = \"DiagnosticLogger\";\r\n /**\r\n * The internal logging queue\r\n */\r\n this.queue = [];\r\n /**\r\n * Count of internal messages sent\r\n */\r\n var _messageCount = 0;\r\n /**\r\n * Holds information about what message types were already logged to console or sent to server.\r\n */\r\n var _messageLogged = {};\r\n dynamicProto(DiagnosticLogger, this, function (_self) {\r\n if (isNullOrUndefined(config)) {\r\n config = {};\r\n }\r\n _self.consoleLoggingLevel = function () { return _getConfigValue(\"loggingLevelConsole\", 0); };\r\n _self.telemetryLoggingLevel = function () { return _getConfigValue(\"loggingLevelTelemetry\", 1); };\r\n _self.maxInternalMessageLimit = function () { return _getConfigValue(\"maxMessageLimit\", 25); };\r\n _self.enableDebugExceptions = function () { return _getConfigValue(\"enableDebugExceptions\", false); };\r\n /**\r\n * This method will throw exceptions in debug mode or attempt to log the error as a console warning.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\n _self.throwInternal = function (severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);\r\n if (_self.enableDebugExceptions()) {\r\n throw dumpObj(message);\r\n }\r\n else {\r\n // Get the logging function and fallback to warnToConsole of for some reason errorToConsole doesn't exist\r\n var logFunc = severity === 1 /* eLoggingSeverity.CRITICAL */ ? strErrorToConsole : strWarnToConsole;\r\n if (!isUndefined(message.message)) {\r\n var logLevel = _self.consoleLoggingLevel();\r\n if (isUserAct) {\r\n // check if this message type was already logged to console for this page view and if so, don't log it again\r\n var messageKey = +message.messageId;\r\n if (!_messageLogged[messageKey] && logLevel >= severity) {\r\n _self[logFunc](message.message);\r\n _messageLogged[messageKey] = true;\r\n }\r\n }\r\n else {\r\n // Only log traces if the console Logging Level is >= the throwInternal severity level\r\n if (logLevel >= severity) {\r\n _self[logFunc](message.message);\r\n }\r\n }\r\n _self.logInternalMessage(severity, message);\r\n }\r\n else {\r\n _debugExtMsg(\"throw\" + (severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"Critical\" : \"Warning\"), message);\r\n }\r\n }\r\n };\r\n /**\r\n * This will write a warning to the console if possible\r\n * @param message {string} - The warning message\r\n */\r\n _self.warnToConsole = function (message) {\r\n _logToConsole(\"warn\", message);\r\n _debugExtMsg(\"warning\", message);\r\n };\r\n /**\r\n * This will write an error to the console if possible\r\n * @param message {string} - The error message\r\n */\r\n _self.errorToConsole = function (message) {\r\n _logToConsole(\"error\", message);\r\n _debugExtMsg(\"error\", message);\r\n };\r\n /**\r\n * Resets the internal message count\r\n */\r\n _self.resetInternalMessageCount = function () {\r\n _messageCount = 0;\r\n _messageLogged = {};\r\n };\r\n /**\r\n * Logs a message to the internal queue.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The message to log.\r\n */\r\n _self.logInternalMessage = function (severity, message) {\r\n if (_areInternalMessagesThrottled()) {\r\n return;\r\n }\r\n // check if this message type was already logged for this session and if so, don't log it again\r\n var logMessage = true;\r\n var messageKey = AIInternalMessagePrefix + message.messageId;\r\n // if the session storage is not available, limit to only one message type per page view\r\n if (_messageLogged[messageKey]) {\r\n logMessage = false;\r\n }\r\n else {\r\n _messageLogged[messageKey] = true;\r\n }\r\n if (logMessage) {\r\n // Push the event in the internal queue\r\n if (severity <= _self.telemetryLoggingLevel()) {\r\n _self.queue.push(message);\r\n _messageCount++;\r\n _debugExtMsg((severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"error\" : \"warn\"), message);\r\n }\r\n // When throttle limit reached, send a special event\r\n if (_messageCount === _self.maxInternalMessageLimit()) {\r\n var throttleLimitMessage = \"Internal events throttle limit per PageView reached for this app.\";\r\n var throttleMessage = new _InternalLogMessage(23 /* _eInternalMessageId.MessageLimitPerPVExceeded */, throttleLimitMessage, false);\r\n _self.queue.push(throttleMessage);\r\n if (severity === 1 /* eLoggingSeverity.CRITICAL */) {\r\n _self.errorToConsole(throttleLimitMessage);\r\n }\r\n else {\r\n _self.warnToConsole(throttleLimitMessage);\r\n }\r\n }\r\n }\r\n };\r\n function _getConfigValue(name, defValue) {\r\n var value = config[name];\r\n if (!isNullOrUndefined(value)) {\r\n return value;\r\n }\r\n return defValue;\r\n }\r\n function _areInternalMessagesThrottled() {\r\n return _messageCount >= _self.maxInternalMessageLimit();\r\n }\r\n function _debugExtMsg(name, data) {\r\n var dbgExt = getDebugExt(config);\r\n if (dbgExt && dbgExt.diagLog) {\r\n dbgExt.diagLog(name, data);\r\n }\r\n }\r\n });\r\n }\r\n// Removed Stub for DiagnosticLogger.prototype.enableDebugExceptions.\r\n// Removed Stub for DiagnosticLogger.prototype.consoleLoggingLevel.\r\n// Removed Stub for DiagnosticLogger.prototype.telemetryLoggingLevel.\r\n// Removed Stub for DiagnosticLogger.prototype.maxInternalMessageLimit.\r\n// Removed Stub for DiagnosticLogger.prototype.throwInternal.\r\n// Removed Stub for DiagnosticLogger.prototype.warnToConsole.\r\n// Removed Stub for DiagnosticLogger.prototype.errorToConsole.\r\n// Removed Stub for DiagnosticLogger.prototype.resetInternalMessageCount.\r\n// Removed Stub for DiagnosticLogger.prototype.logInternalMessage.\r\n return DiagnosticLogger;\r\n}());\r\nexport { DiagnosticLogger };\r\nfunction _getLogger(logger) {\r\n return (logger || new DiagnosticLogger());\r\n}\r\n/**\r\n * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in\r\n * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better\r\n * support minification as logger.throwInternal() will not compress the publish \"throwInternal\" used throughout\r\n * the code.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\nexport function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);\r\n}\r\n/**\r\n * This is a helper method which will call warnToConsole on the passed logger with the provided message.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param message {_InternalLogMessage} - The log message.\r\n */\r\nexport function _warnToConsole(logger, message) {\r\n _getLogger(logger).warnToConsole(message);\r\n}\r\n/**\r\n * Logs a message to the internal queue.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity {LoggingSeverity} - The severity of the log message\r\n * @param message {_InternalLogMessage} - The message to log.\r\n */\r\nexport function _logInternalMessage(logger, severity, message) {\r\n _getLogger(logger).logInternalMessage(severity, message);\r\n}\r\n//# sourceMappingURL=DiagnosticLogger.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { dumpObj, getDocument, getLocation, getNavigator, isIE } from \"./EnvUtils\";\r\nimport { arrForEach, dateNow, getExceptionName, isFunction, isNotNullOrUndefined, isNullOrUndefined, isString, isTruthy, isUndefined, objForEachKey, setValue, strContains, strEndsWith, strTrim } from \"./HelperFuncs\";\r\nimport { strEmpty } from \"./InternalConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nvar strToGMTString = \"toGMTString\";\r\nvar strToUTCString = \"toUTCString\";\r\nvar strCookie = \"cookie\";\r\nvar strExpires = \"expires\";\r\nvar strEnabled = \"enabled\";\r\nvar strIsCookieUseDisabled = \"isCookieUseDisabled\";\r\nvar strDisableCookiesUsage = \"disableCookiesUsage\";\r\nvar strConfigCookieMgr = \"_ckMgr\";\r\nvar _supportsCookies = null;\r\nvar _allowUaSameSite = null;\r\nvar _parsedCookieValue = null;\r\nvar _doc = getDocument();\r\nvar _cookieCache = {};\r\nvar _globalCookieConfig = {};\r\n/**\r\n * @ignore\r\n * DO NOT USE or export from the module, this is exposed as public to support backward compatibility of previous static utility methods only.\r\n * If you want to manager cookies either use the ICookieMgr available from the core instance via getCookieMgr() or create\r\n * your own instance of the CookieMgr and use that.\r\n * Using this directly for enabling / disabling cookie handling will not only affect your usage but EVERY user of cookies.\r\n * Example, if you are using a shared component that is also using Application Insights you will affect their cookie handling.\r\n * @param logger - The DiagnosticLogger to use for reporting errors.\r\n */\r\nexport function _gblCookieMgr(config, logger) {\r\n // Stash the global instance against the BaseCookieMgr class\r\n var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];\r\n if (!inst) {\r\n // Note: not using the getSetValue() helper as that would require always creating a temporary cookieMgr\r\n // that ultimately is never used\r\n inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);\r\n _globalCookieConfig[strConfigCookieMgr] = inst;\r\n }\r\n return inst;\r\n}\r\nfunction _isMgrEnabled(cookieMgr) {\r\n if (cookieMgr) {\r\n return cookieMgr.isEnabled();\r\n }\r\n return true;\r\n}\r\nfunction _createCookieMgrConfig(rootConfig) {\r\n var cookieMgrCfg = rootConfig.cookieCfg = rootConfig.cookieCfg || {};\r\n // Sets the values from the root config if not already present on the cookieMgrCfg\r\n setValue(cookieMgrCfg, \"domain\", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);\r\n setValue(cookieMgrCfg, \"path\", rootConfig.cookiePath || \"/\", null, isNullOrUndefined);\r\n if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {\r\n // Set the enabled from the provided setting or the legacy root values\r\n var cookieEnabled = void 0;\r\n if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {\r\n cookieEnabled = !rootConfig[strIsCookieUseDisabled];\r\n }\r\n if (!isUndefined(rootConfig[strDisableCookiesUsage])) {\r\n cookieEnabled = !rootConfig[strDisableCookiesUsage];\r\n }\r\n cookieMgrCfg[strEnabled] = cookieEnabled;\r\n }\r\n return cookieMgrCfg;\r\n}\r\n/**\r\n * Helper to return the ICookieMgr from the core (if not null/undefined) or a default implementation\r\n * associated with the configuration or a legacy default.\r\n * @param core\r\n * @param config\r\n * @returns\r\n */\r\nexport function safeGetCookieMgr(core, config) {\r\n var cookieMgr;\r\n if (core) {\r\n // Always returns an instance\r\n cookieMgr = core.getCookieMgr();\r\n }\r\n else if (config) {\r\n var cookieCfg = config.cookieCfg;\r\n if (cookieCfg[strConfigCookieMgr]) {\r\n cookieMgr = cookieCfg[strConfigCookieMgr];\r\n }\r\n else {\r\n cookieMgr = createCookieMgr(config);\r\n }\r\n }\r\n if (!cookieMgr) {\r\n // Get or initialize the default global (legacy) cookie manager if we couldn't find one\r\n cookieMgr = _gblCookieMgr(config, (core || {}).logger);\r\n }\r\n return cookieMgr;\r\n}\r\nexport function createCookieMgr(rootConfig, logger) {\r\n var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);\r\n var _path = cookieMgrConfig.path || \"/\";\r\n var _domain = cookieMgrConfig.domain;\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n var _enabled = cookieMgrConfig[strEnabled] !== false;\r\n var cookieMgr = {\r\n isEnabled: function () {\r\n var enabled = _enabled && areCookiesSupported(logger);\r\n // Using an indirect lookup for any global cookie manager to support tree shaking for SDK's\r\n // that don't use the \"applicationinsights-core\" version of the default cookie function\r\n var gblManager = _globalCookieConfig[strConfigCookieMgr];\r\n if (enabled && gblManager && cookieMgr !== gblManager) {\r\n // Make sure the GlobalCookie Manager instance (if not this instance) is also enabled.\r\n // As the global (deprecated) functions may have been called (for backward compatibility)\r\n enabled = _isMgrEnabled(gblManager);\r\n }\r\n return enabled;\r\n },\r\n setEnabled: function (value) {\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n _enabled = value !== false;\r\n },\r\n set: function (name, value, maxAgeSec, domain, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr)) {\r\n var values = {};\r\n var theValue = strTrim(value || strEmpty);\r\n var idx = theValue.indexOf(\";\");\r\n if (idx !== -1) {\r\n theValue = strTrim(value.substring(0, idx));\r\n values = _extractParts(value.substring(idx + 1));\r\n }\r\n // Only update domain if not already present (isUndefined) and the value is truthy (not null, undefined or empty string)\r\n setValue(values, \"domain\", domain || _domain, isTruthy, isUndefined);\r\n if (!isNullOrUndefined(maxAgeSec)) {\r\n var _isIE = isIE();\r\n if (isUndefined(values[strExpires])) {\r\n var nowMs = dateNow();\r\n // Only add expires if not already present\r\n var expireMs = nowMs + (maxAgeSec * 1000);\r\n // Sanity check, if zero or -ve then ignore\r\n if (expireMs > 0) {\r\n var expiry = new Date();\r\n expiry.setTime(expireMs);\r\n setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);\r\n }\r\n }\r\n if (!_isIE) {\r\n // Only replace if not already present\r\n setValue(values, \"max-age\", strEmpty + maxAgeSec, null, isUndefined);\r\n }\r\n }\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol === \"https:\") {\r\n setValue(values, \"secure\", null, null, isUndefined);\r\n // Only set same site if not also secure\r\n if (_allowUaSameSite === null) {\r\n _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {}).userAgent);\r\n }\r\n if (_allowUaSameSite) {\r\n setValue(values, \"SameSite\", \"None\", null, isUndefined);\r\n }\r\n }\r\n setValue(values, \"path\", path || _path, null, isUndefined);\r\n var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;\r\n setCookieFn(name, _formatCookieValue(theValue, values));\r\n result = true;\r\n }\r\n return result;\r\n },\r\n get: function (name) {\r\n var value = strEmpty;\r\n if (_isMgrEnabled(cookieMgr)) {\r\n value = (cookieMgrConfig.getCookie || _getCookieValue)(name);\r\n }\r\n return value;\r\n },\r\n del: function (name, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr)) {\r\n // Only remove the cookie if the manager and cookie support has not been disabled\r\n result = cookieMgr.purge(name, path);\r\n }\r\n return result;\r\n },\r\n purge: function (name, path) {\r\n var _a;\r\n var result = false;\r\n if (areCookiesSupported(logger)) {\r\n // Setting the expiration date in the past immediately removes the cookie\r\n var values = (_a = {},\r\n _a[\"path\"] = path ? path : \"/\",\r\n _a[strExpires] = \"Thu, 01 Jan 1970 00:00:01 GMT\",\r\n _a);\r\n if (!isIE()) {\r\n // Set max age to expire now\r\n values[\"max-age\"] = \"0\";\r\n }\r\n var delCookie = cookieMgrConfig.delCookie || _setCookieValue;\r\n delCookie(name, _formatCookieValue(strEmpty, values));\r\n result = true;\r\n }\r\n return result;\r\n }\r\n };\r\n // Associated this cookie manager with the config\r\n cookieMgr[strConfigCookieMgr] = cookieMgr;\r\n return cookieMgr;\r\n}\r\n/*\r\n* Helper method to tell if document.cookie object is supported by the runtime\r\n*/\r\nexport function areCookiesSupported(logger) {\r\n if (_supportsCookies === null) {\r\n _supportsCookies = false;\r\n try {\r\n var doc = _doc || {};\r\n _supportsCookies = doc[strCookie] !== undefined;\r\n }\r\n catch (e) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 68 /* _eInternalMessageId.CannotAccessCookie */, \"Cannot access document.cookie - \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return _supportsCookies;\r\n}\r\nfunction _extractParts(theValue) {\r\n var values = {};\r\n if (theValue && theValue.length) {\r\n var parts = strTrim(theValue).split(\";\");\r\n arrForEach(parts, function (thePart) {\r\n thePart = strTrim(thePart || strEmpty);\r\n if (thePart) {\r\n var idx = thePart.indexOf(\"=\");\r\n if (idx === -1) {\r\n values[thePart] = null;\r\n }\r\n else {\r\n values[strTrim(thePart.substring(0, idx))] = strTrim(thePart.substring(idx + 1));\r\n }\r\n }\r\n });\r\n }\r\n return values;\r\n}\r\nfunction _formatDate(theDate, func) {\r\n if (isFunction(theDate[func])) {\r\n return theDate[func]();\r\n }\r\n return null;\r\n}\r\nfunction _formatCookieValue(value, values) {\r\n var cookieValue = value || strEmpty;\r\n objForEachKey(values, function (name, theValue) {\r\n cookieValue += \"; \" + name + (!isNullOrUndefined(theValue) ? \"=\" + theValue : strEmpty);\r\n });\r\n return cookieValue;\r\n}\r\nfunction _getCookieValue(name) {\r\n var cookieValue = strEmpty;\r\n if (_doc) {\r\n var theCookie = _doc[strCookie] || strEmpty;\r\n if (_parsedCookieValue !== theCookie) {\r\n _cookieCache = _extractParts(theCookie);\r\n _parsedCookieValue = theCookie;\r\n }\r\n cookieValue = strTrim(_cookieCache[name] || strEmpty);\r\n }\r\n return cookieValue;\r\n}\r\nfunction _setCookieValue(name, cookieValue) {\r\n if (_doc) {\r\n _doc[strCookie] = name + \"=\" + cookieValue;\r\n }\r\n}\r\nexport function uaDisallowsSameSiteNone(userAgent) {\r\n if (!isString(userAgent)) {\r\n return false;\r\n }\r\n // Cover all iOS based browsers here. This includes:\r\n // - Safari on iOS 12 for iPhone, iPod Touch, iPad\r\n // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad\r\n // - Chrome on iOS 12 for iPhone, iPod Touch, iPad\r\n // All of which are broken by SameSite=None, because they use the iOS networking stack\r\n if (strContains(userAgent, \"CPU iPhone OS 12\") || strContains(userAgent, \"iPad; CPU OS 12\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes:\r\n // - Safari on Mac OS X\r\n // This does not include:\r\n // - Internal browser on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strContains(userAgent, \"Version/\") && strContains(userAgent, \"Safari\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X internal browsers that use the Mac OS networking stack. This includes:\r\n // - Internal browser on Mac OS X\r\n // This does not include:\r\n // - Safari on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strEndsWith(userAgent, \"AppleWebKit/605.1.15 (KHTML, like Gecko)\")) {\r\n return true;\r\n }\r\n // Cover Chrome 50-69, because some versions are broken by SameSite=None, and none in this range require it.\r\n // Note: this covers some pre-Chromium Edge versions, but pre-Chromim Edge does not require SameSite=None, so this is fine.\r\n // Note: this regex applies to Windows, Mac OS X, and Linux, deliberately.\r\n if (strContains(userAgent, \"Chrome/5\") || strContains(userAgent, \"Chrome/6\")) {\r\n return true;\r\n }\r\n // Unreal Engine runs Chromium 59, but does not advertise as Chrome until 4.23. Treat versions of Unreal\r\n // that don't specify their Chrome version as lacking support for SameSite=None.\r\n if (strContains(userAgent, \"UnrealEngine\") && !strContains(userAgent, \"Chrome\")) {\r\n return true;\r\n }\r\n // UCBrowser < 12.13.2 ignores Set-Cookie headers with SameSite=None\r\n // NB: this rule isn't complete - you need regex to make a complete rule.\r\n // See: https://www.chromium.org/updates/same-site/incompatible-clients\r\n if (strContains(userAgent, \"UCBrowser/12\") || strContains(userAgent, \"UCBrowser/11\")) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=CookieMgr.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { getCrypto, getMsCrypto, isIE } from \"./EnvUtils\";\r\nimport { dateNow } from \"./HelperFuncs\";\r\nimport { strEmpty } from \"./InternalConstants\";\r\nvar UInt32Mask = 0x100000000;\r\nvar MaxUInt32 = 0xffffffff;\r\n// MWC based Random generator (for IE)\r\nvar _mwcSeeded = false;\r\nvar _mwcW = 123456789;\r\nvar _mwcZ = 987654321;\r\n// Takes any integer\r\nfunction _mwcSeed(seedValue) {\r\n if (seedValue < 0) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n seedValue >>>= 0;\r\n }\r\n _mwcW = (123456789 + seedValue) & MaxUInt32;\r\n _mwcZ = (987654321 - seedValue) & MaxUInt32;\r\n _mwcSeeded = true;\r\n}\r\nfunction _autoSeedMwc() {\r\n // Simple initialization using default Math.random() - So we inherit any entropy from the browser\r\n // and bitwise XOR with the current milliseconds\r\n try {\r\n var now = dateNow() & 0x7fffffff;\r\n _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);\r\n }\r\n catch (e) {\r\n // Don't crash if something goes wrong\r\n }\r\n}\r\n/**\r\n * Generate a random value between 0 and maxValue, max value should be limited to a 32-bit maximum.\r\n * So maxValue(16) will produce a number from 0..16 (range of 17)\r\n * @param maxValue\r\n */\r\nexport function randomValue(maxValue) {\r\n if (maxValue > 0) {\r\n return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;\r\n }\r\n return 0;\r\n}\r\n/**\r\n * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function random32(signed) {\r\n var value = 0;\r\n var c = getCrypto() || getMsCrypto();\r\n if (c && c.getRandomValues) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;\r\n }\r\n if (value === 0 && isIE()) {\r\n // For IE 6, 7, 8 (especially on XP) Math.random is not very random\r\n if (!_mwcSeeded) {\r\n // Set the seed for the Mwc algorithm\r\n _autoSeedMwc();\r\n }\r\n // Don't use Math.random for IE\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = mwcRandom32() & MaxUInt32;\r\n }\r\n if (value === 0) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = Math.floor((UInt32Mask * Math.random()) | 0);\r\n }\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Seed the MWC random number generator with the specified seed or a random value\r\n * @param value - optional the number to used as the seed, if undefined, null or zero a random value will be chosen\r\n */\r\nexport function mwcRandomSeed(value) {\r\n if (!value) {\r\n _autoSeedMwc();\r\n }\r\n else {\r\n _mwcSeed(value);\r\n }\r\n}\r\n/**\r\n * Generate a random 32-bit number between (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), using MWC (Multiply with carry)\r\n * instead of Math.random() defaults to un-signed.\r\n * Used as a replacement random generator for IE to avoid issues with older IE instances.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function mwcRandom32(signed) {\r\n _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;\r\n _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;\r\n var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Generate random base64 id string.\r\n * The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)\r\n * @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22\r\n */\r\nexport function newId(maxLength) {\r\n if (maxLength === void 0) { maxLength = 22; }\r\n var base64chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n // Start with an initial random number, consuming the value in reverse byte order\r\n var number = random32() >>> 0; // Make sure it's a +ve number\r\n var chars = 0;\r\n var result = strEmpty;\r\n while (result.length < maxLength) {\r\n chars++;\r\n result += base64chars.charAt(number & 0x3F);\r\n number >>>= 6; // Zero fill with right shift\r\n if (chars === 5) {\r\n // 5 base64 characters === 30 bits so we don't have enough bits for another base64 char\r\n // So add on another 30 bits and make sure it's +ve\r\n number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;\r\n chars = 0; // We need to reset the number every 5 chars (30 bits)\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=RandomHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { ObjDefineProperty } from \"@microsoft/applicationinsights-shims\";\r\nimport { normalizeJsName } from \"./HelperFuncs\";\r\nimport { newId } from \"./RandomHelper\";\r\nvar _objDefineProperty = ObjDefineProperty;\r\nvar version = \"2.8.4\";\r\nvar instanceName = \".\" + newId(6);\r\nvar _dataUid = 0;\r\nfunction _createAccessor(target, prop, value) {\r\n if (_objDefineProperty) {\r\n try {\r\n _objDefineProperty(target, prop, {\r\n value: value,\r\n enumerable: false,\r\n configurable: true\r\n });\r\n return true;\r\n }\r\n catch (e) {\r\n // IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw\r\n // We will just ignore this here.\r\n }\r\n }\r\n return false;\r\n}\r\n// Accepts only:\r\n// - Node\r\n// - Node.ELEMENT_NODE\r\n// - Node.DOCUMENT_NODE\r\n// - Object\r\n// - Any\r\nfunction _canAcceptData(target) {\r\n return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);\r\n}\r\nfunction _getCache(data, target) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n theCache = {};\r\n try {\r\n if (_canAcceptData(target)) {\r\n if (!_createAccessor(target, data.id, theCache)) {\r\n // Environment doesn't support accessor, so just use direct assignment\r\n target[data.id] = theCache;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Not all environments allow extending all objects, so just ignore the cache in those cases\r\n }\r\n }\r\n return theCache;\r\n}\r\nexport function createUniqueNamespace(name, includeVersion) {\r\n if (includeVersion === void 0) { includeVersion = false; }\r\n return normalizeJsName(name + (_dataUid++) + (includeVersion ? \".\" + version : \"\") + instanceName);\r\n}\r\nexport function createElmNodeData(name) {\r\n var data = {\r\n id: createUniqueNamespace(\"_aiData-\" + (name || \"\") + \".\" + version),\r\n accept: function (target) {\r\n return _canAcceptData(target);\r\n },\r\n get: function (target, name, defValue, addDefault) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n if (addDefault) {\r\n // Side effect is adds the cache\r\n theCache = _getCache(data, target);\r\n theCache[normalizeJsName(name)] = defValue;\r\n }\r\n return defValue;\r\n }\r\n return theCache[normalizeJsName(name)];\r\n },\r\n kill: function (target, name) {\r\n if (target && target[name]) {\r\n try {\r\n delete target[name];\r\n }\r\n catch (e) {\r\n // Just cleaning up, so if this fails -- ignore\r\n }\r\n }\r\n }\r\n };\r\n return data;\r\n}\r\n//# sourceMappingURL=DataCacheHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { createElmNodeData, createUniqueNamespace } from \"./DataCacheHelper\";\r\nimport { getDocument, getWindow } from \"./EnvUtils\";\r\nimport { arrForEach, arrIndexOf, isArray, objForEachKey, objKeys } from \"./HelperFuncs\";\r\n// Added to help with minfication\r\nvar strOnPrefix = \"on\";\r\nvar strAttachEvent = \"attachEvent\";\r\nvar strAddEventHelper = \"addEventListener\";\r\nvar strDetachEvent = \"detachEvent\";\r\nvar strRemoveEventListener = \"removeEventListener\";\r\nvar strEvents = \"events\";\r\nvar strVisibilityChangeEvt = \"visibilitychange\";\r\nvar strPageHide = \"pagehide\";\r\nvar strPageShow = \"pageshow\";\r\nvar strUnload = \"unload\";\r\nvar strBeforeUnload = \"beforeunload\";\r\nvar strPageHideNamespace = createUniqueNamespace(\"aiEvtPageHide\");\r\nvar strPageShowNamespace = createUniqueNamespace(\"aiEvtPageShow\");\r\nvar rRemoveEmptyNs = /\\.[\\.]+/g;\r\nvar rRemoveTrailingEmptyNs = /[\\.]+$/;\r\nvar _guid = 1;\r\nvar elmNodeData = createElmNodeData(\"events\");\r\nvar eventNamespace = /^([^.]*)(?:\\.(.+)|)/;\r\nfunction _normalizeNamespace(name) {\r\n if (name && name.replace) {\r\n return name.replace(/^\\s*\\.*|\\.*\\s*$/g, \"\");\r\n }\r\n return name;\r\n}\r\nfunction _getEvtNamespace(eventName, evtNamespace) {\r\n if (evtNamespace) {\r\n var theNamespace_1 = \"\";\r\n if (isArray(evtNamespace)) {\r\n theNamespace_1 = \"\";\r\n arrForEach(evtNamespace, function (name) {\r\n name = _normalizeNamespace(name);\r\n if (name) {\r\n if (name[0] !== \".\") {\r\n name = \".\" + name;\r\n }\r\n theNamespace_1 += name;\r\n }\r\n });\r\n }\r\n else {\r\n theNamespace_1 = _normalizeNamespace(evtNamespace);\r\n }\r\n if (theNamespace_1) {\r\n if (theNamespace_1[0] !== \".\") {\r\n theNamespace_1 = \".\" + theNamespace_1;\r\n }\r\n // We may only have the namespace and not an eventName\r\n eventName = (eventName || \"\") + theNamespace_1;\r\n }\r\n }\r\n var parsedEvent = (eventNamespace.exec(eventName || \"\") || []);\r\n return {\r\n type: parsedEvent[1],\r\n ns: ((parsedEvent[2] || \"\").replace(rRemoveEmptyNs, \".\").replace(rRemoveTrailingEmptyNs, \"\").split(\".\").sort()).join(\".\")\r\n };\r\n}\r\n/**\r\n * Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by\r\n * applications to remove their own events\r\n * @param target - The EventTarget that has registered events\r\n * @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n */\r\nexport function __getRegisteredEvents(target, eventName, evtNamespace) {\r\n var theEvents = [];\r\n var eventCache = elmNodeData.get(target, strEvents, {}, false);\r\n var evtName = _getEvtNamespace(eventName, evtNamespace);\r\n objForEachKey(eventCache, function (evtType, registeredEvents) {\r\n arrForEach(registeredEvents, function (value) {\r\n if (!evtName.type || evtName.type === value.evtName.type) {\r\n if (!evtName.ns || evtName.ns === evtName.ns) {\r\n theEvents.push({\r\n name: value.evtName.type + (value.evtName.ns ? \".\" + value.evtName.ns : \"\"),\r\n handler: value.handler\r\n });\r\n }\r\n }\r\n });\r\n });\r\n return theEvents;\r\n}\r\n// Exported for internal unit testing only\r\nfunction _getRegisteredEvents(target, evtName, addDefault) {\r\n if (addDefault === void 0) { addDefault = true; }\r\n var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);\r\n var registeredEvents = aiEvts[evtName];\r\n if (!registeredEvents) {\r\n registeredEvents = aiEvts[evtName] = [];\r\n }\r\n return registeredEvents;\r\n}\r\nfunction _doDetach(obj, evtName, handlerRef, useCapture) {\r\n if (obj && evtName && evtName.type) {\r\n if (obj[strRemoveEventListener]) {\r\n obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);\r\n }\r\n else if (obj[strDetachEvent]) {\r\n obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);\r\n }\r\n }\r\n}\r\nfunction _doAttach(obj, evtName, handlerRef, useCapture) {\r\n var result = false;\r\n if (obj && evtName && evtName.type && handlerRef) {\r\n if (obj[strAddEventHelper]) {\r\n // all browsers except IE before version 9\r\n obj[strAddEventHelper](evtName.type, handlerRef, useCapture);\r\n result = true;\r\n }\r\n else if (obj[strAttachEvent]) {\r\n // IE before version 9\r\n obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);\r\n result = true;\r\n }\r\n }\r\n return result;\r\n}\r\nfunction _doUnregister(target, events, evtName, unRegFn) {\r\n var idx = events.length;\r\n while (idx--) {\r\n var theEvent = events[idx];\r\n if (theEvent) {\r\n if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {\r\n if (!unRegFn || unRegFn(theEvent)) {\r\n _doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);\r\n // Remove the registered event\r\n events.splice(idx, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\nfunction _unregisterEvents(target, evtName, unRegFn) {\r\n if (evtName.type) {\r\n _doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);\r\n }\r\n else {\r\n var eventCache = elmNodeData.get(target, strEvents, {});\r\n objForEachKey(eventCache, function (evtType, events) {\r\n _doUnregister(target, events, evtName, unRegFn);\r\n });\r\n // Cleanup\r\n if (objKeys(eventCache).length === 0) {\r\n elmNodeData.kill(target, strEvents);\r\n }\r\n }\r\n}\r\nexport function mergeEvtNamespace(theNamespace, namespaces) {\r\n var newNamespaces;\r\n if (namespaces) {\r\n if (isArray(namespaces)) {\r\n newNamespaces = [theNamespace].concat(namespaces);\r\n }\r\n else {\r\n newNamespaces = [theNamespace, namespaces];\r\n }\r\n // resort the namespaces so they are always in order\r\n newNamespaces = (_getEvtNamespace(\"xx\", newNamespaces).ns).split(\".\");\r\n }\r\n else {\r\n newNamespaces = theNamespace;\r\n }\r\n return newNamespaces;\r\n}\r\n/**\r\n * Binds the specified function to an event, so that the function gets called whenever the event fires on the object\r\n * @param obj Object to add the event too.\r\n * @param eventName String that specifies any of the standard DHTML Events without \"on\" prefix, if may also include an optional (dot \".\" prefixed)\r\n * namespaces \"click\" \"click.mynamespace\" in addition to specific namespaces.\r\n * @param handlerRef Pointer that specifies the function to call when event fires\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n * @param useCapture [Optional] Defaults to false\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\nexport function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n var result = false;\r\n if (target) {\r\n try {\r\n var evtName = _getEvtNamespace(eventName, evtNamespace);\r\n result = _doAttach(target, evtName, handlerRef, useCapture);\r\n if (result && elmNodeData.accept(target)) {\r\n var registeredEvent = {\r\n guid: _guid++,\r\n evtName: evtName,\r\n handler: handlerRef,\r\n capture: useCapture\r\n };\r\n _getRegisteredEvents(target, evtName.type).push(registeredEvent);\r\n }\r\n }\r\n catch (e) {\r\n // Just Ignore any error so that we don't break any execution path\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Removes an event handler for the specified event\r\n * @param Object to remove the event from\r\n * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n * @param useCapture [Optional] Defaults to false\r\n */\r\nexport function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n if (target) {\r\n try {\r\n var evtName_1 = _getEvtNamespace(eventName, evtNamespace);\r\n var found_1 = false;\r\n _unregisterEvents(target, evtName_1, function (regEvent) {\r\n if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {\r\n found_1 = true;\r\n return true;\r\n }\r\n return false;\r\n });\r\n if (!found_1) {\r\n // fallback to try and remove as requested\r\n _doDetach(target, evtName_1, handlerRef, useCapture);\r\n }\r\n }\r\n catch (e) {\r\n // Just Ignore any error so that we don't break any execution path\r\n }\r\n }\r\n}\r\n/**\r\n * Binds the specified function to an event, so that the function gets called whenever the event fires on the object\r\n * @param obj Object to add the event too.\r\n * @param eventNameWithoutOn String that specifies any of the standard DHTML Events without \"on\" prefix and optional (dot \".\" prefixed) namespaces \"click\" \"click.mynamespace\".\r\n * @param handlerRef Pointer that specifies the function to call when event fires\r\n * @param useCapture [Optional] Defaults to false\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\nexport function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);\r\n}\r\n/**\r\n * Removes an event handler for the specified event\r\n * @param Object to remove the event from\r\n * @param eventNameWithoutOn {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param handlerRef {any} - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param useCapture [Optional] Defaults to false\r\n */\r\nexport function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);\r\n}\r\n/**\r\n * Trys to add an event handler for the specified event to the window, body and document\r\n * @param eventName {string} - The name of the event\r\n * @param callback {any} - The callback function that needs to be executed for the given event\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @return {boolean} - true if the handler was successfully added\r\n */\r\nexport function addEventHandler(eventName, callback, evtNamespace) {\r\n var result = false;\r\n var w = getWindow();\r\n if (w) {\r\n result = eventOn(w, eventName, callback, evtNamespace);\r\n result = eventOn(w[\"body\"], eventName, callback, evtNamespace) || result;\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n result = eventOn(doc, eventName, callback, evtNamespace) || result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Trys to remove event handler(s) for the specified event/namespace to the window, body and document\r\n * @param eventName {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param callback {any} - - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n */\r\nexport function removeEventHandler(eventName, callback, evtNamespace) {\r\n var w = getWindow();\r\n if (w) {\r\n eventOff(w, eventName, callback, evtNamespace);\r\n eventOff(w[\"body\"], eventName, callback, evtNamespace);\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n eventOff(doc, eventName, callback, evtNamespace);\r\n }\r\n}\r\n/**\r\n * Bind the listener to the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nfunction _addEventListeners(events, listener, excludeEvents, evtNamespace) {\r\n var added = false;\r\n if (listener && events && events.length > 0) {\r\n arrForEach(events, function (name) {\r\n if (name) {\r\n if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {\r\n added = addEventHandler(name, listener, evtNamespace) || added;\r\n }\r\n }\r\n });\r\n }\r\n return added;\r\n}\r\n/**\r\n * Bind the listener to the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addEventListeners(events, listener, excludeEvents, evtNamespace) {\r\n var added = false;\r\n if (listener && events && isArray(events)) {\r\n added = _addEventListeners(events, listener, excludeEvents, evtNamespace);\r\n if (!added && excludeEvents && excludeEvents.length > 0) {\r\n // Failed to add any listeners and we excluded some, so just attempt to add the excluded events\r\n added = _addEventListeners(events, listener, null, evtNamespace);\r\n }\r\n }\r\n return added;\r\n}\r\n/**\r\n * Remove the listener from the array of events\r\n * @param events An string array of event names to bind the listener to\r\n * @param listener The event callback to call when the event is triggered\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n */\r\nexport function removeEventListeners(events, listener, evtNamespace) {\r\n if (events && isArray(events)) {\r\n arrForEach(events, function (name) {\r\n if (name) {\r\n removeEventHandler(name, listener, evtNamespace);\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,\r\n * this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden\r\n * it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is\r\n * just navigating to a different Tab and may come back (without unloading the page). As such you may also\r\n * need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.\r\n * @param listener - The event callback to call when a page unload event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {\r\n // Hook the unload event for the document, window and body to ensure that the client events are flushed to the server\r\n // As just hooking the window does not always fire (on chrome) for page navigation's.\r\n return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);\r\n}\r\n/**\r\n * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,\r\n * addEventListeners, addPageUnloadEventListener or addPageHideEventListener.\r\n * @param listener - The specific event callback to to be removed\r\n * @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function removePageUnloadEventListener(listener, evtNamespace) {\r\n removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);\r\n}\r\n/**\r\n * Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call\r\n * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The event callback to call when a page hide event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed\r\n * based on this namespace. This call also adds an additional unique \"pageshow\" namespace to the events\r\n * so that only the matching \"removePageHideEventListener\" can remove these events.\r\n * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageHideEventListener(listener, excludeEvents, evtNamespace) {\r\n function _handlePageVisibility(evt) {\r\n var doc = getDocument();\r\n if (listener && doc && doc.visibilityState === \"hidden\") {\r\n listener(evt);\r\n }\r\n }\r\n // add the unique page show namespace to any provided namespace so we can only remove the ones added by \"pagehide\"\r\n var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);\r\n var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);\r\n if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {\r\n pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;\r\n }\r\n if (!pageUnloadAdded && excludeEvents) {\r\n // Failed to add any listeners and we where requested to exclude some, so just call again without excluding anything\r\n pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);\r\n }\r\n return pageUnloadAdded;\r\n}\r\n/**\r\n * Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener\r\n * as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\r\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\r\n */\r\nexport function removePageHideEventListener(listener, evtNamespace) {\r\n // add the unique page show namespace to any provided namespace so we only remove the ones added by \"pagehide\"\r\n var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);\r\n removeEventListeners([strPageHide], listener, newNamespaces);\r\n removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);\r\n}\r\n/**\r\n * Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call\r\n * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The event callback to call when a page is show event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely\r\n * identified and removed based on this namespace. This call also adds an additional unique \"pageshow\" namespace to the events\r\n * so that only the matching \"removePageShowEventListener\" can remove these events.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageShowEventListener(listener, excludeEvents, evtNamespace) {\r\n function _handlePageVisibility(evt) {\r\n var doc = getDocument();\r\n if (listener && doc && doc.visibilityState === \"visible\") {\r\n listener(evt);\r\n }\r\n }\r\n // add the unique page show namespace to any provided namespace so we can only remove the ones added by \"pageshow\"\r\n var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);\r\n var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);\r\n pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;\r\n if (!pageShowAdded && excludeEvents) {\r\n // Failed to add any listeners and we where requested to exclude some, so just call again without excluding anything\r\n pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);\r\n }\r\n return pageShowAdded;\r\n}\r\n/**\r\n * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener\r\n * as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\r\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\r\n */\r\nexport function removePageShowEventListener(listener, evtNamespace) {\r\n // add the unique page show namespace to any provided namespace so we only remove the ones added by \"pageshow\"\r\n var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);\r\n removeEventListeners([strPageShow], listener, newNamespaces);\r\n removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);\r\n}\r\n//# sourceMappingURL=EventHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { objCreateFn, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { _gblCookieMgr } from \"./CookieMgr\";\r\nimport { getPerformance, isIE } from \"./EnvUtils\";\r\nimport { arrForEach, arrIndexOf, arrMap, arrReduce, dateNow, hasOwnProperty, isArray, isBoolean, isDate, isError, isFunction, isNullOrUndefined, isNumber, isObject, isString, isTypeof, isUndefined, objDefineAccessors, objKeys, strTrim, toISOString } from \"./HelperFuncs\";\r\nimport { addEventHandler, attachEvent, detachEvent } from \"./EventHelpers\";\r\nimport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./RandomHelper\";\r\nimport { strEmpty } from \"./InternalConstants\";\r\nvar _cookieMgrs = null;\r\nvar _canUseCookies; // legacy supported config\r\n// Added to help with minfication\r\nexport var Undefined = strShimUndefined;\r\nexport function newGuid() {\r\n function randomHexDigit() {\r\n return randomValue(15); // Get a random value from 0..15\r\n }\r\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(GuidRegex, function (c) {\r\n var r = (randomHexDigit() | 0), v = (c === \"x\" ? r : r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n}\r\n/**\r\n * Return the current value of the Performance Api now() function (if available) and fallback to dateNow() if it is unavailable (IE9 or less)\r\n * https://caniuse.com/#search=performance.now\r\n */\r\nexport function perfNow() {\r\n var perf = getPerformance();\r\n if (perf && perf.now) {\r\n return perf.now();\r\n }\r\n return dateNow();\r\n}\r\n/**\r\n * The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function strEndsWith(value, search) {\r\n if (value && search) {\r\n var len = value.length;\r\n var start = len - search.length;\r\n return value.substring(start >= 0 ? start : 0, len) === search;\r\n }\r\n return false;\r\n}\r\n/**\r\n * generate W3C trace id\r\n */\r\nexport function generateW3CId() {\r\n var hexValues = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\r\n // rfc4122 version 4 UUID without dashes and with lowercase letters\r\n var oct = strEmpty, tmp;\r\n for (var a = 0; a < 4; a++) {\r\n tmp = random32();\r\n oct +=\r\n hexValues[tmp & 0xF] +\r\n hexValues[tmp >> 4 & 0xF] +\r\n hexValues[tmp >> 8 & 0xF] +\r\n hexValues[tmp >> 12 & 0xF] +\r\n hexValues[tmp >> 16 & 0xF] +\r\n hexValues[tmp >> 20 & 0xF] +\r\n hexValues[tmp >> 24 & 0xF] +\r\n hexValues[tmp >> 28 & 0xF];\r\n }\r\n // \"Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively\"\r\n var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];\r\n return oct.substr(0, 8) + oct.substr(9, 4) + \"4\" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);\r\n}\r\n/**\r\n * Provides a collection of utility functions, included for backward compatibility with previous releases.\r\n * @deprecated Marking this instance as deprecated in favor of direct usage of the helper functions\r\n * as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items\r\n * in your resulting code.\r\n */\r\nexport var CoreUtils = {\r\n _canUseCookies: undefined,\r\n isTypeof: isTypeof,\r\n isUndefined: isUndefined,\r\n isNullOrUndefined: isNullOrUndefined,\r\n hasOwnProperty: hasOwnProperty,\r\n isFunction: isFunction,\r\n isObject: isObject,\r\n isDate: isDate,\r\n isArray: isArray,\r\n isError: isError,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isBoolean: isBoolean,\r\n toISOString: toISOString,\r\n arrForEach: arrForEach,\r\n arrIndexOf: arrIndexOf,\r\n arrMap: arrMap,\r\n arrReduce: arrReduce,\r\n strTrim: strTrim,\r\n objCreate: objCreateFn,\r\n objKeys: objKeys,\r\n objDefineAccessors: objDefineAccessors,\r\n addEventHandler: addEventHandler,\r\n dateNow: dateNow,\r\n isIE: isIE,\r\n disableCookies: disableCookies,\r\n newGuid: newGuid,\r\n perfNow: perfNow,\r\n newId: newId,\r\n randomValue: randomValue,\r\n random32: random32,\r\n mwcRandomSeed: mwcRandomSeed,\r\n mwcRandom32: mwcRandom32,\r\n generateW3CId: generateW3CId\r\n};\r\nvar GuidRegex = /[xy]/g;\r\nexport var EventHelper = {\r\n Attach: attachEvent,\r\n AttachEvent: attachEvent,\r\n Detach: detachEvent,\r\n DetachEvent: detachEvent\r\n};\r\n/**\r\n * Helper to support backward compatibility for users that use the legacy cookie handling functions and the use the internal\r\n * CoreUtils._canUseCookies global flag to enable/disable cookies usage.\r\n * Note: This has the following deliberate side-effects\r\n * - Creates the global (legacy) cookie manager if it does not already exist\r\n * - Attempts to add \"listeners\" to the CoreUtils._canUseCookies property to support the legacy usage\r\n * @param config\r\n * @param logger\r\n * @returns\r\n */\r\nexport function _legacyCookieMgr(config, logger) {\r\n var cookieMgr = _gblCookieMgr(config, logger);\r\n var legacyCanUseCookies = CoreUtils._canUseCookies;\r\n if (_cookieMgrs === null) {\r\n _cookieMgrs = [];\r\n _canUseCookies = legacyCanUseCookies;\r\n // Dynamically create get/set property accessors for backward compatibility for enabling / disabling cookies\r\n // this WILL NOT work for ES3 browsers (< IE8)\r\n objDefineAccessors(CoreUtils, \"_canUseCookies\", function () {\r\n return _canUseCookies;\r\n }, function (value) {\r\n _canUseCookies = value;\r\n arrForEach(_cookieMgrs, function (mgr) {\r\n mgr.setEnabled(value);\r\n });\r\n });\r\n }\r\n if (arrIndexOf(_cookieMgrs, cookieMgr) === -1) {\r\n _cookieMgrs.push(cookieMgr);\r\n }\r\n if (isBoolean(legacyCanUseCookies)) {\r\n cookieMgr.setEnabled(legacyCanUseCookies);\r\n }\r\n if (isBoolean(_canUseCookies)) {\r\n cookieMgr.setEnabled(_canUseCookies);\r\n }\r\n return cookieMgr;\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().disable()\r\n * Force the SDK not to store and read any data from cookies.\r\n */\r\nexport function disableCookies() {\r\n _legacyCookieMgr().setEnabled(false);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().isEnabled()\r\n * Helper method to tell if document.cookie object is available and whether it can be used.\r\n */\r\nexport function canUseCookies(logger) {\r\n return _legacyCookieMgr(null, logger).isEnabled();\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().get()\r\n * helper method to access userId and sessionId cookie\r\n */\r\nexport function getCookie(logger, name) {\r\n return _legacyCookieMgr(null, logger).get(name);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().set()\r\n * helper method to set userId and sessionId cookie\r\n */\r\nexport function setCookie(logger, name, value, domain) {\r\n _legacyCookieMgr(null, logger).set(name, value, null, domain);\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().del()\r\n * Deletes a cookie by setting it's expiration time in the past.\r\n * @param name - The name of the cookie to delete.\r\n */\r\nexport function deleteCookie(logger, name) {\r\n return _legacyCookieMgr(null, logger).del(name);\r\n}\r\n//# sourceMappingURL=CoreUtils.js.map","/**\r\n * Endpoint to send 1DS telemetry events to. Includes public and special environments endpoints.\r\n */\r\nexport var OneDSEndpoint;\r\n(function (OneDSEndpoint) {\r\n /**\r\n * US Department of Defense endpoint (Pathfinder)\r\n */\r\n OneDSEndpoint[\"USGOV_DOD\"] = \"https://pf.events.data.microsoft.com/OneCollector/1.0/\";\r\n /**\r\n * US Department of Justice endpoint (Trailblazer)\r\n */\r\n OneDSEndpoint[\"USGOV_DOJ\"] = \"https://tb.events.data.microsoft.com/OneCollector/1.0/\";\r\n /**\r\n * Public endpoint\r\n */\r\n OneDSEndpoint[\"PUBLIC\"] = \"https://browser.events.data.microsoft.com/OneCollector/1.0/\";\r\n /**\r\n * Customer content endpoint\r\n * @deprecated Customer Content endpoint is not exposed externally,\r\n * the SDK internally determines the corresponding CCCO endpoint URL.\r\n */\r\n OneDSEndpoint[\"CUSTOMER_CONTENT\"] = \"\";\r\n /**\r\n * EUDB endpoint\r\n */\r\n OneDSEndpoint[\"EUDB\"] = \"https://eu-office.events.data.microsoft.com/OneCollector/1.0/\";\r\n})(OneDSEndpoint || (OneDSEndpoint = {}));\r\n//# sourceMappingURL=DataModels.js.map","import { logNotification, cloneEvent, User, App, Session, Release } from '@microsoft/oteljs';\r\nimport { addOneDSFields, preprocessEvent, areCoreFieldsValid, getTimestamp, CUSTOMER_CONTENT_TENANT_TOKEN } from './InternalUtils';\r\nimport { newGuid } from '@microsoft/1ds-core-js';\r\nimport { OneDSEndpoint } from './DataModels';\r\nvar MAX_CUSTOMER_CONTENT_MAJOR_VERSION = 2;\r\n/**\r\n * Get the corresponding 1DS CCCO Endpoint for a customer content event, for sending via an external instance of the 1DS SDK\r\n * @param oneDSEndpoint - The public 1DS Endpoint.\r\n */\r\nexport function getCorrespondingCCCOEndpoint(oneDSEndpoint) {\r\n switch (oneDSEndpoint) {\r\n case OneDSEndpoint.PUBLIC:\r\n return \"https://office-c.events.data.microsoft.com/OneCollector/1.0/\" /* OneDSCCCOEndpoint.PUBLIC */;\r\n case OneDSEndpoint.EUDB:\r\n return \"https://eu-office-c.events.data.microsoft.com/OneCollector/1.0/\" /* OneDSCCCOEndpoint.EUDB */;\r\n default:\r\n return undefined;\r\n }\r\n}\r\n/**\r\n * OneDSHelper helps to create a 1DS telemetry event\r\n *\r\n */\r\nvar OneDSHelper = /** @class */ (function () {\r\n /**\r\n * Constructs an 1DS Helper\r\n * @param persistentDataFields - Data fields to be sent with every event; these data fields are assumed to\r\n * be top-level static fields, and will not be prepended with \"Data.\"\r\n * @param oneDSHelperProperties - Properties on the sinks\r\n */\r\n function OneDSHelper(persistentDataFields, oneDSHelperProperties) {\r\n var _this = this;\r\n /**\r\n * Number of telemetry events processed\r\n * Also equal to the Event Sequence\r\n */\r\n this.eventsProcessed = 0;\r\n /**\r\n * Number of telemetry events sent\r\n */\r\n this.eventsSent = 0;\r\n /**\r\n * Number of telemetry events discarded by the 1DS SDK\r\n */\r\n this.eventsDiscarded = 0;\r\n // #region Private variables\r\n var _preprocessors = [];\r\n var _optionalEventsEnabled = false;\r\n var _isEnabled = true;\r\n var _diagnosticLevelChecker = {\r\n name: 'DiagnosticLevel',\r\n /**\r\n * Determine whether an event can be sent. Generally returns true; returns\r\n * false if the event does not have the appropriate event flags and the optional events override is not enabled.\r\n * @param telemetryEvent - An event to process\r\n */\r\n processEvent: function (telemetryEvent) {\r\n var diagnosticLevel = telemetryEvent.eventFlags.diagnosticLevel;\r\n return (_optionalEventsEnabled ||\r\n diagnosticLevel === 10 /* DiagnosticLevel.Required */ ||\r\n diagnosticLevel === 110 /* DiagnosticLevel.RequiredServiceData */ ||\r\n diagnosticLevel === 120 /* DiagnosticLevel.RequiredServiceDataForEssentialServices */);\r\n }\r\n };\r\n // These are persistent data fields kept by the OneDSHelper\r\n var _helperPersistentOneDSDataFields = {};\r\n var _oneDSSinkSessionId = newGuid();\r\n // let _epoch = new Date().getTime().toString();\r\n // #endregion\r\n // #region Public functions\r\n this.init = function (_disableSinkOnInvalidCoreFields) {\r\n return areCoreFieldsValid(_helperPersistentOneDSDataFields, false);\r\n };\r\n this.begin = function () {\r\n _isEnabled = _isEnabled && areCoreFieldsValid(_helperPersistentOneDSDataFields, true);\r\n return _isEnabled;\r\n };\r\n this.getOneDSTelemetryEvent = function (telemetryEvent) {\r\n return getOneDSEventInternal(telemetryEvent, {\r\n eventType: 1 /* EventType.SendTelemetryEvent */\r\n });\r\n };\r\n this.getOneDSCustomerContent = function (telemetryEvent) {\r\n var customerContentVersion = telemetryEvent.telemetryProperties.customerContentVersion;\r\n if (customerContentVersion &&\r\n Math.floor(customerContentVersion) <= MAX_CUSTOMER_CONTENT_MAJOR_VERSION &&\r\n telemetryEvent.telemetryProperties.customerContentType === 1 /* CustomerContentType.MocaAddIn */) {\r\n return getOneDSEventInternal(telemetryEvent, { eventType: 2 /* EventType.CustomerContent */ });\r\n }\r\n return undefined;\r\n };\r\n /**\r\n * Gets a tenant token to use for sending the event\r\n * @param telemetryEvent - The event to be sent, which should have a tenant token in its properties\r\n */\r\n var getTenantToken = function (telemetryEvent, eventType) {\r\n if (eventType === 2 /* EventType.CustomerContent */) {\r\n return CUSTOMER_CONTENT_TENANT_TOKEN;\r\n }\r\n if (!telemetryEvent.telemetryProperties ||\r\n (eventType === 1 /* EventType.SendTelemetryEvent */ && !telemetryEvent.telemetryProperties.ariaTenantToken)) {\r\n logNotification(0 /* LogLevel.Error */, 1 /* Category.Sink */, function () { return 'Missing Aria Token'; });\r\n return undefined;\r\n }\r\n if (eventType === 1 /* EventType.SendTelemetryEvent */) {\r\n return telemetryEvent.telemetryProperties.ariaTenantToken;\r\n }\r\n return undefined;\r\n };\r\n /**\r\n * Create a 1DS telemetry event with the Event contract and data fields\r\n * @param telemetryEvent - The telemetry event to be sent\r\n * @param eventProperties - Properties for the event\r\n */\r\n var getOneDSEventInternal = function (telemetryEvent, eventProperties) {\r\n if (!_isEnabled) {\r\n return;\r\n }\r\n // Clone the event, because preprocessEvent might modify it\r\n var internalEvent = cloneEvent(telemetryEvent);\r\n if (preprocessEvent(internalEvent, _preprocessors)) {\r\n var eventTime = getTimestamp(internalEvent).toISOString();\r\n var data = {\r\n 'Event.Name': internalEvent.eventName,\r\n 'Event.Source': 'OTelJS',\r\n 'Event.Time': { value: eventTime, propertyType: 9 /* EventPropertyType.DateTime */ }\r\n };\r\n _this.eventsProcessed++;\r\n data['Event.Sequence'] = { value: _this.eventsProcessed, propertyType: 4 /* EventPropertyType.Int64 */ };\r\n data['Event.Id'] = _oneDSSinkSessionId + '.' + _this.eventsProcessed;\r\n for (var fieldName in _helperPersistentOneDSDataFields) {\r\n data[fieldName] = _helperPersistentOneDSDataFields[fieldName];\r\n }\r\n // If a field is found that makes the event invalid, drop the event\r\n if (!addOneDSFields(data, internalEvent.dataFields, /*prependDataToken*/ true, eventProperties.eventType)) {\r\n logNotification(0 /* LogLevel.Error */, 1 /* Category.Sink */, function () { return 'Dropping Event: ' + internalEvent.eventName; });\r\n return undefined;\r\n }\r\n var baseType = 'custom';\r\n // Event Contract\r\n if (internalEvent.eventContract) {\r\n if (internalEvent.eventContract.name) {\r\n data['Event.Contract'] = internalEvent.eventContract.name;\r\n baseType += '.' + internalEvent.eventContract.name.toLowerCase().replace(/\\./g, '_');\r\n }\r\n addOneDSFields(data, internalEvent.eventContract.dataFields, /*prependDataToken*/ false, eventProperties.eventType);\r\n }\r\n var token = getTenantToken(internalEvent, eventProperties.eventType);\r\n if (!token) {\r\n return undefined;\r\n }\r\n var oneDSEvent = {\r\n iKey: token,\r\n name: internalEvent.eventName,\r\n data: data,\r\n time: eventTime,\r\n baseType: baseType,\r\n ext: {\r\n sdk: {\r\n seq: _this.eventsProcessed\r\n }\r\n }\r\n };\r\n return oneDSEvent;\r\n }\r\n return undefined;\r\n };\r\n this.addPreprocessor = function (preprocessor) {\r\n _preprocessors.push(preprocessor);\r\n };\r\n this.getOneDSPersistentDataFields = function () {\r\n return _helperPersistentOneDSDataFields;\r\n };\r\n this.getPreprocessors = function () {\r\n return _preprocessors;\r\n };\r\n // Persistent data fields should not contain customer content\r\n // or direct numeric data\r\n // We use this later in the constructor, so saving it as a temporary variable to save bytes\r\n var addPersistentDataFields = function (dataFields) {\r\n addOneDSFields(_helperPersistentOneDSDataFields, dataFields, /*prependDataToken*/ false, 1 /* EventType.SendTelemetryEvent */);\r\n };\r\n this.addPersistentDataFields = addPersistentDataFields;\r\n this.setOptionalEventsEnabled = function (enabled) {\r\n _optionalEventsEnabled = enabled;\r\n };\r\n this.setFullEventsEnabled = this.setOptionalEventsEnabled;\r\n // #endregion\r\n // #region Actual constructor stuff\r\n if (oneDSHelperProperties.enableOptionalEvents) {\r\n _optionalEventsEnabled = true;\r\n }\r\n addPersistentDataFields(persistentDataFields);\r\n var coreFields = oneDSHelperProperties.coreFields;\r\n if (coreFields) {\r\n addPersistentDataFields(App.getFields(coreFields.app));\r\n addPersistentDataFields(User.getFields(coreFields.user));\r\n addPersistentDataFields(Session.getFields(coreFields.session));\r\n var release = coreFields.release;\r\n if (release) {\r\n addPersistentDataFields(Release.getFields(release));\r\n }\r\n }\r\n this.addPreprocessor(_diagnosticLevelChecker);\r\n // #endregion\r\n }\r\n return OneDSHelper;\r\n}());\r\nexport { OneDSHelper };\r\n//# sourceMappingURL=OneDSHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { dateNow, isArray, isFunction, objDefineAccessors } from \"./HelperFuncs\";\r\nvar strExecutionContextKey = \"ctx\";\r\nvar _defaultPerfManager = null;\r\nvar PerfEvent = /** @class */ (function () {\r\n function PerfEvent(name, payloadDetails, isAsync) {\r\n var _self = this;\r\n var accessorDefined = false;\r\n _self.start = dateNow();\r\n _self.name = name;\r\n _self.isAsync = isAsync;\r\n _self.isChildEvt = function () { return false; };\r\n if (isFunction(payloadDetails)) {\r\n // Create an accessor to minimize the potential performance impact of executing the payloadDetails callback\r\n var theDetails_1;\r\n accessorDefined = objDefineAccessors(_self, \"payload\", function () {\r\n // Delay the execution of the payloadDetails until needed\r\n if (!theDetails_1 && isFunction(payloadDetails)) {\r\n theDetails_1 = payloadDetails();\r\n // clear it out now so the referenced objects can be garbage collected\r\n payloadDetails = null;\r\n }\r\n return theDetails_1;\r\n });\r\n }\r\n _self.getCtx = function (key) {\r\n if (key) {\r\n // The parent and child links are located directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent.ParentContextKey || key === PerfEvent.ChildrenContextKey) {\r\n return _self[key];\r\n }\r\n return (_self[strExecutionContextKey] || {})[key];\r\n }\r\n return null;\r\n };\r\n _self.setCtx = function (key, value) {\r\n if (key) {\r\n // Put the parent and child links directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent.ParentContextKey) {\r\n // Simple assumption, if we are setting a parent then we must be a child\r\n if (!_self[key]) {\r\n _self.isChildEvt = function () { return true; };\r\n }\r\n _self[key] = value;\r\n }\r\n else if (key === PerfEvent.ChildrenContextKey) {\r\n _self[key] = value;\r\n }\r\n else {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n }\r\n };\r\n _self.complete = function () {\r\n var childTime = 0;\r\n var childEvts = _self.getCtx(PerfEvent.ChildrenContextKey);\r\n if (isArray(childEvts)) {\r\n for (var lp = 0; lp < childEvts.length; lp++) {\r\n var childEvt = childEvts[lp];\r\n if (childEvt) {\r\n childTime += childEvt.time;\r\n }\r\n }\r\n }\r\n _self.time = dateNow() - _self.start;\r\n _self.exTime = _self.time - childTime;\r\n _self.complete = function () { };\r\n if (!accessorDefined && isFunction(payloadDetails)) {\r\n // If we couldn't define the property set during complete -- to minimize the perf impact until after the time\r\n _self.payload = payloadDetails();\r\n }\r\n };\r\n }\r\n PerfEvent.ParentContextKey = \"parent\";\r\n PerfEvent.ChildrenContextKey = \"childEvts\";\r\n return PerfEvent;\r\n}());\r\nexport { PerfEvent };\r\nvar PerfManager = /** @class */ (function () {\r\n function PerfManager(manager) {\r\n /**\r\n * General bucket used for execution context set and retrieved via setCtx() and getCtx.\r\n * Defined as private so it can be visualized via the DebugPlugin\r\n */\r\n this.ctx = {};\r\n dynamicProto(PerfManager, this, function (_self) {\r\n _self.create = function (src, payloadDetails, isAsync) {\r\n // TODO (@MSNev): at some point we will want to add additional configuration to \"select\" which events to instrument\r\n // for now this is just a simple do everything.\r\n return new PerfEvent(src, payloadDetails, isAsync);\r\n };\r\n _self.fire = function (perfEvent) {\r\n if (perfEvent) {\r\n perfEvent.complete();\r\n if (manager && isFunction(manager.perfEvent)) {\r\n manager.perfEvent(perfEvent);\r\n }\r\n }\r\n };\r\n _self.setCtx = function (key, value) {\r\n if (key) {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n };\r\n _self.getCtx = function (key) {\r\n return (_self[strExecutionContextKey] || {})[key];\r\n };\r\n });\r\n }\r\n// Removed Stub for PerfManager.prototype.create.\r\n// Removed Stub for PerfManager.prototype.fire.\r\n// Removed Stub for PerfManager.prototype.setCtx.\r\n// Removed Stub for PerfManager.prototype.getCtx.\r\n return PerfManager;\r\n}());\r\nexport { PerfManager };\r\nvar doPerfActiveKey = \"CoreUtils.doPerf\";\r\n/**\r\n * Helper function to wrap a function with a perf event\r\n * @param mgrSource - The Performance Manager or a Performance provider source (may be null)\r\n * @param getSource - The callback to create the source name for the event (if perf monitoring is enabled)\r\n * @param func - The function to call and measure\r\n * @param details - A function to return the payload details\r\n * @param isAsync - Is the event / function being call asynchronously or synchronously\r\n */\r\nexport function doPerf(mgrSource, getSource, func, details, isAsync) {\r\n if (mgrSource) {\r\n var perfMgr = mgrSource;\r\n if (isFunction(perfMgr[\"getPerfMgr\"])) {\r\n // Looks like a perf manager provider object\r\n perfMgr = perfMgr[\"getPerfMgr\"]();\r\n }\r\n if (perfMgr) {\r\n var perfEvt = void 0;\r\n var currentActive = perfMgr.getCtx(doPerfActiveKey);\r\n try {\r\n perfEvt = perfMgr.create(getSource(), details, isAsync);\r\n if (perfEvt) {\r\n if (currentActive && perfEvt.setCtx) {\r\n perfEvt.setCtx(PerfEvent.ParentContextKey, currentActive);\r\n if (currentActive.getCtx && currentActive.setCtx) {\r\n var children = currentActive.getCtx(PerfEvent.ChildrenContextKey);\r\n if (!children) {\r\n children = [];\r\n currentActive.setCtx(PerfEvent.ChildrenContextKey, children);\r\n }\r\n children.push(perfEvt);\r\n }\r\n }\r\n // Set this event as the active event now\r\n perfMgr.setCtx(doPerfActiveKey, perfEvt);\r\n return func(perfEvt);\r\n }\r\n }\r\n catch (ex) {\r\n if (perfEvt && perfEvt.setCtx) {\r\n perfEvt.setCtx(\"exception\", ex);\r\n }\r\n }\r\n finally {\r\n // fire the perf event\r\n if (perfEvt) {\r\n perfMgr.fire(perfEvt);\r\n }\r\n // Reset the active event to the previous value\r\n perfMgr.setCtx(doPerfActiveKey, currentActive);\r\n }\r\n }\r\n }\r\n return func();\r\n}\r\n/**\r\n * Set the global performance manager to use when there is no core instance or it has not been initialized yet.\r\n * @param perfManager - The IPerfManager instance to use when no performance manager is supplied.\r\n */\r\nexport function setGblPerfMgr(perfManager) {\r\n _defaultPerfManager = perfManager;\r\n}\r\n/**\r\n * Get the current global performance manager that will be used with no performance manager is supplied.\r\n * @returns - The current default manager\r\n */\r\nexport function getGblPerfMgr() {\r\n return _defaultPerfManager;\r\n}\r\n//# sourceMappingURL=PerfManager.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { generateW3CId } from \"./CoreUtils\";\r\nimport { findMetaTag, findNamedServerTiming } from \"./EnvUtils\";\r\nimport { isArray, isString, strTrim } from \"./HelperFuncs\";\r\n// using {0,16} for leading and trailing whitespace just to constrain the possible runtime of a random string\r\nvar TRACE_PARENT_REGEX = /^([\\da-f]{2})-([\\da-f]{32})-([\\da-f]{16})-([\\da-f]{2})(-[^\\s]*)?$/;\r\nvar DEFAULT_VERSION = \"00\";\r\nvar INVALID_VERSION = \"ff\";\r\nvar INVALID_TRACE_ID = \"00000000000000000000000000000000\";\r\nvar INVALID_SPAN_ID = \"0000000000000000\";\r\nvar SAMPLED_FLAG = 0x01;\r\nfunction _isValid(value, len, invalidValue) {\r\n if (value && value.length === len && value !== invalidValue) {\r\n return !!value.match(/^[\\da-f]*$/);\r\n }\r\n return false;\r\n}\r\nfunction _formatValue(value, len, defValue) {\r\n if (_isValid(value, len)) {\r\n return value;\r\n }\r\n return defValue;\r\n}\r\nfunction _formatFlags(value) {\r\n if (isNaN(value) || value < 0 || value > 255) {\r\n value = 0x01;\r\n }\r\n var result = value.toString(16);\r\n while (result.length < 2) {\r\n result = \"0\" + result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Create a new ITraceParent instance using the provided values.\r\n * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.\r\n * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.\r\n * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid\r\n * @param version - The version to used, defaults to version \"01\" if not supplied or invalid.\r\n * @returns\r\n */\r\nexport function createTraceParent(traceId, spanId, flags, version) {\r\n return {\r\n version: _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,\r\n traceId: isValidTraceId(traceId) ? traceId : generateW3CId(),\r\n spanId: isValidSpanId(spanId) ? spanId : generateW3CId().substr(0, 16),\r\n traceFlags: flags >= 0 && flags <= 0xFF ? flags : 1\r\n };\r\n}\r\n/**\r\n * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)\r\n *\r\n * @param value\r\n * @returns\r\n */\r\nexport function parseTraceParent(value) {\r\n if (!value) {\r\n // Don't pass a null/undefined or empty string\r\n return null;\r\n }\r\n if (isArray(value)) {\r\n // The value may have been encoded on the page into an array so handle this automatically\r\n value = value[0] || \"\";\r\n }\r\n if (!value || !isString(value) || value.length > 8192) {\r\n // limit potential processing based on total length\r\n return null;\r\n }\r\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\r\n var match = TRACE_PARENT_REGEX.exec(strTrim(value));\r\n if (!match || // No match\r\n match[1] === INVALID_VERSION || // version ff is forbidden\r\n match[2] === INVALID_TRACE_ID || // All zeros is considered to be invalid\r\n match[3] === INVALID_SPAN_ID) { // All zeros is considered to be invalid\r\n return null;\r\n }\r\n return {\r\n version: match[1],\r\n traceId: match[2],\r\n spanId: match[3],\r\n traceFlags: parseInt(match[4], 16)\r\n };\r\n}\r\n/**\r\n * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string\r\n * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.\r\n * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.\r\n * @param value - The W3c trace Id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\nexport function isValidTraceId(value) {\r\n return _isValid(value, 32, INVALID_TRACE_ID);\r\n}\r\n/**\r\n * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character\r\n * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.\r\n * If all characters are zero (0000000000000000) this is considered an invalid value.\r\n * @param value - The W3c span id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\nexport function isValidSpanId(value) {\r\n return _isValid(value, 16, INVALID_SPAN_ID);\r\n}\r\n/**\r\n * Validates that the provided ITraceParent instance conforms to the currently supported specifications\r\n * @param value\r\n * @returns\r\n */\r\nexport function isValidTraceParent(value) {\r\n if (!value ||\r\n !_isValid(value.version, 2, INVALID_VERSION) ||\r\n !_isValid(value.traceId, 32, INVALID_TRACE_ID) ||\r\n !_isValid(value.spanId, 16, INVALID_SPAN_ID) ||\r\n !_isValid(_formatFlags(value.traceFlags), 2)) {\r\n // Each known field must contain a valid value\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Is the parsed traceParent indicating that the trace is currently sampled.\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\nexport function isSampledFlag(value) {\r\n if (isValidTraceParent(value)) {\r\n return (value.traceFlags & SAMPLED_FLAG) === SAMPLED_FLAG;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Format the ITraceParent value as a string using the supported and know version formats.\r\n * So even if the passed traceParent is a later version the string value returned from this\r\n * function will convert it to only the known version formats.\r\n * This currently only supports version \"00\" and invalid \"ff\"\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\nexport function formatTraceParent(value) {\r\n if (value) {\r\n // Special Note: This only supports formatting as version 00, future versions should encode any known supported version\r\n // So parsing a future version will populate the correct version value but reformatting will reduce it to version 00.\r\n var flags = _formatFlags(value.traceFlags);\r\n if (!_isValid(flags, 2)) {\r\n flags = \"01\";\r\n }\r\n var version = value.version || DEFAULT_VERSION;\r\n if (version !== \"00\" && version !== \"ff\") {\r\n // Reduce version to \"00\"\r\n version = DEFAULT_VERSION;\r\n }\r\n // Format as version 00\r\n return \"\".concat(version, \"-\").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID), \"-\").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID), \"-\").concat(flags);\r\n }\r\n return \"\";\r\n}\r\n/**\r\n * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.\r\n * @returns\r\n */\r\nexport function findW3cTraceParent() {\r\n var name = \"traceparent\";\r\n var traceParent = parseTraceParent(findMetaTag(name));\r\n if (!traceParent) {\r\n traceParent = parseTraceParent(findNamedServerTiming(name));\r\n }\r\n return traceParent;\r\n}\r\n//# sourceMappingURL=W3cTraceParent.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { arrForEach, isFunction } from \"./HelperFuncs\";\r\nimport { strCore, strDoTeardown, strIsInitialized, strPriority, strProcessTelemetry, strSetNextPlugin, strTeardown } from \"./InternalConstants\";\r\nimport { createElmNodeData } from \"./DataCacheHelper\";\r\nimport { isValidSpanId, isValidTraceId } from \"./W3cTraceParent\";\r\nvar strDoUnload = \"_doUnload\";\r\nvar pluginStateData = createElmNodeData(\"plugin\");\r\nexport function _getPluginState(plugin) {\r\n return pluginStateData.get(plugin, \"state\", {}, true);\r\n}\r\n/**\r\n * Initialize the queue of plugins\r\n * @param plugins - The array of plugins to initialize and setting of the next plugin\r\n * @param config The current config for the instance\r\n * @param core THe current core instance\r\n * @param extensions The extensions\r\n */\r\nexport function initializePlugins(processContext, extensions) {\r\n // Set the next plugin and identified the uninitialized plugins\r\n var initPlugins = [];\r\n var lastPlugin = null;\r\n var proxy = processContext.getNext();\r\n var pluginState;\r\n while (proxy) {\r\n var thePlugin = proxy.getPlugin();\r\n if (thePlugin) {\r\n if (lastPlugin &&\r\n isFunction(lastPlugin[strSetNextPlugin]) &&\r\n isFunction(thePlugin[strProcessTelemetry])) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[strSetNextPlugin](thePlugin);\r\n }\r\n var isInitialized = false;\r\n if (isFunction(thePlugin[strIsInitialized])) {\r\n isInitialized = thePlugin[strIsInitialized]();\r\n }\r\n else {\r\n pluginState = _getPluginState(thePlugin);\r\n isInitialized = pluginState[strIsInitialized];\r\n }\r\n if (!isInitialized) {\r\n initPlugins.push(thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy.getNext();\r\n }\r\n }\r\n // Now initialize the plugins\r\n arrForEach(initPlugins, function (thePlugin) {\r\n var core = processContext.core();\r\n thePlugin.initialize(processContext.getCfg(), core, extensions, processContext.getNext());\r\n pluginState = _getPluginState(thePlugin);\r\n // Only add the core to the state if the plugin didn't set it (doesn't extent from BaseTelemetryPlugin)\r\n if (!thePlugin[strCore] && !pluginState[strCore]) {\r\n pluginState[strCore] = core;\r\n }\r\n pluginState[strIsInitialized] = true;\r\n delete pluginState[strTeardown];\r\n });\r\n}\r\nexport function sortPlugins(plugins) {\r\n // Sort by priority\r\n return plugins.sort(function (extA, extB) {\r\n var result = 0;\r\n if (extB) {\r\n var bHasProcess = isFunction(extB[strProcessTelemetry]);\r\n if (isFunction(extA[strProcessTelemetry])) {\r\n result = bHasProcess ? extA[strPriority] - extB[strPriority] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n }\r\n else {\r\n result = extA ? 1 : -1;\r\n }\r\n return result;\r\n });\r\n // sort complete\r\n}\r\n/**\r\n * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any\r\n * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.\r\n * @param components - The components you want to unload\r\n * @param unloadCtx - This is the context that should be used during unloading.\r\n * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.\r\n * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.\r\n * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.\r\n */\r\nexport function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {\r\n var idx = 0;\r\n function _doUnload() {\r\n while (idx < components.length) {\r\n var component = components[idx++];\r\n if (component) {\r\n var func = component[strDoUnload] || component[strDoTeardown];\r\n if (isFunction(func)) {\r\n if (func.call(component, unloadCtx, unloadState, _doUnload) === true) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return _doUnload();\r\n}\r\n/**\r\n * Creates a IDistributedTraceContext which optionally also \"sets\" the value on a parent\r\n * @param parentCtx - An optional parent distributed trace instance\r\n * @returns A new IDistributedTraceContext instance that uses an internal temporary object\r\n */\r\nexport function createDistributedTraceContext(parentCtx) {\r\n var trace = {};\r\n return {\r\n getName: function () {\r\n return trace.name;\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace.name = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace.traceId;\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace.traceId = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace.spanId;\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace.spanId = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace.traceFlags;\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace.traceFlags = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { safeGetLogger, _throwInternal } from \"./DiagnosticLogger\";\r\nimport { arrForEach, isArray, isFunction, isNullOrUndefined, isObject, isUndefined, objExtend, objForEachKey, objFreeze, objKeys, proxyFunctions } from \"./HelperFuncs\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nimport { strCore, strDisabled, strEmpty, strIsInitialized, strTeardown, strUpdate } from \"./InternalConstants\";\r\nimport { _getPluginState } from \"./TelemetryHelpers\";\r\nvar strTelemetryPluginChain = \"TelemetryPluginChain\";\r\nvar strHasRunFlags = \"_hasRun\";\r\nvar strGetTelCtx = \"_getTelCtx\";\r\nvar _chainId = 0;\r\nfunction _getNextProxyStart(proxy, core, startAt) {\r\n while (proxy) {\r\n if (proxy.getPlugin() === startAt) {\r\n return proxy;\r\n }\r\n proxy = proxy.getNext();\r\n }\r\n // This wasn't found in the existing chain so create an isolated one with just this plugin\r\n return createTelemetryProxyChain([startAt], core.config || {}, core);\r\n}\r\n/**\r\n * @ignore\r\n * @param telemetryChain\r\n * @param config\r\n * @param core\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n * @returns\r\n */\r\nfunction _createInternalContext(telemetryChain, config, core, startAt) {\r\n // We have a special case where we want to start execution from this specific plugin\r\n // or we simply reuse the existing telemetry plugin chain (normal execution case)\r\n var _nextProxy = null; // By Default set as no next plugin\r\n var _onComplete = [];\r\n if (startAt !== null) {\r\n // There is no next element (null) vs not defined (undefined) so use the full chain\r\n _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;\r\n }\r\n var context = {\r\n _next: _moveNext,\r\n ctx: {\r\n core: function () {\r\n return core;\r\n },\r\n diagLog: function () {\r\n return safeGetLogger(core, config);\r\n },\r\n getCfg: function () {\r\n return config;\r\n },\r\n getExtCfg: _getExtCfg,\r\n getConfig: _getConfig,\r\n hasNext: function () {\r\n return !!_nextProxy;\r\n },\r\n getNext: function () {\r\n return _nextProxy;\r\n },\r\n setNext: function (nextPlugin) {\r\n _nextProxy = nextPlugin;\r\n },\r\n iterate: _iterateChain,\r\n onComplete: _addOnComplete\r\n }\r\n };\r\n function _addOnComplete(onComplete, that) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n if (onComplete) {\r\n _onComplete.push({\r\n func: onComplete,\r\n self: !isUndefined(that) ? that : context.ctx,\r\n args: args\r\n });\r\n }\r\n }\r\n function _moveNext() {\r\n var nextProxy = _nextProxy;\r\n // Automatically move to the next plugin\r\n _nextProxy = nextProxy ? nextProxy.getNext() : null;\r\n if (!nextProxy) {\r\n var onComplete = _onComplete;\r\n if (onComplete && onComplete.length > 0) {\r\n arrForEach(onComplete, function (completeDetails) {\r\n try {\r\n completeDetails.func.call(completeDetails.self, completeDetails.args);\r\n }\r\n catch (e) {\r\n _throwInternal(core.logger, 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected Exception during onComplete - \" + dumpObj(e));\r\n }\r\n });\r\n _onComplete = [];\r\n }\r\n }\r\n return nextProxy;\r\n }\r\n function _getExtCfg(identifier, defaultValue, mergeDefault) {\r\n if (defaultValue === void 0) { defaultValue = {}; }\r\n if (mergeDefault === void 0) { mergeDefault = 0 /* GetExtCfgMergeType.None */; }\r\n var theConfig;\r\n if (config) {\r\n var extConfig = config.extensionConfig;\r\n if (extConfig && identifier) {\r\n theConfig = extConfig[identifier];\r\n }\r\n }\r\n if (!theConfig) {\r\n // Just use the defaults\r\n theConfig = defaultValue;\r\n }\r\n else if (isObject(defaultValue)) {\r\n if (mergeDefault !== 0 /* GetExtCfgMergeType.None */) {\r\n // Merge the defaults and configured values\r\n var newConfig_1 = objExtend(true, defaultValue, theConfig);\r\n if (config && mergeDefault === 2 /* GetExtCfgMergeType.MergeDefaultFromRootOrDefault */) {\r\n // Enumerate over the defaultValues and if not already populated attempt to\r\n // find a value from the root config\r\n objForEachKey(defaultValue, function (field) {\r\n // for each unspecified field, set the default value\r\n if (isNullOrUndefined(newConfig_1[field])) {\r\n var cfgValue = config[field];\r\n if (!isNullOrUndefined(cfgValue)) {\r\n newConfig_1[field] = cfgValue;\r\n }\r\n }\r\n });\r\n }\r\n theConfig = newConfig_1;\r\n }\r\n }\r\n return theConfig;\r\n }\r\n function _getConfig(identifier, field, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n var theValue;\r\n var extConfig = _getExtCfg(identifier, null);\r\n if (extConfig && !isNullOrUndefined(extConfig[field])) {\r\n theValue = extConfig[field];\r\n }\r\n else if (config && !isNullOrUndefined(config[field])) {\r\n theValue = config[field];\r\n }\r\n return !isNullOrUndefined(theValue) ? theValue : defaultValue;\r\n }\r\n function _iterateChain(cb) {\r\n // Keep processing until we reach the end of the chain\r\n var nextPlugin;\r\n while (!!(nextPlugin = context._next())) {\r\n var plugin = nextPlugin.getPlugin();\r\n if (plugin) {\r\n // callback with the current on\r\n cb(plugin);\r\n }\r\n }\r\n }\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryContext(telemetryChain, config, core, startAt) {\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(env) {\r\n var nextPlugin = internalContext._next();\r\n // Run the next plugin which will call \"processNext()\"\r\n nextPlugin && nextPlugin.processTelemetry(env, context);\r\n return !nextPlugin;\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);\r\n }\r\n context.processNext = _processNext;\r\n context.createNew = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for handling the unloading of the chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {\r\n var config = core.config || {};\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(unloadState) {\r\n var nextPlugin = internalContext._next();\r\n nextPlugin && nextPlugin.unload(context, unloadState);\r\n return !nextPlugin;\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryUnloadContext(plugins || context.getNext(), core, startAt);\r\n }\r\n context.processNext = _processNext;\r\n context.createNew = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for updating the configuration\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {\r\n var config = core.config || {};\r\n var internalContext = _createInternalContext(telemetryChain, config, core, startAt);\r\n var context = internalContext.ctx;\r\n function _processNext(updateState) {\r\n return context.iterate(function (plugin) {\r\n if (isFunction(plugin.update)) {\r\n plugin.update(context, updateState);\r\n }\r\n });\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config, core, startAt);\r\n }\r\n return createProcessTelemetryUpdateContext(plugins || context.getNext(), core, startAt);\r\n }\r\n context.processNext = _processNext;\r\n context.createNew = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates an execution chain from the array of plugins\r\n * @param plugins - The array of plugins that will be executed in this order\r\n * @param defItemCtx - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n */\r\nexport function createTelemetryProxyChain(plugins, config, core, startAt) {\r\n var firstProxy = null;\r\n var add = startAt ? false : true;\r\n if (isArray(plugins) && plugins.length > 0) {\r\n // Create the proxies and wire up the next plugin chain\r\n var lastProxy_1 = null;\r\n arrForEach(plugins, function (thePlugin) {\r\n if (!add && startAt === thePlugin) {\r\n add = true;\r\n }\r\n if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {\r\n // Only add plugins that are processors\r\n var newProxy = createTelemetryPluginProxy(thePlugin, config, core);\r\n if (!firstProxy) {\r\n firstProxy = newProxy;\r\n }\r\n if (lastProxy_1) {\r\n // Set this new proxy as the next for the previous one\r\n lastProxy_1._setNext(newProxy);\r\n }\r\n lastProxy_1 = newProxy;\r\n }\r\n });\r\n }\r\n if (startAt && !firstProxy) {\r\n // Special case where the \"startAt\" was not in the original list of plugins\r\n return createTelemetryProxyChain([startAt], config, core);\r\n }\r\n return firstProxy;\r\n}\r\n/**\r\n * Create the processing telemetry proxy instance, the proxy is used to abstract the current plugin to allow monitoring and\r\n * execution plugins while passing around the dynamic execution state (IProcessTelemetryContext), the proxy instance no longer\r\n * contains any execution state and can be reused between requests (this was not the case for 2.7.2 and earlier with the\r\n * TelemetryPluginChain class).\r\n * @param plugin - The plugin instance to proxy\r\n * @param config - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n * @returns\r\n */\r\nexport function createTelemetryPluginProxy(plugin, config, core) {\r\n var nextProxy = null;\r\n var hasProcessTelemetry = isFunction(plugin.processTelemetry);\r\n var hasSetNext = isFunction(plugin.setNextPlugin);\r\n var chainId;\r\n if (plugin) {\r\n chainId = plugin.identifier + \"-\" + plugin.priority + \"-\" + _chainId++;\r\n }\r\n else {\r\n chainId = \"Unknown-0-\" + _chainId++;\r\n }\r\n var proxyChain = {\r\n getPlugin: function () {\r\n return plugin;\r\n },\r\n getNext: function () {\r\n return nextProxy;\r\n },\r\n processTelemetry: _processTelemetry,\r\n unload: _unloadPlugin,\r\n update: _updatePlugin,\r\n _id: chainId,\r\n _setNext: function (nextPlugin) {\r\n nextProxy = nextPlugin;\r\n }\r\n };\r\n function _getTelCtx() {\r\n var itemCtx;\r\n // Looks like a plugin didn't pass the (optional) context, so create a new one\r\n if (plugin && isFunction(plugin[strGetTelCtx])) {\r\n // This plugin extends from the BaseTelemetryPlugin so lets use it\r\n itemCtx = plugin[strGetTelCtx]();\r\n }\r\n if (!itemCtx) {\r\n // Create a temporary one\r\n itemCtx = createProcessTelemetryContext(proxyChain, config, core);\r\n }\r\n return itemCtx;\r\n }\r\n function _processChain(itemCtx, processPluginFn, name, details, isAsync) {\r\n var hasRun = false;\r\n var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;\r\n var hasRunContext = itemCtx[strHasRunFlags];\r\n if (!hasRunContext) {\r\n // Assign and populate\r\n hasRunContext = itemCtx[strHasRunFlags] = {};\r\n }\r\n // Ensure that we keep the context in sync\r\n itemCtx.setNext(nextProxy);\r\n if (plugin) {\r\n doPerf(itemCtx[strCore](), function () { return identifier + \":\" + name; }, function () {\r\n // Mark this component as having run\r\n hasRunContext[chainId] = true;\r\n try {\r\n // Set a flag on the next plugin so we know if it was attempted to be executed\r\n var nextId = nextProxy ? nextProxy._id : strEmpty;\r\n if (nextId) {\r\n hasRunContext[nextId] = false;\r\n }\r\n hasRun = processPluginFn(itemCtx);\r\n }\r\n catch (error) {\r\n var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;\r\n if (hasNextRun) {\r\n // The next plugin after us has already run so set this one as complete\r\n hasRun = true;\r\n }\r\n if (!nextProxy || !hasNextRun) {\r\n // Either we have no next plugin or the current one did not attempt to call the next plugin\r\n // Which means the current one is the root of the failure so log/report this failure\r\n _throwInternal(itemCtx.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, \"Plugin [\" + identifier + \"] failed during \" + name + \" - \" + dumpObj(error) + \", run flags: \" + dumpObj(hasRunContext));\r\n }\r\n }\r\n }, details, isAsync);\r\n }\r\n return hasRun;\r\n }\r\n function _processTelemetry(env, itemCtx) {\r\n itemCtx = itemCtx || _getTelCtx();\r\n function _callProcessTelemetry(itemCtx) {\r\n if (!plugin || !hasProcessTelemetry) {\r\n return false;\r\n }\r\n var pluginState = _getPluginState(plugin);\r\n if (pluginState.teardown || pluginState[strDisabled]) {\r\n return false;\r\n }\r\n // Ensure that we keep the context in sync (for processNext()), just in case a plugin\r\n // doesn't calls processTelemetry() instead of itemContext.processNext() or some\r\n // other form of error occurred\r\n if (hasSetNext) {\r\n // Backward compatibility setting the next plugin on the instance\r\n plugin.setNextPlugin(nextProxy);\r\n }\r\n plugin.processTelemetry(env, itemCtx);\r\n // Process Telemetry is expected to call itemCtx.processNext() or nextPlugin.processTelemetry()\r\n return true;\r\n }\r\n if (!_processChain(itemCtx, _callProcessTelemetry, \"processTelemetry\", function () { return ({ item: env }); }, !(env.sync))) {\r\n // The underlying plugin is either not defined, not enabled or does not have a processTelemetry implementation\r\n // so we still want the next plugin to be executed.\r\n itemCtx.processNext(env);\r\n }\r\n }\r\n function _unloadPlugin(unloadCtx, unloadState) {\r\n function _callTeardown() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[strCore] || pluginState.core;\r\n // Only teardown the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {\r\n // Handle plugins that don't extend from the BaseTelemetryPlugin\r\n pluginState[strCore] = null;\r\n pluginState[strTeardown] = true;\r\n pluginState[strIsInitialized] = false;\r\n if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(unloadCtx, _callTeardown, \"unload\", function () { }, unloadState.isAsync)) {\r\n // Only called if we hasRun was not true\r\n unloadCtx.processNext(unloadState);\r\n }\r\n }\r\n function _updatePlugin(updateCtx, updateState) {\r\n function _callUpdate() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[strCore] || pluginState.core;\r\n // Only update the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {\r\n if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(updateCtx, _callUpdate, \"update\", function () { }, false)) {\r\n // Only called if we hasRun was not true\r\n updateCtx.processNext(updateState);\r\n }\r\n }\r\n return objFreeze(proxyChain);\r\n}\r\n/**\r\n * This class will be removed!\r\n * @deprecated use createProcessTelemetryContext() instead\r\n */\r\nvar ProcessTelemetryContext = /** @class */ (function () {\r\n /**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n */\r\n function ProcessTelemetryContext(pluginChain, config, core, startAt) {\r\n var _self = this;\r\n var context = createProcessTelemetryContext(pluginChain, config, core, startAt);\r\n // Proxy all functions of the context to this object\r\n proxyFunctions(_self, context, objKeys(context));\r\n }\r\n return ProcessTelemetryContext;\r\n}());\r\nexport { ProcessTelemetryContext };\r\n//# sourceMappingURL=ProcessTelemetryContext.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n// \r\nimport { arrForEach, isArray, objFreeze, throwError } from \"./HelperFuncs\";\r\nimport { strPause, strProcessNext, strResume, strTeardown } from \"./InternalConstants\";\r\nimport { createProcessTelemetryContext, createTelemetryProxyChain } from \"./ProcessTelemetryContext\";\r\nimport { initializePlugins } from \"./TelemetryHelpers\";\r\nexport var ChannelControllerPriority = 500;\r\nvar ChannelValidationMessage = \"Channel has invalid priority - \";\r\nfunction _addChannelQueue(channelQueue, queue, config, core) {\r\n if (queue && isArray(queue) && queue.length > 0) {\r\n queue = queue.sort(function (a, b) {\r\n return a.priority - b.priority;\r\n });\r\n arrForEach(queue, function (queueItem) {\r\n if (queueItem.priority < ChannelControllerPriority) {\r\n throwError(ChannelValidationMessage + queueItem.identifier);\r\n }\r\n });\r\n channelQueue.push({\r\n queue: objFreeze(queue),\r\n chain: createTelemetryProxyChain(queue, config, core)\r\n });\r\n }\r\n}\r\nexport function createChannelControllerPlugin(channelQueue, core) {\r\n var _a;\r\n function _getTelCtx() {\r\n return createProcessTelemetryContext(null, core.config, core, null);\r\n }\r\n function _processChannelQueue(theChannels, itemCtx, processFn, onComplete) {\r\n var waiting = theChannels ? (theChannels.length + 1) : 1;\r\n function _runChainOnComplete() {\r\n waiting--;\r\n if (waiting === 0) {\r\n onComplete && onComplete();\r\n onComplete = null;\r\n }\r\n }\r\n if (waiting > 0) {\r\n arrForEach(theChannels, function (channels) {\r\n // pass on to first item in queue\r\n if (channels && channels.queue.length > 0) {\r\n var channelChain = channels.chain;\r\n var chainCtx = itemCtx.createNew(channelChain);\r\n chainCtx.onComplete(_runChainOnComplete);\r\n // Cause this chain to start processing\r\n processFn(chainCtx);\r\n }\r\n else {\r\n waiting--;\r\n }\r\n });\r\n }\r\n _runChainOnComplete();\r\n }\r\n function _doUpdate(updateCtx, updateState) {\r\n var theUpdateState = updateState || {\r\n reason: 0 /* TelemetryUpdateReason.Unknown */\r\n };\r\n _processChannelQueue(channelQueue, updateCtx, function (chainCtx) {\r\n chainCtx[strProcessNext](theUpdateState);\r\n }, function () {\r\n updateCtx[strProcessNext](theUpdateState);\r\n });\r\n return true;\r\n }\r\n function _doTeardown(unloadCtx, unloadState) {\r\n var theUnloadState = unloadState || {\r\n reason: 0 /* TelemetryUnloadReason.ManualTeardown */,\r\n isAsync: false\r\n };\r\n _processChannelQueue(channelQueue, unloadCtx, function (chainCtx) {\r\n chainCtx[strProcessNext](theUnloadState);\r\n }, function () {\r\n unloadCtx[strProcessNext](theUnloadState);\r\n isInitialized = false;\r\n });\r\n return true;\r\n }\r\n function _getChannel(pluginIdentifier) {\r\n var thePlugin = null;\r\n if (channelQueue && channelQueue.length > 0) {\r\n arrForEach(channelQueue, function (channels) {\r\n // pass on to first item in queue\r\n if (channels && channels.queue.length > 0) {\r\n arrForEach(channels.queue, function (ext) {\r\n if (ext.identifier === pluginIdentifier) {\r\n thePlugin = ext;\r\n // Cause arrForEach to stop iterating\r\n return -1;\r\n }\r\n });\r\n if (thePlugin) {\r\n // Cause arrForEach to stop iterating\r\n return -1;\r\n }\r\n }\r\n });\r\n }\r\n return thePlugin;\r\n }\r\n var isInitialized = false;\r\n var channelController = (_a = {\r\n identifier: \"ChannelControllerPlugin\",\r\n priority: ChannelControllerPriority,\r\n initialize: function (config, core, extensions, pluginChain) {\r\n isInitialized = true;\r\n arrForEach(channelQueue, function (channels) {\r\n if (channels && channels.queue.length > 0) {\r\n initializePlugins(createProcessTelemetryContext(channels.chain, config, core), extensions);\r\n }\r\n });\r\n },\r\n isInitialized: function () {\r\n return isInitialized;\r\n },\r\n processTelemetry: function (item, itemCtx) {\r\n _processChannelQueue(channelQueue, itemCtx || _getTelCtx(), function (chainCtx) {\r\n chainCtx[strProcessNext](item);\r\n }, function () {\r\n itemCtx[strProcessNext](item);\r\n });\r\n },\r\n update: _doUpdate\r\n },\r\n _a[strPause] = function () {\r\n _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {\r\n chainCtx.iterate(function (plugin) {\r\n plugin[strPause] && plugin[strPause]();\r\n });\r\n }, null);\r\n },\r\n _a[strResume] = function () {\r\n _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {\r\n chainCtx.iterate(function (plugin) {\r\n plugin[strResume] && plugin[strResume]();\r\n });\r\n }, null);\r\n },\r\n _a[strTeardown] = _doTeardown,\r\n _a.getChannel = _getChannel,\r\n _a.flush = function (isAsync, callBack, sendReason, cbTimeout) {\r\n // Setting waiting to one so that we don't call the callBack until we finish iterating\r\n var waiting = 1;\r\n var doneIterating = false;\r\n var cbTimer = null;\r\n cbTimeout = cbTimeout || 5000;\r\n function doCallback() {\r\n waiting--;\r\n if (doneIterating && waiting === 0) {\r\n if (cbTimer) {\r\n clearTimeout(cbTimer);\r\n cbTimer = null;\r\n }\r\n callBack && callBack(doneIterating);\r\n callBack = null;\r\n }\r\n }\r\n _processChannelQueue(channelQueue, _getTelCtx(), function (chainCtx) {\r\n chainCtx.iterate(function (plugin) {\r\n if (plugin.flush) {\r\n waiting++;\r\n var handled_1 = false;\r\n // Not all channels will call this callback for every scenario\r\n if (!plugin.flush(isAsync, function () {\r\n handled_1 = true;\r\n doCallback();\r\n }, sendReason)) {\r\n if (!handled_1) {\r\n // If any channel doesn't return true and it didn't call the callback, then we should assume that the callback\r\n // will never be called, so use a timeout to allow the channel(s) some time to \"finish\" before triggering any\r\n // followup function (such as unloading)\r\n if (isAsync && cbTimer == null) {\r\n cbTimer = setTimeout(function () {\r\n cbTimer = null;\r\n doCallback();\r\n }, cbTimeout);\r\n }\r\n else {\r\n doCallback();\r\n }\r\n }\r\n }\r\n }\r\n });\r\n }, function () {\r\n doneIterating = true;\r\n doCallback();\r\n });\r\n return true;\r\n },\r\n _a._setQueue = function (queue) {\r\n channelQueue = queue;\r\n },\r\n _a);\r\n return channelController;\r\n}\r\nexport function createChannelQueues(channels, extensions, config, core) {\r\n var channelQueue = [];\r\n if (channels) {\r\n // Add and sort the configuration channel queues\r\n arrForEach(channels, function (queue) { return _addChannelQueue(channelQueue, queue, config, core); });\r\n }\r\n if (extensions) {\r\n // Create a new channel queue for any extensions with a priority > the ChannelControllerPriority\r\n var extensionQueue_1 = [];\r\n arrForEach(extensions, function (plugin) {\r\n if (plugin.priority > ChannelControllerPriority) {\r\n extensionQueue_1.push(plugin);\r\n }\r\n });\r\n _addChannelQueue(channelQueue, extensionQueue_1, config, core);\r\n }\r\n return channelQueue;\r\n}\r\n//# sourceMappingURL=ChannelController.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nimport { arrForEach } from \"./HelperFuncs\";\r\nexport function createUnloadHandlerContainer() {\r\n var handlers = [];\r\n function _addHandler(handler) {\r\n if (handler) {\r\n handlers.push(handler);\r\n }\r\n }\r\n function _runHandlers(unloadCtx, unloadState) {\r\n arrForEach(handlers, function (handler) {\r\n try {\r\n handler(unloadCtx, unloadState);\r\n }\r\n catch (e) {\r\n _throwInternal(unloadCtx.diagLog(), 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected error calling unload handler - \" + dumpObj(e));\r\n }\r\n });\r\n handlers = [];\r\n }\r\n return {\r\n add: _addHandler,\r\n run: _runHandlers\r\n };\r\n}\r\n//# sourceMappingURL=UnloadHandlerContainer.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext } from \"./ProcessTelemetryContext\";\r\nimport { arrForEach, isArray, isFunction, isNullOrUndefined, proxyFunctionAs, setValue } from \"./HelperFuncs\";\r\nimport { strExtensionConfig } from \"./Constants\";\r\nimport { createUnloadHandlerContainer } from \"./UnloadHandlerContainer\";\r\nimport { strDoTeardown, strIsInitialized, strSetNextPlugin } from \"./InternalConstants\";\r\nvar strGetPlugin = \"getPlugin\";\r\n/**\r\n * BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins\r\n * can avoid implementation the same set of boiler plate code as well as provide a base\r\n * implementation so that new default implementations can be added without breaking all plugins.\r\n */\r\nvar BaseTelemetryPlugin = /** @class */ (function () {\r\n function BaseTelemetryPlugin() {\r\n var _self = this; // Setting _self here as it's used outside of the dynamicProto as well\r\n // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()\r\n var _isinitialized;\r\n var _rootCtx; // Used as the root context, holding the current config and initialized core\r\n var _nextPlugin; // Used for backward compatibility where plugins don't call the main pipeline\r\n var _unloadHandlerContainer;\r\n var _hooks;\r\n _initDefaults();\r\n dynamicProto(BaseTelemetryPlugin, _self, function (_self) {\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n _setDefaults(config, core, pluginChain);\r\n _isinitialized = true;\r\n };\r\n _self.teardown = function (unloadCtx, unloadState) {\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self.core;\r\n if (!core || (unloadCtx && core !== unloadCtx.core())) {\r\n // Do Nothing as either the plugin is not initialized or was not initialized by the current core\r\n return;\r\n }\r\n var result;\r\n var unloadDone = false;\r\n var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUnloadState = unloadState || {\r\n reason: 0 /* TelemetryUnloadReason.ManualTeardown */,\r\n isAsync: false\r\n };\r\n function _unloadCallback() {\r\n if (!unloadDone) {\r\n unloadDone = true;\r\n _unloadHandlerContainer.run(theUnloadCtx, unloadState);\r\n // Remove all instrumentation hooks\r\n arrForEach(_hooks, function (fn) {\r\n fn.rm();\r\n });\r\n _hooks = [];\r\n if (result === true) {\r\n theUnloadCtx.processNext(theUnloadState);\r\n }\r\n _initDefaults();\r\n }\r\n }\r\n if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {\r\n _unloadCallback();\r\n }\r\n else {\r\n // Tell the caller that we will be calling processNext()\r\n result = true;\r\n }\r\n return result;\r\n };\r\n _self.update = function (updateCtx, updateState) {\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self.core;\r\n if (!core || (updateCtx && core !== updateCtx.core())) {\r\n // Do Nothing\r\n return;\r\n }\r\n var result;\r\n var updateDone = false;\r\n var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUpdateState = updateState || {\r\n reason: 0 /* TelemetryUpdateReason.Unknown */\r\n };\r\n function _updateCallback() {\r\n if (!updateDone) {\r\n updateDone = true;\r\n _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());\r\n }\r\n }\r\n if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {\r\n _updateCallback();\r\n }\r\n else {\r\n result = true;\r\n }\r\n return result;\r\n };\r\n _self._addHook = function (hooks) {\r\n if (hooks) {\r\n if (isArray(hooks)) {\r\n _hooks = _hooks.concat(hooks);\r\n }\r\n else {\r\n _hooks.push(hooks);\r\n }\r\n }\r\n };\r\n proxyFunctionAs(_self, \"_addUnloadCb\", function () { return _unloadHandlerContainer; }, \"add\");\r\n });\r\n // These are added after the dynamicProto so that are not moved to the prototype\r\n _self.diagLog = function (itemCtx) {\r\n return _getTelCtx(itemCtx).diagLog();\r\n };\r\n _self[strIsInitialized] = function () {\r\n return _isinitialized;\r\n };\r\n _self.setInitialized = function (isInitialized) {\r\n _isinitialized = isInitialized;\r\n };\r\n // _self.getNextPlugin = () => DO NOT IMPLEMENT\r\n // Sub-classes of this base class *should* not be relying on this value and instead\r\n // should use processNext() function. If you require access to the plugin use the\r\n // IProcessTelemetryContext.getNext().getPlugin() while in the pipeline, Note getNext() may return null.\r\n _self[strSetNextPlugin] = function (next) {\r\n _nextPlugin = next;\r\n };\r\n _self.processNext = function (env, itemCtx) {\r\n if (itemCtx) {\r\n // Normal core execution sequence\r\n itemCtx.processNext(env);\r\n }\r\n else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {\r\n // Looks like backward compatibility or out of band processing. And as it looks\r\n // like a ITelemetryPlugin or ITelemetryPluginChain, just call processTelemetry\r\n _nextPlugin.processTelemetry(env, null);\r\n }\r\n };\r\n _self._getTelCtx = _getTelCtx;\r\n function _getTelCtx(currentCtx) {\r\n if (currentCtx === void 0) { currentCtx = null; }\r\n var itemCtx = currentCtx;\r\n if (!itemCtx) {\r\n var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);\r\n // tslint:disable-next-line: prefer-conditional-expression\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // Looks like a chain object\r\n itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);\r\n }\r\n else {\r\n itemCtx = rootCtx.createNew(null, _nextPlugin);\r\n }\r\n }\r\n return itemCtx;\r\n }\r\n function _setDefaults(config, core, pluginChain) {\r\n if (config) {\r\n // Make sure the extensionConfig exists\r\n setValue(config, strExtensionConfig, [], null, isNullOrUndefined);\r\n }\r\n if (!pluginChain && core) {\r\n // Get the first plugin from the core\r\n pluginChain = core.getProcessTelContext().getNext();\r\n }\r\n var nextPlugin = _nextPlugin;\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // If it looks like a proxy/chain then get the plugin\r\n nextPlugin = _nextPlugin[strGetPlugin]();\r\n }\r\n // Support legacy plugins where core was defined as a property\r\n _self.core = core;\r\n _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);\r\n }\r\n function _initDefaults() {\r\n _isinitialized = false;\r\n _self.core = null;\r\n _rootCtx = null;\r\n _nextPlugin = null;\r\n _hooks = [];\r\n _unloadHandlerContainer = createUnloadHandlerContainer();\r\n }\r\n }\r\n// Removed Stub for BaseTelemetryPlugin.prototype.initialize.\r\n// Removed Stub for BaseTelemetryPlugin.prototype.teardown.\r\n// Removed Stub for BaseTelemetryPlugin.prototype.update.\r\n// Removed Stub for BaseTelemetryPlugin.prototype._addUnloadCb.\r\n// Removed Stub for BaseTelemetryPlugin.prototype._addHook.\r\n return BaseTelemetryPlugin;\r\n}());\r\nexport { BaseTelemetryPlugin };\r\n//# sourceMappingURL=BaseTelemetryPlugin.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nexport var strIKey = \"iKey\";\r\nexport var strExtensionConfig = \"extensionConfig\";\r\n//# sourceMappingURL=Constants.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n// \r\n// \r\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin } from \"./BaseTelemetryPlugin\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nimport { arrForEach, getExceptionName } from \"./HelperFuncs\";\r\nimport { strDoTeardown } from \"./InternalConstants\";\r\nvar TelemetryInitializerPlugin = /** @class */ (function (_super) {\r\n __extends(TelemetryInitializerPlugin, _super);\r\n function TelemetryInitializerPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"TelemetryInitializerPlugin\";\r\n _this.priority = 199;\r\n // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()\r\n var _id;\r\n var _initializers;\r\n _initDefaults();\r\n dynamicProto(TelemetryInitializerPlugin, _this, function (_self, _base) {\r\n _self.addTelemetryInitializer = function (telemetryInitializer) {\r\n var theInitializer = {\r\n id: _id++,\r\n fn: telemetryInitializer\r\n };\r\n _initializers.push(theInitializer);\r\n var handler = {\r\n remove: function () {\r\n arrForEach(_initializers, function (initializer, idx) {\r\n if (initializer.id === theInitializer.id) {\r\n _initializers.splice(idx, 1);\r\n return -1;\r\n }\r\n });\r\n }\r\n };\r\n return handler;\r\n };\r\n _self.processTelemetry = function (item, itemCtx) {\r\n var doNotSendItem = false;\r\n var telemetryInitializersCount = _initializers.length;\r\n for (var i = 0; i < telemetryInitializersCount; ++i) {\r\n var telemetryInitializer = _initializers[i];\r\n if (telemetryInitializer) {\r\n try {\r\n if (telemetryInitializer.fn.apply(null, [item]) === false) {\r\n doNotSendItem = true;\r\n break;\r\n }\r\n }\r\n catch (e) {\r\n // log error but dont stop executing rest of the telemetry initializers\r\n // doNotSendItem = true;\r\n _throwInternal(itemCtx.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 64 /* _eInternalMessageId.TelemetryInitializerFailed */, \"One of telemetry initializers failed, telemetry item will not be sent: \" + getExceptionName(e), { exception: dumpObj(e) }, true);\r\n }\r\n }\r\n }\r\n if (!doNotSendItem) {\r\n _self.processNext(item, itemCtx);\r\n }\r\n };\r\n _self[strDoTeardown] = function () {\r\n _initDefaults();\r\n };\r\n });\r\n function _initDefaults() {\r\n _id = 0;\r\n _initializers = [];\r\n }\r\n return _this;\r\n }\r\n// Removed Stub for TelemetryInitializerPlugin.prototype.addTelemetryInitializer.\r\n// Removed Stub for TelemetryInitializerPlugin.prototype.processTelemetry.\r\n return TelemetryInitializerPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { TelemetryInitializerPlugin };\r\n//# sourceMappingURL=TelemetryInitializerPlugin.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { __spreadArrayFn as __spreadArray } from \"@microsoft/applicationinsights-shims\";\r\nimport { objCreateFn } from \"@microsoft/applicationinsights-shims\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext, createTelemetryProxyChain } from \"./ProcessTelemetryContext\";\r\nimport { createDistributedTraceContext, initializePlugins, sortPlugins, _getPluginState } from \"./TelemetryHelpers\";\r\nimport { getGblPerfMgr, PerfManager } from \"./PerfManager\";\r\nimport { createCookieMgr } from \"./CookieMgr\";\r\nimport { arrForEach, isNullOrUndefined, getSetValue, setValue, isNotTruthy, isFunction, objExtend, objFreeze, proxyFunctionAs, proxyFunctions, throwError, toISOString, arrIndexOf } from \"./HelperFuncs\";\r\nimport { strExtensionConfig, strIKey } from \"./Constants\";\r\nimport { DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole } from \"./DiagnosticLogger\";\r\nimport { getDebugListener } from \"./DbgExtensionUtils\";\r\nimport { ChannelControllerPriority, createChannelControllerPlugin, createChannelQueues } from \"./ChannelController\";\r\nimport { TelemetryInitializerPlugin } from \"./TelemetryInitializerPlugin\";\r\nimport { createUniqueNamespace } from \"./DataCacheHelper\";\r\nimport { createUnloadHandlerContainer } from \"./UnloadHandlerContainer\";\r\nimport { strAddNotificationListener, strDisabled, strEventsDiscarded, strEventsSendRequest, strEventsSent, strRemoveNotificationListener, strTeardown } from \"./InternalConstants\";\r\nvar strValidationError = \"Plugins must provide initialize method\";\r\nvar strNotificationManager = \"_notificationManager\";\r\nvar strSdkUnloadingError = \"SDK is still unloading...\";\r\nvar strSdkNotInitialized = \"SDK is not initialized\";\r\n// const strPluginUnloadFailed = \"Failed to unload plugin\";\r\nvar defaultInitConfig = {\r\n // Have the Diagnostic Logger default to log critical errors to the console\r\n loggingLevelConsole: 1 /* eLoggingSeverity.CRITICAL */\r\n};\r\n/**\r\n * Helper to create the default performance manager\r\n * @param core\r\n * @param notificationMgr\r\n */\r\nfunction _createPerfManager(core, notificationMgr) {\r\n return new PerfManager(notificationMgr);\r\n}\r\nfunction _validateExtensions(logger, channelPriority, allExtensions) {\r\n // Concat all available extensions\r\n var coreExtensions = [];\r\n // Check if any two extensions have the same priority, then warn to console\r\n // And extract the local extensions from the\r\n var extPriorities = {};\r\n // Extension validation\r\n arrForEach(allExtensions, function (ext) {\r\n if (isNullOrUndefined(ext) || isNullOrUndefined(ext.initialize)) {\r\n throwError(strValidationError);\r\n }\r\n var extPriority = ext.priority;\r\n var identifier = ext.identifier;\r\n if (ext && extPriority) {\r\n if (!isNullOrUndefined(extPriorities[extPriority])) {\r\n _warnToConsole(logger, \"Two extensions have same priority #\" + extPriority + \" - \" + extPriorities[extPriority] + \", \" + identifier);\r\n }\r\n else {\r\n // set a value\r\n extPriorities[extPriority] = identifier;\r\n }\r\n }\r\n // Split extensions to core and channelController\r\n if (!extPriority || extPriority < channelPriority) {\r\n // Add to core extension that will be managed by BaseCore\r\n coreExtensions.push(ext);\r\n }\r\n });\r\n return {\r\n all: allExtensions,\r\n core: coreExtensions\r\n };\r\n}\r\nfunction _isPluginPresent(thePlugin, plugins) {\r\n var exists = false;\r\n arrForEach(plugins, function (plugin) {\r\n if (plugin === thePlugin) {\r\n exists = true;\r\n return -1;\r\n }\r\n });\r\n return exists;\r\n}\r\nfunction _createDummyNotificationManager() {\r\n var _a;\r\n return objCreateFn((_a = {},\r\n _a[strAddNotificationListener] = function (listener) { },\r\n _a[strRemoveNotificationListener] = function (listener) { },\r\n _a[strEventsSent] = function (events) { },\r\n _a[strEventsDiscarded] = function (events, reason) { },\r\n _a[strEventsSendRequest] = function (sendReason, isAsync) { },\r\n _a));\r\n}\r\nvar BaseCore = /** @class */ (function () {\r\n function BaseCore() {\r\n // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()\r\n var _isInitialized;\r\n var _eventQueue;\r\n var _notificationManager;\r\n var _perfManager;\r\n var _cfgPerfManager;\r\n var _cookieManager;\r\n var _pluginChain;\r\n var _configExtensions;\r\n var _coreExtensions;\r\n var _channelControl;\r\n var _channelConfig;\r\n var _channelQueue;\r\n var _isUnloading;\r\n var _telemetryInitializerPlugin;\r\n var _internalLogsEventName;\r\n var _evtNamespace;\r\n var _unloadHandlers;\r\n var _debugListener;\r\n var _traceCtx;\r\n /**\r\n * Internal log poller\r\n */\r\n var _internalLogPoller = 0;\r\n dynamicProto(BaseCore, this, function (_self) {\r\n // Set the default values (also called during teardown)\r\n _initDefaults();\r\n _self.isInitialized = function () { return _isInitialized; };\r\n _self.initialize = function (config, extensions, logger, notificationManager) {\r\n if (_isUnloading) {\r\n throwError(strSdkUnloadingError);\r\n }\r\n // Make sure core is only initialized once\r\n if (_self.isInitialized()) {\r\n throwError(\"Core should not be initialized more than once\");\r\n }\r\n if (!config || isNullOrUndefined(config.instrumentationKey)) {\r\n throwError(\"Please provide instrumentation key\");\r\n }\r\n _notificationManager = notificationManager;\r\n // For backward compatibility only\r\n _self[strNotificationManager] = notificationManager;\r\n _self.config = config || {};\r\n _initDebugListener(config);\r\n _initPerfManager(config);\r\n config.extensions = isNullOrUndefined(config.extensions) ? [] : config.extensions;\r\n // add notification to the extensions in the config so other plugins can access it\r\n _initExtConfig(config);\r\n if (logger) {\r\n _self.logger = logger;\r\n }\r\n // Extension validation\r\n _configExtensions = [];\r\n _configExtensions.push.apply(_configExtensions, __spreadArray(__spreadArray([], extensions, false), config.extensions, false));\r\n _channelConfig = (config || {}).channels;\r\n _initPluginChain(config, null);\r\n if (!_channelQueue || _channelQueue.length === 0) {\r\n throwError(\"No channels available\");\r\n }\r\n _isInitialized = true;\r\n _self.releaseQueue();\r\n };\r\n _self.getTransmissionControls = function () {\r\n var controls = [];\r\n if (_channelQueue) {\r\n arrForEach(_channelQueue, function (channels) {\r\n controls.push(channels.queue);\r\n });\r\n }\r\n return objFreeze(controls);\r\n };\r\n _self.track = function (telemetryItem) {\r\n // setup default iKey if not passed in\r\n setValue(telemetryItem, strIKey, _self.config.instrumentationKey, null, isNotTruthy);\r\n // add default timestamp if not passed in\r\n setValue(telemetryItem, \"time\", toISOString(new Date()), null, isNotTruthy);\r\n // Common Schema 4.0\r\n setValue(telemetryItem, \"ver\", \"4.0\", null, isNullOrUndefined);\r\n if (!_isUnloading && _self.isInitialized()) {\r\n // Process the telemetry plugin chain\r\n _createTelCtx().processNext(telemetryItem);\r\n }\r\n else {\r\n // Queue events until all extensions are initialized\r\n _eventQueue.push(telemetryItem);\r\n }\r\n };\r\n _self.getProcessTelContext = _createTelCtx;\r\n _self.getNotifyMgr = function () {\r\n if (!_notificationManager) {\r\n // Create Dummy notification manager\r\n _notificationManager = _createDummyNotificationManager();\r\n // For backward compatibility only\r\n _self[strNotificationManager] = _notificationManager;\r\n }\r\n return _notificationManager;\r\n };\r\n /**\r\n * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.\r\n * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be\r\n * called.\r\n * @param {INotificationListener} listener - An INotificationListener object.\r\n */\r\n _self[strAddNotificationListener] = function (listener) {\r\n if (_notificationManager) {\r\n _notificationManager[strAddNotificationListener](listener);\r\n }\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - INotificationListener to remove.\r\n */\r\n _self[strRemoveNotificationListener] = function (listener) {\r\n if (_notificationManager) {\r\n _notificationManager[strRemoveNotificationListener](listener);\r\n }\r\n };\r\n _self.getCookieMgr = function () {\r\n if (!_cookieManager) {\r\n _cookieManager = createCookieMgr(_self.config, _self.logger);\r\n }\r\n return _cookieManager;\r\n };\r\n _self.setCookieMgr = function (cookieMgr) {\r\n _cookieManager = cookieMgr;\r\n };\r\n _self.getPerfMgr = function () {\r\n if (!_perfManager && !_cfgPerfManager) {\r\n if (_self.config && _self.config.enablePerfMgr && isFunction(_self.config.createPerfMgr)) {\r\n _cfgPerfManager = _self.config.createPerfMgr(_self, _self.getNotifyMgr());\r\n }\r\n }\r\n return _perfManager || _cfgPerfManager || getGblPerfMgr();\r\n };\r\n _self.setPerfMgr = function (perfMgr) {\r\n _perfManager = perfMgr;\r\n };\r\n _self.eventCnt = function () {\r\n return _eventQueue.length;\r\n };\r\n _self.releaseQueue = function () {\r\n if (_isInitialized && _eventQueue.length > 0) {\r\n var eventQueue = _eventQueue;\r\n _eventQueue = [];\r\n arrForEach(eventQueue, function (event) {\r\n _createTelCtx().processNext(event);\r\n });\r\n }\r\n };\r\n /**\r\n * Periodically check logger.queue for log messages to be flushed\r\n */\r\n _self.pollInternalLogs = function (eventName) {\r\n _internalLogsEventName = eventName || null;\r\n var interval = _self.config.diagnosticLogInterval;\r\n if (!interval || !(interval > 0)) {\r\n interval = 10000;\r\n }\r\n if (_internalLogPoller) {\r\n clearInterval(_internalLogPoller);\r\n }\r\n _internalLogPoller = setInterval(function () {\r\n _flushInternalLogs();\r\n }, interval);\r\n return _internalLogPoller;\r\n };\r\n /**\r\n * Stop polling log messages from logger.queue\r\n */\r\n _self.stopPollingInternalLogs = function () {\r\n if (_internalLogPoller) {\r\n clearInterval(_internalLogPoller);\r\n _internalLogPoller = 0;\r\n _flushInternalLogs();\r\n }\r\n };\r\n // Add addTelemetryInitializer\r\n proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, [\"addTelemetryInitializer\"]);\r\n _self.unload = function (isAsync, unloadComplete, cbTimeout) {\r\n if (isAsync === void 0) { isAsync = true; }\r\n if (!_isInitialized) {\r\n // The SDK is not initialized\r\n throwError(strSdkNotInitialized);\r\n }\r\n // Check if the SDK still unloading so throw\r\n if (_isUnloading) {\r\n // The SDK is already unloading\r\n throwError(strSdkUnloadingError);\r\n }\r\n var unloadState = {\r\n reason: 50 /* TelemetryUnloadReason.SdkUnload */,\r\n isAsync: isAsync,\r\n flushComplete: false\r\n };\r\n var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self);\r\n processUnloadCtx.onComplete(function () {\r\n _initDefaults();\r\n unloadComplete && unloadComplete(unloadState);\r\n }, _self);\r\n function _doUnload(flushComplete) {\r\n unloadState.flushComplete = flushComplete;\r\n _isUnloading = true;\r\n // Run all of the unload handlers first (before unloading the plugins)\r\n _unloadHandlers.run(processUnloadCtx, unloadState);\r\n // Stop polling the internal logs\r\n _self.stopPollingInternalLogs();\r\n // Start unloading the components, from this point onwards the SDK should be considered to be in an unstable state\r\n processUnloadCtx.processNext(unloadState);\r\n }\r\n if (!_flushChannels(isAsync, _doUnload, 6 /* SendRequestReason.SdkUnload */, cbTimeout)) {\r\n _doUnload(false);\r\n }\r\n };\r\n _self.getPlugin = _getPlugin;\r\n _self.addPlugin = function (plugin, replaceExisting, isAsync, addCb) {\r\n if (!plugin) {\r\n addCb && addCb(false);\r\n _logOrThrowError(strValidationError);\r\n return;\r\n }\r\n var existingPlugin = _getPlugin(plugin.identifier);\r\n if (existingPlugin && !replaceExisting) {\r\n addCb && addCb(false);\r\n _logOrThrowError(\"Plugin [\" + plugin.identifier + \"] is already loaded!\");\r\n return;\r\n }\r\n var updateState = {\r\n reason: 16 /* TelemetryUpdateReason.PluginAdded */\r\n };\r\n function _addPlugin(removed) {\r\n _configExtensions.push(plugin);\r\n updateState.added = [plugin];\r\n // Re-Initialize the plugin chain\r\n _initPluginChain(_self.config, updateState);\r\n addCb && addCb(true);\r\n }\r\n if (existingPlugin) {\r\n var removedPlugins_1 = [existingPlugin.plugin];\r\n var unloadState = {\r\n reason: 2 /* TelemetryUnloadReason.PluginReplace */,\r\n isAsync: !!isAsync\r\n };\r\n _removePlugins(removedPlugins_1, unloadState, function (removed) {\r\n if (!removed) {\r\n // Previous plugin was successfully removed or was not installed\r\n addCb && addCb(false);\r\n }\r\n else {\r\n updateState.removed = removedPlugins_1;\r\n updateState.reason |= 32 /* TelemetryUpdateReason.PluginRemoved */;\r\n _addPlugin(true);\r\n }\r\n });\r\n }\r\n else {\r\n _addPlugin(false);\r\n }\r\n };\r\n _self.evtNamespace = function () {\r\n return _evtNamespace;\r\n };\r\n _self.flush = _flushChannels;\r\n _self.getTraceCtx = function (createNew) {\r\n if (!_traceCtx) {\r\n _traceCtx = createDistributedTraceContext();\r\n }\r\n return _traceCtx;\r\n };\r\n _self.setTraceCtx = function (traceCtx) {\r\n _traceCtx = traceCtx || null;\r\n };\r\n // Create the addUnloadCb\r\n proxyFunctionAs(_self, \"addUnloadCb\", function () { return _unloadHandlers; }, \"add\");\r\n function _initDefaults() {\r\n _isInitialized = false;\r\n // Use a default logger so initialization errors are not dropped on the floor with full logging\r\n _self.config = objExtend(true, {}, defaultInitConfig);\r\n _self.logger = new DiagnosticLogger(_self.config);\r\n _self._extensions = [];\r\n _telemetryInitializerPlugin = new TelemetryInitializerPlugin();\r\n _eventQueue = [];\r\n _notificationManager = null;\r\n _perfManager = null;\r\n _cfgPerfManager = null;\r\n _cookieManager = null;\r\n _pluginChain = null;\r\n _coreExtensions = null;\r\n _configExtensions = [];\r\n _channelControl = null;\r\n _channelConfig = null;\r\n _channelQueue = null;\r\n _isUnloading = false;\r\n _internalLogsEventName = null;\r\n _evtNamespace = createUniqueNamespace(\"AIBaseCore\", true);\r\n _unloadHandlers = createUnloadHandlerContainer();\r\n _traceCtx = null;\r\n }\r\n function _createTelCtx() {\r\n return createProcessTelemetryContext(_getPluginChain(), _self.config, _self);\r\n }\r\n // Initialize or Re-initialize the plugins\r\n function _initPluginChain(config, updateState) {\r\n // Extension validation\r\n var theExtensions = _validateExtensions(_self.logger, ChannelControllerPriority, _configExtensions);\r\n _coreExtensions = theExtensions.core;\r\n _pluginChain = null;\r\n // Sort the complete set of extensions by priority\r\n var allExtensions = theExtensions.all;\r\n // Initialize the Channel Queues and the channel plugins first\r\n _channelQueue = objFreeze(createChannelQueues(_channelConfig, allExtensions, config, _self));\r\n if (_channelControl) {\r\n // During add / remove of a plugin this may get called again, so don't re-add if already present\r\n // But we also want the controller as the last, so remove if already present\r\n // And reusing the existing instance, just in case an installed plugin has a reference and\r\n // is using it.\r\n var idx = arrIndexOf(allExtensions, _channelControl);\r\n if (idx !== -1) {\r\n allExtensions.splice(idx, 1);\r\n }\r\n idx = arrIndexOf(_coreExtensions, _channelControl);\r\n if (idx !== -1) {\r\n _coreExtensions.splice(idx, 1);\r\n }\r\n _channelControl._setQueue(_channelQueue);\r\n }\r\n else {\r\n _channelControl = createChannelControllerPlugin(_channelQueue, _self);\r\n }\r\n // Add on \"channelController\" as the last \"plugin\"\r\n allExtensions.push(_channelControl);\r\n _coreExtensions.push(_channelControl);\r\n // Required to allow plugins to call core.getPlugin() during their own initialization\r\n _self._extensions = sortPlugins(allExtensions);\r\n // Initialize the controls\r\n _channelControl.initialize(config, _self, allExtensions);\r\n initializePlugins(_createTelCtx(), allExtensions);\r\n // Now reset the extensions to just those being managed by Basecore\r\n _self._extensions = objFreeze(sortPlugins(_coreExtensions || [])).slice();\r\n if (updateState) {\r\n _doUpdate(updateState);\r\n }\r\n }\r\n function _getPlugin(pluginIdentifier) {\r\n var theExt = null;\r\n var thePlugin = null;\r\n arrForEach(_self._extensions, function (ext) {\r\n if (ext.identifier === pluginIdentifier && ext !== _channelControl && ext !== _telemetryInitializerPlugin) {\r\n thePlugin = ext;\r\n return -1;\r\n }\r\n });\r\n if (!thePlugin && _channelControl) {\r\n // Check the channel Controller\r\n thePlugin = _channelControl.getChannel(pluginIdentifier);\r\n }\r\n if (thePlugin) {\r\n theExt = {\r\n plugin: thePlugin,\r\n setEnabled: function (enabled) {\r\n _getPluginState(thePlugin)[strDisabled] = !enabled;\r\n },\r\n isEnabled: function () {\r\n var pluginState = _getPluginState(thePlugin);\r\n return !pluginState[strTeardown] && !pluginState[strDisabled];\r\n },\r\n remove: function (isAsync, removeCb) {\r\n if (isAsync === void 0) { isAsync = true; }\r\n var pluginsToRemove = [thePlugin];\r\n var unloadState = {\r\n reason: 1 /* TelemetryUnloadReason.PluginUnload */,\r\n isAsync: isAsync\r\n };\r\n _removePlugins(pluginsToRemove, unloadState, function (removed) {\r\n if (removed) {\r\n // Re-Initialize the plugin chain\r\n _initPluginChain(_self.config, {\r\n reason: 32 /* TelemetryUpdateReason.PluginRemoved */,\r\n removed: pluginsToRemove\r\n });\r\n }\r\n removeCb && removeCb(removed);\r\n });\r\n }\r\n };\r\n }\r\n return theExt;\r\n }\r\n function _getPluginChain() {\r\n if (!_pluginChain) {\r\n // copy the collection of extensions\r\n var extensions = (_coreExtensions || []).slice();\r\n // During add / remove this may get called again, so don't readd if already present\r\n if (arrIndexOf(extensions, _telemetryInitializerPlugin) === -1) {\r\n extensions.push(_telemetryInitializerPlugin);\r\n }\r\n _pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _self.config, _self);\r\n }\r\n return _pluginChain;\r\n }\r\n function _removePlugins(thePlugins, unloadState, removeComplete) {\r\n if (thePlugins && thePlugins.length > 0) {\r\n var unloadChain = createTelemetryProxyChain(thePlugins, _self.config, _self);\r\n var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self);\r\n unloadCtx.onComplete(function () {\r\n var removed = false;\r\n // Remove the listed config extensions\r\n var newConfigExtensions = [];\r\n arrForEach(_configExtensions, function (plugin, idx) {\r\n if (!_isPluginPresent(plugin, thePlugins)) {\r\n newConfigExtensions.push(plugin);\r\n }\r\n else {\r\n removed = true;\r\n }\r\n });\r\n _configExtensions = newConfigExtensions;\r\n // Re-Create the channel config\r\n var newChannelConfig = [];\r\n if (_channelConfig) {\r\n arrForEach(_channelConfig, function (queue, idx) {\r\n var newQueue = [];\r\n arrForEach(queue, function (channel) {\r\n if (!_isPluginPresent(channel, thePlugins)) {\r\n newQueue.push(channel);\r\n }\r\n else {\r\n removed = true;\r\n }\r\n });\r\n newChannelConfig.push(newQueue);\r\n });\r\n _channelConfig = newChannelConfig;\r\n }\r\n removeComplete && removeComplete(removed);\r\n });\r\n unloadCtx.processNext(unloadState);\r\n }\r\n else {\r\n removeComplete(false);\r\n }\r\n }\r\n function _flushInternalLogs() {\r\n var queue = _self.logger ? _self.logger.queue : [];\r\n if (queue) {\r\n arrForEach(queue, function (logMessage) {\r\n var item = {\r\n name: _internalLogsEventName ? _internalLogsEventName : \"InternalMessageId: \" + logMessage.messageId,\r\n iKey: _self.config.instrumentationKey,\r\n time: toISOString(new Date()),\r\n baseType: _InternalLogMessage.dataType,\r\n baseData: { message: logMessage.message }\r\n };\r\n _self.track(item);\r\n });\r\n queue.length = 0;\r\n }\r\n }\r\n function _flushChannels(isAsync, callBack, sendReason, cbTimeout) {\r\n if (_channelControl) {\r\n return _channelControl.flush(isAsync, callBack, sendReason || 6 /* SendRequestReason.SdkUnload */, cbTimeout);\r\n }\r\n callBack && callBack(false);\r\n return true;\r\n }\r\n function _initDebugListener(config) {\r\n if (config.disableDbgExt === true && _debugListener) {\r\n // Remove any previously loaded debug listener\r\n _notificationManager[strRemoveNotificationListener](_debugListener);\r\n _debugListener = null;\r\n }\r\n if (_notificationManager && !_debugListener && config.disableDbgExt !== true) {\r\n _debugListener = getDebugListener(config);\r\n _notificationManager[strAddNotificationListener](_debugListener);\r\n }\r\n }\r\n function _initPerfManager(config) {\r\n if (!config.enablePerfMgr && _cfgPerfManager) {\r\n // Remove any existing config based performance manager\r\n _cfgPerfManager = null;\r\n }\r\n if (config.enablePerfMgr) {\r\n // Set the performance manager creation function if not defined\r\n setValue(_self.config, \"createPerfMgr\", _createPerfManager);\r\n }\r\n }\r\n function _initExtConfig(config) {\r\n var extConfig = getSetValue(config, strExtensionConfig);\r\n extConfig.NotificationManager = _notificationManager;\r\n }\r\n function _doUpdate(updateState) {\r\n var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self);\r\n if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {\r\n updateCtx.processNext(updateState);\r\n }\r\n }\r\n function _logOrThrowError(message) {\r\n var logger = _self.logger;\r\n if (logger) {\r\n // there should always be a logger\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, message);\r\n }\r\n else {\r\n throwError(message);\r\n }\r\n }\r\n });\r\n }\r\n// Removed Stub for BaseCore.prototype.initialize.\r\n// Removed Stub for BaseCore.prototype.getTransmissionControls.\r\n// Removed Stub for BaseCore.prototype.track.\r\n// Removed Stub for BaseCore.prototype.getProcessTelContext.\r\n// Removed Stub for BaseCore.prototype.getNotifyMgr.\r\n// Removed Stub for BaseCore.prototype.addNotificationListener.\r\n// Removed Stub for BaseCore.prototype.removeNotificationListener.\r\n// Removed Stub for BaseCore.prototype.getCookieMgr.\r\n// Removed Stub for BaseCore.prototype.setCookieMgr.\r\n// Removed Stub for BaseCore.prototype.getPerfMgr.\r\n// Removed Stub for BaseCore.prototype.setPerfMgr.\r\n// Removed Stub for BaseCore.prototype.eventCnt.\r\n// Removed Stub for BaseCore.prototype.pollInternalLogs.\r\n// Removed Stub for BaseCore.prototype.stopPollingInternalLogs.\r\n// Removed Stub for BaseCore.prototype.addTelemetryInitializer.\r\n// Removed Stub for BaseCore.prototype.unload.\r\n// Removed Stub for BaseCore.prototype.getPlugin.\r\n// Removed Stub for BaseCore.prototype.addPlugin.\r\n// Removed Stub for BaseCore.prototype.evtNamespace.\r\n// Removed Stub for BaseCore.prototype.addUnloadCb.\r\n// Removed Stub for BaseCore.prototype.flush.\r\n// Removed Stub for BaseCore.prototype.getTraceCtx.\r\n// Removed Stub for BaseCore.prototype.setTraceCtx.\r\n// Removed Stub for BaseCore.prototype.releaseQueue.\r\n// Removed Stub for BaseCore.prototype._updateHook.\r\n return BaseCore;\r\n}());\r\nexport { BaseCore };\r\n//# sourceMappingURL=BaseCore.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrForEach, arrIndexOf } from \"./HelperFuncs\";\r\nimport { strAddNotificationListener, strEventsDiscarded, strEventsSendRequest, strEventsSent, strPerfEvent, strRemoveNotificationListener } from \"./InternalConstants\";\r\nfunction _runListeners(listeners, name, isAsync, callback) {\r\n arrForEach(listeners, function (listener) {\r\n if (listener && listener[name]) {\r\n if (isAsync) {\r\n setTimeout(function () { return callback(listener); }, 0);\r\n }\r\n else {\r\n try {\r\n callback(listener);\r\n }\r\n catch (e) {\r\n // Catch errors to ensure we don't block sending the requests\r\n }\r\n }\r\n }\r\n });\r\n}\r\n/**\r\n * Class to manage sending notifications to all the listeners.\r\n */\r\nvar NotificationManager = /** @class */ (function () {\r\n function NotificationManager(config) {\r\n this.listeners = [];\r\n var perfEvtsSendAll = !!(config || {}).perfEvtsSendAll;\r\n dynamicProto(NotificationManager, this, function (_self) {\r\n _self[strAddNotificationListener] = function (listener) {\r\n _self.listeners.push(listener);\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param {INotificationListener} listener - AWTNotificationListener to remove.\r\n */\r\n _self[strRemoveNotificationListener] = function (listener) {\r\n var index = arrIndexOf(_self.listeners, listener);\r\n while (index > -1) {\r\n _self.listeners.splice(index, 1);\r\n index = arrIndexOf(_self.listeners, listener);\r\n }\r\n };\r\n /**\r\n * Notification for events sent.\r\n * @param {ITelemetryItem[]} events - The array of events that have been sent.\r\n */\r\n _self[strEventsSent] = function (events) {\r\n _runListeners(_self.listeners, strEventsSent, true, function (listener) {\r\n listener[strEventsSent](events);\r\n });\r\n };\r\n /**\r\n * Notification for events being discarded.\r\n * @param {ITelemetryItem[]} events - The array of events that have been discarded by the SDK.\r\n * @param {number} reason - The reason for which the SDK discarded the events. The EventsDiscardedReason\r\n * constant should be used to check the different values.\r\n */\r\n _self[strEventsDiscarded] = function (events, reason) {\r\n _runListeners(_self.listeners, strEventsDiscarded, true, function (listener) {\r\n listener[strEventsDiscarded](events, reason);\r\n });\r\n };\r\n /**\r\n * [Optional] A function called when the events have been requested to be sent to the sever.\r\n * @param {number} sendReason - The reason why the event batch is being sent.\r\n * @param {boolean} isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.\r\n */\r\n _self[strEventsSendRequest] = function (sendReason, isAsync) {\r\n _runListeners(_self.listeners, strEventsSendRequest, isAsync, function (listener) {\r\n listener[strEventsSendRequest](sendReason, isAsync);\r\n });\r\n };\r\n _self[strPerfEvent] = function (perfEvent) {\r\n if (perfEvent) {\r\n // Send all events or only parent events\r\n if (perfEvtsSendAll || !perfEvent.isChildEvt()) {\r\n _runListeners(_self.listeners, strPerfEvent, false, function (listener) {\r\n if (perfEvent.isAsync) {\r\n setTimeout(function () { return listener[strPerfEvent](perfEvent); }, 0);\r\n }\r\n else {\r\n listener[strPerfEvent](perfEvent);\r\n }\r\n });\r\n }\r\n }\r\n };\r\n });\r\n }\r\n// Removed Stub for NotificationManager.prototype.addNotificationListener.\r\n// Removed Stub for NotificationManager.prototype.removeNotificationListener.\r\n// Removed Stub for NotificationManager.prototype.eventsSent.\r\n// Removed Stub for NotificationManager.prototype.eventsDiscarded.\r\n// Removed Stub for NotificationManager.prototype.eventsSendRequest.\r\n return NotificationManager;\r\n}());\r\nexport { NotificationManager };\r\n//# sourceMappingURL=NotificationManager.js.map","/*\n * 1DS JS SDK Core, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nvar _a;\r\n/**\r\n * Utils.ts\r\n * @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n * @copyright Microsoft 2018\r\n * File containing utility functions.\r\n */\r\nimport { objCreateFn, strShimObject } from \"@microsoft/applicationinsights-shims\";\r\nimport { getDocument, getNavigator, getWindow, getGlobalInst, objForEachKey, isUndefined, isNullOrUndefined, isNumber, isReactNative, isString, isBoolean, isArray, newGuid, isObject, perfNow, hasOwnProperty, addEventHandler, uaDisallowsSameSiteNone, strPrototype, objDefineAccessors, toISOString, strTrim, isFunction, objKeys, arrReduce, arrMap, arrIndexOf, arrForEach, strUndefined, strObject, areCookiesSupported, safeGetCookieMgr, generateW3CId, mwcRandom32, mwcRandomSeed, random32, randomValue, newId, isIE, dateNow, isError, isDate, isTypeof, strEndsWith, useXDomainRequest, isBeaconsSupported, addPageUnloadEventListener, } from \"@microsoft/applicationinsights-core-js\";\r\nexport var Version = '3.2.3';\r\nexport var FullVersionString = \"1DS-Web-JS-\" + Version;\r\n// Defining here so we don't need to take (import) the ApplicationInsights Common module\r\nvar strDisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nvar strWithCredentials = \"withCredentials\";\r\nvar strTimeout = \"timeout\";\r\n// If value is array just get the type for the first element\r\nvar _fieldTypeEventPropMap = (_a = {},\r\n _a[0 /* FieldValueSanitizerType.NotSet */] = 0 /* eEventPropertyType.Unspecified */,\r\n _a[2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a);\r\n/**\r\n * @ignore\r\n */\r\n// let _uaDisallowsSameSiteNone = null;\r\nvar uInt8ArraySupported = null;\r\n// var _areCookiesAvailable: boolean | undefined;\r\n/**\r\n * Checks if document object is available\r\n */\r\nexport var isDocumentObjectAvailable = Boolean(getDocument());\r\n/**\r\n * Checks if window object is available\r\n */\r\nexport var isWindowObjectAvailable = Boolean(getWindow());\r\n/**\r\n * Checks if value is assigned to the given param.\r\n * @param value - The token from which the tenant id is to be extracted.\r\n * @returns True/false denoting if value is assigned to the param.\r\n */\r\nexport function isValueAssigned(value) {\r\n /// takes a value and checks for undefined, null and empty string \r\n /// value to be tested \r\n /// true if value is null undefined or emptyString \r\n return !(value === \"\" || isNullOrUndefined(value));\r\n}\r\n/**\r\n * Gets the tenant id from the tenant token.\r\n * @param apiKey - The token from which the tenant id is to be extracted.\r\n * @returns The tenant id.\r\n */\r\nexport function getTenantId(apiKey) {\r\n if (apiKey) {\r\n var indexTenantId = apiKey.indexOf(\"-\");\r\n if (indexTenantId > -1) {\r\n return apiKey.substring(0, indexTenantId);\r\n }\r\n }\r\n return \"\";\r\n}\r\n/**\r\n * Checks if Uint8Array are available in the current environment. Safari and Firefox along with\r\n * ReactNative are known to not support Uint8Array properly.\r\n * @returns True if available, false otherwise.\r\n */\r\nexport function isUint8ArrayAvailable() {\r\n if (uInt8ArraySupported === null) {\r\n uInt8ArraySupported = !isUndefined(Uint8Array) && !isSafariOrFirefox() && !isReactNative();\r\n }\r\n return uInt8ArraySupported;\r\n}\r\n/**\r\n * Checks if the value is a valid EventLatency.\r\n * @param value - The value that needs to be checked.\r\n * @returns True if the value is in AWTEventLatency, false otherwise.\r\n */\r\nexport function isLatency(value) {\r\n if (value && isNumber(value) && value >= 1 /* EventLatencyValue.Normal */ && value <= 4 /* EventLatencyValue.Immediate */) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Sanitizes the Property. It checks the that the property name and value are valid. It also\r\n * checks/populates the correct type and pii of the property value.\r\n * @param name - property name - The property name.\r\n * @param property - The property value or an IEventProperty containing value,\r\n * type ,pii and customer content.\r\n * @returns IEventProperty containing valid name, value, pii and type or null if invalid.\r\n */\r\nexport function sanitizeProperty(name, property, stringifyObjects) {\r\n // Check that property is valid\r\n if ((!property && !isValueAssigned(property)) || typeof name !== \"string\") {\r\n return null;\r\n }\r\n // Perf optimization -- only need to get the type once not multiple times\r\n var propType = typeof property;\r\n // If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.\r\n if (propType === \"string\" || propType === \"number\" || propType === \"boolean\" || isArray(property)) {\r\n property = { value: property };\r\n }\r\n else if (propType === \"object\" && !property.hasOwnProperty(\"value\")) {\r\n property = { value: stringifyObjects ? JSON.stringify(property) : property };\r\n }\r\n else if (isNullOrUndefined(property.value)\r\n || property.value === \"\" || (!isString(property.value)\r\n && !isNumber(property.value) && !isBoolean(property.value)\r\n && !isArray(property.value))) {\r\n // Since property is IEventProperty, we need to validate its value\r\n return null;\r\n }\r\n // We need to check that if the property value is an array, it is valid\r\n if (isArray(property.value) &&\r\n !isArrayValid(property.value)) {\r\n return null;\r\n }\r\n // If either pii or cc is set convert value to string (since only string pii/cc is allowed).\r\n // If the value is a complex type like an array that can't be converted to string we will drop\r\n // the property.\r\n if (!isNullOrUndefined(property.kind)) {\r\n if (isArray(property.value) || !isValueKind(property.kind)) {\r\n return null;\r\n }\r\n property.value = property.value.toString();\r\n }\r\n return property;\r\n}\r\nexport function getCommonSchemaMetaData(value, kind, type) {\r\n var encodedTypeValue = -1;\r\n if (!isUndefined(value)) {\r\n if (kind > 0) {\r\n if (kind === 32) {\r\n // encode customer content. Value can only be string. bit 13-16 are for cc\r\n encodedTypeValue = (1 << 13);\r\n }\r\n else if (kind <= 13) {\r\n // encode PII. Value can only be string. bits 5-12 are for Pii\r\n encodedTypeValue = (kind << 5);\r\n }\r\n }\r\n // isDataType checks that the \"type\" is a number so we don't need to check for undefined\r\n if (isDataType(type)) {\r\n // Data Type is provided and valid, so use that\r\n if (encodedTypeValue === -1) {\r\n // Don't return -1\r\n encodedTypeValue = 0;\r\n }\r\n encodedTypeValue |= type;\r\n }\r\n else {\r\n var propType = _fieldTypeEventPropMap[getFieldValueType(value)] || -1;\r\n if (encodedTypeValue !== -1 && propType !== -1) {\r\n // pii exists so we must return correct type\r\n encodedTypeValue |= propType;\r\n }\r\n else if (propType === 6 /* eEventPropertyType.Double */) {\r\n encodedTypeValue = propType;\r\n }\r\n }\r\n }\r\n return encodedTypeValue;\r\n}\r\n/**\r\n * @deprecated - Use the core.getCookieMgr().disable()\r\n * Force the SDK not to store and read any data from cookies.\r\n * Overriding the applicationinsights-core version for tree-shaking\r\n */\r\nexport function disableCookies() {\r\n safeGetCookieMgr(null).setEnabled(false);\r\n}\r\n/**\r\n * @deprecated - Use the oneDs.getCookieMgr().set()\r\n * Sets the value of a cookie.\r\n * @param name - Cookie name.\r\n * @param value - Cookie value.\r\n * @param days - Expiration days.\r\n */\r\nexport function setCookie(name, value, days) {\r\n if (areCookiesSupported(null)) {\r\n safeGetCookieMgr(null).set(name, value, days * 86400, null, \"/\");\r\n }\r\n}\r\n/**\r\n * @deprecated - Use the oneDs.getCookieMgr().del()\r\n * Deletes a cookie, by setting its expiration to -1.\r\n * @param name - Cookie name to delete.\r\n */\r\nexport function deleteCookie(name) {\r\n if (areCookiesSupported(null)) {\r\n safeGetCookieMgr(null).del(name);\r\n }\r\n}\r\n/**\r\n * @deprecated - Use the oneDs.getCookieMgr().get()\r\n * Gets the cookie value for the specified cookie.\r\n * if value is k1=v1&k2==v2 then will return 'v1' for key 'k1'\r\n * @param cookieName - Cookie name.\r\n */\r\nexport function getCookie(name) {\r\n if (areCookiesSupported(null)) {\r\n return getCookieValue(safeGetCookieMgr(null), name);\r\n }\r\n return \"\";\r\n}\r\n/**\r\n * Helper to get and decode the cookie value using decodeURIComponent, this is for historical\r\n * backward compatibility where the document.cookie value was decoded before parsing.\r\n * @param cookieMgr - The cookie manager to use\r\n * @param name - The name of the cookie to get\r\n * @param decode - A flag to indicate whether the cookie value should be decoded\r\n * @returns The decoded cookie value (if available) otherwise an empty string.\r\n */\r\nexport function getCookieValue(cookieMgr, name, decode) {\r\n if (decode === void 0) { decode = true; }\r\n var cookieValue;\r\n if (cookieMgr) {\r\n cookieValue = cookieMgr.get(name);\r\n if (decode && cookieValue && decodeURIComponent) {\r\n cookieValue = decodeURIComponent(cookieValue);\r\n }\r\n }\r\n return cookieValue || \"\";\r\n}\r\n/**\r\n * Create a new guid.\r\n * @param style - The style of guid to generated, defaults to Digits\r\n * Digits (Default) : 32 digits separated by hyphens: 00000000-0000-0000-0000-000000000000\r\n * Braces - 32 digits separated by hyphens, enclosed in braces: {00000000-0000-0000-0000-000000000000}\r\n * Parentheses - 32 digits separated by hyphens, enclosed in parentheses: (00000000-0000-0000-0000-000000000000)\r\n * Numeric - 32 digits: 00000000000000000000000000000000\r\n * @returns The formatted guid.\r\n */\r\nexport function createGuid(style) {\r\n if (style === void 0) { style = \"D\" /* GuidStyle.Digits */; }\r\n var theGuid = newGuid();\r\n if (style === \"B\" /* GuidStyle.Braces */) {\r\n theGuid = \"{\" + theGuid + \"}\";\r\n }\r\n else if (style === \"P\" /* GuidStyle.Parentheses */) {\r\n theGuid = \"(\" + theGuid + \")\";\r\n }\r\n else if (style === \"N\" /* GuidStyle.Numeric */) {\r\n theGuid = theGuid.replace(/-/g, \"\");\r\n }\r\n return theGuid;\r\n}\r\n/**\r\n * Pass in the objects to merge as arguments.\r\n * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.\r\n * @param obj2 - object to merge.\r\n * @param obj3 - object to merge.\r\n * @param obj4 - object to merge.\r\n * @param obj5 - object to merge.\r\n * @returns The extended object.\r\n */\r\nexport function extend(obj, obj2, obj3, obj4, obj5) {\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n var length = arguments.length;\r\n var objProto = Object[strPrototype];\r\n var theArgs = arguments;\r\n // Check if a deep merge\r\n if (objProto.toString.call(theArgs[0]) === \"[object Boolean]\") {\r\n deep = theArgs[0];\r\n i++;\r\n }\r\n // Loop through each object and conduct a merge\r\n for (; i < length; i++) {\r\n var obj = theArgs[i];\r\n objForEachKey(obj, function (prop, value) {\r\n // If deep merge and property is an object, merge properties\r\n if (deep && value && isObject(value)) {\r\n if (isArray(value)) {\r\n extended[prop] = extended[prop] || [];\r\n arrForEach(value, function (arrayValue, arrayIndex) {\r\n if (arrayValue && isObject(arrayValue)) {\r\n extended[prop][arrayIndex] = extend(true, extended[prop][arrayIndex], arrayValue);\r\n }\r\n else {\r\n extended[prop][arrayIndex] = arrayValue;\r\n }\r\n });\r\n }\r\n else {\r\n extended[prop] = extend(true, extended[prop], value);\r\n }\r\n }\r\n else {\r\n extended[prop] = value;\r\n }\r\n });\r\n }\r\n return extended;\r\n}\r\nexport var getTime = perfNow;\r\nexport function isValueKind(value) {\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value === 0 /* eValueKind.NotSet */ || ((value > 0 /* eValueKind.NotSet */ && value <= 13 /* eValueKind.Pii_IPV4AddressLegacy */) || value === 32 /* eValueKind.CustomerContent_GenericContent */)) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isDataType(value) {\r\n // Remark: 0 returns false, but it doesn't affect encoding anyways\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value >= 0 && value <= 9) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isSafariOrFirefox() {\r\n var nav = getNavigator();\r\n // If non-browser navigator will be undefined\r\n if (!isUndefined(nav) && nav.userAgent) {\r\n var ua = nav.userAgent.toLowerCase();\r\n if ((ua.indexOf(\"safari\") >= 0 || ua.indexOf(\"firefox\") >= 0) && ua.indexOf(\"chrome\") < 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nexport function isArrayValid(value) {\r\n return value.length > 0;\r\n}\r\nexport function setProcessTelemetryTimings(event, identifier) {\r\n var evt = event;\r\n evt.timings = evt.timings || {};\r\n evt.timings.processTelemetryStart = evt.timings.processTelemetryStart || {};\r\n evt.timings.processTelemetryStart[identifier] = getTime();\r\n}\r\n/**\r\n * Returns a bitwise value for the FieldValueSanitizerType enum representing the decoded type of the passed value\r\n * @param value The value to determine the type\r\n */\r\nexport function getFieldValueType(value) {\r\n var theType = 0 /* FieldValueSanitizerType.NotSet */;\r\n if (value !== null && value !== undefined) {\r\n var objType = typeof value;\r\n if (objType === \"string\") {\r\n theType = 1 /* FieldValueSanitizerType.String */;\r\n }\r\n else if (objType === \"number\") {\r\n theType = 2 /* FieldValueSanitizerType.Number */;\r\n }\r\n else if (objType === \"boolean\") {\r\n theType = 3 /* FieldValueSanitizerType.Boolean */;\r\n }\r\n else if (objType === strShimObject) {\r\n theType = 4 /* FieldValueSanitizerType.Object */;\r\n if (isArray(value)) {\r\n theType = 4096 /* FieldValueSanitizerType.Array */;\r\n if (value.length > 0) {\r\n // Empty arrays are not supported and are considered to be the same as null\r\n theType |= getFieldValueType(value[0]);\r\n }\r\n }\r\n else if (hasOwnProperty(value, \"value\")) {\r\n // Looks like an IEventProperty\r\n theType = 8192 /* FieldValueSanitizerType.EventProperty */ | getFieldValueType(value.value);\r\n }\r\n }\r\n }\r\n return theType;\r\n}\r\nexport var Utils = {\r\n Version: Version,\r\n FullVersionString: FullVersionString,\r\n strUndefined: strUndefined,\r\n strObject: strObject,\r\n Undefined: strUndefined,\r\n arrForEach: arrForEach,\r\n arrIndexOf: arrIndexOf,\r\n arrMap: arrMap,\r\n arrReduce: arrReduce,\r\n objKeys: objKeys,\r\n toISOString: toISOString,\r\n isReactNative: isReactNative,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isBoolean: isBoolean,\r\n isFunction: isFunction,\r\n isArray: isArray,\r\n isObject: isObject,\r\n strTrim: strTrim,\r\n isDocumentObjectAvailable: isDocumentObjectAvailable,\r\n isWindowObjectAvailable: isWindowObjectAvailable,\r\n isValueAssigned: isValueAssigned,\r\n getTenantId: getTenantId,\r\n isBeaconsSupported: isBeaconsSupported,\r\n isUint8ArrayAvailable: isUint8ArrayAvailable,\r\n isLatency: isLatency,\r\n sanitizeProperty: sanitizeProperty,\r\n getISOString: toISOString,\r\n useXDomainRequest: useXDomainRequest,\r\n getCommonSchemaMetaData: getCommonSchemaMetaData,\r\n cookieAvailable: areCookiesSupported,\r\n disallowsSameSiteNone: uaDisallowsSameSiteNone,\r\n setCookie: setCookie,\r\n deleteCookie: deleteCookie,\r\n getCookie: getCookie,\r\n createGuid: createGuid,\r\n extend: extend,\r\n getTime: getTime,\r\n isValueKind: isValueKind,\r\n isArrayValid: isArrayValid,\r\n objDefineAccessors: objDefineAccessors,\r\n addPageUnloadEventListener: addPageUnloadEventListener,\r\n setProcessTelemetryTimings: setProcessTelemetryTimings,\r\n addEventHandler: addEventHandler,\r\n getFieldValueType: getFieldValueType,\r\n strEndsWith: strEndsWith,\r\n objForEachKey: objForEachKey\r\n};\r\n/**\r\n * Provides a collection of utility functions, included for backward compatibility with previous releases.\r\n * @deprecated Marking this instance as deprecated in favor of direct usage of the helper functions\r\n * as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items\r\n * in your resulting code.\r\n * Overriding the applicationinsights-core version for tree-shaking\r\n */\r\nexport var CoreUtils = {\r\n _canUseCookies: undefined,\r\n isTypeof: isTypeof,\r\n isUndefined: isUndefined,\r\n isNullOrUndefined: isNullOrUndefined,\r\n hasOwnProperty: hasOwnProperty,\r\n isFunction: isFunction,\r\n isObject: isObject,\r\n isDate: isDate,\r\n isArray: isArray,\r\n isError: isError,\r\n isString: isString,\r\n isNumber: isNumber,\r\n isBoolean: isBoolean,\r\n toISOString: toISOString,\r\n arrForEach: arrForEach,\r\n arrIndexOf: arrIndexOf,\r\n arrMap: arrMap,\r\n arrReduce: arrReduce,\r\n strTrim: strTrim,\r\n objCreate: objCreateFn,\r\n objKeys: objKeys,\r\n objDefineAccessors: objDefineAccessors,\r\n addEventHandler: addEventHandler,\r\n dateNow: dateNow,\r\n isIE: isIE,\r\n disableCookies: disableCookies,\r\n newGuid: newGuid,\r\n perfNow: perfNow,\r\n newId: newId,\r\n randomValue: randomValue,\r\n random32: random32,\r\n mwcRandomSeed: mwcRandomSeed,\r\n mwcRandom32: mwcRandom32,\r\n generateW3CId: generateW3CId\r\n};\r\n/**\r\n * Helper to identify whether we are running in a chromium based browser environment\r\n */\r\nexport function isChromium() {\r\n return !!getGlobalInst(\"chrome\");\r\n}\r\n/**\r\n * Create and open an XMLHttpRequest object\r\n * @param method - The request method\r\n * @param urlString - The url\r\n * @param withCredentials - Option flag indicating that credentials should be sent\r\n * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)\r\n * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)\r\n * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request\r\n * @returns A new opened XHR request\r\n */\r\nexport function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {\r\n if (disabled === void 0) { disabled = false; }\r\n if (isSync === void 0) { isSync = false; }\r\n function _wrapSetXhrProp(xhr, prop, value) {\r\n try {\r\n xhr[prop] = value;\r\n }\r\n catch (e) {\r\n // - Wrapping as depending on the environment setting the property may fail (non-terminally)\r\n }\r\n }\r\n var xhr = new XMLHttpRequest();\r\n if (disabled) {\r\n // Tag the instance so it's not tracked (trackDependency)\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);\r\n }\r\n if (withCredentials) {\r\n // Some libraries require that the withCredentials flag is set \"before\" open and\r\n // - Wrapping as IE 10 has started throwing when setting before open\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n xhr.open(method, urlString, !isSync);\r\n if (withCredentials) {\r\n // withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)\r\n // And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n // Only set the timeout for asynchronous requests as\r\n // \"Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.\"\"\r\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\r\n if (!isSync && timeout) {\r\n _wrapSetXhrProp(xhr, strTimeout, timeout);\r\n }\r\n return xhr;\r\n}\r\n//# sourceMappingURL=Utils.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\nimport { BaseCore } from \"./BaseCore\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { DiagnosticLogger } from \"./DiagnosticLogger\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isNullOrUndefined, throwError } from \"./HelperFuncs\";\r\nvar AppInsightsCore = /** @class */ (function (_super) {\r\n __extends(AppInsightsCore, _super);\r\n function AppInsightsCore() {\r\n var _this = _super.call(this) || this;\r\n dynamicProto(AppInsightsCore, _this, function (_self, _base) {\r\n _self.initialize = function (config, extensions, logger, notificationManager) {\r\n _base.initialize(config, extensions, logger || new DiagnosticLogger(config), notificationManager || new NotificationManager(config));\r\n };\r\n _self.track = function (telemetryItem) {\r\n doPerf(_self.getPerfMgr(), function () { return \"AppInsightsCore:track\"; }, function () {\r\n if (telemetryItem === null) {\r\n _notifyInvalidEvent(telemetryItem);\r\n // throw error\r\n throwError(\"Invalid telemetry item\");\r\n }\r\n // do basic validation before sending it through the pipeline\r\n _validateTelemetryItem(telemetryItem);\r\n _base.track(telemetryItem);\r\n }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));\r\n };\r\n function _validateTelemetryItem(telemetryItem) {\r\n if (isNullOrUndefined(telemetryItem.name)) {\r\n _notifyInvalidEvent(telemetryItem);\r\n throwError(\"telemetry name required\");\r\n }\r\n }\r\n function _notifyInvalidEvent(telemetryItem) {\r\n var manager = _self.getNotifyMgr();\r\n if (manager) {\r\n manager.eventsDiscarded([telemetryItem], 2 /* eEventsDiscardedReason.InvalidEvent */);\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n// Removed Stub for AppInsightsCore.prototype.initialize.\r\n// Removed Stub for AppInsightsCore.prototype.track.\r\n return AppInsightsCore;\r\n}(BaseCore));\r\nexport { AppInsightsCore };\r\n//# sourceMappingURL=AppInsightsCore.js.map","/*!\n * Microsoft Dynamic Proto Utility, 1.1.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Constructor = 'constructor';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Prototype = 'prototype';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strFunction = 'function';\r\n/**\r\n * Used to define the name of the instance function lookup table\r\n * @ignore\r\n */\r\nvar DynInstFuncTable = '_dynInstFuncs';\r\n/**\r\n * Name used to tag the dynamic prototype function\r\n * @ignore\r\n */\r\nvar DynProxyTag = '_isDynProxy';\r\n/**\r\n * Name added to a prototype to define the dynamic prototype \"class\" name used to lookup the function table\r\n * @ignore\r\n */\r\nvar DynClassName = '_dynClass';\r\n/**\r\n * Prefix added to the classname to avoid any name clashes with other instance level properties\r\n * @ignore\r\n */\r\nvar DynClassNamePrefix = '_dynCls$';\r\n/**\r\n * A tag which is used to check if we have already to attempted to set the instance function if one is not present\r\n * @ignore\r\n */\r\nvar DynInstChkTag = '_dynInstChk';\r\n/**\r\n * A tag which is used to check if we are allows to try and set an instance function is one is not present. Using the same\r\n * tag name as the function level but a different const name for readability only.\r\n */\r\nvar DynAllowInstChkTag = DynInstChkTag;\r\n/**\r\n * The global (imported) instances where the global performance options are stored\r\n */\r\nvar DynProtoDefaultOptions = '_dfOpts';\r\n/**\r\n * Value used as the name of a class when it cannot be determined\r\n * @ignore\r\n */\r\nvar UnknownValue = '_unknown_';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * The polyfill version of __proto__ so that it doesn't cause issues for anyone not expecting it to exist\r\n */\r\nvar DynProtoBaseProto = \"_dyn\" + str__Proto;\r\n/**\r\n * Track the current prototype for IE8 as you can't look back to get the prototype\r\n */\r\nvar DynProtoCurrent = \"_dynInstProto\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strUseBaseInst = 'useBaseInst';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strSetInstFuncs = 'setInstFuncs';\r\nvar Obj = Object;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Obj[\"getPrototypeOf\"];\r\n/**\r\n * Pre-lookup to check for the existence of this function\r\n */\r\nvar _objGetOwnProps = Obj[\"getOwnPropertyNames\"];\r\n/**\r\n * Internal Global used to generate a unique dynamic class name, every new class will increase this value\r\n * @ignore\r\n */\r\nvar _dynamicNames = 0;\r\n/**\r\n * Helper to check if the object contains a property of the name\r\n * @ignore\r\n */\r\nfunction _hasOwnProperty(obj, prop) {\r\n return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype or Array prototype\r\n * @ignore\r\n */\r\nfunction _isObjectOrArrayPrototype(target) {\r\n return target && (target === Obj[Prototype] || target === Array[Prototype]);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype, Array prototype or Function prototype\r\n * @ignore\r\n */\r\nfunction _isObjectArrayOrFunctionPrototype(target) {\r\n return _isObjectOrArrayPrototype(target) || target === Function[Prototype];\r\n}\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n var newProto;\r\n if (target) {\r\n // This method doesn't exist in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);\r\n // Using the pre-calculated value as IE8 doesn't support looking up the prototype of a prototype and thus fails for more than 1 base class\r\n newProto = target[DynProtoBaseProto] || curProto;\r\n if (!_hasOwnProperty(target, DynProtoBaseProto)) {\r\n // As this prototype doesn't have this property then this is from an inherited class so newProto is the base to return so save it\r\n // so we can look it up value (which for a multiple hierarchy dynamicProto will be the base class)\r\n delete target[DynProtoCurrent]; // Delete any current value allocated to this instance so we pick up the value from prototype hierarchy\r\n newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];\r\n target[DynProtoCurrent] = curProto;\r\n }\r\n }\r\n return newProto;\r\n}\r\n/**\r\n * Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6\r\n * are not enumerable.\r\n * @param target\r\n */\r\nfunction _forEachProp(target, func) {\r\n var props = [];\r\n if (_objGetOwnProps) {\r\n props = _objGetOwnProps(target);\r\n }\r\n else {\r\n for (var name_1 in target) {\r\n if (typeof name_1 === \"string\" && _hasOwnProperty(target, name_1)) {\r\n props.push(name_1);\r\n }\r\n }\r\n }\r\n if (props && props.length > 0) {\r\n for (var lp = 0; lp < props.length; lp++) {\r\n func(props[lp]);\r\n }\r\n }\r\n}\r\n/**\r\n * Helper function to check whether the provided function name is a potential candidate for dynamic\r\n * callback and prototype generation.\r\n * @param target The target object, may be a prototype or class object\r\n * @param funcName The function name\r\n * @param skipOwn Skips the check for own property\r\n * @ignore\r\n */\r\nfunction _isDynamicCandidate(target, funcName, skipOwn) {\r\n return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));\r\n}\r\n/**\r\n * Helper to throw a TypeError exception\r\n * @param message the message\r\n * @ignore\r\n */\r\nfunction _throwTypeError(message) {\r\n throw new TypeError(\"DynamicProto: \" + message);\r\n}\r\n/**\r\n * Returns a collection of the instance functions that are defined directly on the thisTarget object, it does\r\n * not return any inherited functions\r\n * @param thisTarget The object to get the instance functions from\r\n * @ignore\r\n */\r\nfunction _getInstanceFuncs(thisTarget) {\r\n // Get the base proto\r\n var instFuncs = {};\r\n // Save any existing instance functions\r\n _forEachProp(thisTarget, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {\r\n // Create an instance callback for passing the base function to the caller\r\n instFuncs[name] = thisTarget[name];\r\n }\r\n });\r\n return instFuncs;\r\n}\r\n/**\r\n * Returns whether the value is included in the array\r\n * @param values The array of values\r\n * @param value The value\r\n */\r\nfunction _hasVisited(values, value) {\r\n for (var lp = values.length - 1; lp >= 0; lp--) {\r\n if (values[lp] === value) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Returns an object that contains callback functions for all \"base/super\" functions, this is used to \"save\"\r\n * enabling calling super.xxx() functions without requiring that the base \"class\" has defined a prototype references\r\n * @param target The current instance\r\n * @ignore\r\n */\r\nfunction _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {\r\n function _instFuncProxy(target, funcHost, funcName) {\r\n var theFunc = funcHost[funcName];\r\n if (theFunc[DynProxyTag] && useBaseInst) {\r\n // grab and reuse the hosted looking function (if available) otherwise the original passed function\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;\r\n }\r\n }\r\n return function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n return theFunc.apply(target, arguments);\r\n };\r\n }\r\n // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced)\r\n var baseFuncs = {};\r\n _forEachProp(instFuncs, function (name) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);\r\n });\r\n // Get the base prototype functions\r\n var baseProto = _getObjProto(classProto);\r\n var visited = [];\r\n // Don't include base object functions for Object, Array or Function\r\n while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {\r\n // look for prototype functions\r\n _forEachProp(baseProto, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the \r\n // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return\r\n // the Object prototype methods while bypassing the check\r\n if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);\r\n }\r\n });\r\n // We need to find all possible functions that might be overloaded by walking the entire prototype chain\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(baseProto);\r\n baseProto = _getObjProto(baseProto);\r\n }\r\n return baseFuncs;\r\n}\r\nfunction _getInstFunc(target, funcName, proto, currentDynProtoProxy) {\r\n var instFunc = null;\r\n // We need to check whether the class name is defined directly on this prototype otherwise\r\n // it will walk the proto chain and return any parent proto classname.\r\n if (target && _hasOwnProperty(proto, DynClassName)) {\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];\r\n if (!instFunc) {\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\r\n // We have the instance function, lets check it we can speed up further calls\r\n // by adding the instance function back directly on the instance (avoiding the dynamic func lookup)\r\n if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {\r\n // If the instance already has an instance function we can't replace it\r\n var canAddInst = !_hasOwnProperty(target, funcName);\r\n // Get current prototype\r\n var objProto = _getObjProto(target);\r\n var visited = [];\r\n // Lookup the function starting at the top (instance level prototype) and traverse down, if the first matching function\r\n // if nothing is found or if the first hit is a dynamic proto instance then we can safely add an instance shortcut\r\n while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {\r\n var protoFunc = objProto[funcName];\r\n if (protoFunc) {\r\n canAddInst = (protoFunc === currentDynProtoProxy);\r\n break;\r\n }\r\n // We need to find all possible initial functions to ensure that we don't bypass a valid override function\r\n visited.push(objProto);\r\n objProto = _getObjProto(objProto);\r\n }\r\n try {\r\n if (canAddInst) {\r\n // This instance doesn't have an instance func and the class hierarchy does have a higher level prototype version\r\n // so it's safe to directly assign for any subsequent calls (for better performance)\r\n target[funcName] = instFunc;\r\n }\r\n // Block further attempts to set the instance function for any\r\n instFunc[DynInstChkTag] = 1;\r\n }\r\n catch (e) {\r\n // Don't crash if the object is readonly or the runtime doesn't allow changing this\r\n // And set a flag so we don't try again for any function\r\n instFuncTable[DynAllowInstChkTag] = false;\r\n }\r\n }\r\n }\r\n return instFunc;\r\n}\r\nfunction _getProtoFunc(funcName, proto, currentDynProtoProxy) {\r\n var protoFunc = proto[funcName];\r\n // Check that the prototype function is not a self reference -- try to avoid stack overflow!\r\n if (protoFunc === currentDynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (typeof protoFunc !== strFunction) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc;\r\n}\r\n/**\r\n * Add the required dynamic prototype methods to the the class prototype\r\n * @param proto - The class prototype\r\n * @param className - The instance classname\r\n * @param target - The target instance\r\n * @param baseInstFuncs - The base instance functions\r\n * @param setInstanceFunc - Flag to allow prototype function to reset the instance function if one does not exist\r\n * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n // Use the instance or prototype function\r\n var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);\r\n // eslint-disable-next-line prefer-rest-params\r\n return instFunc.apply(this, arguments);\r\n };\r\n // Tag this function as a proxy to support replacing dynamic proxy elements (primary use case is for unit testing\r\n // via which can dynamically replace the prototype function reference)\r\n dynProtoProxy[DynProxyTag] = 1;\r\n return dynProtoProxy;\r\n }\r\n if (!_isObjectOrArrayPrototype(proto)) {\r\n var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};\r\n var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {}); // fetch and assign if as it may not exist yet\r\n // Set whether we are allow to lookup instances, if someone has set to false then do not re-enable\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;\r\n }\r\n _forEachProp(target, function (name) {\r\n // Only add overridden functions\r\n if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {\r\n // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function\r\n instFuncs_1[name] = target[name];\r\n delete target[name];\r\n // Add a dynamic proto if one doesn't exist or if a prototype function exists and it's not a dynamic one\r\n if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {\r\n proto[name] = _createDynamicPrototype(proto, name);\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Checks whether the passed prototype object appears to be correct by walking the prototype hierarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whether the passed prototype instance is in the hierarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n // As this is primarily a coding time check, don't bother checking if running in IE8 or lower\r\n var visited = [];\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(thisProto);\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\r\n }\r\n // If objGetPrototypeOf doesn't exist then just assume everything is ok.\r\n return true;\r\n}\r\n/**\r\n * Gets the current prototype name using the ES6 name if available otherwise falling back to a use unknown as the name.\r\n * It's not critical for this to return a name, it's used to decorate the generated unique name for easier debugging only.\r\n * @param target\r\n * @param unknownValue\r\n * @ignore\r\n */\r\nfunction _getObjName(target, unknownValue) {\r\n if (_hasOwnProperty(target, Prototype)) {\r\n // Look like a prototype\r\n return target.name || unknownValue || UnknownValue;\r\n }\r\n return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;\r\n}\r\n/**\r\n * Helper function when creating dynamic (inline) functions for classes, this helper performs the following tasks :-\r\n * - Saves references to all defined base class functions\r\n * - Calls the delegateFunc with the current target (this) and a base object reference that can be used to call all \"super\" functions.\r\n * - Will populate the class prototype for all overridden functions to support class extension that call the prototype instance.\r\n * Callers should use this helper when declaring all function within the constructor of a class, as mentioned above the delegateFunc is\r\n * passed both the target \"this\" and an object that can be used to call any base (super) functions, using this based object in place of\r\n * super.XXX() (which gets expanded to _super.prototype.XXX()) provides a better minification outcome and also ensures the correct \"this\"\r\n * context is maintained as TypeScript creates incorrect references using super.XXXX() for dynamically defined functions i.e. Functions\r\n * defined in the constructor or some other function (rather than declared as complete typescript functions).\r\n * ### Usage\r\n * ```typescript\r\n * import dynamicProto from \"@microsoft/dynamicproto-js\";\r\n * class ExampleClass extends BaseClass {\r\n * constructor() {\r\n * dynamicProto(ExampleClass, this, (_self, base) => {\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.newFunc = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * ...\r\n * }\r\n * }\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.myFunction = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * // Call the base version of the function that we are overriding\r\n * base.myFunction();\r\n * }\r\n * ...\r\n * }\r\n * _self.initialize = () => {\r\n * ...\r\n * }\r\n * // Warnings: While the following will work as _self is simply a reference to\r\n * // this, if anyone overrides myFunction() the overridden will be called first\r\n * // as the normal JavaScript method resolution will occur and the defined\r\n * // _self.initialize() function is actually gets removed from the instance and\r\n * // a proxy prototype version is created to reference the created method.\r\n * _self.initialize();\r\n * });\r\n * }\r\n * }\r\n * ```\r\n * @typeparam DPType This is the generic type of the class, used to keep intellisense valid\r\n * @typeparam DPCls The type that contains the prototype of the current class\r\n * @param theClass - This is the current class instance which contains the prototype for the current class\r\n * @param target - The current \"this\" (target) reference, when the class has been extended this.prototype will not be the 'theClass' value.\r\n * @param delegateFunc - The callback function (closure) that will create the dynamic function\r\n * @param options - Additional options to configure how the dynamic prototype operates\r\n */\r\nfunction dynamicProto(theClass, target, delegateFunc, options) {\r\n // Make sure that the passed theClass argument looks correct\r\n if (!_hasOwnProperty(theClass, Prototype)) {\r\n _throwTypeError(\"theClass is an invalid class definition.\");\r\n }\r\n // Quick check to make sure that the passed theClass argument looks correct (this is a common copy/paste error)\r\n var classProto = theClass[Prototype];\r\n if (!_checkPrototype(classProto, target)) {\r\n _throwTypeError(\"[\" + _getObjName(theClass) + \"] is not in class hierarchy of [\" + _getObjName(target) + \"]\");\r\n }\r\n var className = null;\r\n if (_hasOwnProperty(classProto, DynClassName)) {\r\n // Only grab the class name if it's defined on this prototype (i.e. don't walk the prototype chain)\r\n className = classProto[DynClassName];\r\n }\r\n else {\r\n // As not all browser support name on the prototype creating a unique dynamic one if we have not already\r\n // assigned one, so we can use a simple string as the lookup rather than an object for the dynamic instance\r\n // function table lookup.\r\n className = DynClassNamePrefix + _getObjName(theClass, \"_\") + \"$\" + _dynamicNames;\r\n _dynamicNames++;\r\n classProto[DynClassName] = className;\r\n }\r\n var perfOptions = dynamicProto[DynProtoDefaultOptions];\r\n var useBaseInst = !!perfOptions[strUseBaseInst];\r\n if (useBaseInst && options && options[strUseBaseInst] !== undefined) {\r\n useBaseInst = !!options[strUseBaseInst];\r\n }\r\n // Get the current instance functions\r\n var instFuncs = _getInstanceFuncs(target);\r\n // Get all of the functions for any base instance (before they are potentially overridden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);\r\n // Execute the delegate passing in both the current target \"this\" and \"base\" function references\r\n // Note casting the same type as we don't actually have the base class here and this will provide some intellisense support\r\n delegateFunc(target, baseFuncs);\r\n // Don't allow setting instance functions for older IE instances\r\n var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];\r\n if (setInstanceFunc && options) {\r\n setInstanceFunc = !!options[strSetInstFuncs];\r\n }\r\n // Populate the Prototype for any overridden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);\r\n}\r\n/**\r\n * Exposes the default global options to allow global configuration, if the global values are disabled these will override\r\n * any passed values. This is primarily exposed to support unit-testing without the need for individual classes to expose\r\n * their internal usage of dynamic proto.\r\n */\r\nvar perfDefaults = {\r\n setInstFuncs: true,\r\n useBaseInst: true\r\n};\r\n// And expose for testing\r\ndynamicProto[DynProtoDefaultOptions] = perfDefaults;\n\nexport { dynamicProto as default };\n//# sourceMappingURL=dynamicproto-js.js.map\n","/*\n * 1DS JS SDK Core, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\n/**\r\n * AppInsightsCore.ts\r\n * @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n * @copyright Microsoft 2018\r\n */\r\nimport { AppInsightsCore as InternalCore, doPerf, arrForEach, dumpObj, DiagnosticLogger } from \"@microsoft/applicationinsights-core-js\";\r\nimport { isLatency, FullVersionString, getTime } from \"./Utils\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nvar PropVersion = \"version\";\r\nvar properties = \"properties\";\r\nvar AppInsightsCore = /** @class */ (function (_super) {\r\n __extends(AppInsightsCore, _super);\r\n function AppInsightsCore() {\r\n var _this = _super.call(this) || this;\r\n _this.pluginVersionStringArr = [];\r\n _this.pluginVersionString = \"\";\r\n dynamicProto(AppInsightsCore, _this, function (_self, _base) {\r\n if (!_self.logger || !_self.logger.queue) {\r\n // The AI Base can inject a No-Op logger so if not defined or the No-Op, change to use a default logger so initialization errors\r\n // are not dropped on the floor if one is not already defined\r\n _self.logger = new DiagnosticLogger({ loggingLevelConsole: 1 /* eLoggingSeverity.CRITICAL */ });\r\n }\r\n _self.initialize = function (config, extensions, logger, notificationManager) {\r\n doPerf(_self, function () { return \"AppInsightsCore.initialize\"; }, function () {\r\n // Add default collector url\r\n if (config) {\r\n if (!config.endpointUrl) {\r\n config.endpointUrl = \"https://browser.events.data.microsoft.com/OneCollector/1.0/\";\r\n }\r\n var propertyStorageOverride = config.propertyStorageOverride;\r\n // Validate property storage override\r\n if (propertyStorageOverride && (!propertyStorageOverride.getProperty || !propertyStorageOverride.setProperty)) {\r\n throw new Error(\"Invalid property storage override passed.\");\r\n }\r\n if (config.channels) {\r\n arrForEach(config.channels, function (channels) {\r\n if (channels) {\r\n arrForEach(channels, function (channel) {\r\n if (channel.identifier && channel.version) {\r\n var ver = channel.identifier + \"=\" + channel.version;\r\n _self.pluginVersionStringArr.push(ver);\r\n }\r\n });\r\n }\r\n });\r\n }\r\n }\r\n _self.getWParam = function () {\r\n return typeof document !== \"undefined\" ? 0 : -1;\r\n };\r\n if (extensions) {\r\n arrForEach(extensions, function (ext) {\r\n if (ext && ext.identifier && ext.version) {\r\n var ver = ext.identifier + \"=\" + ext.version;\r\n _self.pluginVersionStringArr.push(ver);\r\n }\r\n });\r\n }\r\n _self.pluginVersionString = _self.pluginVersionStringArr.join(\";\");\r\n try {\r\n _base.initialize(config, extensions, logger, notificationManager);\r\n _self.pollInternalLogs(\"InternalLog\");\r\n }\r\n catch (e) {\r\n var logger_1 = _self.logger;\r\n var message = dumpObj(e);\r\n if (message.indexOf(\"channels\") !== -1) {\r\n // Add some additional context to the underlying reported error\r\n message += \"\\n - Channels must be provided through config.channels only!\";\r\n }\r\n logger_1.throwInternal(1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, \"SDK Initialization Failed - no telemetry will be sent: \" + message);\r\n }\r\n }, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });\r\n };\r\n _self.track = function (item) {\r\n doPerf(_self, function () { return \"AppInsightsCore.track\"; }, function () {\r\n var telemetryItem = item;\r\n if (telemetryItem) {\r\n telemetryItem.timings = telemetryItem.timings || {};\r\n telemetryItem.timings.trackStart = getTime();\r\n if (!isLatency(telemetryItem.latency)) {\r\n telemetryItem.latency = 1 /* EventLatencyValue.Normal */;\r\n }\r\n var itemExt = telemetryItem.ext = telemetryItem.ext || {};\r\n itemExt.sdk = itemExt.sdk || {};\r\n itemExt.sdk.ver = FullVersionString;\r\n var baseData = telemetryItem.baseData = telemetryItem.baseData || {};\r\n if (!baseData[properties]) {\r\n baseData[properties] = {};\r\n }\r\n var itemProperties = baseData[properties];\r\n if (!itemProperties[PropVersion]) {\r\n itemProperties[PropVersion] = \"\";\r\n }\r\n if (_self.pluginVersionString !== \"\") {\r\n itemProperties[PropVersion] = _self.pluginVersionString;\r\n }\r\n }\r\n _base.track(telemetryItem);\r\n }, function () { return ({ item: item }); }, !(item.sync));\r\n };\r\n });\r\n return _this;\r\n }\r\n// Removed Stub for AppInsightsCore.prototype.initialize.\r\n// Removed Stub for AppInsightsCore.prototype.track.\r\n return AppInsightsCore;\r\n}(InternalCore));\r\nexport default AppInsightsCore;\r\n//# sourceMappingURL=AppInsightsCore.js.map","/*!\n * Microsoft Dynamic Proto Utility, 1.1.6\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Constructor = 'constructor';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Prototype = 'prototype';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strFunction = 'function';\r\n/**\r\n * Used to define the name of the instance function lookup table\r\n * @ignore\r\n */\r\nvar DynInstFuncTable = '_dynInstFuncs';\r\n/**\r\n * Name used to tag the dynamic prototype function\r\n * @ignore\r\n */\r\nvar DynProxyTag = '_isDynProxy';\r\n/**\r\n * Name added to a prototype to define the dynamic prototype \"class\" name used to lookup the function table\r\n * @ignore\r\n */\r\nvar DynClassName = '_dynClass';\r\n/**\r\n * Prefix added to the classname to avoid any name clashes with other instance level properties\r\n * @ignore\r\n */\r\nvar DynClassNamePrefix = '_dynCls$';\r\n/**\r\n * A tag which is used to check if we have already to attempted to set the instance function if one is not present\r\n * @ignore\r\n */\r\nvar DynInstChkTag = '_dynInstChk';\r\n/**\r\n * A tag which is used to check if we are allows to try and set an instance function is one is not present. Using the same\r\n * tag name as the function level but a different const name for readability only.\r\n */\r\nvar DynAllowInstChkTag = DynInstChkTag;\r\n/**\r\n * The global (imported) instances where the global performance options are stored\r\n */\r\nvar DynProtoDefaultOptions = '_dfOpts';\r\n/**\r\n * Value used as the name of a class when it cannot be determined\r\n * @ignore\r\n */\r\nvar UnknownValue = '_unknown_';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * The polyfill version of __proto__ so that it doesn't cause issues for anyone not expecting it to exist\r\n */\r\nvar DynProtoBaseProto = \"_dyn\" + str__Proto;\r\n/**\r\n * Track the current prototype for IE8 as you can't look back to get the prototype\r\n */\r\nvar DynProtoCurrent = \"_dynInstProto\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strUseBaseInst = 'useBaseInst';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strSetInstFuncs = 'setInstFuncs';\r\nvar Obj = Object;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Obj[\"getPrototypeOf\"];\r\n/**\r\n * Pre-lookup to check for the existence of this function\r\n */\r\nvar _objGetOwnProps = Obj[\"getOwnPropertyNames\"];\r\n/**\r\n * Internal Global used to generate a unique dynamic class name, every new class will increase this value\r\n * @ignore\r\n */\r\nvar _dynamicNames = 0;\r\n/**\r\n * Helper to check if the object contains a property of the name\r\n * @ignore\r\n */\r\nfunction _hasOwnProperty(obj, prop) {\r\n return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype or Array prototype\r\n * @ignore\r\n */\r\nfunction _isObjectOrArrayPrototype(target) {\r\n return target && (target === Obj[Prototype] || target === Array[Prototype]);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype, Array prototype or Function prototype\r\n * @ignore\r\n */\r\nfunction _isObjectArrayOrFunctionPrototype(target) {\r\n return _isObjectOrArrayPrototype(target) || target === Function[Prototype];\r\n}\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n var newProto;\r\n if (target) {\r\n // This method doesn't exist in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);\r\n // Using the pre-calculated value as IE8 doesn't support looking up the prototype of a prototype and thus fails for more than 1 base class\r\n newProto = target[DynProtoBaseProto] || curProto;\r\n if (!_hasOwnProperty(target, DynProtoBaseProto)) {\r\n // As this prototype doesn't have this property then this is from an inherited class so newProto is the base to return so save it\r\n // so we can look it up value (which for a multiple hierarchy dynamicProto will be the base class)\r\n delete target[DynProtoCurrent]; // Delete any current value allocated to this instance so we pick up the value from prototype hierarchy\r\n newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];\r\n target[DynProtoCurrent] = curProto;\r\n }\r\n }\r\n return newProto;\r\n}\r\n/**\r\n * Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6\r\n * are not enumerable.\r\n * @param target\r\n */\r\nfunction _forEachProp(target, func) {\r\n var props = [];\r\n if (_objGetOwnProps) {\r\n props = _objGetOwnProps(target);\r\n }\r\n else {\r\n for (var name_1 in target) {\r\n if (typeof name_1 === \"string\" && _hasOwnProperty(target, name_1)) {\r\n props.push(name_1);\r\n }\r\n }\r\n }\r\n if (props && props.length > 0) {\r\n for (var lp = 0; lp < props.length; lp++) {\r\n func(props[lp]);\r\n }\r\n }\r\n}\r\n/**\r\n * Helper function to check whether the provided function name is a potential candidate for dynamic\r\n * callback and prototype generation.\r\n * @param target The target object, may be a prototype or class object\r\n * @param funcName The function name\r\n * @param skipOwn Skips the check for own property\r\n * @ignore\r\n */\r\nfunction _isDynamicCandidate(target, funcName, skipOwn) {\r\n return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));\r\n}\r\n/**\r\n * Helper to throw a TypeError exception\r\n * @param message the message\r\n * @ignore\r\n */\r\nfunction _throwTypeError(message) {\r\n throw new TypeError(\"DynamicProto: \" + message);\r\n}\r\n/**\r\n * Returns a collection of the instance functions that are defined directly on the thisTarget object, it does\r\n * not return any inherited functions\r\n * @param thisTarget The object to get the instance functions from\r\n * @ignore\r\n */\r\nfunction _getInstanceFuncs(thisTarget) {\r\n // Get the base proto\r\n var instFuncs = {};\r\n // Save any existing instance functions\r\n _forEachProp(thisTarget, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {\r\n // Create an instance callback for passing the base function to the caller\r\n instFuncs[name] = thisTarget[name];\r\n }\r\n });\r\n return instFuncs;\r\n}\r\n/**\r\n * Returns whether the value is included in the array\r\n * @param values The array of values\r\n * @param value The value\r\n */\r\nfunction _hasVisited(values, value) {\r\n for (var lp = values.length - 1; lp >= 0; lp--) {\r\n if (values[lp] === value) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Returns an object that contains callback functions for all \"base/super\" functions, this is used to \"save\"\r\n * enabling calling super.xxx() functions without requiring that the base \"class\" has defined a prototype references\r\n * @param target The current instance\r\n * @ignore\r\n */\r\nfunction _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {\r\n function _instFuncProxy(target, funcHost, funcName) {\r\n var theFunc = funcHost[funcName];\r\n if (theFunc[DynProxyTag] && useBaseInst) {\r\n // grab and reuse the hosted looking function (if available) otherwise the original passed function\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;\r\n }\r\n }\r\n return function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n return theFunc.apply(target, arguments);\r\n };\r\n }\r\n // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced)\r\n var baseFuncs = {};\r\n _forEachProp(instFuncs, function (name) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);\r\n });\r\n // Get the base prototype functions\r\n var baseProto = _getObjProto(classProto);\r\n var visited = [];\r\n // Don't include base object functions for Object, Array or Function\r\n while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {\r\n // look for prototype functions\r\n _forEachProp(baseProto, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the \r\n // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return\r\n // the Object prototype methods while bypassing the check\r\n if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);\r\n }\r\n });\r\n // We need to find all possible functions that might be overloaded by walking the entire prototype chain\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(baseProto);\r\n baseProto = _getObjProto(baseProto);\r\n }\r\n return baseFuncs;\r\n}\r\nfunction _getInstFunc(target, funcName, proto, currentDynProtoProxy) {\r\n var instFunc = null;\r\n // We need to check whether the class name is defined directly on this prototype otherwise\r\n // it will walk the proto chain and return any parent proto classname.\r\n if (target && _hasOwnProperty(proto, DynClassName)) {\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];\r\n if (!instFunc) {\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\r\n // We have the instance function, lets check it we can speed up further calls\r\n // by adding the instance function back directly on the instance (avoiding the dynamic func lookup)\r\n if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {\r\n // If the instance already has an instance function we can't replace it\r\n var canAddInst = !_hasOwnProperty(target, funcName);\r\n // Get current prototype\r\n var objProto = _getObjProto(target);\r\n var visited = [];\r\n // Lookup the function starting at the top (instance level prototype) and traverse down, if the first matching function\r\n // if nothing is found or if the first hit is a dynamic proto instance then we can safely add an instance shortcut\r\n while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {\r\n var protoFunc = objProto[funcName];\r\n if (protoFunc) {\r\n canAddInst = (protoFunc === currentDynProtoProxy);\r\n break;\r\n }\r\n // We need to find all possible initial functions to ensure that we don't bypass a valid override function\r\n visited.push(objProto);\r\n objProto = _getObjProto(objProto);\r\n }\r\n try {\r\n if (canAddInst) {\r\n // This instance doesn't have an instance func and the class hierarchy does have a higher level prototype version\r\n // so it's safe to directly assign for any subsequent calls (for better performance)\r\n target[funcName] = instFunc;\r\n }\r\n // Block further attempts to set the instance function for any\r\n instFunc[DynInstChkTag] = 1;\r\n }\r\n catch (e) {\r\n // Don't crash if the object is readonly or the runtime doesn't allow changing this\r\n // And set a flag so we don't try again for any function\r\n instFuncTable[DynAllowInstChkTag] = false;\r\n }\r\n }\r\n }\r\n return instFunc;\r\n}\r\nfunction _getProtoFunc(funcName, proto, currentDynProtoProxy) {\r\n var protoFunc = proto[funcName];\r\n // Check that the prototype function is not a self reference -- try to avoid stack overflow!\r\n if (protoFunc === currentDynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (typeof protoFunc !== strFunction) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc;\r\n}\r\n/**\r\n * Add the required dynamic prototype methods to the the class prototype\r\n * @param proto - The class prototype\r\n * @param className - The instance classname\r\n * @param target - The target instance\r\n * @param baseInstFuncs - The base instance functions\r\n * @param setInstanceFunc - Flag to allow prototype function to reset the instance function if one does not exist\r\n * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n // Use the instance or prototype function\r\n var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);\r\n // eslint-disable-next-line prefer-rest-params\r\n return instFunc.apply(this, arguments);\r\n };\r\n // Tag this function as a proxy to support replacing dynamic proxy elements (primary use case is for unit testing\r\n // via which can dynamically replace the prototype function reference)\r\n dynProtoProxy[DynProxyTag] = 1;\r\n return dynProtoProxy;\r\n }\r\n if (!_isObjectOrArrayPrototype(proto)) {\r\n var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};\r\n var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {}); // fetch and assign if as it may not exist yet\r\n // Set whether we are allow to lookup instances, if someone has set to false then do not re-enable\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;\r\n }\r\n _forEachProp(target, function (name) {\r\n // Only add overridden functions\r\n if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {\r\n // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function\r\n instFuncs_1[name] = target[name];\r\n delete target[name];\r\n // Add a dynamic proto if one doesn't exist or if a prototype function exists and it's not a dynamic one\r\n if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {\r\n proto[name] = _createDynamicPrototype(proto, name);\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Checks whether the passed prototype object appears to be correct by walking the prototype hierarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whether the passed prototype instance is in the hierarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n // As this is primarily a coding time check, don't bother checking if running in IE8 or lower\r\n var visited = [];\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(thisProto);\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\r\n }\r\n // If objGetPrototypeOf doesn't exist then just assume everything is ok.\r\n return true;\r\n}\r\n/**\r\n * Gets the current prototype name using the ES6 name if available otherwise falling back to a use unknown as the name.\r\n * It's not critical for this to return a name, it's used to decorate the generated unique name for easier debugging only.\r\n * @param target\r\n * @param unknownValue\r\n * @ignore\r\n */\r\nfunction _getObjName(target, unknownValue) {\r\n if (_hasOwnProperty(target, Prototype)) {\r\n // Look like a prototype\r\n return target.name || unknownValue || UnknownValue;\r\n }\r\n return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;\r\n}\r\n/**\r\n * Helper function when creating dynamic (inline) functions for classes, this helper performs the following tasks :-\r\n * - Saves references to all defined base class functions\r\n * - Calls the delegateFunc with the current target (this) and a base object reference that can be used to call all \"super\" functions.\r\n * - Will populate the class prototype for all overridden functions to support class extension that call the prototype instance.\r\n * Callers should use this helper when declaring all function within the constructor of a class, as mentioned above the delegateFunc is\r\n * passed both the target \"this\" and an object that can be used to call any base (super) functions, using this based object in place of\r\n * super.XXX() (which gets expanded to _super.prototype.XXX()) provides a better minification outcome and also ensures the correct \"this\"\r\n * context is maintained as TypeScript creates incorrect references using super.XXXX() for dynamically defined functions i.e. Functions\r\n * defined in the constructor or some other function (rather than declared as complete typescript functions).\r\n * ### Usage\r\n * ```typescript\r\n * import dynamicProto from \"@microsoft/dynamicproto-js\";\r\n * class ExampleClass extends BaseClass {\r\n * constructor() {\r\n * dynamicProto(ExampleClass, this, (_self, base) => {\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.newFunc = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * ...\r\n * }\r\n * }\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.myFunction = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * // Call the base version of the function that we are overriding\r\n * base.myFunction();\r\n * }\r\n * ...\r\n * }\r\n * _self.initialize = () => {\r\n * ...\r\n * }\r\n * // Warnings: While the following will work as _self is simply a reference to\r\n * // this, if anyone overrides myFunction() the overridden will be called first\r\n * // as the normal JavaScript method resolution will occur and the defined\r\n * // _self.initialize() function is actually gets removed from the instance and\r\n * // a proxy prototype version is created to reference the created method.\r\n * _self.initialize();\r\n * });\r\n * }\r\n * }\r\n * ```\r\n * @typeparam DPType This is the generic type of the class, used to keep intellisense valid\r\n * @typeparam DPCls The type that contains the prototype of the current class\r\n * @param theClass - This is the current class instance which contains the prototype for the current class\r\n * @param target - The current \"this\" (target) reference, when the class has been extended this.prototype will not be the 'theClass' value.\r\n * @param delegateFunc - The callback function (closure) that will create the dynamic function\r\n * @param options - Additional options to configure how the dynamic prototype operates\r\n */\r\nfunction dynamicProto(theClass, target, delegateFunc, options) {\r\n // Make sure that the passed theClass argument looks correct\r\n if (!_hasOwnProperty(theClass, Prototype)) {\r\n _throwTypeError(\"theClass is an invalid class definition.\");\r\n }\r\n // Quick check to make sure that the passed theClass argument looks correct (this is a common copy/paste error)\r\n var classProto = theClass[Prototype];\r\n if (!_checkPrototype(classProto, target)) {\r\n _throwTypeError(\"[\" + _getObjName(theClass) + \"] is not in class hierarchy of [\" + _getObjName(target) + \"]\");\r\n }\r\n var className = null;\r\n if (_hasOwnProperty(classProto, DynClassName)) {\r\n // Only grab the class name if it's defined on this prototype (i.e. don't walk the prototype chain)\r\n className = classProto[DynClassName];\r\n }\r\n else {\r\n // As not all browser support name on the prototype creating a unique dynamic one if we have not already\r\n // assigned one, so we can use a simple string as the lookup rather than an object for the dynamic instance\r\n // function table lookup.\r\n className = DynClassNamePrefix + _getObjName(theClass, \"_\") + \"$\" + _dynamicNames;\r\n _dynamicNames++;\r\n classProto[DynClassName] = className;\r\n }\r\n var perfOptions = dynamicProto[DynProtoDefaultOptions];\r\n var useBaseInst = !!perfOptions[strUseBaseInst];\r\n if (useBaseInst && options && options[strUseBaseInst] !== undefined) {\r\n useBaseInst = !!options[strUseBaseInst];\r\n }\r\n // Get the current instance functions\r\n var instFuncs = _getInstanceFuncs(target);\r\n // Get all of the functions for any base instance (before they are potentially overridden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);\r\n // Execute the delegate passing in both the current target \"this\" and \"base\" function references\r\n // Note casting the same type as we don't actually have the base class here and this will provide some intellisense support\r\n delegateFunc(target, baseFuncs);\r\n // Don't allow setting instance functions for older IE instances\r\n var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];\r\n if (setInstanceFunc && options) {\r\n setInstanceFunc = !!options[strSetInstFuncs];\r\n }\r\n // Populate the Prototype for any overridden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);\r\n}\r\n/**\r\n * Exposes the default global options to allow global configuration, if the global values are disabled these will override\r\n * any passed values. This is primarily exposed to support unit-testing without the need for individual classes to expose\r\n * their internal usage of dynamic proto.\r\n */\r\nvar perfDefaults = {\r\n setInstFuncs: true,\r\n useBaseInst: true\r\n};\r\n// And expose for testing\r\ndynamicProto[DynProtoDefaultOptions] = perfDefaults;\n\nexport { dynamicProto as default };\n//# sourceMappingURL=dynamicproto-js.js.map\n","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { createEnumStyle } from \"../JavaScriptSDK.Enums/EnumHelperFuncs\";\r\n/**\r\n * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.\r\n */\r\nexport var EventsDiscardedReason = createEnumStyle({\r\n /**\r\n * Unknown.\r\n */\r\n Unknown: 0 /* eEventsDiscardedReason.Unknown */,\r\n /**\r\n * Status set to non-retryable.\r\n */\r\n NonRetryableStatus: 1 /* eEventsDiscardedReason.NonRetryableStatus */,\r\n /**\r\n * The event is invalid.\r\n */\r\n InvalidEvent: 2 /* eEventsDiscardedReason.InvalidEvent */,\r\n /**\r\n * The size of the event is too large.\r\n */\r\n SizeLimitExceeded: 3 /* eEventsDiscardedReason.SizeLimitExceeded */,\r\n /**\r\n * The server is not accepting events from this instrumentation key.\r\n */\r\n KillSwitch: 4 /* eEventsDiscardedReason.KillSwitch */,\r\n /**\r\n * The event queue is full.\r\n */\r\n QueueFull: 5 /* eEventsDiscardedReason.QueueFull */\r\n});\r\n//# sourceMappingURL=EventsDiscardedReason.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.4\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { objForEachKey, deepFreeze } from \"../JavaScriptSDK/HelperFuncs\";\r\n/**\r\n * Create an enum style object which has both the key => value and value => key mappings\r\n * @param values - The values to populate on the new object\r\n * @returns\r\n */\r\nexport function createEnumStyle(values) {\r\n var enumClass = {};\r\n objForEachKey(values, function (field, value) {\r\n enumClass[field] = value;\r\n enumClass[value] = field;\r\n });\r\n return deepFreeze(enumClass);\r\n}\r\n/**\r\n * Create a 2 index map that maps an enum's key as both the key and value, X[\"key\"] => \"key\" and X[0] => \"keyof 0\".\r\n * @param values - The values to populate on the new object\r\n * @returns\r\n */\r\nexport function createEnumMap(values) {\r\n var mapClass = {};\r\n objForEachKey(values, function (field, value) {\r\n mapClass[field] = field;\r\n mapClass[value] = field;\r\n });\r\n return deepFreeze(mapClass);\r\n}\r\n/**\r\n * Create a 2 index map that maps an enum's key and value to the defined map value, X[\"key\"] => mapValue and X[0] => mapValue.\r\n * Generic values\r\n * - E = the const enum type (typeof eRequestHeaders);\r\n * - V = Identifies the valid values for the keys, this should include both the enum numeric and string key of the type. The\r\n * resulting \"Value\" of each entry identifies the valid values withing the assignments.\r\n * @param values - The values to populate on the new object\r\n * @returns\r\n */\r\nexport function createValueMap(values) {\r\n var mapClass = {};\r\n objForEachKey(values, function (field, value) {\r\n mapClass[field] = value[1];\r\n mapClass[value[0]] = value[1];\r\n });\r\n return deepFreeze(mapClass);\r\n}\r\n//# sourceMappingURL=EnumHelperFuncs.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nimport { isNullOrUndefined, isValueAssigned } from \"@microsoft/1ds-core-js\";\r\nimport { strMsfpc } from \"./Constants\";\r\nfunction _getEventMsfpc(theEvent) {\r\n var intWeb = ((theEvent.ext || {})[\"intweb\"]);\r\n if (intWeb && isValueAssigned(intWeb[strMsfpc])) {\r\n return intWeb[strMsfpc];\r\n }\r\n return null;\r\n}\r\nfunction _getMsfpc(theEvents) {\r\n var msfpc = null;\r\n for (var lp = 0; msfpc === null && lp < theEvents.length; lp++) {\r\n msfpc = _getEventMsfpc(theEvents[lp]);\r\n }\r\n return msfpc;\r\n}\r\n/**\r\n* This class defines a \"batch\" events related to a specific iKey, it is used by the PostChannel and HttpManager\r\n* to collect and transfer ownership of events without duplicating them in-memory. This reduces the previous\r\n* array duplication and shared ownership issues that occurred due to race conditions caused by the async nature\r\n* of sending requests.\r\n*/\r\nvar EventBatch = /** @class */ (function () {\r\n /**\r\n * Private constructor so that caller is forced to use the static create method.\r\n * @param iKey - The iKey to associate with the events (not validated)\r\n * @param addEvents - The optional collection of events to assign to this batch - defaults to an empty array.\r\n */\r\n function EventBatch(iKey, addEvents) {\r\n var events = addEvents ? [].concat(addEvents) : [];\r\n var _self = this;\r\n var _msfpc = _getMsfpc(events);\r\n _self.iKey = function () {\r\n return iKey;\r\n };\r\n _self.Msfpc = function () {\r\n // return the cached value unless it's undefined -- used to avoid cpu\r\n return _msfpc || \"\";\r\n };\r\n _self.count = function () {\r\n return events.length;\r\n };\r\n _self.events = function () {\r\n return events;\r\n };\r\n _self.addEvent = function (theEvent) {\r\n if (theEvent) {\r\n events.push(theEvent);\r\n if (!_msfpc) {\r\n // Not found so try and find one\r\n _msfpc = _getEventMsfpc(theEvent);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n _self.split = function (fromEvent, numEvents) {\r\n // Create a new batch with the same iKey\r\n var theEvents;\r\n if (fromEvent < events.length) {\r\n var cnt = events.length - fromEvent;\r\n if (!isNullOrUndefined(numEvents)) {\r\n cnt = numEvents < cnt ? numEvents : cnt;\r\n }\r\n theEvents = events.splice(fromEvent, cnt);\r\n // reset the fetched msfpc value\r\n _msfpc = _getMsfpc(events);\r\n }\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n }\r\n /**\r\n * Creates a new Event Batch object\r\n * @param iKey The iKey associated with this batch of events\r\n */\r\n EventBatch.create = function (iKey, theEvents) {\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n return EventBatch;\r\n}());\r\nexport { EventBatch };\r\n//# sourceMappingURL=EventBatch.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Serializer.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\nimport { getTenantId, getCommonSchemaMetaData, isArray, sanitizeProperty, doPerf, isValueAssigned, strStartsWith, objForEachKey, arrIndexOf, } from \"@microsoft/1ds-core-js\";\r\nimport { EventBatch } from \"./EventBatch\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\n/**\r\n * Note: This is an optimization for V8-based browsers. When V8 concatenates a string,\r\n * the strings are only joined logically using a \"cons string\" or \"constructed/concatenated\r\n * string\". These containers keep references to one another and can result in very large\r\n * memory usage. For example, if a 2MB string is constructed by concatenating 4 bytes\r\n * together at a time, the memory usage will be ~44MB; so ~22x increase. The strings are\r\n * only joined together when an operation requiring their joining takes place, such as\r\n * substr(). This function is called when adding data to this buffer to ensure these\r\n * types of strings are periodically joined to reduce the memory footprint.\r\n * Setting to every 20 events as the JSON.stringify() may have joined many strings\r\n * and calling this too much causes a minor delay while processing.\r\n */\r\nvar _MAX_STRING_JOINS = 20;\r\nvar RequestSizeLimitBytes = 3984588; // approx 3.8 Mb\r\nvar BeaconRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)\r\nvar MaxRecordSize = 2000000; // approx 2 Mb\r\nvar MaxBeaconRecordSize = Math.min(MaxRecordSize, BeaconRequestSizeLimitBytes);\r\nvar metadata = \"metadata\";\r\nvar f = \"f\";\r\nvar rCheckDot = /\\./;\r\n/**\r\n* Class to handle serialization of event and request.\r\n* Currently uses Bond for serialization. Please note that this may be subject to change.\r\n*/\r\nvar Serializer = /** @class */ (function () {\r\n function Serializer(perfManager, valueSanitizer, stringifyObjects, enableCompoundKey) {\r\n var strData = \"data\";\r\n var strBaseData = \"baseData\";\r\n var strExt = \"ext\";\r\n var _checkForCompoundkey = !!enableCompoundKey;\r\n var _processSubMetaData = true;\r\n var _theSanitizer = valueSanitizer;\r\n var _isReservedCache = {};\r\n dynamicProto(Serializer, this, function (_self) {\r\n _self.createPayload = function (retryCnt, isTeardown, isSync, useSendBeacon, sendReason, sendType) {\r\n return {\r\n apiKeys: [],\r\n payloadBlob: \"\",\r\n overflow: null,\r\n sizeExceed: [],\r\n failedEvts: [],\r\n batches: [],\r\n numEvents: 0,\r\n retryCnt: retryCnt,\r\n isTeardown: isTeardown,\r\n isSync: isSync,\r\n isBeacon: useSendBeacon,\r\n sendType: sendType,\r\n sendReason: sendReason\r\n };\r\n };\r\n _self.appendPayload = function (payload, theBatch, maxEventsPerBatch) {\r\n var canAddEvents = payload && theBatch && !payload.overflow;\r\n if (canAddEvents) {\r\n doPerf(perfManager, function () { return \"Serializer:appendPayload\"; }, function () {\r\n var theEvents = theBatch.events();\r\n var payloadBlob = payload.payloadBlob;\r\n var payloadEvents = payload.numEvents;\r\n var eventsAdded = false;\r\n var sizeExceeded = [];\r\n var failedEvts = [];\r\n var isBeaconPayload = payload.isBeacon;\r\n var requestMaxSize = isBeaconPayload ? BeaconRequestSizeLimitBytes : RequestSizeLimitBytes;\r\n var recordMaxSize = isBeaconPayload ? MaxBeaconRecordSize : MaxRecordSize;\r\n var lp = 0;\r\n var joinCount = 0;\r\n while (lp < theEvents.length) {\r\n var theEvent = theEvents[lp];\r\n if (theEvent) {\r\n if (payloadEvents >= maxEventsPerBatch) {\r\n // Maximum events per payload reached, so don't add any more\r\n payload.overflow = theBatch.split(lp);\r\n break;\r\n }\r\n var eventBlob = _self.getEventBlob(theEvent);\r\n if (eventBlob && eventBlob.length <= recordMaxSize) {\r\n // This event will fit into the payload\r\n var blobLength = eventBlob.length;\r\n var currentSize = payloadBlob.length;\r\n if (currentSize + blobLength > requestMaxSize) {\r\n // Request or batch size exceeded, so don't add any more to the payload\r\n payload.overflow = theBatch.split(lp);\r\n break;\r\n }\r\n if (payloadBlob) {\r\n payloadBlob += \"\\n\";\r\n }\r\n payloadBlob += eventBlob;\r\n joinCount++;\r\n // v8 memory optimization only\r\n if (joinCount > _MAX_STRING_JOINS) {\r\n // this substr() should cause the constructed string to join\r\n payloadBlob.substr(0, 1);\r\n joinCount = 0;\r\n }\r\n eventsAdded = true;\r\n payloadEvents++;\r\n }\r\n else {\r\n if (eventBlob) {\r\n // Single event size exceeded so remove from the batch\r\n sizeExceeded.push(theEvent);\r\n }\r\n else {\r\n failedEvts.push(theEvent);\r\n }\r\n // We also need to remove this event from the existing array, otherwise a notification will be sent\r\n // indicating that it was successfully sent\r\n theEvents.splice(lp, 1);\r\n lp--;\r\n }\r\n }\r\n lp++;\r\n }\r\n if (sizeExceeded && sizeExceeded.length > 0) {\r\n payload.sizeExceed.push(EventBatch.create(theBatch.iKey(), sizeExceeded));\r\n // Remove the exceeded events from the batch\r\n }\r\n if (failedEvts && failedEvts.length > 0) {\r\n payload.failedEvts.push(EventBatch.create(theBatch.iKey(), failedEvts));\r\n // Remove the failed events from the batch\r\n }\r\n if (eventsAdded) {\r\n payload.batches.push(theBatch);\r\n payload.payloadBlob = payloadBlob;\r\n payload.numEvents = payloadEvents;\r\n var apiKey = theBatch.iKey();\r\n if (arrIndexOf(payload.apiKeys, apiKey) === -1) {\r\n payload.apiKeys.push(apiKey);\r\n }\r\n }\r\n }, function () { return ({ payload: payload, theBatch: { iKey: theBatch.iKey(), evts: theBatch.events() }, max: maxEventsPerBatch }); });\r\n }\r\n return canAddEvents;\r\n };\r\n _self.getEventBlob = function (eventData) {\r\n try {\r\n return doPerf(perfManager, function () { return \"Serializer.getEventBlob\"; }, function () {\r\n var serializedEvent = {};\r\n // Adding as dynamic keys for v8 performance\r\n serializedEvent.name = eventData.name;\r\n serializedEvent.time = eventData.time;\r\n serializedEvent.ver = eventData.ver;\r\n serializedEvent.iKey = \"o:\" + getTenantId(eventData.iKey);\r\n // Assigning local var so usage in part b/c don't throw if there is no ext\r\n var serializedExt = {};\r\n // Part A\r\n var eventExt = eventData[strExt];\r\n if (eventExt) {\r\n // Only assign ext if the event had one (There are tests covering this use case)\r\n serializedEvent[strExt] = serializedExt;\r\n objForEachKey(eventExt, function (key, value) {\r\n var data = serializedExt[key] = {};\r\n // Don't include a metadata callback as we don't currently set metadata Part A fields\r\n _processPathKeys(value, data, \"ext.\" + key, true, null, null, true);\r\n });\r\n }\r\n var serializedData = serializedEvent[strData] = {};\r\n serializedData.baseType = eventData.baseType;\r\n var serializedBaseData = serializedData[strBaseData] = {};\r\n // Part B\r\n _processPathKeys(eventData.baseData, serializedBaseData, strBaseData, false, [strBaseData], function (pathKeys, name, value) {\r\n _addJSONPropertyMetaData(serializedExt, pathKeys, name, value);\r\n }, _processSubMetaData);\r\n // Part C\r\n _processPathKeys(eventData.data, serializedData, strData, false, [], function (pathKeys, name, value) {\r\n _addJSONPropertyMetaData(serializedExt, pathKeys, name, value);\r\n }, _processSubMetaData);\r\n return JSON.stringify(serializedEvent);\r\n }, function () { return ({ item: eventData }); });\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n };\r\n function _isReservedField(path, name) {\r\n var result = _isReservedCache[path];\r\n if (result === undefined) {\r\n if (path.length >= 7) {\r\n // Do not allow the changing of fields located in the ext.metadata or ext.web extension\r\n result = strStartsWith(path, \"ext.metadata\") || strStartsWith(path, \"ext.web\");\r\n }\r\n _isReservedCache[path] = result;\r\n }\r\n return result;\r\n }\r\n function _processPathKeys(srcObj, target, thePath, checkReserved, metadataPathKeys, metadataCallback, processSubKeys) {\r\n objForEachKey(srcObj, function (key, srcValue) {\r\n var prop = null;\r\n if (srcValue || isValueAssigned(srcValue)) {\r\n var path = thePath;\r\n var name_1 = key;\r\n var theMetaPathKeys = metadataPathKeys;\r\n var destObj = target;\r\n // Handle keys with embedded '.', like \"TestObject.testProperty\"\r\n if (_checkForCompoundkey && !checkReserved && rCheckDot.test(key)) {\r\n var subKeys = key.split(\".\");\r\n var keyLen = subKeys.length;\r\n if (keyLen > 1) {\r\n if (theMetaPathKeys) {\r\n // Create a copy of the meta path keys so we can add the extra ones\r\n theMetaPathKeys = theMetaPathKeys.slice();\r\n }\r\n for (var lp = 0; lp < keyLen - 1; lp++) {\r\n var subKey = subKeys[lp];\r\n // Add/reuse the sub key object\r\n destObj = destObj[subKey] = destObj[subKey] || {};\r\n path += \".\" + subKey;\r\n if (theMetaPathKeys) {\r\n theMetaPathKeys.push(subKey);\r\n }\r\n }\r\n name_1 = subKeys[keyLen - 1];\r\n }\r\n }\r\n var isReserved = checkReserved && _isReservedField(path, name_1);\r\n if (!isReserved && _theSanitizer && _theSanitizer.handleField(path, name_1)) {\r\n prop = _theSanitizer.value(path, name_1, srcValue, stringifyObjects);\r\n }\r\n else {\r\n prop = sanitizeProperty(name_1, srcValue, stringifyObjects);\r\n }\r\n if (prop) {\r\n // Set the value\r\n var newValue = prop.value;\r\n destObj[name_1] = newValue;\r\n if (metadataCallback) {\r\n metadataCallback(theMetaPathKeys, name_1, prop);\r\n }\r\n if (processSubKeys && typeof newValue === \"object\" && !isArray(newValue)) {\r\n var newPath = theMetaPathKeys;\r\n if (newPath) {\r\n newPath = newPath.slice();\r\n newPath.push(name_1);\r\n }\r\n // Make sure we process sub objects as well (for value sanitization and metadata)\r\n _processPathKeys(srcValue, newValue, path + \".\" + name_1, checkReserved, newPath, metadataCallback, processSubKeys);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n });\r\n }\r\n// Removed Stub for Serializer.prototype.createPayload.\r\n// Removed Stub for Serializer.prototype.appendPayload.\r\n// Removed Stub for Serializer.prototype.getEventBlob.\r\n// Removed Stub for Serializer.prototype.handleField.\r\n// Removed Stub for Serializer.prototype.getSanitizer.\r\n return Serializer;\r\n}());\r\nexport { Serializer };\r\n/**\r\n * @ignore\r\n */\r\nfunction _addJSONPropertyMetaData(json, propKeys, name, propertyValue) {\r\n if (propertyValue && json) {\r\n var encodedTypeValue = getCommonSchemaMetaData(propertyValue.value, propertyValue.kind, propertyValue.propertyType);\r\n if (encodedTypeValue > -1) {\r\n // Add the root metadata\r\n var metaData = json[metadata];\r\n if (!metaData) {\r\n // Sets the root 'f'\r\n metaData = json[metadata] = { f: {} };\r\n }\r\n var metaTarget = metaData[f];\r\n if (!metaTarget) {\r\n // This can occur if someone has manually added an ext.metadata object\r\n // Such as ext.metadata.privLevel and ext.metadata.privTags\r\n metaTarget = metaData[f] = {};\r\n }\r\n // Traverse the metadata path and build each object (contains an 'f' key) -- if required\r\n if (propKeys) {\r\n for (var lp = 0; lp < propKeys.length; lp++) {\r\n var key = propKeys[lp];\r\n if (!metaTarget[key]) {\r\n metaTarget[key] = { f: {} };\r\n }\r\n var newTarget = metaTarget[key][f];\r\n if (!newTarget) {\r\n // Not expected, but can occur if the metadata context was pre-created as part of the event\r\n newTarget = metaTarget[key][f] = {};\r\n }\r\n metaTarget = newTarget;\r\n }\r\n }\r\n metaTarget = metaTarget[name] = {};\r\n if (isArray(propertyValue.value)) {\r\n metaTarget[\"a\"] = {\r\n t: encodedTypeValue\r\n };\r\n }\r\n else {\r\n metaTarget[\"t\"] = encodedTypeValue;\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=Serializer.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* RetryPolicy.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nvar RandomizationLowerThreshold = 0.8;\r\nvar RandomizationUpperThreshold = 1.2;\r\nvar BaseBackoff = 3000;\r\nvar MaxBackoff = 600000;\r\n/**\r\n * Determine if the request should be retried for the given status code.\r\n * The below expression reads that we should only retry for:\r\n * - HttpStatusCodes that are smaller than 300.\r\n * - HttpStatusCodes greater or equal to 500 (except for 501-NotImplement\r\n * and 505-HttpVersionNotSupport).\r\n * - HttpStatusCode 408-RequestTimeout.\r\n * - HttpStatusCode 429.\r\n * This is based on Microsoft.WindowsAzure.Storage.RetryPolicies.ExponentialRetry class\r\n * @param httpStatusCode - The status code returned for the request.\r\n * @returns True if request should be retried, false otherwise.\r\n */\r\nexport function retryPolicyShouldRetryForStatus(httpStatusCode) {\r\n /* tslint:disable:triple-equals */\r\n // Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value\r\n return !((httpStatusCode >= 300 && httpStatusCode < 500 && httpStatusCode != 408 && httpStatusCode != 429)\r\n || (httpStatusCode == 501)\r\n || (httpStatusCode == 505));\r\n /* tslint:enable:triple-equals */\r\n}\r\n/**\r\n * Gets the number of milliseconds to back off before retrying the request. The\r\n * back off duration is exponentially scaled based on the number of retries already\r\n * done for the request.\r\n * @param retriesSoFar - The number of times the request has already been retried.\r\n * @returns The back off duration for the request before it can be retried.\r\n */\r\nexport function retryPolicyGetMillisToBackoffForRetry(retriesSoFar) {\r\n var waitDuration = 0;\r\n var minBackoff = BaseBackoff * RandomizationLowerThreshold;\r\n var maxBackoff = BaseBackoff * RandomizationUpperThreshold;\r\n var randomBackoff = Math.floor(Math.random() * (maxBackoff - minBackoff)) + minBackoff;\r\n waitDuration = Math.pow(2, retriesSoFar) * randomBackoff;\r\n return Math.min(waitDuration, MaxBackoff);\r\n}\r\n//# sourceMappingURL=RetryPolicy.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* KillSwitch.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrForEach, strTrim, dateNow } from \"@microsoft/1ds-core-js\";\r\nvar SecToMsMultiplier = 1000;\r\n/**\r\n* Class to stop certain tenants sending events.\r\n*/\r\nvar KillSwitch = /** @class */ (function () {\r\n function KillSwitch() {\r\n var _killedTokenDictionary = {};\r\n function _normalizeTenants(values) {\r\n var result = [];\r\n if (values) {\r\n arrForEach(values, function (value) {\r\n result.push(strTrim(value));\r\n });\r\n }\r\n return result;\r\n }\r\n dynamicProto(KillSwitch, this, function (_self) {\r\n _self.setKillSwitchTenants = function (killTokens, killDuration) {\r\n if (killTokens && killDuration) {\r\n try {\r\n var killedTokens = _normalizeTenants(killTokens.split(\",\"));\r\n if (killDuration === \"this-request-only\") {\r\n return killedTokens;\r\n }\r\n var durationMs = parseInt(killDuration, 10) * SecToMsMultiplier;\r\n for (var i = 0; i < killedTokens.length; ++i) {\r\n _killedTokenDictionary[killedTokens[i]] = dateNow() + durationMs;\r\n }\r\n }\r\n catch (ex) {\r\n return [];\r\n }\r\n }\r\n return [];\r\n };\r\n _self.isTenantKilled = function (tenantToken) {\r\n var killDictionary = _killedTokenDictionary;\r\n var name = strTrim(tenantToken);\r\n if (killDictionary[name] !== undefined && killDictionary[name] > dateNow()) {\r\n return true;\r\n }\r\n delete killDictionary[name];\r\n return false;\r\n };\r\n });\r\n }\r\n// Removed Stub for KillSwitch.prototype.setKillSwitchTenants.\r\n// Removed Stub for KillSwitch.prototype.isTenantKilled.\r\n return KillSwitch;\r\n}());\r\nexport default KillSwitch;\r\n//# sourceMappingURL=KillSwitch.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nvar _a;\r\n/**\r\n* HttpManager.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\nimport { isReactNative, isValueAssigned, isString, getTime, arrForEach, getLocation, strTrim, isFetchSupported, isXhrSupported, isBeaconsSupported, FullVersionString, useXDomainRequest, strUndefined, getNavigator, doPerf, dateNow, isUndefined, isNullOrUndefined, objForEachKey, isNumber, isArray, dumpObj, objKeys, extend, hasOwnProperty, openXhr, _throwInternal } from \"@microsoft/1ds-core-js\";\r\nimport { Serializer } from \"./Serializer\";\r\nimport { retryPolicyGetMillisToBackoffForRetry, retryPolicyShouldRetryForStatus } from \"./RetryPolicy\";\r\nimport EVTKillSwitch from \"./KillSwitch\";\r\nimport EVTClockSkewManager from \"./ClockSkewManager\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { defaultCacheControl, defaultContentType, DisabledPropertyName, Method, strApiKey, strAuthXToken, strCacheControl, strClientId, strClientVersion, strContentTypeHeader, strDropped, strKillDurationHeader, strKillDurationSecondsHeader, strKillTokensHeader, strMsaDeviceTicket, strMsfpc, strNoResponseBody, strOther, strRequeue, strResponseFail, strSending, strTimeDeltaHeader, strTimeDeltaToApply, strUploadTime } from \"./Constants\";\r\nvar strSendAttempt = \"sendAttempt\";\r\nvar _noResponseQs = \"&\" + strNoResponseBody + \"=true\";\r\n/**\r\n * Identifies the default notification reason to the action names\r\n */\r\nvar _eventActionMap = (_a = {},\r\n _a[1 /* EventBatchNotificationReason.Paused */] = strRequeue,\r\n _a[100 /* EventBatchNotificationReason.RequeueEvents */] = strRequeue,\r\n _a[200 /* EventBatchNotificationReason.Complete */] = \"sent\",\r\n _a[8004 /* EventBatchNotificationReason.KillSwitch */] = strDropped,\r\n _a[8003 /* EventBatchNotificationReason.SizeLimitExceeded */] = strDropped,\r\n _a);\r\nvar _collectorQsHeaders = {};\r\nvar _collectorHeaderToQs = {};\r\nfunction _addCollectorHeaderQsMapping(qsName, headerName, allowQs) {\r\n _collectorQsHeaders[qsName] = headerName;\r\n if (allowQs !== false) {\r\n _collectorHeaderToQs[headerName] = qsName;\r\n }\r\n}\r\n_addCollectorHeaderQsMapping(strMsaDeviceTicket, strMsaDeviceTicket, false);\r\n_addCollectorHeaderQsMapping(strClientVersion, strClientVersion);\r\n_addCollectorHeaderQsMapping(strClientId, \"Client-Id\");\r\n_addCollectorHeaderQsMapping(strApiKey, strApiKey);\r\n_addCollectorHeaderQsMapping(strTimeDeltaToApply, strTimeDeltaToApply);\r\n_addCollectorHeaderQsMapping(strUploadTime, strUploadTime);\r\n_addCollectorHeaderQsMapping(strAuthXToken, strAuthXToken);\r\nfunction _getResponseText(xhr) {\r\n try {\r\n return xhr.responseText;\r\n }\r\n catch (e) {\r\n // Best effort, as XHR may throw while XDR wont so just ignore\r\n }\r\n return \"\";\r\n}\r\nfunction _hasHeader(headers, header) {\r\n var hasHeader = false;\r\n if (headers && header) {\r\n var keys = objKeys(headers);\r\n if (keys && keys.length > 0) {\r\n var lowerHeader = header.toLowerCase();\r\n for (var lp = 0; lp < keys.length; lp++) {\r\n var value = keys[lp];\r\n if (value && hasOwnProperty(header, value) &&\r\n value.toLowerCase() === lowerHeader) {\r\n hasHeader = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return hasHeader;\r\n}\r\nfunction _addRequestDetails(details, name, value, useHeaders) {\r\n if (name && value && value.length > 0) {\r\n if (useHeaders && _collectorQsHeaders[name]) {\r\n details.hdrs[_collectorQsHeaders[name]] = value;\r\n details.useHdrs = true;\r\n }\r\n else {\r\n details.url += \"&\" + name + \"=\" + value;\r\n }\r\n }\r\n}\r\n/**\r\n * Class managing the sending of requests.\r\n */\r\nvar HttpManager = /** @class */ (function () {\r\n /**\r\n * @constructor\r\n * @param requestQueue - The queue that contains the requests to be sent.\r\n */\r\n function HttpManager(maxEventsPerBatch, maxConnections, maxRequestRetriesBeforeBackoff, actions, timeoutOverride) {\r\n this._responseHandlers = [];\r\n var _urlString = \"?cors=true&\" + strContentTypeHeader.toLowerCase() + \"=\" + defaultContentType;\r\n var _killSwitch = new EVTKillSwitch();\r\n var _paused = false;\r\n var _clockSkewManager = new EVTClockSkewManager();\r\n var _useBeacons = false;\r\n var _outstandingRequests = 0; // Holds the number of outstanding async requests that have not returned a response yet\r\n var _postManager;\r\n var _sendInterfaces;\r\n var _core;\r\n var _customHttpInterface = true;\r\n var _queryStringParameters = [];\r\n var _headers = {};\r\n var _batchQueue = [];\r\n var _serializer = null;\r\n var _enableEventTimings = false;\r\n var _cookieMgr;\r\n var _isUnloading = false;\r\n var _useHeaders = false;\r\n var _xhrTimeout;\r\n var _disableXhrSync;\r\n dynamicProto(HttpManager, this, function (_self) {\r\n var _sendCredentials = true;\r\n _self.initialize = function (endpointUrl, core, postChannel, httpInterface, channelConfig) {\r\n var _a;\r\n if (!channelConfig) {\r\n channelConfig = {};\r\n }\r\n _urlString = endpointUrl + _urlString;\r\n _useHeaders = !isUndefined(channelConfig.avoidOptions) ? !channelConfig.avoidOptions : true;\r\n _core = core;\r\n _cookieMgr = core.getCookieMgr();\r\n _enableEventTimings = !_core.config.disableEventTimings;\r\n var enableCompoundKey = !!_core.config.enableCompoundKey;\r\n _postManager = postChannel;\r\n var valueSanitizer = channelConfig.valueSanitizer;\r\n var stringifyObjects = channelConfig.stringifyObjects;\r\n if (!isUndefined(channelConfig.enableCompoundKey)) {\r\n enableCompoundKey = !!channelConfig.enableCompoundKey;\r\n }\r\n _xhrTimeout = channelConfig.xhrTimeout;\r\n _disableXhrSync = channelConfig.disableXhrSync;\r\n _useBeacons = !isReactNative(); // Only use beacons if not running in React Native\r\n _serializer = new Serializer(_core, valueSanitizer, stringifyObjects, enableCompoundKey);\r\n var syncHttpInterface = httpInterface;\r\n var beaconHttpInterface = channelConfig.alwaysUseXhrOverride ? httpInterface : null;\r\n var fetchSyncHttpInterface = channelConfig.alwaysUseXhrOverride ? httpInterface : null;\r\n if (!httpInterface) {\r\n _customHttpInterface = false;\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol && location_1.protocol.toLowerCase() === \"file:\") {\r\n // Special case where a local html file fails with a CORS error on Chromium browsers\r\n _sendCredentials = false;\r\n }\r\n var theTransports = [];\r\n if (isReactNative()) {\r\n // Use Fetch or XDR/XHR\r\n theTransports = [2 /* TransportType.Fetch */, 1 /* TransportType.Xhr */];\r\n }\r\n else {\r\n // Use XDR/XHR, Fetch or beacons\r\n theTransports = [1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */];\r\n }\r\n // Prefix any user requested transport(s) values\r\n var configTransports = channelConfig.transports;\r\n if (configTransports) {\r\n if (isNumber(configTransports)) {\r\n theTransports = [configTransports].concat(theTransports);\r\n }\r\n else if (isArray(configTransports)) {\r\n theTransports = configTransports.concat(theTransports);\r\n }\r\n }\r\n httpInterface = _getSenderInterface(theTransports, false);\r\n syncHttpInterface = _getSenderInterface(theTransports, true);\r\n if (!httpInterface) {\r\n _postManager.diagLog().warnToConsole(\"No available transport to send events\");\r\n }\r\n }\r\n _sendInterfaces = (_a = {},\r\n _a[0 /* EventSendType.Batched */] = httpInterface,\r\n _a[1 /* EventSendType.Synchronous */] = syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */], true),\r\n _a[2 /* EventSendType.SendBeacon */] = beaconHttpInterface || _getSenderInterface([3 /* TransportType.Beacon */, 2 /* TransportType.Fetch */], true) || syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */], true),\r\n _a[3 /* EventSendType.SyncFetch */] = fetchSyncHttpInterface || _getSenderInterface([2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */], true) || syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */], true),\r\n _a);\r\n };\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n function _getSenderInterface(transports, syncSupport) {\r\n var transportType = 0 /* TransportType.NotSet */;\r\n var sendPostFunc = null;\r\n var lp = 0;\r\n while (sendPostFunc == null && lp < transports.length) {\r\n transportType = transports[lp];\r\n if (transportType === 1 /* TransportType.Xhr */) {\r\n if (useXDomainRequest()) {\r\n sendPostFunc = _xdrSendPost;\r\n }\r\n else if (isXhrSupported()) {\r\n sendPostFunc = _xhrSendPost;\r\n }\r\n }\r\n else if (transportType === 2 /* TransportType.Fetch */ && isFetchSupported(syncSupport)) {\r\n sendPostFunc = _fetchSendPost;\r\n }\r\n else if (_useBeacons && transportType === 3 /* TransportType.Beacon */ && isBeaconsSupported()) {\r\n sendPostFunc = _beaconSendPost;\r\n }\r\n lp++;\r\n }\r\n if (sendPostFunc) {\r\n return {\r\n _transport: transportType,\r\n _isSync: syncSupport,\r\n sendPOST: sendPostFunc\r\n };\r\n }\r\n return null;\r\n }\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_sendInterfaces[0 /* EventSendType.Batched */], _killSwitch, _serializer, _sendInterfaces];\r\n };\r\n function _xdrSendPost(payload, oncomplete, sync) {\r\n // It doesn't support custom headers, so no action is taken with current requestHeaders\r\n var xdr = new XDomainRequest();\r\n xdr.open(Method, payload.urlString);\r\n if (payload.timeout) {\r\n xdr.timeout = payload.timeout;\r\n }\r\n // can't get the status code in xdr.\r\n xdr.onload = function () {\r\n // we will assume onload means the request succeeded.\r\n var response = _getResponseText(xdr);\r\n _doOnComplete(oncomplete, 200, {}, response);\r\n _handleCollectorResponse(response);\r\n };\r\n // we will assume onerror means we need to drop the events.\r\n xdr.onerror = function () {\r\n _doOnComplete(oncomplete, 400, {});\r\n };\r\n // we will assume ontimeout means we need to retry the events.\r\n xdr.ontimeout = function () {\r\n _doOnComplete(oncomplete, 500, {});\r\n };\r\n // https://cypressnorth.com/web-programming-and-development/internet-explorer-aborting-ajax-requests-fixed/\r\n // tslint:disable-next-line:no-empty\r\n xdr.onprogress = function () { };\r\n if (sync) {\r\n xdr.send(payload.data);\r\n }\r\n else {\r\n timeoutOverride.set(function () {\r\n xdr.send(payload.data);\r\n }, 0);\r\n }\r\n }\r\n function _fetchSendPost(payload, oncomplete, sync) {\r\n var _a;\r\n var theUrl = payload.urlString;\r\n var ignoreResponse = false;\r\n var responseHandled = false;\r\n var requestInit = (_a = {\r\n body: payload.data,\r\n method: Method\r\n },\r\n _a[DisabledPropertyName] = true,\r\n _a);\r\n if (sync) {\r\n requestInit.keepalive = true;\r\n if (payload._sendReason === 2 /* SendRequestReason.Unload */) {\r\n // As a sync request (during unload), it is unlikely that we will get a chance to process the response so\r\n // just like beacon send assume that the events have been accepted and processed\r\n ignoreResponse = true;\r\n theUrl += _noResponseQs;\r\n }\r\n }\r\n if (_sendCredentials) {\r\n // Don't send credentials when URL is file://\r\n requestInit.credentials = \"include\";\r\n }\r\n // Only add headers if there are headers to add, due to issue with some polyfills\r\n if (payload.headers && objKeys(payload.headers).length > 0) {\r\n requestInit.headers = payload.headers;\r\n }\r\n fetch(theUrl, requestInit).then(function (response) {\r\n var headerMap = {};\r\n var responseText = \"\";\r\n if (response.headers) {\r\n response.headers.forEach(function (value, name) {\r\n headerMap[name] = value;\r\n });\r\n }\r\n if (response.body) {\r\n response.text().then(function (text) {\r\n responseText = text;\r\n });\r\n }\r\n if (!responseHandled) {\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, response.status, headerMap, responseText);\r\n _handleCollectorResponse(responseText);\r\n }\r\n })[\"catch\"](function (error) {\r\n // In case there is an error in the request. Set the status to 0\r\n // so that the events can be retried later.\r\n if (!responseHandled) {\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 0, {});\r\n }\r\n });\r\n if (ignoreResponse && !responseHandled) {\r\n // Assume success during unload processing\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 200, {});\r\n }\r\n if (!responseHandled && payload.timeout > 0) {\r\n // Simulate timeout\r\n timeoutOverride.set(function () {\r\n if (!responseHandled) {\r\n // Assume a 500 response (which will cause a retry)\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 500, {});\r\n }\r\n }, payload.timeout);\r\n }\r\n }\r\n function _xhrSendPost(payload, oncomplete, sync) {\r\n var theUrl = payload.urlString;\r\n function _appendHeader(theHeaders, xhr, name) {\r\n if (!theHeaders[name] && xhr && xhr.getResponseHeader) {\r\n var value = xhr.getResponseHeader(name);\r\n if (value) {\r\n theHeaders[name] = strTrim(value);\r\n }\r\n }\r\n return theHeaders;\r\n }\r\n function _getAllResponseHeaders(xhr) {\r\n var theHeaders = {};\r\n if (!xhr.getAllResponseHeaders) {\r\n // Firefox 2-63 doesn't have getAllResponseHeaders function but it does have getResponseHeader\r\n // Only call these if getAllResponseHeaders doesn't exist, otherwise we can get invalid response errors\r\n // as collector is not currently returning the correct header to allow JS to access these headers\r\n theHeaders = _appendHeader(theHeaders, xhr, strTimeDeltaHeader);\r\n theHeaders = _appendHeader(theHeaders, xhr, strKillDurationHeader);\r\n theHeaders = _appendHeader(theHeaders, xhr, strKillDurationSecondsHeader);\r\n }\r\n else {\r\n theHeaders = _convertAllHeadersToMap(xhr.getAllResponseHeaders());\r\n }\r\n return theHeaders;\r\n }\r\n function xhrComplete(xhr, responseTxt) {\r\n _doOnComplete(oncomplete, xhr.status, _getAllResponseHeaders(xhr), responseTxt);\r\n }\r\n if (sync && payload.disableXhrSync) {\r\n sync = false;\r\n }\r\n var xhrRequest = openXhr(Method, theUrl, _sendCredentials, true, sync, payload.timeout);\r\n // Set custom headers (e.g. gzip) here (after open())\r\n objForEachKey(payload.headers, function (name, value) {\r\n xhrRequest.setRequestHeader(name, value);\r\n });\r\n xhrRequest.onload = function () {\r\n var response = _getResponseText(xhrRequest);\r\n xhrComplete(xhrRequest, response);\r\n _handleCollectorResponse(response);\r\n };\r\n xhrRequest.onerror = function () {\r\n xhrComplete(xhrRequest);\r\n };\r\n xhrRequest.ontimeout = function () {\r\n xhrComplete(xhrRequest);\r\n };\r\n xhrRequest.send(payload.data);\r\n }\r\n function _doOnComplete(oncomplete, status, headers, response) {\r\n try {\r\n oncomplete(status, headers, response);\r\n }\r\n catch (e) {\r\n _throwInternal(_postManager.diagLog(), 2 /* eLoggingSeverity.WARNING */, 518 /* _eExtendedInternalMessageId.SendPostOnCompleteFailure */, dumpObj(e));\r\n }\r\n }\r\n function _beaconSendPost(payload, oncomplete, sync) {\r\n // Custom headers not supported in sendBeacon payload.headers would be ignored\r\n var internalPayloadData = payload;\r\n var status = 200;\r\n var thePayload = internalPayloadData._thePayload;\r\n var theUrl = payload.urlString + _noResponseQs;\r\n try {\r\n var nav_1 = getNavigator();\r\n if (!nav_1.sendBeacon(theUrl, payload.data)) {\r\n if (thePayload) {\r\n // Failed to send entire payload so try and split data and try to send as much events as possible\r\n var droppedBatches_1 = [];\r\n arrForEach(thePayload.batches, function (theBatch) {\r\n if (droppedBatches_1 && theBatch && theBatch.count() > 0) {\r\n var theEvents = theBatch.events();\r\n for (var lp = 0; lp < theEvents.length; lp++) {\r\n if (!nav_1.sendBeacon(theUrl, _serializer.getEventBlob(theEvents[lp]))) {\r\n // Can't send anymore, so split the batch and drop the rest\r\n droppedBatches_1.push(theBatch.split(lp));\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n // Remove all of the events from the existing batch in the payload as the copy includes the original\r\n droppedBatches_1.push(theBatch.split(0));\r\n }\r\n });\r\n _sendBatchesNotification(droppedBatches_1, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload.sendType, true);\r\n }\r\n else {\r\n status = 0;\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n _postManager.diagLog().warnToConsole(\"Failed to send telemetry using sendBeacon API. Ex:\" + dumpObj(ex));\r\n status = 0;\r\n }\r\n finally {\r\n _doOnComplete(oncomplete, status, {}, \"\");\r\n }\r\n }\r\n function _isBeaconPayload(sendType) {\r\n // Sync Fetch has the same payload limitation as sendBeacon -- 64kb limit, so treat both as a beacon send\r\n return sendType === 2 /* EventSendType.SendBeacon */ || sendType === 3 /* EventSendType.SyncFetch */;\r\n }\r\n function _adjustSendType(sendType) {\r\n if (_isUnloading && _isBeaconPayload(sendType)) {\r\n sendType = 2 /* EventSendType.SendBeacon */;\r\n }\r\n return sendType;\r\n }\r\n _self.addQueryStringParameter = function (name, value) {\r\n for (var i = 0; i < _queryStringParameters.length; i++) {\r\n if (_queryStringParameters[i].name === name) {\r\n _queryStringParameters[i].value = value;\r\n return;\r\n }\r\n }\r\n _queryStringParameters.push({ name: name, value: value });\r\n };\r\n _self.addHeader = function (name, value) {\r\n _headers[name] = value;\r\n };\r\n _self.canSendRequest = function () {\r\n return _hasIdleConnection() && _clockSkewManager.allowRequestSending();\r\n };\r\n _self.sendQueuedRequests = function (sendType, sendReason) {\r\n if (isUndefined(sendType)) {\r\n sendType = 0 /* EventSendType.Batched */;\r\n }\r\n if (_isUnloading) {\r\n sendType = _adjustSendType(sendType);\r\n sendReason = 2 /* SendRequestReason.Unload */;\r\n }\r\n if (_canSendPayload(_batchQueue, sendType, 0)) {\r\n _sendBatches(_clearQueue(), 0, false, sendType, sendReason || 0 /* SendRequestReason.Undefined */);\r\n }\r\n };\r\n _self.isCompletelyIdle = function () {\r\n return !_paused && _outstandingRequests === 0 && _batchQueue.length === 0;\r\n };\r\n _self.setUnloading = function (value) {\r\n _isUnloading = value;\r\n };\r\n _self.addBatch = function (theBatch) {\r\n if (theBatch && theBatch.count() > 0) {\r\n // Try and kill the event faster\r\n if (_killSwitch.isTenantKilled(theBatch.iKey())) {\r\n return false;\r\n }\r\n _batchQueue.push(theBatch);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Queue all the remaining requests to be sent. The requests will be\r\n * sent using HTML5 Beacons if they are available.\r\n */\r\n _self.teardown = function () {\r\n if (_batchQueue.length > 0) {\r\n _sendBatches(_clearQueue(), 0, true, 2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n };\r\n /**\r\n * Pause the sending of requests. No new requests will be sent.\r\n */\r\n _self.pause = function () {\r\n _paused = true;\r\n };\r\n /**\r\n * Resume the sending of requests.\r\n */\r\n _self.resume = function () {\r\n _paused = false;\r\n _self.sendQueuedRequests(0 /* EventSendType.Batched */, 4 /* SendRequestReason.Resumed */);\r\n };\r\n /**\r\n * Sends a request synchronously to the Aria collector. This api is used to send\r\n * a request containing a single immediate event.\r\n *\r\n * @param batch - The request to be sent.\r\n * @param sendReason - The token used to send the request.\r\n */\r\n _self.sendSynchronousBatch = function (batch, sendType, sendReason) {\r\n // This will not take into account the max connections restriction. Since this is sync, we can\r\n // only send one of this request at a time and thus should not worry about multiple connections\r\n // being used to send synchronous events.\r\n // Increment active connection since we are still going to use a connection to send the request.\r\n if (batch && batch.count() > 0) {\r\n if (isNullOrUndefined(sendType)) {\r\n sendType = 1 /* EventSendType.Synchronous */;\r\n }\r\n if (_isUnloading) {\r\n sendType = _adjustSendType(sendType);\r\n sendReason = 2 /* SendRequestReason.Unload */;\r\n }\r\n // For sync requests we will not wait for the clock skew.\r\n _sendBatches([batch], 0, false, sendType, sendReason || 0 /* SendRequestReason.Undefined */);\r\n }\r\n };\r\n function _hasIdleConnection() {\r\n return !_paused && _outstandingRequests < maxConnections;\r\n }\r\n function _clearQueue() {\r\n var theQueue = _batchQueue;\r\n _batchQueue = [];\r\n return theQueue;\r\n }\r\n function _canSendPayload(theBatches, sendType, retryCnt) {\r\n var result = false;\r\n if (theBatches && theBatches.length > 0 && !_paused && _sendInterfaces[sendType] && _serializer) {\r\n // Always attempt to send synchronous events don't wait for idle or clockSkew\r\n // and don't block retry requests if clockSkew is not yet set\r\n result = (sendType !== 0 /* EventSendType.Batched */) || (_hasIdleConnection() && (retryCnt > 0 || _clockSkewManager.allowRequestSending()));\r\n }\r\n return result;\r\n }\r\n function _createDebugBatches(theBatches) {\r\n var values = {};\r\n if (theBatches) {\r\n arrForEach(theBatches, function (theBatch, idx) {\r\n values[idx] = {\r\n iKey: theBatch.iKey(),\r\n evts: theBatch.events()\r\n };\r\n });\r\n }\r\n return values;\r\n }\r\n function _sendBatches(theBatches, retryCount, isTeardown, sendType, sendReason) {\r\n if (!theBatches || theBatches.length === 0) {\r\n // Nothing to do\r\n return;\r\n }\r\n if (_paused) {\r\n _sendBatchesNotification(theBatches, 1 /* EventBatchNotificationReason.Paused */, sendType);\r\n return;\r\n }\r\n // Make sure that if we are unloading the sendType is a supported version\r\n sendType = _adjustSendType(sendType);\r\n try {\r\n var orgBatches_1 = theBatches;\r\n var isSynchronous_1 = sendType !== 0 /* EventSendType.Batched */;\r\n doPerf(_core, function () { return \"HttpManager:_sendBatches\"; }, function (perfEvt) {\r\n if (perfEvt) {\r\n // Perf Monitoring is enabled, so create a \"Quick\" copy of the original batches so we still report\r\n // the original values as part of the perfEvent. This is because theBatches uses .shift() to remove each\r\n // batch as they are processed - removing from the original array, so by the time the _createDebugBatches()\r\n // function is called the passed in value has changed and therefore the reported value for the perfEvent is incorrect\r\n theBatches = theBatches.slice(0);\r\n }\r\n var droppedBatches = [];\r\n var thePayload = null;\r\n var serializationStart = getTime();\r\n var sendInterface = _sendInterfaces[sendType] || (isSynchronous_1 ? _sendInterfaces[1 /* EventSendType.Synchronous */] : _sendInterfaces[0 /* EventSendType.Batched */]);\r\n // Sync Fetch has the same payload limitation as sendBeacon -- 64kb limit\r\n var isBeaconTransport = (_isUnloading || _isBeaconPayload(sendType) || (sendInterface && sendInterface._transport === 3 /* TransportType.Beacon */)) && _canUseSendBeaconApi();\r\n while (_canSendPayload(theBatches, sendType, retryCount)) {\r\n var theBatch = theBatches.shift();\r\n if (theBatch && theBatch.count() > 0) {\r\n if (!_killSwitch.isTenantKilled(theBatch.iKey())) {\r\n // Make sure we have a payload object\r\n thePayload = thePayload || _serializer.createPayload(retryCount, isTeardown, isSynchronous_1, isBeaconTransport, sendReason, sendType);\r\n // Add the batch to the current payload\r\n if (!_serializer.appendPayload(thePayload, theBatch, maxEventsPerBatch)) {\r\n // Entire batch was not added so send the payload and retry adding this batch\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n serializationStart = getTime();\r\n theBatches = [theBatch].concat(theBatches);\r\n thePayload = null;\r\n }\r\n else if (thePayload.overflow !== null) {\r\n // Total Payload size was exceeded so send the payload and add the unsent as the next batch to send\r\n theBatches = [thePayload.overflow].concat(theBatches);\r\n thePayload.overflow = null;\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n serializationStart = getTime();\r\n thePayload = null;\r\n }\r\n }\r\n else {\r\n droppedBatches.push(theBatch);\r\n }\r\n }\r\n }\r\n // Make sure to flush any remaining payload\r\n if (thePayload) {\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n }\r\n if (theBatches.length > 0) {\r\n // Add any unsent batches back to the head of the queue\r\n _batchQueue = theBatches.concat(_batchQueue);\r\n }\r\n // Now send notification about any dropped events\r\n _sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, sendType);\r\n }, function () { return ({ batches: _createDebugBatches(orgBatches_1), retryCount: retryCount, isTeardown: isTeardown, isSynchronous: isSynchronous_1, sendReason: sendReason, useSendBeacon: _isBeaconPayload(sendType), sendType: sendType }); }, !isSynchronous_1);\r\n }\r\n catch (ex) {\r\n _throwInternal(_postManager.diagLog(), 2 /* eLoggingSeverity.WARNING */, 48 /* _eInternalMessageId.CannotSerializeObject */, \"Unexpected Exception sending batch: \" + dumpObj(ex));\r\n }\r\n }\r\n function _buildRequestDetails(thePayload, useHeaders) {\r\n var requestDetails = {\r\n url: _urlString,\r\n hdrs: {},\r\n useHdrs: false // Assume no headers\r\n };\r\n if (!useHeaders) {\r\n // Attempt to map headers to a query string if possible\r\n objForEachKey(_headers, function (name, value) {\r\n if (_collectorHeaderToQs[name]) {\r\n _addRequestDetails(requestDetails, _collectorHeaderToQs[name], value, false);\r\n }\r\n else {\r\n // No mapping, so just include in the headers anyway (may not get sent if using sendBeacon())\r\n requestDetails.hdrs[name] = value;\r\n requestDetails.useHdrs = true;\r\n }\r\n });\r\n }\r\n else {\r\n // Copy the pre-defined headers into the payload headers\r\n requestDetails.hdrs = extend(requestDetails.hdrs, _headers);\r\n requestDetails.useHdrs = (objKeys(requestDetails.hdrs).length > 0);\r\n }\r\n _addRequestDetails(requestDetails, strClientId, \"NO_AUTH\", useHeaders);\r\n _addRequestDetails(requestDetails, strClientVersion, FullVersionString, useHeaders);\r\n var apiQsKeys = \"\";\r\n arrForEach(thePayload.apiKeys, function (apiKey) {\r\n if (apiQsKeys.length > 0) {\r\n apiQsKeys += \",\";\r\n }\r\n apiQsKeys += apiKey;\r\n });\r\n _addRequestDetails(requestDetails, strApiKey, apiQsKeys, useHeaders);\r\n _addRequestDetails(requestDetails, strUploadTime, dateNow().toString(), useHeaders);\r\n var msfpc = _getMsfpc(thePayload);\r\n if (isValueAssigned(msfpc)) {\r\n requestDetails.url += \"&ext.intweb.msfpc=\" + msfpc;\r\n }\r\n if (_clockSkewManager.shouldAddClockSkewHeaders()) {\r\n _addRequestDetails(requestDetails, strTimeDeltaToApply, _clockSkewManager.getClockSkewHeaderValue(), useHeaders);\r\n }\r\n if (_core.getWParam) {\r\n var wParam = _core.getWParam();\r\n if (wParam >= 0) {\r\n requestDetails.url += \"&w=\" + wParam;\r\n }\r\n }\r\n for (var i = 0; i < _queryStringParameters.length; i++) {\r\n requestDetails.url += \"&\" + _queryStringParameters[i].name + \"=\" + _queryStringParameters[i].value;\r\n }\r\n return requestDetails;\r\n }\r\n function _canUseSendBeaconApi() {\r\n return !_customHttpInterface && _useBeacons && isBeaconsSupported();\r\n }\r\n function _setTimingValue(timings, name, value) {\r\n timings[name] = timings[name] || {};\r\n timings[name][_postManager.identifier] = value;\r\n }\r\n function _doPayloadSend(thePayload, serializationStart, serializationCompleted, sendReason) {\r\n if (thePayload && thePayload.payloadBlob && thePayload.payloadBlob.length > 0) {\r\n var useSendHook_1 = !!_self.sendHook;\r\n var sendInterface_1 = _sendInterfaces[thePayload.sendType];\r\n // Send all data using a beacon style transport if closing mode is on or channel was teared down\r\n if (!_isBeaconPayload(thePayload.sendType) && thePayload.isBeacon && thePayload.sendReason === 2 /* SendRequestReason.Unload */) {\r\n sendInterface_1 = _sendInterfaces[2 /* EventSendType.SendBeacon */] || _sendInterfaces[3 /* EventSendType.SyncFetch */] || sendInterface_1;\r\n }\r\n var useHeaders_1 = _useHeaders;\r\n // Disable header usage if we know we are using sendBeacon as additional headers are not supported\r\n if (thePayload.isBeacon || sendInterface_1._transport === 3 /* TransportType.Beacon */) {\r\n useHeaders_1 = false;\r\n }\r\n var requestDetails_1 = _buildRequestDetails(thePayload, useHeaders_1);\r\n useHeaders_1 = useHeaders_1 || requestDetails_1.useHdrs;\r\n var sendEventStart_1 = getTime();\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend\"; }, function () {\r\n // Increment the send attempt count and add timings after packaging (So it's not serialized in the 1st attempt)\r\n for (var batchLp = 0; batchLp < thePayload.batches.length; batchLp++) {\r\n var theBatch = thePayload.batches[batchLp];\r\n var theEvents = theBatch.events();\r\n for (var evtLp = 0; evtLp < theEvents.length; evtLp++) {\r\n var telemetryItem = theEvents[evtLp];\r\n if (_enableEventTimings) {\r\n var timings = telemetryItem.timings = telemetryItem.timings || {};\r\n _setTimingValue(timings, \"sendEventStart\", sendEventStart_1);\r\n _setTimingValue(timings, \"serializationStart\", serializationStart);\r\n _setTimingValue(timings, \"serializationCompleted\", serializationCompleted);\r\n }\r\n telemetryItem[strSendAttempt] > 0 ? telemetryItem[strSendAttempt]++ : telemetryItem[strSendAttempt] = 1;\r\n }\r\n }\r\n // Note: always sending this notification in a synchronous manner.\r\n _sendBatchesNotification(thePayload.batches, (1000 /* EventBatchNotificationReason.SendingUndefined */ + (sendReason || 0 /* SendRequestReason.Undefined */)), thePayload.sendType, true);\r\n // Disabling the use of const because of Issue: \r\n // - Task 9227844: [1DS] Some environments and packagers automatically \"freeze\" objects which are defined as const which causes any mutations to throw\r\n // eslint-disable-next-line prefer-const\r\n var orgPayloadData = {\r\n data: thePayload.payloadBlob,\r\n urlString: requestDetails_1.url,\r\n headers: requestDetails_1.hdrs,\r\n _thePayload: thePayload,\r\n _sendReason: sendReason,\r\n timeout: _xhrTimeout\r\n };\r\n if (!isUndefined(_disableXhrSync)) {\r\n orgPayloadData.disableXhrSync = !!_disableXhrSync;\r\n }\r\n // Only automatically add the following headers if already sending headers and we are not attempting to avoid an options call\r\n if (useHeaders_1) {\r\n if (!_hasHeader(orgPayloadData.headers, strCacheControl)) {\r\n orgPayloadData.headers[strCacheControl] = defaultCacheControl;\r\n }\r\n if (!_hasHeader(orgPayloadData.headers, strContentTypeHeader)) {\r\n orgPayloadData.headers[strContentTypeHeader] = defaultContentType;\r\n }\r\n }\r\n var sender = null;\r\n if (sendInterface_1) {\r\n // Send sync requests if the request is immediate or we are tearing down telemetry.\r\n sender = function (payload) {\r\n // Notify the clock skew manager that we are sending the first request (Potentially blocking all further requests)\r\n _clockSkewManager.firstRequestSent();\r\n var onComplete = function (status, headers) {\r\n _retryRequestIfNeeded(status, headers, thePayload, sendReason);\r\n };\r\n var isSync = thePayload.isTeardown || thePayload.isSync;\r\n try {\r\n sendInterface_1.sendPOST(payload, onComplete, isSync);\r\n if (_self.sendListener) {\r\n // Send the original payload to the listener\r\n _self.sendListener(orgPayloadData, payload, isSync, thePayload.isBeacon);\r\n }\r\n }\r\n catch (ex) {\r\n _postManager.diagLog().warnToConsole(\"Unexpected exception sending payload. Ex:\" + dumpObj(ex));\r\n _doOnComplete(onComplete, 0, {});\r\n }\r\n };\r\n }\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend.sender\"; }, function () {\r\n if (sender) {\r\n if (thePayload.sendType === 0 /* EventSendType.Batched */) {\r\n _outstandingRequests++;\r\n }\r\n // Only call the hook if it's defined and we are not using sendBeacon as additional headers are not supported\r\n if (useSendHook_1 && !thePayload.isBeacon && sendInterface_1._transport !== 3 /* TransportType.Beacon */) {\r\n // Create a new IPayloadData that is sent into the hook method, so that the hook method\r\n // can't change the object references to the orgPayloadData (it can still change the content -- mainly the headers)\r\n // Disabling the use of const because of Issue: \r\n // - Task 9227844: [1DS] Some environments and packagers automatically \"freeze\" objects which are defined as const which causes any mutations to throw\r\n // eslint-disable-next-line prefer-const\r\n var hookData_1 = {\r\n data: orgPayloadData.data,\r\n urlString: orgPayloadData.urlString,\r\n headers: extend({}, orgPayloadData.headers),\r\n timeout: orgPayloadData.timeout,\r\n disableXhrSync: orgPayloadData.disableXhrSync\r\n };\r\n var senderCalled_1 = false;\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend.sendHook\"; }, function () {\r\n try {\r\n _self.sendHook(hookData_1, function (payload) {\r\n senderCalled_1 = true;\r\n // Add back the internal properties\r\n if (!_customHttpInterface && !payload._thePayload) {\r\n payload._thePayload = payload._thePayload || orgPayloadData._thePayload;\r\n payload._sendReason = payload._sendReason || orgPayloadData._sendReason;\r\n }\r\n sender(payload);\r\n }, thePayload.isSync || thePayload.isTeardown);\r\n }\r\n catch (ex) {\r\n if (!senderCalled_1) {\r\n // The hook never called the sender -- assume that it never will\r\n sender(orgPayloadData);\r\n }\r\n }\r\n });\r\n }\r\n else {\r\n sender(orgPayloadData);\r\n }\r\n }\r\n });\r\n }, function () { return ({ thePayload: thePayload, serializationStart: serializationStart, serializationCompleted: serializationCompleted, sendReason: sendReason }); }, thePayload.isSync);\r\n }\r\n if (thePayload.sizeExceed && thePayload.sizeExceed.length > 0) {\r\n // Ensure that we send any discard events for oversize events even when there was no payload to send\r\n _sendBatchesNotification(thePayload.sizeExceed, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload.sendType);\r\n }\r\n if (thePayload.failedEvts && thePayload.failedEvts.length > 0) {\r\n // Ensure that we send any discard events for events that could not be serialized even when there was no payload to send\r\n _sendBatchesNotification(thePayload.failedEvts, 8002 /* EventBatchNotificationReason.InvalidEvent */, thePayload.sendType);\r\n }\r\n }\r\n function _addEventCompletedTimings(theEvents, sendEventCompleted) {\r\n if (_enableEventTimings) {\r\n arrForEach(theEvents, function (theEvent) {\r\n var timings = theEvent.timings = theEvent.timings || {};\r\n _setTimingValue(timings, \"sendEventCompleted\", sendEventCompleted);\r\n });\r\n }\r\n }\r\n function _retryRequestIfNeeded(status, headers, thePayload, sendReason) {\r\n var reason = 9000 /* EventBatchNotificationReason.ResponseFailure */;\r\n var droppedBatches = null;\r\n var isRetrying = false;\r\n var backOffTrans = false;\r\n try {\r\n var shouldRetry = true;\r\n if (typeof status !== strUndefined) {\r\n if (headers) {\r\n _clockSkewManager.setClockSkew(headers[strTimeDeltaHeader]);\r\n var killDuration = headers[strKillDurationHeader] || headers[\"kill-duration-seconds\"];\r\n arrForEach(_killSwitch.setKillSwitchTenants(headers[strKillTokensHeader], killDuration), function (killToken) {\r\n arrForEach(thePayload.batches, function (theBatch) {\r\n if (theBatch.iKey() === killToken) {\r\n // Make sure we have initialized the array\r\n droppedBatches = droppedBatches || [];\r\n // Create a copy of the batch with all of the events (and more importantly the action functions)\r\n var removedEvents = theBatch.split(0);\r\n // And then remove the events for the payload batch and reduce the actual number of processed\r\n thePayload.numEvents -= removedEvents.count();\r\n droppedBatches.push(removedEvents);\r\n }\r\n });\r\n });\r\n }\r\n // Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value\r\n // tslint:disable-next-line:triple-equals\r\n if (status == 200 || status == 204) {\r\n // Response was successfully sent\r\n reason = 200 /* EventBatchNotificationReason.Complete */;\r\n return;\r\n }\r\n if (!retryPolicyShouldRetryForStatus(status) || thePayload.numEvents <= 0) {\r\n // Only retry for specific response codes and if there is still events after kill switch processing\r\n shouldRetry = false;\r\n }\r\n // Derive the notification response from the HttpStatus Code\r\n reason = 9000 /* EventBatchNotificationReason.ResponseFailure */ + (status % 1000);\r\n }\r\n if (shouldRetry) {\r\n // The events should be retried -- so change notification to requeue them\r\n reason = 100 /* EventBatchNotificationReason.RequeueEvents */;\r\n var retryCount_1 = thePayload.retryCnt;\r\n if (thePayload.sendType === 0 /* EventSendType.Batched */) {\r\n // attempt to resend the entire batch\r\n if (retryCount_1 < maxRequestRetriesBeforeBackoff) {\r\n isRetrying = true;\r\n _doAction(function () {\r\n // try to resend the same batches\r\n if (thePayload.sendType === 0 /* EventSendType.Batched */) {\r\n // Reduce the outstanding request count (if this was an async request) as we didn't reduce the count\r\n // previously and we are about to reschedule our retry attempt and we want an attempt to send\r\n // to occur, it's also required to ensure that a follow up handleRequestFinished() call occurs\r\n _outstandingRequests--;\r\n }\r\n _sendBatches(thePayload.batches, retryCount_1 + 1, thePayload.isTeardown, _isUnloading ? 2 /* EventSendType.SendBeacon */ : thePayload.sendType, 5 /* SendRequestReason.Retry */);\r\n }, _isUnloading, retryPolicyGetMillisToBackoffForRetry(retryCount_1));\r\n }\r\n else {\r\n backOffTrans = true;\r\n if (_isUnloading) {\r\n // we are unloading so don't try and requeue the events otherwise let the events get requeued and resent during the backoff sending\r\n // This will also cause the events to be purged based on the priority (if necessary)\r\n reason = 8001 /* EventBatchNotificationReason.NonRetryableStatus */;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n if (!isRetrying) {\r\n // Make sure the clockSkewManager doesn't blocking further sending of requests once we have a proper response\r\n // This won't override any previously sent clock Skew value\r\n _clockSkewManager.setClockSkew();\r\n _handleRequestFinished(thePayload, reason, sendReason, backOffTrans);\r\n }\r\n _sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, thePayload.sendType);\r\n }\r\n }\r\n function _handleRequestFinished(thePayload, batchReason, sendReason, backOffTrans) {\r\n try {\r\n if (backOffTrans) {\r\n // Slow down the transmission requests\r\n _postManager._backOffTransmission();\r\n }\r\n if (batchReason === 200 /* EventBatchNotificationReason.Complete */) {\r\n if (!backOffTrans && !thePayload.isSync) {\r\n // We have a successful async response, so the lets open the floodgates\r\n // The reason for checking isSync is to avoid unblocking if beacon send occurred as it\r\n // doesn't wait for a response.\r\n _postManager._clearBackOff();\r\n }\r\n _addCompleteTimings(thePayload.batches);\r\n }\r\n // Send the notifications synchronously\r\n _sendBatchesNotification(thePayload.batches, batchReason, thePayload.sendType, true);\r\n }\r\n finally {\r\n if (thePayload.sendType === 0 /* EventSendType.Batched */) {\r\n // we always need to decrement this value otherwise the httpmanager locks up and won't send any more events\r\n _outstandingRequests--;\r\n // Don't try to send additional queued events if this is a retry operation as the retried\r\n // response will eventually call _handleRequestFinished for the retried event\r\n if (sendReason !== 5 /* SendRequestReason.Retry */) {\r\n // Try and send any other queued batched events\r\n _self.sendQueuedRequests(thePayload.sendType, sendReason);\r\n }\r\n }\r\n }\r\n }\r\n function _addCompleteTimings(theBatches) {\r\n if (_enableEventTimings) {\r\n var sendEventCompleted_1 = getTime();\r\n arrForEach(theBatches, function (theBatch) {\r\n if (theBatch && theBatch.count() > 0) {\r\n _addEventCompletedTimings(theBatch.events(), sendEventCompleted_1);\r\n }\r\n });\r\n }\r\n }\r\n function _doAction(cb, isSync, interval) {\r\n if (isSync) {\r\n cb();\r\n }\r\n else {\r\n timeoutOverride.set(cb, interval);\r\n }\r\n }\r\n /**\r\n * Converts the XHR getAllResponseHeaders to a map containing the header key and value.\r\n */\r\n // tslint:disable-next-line: align\r\n function _convertAllHeadersToMap(headersString) {\r\n var headers = {};\r\n if (isString(headersString)) {\r\n var headersArray = strTrim(headersString).split(/[\\r\\n]+/);\r\n arrForEach(headersArray, function (headerEntry) {\r\n if (headerEntry) {\r\n var idx = headerEntry.indexOf(\": \");\r\n if (idx !== -1) {\r\n // The new spec has the headers returning all as lowercase -- but not all browsers do this yet\r\n var header = strTrim(headerEntry.substring(0, idx)).toLowerCase();\r\n var value = strTrim(headerEntry.substring(idx + 1));\r\n headers[header] = value;\r\n }\r\n else {\r\n headers[strTrim(headerEntry)] = 1;\r\n }\r\n }\r\n });\r\n }\r\n return headers;\r\n }\r\n function _getMsfpc(thePayload) {\r\n for (var lp = 0; lp < thePayload.batches.length; lp++) {\r\n var msfpc = thePayload.batches[lp].Msfpc();\r\n if (msfpc) {\r\n return encodeURIComponent(msfpc);\r\n }\r\n }\r\n return \"\";\r\n }\r\n function _handleCollectorResponse(responseText) {\r\n var responseHandlers = _self._responseHandlers;\r\n try {\r\n for (var i = 0; i < responseHandlers.length; i++) {\r\n try {\r\n responseHandlers[i](responseText);\r\n }\r\n catch (e) {\r\n _throwInternal(_postManager.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 519 /* _eExtendedInternalMessageId.PostResponseHandler */, \"Response handler failed: \" + e);\r\n }\r\n }\r\n if (responseText) {\r\n var response = JSON.parse(responseText);\r\n if (isValueAssigned(response.webResult) && isValueAssigned(response.webResult[strMsfpc])) {\r\n // Set cookie\r\n _cookieMgr.set(\"MSFPC\", response.webResult[strMsfpc], 365 * 86400);\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n // Doing nothing\r\n }\r\n }\r\n function _sendBatchesNotification(theBatches, batchReason, sendType, sendSync) {\r\n if (theBatches && theBatches.length > 0 && actions) {\r\n var theAction_1 = actions[_getNotificationAction(batchReason)];\r\n if (theAction_1) {\r\n var isSyncRequest_1 = sendType !== 0 /* EventSendType.Batched */;\r\n doPerf(_core, function () { return \"HttpManager:_sendBatchesNotification\"; }, function () {\r\n _doAction(function () {\r\n try {\r\n theAction_1.call(actions, theBatches, batchReason, isSyncRequest_1, sendType);\r\n }\r\n catch (e) {\r\n _throwInternal(_postManager.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 74 /* _eInternalMessageId.NotificationException */, \"send request notification failed: \" + e);\r\n }\r\n }, sendSync || isSyncRequest_1, 0);\r\n }, function () { return ({ batches: _createDebugBatches(theBatches), reason: batchReason, isSync: isSyncRequest_1, sendSync: sendSync, sendType: sendType }); }, !isSyncRequest_1);\r\n }\r\n }\r\n }\r\n function _getNotificationAction(reason) {\r\n var action = _eventActionMap[reason];\r\n if (!isValueAssigned(action)) {\r\n action = strOther;\r\n if (reason >= 9000 /* EventBatchNotificationReason.ResponseFailure */ && reason <= 9999 /* EventBatchNotificationReason.ResponseFailureMax */) {\r\n action = strResponseFail;\r\n }\r\n else if (reason >= 8000 /* EventBatchNotificationReason.EventsDropped */ && reason <= 8999 /* EventBatchNotificationReason.EventsDroppedMax */) {\r\n action = strDropped;\r\n }\r\n else if (reason >= 1000 /* EventBatchNotificationReason.SendingUndefined */ && reason <= 1999 /* EventBatchNotificationReason.SendingEventMax */) {\r\n action = strSending;\r\n }\r\n }\r\n return action;\r\n }\r\n });\r\n }\r\n// Removed Stub for HttpManager.prototype.initialize.\r\n// Removed Stub for HttpManager.prototype.addQueryStringParameter.\r\n// Removed Stub for HttpManager.prototype.addHeader.\r\n// Removed Stub for HttpManager.prototype.addBatch.\r\n// Removed Stub for HttpManager.prototype.canSendRequest.\r\n// Removed Stub for HttpManager.prototype.sendQueuedRequests.\r\n// Removed Stub for HttpManager.prototype.isCompletelyIdle.\r\n// Removed Stub for HttpManager.prototype.setUnloading.\r\n// Removed Stub for HttpManager.prototype.teardown.\r\n// Removed Stub for HttpManager.prototype.pause.\r\n// Removed Stub for HttpManager.prototype.resume.\r\n// Removed Stub for HttpManager.prototype.sendSynchronousBatch.\r\n return HttpManager;\r\n}());\r\nexport { HttpManager };\r\n//# sourceMappingURL=HttpManager.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* ClockSkewManager.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\n/**\r\n* Class to manage clock skew correction.\r\n*/\r\nvar ClockSkewManager = /** @class */ (function () {\r\n function ClockSkewManager() {\r\n var _allowRequestSending = true;\r\n var _shouldAddClockSkewHeaders = true;\r\n var _isFirstRequest = true;\r\n var _clockSkewHeaderValue = \"use-collector-delta\";\r\n var _clockSkewSet = false;\r\n dynamicProto(ClockSkewManager, this, function (_self) {\r\n /**\r\n * Determine if requests can be sent.\r\n * @returns True if requests can be sent, false otherwise.\r\n */\r\n _self.allowRequestSending = function () {\r\n return _allowRequestSending;\r\n };\r\n /**\r\n * Tells the ClockSkewManager that it should assume that the first request has now been sent,\r\n * If this method had not yet been called AND the clock Skew had not been set this will set\r\n * allowRequestSending to false until setClockSet() is called.\r\n */\r\n _self.firstRequestSent = function () {\r\n if (_isFirstRequest) {\r\n _isFirstRequest = false;\r\n if (!_clockSkewSet) {\r\n // Block sending until we get the first clock Skew\r\n _allowRequestSending = false;\r\n }\r\n }\r\n };\r\n /**\r\n * Determine if clock skew headers should be added to the request.\r\n * @returns True if clock skew headers should be added, false otherwise.\r\n */\r\n _self.shouldAddClockSkewHeaders = function () {\r\n return _shouldAddClockSkewHeaders;\r\n };\r\n /**\r\n * Gets the clock skew header value.\r\n * @returns The clock skew header value.\r\n */\r\n _self.getClockSkewHeaderValue = function () {\r\n return _clockSkewHeaderValue;\r\n };\r\n /**\r\n * Sets the clock skew header value. Once clock skew is set this method\r\n * is no-op.\r\n * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.\r\n */\r\n _self.setClockSkew = function (timeDeltaInMillis) {\r\n if (!_clockSkewSet) {\r\n if (timeDeltaInMillis) {\r\n _clockSkewHeaderValue = timeDeltaInMillis;\r\n _shouldAddClockSkewHeaders = true;\r\n _clockSkewSet = true;\r\n }\r\n else {\r\n _shouldAddClockSkewHeaders = false;\r\n }\r\n // Unblock sending\r\n _allowRequestSending = true;\r\n }\r\n };\r\n });\r\n }\r\n// Removed Stub for ClockSkewManager.prototype.allowRequestSending.\r\n// Removed Stub for ClockSkewManager.prototype.firstRequestSent.\r\n// Removed Stub for ClockSkewManager.prototype.shouldAddClockSkewHeaders.\r\n// Removed Stub for ClockSkewManager.prototype.getClockSkewHeaderValue.\r\n// Removed Stub for ClockSkewManager.prototype.setClockSkew.\r\n return ClockSkewManager;\r\n}());\r\nexport default ClockSkewManager;\r\n//# sourceMappingURL=ClockSkewManager.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nexport var Method = \"POST\";\r\nexport var DisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nexport var strDropped = \"drop\";\r\nexport var strSending = \"send\";\r\nexport var strRequeue = \"requeue\";\r\nexport var strResponseFail = \"rspFail\";\r\nexport var strOther = \"oth\";\r\nexport var defaultCacheControl = \"no-cache, no-store\";\r\nexport var defaultContentType = \"application/x-json-stream\";\r\nexport var strCacheControl = \"cache-control\";\r\nexport var strContentTypeHeader = \"content-type\";\r\nexport var strKillTokensHeader = \"kill-tokens\";\r\nexport var strKillDurationHeader = \"kill-duration\";\r\nexport var strKillDurationSecondsHeader = \"kill-duration-seconds\";\r\nexport var strTimeDeltaHeader = \"time-delta-millis\";\r\nexport var strClientVersion = \"client-version\";\r\nexport var strClientId = \"client-id\";\r\nexport var strTimeDeltaToApply = \"time-delta-to-apply-millis\";\r\nexport var strUploadTime = \"upload-time\";\r\nexport var strApiKey = \"apikey\";\r\nexport var strMsaDeviceTicket = \"AuthMsaDeviceTicket\";\r\nexport var strAuthXToken = \"AuthXToken\";\r\nexport var strSdkVersion = \"sdk-version\";\r\nexport var strNoResponseBody = \"NoResponseBody\";\r\nexport var strMsfpc = \"msfpc\";\r\n//# sourceMappingURL=Constants.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n * TimeoutOverrideWrapper.ts\r\n * @author Nev Wylie (newylie)\r\n * @copyright Microsoft 2022\r\n * Simple internal timeout wrapper\r\n */\r\nexport function defaultSetTimeout(callback, ms) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n return setTimeout(callback, ms, args);\r\n}\r\nexport function defaultClearTimeout(timeoutId) {\r\n clearTimeout(timeoutId);\r\n}\r\nexport function createTimeoutWrapper(argSetTimeout, argClearTimeout) {\r\n return {\r\n set: argSetTimeout || defaultSetTimeout,\r\n clear: argClearTimeout || defaultClearTimeout\r\n };\r\n}\r\n//# sourceMappingURL=TimeoutOverrideWrapper.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\n/**\r\n* PostManager.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin, EventsDiscardedReason, isValueAssigned, setProcessTelemetryTimings, arrForEach, doPerf, objForEachKey, optimizeObject, isChromium, getWindow, isNumber, mergeEvtNamespace, createUniqueNamespace, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, _throwInternal, objDefineAccessors } from \"@microsoft/1ds-core-js\";\r\nimport { RT_PROFILE, NRT_PROFILE, BE_PROFILE, } from \"./DataModels\";\r\nimport { EventBatch } from \"./EventBatch\";\r\nimport { HttpManager } from \"./HttpManager\";\r\nimport { retryPolicyGetMillisToBackoffForRetry } from \"./RetryPolicy\";\r\nimport { strMsaDeviceTicket } from \"./Constants\";\r\nimport { createTimeoutWrapper } from \"./TimeoutOverrideWrapper\";\r\nvar FlushCheckTimer = 0.250; // This needs to be in seconds, so this is 250ms\r\nvar MaxNumberEventPerBatch = 500;\r\nvar EventsDroppedAtOneTime = 20;\r\nvar MaxSendAttempts = 6;\r\nvar MaxSyncUnloadSendAttempts = 2; // Assuming 2 based on beforeunload and unload\r\nvar MaxBackoffCount = 4;\r\nvar MaxConnections = 2;\r\nvar MaxRequestRetriesBeforeBackoff = 1;\r\nvar strEventsDiscarded = \"eventsDiscarded\";\r\nvar strOverrideInstrumentationKey = \"overrideInstrumentationKey\";\r\nvar strMaxEventRetryAttempts = \"maxEventRetryAttempts\";\r\nvar strMaxUnloadEventRetryAttempts = \"maxUnloadEventRetryAttempts\";\r\nvar strAddUnloadCb = \"addUnloadCb\";\r\n/**\r\n * Class that manages adding events to inbound queues and batching of events\r\n * into requests.\r\n */\r\nvar PostChannel = /** @class */ (function (_super) {\r\n __extends(PostChannel, _super);\r\n function PostChannel() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"PostChannel\";\r\n _this.priority = 1011;\r\n _this.version = '3.2.3';\r\n var _config;\r\n var _isTeardownCalled = false;\r\n var _flushCallbackQueue = [];\r\n var _flushCallbackTimerId = null;\r\n var _paused = false;\r\n var _immediateQueueSize = 0;\r\n var _immediateQueueSizeLimit = 500;\r\n var _queueSize = 0;\r\n var _queueSizeLimit = 10000;\r\n var _profiles = {};\r\n var _currentProfile = RT_PROFILE;\r\n var _scheduledTimerId = null;\r\n var _immediateTimerId = null;\r\n var _currentBackoffCount = 0;\r\n var _timerCount = 0;\r\n var _xhrOverride;\r\n var _httpManager;\r\n var _batchQueues = {};\r\n var _autoFlushEventsLimit;\r\n // either MaxBatchSize * (1+ Max Connections) or _queueLimit / 6 (where 3 latency Queues [normal, realtime, cost deferred] * 2 [allow half full -- allow for retry])\r\n var _autoFlushBatchLimit;\r\n var _delayedBatchSendLatency = -1;\r\n var _delayedBatchReason;\r\n var _optimizeObject = true;\r\n var _isPageUnloadTriggered = false;\r\n var _maxEventSendAttempts = MaxSendAttempts;\r\n var _maxUnloadEventSendAttempts = MaxSyncUnloadSendAttempts;\r\n var _evtNamespace;\r\n var _timeoutWrapper;\r\n dynamicProto(PostChannel, _this, function (_self, _base) {\r\n _initDefaults();\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_httpManager];\r\n };\r\n _self.initialize = function (coreConfig, core, extensions) {\r\n doPerf(core, function () { return \"PostChannel:initialize\"; }, function () {\r\n var extendedCore = core;\r\n _base.initialize(coreConfig, core, extensions);\r\n try {\r\n var hasAddUnloadCb = !!core[strAddUnloadCb];\r\n _evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self.identifier), core.evtNamespace && core.evtNamespace());\r\n var ctx = _self._getTelCtx();\r\n coreConfig.extensionConfig[_self.identifier] = coreConfig.extensionConfig[_self.identifier] || {};\r\n _config = ctx.getExtCfg(_self.identifier);\r\n _timeoutWrapper = createTimeoutWrapper(_config.setTimeoutOverride, _config.clearTimeoutOverride);\r\n // Only try and use the optimizeObject() if this appears to be a chromium based browser and it has not been explicitly disabled\r\n _optimizeObject = !_config.disableOptimizeObj && isChromium();\r\n _hookWParam(extendedCore);\r\n if (_config.eventsLimitInMem > 0) {\r\n _queueSizeLimit = _config.eventsLimitInMem;\r\n }\r\n if (_config.immediateEventLimit > 0) {\r\n _immediateQueueSizeLimit = _config.immediateEventLimit;\r\n }\r\n if (_config.autoFlushEventsLimit > 0) {\r\n _autoFlushEventsLimit = _config.autoFlushEventsLimit;\r\n }\r\n if (isNumber(_config[strMaxEventRetryAttempts])) {\r\n _maxEventSendAttempts = _config[strMaxEventRetryAttempts];\r\n }\r\n if (isNumber(_config[strMaxUnloadEventRetryAttempts])) {\r\n _maxUnloadEventSendAttempts = _config[strMaxUnloadEventRetryAttempts];\r\n }\r\n _setAutoLimits();\r\n if (_config.httpXHROverride && _config.httpXHROverride.sendPOST) {\r\n _xhrOverride = _config.httpXHROverride;\r\n }\r\n if (isValueAssigned(coreConfig.anonCookieName)) {\r\n _httpManager.addQueryStringParameter(\"anoncknm\", coreConfig.anonCookieName);\r\n }\r\n _httpManager.sendHook = _config.payloadPreprocessor;\r\n _httpManager.sendListener = _config.payloadListener;\r\n // Override endpointUrl if provided in Post config\r\n var endpointUrl = _config.overrideEndpointUrl ? _config.overrideEndpointUrl : coreConfig.endpointUrl;\r\n _self._notificationManager = coreConfig.extensionConfig.NotificationManager;\r\n _httpManager.initialize(endpointUrl, _self.core, _self, _xhrOverride, _config);\r\n var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents || [];\r\n // When running in Web browsers try to send all telemetry if page is unloaded\r\n addPageUnloadEventListener(_handleUnloadEvents, excludePageUnloadEvents, _evtNamespace);\r\n addPageHideEventListener(_handleUnloadEvents, excludePageUnloadEvents, _evtNamespace);\r\n addPageShowEventListener(_handleShowEvents, coreConfig.disablePageShowEvents, _evtNamespace);\r\n }\r\n catch (e) {\r\n // resetting the initialized state because of failure\r\n _self.setInitialized(false);\r\n throw e;\r\n }\r\n }, function () { return ({ coreConfig: coreConfig, core: core, extensions: extensions }); });\r\n };\r\n _self.processTelemetry = function (ev, itemCtx) {\r\n setProcessTelemetryTimings(ev, _self.identifier);\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n // Get the channel instance from the current request/instance\r\n var channelConfig = itemCtx.getExtCfg(_self.identifier);\r\n // DisableTelemetry was defined in the config provided during initialization\r\n var disableTelemetry = !!_config.disableTelemetry;\r\n if (channelConfig) {\r\n // DisableTelemetry is defined in the config for this request/instance\r\n disableTelemetry = disableTelemetry || !!channelConfig.disableTelemetry;\r\n }\r\n var event = ev;\r\n if (!disableTelemetry && !_isTeardownCalled) {\r\n // Override iKey if provided in Post config if provided for during initialization\r\n if (_config[strOverrideInstrumentationKey]) {\r\n event.iKey = _config[strOverrideInstrumentationKey];\r\n }\r\n // Override iKey if provided in Post config if provided for this instance\r\n if (channelConfig && channelConfig[strOverrideInstrumentationKey]) {\r\n event.iKey = channelConfig[strOverrideInstrumentationKey];\r\n }\r\n _addEventToQueues(event, true);\r\n if (_isPageUnloadTriggered) {\r\n // Unload event has been received so we need to try and flush new events\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n else {\r\n _scheduleTimer();\r\n }\r\n }\r\n _self.processNext(event, itemCtx);\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n _isTeardownCalled = true;\r\n _httpManager.teardown();\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n removePageShowEventListener(null, _evtNamespace);\r\n // Just register to remove all events associated with this namespace\r\n _initDefaults();\r\n };\r\n function _hookWParam(extendedCore) {\r\n var existingGetWParamMethod = extendedCore.getWParam;\r\n extendedCore.getWParam = function () {\r\n var wparam = 0;\r\n if (_config.ignoreMc1Ms0CookieProcessing) {\r\n wparam = wparam | 2;\r\n }\r\n return wparam | existingGetWParamMethod();\r\n };\r\n }\r\n // Moving event handlers out from the initialize closure so that any local variables can be garbage collected\r\n function _handleUnloadEvents(evt) {\r\n var theEvt = evt || getWindow().event; // IE 8 does not pass the event\r\n if (theEvt.type !== \"beforeunload\") {\r\n // Only set the unload trigger if not beforeunload event as beforeunload can be cancelled while the other events can't\r\n _isPageUnloadTriggered = true;\r\n _httpManager.setUnloading(_isPageUnloadTriggered);\r\n }\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n function _handleShowEvents(evt) {\r\n // Handle the page becoming visible again\r\n _isPageUnloadTriggered = false;\r\n _httpManager.setUnloading(_isPageUnloadTriggered);\r\n }\r\n function _addEventToQueues(event, append) {\r\n // If send attempt field is undefined we should set it to 0.\r\n if (!event.sendAttempt) {\r\n event.sendAttempt = 0;\r\n }\r\n // Add default latency\r\n if (!event.latency) {\r\n event.latency = 1 /* EventLatencyValue.Normal */;\r\n }\r\n // Remove extra AI properties if present\r\n if (event.ext && event.ext[\"trace\"]) {\r\n delete (event.ext[\"trace\"]);\r\n }\r\n if (event.ext && event.ext[\"user\"] && event.ext[\"user\"][\"id\"]) {\r\n delete (event.ext[\"user\"][\"id\"]);\r\n }\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n event.ext = optimizeObject(event.ext);\r\n if (event.baseData) {\r\n event.baseData = optimizeObject(event.baseData);\r\n }\r\n if (event.data) {\r\n event.data = optimizeObject(event.data);\r\n }\r\n }\r\n if (event.sync) {\r\n // If the transmission is backed off then do not send synchronous events.\r\n // We will convert these events to Real time latency instead.\r\n if (_currentBackoffCount || _paused) {\r\n event.latency = 3 /* EventLatencyValue.RealTime */;\r\n event.sync = false;\r\n }\r\n else {\r\n // Log the event synchronously\r\n if (_httpManager) {\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n event = optimizeObject(event);\r\n }\r\n _httpManager.sendSynchronousBatch(EventBatch.create(event.iKey, [event]), event.sync === true ? 1 /* EventSendType.Synchronous */ : event.sync, 3 /* SendRequestReason.SyncEvent */);\r\n return;\r\n }\r\n }\r\n }\r\n var evtLatency = event.latency;\r\n var queueSize = _queueSize;\r\n var queueLimit = _queueSizeLimit;\r\n if (evtLatency === 4 /* EventLatencyValue.Immediate */) {\r\n queueSize = _immediateQueueSize;\r\n queueLimit = _immediateQueueSizeLimit;\r\n }\r\n var eventDropped = false;\r\n // Only add the event if the queue isn't full or it's a direct event (which don't add to the queue sizes)\r\n if (queueSize < queueLimit) {\r\n eventDropped = !_addEventToProperQueue(event, append);\r\n }\r\n else {\r\n var dropLatency = 1 /* EventLatencyValue.Normal */;\r\n var dropNumber = EventsDroppedAtOneTime;\r\n if (evtLatency === 4 /* EventLatencyValue.Immediate */) {\r\n // Only drop other immediate events as they are not technically sharing the general queue\r\n dropLatency = 4 /* EventLatencyValue.Immediate */;\r\n dropNumber = 1;\r\n }\r\n // Drop old event from lower or equal latency\r\n eventDropped = true;\r\n if (_dropEventWithLatencyOrLess(event.iKey, event.latency, dropLatency, dropNumber)) {\r\n eventDropped = !_addEventToProperQueue(event, append);\r\n }\r\n }\r\n if (eventDropped) {\r\n // Can't drop events from current queues because the all the slots are taken by queues that are being flushed.\r\n _notifyEvents(strEventsDiscarded, [event], EventsDiscardedReason.QueueFull);\r\n }\r\n }\r\n _self.setEventQueueLimits = function (eventLimit, autoFlushLimit) {\r\n _queueSizeLimit = eventLimit > 0 ? eventLimit : 10000;\r\n _autoFlushEventsLimit = autoFlushLimit > 0 ? autoFlushLimit : 0;\r\n _setAutoLimits();\r\n // We only do this check here as during normal event addition if the queue is > then events start getting dropped\r\n var doFlush = _queueSize > eventLimit;\r\n if (!doFlush && _autoFlushBatchLimit > 0) {\r\n // Check the auto flush max batch size\r\n for (var latency = 1 /* EventLatencyValue.Normal */; !doFlush && latency <= 3 /* EventLatencyValue.RealTime */; latency++) {\r\n var batchQueue = _batchQueues[latency];\r\n if (batchQueue && batchQueue.batches) {\r\n arrForEach(batchQueue.batches, function (theBatch) {\r\n if (theBatch && theBatch.count() >= _autoFlushBatchLimit) {\r\n // If any 1 batch is > than the limit then trigger an auto flush\r\n doFlush = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n _performAutoFlush(true, doFlush);\r\n };\r\n _self.pause = function () {\r\n _clearScheduledTimer();\r\n _paused = true;\r\n _httpManager.pause();\r\n };\r\n _self.resume = function () {\r\n _paused = false;\r\n _httpManager.resume();\r\n _scheduleTimer();\r\n };\r\n _self.addResponseHandler = function (responseHandler) {\r\n _httpManager._responseHandlers.push(responseHandler);\r\n };\r\n _self._loadTransmitProfiles = function (profiles) {\r\n _resetTransmitProfiles();\r\n objForEachKey(profiles, function (profileName, profileValue) {\r\n var profLen = profileValue.length;\r\n if (profLen >= 2) {\r\n var directValue = (profLen > 2 ? profileValue[2] : 0);\r\n profileValue.splice(0, profLen - 2);\r\n // Make sure if a higher latency is set to not send then don't send lower latency\r\n if (profileValue[1] < 0) {\r\n profileValue[0] = -1;\r\n }\r\n // Make sure each latency is multiple of the latency higher then it. If not a multiple\r\n // we round up so that it becomes a multiple.\r\n if (profileValue[1] > 0 && profileValue[0] > 0) {\r\n var timerMultiplier = profileValue[0] / profileValue[1];\r\n profileValue[0] = Math.ceil(timerMultiplier) * profileValue[1];\r\n }\r\n // Add back the direct profile timeout\r\n if (directValue >= 0 && profileValue[1] >= 0 && directValue > profileValue[1]) {\r\n // Make sure if it's not disabled (< 0) then make sure it's not larger than RealTime\r\n directValue = profileValue[1];\r\n }\r\n profileValue.push(directValue);\r\n _profiles[profileName] = profileValue;\r\n }\r\n });\r\n };\r\n _self.flush = function (async, callback, sendReason) {\r\n if (async === void 0) { async = true; }\r\n if (!_paused) {\r\n sendReason = sendReason || 1 /* SendRequestReason.ManualFlush */;\r\n if (async) {\r\n if (_flushCallbackTimerId == null) {\r\n // Clear the normal schedule timer as we are going to try and flush ASAP\r\n _clearScheduledTimer();\r\n // Move all queued events to the HttpManager so that we don't discard new events (Auto flush scenario)\r\n _queueBatches(1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, sendReason);\r\n _flushCallbackTimerId = _createTimer(function () {\r\n _flushCallbackTimerId = null;\r\n _flushImpl(callback, sendReason);\r\n }, 0);\r\n }\r\n else {\r\n // Even if null (no callback) this will ensure after the flushImpl finishes waiting\r\n // for a completely idle connection it will attempt to re-flush any queued events on the next cycle\r\n _flushCallbackQueue.push(callback);\r\n }\r\n }\r\n else {\r\n // Clear the normal schedule timer as we are going to try and flush ASAP\r\n var cleared = _clearScheduledTimer();\r\n // Now cause all queued events to be sent synchronously\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, 1 /* EventSendType.Synchronous */, sendReason);\r\n if (callback !== null && callback !== undefined) {\r\n callback();\r\n }\r\n if (cleared) {\r\n // restart the normal event timer if it was cleared\r\n _scheduleTimer();\r\n }\r\n }\r\n }\r\n };\r\n _self.setMsaAuthTicket = function (ticket) {\r\n _httpManager.addHeader(strMsaDeviceTicket, ticket);\r\n };\r\n _self.hasEvents = _hasEvents;\r\n _self._setTransmitProfile = function (profileName) {\r\n if (_currentProfile !== profileName && _profiles[profileName] !== undefined) {\r\n _clearScheduledTimer();\r\n _currentProfile = profileName;\r\n _scheduleTimer();\r\n }\r\n };\r\n /**\r\n * Batch and send events currently in the queue for the given latency.\r\n * @param latency - Latency for which to send events.\r\n */\r\n function _sendEventsForLatencyAndAbove(latency, sendType, sendReason) {\r\n var queued = _queueBatches(latency, sendType, sendReason);\r\n // Always trigger the request as while the post channel may not have queued additional events, the httpManager may already have waiting events\r\n _httpManager.sendQueuedRequests(sendType, sendReason);\r\n return queued;\r\n }\r\n function _hasEvents() {\r\n return _queueSize > 0;\r\n }\r\n /**\r\n * Try to schedule the timer after which events will be sent. If there are\r\n * no events to be sent, or there is already a timer scheduled, or the\r\n * http manager doesn't have any idle connections this method is no-op.\r\n */\r\n function _scheduleTimer() {\r\n // If we had previously attempted to send requests, but the http manager didn't have any idle connections then the requests where delayed\r\n // so try and requeue then again now\r\n if (_delayedBatchSendLatency >= 0 && _queueBatches(_delayedBatchSendLatency, 0 /* EventSendType.Batched */, _delayedBatchReason)) {\r\n _httpManager.sendQueuedRequests(0 /* EventSendType.Batched */, _delayedBatchReason);\r\n }\r\n if (_immediateQueueSize > 0 && !_immediateTimerId && !_paused) {\r\n // During initialization _profiles enforce that the direct [2] is less than real time [1] timer value\r\n // If the immediateTimeout is disabled the immediate events will be sent with Real Time events\r\n var immediateTimeOut = _profiles[_currentProfile][2];\r\n if (immediateTimeOut >= 0) {\r\n _immediateTimerId = _createTimer(function () {\r\n _immediateTimerId = null;\r\n // Only try to send direct events\r\n _sendEventsForLatencyAndAbove(4 /* EventLatencyValue.Immediate */, 0 /* EventSendType.Batched */, 1 /* SendRequestReason.NormalSchedule */);\r\n _scheduleTimer();\r\n }, immediateTimeOut);\r\n }\r\n }\r\n // During initialization the _profiles enforce that the normal [0] is a multiple of the real time [1] timer value\r\n var timeOut = _profiles[_currentProfile][1];\r\n if (!_scheduledTimerId && !_flushCallbackTimerId && timeOut >= 0 && !_paused) {\r\n if (_hasEvents()) {\r\n _scheduledTimerId = _createTimer(function () {\r\n _scheduledTimerId = null;\r\n _sendEventsForLatencyAndAbove(_timerCount === 0 ? 3 /* EventLatencyValue.RealTime */ : 1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, 1 /* SendRequestReason.NormalSchedule */);\r\n // Increment the count for next cycle\r\n _timerCount++;\r\n _timerCount %= 2;\r\n _scheduleTimer();\r\n }, timeOut);\r\n }\r\n else {\r\n _timerCount = 0;\r\n }\r\n }\r\n }\r\n _self._backOffTransmission = function () {\r\n if (_currentBackoffCount < MaxBackoffCount) {\r\n _currentBackoffCount++;\r\n _clearScheduledTimer();\r\n _scheduleTimer();\r\n }\r\n };\r\n _self._clearBackOff = function () {\r\n if (_currentBackoffCount) {\r\n _currentBackoffCount = 0;\r\n _clearScheduledTimer();\r\n _scheduleTimer();\r\n }\r\n };\r\n function _initDefaults() {\r\n _config = null;\r\n _isTeardownCalled = false;\r\n _flushCallbackQueue = [];\r\n _flushCallbackTimerId = null;\r\n _paused = false;\r\n _immediateQueueSize = 0;\r\n _immediateQueueSizeLimit = 500;\r\n _queueSize = 0;\r\n _queueSizeLimit = 10000;\r\n _profiles = {};\r\n _currentProfile = RT_PROFILE;\r\n _scheduledTimerId = null;\r\n _immediateTimerId = null;\r\n _currentBackoffCount = 0;\r\n _timerCount = 0;\r\n _xhrOverride = null;\r\n _batchQueues = {};\r\n _autoFlushEventsLimit = undefined;\r\n // either MaxBatchSize * (1+ Max Connections) or _queueLimit / 6 (where 3 latency Queues [normal, realtime, cost deferred] * 2 [allow half full -- allow for retry])\r\n _autoFlushBatchLimit = 0;\r\n _delayedBatchSendLatency = -1;\r\n _delayedBatchReason = null;\r\n _optimizeObject = true;\r\n _isPageUnloadTriggered = false;\r\n _maxEventSendAttempts = MaxSendAttempts;\r\n _maxUnloadEventSendAttempts = MaxSyncUnloadSendAttempts;\r\n _evtNamespace = null;\r\n _timeoutWrapper = createTimeoutWrapper();\r\n _httpManager = new HttpManager(MaxNumberEventPerBatch, MaxConnections, MaxRequestRetriesBeforeBackoff, {\r\n requeue: _requeueEvents,\r\n send: _sendingEvent,\r\n sent: _eventsSentEvent,\r\n drop: _eventsDropped,\r\n rspFail: _eventsResponseFail,\r\n oth: _otherEvent\r\n }, _timeoutWrapper);\r\n _initializeProfiles();\r\n _clearQueues();\r\n _setAutoLimits();\r\n }\r\n function _createTimer(theTimerFunc, timeOut) {\r\n // If the transmission is backed off make the timer at least 1 sec to allow for back off.\r\n if (timeOut === 0 && _currentBackoffCount) {\r\n timeOut = 1;\r\n }\r\n var timerMultiplier = 1000;\r\n if (_currentBackoffCount) {\r\n timerMultiplier = retryPolicyGetMillisToBackoffForRetry(_currentBackoffCount - 1);\r\n }\r\n return _timeoutWrapper.set(theTimerFunc, timeOut * timerMultiplier);\r\n }\r\n function _clearScheduledTimer() {\r\n if (_scheduledTimerId !== null) {\r\n _timeoutWrapper.clear(_scheduledTimerId);\r\n _scheduledTimerId = null;\r\n _timerCount = 0;\r\n return true;\r\n }\r\n return false;\r\n }\r\n // Try to send all queued events using beacons if available\r\n function _releaseAllQueues(sendType, sendReason) {\r\n _clearScheduledTimer();\r\n // Cancel all flush callbacks\r\n if (_flushCallbackTimerId) {\r\n _timeoutWrapper.clear(_flushCallbackTimerId);\r\n _flushCallbackTimerId = null;\r\n }\r\n if (!_paused) {\r\n // Queue all the remaining requests to be sent. The requests will be sent using HTML5 Beacons if they are available.\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, sendType, sendReason);\r\n }\r\n }\r\n /**\r\n * Add empty queues for all latencies in the inbound queues map. This is called\r\n * when Transmission Manager is being flushed. This ensures that new events added\r\n * after flush are stored separately till we flush the current events.\r\n */\r\n function _clearQueues() {\r\n _batchQueues[4 /* EventLatencyValue.Immediate */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[3 /* EventLatencyValue.RealTime */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[2 /* EventLatencyValue.CostDeferred */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[1 /* EventLatencyValue.Normal */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n }\r\n function _getEventBatch(iKey, latency, create) {\r\n var batchQueue = _batchQueues[latency];\r\n if (!batchQueue) {\r\n latency = 1 /* EventLatencyValue.Normal */;\r\n batchQueue = _batchQueues[latency];\r\n }\r\n var eventBatch = batchQueue.iKeyMap[iKey];\r\n if (!eventBatch && create) {\r\n eventBatch = EventBatch.create(iKey);\r\n batchQueue.batches.push(eventBatch);\r\n batchQueue.iKeyMap[iKey] = eventBatch;\r\n }\r\n return eventBatch;\r\n }\r\n function _performAutoFlush(isAsync, doFlush) {\r\n // Only perform the auto flush check if the httpManager has an idle connection and we are not in a backoff situation\r\n if (_httpManager.canSendRequest() && !_currentBackoffCount) {\r\n if (_autoFlushEventsLimit > 0 && _queueSize > _autoFlushEventsLimit) {\r\n // Force flushing\r\n doFlush = true;\r\n }\r\n if (doFlush && _flushCallbackTimerId == null) {\r\n // Auto flush the queue\r\n _self.flush(isAsync, null, 20 /* SendRequestReason.MaxQueuedEvents */);\r\n }\r\n }\r\n }\r\n function _addEventToProperQueue(event, append) {\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n event = optimizeObject(event);\r\n }\r\n var latency = event.latency;\r\n var eventBatch = _getEventBatch(event.iKey, latency, true);\r\n if (eventBatch.addEvent(event)) {\r\n if (latency !== 4 /* EventLatencyValue.Immediate */) {\r\n _queueSize++;\r\n // Check for auto flushing based on total events in the queue, but not for requeued or retry events\r\n if (append && event.sendAttempt === 0) {\r\n // Force the flushing of the batch if the batch (specific iKey / latency combination) reaches it's auto flush limit\r\n _performAutoFlush(!event.sync, _autoFlushBatchLimit > 0 && eventBatch.count() >= _autoFlushBatchLimit);\r\n }\r\n }\r\n else {\r\n // Direct events don't need auto flushing as they are scheduled (by default) for immediate delivery\r\n _immediateQueueSize++;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n function _dropEventWithLatencyOrLess(iKey, latency, currentLatency, dropNumber) {\r\n while (currentLatency <= latency) {\r\n var eventBatch = _getEventBatch(iKey, latency, true);\r\n if (eventBatch && eventBatch.count() > 0) {\r\n // Dropped oldest events from lowest possible latency\r\n var droppedEvents = eventBatch.split(0, dropNumber);\r\n var droppedCount = droppedEvents.count();\r\n if (droppedCount > 0) {\r\n if (currentLatency === 4 /* EventLatencyValue.Immediate */) {\r\n _immediateQueueSize -= droppedCount;\r\n }\r\n else {\r\n _queueSize -= droppedCount;\r\n }\r\n _notifyBatchEvents(strEventsDiscarded, [droppedEvents], EventsDiscardedReason.QueueFull);\r\n return true;\r\n }\r\n }\r\n currentLatency++;\r\n }\r\n // Unable to drop any events -- lets just make sure the queue counts are correct to avoid exhaustion\r\n _resetQueueCounts();\r\n return false;\r\n }\r\n /**\r\n * Internal helper to reset the queue counts, used as a backstop to avoid future queue exhaustion errors\r\n * that might occur because of counting issues.\r\n */\r\n function _resetQueueCounts() {\r\n var immediateQueue = 0;\r\n var normalQueue = 0;\r\n var _loop_1 = function (latency) {\r\n var batchQueue = _batchQueues[latency];\r\n if (batchQueue && batchQueue.batches) {\r\n arrForEach(batchQueue.batches, function (theBatch) {\r\n if (latency === 4 /* EventLatencyValue.Immediate */) {\r\n immediateQueue += theBatch.count();\r\n }\r\n else {\r\n normalQueue += theBatch.count();\r\n }\r\n });\r\n }\r\n };\r\n for (var latency = 1 /* EventLatencyValue.Normal */; latency <= 4 /* EventLatencyValue.Immediate */; latency++) {\r\n _loop_1(latency);\r\n }\r\n _queueSize = normalQueue;\r\n _immediateQueueSize = immediateQueue;\r\n }\r\n function _queueBatches(latency, sendType, sendReason) {\r\n var eventsQueued = false;\r\n var isAsync = sendType === 0 /* EventSendType.Batched */;\r\n // Only queue batches (to the HttpManager) if this is a sync request or the httpManager has an idle connection\r\n // Thus keeping the events within the PostChannel until the HttpManager has a connection available\r\n // This is so we can drop \"old\" events if the queue is getting full because we can't successfully send events\r\n if (!isAsync || _httpManager.canSendRequest()) {\r\n doPerf(_self.core, function () { return \"PostChannel._queueBatches\"; }, function () {\r\n var droppedEvents = [];\r\n var latencyToProcess = 4 /* EventLatencyValue.Immediate */;\r\n while (latencyToProcess >= latency) {\r\n var batchQueue = _batchQueues[latencyToProcess];\r\n if (batchQueue && batchQueue.batches && batchQueue.batches.length > 0) {\r\n arrForEach(batchQueue.batches, function (theBatch) {\r\n // Add the batch to the http manager to send the requests\r\n if (!_httpManager.addBatch(theBatch)) {\r\n // The events from this iKey are being dropped (killed)\r\n droppedEvents = droppedEvents.concat(theBatch.events());\r\n }\r\n else {\r\n eventsQueued = eventsQueued || (theBatch && theBatch.count() > 0);\r\n }\r\n if (latencyToProcess === 4 /* EventLatencyValue.Immediate */) {\r\n _immediateQueueSize -= theBatch.count();\r\n }\r\n else {\r\n _queueSize -= theBatch.count();\r\n }\r\n });\r\n // Remove all batches from this Queue\r\n batchQueue.batches = [];\r\n batchQueue.iKeyMap = {};\r\n }\r\n latencyToProcess--;\r\n }\r\n if (droppedEvents.length > 0) {\r\n _notifyEvents(strEventsDiscarded, droppedEvents, EventsDiscardedReason.KillSwitch);\r\n }\r\n if (eventsQueued && _delayedBatchSendLatency >= latency) {\r\n // We have queued events at the same level as the delayed values so clear the setting\r\n _delayedBatchSendLatency = -1;\r\n _delayedBatchReason = 0 /* SendRequestReason.Undefined */;\r\n }\r\n }, function () { return ({ latency: latency, sendType: sendType, sendReason: sendReason }); }, !isAsync);\r\n }\r\n else {\r\n // remember the min latency so that we can re-trigger later\r\n _delayedBatchSendLatency = _delayedBatchSendLatency >= 0 ? Math.min(_delayedBatchSendLatency, latency) : latency;\r\n _delayedBatchReason = Math.max(_delayedBatchReason, sendReason);\r\n }\r\n return eventsQueued;\r\n }\r\n /**\r\n * This is the callback method is called as part of the manual flushing process.\r\n * @param callback\r\n * @param sendReason\r\n */\r\n function _flushImpl(callback, sendReason) {\r\n // Add any additional queued events and cause all queued events to be sent asynchronously\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, sendReason);\r\n // All events (should) have been queue -- lets just make sure the queue counts are correct to avoid queue exhaustion (previous bug #9685112)\r\n _resetQueueCounts();\r\n _waitForIdleManager(function () {\r\n // Only called AFTER the httpManager does not have any outstanding requests\r\n if (callback) {\r\n callback();\r\n }\r\n if (_flushCallbackQueue.length > 0) {\r\n _flushCallbackTimerId = _createTimer(function () {\r\n _flushCallbackTimerId = null;\r\n _flushImpl(_flushCallbackQueue.shift(), sendReason);\r\n }, 0);\r\n }\r\n else {\r\n // No more flush requests\r\n _flushCallbackTimerId = null;\r\n // Restart the normal timer schedule\r\n _scheduleTimer();\r\n }\r\n });\r\n }\r\n function _waitForIdleManager(callback) {\r\n if (_httpManager.isCompletelyIdle()) {\r\n callback();\r\n }\r\n else {\r\n _flushCallbackTimerId = _createTimer(function () {\r\n _flushCallbackTimerId = null;\r\n _waitForIdleManager(callback);\r\n }, FlushCheckTimer);\r\n }\r\n }\r\n /**\r\n * Resets the transmit profiles to the default profiles of Real Time, Near Real Time\r\n * and Best Effort. This removes all the custom profiles that were loaded.\r\n */\r\n function _resetTransmitProfiles() {\r\n _clearScheduledTimer();\r\n _initializeProfiles();\r\n _currentProfile = RT_PROFILE;\r\n _scheduleTimer();\r\n }\r\n function _initializeProfiles() {\r\n _profiles = {};\r\n _profiles[RT_PROFILE] = [2, 1, 0];\r\n _profiles[NRT_PROFILE] = [6, 3, 0];\r\n _profiles[BE_PROFILE] = [18, 9, 0];\r\n }\r\n /**\r\n * The notification handler for requeue events\r\n * @ignore\r\n */\r\n function _requeueEvents(batches, reason) {\r\n var droppedEvents = [];\r\n var maxSendAttempts = _maxEventSendAttempts;\r\n if (_isPageUnloadTriggered) {\r\n // If a page unlaod has been triggered reduce the number of times we try to \"retry\"\r\n maxSendAttempts = _maxUnloadEventSendAttempts;\r\n }\r\n arrForEach(batches, function (theBatch) {\r\n if (theBatch && theBatch.count() > 0) {\r\n arrForEach(theBatch.events(), function (theEvent) {\r\n if (theEvent) {\r\n // Check if the request being added back is for a sync event in which case mark it no longer a sync event\r\n if (theEvent.sync) {\r\n theEvent.latency = 4 /* EventLatencyValue.Immediate */;\r\n theEvent.sync = false;\r\n }\r\n if (theEvent.sendAttempt < maxSendAttempts) {\r\n // Reset the event timings\r\n setProcessTelemetryTimings(theEvent, _self.identifier);\r\n _addEventToQueues(theEvent, false);\r\n }\r\n else {\r\n droppedEvents.push(theEvent);\r\n }\r\n }\r\n });\r\n }\r\n });\r\n if (droppedEvents.length > 0) {\r\n _notifyEvents(strEventsDiscarded, droppedEvents, EventsDiscardedReason.NonRetryableStatus);\r\n }\r\n if (_isPageUnloadTriggered) {\r\n // Unload event has been received so we need to try and flush new events\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n }\r\n function _callNotification(evtName, theArgs) {\r\n var manager = (_self._notificationManager || {});\r\n var notifyFunc = manager[evtName];\r\n if (notifyFunc) {\r\n try {\r\n notifyFunc.apply(manager, theArgs);\r\n }\r\n catch (e) {\r\n _throwInternal(_self.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 74 /* _eInternalMessageId.NotificationException */, evtName + \" notification failed: \" + e);\r\n }\r\n }\r\n }\r\n function _notifyEvents(evtName, theEvents) {\r\n var extraArgs = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n extraArgs[_i - 2] = arguments[_i];\r\n }\r\n if (theEvents && theEvents.length > 0) {\r\n _callNotification(evtName, [theEvents].concat(extraArgs));\r\n }\r\n }\r\n function _notifyBatchEvents(evtName, batches) {\r\n var extraArgs = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n extraArgs[_i - 2] = arguments[_i];\r\n }\r\n if (batches && batches.length > 0) {\r\n arrForEach(batches, function (theBatch) {\r\n if (theBatch && theBatch.count() > 0) {\r\n _callNotification(evtName, [theBatch.events()].concat(extraArgs));\r\n }\r\n });\r\n }\r\n }\r\n /**\r\n * The notification handler for when batches are about to be sent\r\n * @ignore\r\n */\r\n function _sendingEvent(batches, reason, isSyncRequest) {\r\n if (batches && batches.length > 0) {\r\n _callNotification(\"eventsSendRequest\", [(reason >= 1000 /* EventBatchNotificationReason.SendingUndefined */ && reason <= 1999 /* EventBatchNotificationReason.SendingEventMax */ ?\r\n reason - 1000 /* EventBatchNotificationReason.SendingUndefined */ :\r\n 0 /* SendRequestReason.Undefined */), isSyncRequest !== true]);\r\n }\r\n }\r\n /**\r\n * This event represents that a batch of events have been successfully sent and a response received\r\n * @param batches The notification handler for when the batches have been successfully sent\r\n * @param reason For this event the reason will always be EventBatchNotificationReason.Complete\r\n */\r\n function _eventsSentEvent(batches, reason) {\r\n _notifyBatchEvents(\"eventsSent\", batches, reason);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _eventsDropped(batches, reason) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, (reason >= 8000 /* EventBatchNotificationReason.EventsDropped */ && reason <= 8999 /* EventBatchNotificationReason.EventsDroppedMax */ ?\r\n reason - 8000 /* EventBatchNotificationReason.EventsDropped */ :\r\n EventsDiscardedReason.Unknown));\r\n }\r\n function _eventsResponseFail(batches) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, EventsDiscardedReason.NonRetryableStatus);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _otherEvent(batches, reason) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, EventsDiscardedReason.Unknown);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _setAutoLimits() {\r\n if (!_config || !_config.disableAutoBatchFlushLimit) {\r\n _autoFlushBatchLimit = Math.max(MaxNumberEventPerBatch * (MaxConnections + 1), _queueSizeLimit / 6);\r\n }\r\n else {\r\n _autoFlushBatchLimit = 0;\r\n }\r\n }\r\n // Provided for backward compatibility they are not \"expected\" to be in current use but they are public\r\n objDefineAccessors(_self, \"_setTimeoutOverride\", function () { return _timeoutWrapper.set; }, function (value) {\r\n // Recreate the timeout wrapper\r\n _timeoutWrapper = createTimeoutWrapper(value, _timeoutWrapper.clear);\r\n });\r\n objDefineAccessors(_self, \"_clearTimeoutOverride\", function () { return _timeoutWrapper.clear; }, function (value) {\r\n // Recreate the timeout wrapper\r\n _timeoutWrapper = createTimeoutWrapper(_timeoutWrapper.set, value);\r\n });\r\n });\r\n return _this;\r\n }\r\n// Removed Stub for PostChannel.prototype.initialize.\r\n// Removed Stub for PostChannel.prototype.processTelemetry.\r\n// Removed Stub for PostChannel.prototype.setEventQueueLimits.\r\n// Removed Stub for PostChannel.prototype.pause.\r\n// Removed Stub for PostChannel.prototype.resume.\r\n// Removed Stub for PostChannel.prototype.addResponseHandler.\r\n// Removed Stub for PostChannel.prototype.flush.\r\n// Removed Stub for PostChannel.prototype.setMsaAuthTicket.\r\n// Removed Stub for PostChannel.prototype.hasEvents.\r\n// Removed Stub for PostChannel.prototype._loadTransmitProfiles.\r\n// Removed Stub for PostChannel.prototype._setTransmitProfile.\r\n// Removed Stub for PostChannel.prototype._backOffTransmission.\r\n// Removed Stub for PostChannel.prototype._clearBackOff.\r\n return PostChannel;\r\n}(BaseTelemetryPlugin));\r\nexport default PostChannel;\r\n//# sourceMappingURL=PostChannel.js.map","/*\n * 1DS JS SDK POST plugin, 3.2.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n * Real Time profile (default profile). RealTime Latency events are sent every 1 sec and\r\n * Normal Latency events are sent every 2 sec.\r\n */\r\nexport var RT_PROFILE = \"REAL_TIME\";\r\n/**\r\n * Near Real Time profile. RealTime Latency events are sent every 3 sec and\r\n * Normal Latency events are sent every 6 sec.\r\n */\r\nexport var NRT_PROFILE = \"NEAR_REAL_TIME\";\r\n/**\r\n * Best Effort. RealTime Latency events are sent every 9 sec and\r\n * Normal Latency events are sent every 18 sec.\r\n */\r\nexport var BE_PROFILE = \"BEST_EFFORT\";\r\n//# sourceMappingURL=DataModels.js.map","// For the duration and number of events.\r\nvar SEND_BATCHES_EVENT = 'HttpManager:_sendBatches';\r\n// For the time taken by privacy guard to process the event.\r\nvar PRIVACY_GUARD_PROCESSING_TIME_EVENT = 'PrivacyGuard:_processTelemetry';\r\nvar PerfEvent = /** @class */ (function () {\r\n function PerfEvent(name, payload, isAsync) {\r\n this.start = Date.now();\r\n this.name = name;\r\n this.isAsync = isAsync === true ? true : false;\r\n this.payload = payload;\r\n }\r\n /**\r\n * Identifies whether this event is a child event of a parent\r\n */\r\n PerfEvent.prototype.isChildEvt = function () {\r\n return false;\r\n };\r\n PerfEvent.prototype.complete = function () {\r\n this.time = Date.now() - this.start;\r\n this.exTime = this.time;\r\n };\r\n return PerfEvent;\r\n}());\r\nexport { PerfEvent };\r\nvar PerfManager = /** @class */ (function () {\r\n function PerfManager(callbacks) {\r\n this._callbacks = callbacks;\r\n }\r\n PerfManager.prototype.create = function (src, payload, isAsync) {\r\n if (src === SEND_BATCHES_EVENT || src === PRIVACY_GUARD_PROCESSING_TIME_EVENT) {\r\n var evt = new PerfEvent(src, payload, isAsync);\r\n return evt;\r\n }\r\n return null;\r\n };\r\n PerfManager.prototype.fire = function (perfEvent) {\r\n if (perfEvent) {\r\n perfEvent.complete();\r\n }\r\n if (this._callbacks) {\r\n switch (perfEvent.name) {\r\n case SEND_BATCHES_EVENT:\r\n this.handleSendBatches(perfEvent);\r\n break;\r\n case PRIVACY_GUARD_PROCESSING_TIME_EVENT:\r\n this.handlePrivacyGuardNotification(perfEvent);\r\n break;\r\n }\r\n }\r\n };\r\n PerfManager.prototype.setCtx = function (_key, _value) { };\r\n PerfManager.prototype.getCtx = function (_key) { };\r\n PerfManager.prototype.handleSendBatches = function (perfEvent) {\r\n if (this._callbacks.requestProcessingStats) {\r\n var eventCount = 0;\r\n if (perfEvent.payload) {\r\n var payload = perfEvent.payload();\r\n if (payload.batches) {\r\n for (var index in payload.batches) {\r\n eventCount += payload.batches[index].evts.length;\r\n }\r\n }\r\n }\r\n this._callbacks.requestProcessingStats(perfEvent.time || 0, eventCount);\r\n }\r\n };\r\n PerfManager.prototype.handlePrivacyGuardNotification = function (perfEvent) {\r\n if (this._callbacks.privacyGuardStats && perfEvent.time && perfEvent.time > 0) {\r\n this._callbacks.privacyGuardStats(perfEvent.time);\r\n }\r\n };\r\n return PerfManager;\r\n}());\r\nexport { PerfManager };\r\n//# sourceMappingURL=PerfManager.js.map","import { __assign, __extends } from \"tslib\";\r\nimport { AppInsightsCore } from '@microsoft/1ds-core-js';\r\nimport { PostChannel } from '@microsoft/1ds-post-js';\r\nimport { logNotification } from '@microsoft/oteljs';\r\nimport { PerfManager } from './PerfManager';\r\nexport function getAppInsights(oneDSSinkProperties, instrumentationKey) {\r\n var httpXHROverride = oneDSSinkProperties.httpXHROverride;\r\n var appInsightsConfig = {\r\n instrumentationKey: instrumentationKey,\r\n endpointUrl: oneDSSinkProperties.endpointUrl,\r\n channelConfiguration: {\r\n eventsLimitInMem: oneDSSinkProperties.eventsLimitInMem,\r\n httpXHROverride: httpXHROverride,\r\n setTimeoutOverride: oneDSSinkProperties.setTimeoutOverride,\r\n clearTimeoutOverride: oneDSSinkProperties.clearTimeoutOverride,\r\n ignoreMc1Ms0CookieProcessing: true,\r\n // 1ds-post-js in 3.1.x adds some optimization code that purportedly improves overall performance, but\r\n // in our testing regresses synchronous API performance. Disabling it here.\r\n disableOptimizeObj: true\r\n },\r\n // Force a \"w\" parameter on the URL string, which tells the Collector that this is a web request and that it\r\n // should parse the user agent string to determine the browser name and version\r\n // In the URL string, this looks like \"&w=2\"\r\n // (the presence of a \"w\" string indicates it's a web request, and \"2\" means disable cookies)\r\n // The 1DS SDK generally automatically sets the \"w\" parameter when it detects the active document (i.e. webpage),\r\n // but in the web worker it doesn't have access to the document, so we have to force it.\r\n // As a good heuristic, we are probably in a web environment (i.e. not Node.js) if we didn't have to override XHR.\r\n // This should be sufficient for our purposes, and covers the web worker scenario.\r\n enableWParam: !httpXHROverride,\r\n // Sets the value of the \"w\" parameter to 2, which means \"disable cookies\"\r\n disableCookiesUsage: true,\r\n extensionConfig: __assign({}, oneDSSinkProperties.extensionConfig)\r\n };\r\n if (oneDSSinkProperties.stats && oneDSSinkProperties.stats.networkStats && appInsightsConfig.channelConfiguration) {\r\n appInsightsConfig.channelConfiguration.payloadListener = function (originalPayload, modifiedPayload) {\r\n var _a;\r\n var actualPayload = modifiedPayload ? modifiedPayload : originalPayload;\r\n if (actualPayload.data) {\r\n (_a = oneDSSinkProperties.stats) === null || _a === void 0 ? void 0 : _a.networkStats(actualPayload.data.length);\r\n }\r\n };\r\n }\r\n var applicationInsights = new ApplicationInsights();\r\n applicationInsights.initialize(appInsightsConfig, oneDSSinkProperties.plugins);\r\n applicationInsights.setUploadFrequency(oneDSSinkProperties.uploadFrequency);\r\n if (oneDSSinkProperties.notificationListener) {\r\n applicationInsights.addNotificationListener(oneDSSinkProperties.notificationListener);\r\n }\r\n if (oneDSSinkProperties.stats) {\r\n applicationInsights.setPerfMgr(new PerfManager(oneDSSinkProperties.stats));\r\n }\r\n return applicationInsights;\r\n}\r\nexport var hookUp1DSNotifications = function (oneDSSink, applicationInsights) {\r\n if (applicationInsights) {\r\n applicationInsights.addNotificationListener({\r\n eventsSent: function (events) {\r\n logNotification(2 /* LogLevel.Info */, 2 /* Category.Transport */, function () {\r\n return \"Successfully sent \".concat(events.length, \" event(s)\");\r\n });\r\n logNotification(3 /* LogLevel.Verbose */, 2 /* Category.Transport */, function () {\r\n return \"Sent event(s) details : \".concat(JSON.stringify(events, null, 2));\r\n });\r\n oneDSSink.eventsSent += events.length;\r\n },\r\n eventsDiscarded: function (events, reason) {\r\n logNotification(0 /* LogLevel.Error */, 2 /* Category.Transport */, function () {\r\n return \"Discarded \".concat(events.length, \" event(s) because \").concat(reason);\r\n });\r\n logNotification(3 /* LogLevel.Verbose */, 2 /* Category.Transport */, function () {\r\n return \"Discarded event(s) details : \".concat(JSON.stringify(events, null, 2));\r\n });\r\n oneDSSink.eventsDiscarded += events.length;\r\n }\r\n });\r\n }\r\n};\r\nvar ApplicationInsights = /** @class */ (function (_super) {\r\n __extends(ApplicationInsights, _super);\r\n function ApplicationInsights() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Initialize the sdk.\r\n * @param {IExtendedConfiguration} config - The configuration to initialize the SDK.\r\n * @param {IPlugin[]} extensions - An array of extensions that are to be used by the core.\r\n */\r\n ApplicationInsights.prototype.initialize = function (config, extensions) {\r\n this._postChannel = new PostChannel();\r\n var plugins = extensions !== null && extensions !== void 0 ? extensions : [];\r\n config.channels = [[this._postChannel]];\r\n config.extensionConfig = config.extensionConfig || [];\r\n config.extensionConfig[this._postChannel.identifier] = __assign(__assign({}, config.channelConfiguration), config.extensionConfig[this._postChannel.identifier]);\r\n try {\r\n _super.prototype.initialize.call(this, config, plugins);\r\n }\r\n catch (error) {\r\n this.logger.warnToConsole('Failed to initialize SDK.' + error);\r\n }\r\n };\r\n ApplicationInsights.prototype.setUploadFrequency = function (uploadFrequency) {\r\n if (!this._postChannel || !uploadFrequency) {\r\n return;\r\n }\r\n // OneDS SDK allows to specify \"Latency\" of the event (think priority). At the moment the SDK supports two meaningful latencies\r\n // (three if you look at the enum definition, but the third one is not used) - EventLatency.Normal (default) and EventLatency.RealTime.\r\n // The idea here is to upload events with RealTime latency at a higher frequency than the events with Normal latency. To determine the\r\n // upload frequency for the event, OneDS uses the \"concept\" of transmission profile. A transmission profile is simply a name that is\r\n // associated with an array of two numbers - { 'Name' = [Normal, RealTime] }. OneDS documentation specifies that each latency timer\r\n // needs to be a multiple of the latency higher than it - more on this later.\r\n // There are three built in profiles:\r\n // - RT_PROFILE = [2, 1]; (default)\r\n // - NRT_PROFILE = [6, 3];\r\n // - BE_PROFILE = [18, 9];\r\n // Now here is the fun part, only the RealTime latency frequency is used in the code - the code simply doubles the RealTime latency\r\n // frequency and uses it for Normal latency frequency - i.e. Normal = RealTime * 2 (see PostChannel._batchAndSendEvents for details).\r\n // OTel SDK does not expose RealTime latency and uses the default Normal one. So the upload frequency that we are interested here is\r\n // the Normal one, and to keep things sane for the consumers of the SDK that's what the uploadFrequency parameter will be mapped to.\r\n var normalLatencyFrequency = uploadFrequency / 1000;\r\n var realtimeLatencyFrequency = normalLatencyFrequency / 2;\r\n var customProfiles = {};\r\n customProfiles['OTelCustomTransmissionProfile'] = [normalLatencyFrequency, realtimeLatencyFrequency];\r\n this._postChannel._loadTransmitProfiles(customProfiles);\r\n this._postChannel._setTransmitProfile('OTelCustomTransmissionProfile');\r\n };\r\n ApplicationInsights.prototype.flush = function (async) {\r\n if (this._postChannel) {\r\n this._postChannel.flush(async);\r\n }\r\n };\r\n ApplicationInsights.prototype.shutdown = function () {\r\n if (this._postChannel) {\r\n this._postChannel.teardown();\r\n }\r\n };\r\n return ApplicationInsights;\r\n}(AppInsightsCore));\r\nexport { ApplicationInsights };\r\n//# sourceMappingURL=ApplicationInsights.js.map","import { __extends } from \"tslib\";\r\nimport { logNotification } from '@microsoft/oteljs';\r\nimport { ARIA_OFFICE_TELEMETRY_TOKEN, tryCatch, voidValue } from './InternalUtils';\r\nimport { OneDSHelper } from './OneDSHelper';\r\nimport { getAppInsights, hookUp1DSNotifications } from './ApplicationInsights';\r\n/**\r\n * OTelJS 1DS Sink sends telemetry using the Web 1DS sdk\r\n */\r\nvar OneDSSink = /** @class */ (function (_super) {\r\n __extends(OneDSSink, _super);\r\n /**\r\n * Constructs an 1DS Sink\r\n * @param persistentDataFields - Data fields to be sent with every event; these data fields are assumed to\r\n * be top-level static fields, and will not be prepended with \"Data.\"\r\n * @param oneDSSinkProperties - Properties on the sinks\r\n */\r\n function OneDSSink(persistentDataFields, oneDSSinkProperties) {\r\n var _this = _super.call(this, persistentDataFields, oneDSSinkProperties) || this;\r\n // #region Private variables\r\n var _applicationInsights;\r\n // #endregion\r\n // #region Public functions\r\n _this.sendTelemetryEvent = function (telemetryEvent) {\r\n return tryCatch(function () {\r\n var event = _this.getOneDSTelemetryEvent(telemetryEvent);\r\n if (event && _applicationInsights) {\r\n _applicationInsights.track(event);\r\n }\r\n }, voidValue);\r\n };\r\n _this.sendCustomerContent = function (_customerContentEvent) {\r\n return undefined;\r\n };\r\n _this.sendNonStandardEvent = function (telemetryEvent, eventType) {\r\n var isHandled = false;\r\n nonStandardEventHandlers.forEach(function (handler) {\r\n if (handler.canHandle(eventType)) {\r\n handler.processEvent(telemetryEvent);\r\n isHandled = true;\r\n }\r\n });\r\n if (!isHandled) {\r\n logNotification(0 /* LogLevel.Error */, 1 /* Category.Sink */, function () { return 'Missing Handler for ' + eventType + 'to process' + telemetryEvent.eventName; });\r\n }\r\n };\r\n _this.flush = function (async) {\r\n _applicationInsights === null || _applicationInsights === void 0 ? void 0 : _applicationInsights.flush(async);\r\n nonStandardEventHandlers.forEach(function (handler) {\r\n handler.flush(async);\r\n });\r\n };\r\n _this.shutdown = function () {\r\n try {\r\n _applicationInsights === null || _applicationInsights === void 0 ? void 0 : _applicationInsights.shutdown();\r\n nonStandardEventHandlers.forEach(function (handler) {\r\n handler.shutdown();\r\n });\r\n }\r\n catch (e) {\r\n logNotification(0 /* LogLevel.Error */, 2 /* Category.Transport */, function () { return 'An error occurred on shutdown'; });\r\n }\r\n };\r\n // #endregion\r\n // #region Actual constructor stuff\r\n var nonStandardEventHandlers = oneDSSinkProperties.nonStandardEventHandlers || [];\r\n _applicationInsights = getAppInsights(oneDSSinkProperties, ARIA_OFFICE_TELEMETRY_TOKEN);\r\n // Initialize each special event handler\r\n nonStandardEventHandlers.forEach(function (handler) {\r\n handler.initialize(_this, oneDSSinkProperties);\r\n });\r\n if (!oneDSSinkProperties.endpointUrl) {\r\n throw new Error('Missing Endpoint Url');\r\n }\r\n if (!oneDSSinkProperties.disableStatsTracking) {\r\n hookUp1DSNotifications(_this, _applicationInsights);\r\n }\r\n return _this;\r\n // #endregion\r\n }\r\n return OneDSSink;\r\n}(OneDSHelper));\r\nexport { OneDSSink };\r\n//# sourceMappingURL=OneDSSink.js.map","import { makeDoubleDataField, makeBooleanDataField, makeStringDataField } from '@microsoft/oteljs';\r\nvar DEFAULT_SAMPLE_RATE = 0.02;\r\n// An internal value used to set the precision of the sampling value\r\n// 1000 matches with Microsoft Teams cohort size. Office client uses 10,000 buckets.\r\nvar SAMPLE_DENOMINATOR = 1000;\r\n/**\r\n * Hashes a string value to a numeric value using djb2 hashing algorithm.\r\n * See https://en.wikipedia.org/wiki/Universal_hashing#Hashing_strings AND http://www.cse.yorku.ca/~oz/hash.html for algorithm details.\r\n * @param {string} str String value to be hashed\r\n * @return {number} - A positive numeric value\r\n */\r\nfunction getDjb2Hash(str) {\r\n var hash = 5381;\r\n for (var i = 0; i < str.length; i++) {\r\n hash = (hash << 5) + hash + str.charCodeAt(i);\r\n }\r\n return hash >>> 0; // Ensure positive number\r\n}\r\n/**\r\n * Returns a sampling value in [0, 1) from an identifier, using djb2\r\n * @param identifier - An identifier to be hashed. If a GUID, should be lowercase with dashes only.\r\n */\r\nfunction computeSamplingValue(identifier) {\r\n var hash = getDjb2Hash(identifier);\r\n return (hash % SAMPLE_DENOMINATOR) / SAMPLE_DENOMINATOR;\r\n}\r\n/**\r\n * A class that implements sampling. After creating the sampler,\r\n * o Enable it by calling enableWithIdentifier, enableWithSamplingValue, or enableWithRandomValue()\r\n * o Call setSamplingKey to indicate what type of identifier was used\r\n * o Add the sampler as a preprocessor to the 1DS sink.\r\n * Only events that have SamplingPolicy explicitly set to Measure are sampled.\r\n * Sampling should generally be done on a session basis; events are marked with Session.SamplingKValue.\r\n */\r\nvar Sampler = /** @class */ (function () {\r\n function Sampler() {\r\n /**\r\n * The name of the preprocessor\r\n */\r\n this.name = 'Sampler';\r\n this.sampleRate = DEFAULT_SAMPLE_RATE;\r\n }\r\n /**\r\n * Enables sampling using an identifier as a seed for a djb2 hash function.\r\n * Returns whether sampling was successfully enabled (not whether the session is going to be sampled)\r\n * @param samplingKey - The name of the identifier that will be hashed. 'ClientId' and 'UserId' are canonical values\r\n * @param identifier - An identifier that will be hashed to determine whether to sample events\r\n * If it is a GUID, it should be in lowercase with only dashes.\r\n */\r\n Sampler.prototype.enableWithIdentifier = function (samplingKey, identifier) {\r\n // Insufficient entropy if not long enough identifier\r\n if (typeof identifier !== 'string' || identifier.length < 4) {\r\n return false;\r\n }\r\n this.samplingValue = computeSamplingValue(identifier);\r\n this.samplingKey = samplingKey;\r\n return true;\r\n };\r\n /**\r\n * Enables sampling using the given sampling value\r\n * @param samplingKey - The name of the source of the sampling value. 'ClientId' and 'UserId' are canonical values\r\n * @param samplingValue - A value in [0, 1). If you do not want sampling, then do not add a Sampler.\r\n */\r\n Sampler.prototype.enableWithSamplingValue = function (samplingKey, samplingValue) {\r\n if (isNaN(samplingValue) || samplingValue < 0 || samplingValue >= 1) {\r\n return false;\r\n }\r\n this.samplingValue = samplingValue;\r\n this.samplingKey = samplingKey;\r\n return true;\r\n };\r\n /**\r\n * Enables sampling using a random sampling value\r\n */\r\n Sampler.prototype.enableWithRandomValue = function () {\r\n var byteArray = new Uint32Array(1);\r\n if (typeof window === 'object' && window.crypto) {\r\n window.crypto.getRandomValues(byteArray);\r\n }\r\n else {\r\n return false;\r\n }\r\n this.samplingValue = (byteArray[0] % SAMPLE_DENOMINATOR) / SAMPLE_DENOMINATOR;\r\n this.samplingKey = 'Random';\r\n return true;\r\n };\r\n /**\r\n * Overrides the default sample rate for Measure events.\r\n * @param sampleRate - The sample rate to set, between 0 and 1 inclusive.\r\n */\r\n Sampler.prototype.setSampleRate = function (sampleRate) {\r\n // Checking like this ensures that sampleRate is numeric\r\n if (sampleRate >= 0 && sampleRate <= 1) {\r\n this.sampleRate = sampleRate;\r\n return true;\r\n }\r\n return false;\r\n };\r\n /**\r\n * Gets the sampling value used by this sampler\r\n */\r\n Sampler.prototype.getSamplingValue = function () {\r\n return this.samplingValue;\r\n };\r\n /**\r\n * Returns whether this sampler allows sending measures\r\n */\r\n Sampler.prototype.isMeasuresEnabled = function () {\r\n return this.samplingValue === undefined || this.samplingValue < this.sampleRate;\r\n };\r\n /**\r\n * Possibly samples an event. Returns whether the event should be sent.\r\n * If sampling is enabled, adds field to the event\r\n * @param telemetryEvent - The event\r\n */\r\n Sampler.prototype.processEvent = function (telemetryEvent) {\r\n var samplingPolicy = telemetryEvent.eventFlags.samplingPolicy;\r\n // If the sampler hasn't been configured, don't do anything.\r\n // Also don't do anything if sampling policy isn't set.\r\n if (this.samplingValue === undefined || samplingPolicy === undefined) {\r\n return true;\r\n }\r\n // Measured events are sent if enabled\r\n // Diagnostics events are not sent\r\n // Otherwise, fall through and send at 100%\r\n if (samplingPolicy === 1 /* SamplingPolicy.Measure */) {\r\n if (this.isMeasuresEnabled()) {\r\n this.addSampleRateField(telemetryEvent, this.sampleRate, this.samplingValue);\r\n return true;\r\n }\r\n return false;\r\n }\r\n // else if, but the 'else' is unnecessary because the previous block returns\r\n if (samplingPolicy === 2 /* SamplingPolicy.Diagnostics */) {\r\n return false;\r\n }\r\n this.addSampleRateField(telemetryEvent, 1, this.samplingValue);\r\n return true;\r\n };\r\n Sampler.prototype.addSampleRateField = function (telemetryEvent, reportedSampleRate, samplingValue) {\r\n // Adding fields to Event Contract fields, which are sent without \"Data.\"\"\r\n if (!telemetryEvent.eventContract) {\r\n telemetryEvent.eventContract = { name: '', dataFields: [] };\r\n }\r\n var dataFields = telemetryEvent.eventContract.dataFields;\r\n dataFields.push(makeDoubleDataField('Event.SampleRate', reportedSampleRate));\r\n dataFields.push(makeDoubleDataField('Session.SamplingValue', samplingValue));\r\n if (this.samplingKey) {\r\n dataFields.push(makeStringDataField('Session.SamplingKey', this.samplingKey));\r\n }\r\n dataFields.push(makeBooleanDataField('Session.MeasuresEnabled', this.isMeasuresEnabled()));\r\n };\r\n return Sampler;\r\n}());\r\nexport { Sampler };\r\n//# sourceMappingURL=Sampler.js.map","// this is a port of the CS RingBuffer in aria-logger-net\r\n// https://github.com/microsoft-notes/aria-logger-net/blob/master/Aria.Logger/RingBuffer.cs\r\nvar RingBuffer = /** @class */ (function () {\r\n function RingBuffer(capacity) {\r\n var _this = this;\r\n this.getNextIndex = function (index) {\r\n return (index + 1) % _this.capacity;\r\n };\r\n if (capacity <= 0) {\r\n throw new Error('Ring buffer capacity must be greater than zero');\r\n }\r\n this.capacity = capacity;\r\n // tslint:disable-next-line:prefer-array-literal\r\n this.buffer = new Array(capacity);\r\n this.tailIndex = capacity - 1;\r\n this.count = 0;\r\n }\r\n RingBuffer.prototype.add = function (item) {\r\n this.tailIndex = this.getNextIndex(this.tailIndex);\r\n this.buffer[this.tailIndex] = item;\r\n this.count = Math.min(this.capacity, this.count + 1);\r\n };\r\n RingBuffer.prototype.clear = function () {\r\n this.count = 0;\r\n this.tailIndex = this.capacity - 1;\r\n // tslint:disable-next-line:prefer-array-literal\r\n this.buffer = new Array(this.capacity);\r\n };\r\n RingBuffer.prototype.toArray = function () {\r\n var arr = [];\r\n if (this.count !== 0) {\r\n var startIndex = this.count === this.capacity\r\n ? this.getNextIndex(this.tailIndex)\r\n : 0;\r\n for (var i = startIndex; i !== this.tailIndex; i = this.getNextIndex(i)) {\r\n if (this.buffer[i] !== undefined) {\r\n arr.push(this.buffer[i]);\r\n }\r\n }\r\n if (this.buffer[this.tailIndex] !== undefined) {\r\n arr.push(this.buffer[this.tailIndex]);\r\n }\r\n }\r\n return arr;\r\n };\r\n return RingBuffer;\r\n}());\r\nexport { RingBuffer };\r\n//# sourceMappingURL=RingBuffer.js.map","var namespaceRegex = /^[A-Z][A-Za-z0-9]*(\\.[A-Z][A-Za-z0-9]*)*$/;\r\nvar nameRegex = /^[A-Z][A-Za-z0-9]*$/;\r\nvar propertyTests = [\r\n ['EventName', namespaceRegex],\r\n ['Namespace', namespaceRegex],\r\n ['ShortEventName', nameRegex],\r\n];\r\nvar logItemTests = [\r\n ['Namespace', namespaceRegex],\r\n ['ShortEventName', nameRegex],\r\n];\r\nexport function assertValidNamespace(namespace) {\r\n if (!namespaceRegex.test(namespace)) {\r\n throw new Error(\"namespace \\\"\" + namespace + \"\\\" does not match pattern \" + namespaceRegex.toString());\r\n }\r\n}\r\nexport function assertValidName(name) {\r\n if (!nameRegex.test(name)) {\r\n throw new Error(\"name \\\"\" + name + \"\\\" does not patch pattern \" + nameRegex.toString());\r\n }\r\n}\r\nexport function assertValidProperty(properties, key, pattern) {\r\n var value = \"\" + properties[key];\r\n if (!pattern.test(value)) {\r\n throw new Error(key + \" \\\"\" + value + \"\\\" does not match pattern \" + pattern.toString());\r\n }\r\n}\r\nexport function assertValidProperties(properties, tests) {\r\n tests.forEach(function (_a) {\r\n var key = _a[0], pattern = _a[1];\r\n return assertValidProperty(properties, key, pattern);\r\n });\r\n}\r\nexport function assertValidCommonProperties(properties) {\r\n assertValidProperties(properties, propertyTests);\r\n}\r\nexport function assertValidLogItem(logItem) {\r\n assertValidProperties(logItem, logItemTests);\r\n}\r\n//# sourceMappingURL=validation.js.map","/**\r\n * The AWTSessionState enumeration contains a set of values that indicate the session state.\r\n * @enum {number}\r\n */\r\nexport var AWTSessionState;\r\n(function (AWTSessionState) {\r\n /**\r\n * Session started.\r\n */\r\n AWTSessionState[AWTSessionState[\"Started\"] = 0] = \"Started\";\r\n /**\r\n * Session ended.\r\n */\r\n AWTSessionState[AWTSessionState[\"Ended\"] = 1] = \"Ended\";\r\n})(AWTSessionState || (AWTSessionState = {}));\r\n//# sourceMappingURL=AWTSessionState.js.map","export var DataBoundary;\r\n(function (DataBoundary) {\r\n /**\r\n * US Department of Defense endpoint (Pathfinder)\r\n */\r\n DataBoundary[\"USGOV_DOD\"] = \"USGOV_DOD\";\r\n /**\r\n * US Department of Justice endpoint (Trailblazer)\r\n */\r\n DataBoundary[\"USGOV_DOJ\"] = \"USGOV_DOJ\";\r\n /**\r\n * Public endpoint\r\n */\r\n DataBoundary[\"PUBLIC\"] = \"PUBLIC\";\r\n DataBoundary[\"GLOBAL\"] = \"GLOBAL\";\r\n /**\r\n * Customer content\r\n */\r\n DataBoundary[\"CUSTOMER_CONTENT\"] = \"CUSTOMER_CONTENT\";\r\n /**\r\n * EUDB endpoint\r\n */\r\n DataBoundary[\"EUDB\"] = \"EUDB\";\r\n DataBoundary[\"EMEA\"] = \"EMEA\";\r\n})(DataBoundary || (DataBoundary = {}));\r\nexport var mailHrdApiEndpoint = \"https://odc.officeapps.live.com/odc/v2.1/federationprovider\";\r\n//# sourceMappingURL=constants.js.map","import { AWTSessionState } from '@notes/webintegrations-common/lib/shared/logging/AWTSessionState';\r\n/**\r\n * Typeguard to verify if an object is an instance of the PerformanceNavigationTiming class\r\n */\r\nvar isPerformanceNavigationTiming = function (objectToTypeCheck) {\r\n return objectToTypeCheck instanceof PerformanceNavigationTiming;\r\n};\r\n/**\r\n * Utility function to access the PerformanceNavigationTiming object in a type safe way.\r\n *\r\n * @returns The PerformanceNavigationTiming entries from the window.performance object.\r\n */\r\nvar getPerformanceNavigationEntries = function () {\r\n var navigationEntries = performance.getEntriesByType('navigation');\r\n if (navigationEntries.length <= 0) {\r\n return undefined;\r\n }\r\n var performanceNavigationTimingEntries = navigationEntries[0];\r\n if (!isPerformanceNavigationTiming(performanceNavigationTimingEntries)) {\r\n return undefined;\r\n }\r\n return performanceNavigationTimingEntries;\r\n};\r\n/**\r\n * Calculates the time that has passed since the event 'fetchStart' occurred.\r\n * Uses the Browser PerformanceNavigationTiming object to do the calculations.\r\n * It will default to the deprecated 'window.performance.timing' object for browsers that don't support the new object yet (Safari).\r\n *\r\n * @returns The time that has passed since the 'fetchStart' navigation event occurred.\r\n */\r\nvar getSessionDuration = function () {\r\n var perfNavigationEntries = getPerformanceNavigationEntries();\r\n return perfNavigationEntries !== undefined\r\n ? performance.now() - perfNavigationEntries.fetchStart\r\n : // Safari browser doesn't support the new PerformanceNavigationTiming object yet so we fallback in that case\r\n // eslint-disable-next-line deprecation/deprecation\r\n (window.performance.timing && window.performance.timing.fetchStart\r\n ? Date.now() - window.performance.timing.fetchStart\r\n : \"\");\r\n};\r\n/**\r\n * Calculates the time when the fetch started\r\n * Uses the Browser PerformanceNavigationTiming object to do the calculations.\r\n * It will default to the deprecated 'window.performance.timing' object for browsers that don't support the new object yet (Safari).\r\n *\r\n * @returns The time when the 'fetchStart' navigation event occurred.\r\n */\r\nvar getFirstLaunchTime = function () {\r\n var perfNavigationEntries = getPerformanceNavigationEntries();\r\n var fetchTime = Date.now() -\r\n (perfNavigationEntries !== undefined\r\n ? perfNavigationEntries.fetchStart\r\n : // Safari browser doesn't support the new PerformanceNavigationTiming object yet so we fallback in that case\r\n // eslint-disable-next-line deprecation/deprecation\r\n window.performance.timing && window.performance.timing.fetchStart\r\n ? window.performance.timing.fetchStart\r\n : Date.now());\r\n return new Date(fetchTime).toISOString();\r\n};\r\nexport var getSessionStartContext = function () {\r\n return {\r\n SessionState: AWTSessionState[AWTSessionState.Started],\r\n SessionFirstLaunchTime: getFirstLaunchTime(),\r\n NetworkType: getNetworkType(),\r\n };\r\n};\r\nexport var getSessionEndContext = function () {\r\n return {\r\n SessionState: AWTSessionState[AWTSessionState.Ended],\r\n SessionDuration: getSessionDuration(),\r\n NetworkType: getNetworkType(),\r\n };\r\n};\r\nvar nav = navigator;\r\nvar connection = nav.connection || nav.mozConnection || nav.webkitConnection;\r\nvar getNetworkType = function () {\r\n return connection !== undefined ? connection.effectiveType : '';\r\n};\r\n//# sourceMappingURL=sessionLogging.js.map","import * as tslib_1 from \"tslib\";\r\nimport { PrivacyGuardPlugin } from '@microsoft/1ds-privacy-guard-js';\r\nimport { App, makeBooleanDataField, makeDoubleDataField, makeStringDataField, Session, TelemetryLogger, User } from '@microsoft/oteljs';\r\nimport { OneDSEndpoint, OneDSSink, Sampler } from '@microsoft/oteljs-1ds';\r\nimport { RingBuffer } from './lib/RingBuffer';\r\nimport { TRACE, Audience, SamplePolicy, AccountType } from './types';\r\nimport { assertValidCommonProperties, assertValidLogItem } from './validation';\r\nimport { getResponseDiagnostics } from '@notes/webintegrations-common/lib/Http/Response/getResponseDiagnostics';\r\nimport { HttpResponseError } from '@notes/webintegrations-common/lib/Http/Response/HttpResponseError';\r\nimport { executeWithTimeout } from '@notes/webintegrations-common/lib/shared/executeWithTimeout';\r\nimport { getErrorAsString } from '@notes/webintegrations-common/lib/shared/getErrorAsString';\r\nimport { AWTSessionState } from '@notes/webintegrations-common/lib/shared/logging/AWTSessionState';\r\nimport { UrlUtils } from '@notes/webintegrations-common/lib/UrlUtils/UrlUtils';\r\nimport { DataBoundary, mailHrdApiEndpoint } from './constants';\r\nimport { getSessionEndContext, getSessionStartContext } from './sessionLogging';\r\nexport var defaultOtelLoggerOptions = {\r\n audience: Audience.Dogfood,\r\n};\r\nvar OTelLogger = /** @class */ (function () {\r\n function OTelLogger(options, context, isEUDBRoutingEnabled, userInfo, sink, samplingRate, isOptionalEventsEnabled) {\r\n var _this = this;\r\n this.privacyGuard = new PrivacyGuardPlugin();\r\n this.options = options;\r\n this.context = context;\r\n this.otelSink = sink;\r\n this.isOptionalEventsEnabled = !!isOptionalEventsEnabled;\r\n this.samplingRate = samplingRate ? samplingRate : 1;\r\n this.traceBuffer = new RingBuffer(100);\r\n this.isEUDBRoutingEnabled = isEUDBRoutingEnabled\r\n ? isEUDBRoutingEnabled\r\n : false;\r\n this.optionsWithDefaults = tslib_1.__assign({}, defaultOtelLoggerOptions, this.options);\r\n if (this.isOptionalEventsEnabled && this.otelSink && this.otelSink instanceof OneDSSink) {\r\n /**\r\n * For services, the expectation historically has been that the data is Required Service Diagnostic Data,\r\n * or RSD for Essential Services. As such, Optional is explicitly disabled. If your scenario is web and\r\n * you want to explicitly collect Optional Diagnostic Data, you need to set that to true.\r\n */\r\n this.otelSink.setOptionalEventsEnabled(true);\r\n }\r\n this.logger = this.createLogger(sink);\r\n if (userInfo) {\r\n this.setUserContext(userInfo);\r\n }\r\n this.logSession(AWTSessionState.Started, context);\r\n if (window && window.addEventListener) {\r\n window.addEventListener('beforeunload', function (_) {\r\n _this.logSession(AWTSessionState.Ended, context);\r\n // Make sure we flush all events before closing the window\r\n _this.flushLogsAndTeardown();\r\n });\r\n }\r\n else {\r\n console.warn('[OTelLogger] Could not register the beforeunload callback for flushing logs.');\r\n }\r\n }\r\n /**\r\n * LogReportData is best used to collect\r\n * an isolated data point that is intended to be used in a report\r\n * or otherwise closely monitored to analyze how the product is being used\r\n */\r\n OTelLogger.prototype.logReportData = function (item, eventFlags) {\r\n var _this = this;\r\n item.SamplePolicy = this.getSamplePolicy(eventFlags);\r\n assertValidLogItem(item);\r\n this.withLogger(function () {\r\n _this.logger.sendTelemetryEvent({\r\n eventName: _this.options.tenantNameSpace + \".\" + item.ShortEventName,\r\n eventFlags: eventFlags\r\n ? eventFlags\r\n : _this.buildEventFlags(true /*SamplePolicy.Critical*/),\r\n dataFields: _this.createDataFields(item.Context ? item.Context : {}, item),\r\n });\r\n });\r\n };\r\n /**\r\n * logUnexpected is only to be used for sending an unexpected, critical error\r\n * Unexpected logs need to be treated as product bug to process forward\r\n * logUnexpected doesn’t provide the ability for the instrumenter to add custom properties or additional context\r\n * calling logUnexpected will automatically upload a ring buffer of traces\r\n */\r\n OTelLogger.prototype.logUnexpected = function (item, eventFlags, traceEventFlags, logTriggerProperties, nonCriticalTraceEvents) {\r\n var _this = this;\r\n if (logTriggerProperties === void 0) { logTriggerProperties = true; }\r\n if (nonCriticalTraceEvents === void 0) { nonCriticalTraceEvents = []; }\r\n item.SamplePolicy = this.getSamplePolicy(eventFlags);\r\n assertValidLogItem(item);\r\n this.withLogger(function () {\r\n _this.flushTraceBuffer(item, traceEventFlags, logTriggerProperties, nonCriticalTraceEvents);\r\n _this.logger.sendError({\r\n eventName: _this.options.tenantNameSpace + \".\" + item.ShortEventName,\r\n error: {\r\n errorGroup: item.ErrorType !== undefined\r\n ? item.ErrorType.toString()\r\n : 'UserError',\r\n tag: 0,\r\n code: item.ErrorCode1,\r\n },\r\n eventFlags: eventFlags\r\n ? eventFlags\r\n : _this.buildEventFlags(true /*SamplePolicy.Critical*/),\r\n dataFields: _this.createUnexpectedProperties(item),\r\n });\r\n });\r\n };\r\n /**\r\n * logTrace is best used for logging a diagnostic trace\r\n * traces are not immediately sent as events, they are put into a ring buffer\r\n * they are flushed when logUnexpected is called\r\n */\r\n OTelLogger.prototype.logTrace = function (item) {\r\n var _this = this;\r\n assertValidLogItem(item);\r\n this.withLogger(function () {\r\n _this.traceBuffer.add(tslib_1.__assign({}, item, { TraceTime: new Date().toISOString() }));\r\n });\r\n };\r\n /**\r\n * logSession is used to log the beginning of a session and the end of a session in a webapp\r\n * in general, we can use enableAutoUserSession, however in cases where the window events aren't supported (e.g. Microsoft Teams)\r\n * we have to call these methods manually, so this library exposes them\r\n */\r\n OTelLogger.prototype.logSession = function (sessionState, context) {\r\n var _this = this;\r\n var logItem = this.getSessionLogItem(sessionState, context);\r\n this.withLogger(function () {\r\n _this.logReportData(logItem);\r\n });\r\n };\r\n OTelLogger.prototype.createActivity = function (name, activityEventFlags, item, useActivityNameInEventName) {\r\n if (useActivityNameInEventName === void 0) { useActivityNameInEventName = false; }\r\n item.SamplePolicy = this.getSamplePolicy(activityEventFlags);\r\n assertValidLogItem(item);\r\n var dataFields = this.createDataFields(item.Context ? item.Context : {}, item);\r\n if (!useActivityNameInEventName) {\r\n dataFields.push(makeStringDataField('ActivityName', name));\r\n }\r\n return this.logger.createActivity({\r\n eventName: this.options.tenantNameSpace + \".\" + (useActivityNameInEventName ? item.ShortEventName : 'Activity'),\r\n eventFlags: activityEventFlags,\r\n dataFields: dataFields,\r\n });\r\n };\r\n OTelLogger.prototype.setUserContext = function (userInfo, dataBoundary) {\r\n return tslib_1.__awaiter(this, void 0, void 0, function () {\r\n var endPointUrl, _a;\r\n return tslib_1.__generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n if (!(this.userInfo === undefined)) return [3 /*break*/, 4];\r\n this.userInfo = userInfo;\r\n endPointUrl = !this.isEUDBRoutingEnabled\r\n ? OneDSEndpoint.PUBLIC.toString()\r\n : undefined;\r\n if (!this.isEUDBRoutingEnabled) return [3 /*break*/, 3];\r\n this.dataBoundary = this.dataBoundary\r\n ? this.dataBoundary\r\n : dataBoundary;\r\n if (!!this.dataBoundary) return [3 /*break*/, 2];\r\n // Get dataBoundary from the API\r\n _a = this;\r\n return [4 /*yield*/, this.getDataBoundary()];\r\n case 1:\r\n // Get dataBoundary from the API\r\n _a.dataBoundary = _b.sent();\r\n _b.label = 2;\r\n case 2:\r\n endPointUrl = this.getEndPointUrl();\r\n _b.label = 3;\r\n case 3:\r\n // Do not log telemetry if the databoundry is unknown\r\n if (!this.isEUDBRoutingEnabled || endPointUrl) {\r\n if (!this.otelSink || this.otelSink instanceof OneDSSink) {\r\n // Create a new sink if the sink is not initialized\r\n // or if the sink is an instance of OneDSSink and\r\n // needs to be updated with the new endpointUrl\r\n this.createOTelSink(endPointUrl);\r\n this.addSinkToLogger();\r\n }\r\n }\r\n _b.label = 4;\r\n case 4:\r\n this.updatePrivacyGuardContext();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /**\r\n * Use of IPiiLogItem will bring in @aria/webjs-sdk which\r\n * has been deprecated. Hence, not implementing the method\r\n * logReportDataWithPii.\r\n * TODO: Implement later if required VSO: 6907391\r\n */\r\n OTelLogger.prototype.getSessionId = function () {\r\n return this.context.SessionId !== undefined\r\n ? this.context.SessionId.toString()\r\n : \"\";\r\n };\r\n /**\r\n * Flushes the logs from the queue\r\n * If the sink is not initialized, fallback to EU cluster\r\n * Avoid flushing explicitly as the event queue is already configured to be flushed on app-unload\r\n */\r\n OTelLogger.prototype.flushLogs = function (flushingLogsCompleted) {\r\n if (this.otelSink === undefined) {\r\n // Keeping default as PUBLIC since if we don't know the user, there is nothing to safeguard\r\n var endpointUrl = OneDSEndpoint.PUBLIC;\r\n this.createOTelSink(endpointUrl);\r\n this.addSinkToLogger();\r\n }\r\n if (this.otelSink instanceof OneDSSink) {\r\n this.otelSink.flush(true);\r\n }\r\n if (flushingLogsCompleted) {\r\n flushingLogsCompleted();\r\n }\r\n };\r\n /**\r\n * Flush all events before disposing the logger\r\n */\r\n OTelLogger.prototype.flushLogsAndTeardown = function (flushingLogsCompleted) {\r\n this.flushLogs(flushingLogsCompleted);\r\n if (this.otelSink instanceof OneDSSink) {\r\n this.otelSink.shutdown();\r\n }\r\n };\r\n OTelLogger.prototype.getSessionLogItem = function (sessionState, itemContext) {\r\n var sessionNamespace;\r\n var sessionContext;\r\n if (sessionState == AWTSessionState.Started) {\r\n sessionContext = getSessionStartContext();\r\n sessionNamespace = 'SessionStarted';\r\n }\r\n else {\r\n sessionContext = getSessionEndContext();\r\n sessionNamespace = 'SessionEnded';\r\n }\r\n return {\r\n Context: tslib_1.__assign({}, itemContext, sessionContext),\r\n ShortEventName: 'Session',\r\n ExpirationDate: '',\r\n Namespace: sessionNamespace,\r\n };\r\n };\r\n OTelLogger.prototype.createLogger = function (sink) {\r\n // OTel Buffer has a limit of 1000 events\r\n // Reference: MAX_EVENT_QUEUE_LENGTH in https://office.visualstudio.com/DefaultCollection/OE/_git/OTEL-OTelJS?path=%2Foteljs%2Fsrc%2FSimpleTelemetryLogger.ts&_a=contents&version=GBmaster\r\n var telemetryConfig = { enableQueue: true };\r\n var otelLogger = new TelemetryLogger(undefined /* parent */, sink !== undefined ? this.buildCommonDataFields() : undefined, telemetryConfig);\r\n otelLogger.setTenantToken(this.options.tenantNameSpace, this.optionsWithDefaults.tenantID, this.options.nexusTenantToken ? this.options.nexusTenantToken : undefined);\r\n if (sink !== undefined) {\r\n otelLogger.addSink(sink);\r\n }\r\n return otelLogger;\r\n };\r\n /**\r\n * Create a OneDSSink. If the sink already exists, flush and shutdown the existing sink.\r\n */\r\n OTelLogger.prototype.createOTelSink = function (endPointUrl) {\r\n var persistentDataFields = this.buildCommonDataFields();\r\n var privacyGuardConfig = {\r\n notificationEventName: this.options.tenantNameSpace + '.PrivacyConcern',\r\n iKey: this.optionsWithDefaults.tenantID,\r\n };\r\n var oneDSSinkProperties = {\r\n endpointUrl: endPointUrl,\r\n // The PrivacyGuardPlugin plugin inspects data as it is logged and fires a privacy concern as needed.\r\n // As we set the plugin, we also need to set the config in the extensionConfig object.\r\n // TODO:- Work with OTel team to align PrivacyGuardPlugin interface with IPlugin interface to avoid ignore this ts error\r\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\r\n // @ts-ignore\r\n plugins: [this.privacyGuard],\r\n extensionConfig: {\r\n PrivacyGuardPlugin: privacyGuardConfig,\r\n },\r\n };\r\n var defaultSink = new OneDSSink(persistentDataFields, oneDSSinkProperties);\r\n if (this.samplingRate > 0 && this.samplingRate < 1) {\r\n var sampler = new Sampler();\r\n if (this.userInfo && this.userInfo.userId) {\r\n sampler.enableWithIdentifier('PrimaryIdentityHash', this.userInfo.userId);\r\n }\r\n else {\r\n sampler.enableWithIdentifier('SessionId', this.getSessionId());\r\n }\r\n sampler.setSampleRate(this.samplingRate);\r\n defaultSink.addPreprocessor(sampler);\r\n }\r\n if (this.otelSink) {\r\n // If the sink is OneDSSink, it might have been created at a time\r\n // when the user context was not available, and in that case, the\r\n // sink would have been created with PUBLIC as the default endpoint.\r\n // Hence, we now need to flush and shutdown the existing sink and\r\n // assign the new sink with the updated endpoint to this.otelSink.\r\n if (this.otelSink instanceof OneDSSink) {\r\n this.otelSink.flush(true);\r\n this.otelSink.shutdown();\r\n this.otelSink = defaultSink;\r\n }\r\n // If the sink is not OneDSSink, do not flush and shutdown the sink\r\n // and continue to use the existing sink\r\n }\r\n else {\r\n this.otelSink = defaultSink;\r\n }\r\n if (this.isOptionalEventsEnabled && this.otelSink && this.otelSink instanceof OneDSSink) {\r\n /**\r\n * For services, the expectation historically has been that the data is Required Service Diagnostic Data,\r\n * or RSD for Essential Services. As such, Optional is explicitly disabled. If your scenario is web and\r\n * you want to explicitly collect Optional Diagnostic Data, you need to set that to true.\r\n */\r\n this.otelSink.setOptionalEventsEnabled(true);\r\n }\r\n };\r\n OTelLogger.prototype.addSinkToLogger = function () {\r\n // OTel flushes events stored in events buffer to sink on addSink\r\n // Reference: addSink api in https://office.visualstudio.com/DefaultCollection/OE/_git/OTEL-OTelJS?path=%2Foteljs%2Fsrc%2FSimpleTelemetryLogger.ts&_a=contents&version=GBmaster\r\n if (this.otelSink !== undefined) {\r\n this.logger.addSink(this.otelSink);\r\n }\r\n };\r\n /**\r\n * GetDataBoundary will identify the dataBoundary using\r\n * MailHRD API\r\n */\r\n OTelLogger.prototype.getDataBoundary = function () {\r\n return tslib_1.__awaiter(this, void 0, void 0, function () {\r\n var domainValue, mailHrdApi, queryParams, _i, _a, key, queryParam, telemetryRegion, headers, correlationId, fetchRequest, timeout, response, error_1, responseDiagnostics, error, data, error_2;\r\n return tslib_1.__generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n if (this.userInfo == undefined) {\r\n console.error('User Info not present.');\r\n return [2 /*return*/, undefined];\r\n }\r\n if (this.userInfo.userType == AccountType.MSACID) {\r\n // Only OrgId users need to be compliant with EUDB requirements\r\n return [2 /*return*/, DataBoundary.PUBLIC];\r\n }\r\n domainValue = this.userInfo.tenantId\r\n ? this.userInfo.tenantId\r\n : undefined;\r\n if (!domainValue && this.userInfo.userId) {\r\n domainValue = this.userInfo.userId.substring(this.userInfo.userId.indexOf('@') + 1);\r\n }\r\n if (!domainValue) {\r\n console.error('Userinfo does not contain tenantId or userId');\r\n return [2 /*return*/, undefined];\r\n }\r\n mailHrdApi = mailHrdApiEndpoint;\r\n queryParams = { domain: domainValue };\r\n if (queryParams) {\r\n for (_i = 0, _a = Object.keys(queryParams); _i < _a.length; _i++) {\r\n key = _a[_i];\r\n queryParam = queryParams[key];\r\n if (queryParam) {\r\n mailHrdApi = UrlUtils.addQueryParam(mailHrdApi, key, queryParam);\r\n }\r\n }\r\n }\r\n headers = {\r\n 'X-Office-Application': this.options.officeApplicationNumber ? this.options.officeApplicationNumber.toString() : '',\r\n 'Enlightened-Hrd-Client': '1',\r\n 'X-Office-Platform': 'Web',\r\n 'Content-Type': 'application/json'\r\n };\r\n correlationId = this.getSessionId();\r\n fetchRequest = fetch(mailHrdApi, {\r\n method: 'GET',\r\n headers: new Headers(tslib_1.__assign({}, headers, { 'X-CorrelationId': correlationId })),\r\n });\r\n timeout = 15000;\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, executeWithTimeout(timeout, fetchRequest, 'AtMentionsRequest')];\r\n case 2:\r\n response = _b.sent();\r\n return [3 /*break*/, 4];\r\n case 3:\r\n error_1 = _b.sent();\r\n console.error(\"Error when making fetch request. \" + getErrorAsString(error_1));\r\n throw error_1;\r\n case 4:\r\n if (!response.ok) {\r\n if (response.status === 401) {\r\n console.error(\"Got 401 for fetching request to mailHRDAPi.\");\r\n return [2 /*return*/, undefined];\r\n }\r\n responseDiagnostics = getResponseDiagnostics(response);\r\n error = new HttpResponseError(responseDiagnostics, response.status);\r\n console.error(\"Invalid response from fetch request. \" + responseDiagnostics);\r\n throw error;\r\n }\r\n _b.label = 5;\r\n case 5:\r\n _b.trys.push([5, 7, , 8]);\r\n return [4 /*yield*/, response.json()];\r\n case 6:\r\n data = _b.sent();\r\n telemetryRegion = data.telemetryRegion;\r\n return [3 /*break*/, 8];\r\n case 7:\r\n error_2 = _b.sent();\r\n console.error(\"Ran into an error when parsing response JSON. \" + getErrorAsString(error_2));\r\n throw error_2;\r\n case 8: return [2 /*return*/, telemetryRegion];\r\n }\r\n });\r\n });\r\n };\r\n OTelLogger.prototype.getEndPointUrl = function () {\r\n var collectorUri;\r\n switch (this.dataBoundary) {\r\n case DataBoundary.EMEA:\r\n case DataBoundary.EUDB:\r\n collectorUri = OneDSEndpoint.EUDB;\r\n break;\r\n case DataBoundary.USGOV_DOD:\r\n collectorUri = OneDSEndpoint.USGOV_DOD;\r\n break;\r\n case DataBoundary.USGOV_DOJ:\r\n collectorUri = OneDSEndpoint.USGOV_DOJ;\r\n break;\r\n case DataBoundary.PUBLIC:\r\n case DataBoundary.GLOBAL:\r\n collectorUri = OneDSEndpoint.PUBLIC;\r\n break;\r\n case DataBoundary.CUSTOMER_CONTENT:\r\n collectorUri = OneDSEndpoint.CUSTOMER_CONTENT;\r\n break;\r\n default:\r\n collectorUri = undefined;\r\n }\r\n return collectorUri;\r\n };\r\n OTelLogger.prototype.buildCommonDataFields = function () {\r\n return this.userInfo\r\n ? this.buildUserFields(this.userInfo).concat(this.buildPersistentDataFields()) : this.buildPersistentDataFields();\r\n };\r\n OTelLogger.prototype.buildUserFields = function (userInfo) {\r\n return User.getFields({\r\n primaryIdentityHash: userInfo.userId,\r\n primaryIdentitySpace: AccountType[userInfo.userType],\r\n tenantId: userInfo.tenantId,\r\n tenantGroup: '',\r\n isAnonymous: false,\r\n });\r\n };\r\n OTelLogger.prototype.buildPersistentDataFields = function () {\r\n var persistentPropertiesFromOptions = {\r\n 'Audience': this.options.audience,\r\n 'Device.Id': this.options.deviceID ? this.options.deviceID : '',\r\n };\r\n // OTel Contracts : https://eng.ms/docs/experiences-devices/oxo/office-fuel/dig/unified-telemetry-documentation/unified-telemetry/sdks/js/sinks/onedssink\r\n // Note that the fields are classified as EssentialServiceMetadata in the contract\r\n // and Office.js sink doesn't support the same. Hence, this classification shall be\r\n // used only in case of OneDSSink.\r\n var appFields = App.getFields({\r\n name: this.options.appID,\r\n platform: this.options.appPlatform ? this.options.appPlatform : '',\r\n version: this.options.appVersion,\r\n });\r\n // Session.Id must be a GUID to get the EventView in Cosmos\r\n // https://eng.ms/docs/experiences-devices/data-platform-growth/ideas/ideas-wiki/data-platform/ideas-onboarding/eventview-onboarding\r\n var sessionFields = Session.getFields({\r\n id: this.getSessionId(),\r\n });\r\n if (!this.otelSink || this.otelSink instanceof OneDSSink) {\r\n return this.convertToOTelDataFields(persistentPropertiesFromOptions).concat(appFields, sessionFields);\r\n }\r\n else {\r\n var persistentPropertiesFromOptionsForOtherSinks = {\r\n 'Audience': this.options.audience,\r\n 'Device.Id': this.options.deviceID ? this.options.deviceID : '',\r\n 'App.Name': this.options.appID,\r\n 'App.Platform': this.options.appPlatform ? this.options.appPlatform : '',\r\n 'App.Version': this.options.appVersion,\r\n };\r\n return this.convertToOTelDataFields(persistentPropertiesFromOptionsForOtherSinks);\r\n }\r\n };\r\n OTelLogger.prototype.buildCommonItemProperties = function (item) {\r\n var properties = {\r\n ShortEventName: item.ShortEventName,\r\n Namespace: item.Namespace,\r\n EventName: item.Namespace + \".\" + item.ShortEventName,\r\n SamplePolicy: item.SamplePolicy != undefined ? item.SamplePolicy : SamplePolicy.Critical,\r\n ExpirationDate: item.ExpirationDate,\r\n SessionCorrelationId: item.SessionCorrelationId\r\n ? item.SessionCorrelationId\r\n : '',\r\n // HostApp is outside of the Common Schema, but is added to allow multiple host contexts for a single Aria tenant\r\n HostApp: item.HostApp ? item.HostApp : '',\r\n // Although Session_Id is already populated [see buildPersistentDataFields above],\r\n // populate Data_Session_Id as well to be on par with Memory SDX\r\n 'Session.Id': this.getSessionId(),\r\n };\r\n assertValidCommonProperties(properties);\r\n return properties;\r\n };\r\n OTelLogger.prototype.convertToOTelDataFields = function (primitiveProperties) {\r\n var dataFields = [];\r\n Object.keys(primitiveProperties).forEach(function (key) {\r\n var value = primitiveProperties[key];\r\n switch (typeof value) {\r\n case 'string':\r\n dataFields.push(makeStringDataField(key, value));\r\n break;\r\n case 'number':\r\n dataFields.push(makeDoubleDataField(key, value));\r\n break;\r\n case 'boolean':\r\n dataFields.push(makeBooleanDataField(key, value));\r\n break;\r\n default:\r\n break;\r\n }\r\n });\r\n return dataFields;\r\n };\r\n OTelLogger.prototype.withLogger = function (fn) {\r\n if (this.hasLogger()) {\r\n fn();\r\n }\r\n };\r\n OTelLogger.prototype.hasLogger = function () {\r\n return this.logger !== undefined;\r\n };\r\n OTelLogger.prototype.buildEventFlags = function (isCriticalEvent) {\r\n if (isCriticalEvent === void 0) { isCriticalEvent = false; }\r\n return {\r\n dataCategories: 2 /* ProductServiceUsage */,\r\n diagnosticLevel: 100 /* Optional */,\r\n samplingPolicy: isCriticalEvent\r\n ? 194 /* CriticalUsage */\r\n : 1 /* Measure */,\r\n };\r\n };\r\n OTelLogger.prototype.createDataFields = function (primitiveProperties, item) {\r\n // Remove SessionId from primitiveProperties if it is already set in the context\r\n if (this.getSessionId() === \"\") {\r\n this.context.SessionId =\r\n primitiveProperties.SessionId !== undefined\r\n ? primitiveProperties.SessionId\r\n : \"\";\r\n }\r\n if (primitiveProperties.SessionId !== undefined) {\r\n delete primitiveProperties.SessionId;\r\n }\r\n var properties = tslib_1.__assign({}, this.buildCommonItemProperties(item), primitiveProperties);\r\n var dataFields = this.convertToOTelDataFields(properties);\r\n return dataFields;\r\n };\r\n OTelLogger.prototype.createUnexpectedProperties = function (item) {\r\n return this.createDataFields(tslib_1.__assign({}, item.Context, { ErrorCode1: item.ErrorCode1 ? item.ErrorCode1 : '', ErrorCode2: item.ErrorCode2 ? item.ErrorCode2 : '', ErrorTag: item.ErrorTag ? item.ErrorTag : '', ErrorType: item.ErrorType ? item.ErrorType : '' }), item);\r\n };\r\n OTelLogger.prototype.flushTraceBuffer = function (triggerProperties, eventFlags, logTriggerProperties, nonCriticalTraceEvents) {\r\n var _this = this;\r\n if (logTriggerProperties === void 0) { logTriggerProperties = true; }\r\n if (nonCriticalTraceEvents === void 0) { nonCriticalTraceEvents = []; }\r\n // Ideally, triggerProperties shouldn't be logged if we are already calling\r\n // logUnexpectedWithTrace in the host in order to avoid duplicate logs.\r\n var traces = logTriggerProperties ? [triggerProperties].concat(this.traceBuffer.toArray()) : this.traceBuffer.toArray();\r\n traces.forEach(function (trace) {\r\n trace.SamplePolicy = _this.getSamplePolicy(eventFlags);\r\n var dataFields = _this.createUnexpectedProperties(trace);\r\n if (trace.ErrorTag && nonCriticalTraceEvents.includes(trace.ErrorTag)) {\r\n _this.logger.sendTelemetryEvent({\r\n eventName: _this.options.tenantNameSpace + \".\" + TRACE,\r\n // Non-critical traces shall be sent with DiagnosticLevel.Optional and SamplingPolicy.Measure\r\n eventFlags: _this.buildEventFlags(false),\r\n dataFields: dataFields,\r\n });\r\n }\r\n else {\r\n _this.logger.sendTelemetryEvent({\r\n eventName: _this.options.tenantNameSpace + \".\" + TRACE,\r\n eventFlags: eventFlags ? eventFlags : _this.buildEventFlags(true),\r\n dataFields: dataFields,\r\n });\r\n }\r\n });\r\n this.traceBuffer.clear();\r\n };\r\n OTelLogger.prototype.updatePrivacyGuardContext = function () {\r\n if (this.userInfo !== undefined) {\r\n var dataCtx = {\r\n UserName: this.userInfo.userId,\r\n UserAlias: '',\r\n MachineIds: [],\r\n OutOfScopeIdentifiers: [],\r\n };\r\n this.privacyGuard.updateCommonContext(dataCtx);\r\n }\r\n };\r\n OTelLogger.prototype.getSamplePolicy = function (eventFlags) {\r\n if (eventFlags === undefined) {\r\n return SamplePolicy.Critical;\r\n }\r\n switch (eventFlags.samplingPolicy) {\r\n case 194 /* CriticalUsage */:\r\n return SamplePolicy.Critical;\r\n case 1 /* Measure */:\r\n return SamplePolicy.Measure;\r\n default:\r\n return SamplePolicy.Critical;\r\n }\r\n };\r\n return OTelLogger;\r\n}());\r\nexport { OTelLogger };\r\n//# sourceMappingURL=OTelLogger.js.map","import { ISilentAuth, MsaImplicitAuthScope } from '@notes/webintegrations-common'\r\nimport { IGetToken } from './IGetToken'\r\n\r\nexport class MsaGetToken implements IGetToken {\r\n msaSilentAuth: ISilentAuth\r\n\r\n constructor(msaSilentAuth: ISilentAuth) {\r\n this.msaSilentAuth = msaSilentAuth\r\n }\r\n\r\n async getSubstrateNotesToken(): Promise {\r\n return await this.getAccessTokenForScopes([MsaImplicitAuthScope.NotesInternalReadWrite])\r\n }\r\n\r\n async getGraphUserInfoToken(): Promise {\r\n return await this.getAccessTokenForScopes([MsaImplicitAuthScope.GraphUserRead])\r\n }\r\n\r\n async getOneNoteUserInfoToken(): Promise {\r\n return await this.getAccessTokenForScopes([MsaImplicitAuthScope.OneNoteUpdate])\r\n }\r\n\r\n // tslint:disable-next-line: no-any\r\n private async getAccessTokenForScopes(scopes: any): Promise {\r\n const tokenInfo = await this.msaSilentAuth.getToken(scopes)\r\n return tokenInfo.accessToken\r\n }\r\n}\r\n","import { IExchangeToken, Resource } from '@notes/webintegrations-common'\r\nimport { IGetToken } from './IGetToken'\r\n\r\nexport class O365GetToken implements IGetToken {\r\n exchangeToken: IExchangeToken\r\n accessToken: string\r\n tenantId: string\r\n\r\n constructor(exchangeToken: IExchangeToken, accessToken: string, tenantId: string) {\r\n this.exchangeToken = exchangeToken\r\n this.accessToken = accessToken\r\n this.tenantId = tenantId\r\n }\r\n\r\n async getSubstrateNotesToken(): Promise {\r\n const exchangeTokenInfo = await this.exchangeToken.exchangeToken(this.accessToken, this.tenantId!, Resource.OutlookO365)\r\n return exchangeTokenInfo.accessToken\r\n }\r\n\r\n async getGraphUserInfoToken(): Promise {\r\n return await this.getGraphToken()\r\n }\r\n\r\n async getOneNoteUserInfoToken(): Promise {\r\n const exchangeTokenInfo = await this.exchangeToken.exchangeToken(this.accessToken, this.tenantId!, Resource.OneNote)\r\n return exchangeTokenInfo.accessToken\r\n }\r\n\r\n private async getGraphToken(): Promise {\r\n const exchangeTokenInfo = await this.exchangeToken.exchangeToken(this.accessToken, this.tenantId!, Resource.GraphNotes)\r\n return exchangeTokenInfo.accessToken\r\n }\r\n}\r\n","import { ExchangeTokenWithCacheFactory, SilentAuthWithCacheFactory } from '@notes/webintegrations-common'\r\nimport { exchangeTokenCache, implicitAuthCache } from '../caches'\r\nimport { IGetToken } from './IGetToken'\r\nimport { MsaGetToken } from './MsaGetToken'\r\nimport { O365GetToken } from './O365GetToken'\r\n\r\nexport class GetTokenFactory {\r\n static createMsa(forceRefresh: boolean): IGetToken {\r\n return new MsaGetToken(SilentAuthWithCacheFactory.create(implicitAuthCache, forceRefresh))\r\n }\r\n\r\n static createO365(accessToken: string, tenantId: string, forceRefresh: boolean): IGetToken {\r\n return new O365GetToken(ExchangeTokenWithCacheFactory.create(exchangeTokenCache, forceRefresh), accessToken, tenantId)\r\n }\r\n}\r\n","import { getSignInUrl } from '@notes/webintegrations-common'\r\nimport { getMsaSignInUrl } from '@notes/webintegrations-common/lib/Auth/Url/getSignInUrl'\r\nimport { USE_IMPLICIT_AUTH_FOR_MSA } from './useImplicitAuthForMsa'\r\n\r\nexport function getForceSignInUrl(selectAccount: boolean): string {\r\n // Use the current url, since it could be onenote.com/stickynotes or onenote.com/officeaddins/stickynotes\r\n const currentUrl = window.location.href // Note current url already has dev parameters\r\n return getSignInUrl(currentUrl, USE_IMPLICIT_AUTH_FOR_MSA, 1, selectAccount ? 'select_account' : undefined)\r\n}\r\n\r\nexport function getMsaImplicitGrantSignInUrl(): string {\r\n const currentUrl = window.location.href // Note current url already has dev parameters\r\n return getMsaSignInUrl(currentUrl)\r\n}\r\n\r\nconst signInUrlTemplate = 'https://login.live.com/oauth20_authorize.srf?client_id=6b276b59-3b21-4d3b-8a6d-3ad8a955e3b8&' +\r\n 'scope={0}&' +\r\n 'redirect_uri={1}&' +\r\n 'response_type=token&' +\r\n 'nonce=3bc1c8b8-4885-4dc4-9bef-9e6ede23e8b5'\r\n\r\nexport function getImplicitGrantUrl(scope: string): string {\r\n const redirectUrl = window.location.href.split('#')[0] // Preserve dev params, but don't capture fragment\r\n return signInUrlTemplate\r\n .replace('{0}', encodeURIComponent(scope))\r\n .replace('{1}', encodeURIComponent(redirectUrl))\r\n}\r\n","export const LOADING_PLACEHOLDER_ID = 'loadingPlaceholder'\r\nexport const STICKY_NOTES_FRAME_ID = 'stickyNotesFrame'\r\n","/*!\n * Microsoft Dynamic Proto Utility, 1.1.7\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nvar _a;\r\nvar UNDEFINED = \"undefined\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Constructor = 'constructor';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Prototype = 'prototype';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strFunction = 'function';\r\n/**\r\n * Used to define the name of the instance function lookup table\r\n * @ignore\r\n */\r\nvar DynInstFuncTable = '_dynInstFuncs';\r\n/**\r\n * Name used to tag the dynamic prototype function\r\n * @ignore\r\n */\r\nvar DynProxyTag = '_isDynProxy';\r\n/**\r\n * Name added to a prototype to define the dynamic prototype \"class\" name used to lookup the function table\r\n * @ignore\r\n */\r\nvar DynClassName = '_dynClass';\r\n/**\r\n * Prefix added to the classname to avoid any name clashes with other instance level properties\r\n * @ignore\r\n */\r\nvar DynClassNamePrefix = '_dynCls$';\r\n/**\r\n * A tag which is used to check if we have already to attempted to set the instance function if one is not present\r\n * @ignore\r\n */\r\nvar DynInstChkTag = '_dynInstChk';\r\n/**\r\n * A tag which is used to check if we are allows to try and set an instance function is one is not present. Using the same\r\n * tag name as the function level but a different const name for readability only.\r\n */\r\nvar DynAllowInstChkTag = DynInstChkTag;\r\n/**\r\n * The global (imported) instances where the global performance options are stored\r\n */\r\nvar DynProtoDefaultOptions = '_dfOpts';\r\n/**\r\n * Value used as the name of a class when it cannot be determined\r\n * @ignore\r\n */\r\nvar UnknownValue = '_unknown_';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * The polyfill version of __proto__ so that it doesn't cause issues for anyone not expecting it to exist\r\n */\r\nvar DynProtoBaseProto = \"_dyn\" + str__Proto;\r\n/**\r\n * Runtime Global holder for dynamicProto settings\r\n */\r\nvar DynProtoGlobalSettings = \"__dynProto$Gbl\";\r\n/**\r\n * Track the current prototype for IE8 as you can't look back to get the prototype\r\n */\r\nvar DynProtoCurrent = \"_dynInstProto\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strUseBaseInst = 'useBaseInst';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strSetInstFuncs = 'setInstFuncs';\r\nvar Obj = Object;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Obj[\"getPrototypeOf\"];\r\n/**\r\n * Pre-lookup to check for the existence of this function\r\n */\r\nvar _objGetOwnProps = Obj[\"getOwnPropertyNames\"];\r\n/**\r\n * Gets the runtime global reference\r\n * @returns\r\n */\r\nfunction _getGlobal() {\r\n var result;\r\n if (typeof globalThis !== UNDEFINED) {\r\n result = globalThis;\r\n }\r\n if (!result && typeof self !== UNDEFINED) {\r\n result = self;\r\n }\r\n if (!result && typeof window !== UNDEFINED) {\r\n result = window;\r\n }\r\n if (!result && typeof global !== UNDEFINED) {\r\n result = global;\r\n }\r\n return result || {};\r\n}\r\n// Since 1.1.7 moving these to the runtime global to work around mixed version and module issues\r\n// See Issue https://github.com/microsoft/DynamicProto-JS/issues/57 for details\r\nvar _gbl = _getGlobal();\r\nvar _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = {\r\n o: (_a = {},\r\n _a[strSetInstFuncs] = true,\r\n _a[strUseBaseInst] = true,\r\n _a),\r\n n: 1000 // Start new global index @ 1000 so we \"fix\" some cases when mixed with 1.1.6 or earlier\r\n});\r\n/**\r\n * Helper to check if the object contains a property of the name\r\n * @ignore\r\n */\r\nfunction _hasOwnProperty(obj, prop) {\r\n return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype or Array prototype\r\n * @ignore\r\n */\r\nfunction _isObjectOrArrayPrototype(target) {\r\n return target && (target === Obj[Prototype] || target === Array[Prototype]);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype, Array prototype or Function prototype\r\n * @ignore\r\n */\r\nfunction _isObjectArrayOrFunctionPrototype(target) {\r\n return _isObjectOrArrayPrototype(target) || target === Function[Prototype];\r\n}\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n var newProto;\r\n if (target) {\r\n // This method doesn't exist in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);\r\n // Using the pre-calculated value as IE8 doesn't support looking up the prototype of a prototype and thus fails for more than 1 base class\r\n newProto = target[DynProtoBaseProto] || curProto;\r\n if (!_hasOwnProperty(target, DynProtoBaseProto)) {\r\n // As this prototype doesn't have this property then this is from an inherited class so newProto is the base to return so save it\r\n // so we can look it up value (which for a multiple hierarchy dynamicProto will be the base class)\r\n delete target[DynProtoCurrent]; // Delete any current value allocated to this instance so we pick up the value from prototype hierarchy\r\n newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];\r\n target[DynProtoCurrent] = curProto;\r\n }\r\n }\r\n return newProto;\r\n}\r\n/**\r\n * Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6\r\n * are not enumerable.\r\n * @param target\r\n */\r\nfunction _forEachProp(target, func) {\r\n var props = [];\r\n if (_objGetOwnProps) {\r\n props = _objGetOwnProps(target);\r\n }\r\n else {\r\n for (var name_1 in target) {\r\n if (typeof name_1 === \"string\" && _hasOwnProperty(target, name_1)) {\r\n props.push(name_1);\r\n }\r\n }\r\n }\r\n if (props && props.length > 0) {\r\n for (var lp = 0; lp < props.length; lp++) {\r\n func(props[lp]);\r\n }\r\n }\r\n}\r\n/**\r\n * Helper function to check whether the provided function name is a potential candidate for dynamic\r\n * callback and prototype generation.\r\n * @param target The target object, may be a prototype or class object\r\n * @param funcName The function name\r\n * @param skipOwn Skips the check for own property\r\n * @ignore\r\n */\r\nfunction _isDynamicCandidate(target, funcName, skipOwn) {\r\n return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));\r\n}\r\n/**\r\n * Helper to throw a TypeError exception\r\n * @param message the message\r\n * @ignore\r\n */\r\nfunction _throwTypeError(message) {\r\n throw new TypeError(\"DynamicProto: \" + message);\r\n}\r\n/**\r\n * Returns a collection of the instance functions that are defined directly on the thisTarget object, it does\r\n * not return any inherited functions\r\n * @param thisTarget The object to get the instance functions from\r\n * @ignore\r\n */\r\nfunction _getInstanceFuncs(thisTarget) {\r\n // Get the base proto\r\n var instFuncs = {};\r\n // Save any existing instance functions\r\n _forEachProp(thisTarget, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {\r\n // Create an instance callback for passing the base function to the caller\r\n instFuncs[name] = thisTarget[name];\r\n }\r\n });\r\n return instFuncs;\r\n}\r\n/**\r\n * Returns whether the value is included in the array\r\n * @param values The array of values\r\n * @param value The value\r\n */\r\nfunction _hasVisited(values, value) {\r\n for (var lp = values.length - 1; lp >= 0; lp--) {\r\n if (values[lp] === value) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Returns an object that contains callback functions for all \"base/super\" functions, this is used to \"save\"\r\n * enabling calling super.xxx() functions without requiring that the base \"class\" has defined a prototype references\r\n * @param target The current instance\r\n * @ignore\r\n */\r\nfunction _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {\r\n function _instFuncProxy(target, funcHost, funcName) {\r\n var theFunc = funcHost[funcName];\r\n if (theFunc[DynProxyTag] && useBaseInst) {\r\n // grab and reuse the hosted looking function (if available) otherwise the original passed function\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;\r\n }\r\n }\r\n return function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n return theFunc.apply(target, arguments);\r\n };\r\n }\r\n // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced)\r\n var baseFuncs = {};\r\n _forEachProp(instFuncs, function (name) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);\r\n });\r\n // Get the base prototype functions\r\n var baseProto = _getObjProto(classProto);\r\n var visited = [];\r\n // Don't include base object functions for Object, Array or Function\r\n while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {\r\n // look for prototype functions\r\n _forEachProp(baseProto, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the \r\n // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return\r\n // the Object prototype methods while bypassing the check\r\n if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);\r\n }\r\n });\r\n // We need to find all possible functions that might be overloaded by walking the entire prototype chain\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(baseProto);\r\n baseProto = _getObjProto(baseProto);\r\n }\r\n return baseFuncs;\r\n}\r\nfunction _getInstFunc(target, funcName, proto, currentDynProtoProxy) {\r\n var instFunc = null;\r\n // We need to check whether the class name is defined directly on this prototype otherwise\r\n // it will walk the proto chain and return any parent proto classname.\r\n if (target && _hasOwnProperty(proto, DynClassName)) {\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];\r\n if (!instFunc) {\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\r\n // We have the instance function, lets check it we can speed up further calls\r\n // by adding the instance function back directly on the instance (avoiding the dynamic func lookup)\r\n if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {\r\n // If the instance already has an instance function we can't replace it\r\n var canAddInst = !_hasOwnProperty(target, funcName);\r\n // Get current prototype\r\n var objProto = _getObjProto(target);\r\n var visited = [];\r\n // Lookup the function starting at the top (instance level prototype) and traverse down, if the first matching function\r\n // if nothing is found or if the first hit is a dynamic proto instance then we can safely add an instance shortcut\r\n while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {\r\n var protoFunc = objProto[funcName];\r\n if (protoFunc) {\r\n canAddInst = (protoFunc === currentDynProtoProxy);\r\n break;\r\n }\r\n // We need to find all possible initial functions to ensure that we don't bypass a valid override function\r\n visited.push(objProto);\r\n objProto = _getObjProto(objProto);\r\n }\r\n try {\r\n if (canAddInst) {\r\n // This instance doesn't have an instance func and the class hierarchy does have a higher level prototype version\r\n // so it's safe to directly assign for any subsequent calls (for better performance)\r\n target[funcName] = instFunc;\r\n }\r\n // Block further attempts to set the instance function for any\r\n instFunc[DynInstChkTag] = 1;\r\n }\r\n catch (e) {\r\n // Don't crash if the object is readonly or the runtime doesn't allow changing this\r\n // And set a flag so we don't try again for any function\r\n instFuncTable[DynAllowInstChkTag] = false;\r\n }\r\n }\r\n }\r\n return instFunc;\r\n}\r\nfunction _getProtoFunc(funcName, proto, currentDynProtoProxy) {\r\n var protoFunc = proto[funcName];\r\n // Check that the prototype function is not a self reference -- try to avoid stack overflow!\r\n if (protoFunc === currentDynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (typeof protoFunc !== strFunction) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc;\r\n}\r\n/**\r\n * Add the required dynamic prototype methods to the the class prototype\r\n * @param proto - The class prototype\r\n * @param className - The instance classname\r\n * @param target - The target instance\r\n * @param baseInstFuncs - The base instance functions\r\n * @param setInstanceFunc - Flag to allow prototype function to reset the instance function if one does not exist\r\n * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n // Use the instance or prototype function\r\n var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);\r\n // eslint-disable-next-line prefer-rest-params\r\n return instFunc.apply(this, arguments);\r\n };\r\n // Tag this function as a proxy to support replacing dynamic proxy elements (primary use case is for unit testing\r\n // via which can dynamically replace the prototype function reference)\r\n dynProtoProxy[DynProxyTag] = 1;\r\n return dynProtoProxy;\r\n }\r\n if (!_isObjectOrArrayPrototype(proto)) {\r\n var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};\r\n var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {}); // fetch and assign if as it may not exist yet\r\n // Set whether we are allow to lookup instances, if someone has set to false then do not re-enable\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;\r\n }\r\n _forEachProp(target, function (name) {\r\n // Only add overridden functions\r\n if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {\r\n // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function\r\n instFuncs_1[name] = target[name];\r\n delete target[name];\r\n // Add a dynamic proto if one doesn't exist or if a prototype function exists and it's not a dynamic one\r\n if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {\r\n proto[name] = _createDynamicPrototype(proto, name);\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Checks whether the passed prototype object appears to be correct by walking the prototype hierarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whether the passed prototype instance is in the hierarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n // As this is primarily a coding time check, don't bother checking if running in IE8 or lower\r\n var visited = [];\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(thisProto);\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\r\n }\r\n // If objGetPrototypeOf doesn't exist then just assume everything is ok.\r\n return true;\r\n}\r\n/**\r\n * Gets the current prototype name using the ES6 name if available otherwise falling back to a use unknown as the name.\r\n * It's not critical for this to return a name, it's used to decorate the generated unique name for easier debugging only.\r\n * @param target\r\n * @param unknownValue\r\n * @ignore\r\n */\r\nfunction _getObjName(target, unknownValue) {\r\n if (_hasOwnProperty(target, Prototype)) {\r\n // Look like a prototype\r\n return target.name || unknownValue || UnknownValue;\r\n }\r\n return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;\r\n}\r\n/**\r\n * Helper function when creating dynamic (inline) functions for classes, this helper performs the following tasks :-\r\n * - Saves references to all defined base class functions\r\n * - Calls the delegateFunc with the current target (this) and a base object reference that can be used to call all \"super\" functions.\r\n * - Will populate the class prototype for all overridden functions to support class extension that call the prototype instance.\r\n * Callers should use this helper when declaring all function within the constructor of a class, as mentioned above the delegateFunc is\r\n * passed both the target \"this\" and an object that can be used to call any base (super) functions, using this based object in place of\r\n * super.XXX() (which gets expanded to _super.prototype.XXX()) provides a better minification outcome and also ensures the correct \"this\"\r\n * context is maintained as TypeScript creates incorrect references using super.XXXX() for dynamically defined functions i.e. Functions\r\n * defined in the constructor or some other function (rather than declared as complete typescript functions).\r\n * ### Usage\r\n * ```typescript\r\n * import dynamicProto from \"@microsoft/dynamicproto-js\";\r\n * class ExampleClass extends BaseClass {\r\n * constructor() {\r\n * dynamicProto(ExampleClass, this, (_self, base) => {\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.newFunc = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * ...\r\n * }\r\n * }\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.myFunction = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * // Call the base version of the function that we are overriding\r\n * base.myFunction();\r\n * }\r\n * ...\r\n * }\r\n * _self.initialize = () => {\r\n * ...\r\n * }\r\n * // Warnings: While the following will work as _self is simply a reference to\r\n * // this, if anyone overrides myFunction() the overridden will be called first\r\n * // as the normal JavaScript method resolution will occur and the defined\r\n * // _self.initialize() function is actually gets removed from the instance and\r\n * // a proxy prototype version is created to reference the created method.\r\n * _self.initialize();\r\n * });\r\n * }\r\n * }\r\n * ```\r\n * @typeparam DPType This is the generic type of the class, used to keep intellisense valid\r\n * @typeparam DPCls The type that contains the prototype of the current class\r\n * @param theClass - This is the current class instance which contains the prototype for the current class\r\n * @param target - The current \"this\" (target) reference, when the class has been extended this.prototype will not be the 'theClass' value.\r\n * @param delegateFunc - The callback function (closure) that will create the dynamic function\r\n * @param options - Additional options to configure how the dynamic prototype operates\r\n */\r\nfunction dynamicProto(theClass, target, delegateFunc, options) {\r\n // Make sure that the passed theClass argument looks correct\r\n if (!_hasOwnProperty(theClass, Prototype)) {\r\n _throwTypeError(\"theClass is an invalid class definition.\");\r\n }\r\n // Quick check to make sure that the passed theClass argument looks correct (this is a common copy/paste error)\r\n var classProto = theClass[Prototype];\r\n if (!_checkPrototype(classProto, target)) {\r\n _throwTypeError(\"[\" + _getObjName(theClass) + \"] not in hierarchy of [\" + _getObjName(target) + \"]\");\r\n }\r\n var className = null;\r\n if (_hasOwnProperty(classProto, DynClassName)) {\r\n // Only grab the class name if it's defined on this prototype (i.e. don't walk the prototype chain)\r\n className = classProto[DynClassName];\r\n }\r\n else {\r\n // As not all browser support name on the prototype creating a unique dynamic one if we have not already\r\n // assigned one, so we can use a simple string as the lookup rather than an object for the dynamic instance\r\n // function table lookup.\r\n className = DynClassNamePrefix + _getObjName(theClass, \"_\") + \"$\" + _gblInst.n;\r\n _gblInst.n++;\r\n classProto[DynClassName] = className;\r\n }\r\n var perfOptions = dynamicProto[DynProtoDefaultOptions];\r\n var useBaseInst = !!perfOptions[strUseBaseInst];\r\n if (useBaseInst && options && options[strUseBaseInst] !== undefined) {\r\n useBaseInst = !!options[strUseBaseInst];\r\n }\r\n // Get the current instance functions\r\n var instFuncs = _getInstanceFuncs(target);\r\n // Get all of the functions for any base instance (before they are potentially overridden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);\r\n // Execute the delegate passing in both the current target \"this\" and \"base\" function references\r\n // Note casting the same type as we don't actually have the base class here and this will provide some intellisense support\r\n delegateFunc(target, baseFuncs);\r\n // Don't allow setting instance functions for older IE instances\r\n var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];\r\n if (setInstanceFunc && options) {\r\n setInstanceFunc = !!options[strSetInstFuncs];\r\n }\r\n // Populate the Prototype for any overridden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);\r\n}\r\n/**\r\n * Exposes the default global options to allow global configuration, if the global values are disabled these will override\r\n * any passed values. This is primarily exposed to support unit-testing without the need for individual classes to expose\r\n * their internal usage of dynamic proto.\r\n */\r\ndynamicProto[DynProtoDefaultOptions] = _gblInst.o;\n\nexport { dynamicProto as default };\n//# sourceMappingURL=dynamicproto-js.js.map\n","export const USE_IMPLICIT_AUTH_FOR_MSA = true\r\n","import {\r\n AuthType,\r\n GetGraphUserInfo,\r\n GetUserInfoFromO365JwtToken,\r\n GetUserInfoWithCache,\r\n IAuthenticatedUserInfo,\r\n IGetUserInfo,\r\n isMsa,\r\n LocalStorageCacheWithExpiry\r\n} from '@notes/webintegrations-common'\r\nimport { getAuthTypeWithExtension } from '../../agave/auth/getAuthTypeWithExtension'\r\n\r\nexport class GetUserInfoFactory {\r\n static create(authType: AuthType, cache: LocalStorageCacheWithExpiry): IGetUserInfo {\r\n if (isMsa(authType)) {\r\n return new GetUserInfoWithCache(new GetGraphUserInfo(), cache)\r\n }\r\n return new GetUserInfoWithCache(new GetUserInfoFromO365JwtToken(), cache)\r\n }\r\n\r\n static createIfAuthenticated(cache: LocalStorageCacheWithExpiry): IGetUserInfo | undefined {\r\n const authType = getAuthTypeWithExtension()\r\n return authType && GetUserInfoFactory.create(authType, cache)\r\n }\r\n}\r\n","import { AuthType } from '@notes/webintegrations-common'\r\nimport { userInfoCache } from '../caches'\r\nimport { GetUserInfoFactory } from './GetUserInfoFactory'\r\n\r\n// Glue code to combine the auth factories and caches this app uses\r\nexport const createGetUserInfo = (authType: AuthType) => GetUserInfoFactory.create(authType, userInfoCache)\r\nexport const createGetUserInfoIfAuthenticated = () => GetUserInfoFactory.createIfAuthenticated(userInfoCache)\r\n"],"sourceRoot":""}