{"version":3,"sources":["webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/Constants.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/InternalConstants.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/TelemetryHelpers.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DbgExtensionUtils.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DiagnosticLogger.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/DataCacheHelper.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EnvUtils.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CoreUtils.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ChannelController.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/applicationinsights-core-js/dist-esm/JavaScriptSDK/AppInsightsCore.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/EventHelpers.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/HelperFuncs.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/PerfManager.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/InstrumentHooks.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/RandomHelper.js","webpack:///./node_modules/@microsoft/applicationinsights-core-js/dist-esm/JavaScriptSDK/CookieMgr.js"],"names":["strIKey","strExtensionConfig","strEmpty","strProcessTelemetry","strPriority","strSetNextPlugin","strIsInitialized","strTeardown","strCore","strUpdate","strDisabled","strDoTeardown","strProcessNext","strResume","strPause","strNotificationListener","strAddNotificationListener","strRemoveNotificationListener","strEventsSent","strEventsDiscarded","strEventsSendRequest","strPerfEvent","pluginStateData","_getPluginState","plugin","get","initializePlugins","processContext","extensions","pluginState","initPlugins","lastPlugin","proxy","getNext","thePlugin","getPlugin","isInitialized","push","core","initialize","getCfg","sortPlugins","plugins","sort","extA","extB","result","bHasProcess","createUnloadHandlerContainer","handlers","_addHandler","handler","_runHandlers","unloadCtx","unloadState","e","diagLog","add","run","createEnumStyle","values","enumClass","field","value","createValueMap","mapClass","_debugListener","listenerFuncs","_aiNamespace","_listenerProxyFunc","name","config","args","arguments","dbgExt","getDebugExt","listener","apply","_getExtensionNamespace","target","ns","disableDbgExt","getDebugListener","lp","length","strGetPlugin","BaseTelemetryPlugin","_isinitialized","_rootCtx","_nextPlugin","_unloadHandlerContainer","_hooks","_self","this","_getTelCtx","currentCtx","itemCtx","rootCtx","createNew","_setDefaults","pluginChain","getProcessTelContext","nextPlugin","_initDefaults","teardown","unloadDone","theUnloadCtx","theUnloadState","reason","isAsync","_unloadCallback","fn","rm","processNext","update","updateCtx","updateState","updateDone","theUpdateCtx","theUpdateState","_doUpdate","_updateCallback","_addHook","hooks","concat","setInitialized","next","env","processTelemetry","AiNonUserActionablePrefix","AiUserActionablePrefix","AIInternalMessagePrefix","strErrorToConsole","strWarnToConsole","_sanitizeDiagnosticText","text","replace","_logToConsole","func","message","theConsole","logFunc","_InternalLogMessage","msgId","msg","isUserAct","properties","messageId","strProps","stringify","diagnosticText","dataType","safeGetLogger","logger","DiagnosticLogger","identifier","queue","_messageCount","_messageLogged","_getConfigValue","defValue","_areInternalMessagesThrottled","maxInternalMessageLimit","_debugExtMsg","data","consoleLoggingLevel","telemetryLoggingLevel","enableDebugExceptions","throwInternal","severity","logLevel","messageKey","logInternalMessage","warnToConsole","errorToConsole","resetInternalMessageCount","logMessage","throttleLimitMessage","throttleMessage","_getLogger","_throwInternal","_warnToConsole","_logInternalMessage","_objDefineProperty","version","instanceName","_dataUid","_createAccessor","prop","enumerable","configurable","_canAcceptData","nodeType","_getCache","theCache","id","createUniqueNamespace","includeVersion","createElmNodeData","accept","addDefault","kill","strWindow","strDocument","strDocumentMode","strNavigator","strHistory","strLocation","strConsole","strPerformance","strJSON","strCrypto","strMsCrypto","strReactNative","strMsie","strTrident","strXMLHttpRequest","_isTrident","_navUserAgentCheck","_enableMocks","_useXDomainRequest","_beaconsSupported","_hasProperty","theClass","property","supported","proto","tmp","getGlobalInst","gbl","hasWindow","window","Boolean","getWindow","hasDocument","document","getDocument","hasNavigator","navigator","getNavigator","hasHistory","history","getHistory","getLocation","checkForMock","mockLocation","location","getConsole","console","getPerformance","hasJSON","JSON","getJSON","getCrypto","getMsCrypto","isReactNative","nav","product","isIE","userAgent","toLowerCase","getIEVersion","userAgentStr","navigator_1","ua","doc","Math","max","parseInt","split","tridentVer","dumpObj","object","objectTypeDump","Object","toString","call","propertyValueDump","stack","isBeaconsSupported","sendBeacon","isFetchSupported","withKeepAlive","isSupported","request","useXDomainRequest","XDomainRequest","isXhrSupported","xmlHttpRequest","_canUseCookies","_cookieMgrs","newGuid","randomHexDigit","GuidRegex","c","r","v","perfNow","perf","now","generateW3CId","hexValues","oct","a","clockSequenceHi","substr","CoreUtils","undefined","isTypeof","isUndefined","isNullOrUndefined","hasOwnProperty","isFunction","isObject","isDate","isArray","isError","isString","isNumber","isBoolean","toISOString","arrForEach","arrIndexOf","arrMap","arrReduce","strTrim","objCreate","objKeys","objDefineAccessors","addEventHandler","dateNow","disableCookies","newId","randomValue","random32","mwcRandomSeed","mwcRandom32","_legacyCookieMgr","cookieMgr","legacyCanUseCookies","mgr","setEnabled","canUseCookies","isEnabled","getCookie","setCookie","domain","set","deleteCookie","del","ChannelControllerPriority","ChannelValidationMessage","_addChannelQueue","channelQueue","b","priority","queueItem","chain","createChannelControllerPlugin","_a","_processChannelQueue","theChannels","processFn","onComplete","waiting","_runChainOnComplete","channels","channelChain","chainCtx","_doTeardown","_getChannel","pluginIdentifier","ext","channelController","item","iterate","getChannel","flush","callBack","sendReason","cbTimeout","doneIterating","cbTimer","doCallback","clearTimeout","handled_1","setTimeout","_setQueue","createChannelQueues","extensionQueue_1","_super","TelemetryInitializerPlugin","_id","_initializers","_this","_base","addTelemetryInitializer","telemetryInitializer","theInitializer","remove","initializer","idx","splice","doNotSendItem","telemetryInitializersCount","i","exception","strValidationError","strNotificationManager","strSdkUnloadingError","strSdkNotInitialized","defaultInitConfig","loggingLevelConsole","_createPerfManager","notificationMgr","PerfManager","_validateExtensions","channelPriority","allExtensions","coreExtensions","extPriorities","extPriority","all","_isPluginPresent","exists","_createDummyNotificationManager","events","BaseCore","_isInitialized","_eventQueue","_notificationManager","_perfManager","_cfgPerfManager","_cookieManager","_pluginChain","_configExtensions","_coreExtensions","_channelControl","_channelConfig","_channelQueue","_isUnloading","_telemetryInitializerPlugin","_internalLogsEventName","_evtNamespace","_unloadHandlers","_internalLogPoller","_extensions","_createTelCtx","_getPluginChain","_initPluginChain","theExtensions","slice","_getPlugin","theExt","enabled","removeCb","pluginsToRemove","_removePlugins","removed","thePlugins","removeComplete","unloadChain","newConfigExtensions","newChannelConfig","newQueue","channel","_flushInternalLogs","iKey","instrumentationKey","time","Date","baseType","baseData","track","_flushChannels","_initDebugListener","_initPerfManager","enablePerfMgr","_initExtConfig","extConfig","NotificationManager","_updateHook","_logOrThrowError","notificationManager","releaseQueue","getTransmissionControls","controls","telemetryItem","getNotifyMgr","getCookieMgr","setCookieMgr","getPerfMgr","createPerfMgr","setPerfMgr","perfMgr","eventCnt","eventQueue","event","pollInternalLogs","eventName","interval","diagnosticLogInterval","clearInterval","setInterval","stopPollingInternalLogs","unload","unloadComplete","flushComplete","processUnloadCtx","_doUnload","addPlugin","replaceExisting","addCb","existingPlugin","_addPlugin","added","removedPlugins_1","evtNamespace","_runListeners","listeners","callback","perfEvtsSendAll","index","perfEvent","isChildEvt","AppInsightsCore","_validateTelemetryItem","_notifyInvalidEvent","manager","eventsDiscarded","strOnPrefix","strAttachEvent","strAddEventHelper","strDetachEvent","strRemoveEventListener","strEvents","strVisibilityChangeEvt","strPageHide","strUnload","strBeforeUnload","strPageHideNamespace","rRemoveEmptyNs","rRemoveTrailingEmptyNs","_guid","elmNodeData","eventNamespace","_normalizeNamespace","_getEvtNamespace","theNamespace_1","parsedEvent","exec","type","join","_getRegisteredEvents","evtName","aiEvts","registeredEvents","_doDetach","obj","handlerRef","useCapture","_doAttach","_doUnregister","unRegFn","theEvent","capture","_unregisterEvents","eventCache","evtType","mergeEvtNamespace","theNamespace","namespaces","newNamespaces","eventOn","registeredEvent","guid","eventOff","evtName_1","found_1","regEvent","attachEvent","eventNameWithoutOn","detachEvent","w","removeEventHandler","_addEventListeners","excludeEvents","addEventListeners","removeEventListeners","addPageUnloadEventListener","removePageUnloadEventListener","addPageHideEventListener","_handlePageVisibility","evt","visibilityState","pageUnloadAdded","removePageHideEventListener","strToISOString","cStrEndsWith","cStrStartsWith","strIndexOf","strMap","strReduce","cStrTrim","strToString","str__Proto","strConstructor","_objFreeze","freeze","_objKeys","seal","keys","StringProto","String","_strTrim","_strEndsWith","DateProto","_dataToISOString","_isArray","Array","_objToString","_fnToString","_objFunctionString","rCamelCase","rNormalizeInvalid","rLeadingNumeric","_objGetPrototypeOf","_getObjProto","newProto","theType","isNotNullOrUndefined","normalizeJsName","_all","letter","toUpperCase","match","objForEachKey","callbackfn","strEndsWith","search","_strEndsWithPoly","searchLen","valLen","pos","strContains","indexOf","_isArrayPoly","isPlainObject","date","_toISOStringPoly","getUTCFullYear","pad","num","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","toFixed","arr","thisArg","len","searchElement","fromIndex","from","abs","results","initialValue","str","_objKeysHasDontEnumBug","propertyIsEnumerable","_objKeysDontEnums","objType","dontEnumsLength","getProp","setProp","descriptor","_doNothing","deepFreeze","objFreeze","dt","getTime","getExceptionName","setValue","valChk","srcChk","theValue","getSetValue","isNotTruthy","isTruthy","throwError","Error","_createProxyFunction","source","funcName","srcFunc","src","originalArguments","proxyAssign","chkSet","_loop_1","proxyFunctionAs","theFunc","overwriteTarget","proxyFunctions","functionsToProxy","theFuncName","createClassFromInterface","defaults","class_1","_this_1","optimizeObject","theObject","objExtend","obj1","obj2","obj3","obj4","obj5","obj6","theArgs","extended","argLen","deep","arg","isArgArray","isArgObj","propOk","newValue","isNewArray","clone","strTelemetryPluginChain","strHasRunFlags","strGetTelCtx","_chainId","_getNextProxyStart","startAt","createTelemetryProxyChain","_createInternalContext","telemetryChain","_nextProxy","_onComplete","context","_next","_moveNext","ctx","getExtCfg","_getExtCfg","getConfig","_getConfig","hasNext","setNext","_iterateChain","_addOnComplete","that","_i","self","nextProxy","completeDetails","defaultValue","mergeDefault","theConfig","extensionConfig","newConfig_1","cfgValue","cb","createProcessTelemetryContext","internalContext","_processNext","_createNew","createProcessTelemetryUnloadContext","createProcessTelemetryUpdateContext","firstProxy","lastProxy_1","newProxy","createTelemetryPluginProxy","_setNext","chainId","hasProcessTelemetry","hasSetNext","setNextPlugin","proxyChain","_processTelemetry","_unloadPlugin","_updatePlugin","_processChain","processPluginFn","details","hasRun","hasRunContext","nextId","error","hasNextRun","_callProcessTelemetry","_callTeardown","pluginCore","_callUpdate","ProcessTelemetryContext","strExecutionContextKey","_defaultPerfManager","PerfEvent","payloadDetails","theDetails_1","accessorDefined","start","getCtx","key","ParentContextKey","ChildrenContextKey","setCtx","complete","childTime","childEvts","childEvt","exTime","payload","create","fire","doPerfActiveKey","doPerf","mgrSource","getSource","perfEvt","currentActive","children","ex","getGblPerfMgr","aiInstrumentHooks","cbNames","_arrLoop","_doCallbacks","callDetails","cbArgs","hookCtx","hook","cbks","inst","err","orgEx","hookErrorCb","_createFunctionHook","aiHook","funcThis","orgArgs","h","funcArgs","n","_replaceArg","_createArgs","f","rslt","_getOwner","checkPrototype","owner","InstrumentProto","callbacks","InstrumentFunc","_createInstrumentHook","newFunc","theHook","InstrumentEvent","UInt32Mask","MaxUInt32","_mwcSeeded","_mwcW","_mwcZ","_mwcSeed","seedValue","_autoSeedMwc","random","maxValue","floor","signed","getRandomValues","Uint32Array","maxLength","base64chars","number","chars","charAt","strToGMTString","strToUTCString","strCookie","strExpires","strEnabled","strIsCookieUseDisabled","strDisableCookiesUsage","strConfigCookieMgr","_supportsCookies","_allowUaSameSite","_parsedCookieValue","_doc","_cookieCache","_globalCookieConfig","_gblCookieMgr","createCookieMgr","_isMgrEnabled","_createCookieMgrConfig","rootConfig","cookieMgrCfg","cookieCfg","cookieDomain","cookiePath","cookieEnabled","safeGetCookieMgr","cookieMgrConfig","_path","path","_domain","_enabled","areCookiesSupported","gblManager","maxAgeSec","substring","_extractParts","_isIE","nowMs","expireMs","expiry","setTime","_formatDate","location_1","protocol","uaDisallowsSameSiteNone","setCookieFn","_setCookieValue","_formatCookieValue","_getCookieValue","purge","delCookie","parts","thePart","theDate","cookieValue","theCookie"],"mappings":"0HAAA,oEAMO,IAAIA,EAAU,OACVC,EAAqB,mB,oCCPhC,soBAOO,IAAIC,EAAW,GACXC,EAAsB,mBACtBC,EAAc,WACdC,EAAmB,gBACnBC,EAAmB,gBACnBC,EAAc,WACdC,EAAU,OACVC,EAAY,SACZC,EAAc,WACdC,EAAgB,cAChBC,EAAiB,cACjBC,EAAY,SACZC,EAAW,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AAc,OAClB,GAAI1C,EAAM,CACN,IAAI2C,EAAY3C,EAAKT,IAAc,OAC/BQ,IAAuB4C,IACvB1C,EAAesB,EAAcoB,GAC7B5C,EAAqB4C,GAEzBD,EAAc,eAAQzC,EAAavzB,IAAS,QAEhD,OAAOg2B,EAEX,SAASR,EAAgBx1B,EAAMg2B,GACvB1C,IACAA,EAAKT,GAAa7yB,EAAO,IAAMg2B,GAGhC,SAASV,EAAwBzpB,GACpC,QAAK,eAASA,QAQV,eAAYA,EAAW,sBAAuB,eAAYA,EAAW,yBAUrE,eAAYA,EAAW,oCAAsC,eAAYA,EAAW,aAAe,eAAYA,EAAW,gBAU1H,eAAYA,EAAW,qCAAsC,eAAYA,EAAW,kDAMpF,eAAYA,EAAW,cAAe,eAAYA,EAAW,kBAK7D,eAAYA,EAAW,iBAAoB,eAAYA,EAAW,eAMlE,eAAYA,EAAW,kBAAmB,eAAYA,EAAW","file":"js/chunk-vendors~0eba4586.a8baa387.js","sourcesContent":["/*\n * Application Insights JavaScript SDK - Core, 2.8.3\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.3\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","/*\n * Application Insights JavaScript SDK - Core, 2.8.3\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\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 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 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//# sourceMappingURL=TelemetryHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.3\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 /* WARNING */, 73 /* 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.3\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 * Application Insights JavaScript SDK - Core, 2.8.3\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.3\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 /* 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 /* 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.3\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 /* 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 /* 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 /* 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 /* MessageLimitPerPVExceeded */, throttleLimitMessage, false);\r\n _self.queue.push(throttleMessage);\r\n if (severity === 1 /* 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.3\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.3\";\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.3\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\n//# sourceMappingURL=EnvUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.3\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","/*\n * Application Insights JavaScript SDK - Core, 2.8.3\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 /* 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 /* 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.3\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 /* CRITICAL */, 64 /* 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.3\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 { 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 /* 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 /**\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 /* 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 /* 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 /* 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 /* 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 /* 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 // 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 }\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 /* 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 /* 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 /* 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 /* WARNING */, 73 /* 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.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.3\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 * Application Insights JavaScript SDK - Core, 2.8.3\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 /* 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 * Application Insights JavaScript SDK - Core, 2.8.3\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.3\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.3\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 /* WARNING */, 73 /* 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 /* 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 /* None */) {\r\n // Merge the defaults and configured values\r\n var newConfig_1 = objExtend(true, defaultValue, theConfig);\r\n if (config && mergeDefault === 2 /* 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 /* CRITICAL */, 73 /* 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.3\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.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { strShimFunction, strShimPrototype } from \"@microsoft/applicationinsights-shims\";\r\nimport { hasOwnProperty, _getObjProto } from \"./HelperFuncs\";\r\nimport { getGlobalInst } from \"./EnvUtils\";\r\nvar aiInstrumentHooks = \"_aiHooks\";\r\nvar cbNames = [\r\n \"req\", \"rsp\", \"hkErr\", \"fnErr\"\r\n];\r\n/** @ignore */\r\nfunction _arrLoop(arr, fn) {\r\n if (arr) {\r\n for (var lp = 0; lp < arr.length; lp++) {\r\n if (fn(arr[lp], lp)) {\r\n break;\r\n }\r\n }\r\n }\r\n}\r\n/** @ignore */\r\nfunction _doCallbacks(hooks, callDetails, cbArgs, hookCtx, type) {\r\n if (type >= 0 /* Request */ && type <= 2 /* HookError */) {\r\n _arrLoop(hooks, function (hook, idx) {\r\n var cbks = hook.cbks;\r\n var cb = cbks[cbNames[type]];\r\n if (cb) {\r\n // Set the specific hook context implementation using a lazy creation pattern\r\n callDetails.ctx = function () {\r\n var ctx = hookCtx[idx] = (hookCtx[idx] || {});\r\n return ctx;\r\n };\r\n try {\r\n cb.apply(callDetails.inst, cbArgs);\r\n }\r\n catch (err) {\r\n var orgEx = callDetails.err;\r\n try {\r\n // Report Hook error via the callback\r\n var hookErrorCb = cbks[cbNames[2 /* HookError */]];\r\n if (hookErrorCb) {\r\n callDetails.err = err;\r\n hookErrorCb.apply(callDetails.inst, cbArgs);\r\n }\r\n }\r\n catch (e) {\r\n // Not much we can do here -- swallowing the exception to avoid crashing the hosting app\r\n }\r\n finally {\r\n // restore the original exception (if any)\r\n callDetails.err = orgEx;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/** @ignore */\r\nfunction _createFunctionHook(aiHook) {\r\n // Define a temporary method that queues-up a the real method call\r\n return function () {\r\n var funcThis = this;\r\n // Capture the original arguments passed to the method\r\n var orgArgs = arguments;\r\n var hooks = aiHook.h;\r\n var funcArgs = {\r\n name: aiHook.n,\r\n inst: funcThis,\r\n ctx: null,\r\n set: _replaceArg\r\n };\r\n var hookCtx = [];\r\n var cbArgs = _createArgs([funcArgs], orgArgs);\r\n funcArgs.evt = getGlobalInst(\"event\");\r\n function _createArgs(target, theArgs) {\r\n _arrLoop(theArgs, function (arg) {\r\n target.push(arg);\r\n });\r\n return target;\r\n }\r\n function _replaceArg(idx, value) {\r\n orgArgs = _createArgs([], orgArgs);\r\n orgArgs[idx] = value;\r\n cbArgs = _createArgs([funcArgs], orgArgs);\r\n }\r\n // Call the pre-request hooks\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 0 /* Request */);\r\n // Call the original function was called\r\n var theFunc = aiHook.f;\r\n if (theFunc) {\r\n try {\r\n funcArgs.rslt = theFunc.apply(funcThis, orgArgs);\r\n }\r\n catch (err) {\r\n // Report the request callback\r\n funcArgs.err = err;\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 3 /* FunctionError */);\r\n // rethrow the original exception so anyone listening for it can catch the exception\r\n throw err;\r\n }\r\n }\r\n // Call the post-request hooks\r\n _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 1 /* Response */);\r\n return funcArgs.rslt;\r\n };\r\n}\r\n/** @ignore */\r\nfunction _getOwner(target, name, checkPrototype) {\r\n var owner = null;\r\n if (target) {\r\n if (hasOwnProperty(target, name)) {\r\n owner = target;\r\n }\r\n else if (checkPrototype) {\r\n owner = _getOwner(_getObjProto(target), name, false);\r\n }\r\n }\r\n return owner;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcName - The function name\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n */\r\nexport function InstrumentProto(target, funcName, callbacks) {\r\n if (target) {\r\n return InstrumentFunc(target[strShimPrototype], funcName, callbacks, false);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcNames - The function names to intercept and call\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n */\r\nexport function InstrumentProtos(target, funcNames, callbacks) {\r\n if (target) {\r\n return InstrumentFuncs(target[strShimPrototype], funcNames, callbacks, false);\r\n }\r\n return null;\r\n}\r\nfunction _createInstrumentHook(owner, funcName, fn, callbacks) {\r\n var aiHook = fn && fn[aiInstrumentHooks];\r\n if (!aiHook) {\r\n // Only hook the function once\r\n aiHook = {\r\n i: 0,\r\n n: funcName,\r\n f: fn,\r\n h: []\r\n };\r\n // Override (hook) the original function\r\n var newFunc = _createFunctionHook(aiHook);\r\n newFunc[aiInstrumentHooks] = aiHook; // Tag and store the function hooks\r\n owner[funcName] = newFunc;\r\n }\r\n var theHook = {\r\n // tslint:disable:object-literal-shorthand\r\n id: aiHook.i,\r\n cbks: callbacks,\r\n rm: function () {\r\n // DO NOT Use () => { shorthand for the function as the this gets replaced\r\n // with the outer this and not the this for theHook instance.\r\n var id = this.id;\r\n _arrLoop(aiHook.h, function (hook, idx) {\r\n if (hook.id === id) {\r\n aiHook.h.splice(idx, 1);\r\n return 1;\r\n }\r\n });\r\n }\r\n // tslint:enable:object-literal-shorthand\r\n };\r\n aiHook.i++;\r\n aiHook.h.push(theHook);\r\n return theHook;\r\n}\r\n/**\r\n * Intercept the named prototype functions for the target class / object\r\n * @param target - The target object\r\n * @param funcName - The function name\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function\r\n */\r\nexport function InstrumentFunc(target, funcName, callbacks, checkPrototype) {\r\n if (checkPrototype === void 0) { checkPrototype = true; }\r\n if (target && funcName && callbacks) {\r\n var owner = _getOwner(target, funcName, checkPrototype);\r\n if (owner) {\r\n var fn = owner[funcName];\r\n if (typeof fn === strShimFunction) {\r\n return _createInstrumentHook(owner, funcName, fn, callbacks);\r\n }\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Intercept the named functions for the target class / object\r\n * @param target - The target object\r\n * @param funcNames - The function names to intercept and call\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function\r\n */\r\nexport function InstrumentFuncs(target, funcNames, callbacks, checkPrototype) {\r\n if (checkPrototype === void 0) { checkPrototype = true; }\r\n var hooks = null;\r\n _arrLoop(funcNames, function (funcName) {\r\n var hook = InstrumentFunc(target, funcName, callbacks, checkPrototype);\r\n if (hook) {\r\n if (!hooks) {\r\n hooks = [];\r\n }\r\n hooks.push(hook);\r\n }\r\n });\r\n return hooks;\r\n}\r\n/**\r\n * Add an instrumentation hook to the provided named \"event\" for the target class / object, this doesn't check whether the\r\n * named \"event\" is in fact a function and just assigns the instrumentation hook to the target[evtName]\r\n * @param target - The target object\r\n * @param evtName - The name of the event\r\n * @param callbacks - The callbacks to configure and call whenever the function is called\r\n * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function\r\n */\r\nexport function InstrumentEvent(target, evtName, callbacks, checkPrototype) {\r\n if (target && evtName && callbacks) {\r\n var owner = _getOwner(target, evtName, checkPrototype) || target;\r\n if (owner) {\r\n return _createInstrumentHook(owner, evtName, owner[evtName], callbacks);\r\n }\r\n }\r\n return null;\r\n}\r\n//# sourceMappingURL=InstrumentHooks.js.map","/*\n * Application Insights JavaScript SDK - Core, 2.8.3\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.3\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 /* WARNING */, 68 /* 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"],"sourceRoot":""}