{"version":3,"file":"ms.analytics-web-4.0.2.min.js","sources":["../../../../common/temp/node_modules/@microsoft/applicationinsights-shims/dist-es5/Constants.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/internal/constants.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/safe_get.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/base.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/get_own_prop_desc.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/has_own_prop.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/has_own.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/for_each_key.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/internal/map.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/throw.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/object.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/internal/global.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/symbol/well_known.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/enum.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/string/as_string.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/diagnostics.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/internal/unwrapFunction.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/math/min_max.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/string/slice.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/string/substring.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/string/starts_with.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/polyfills/symbol.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/define.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/lazy.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/safe_lazy.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/environment.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/symbol/symbol.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/iterator/forOf.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/iterator/iterator.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/funcs/fnApply.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/array/append.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/array/forEach.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/array/indexOf.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/set_proto.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/array/map.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/array/slice.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/funcs/fnCall.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/create.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/customError.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/date.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/polyfills/trim.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/is_plain_object.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/string/trim.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/object/copy.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/extend.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/length.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/helpers/perf.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/string/ends_with.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/string/index_of.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/timer/handler.js","../../../../common/temp/node_modules/@nevware21/ts-utils/dist-es5/timer/timeout.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-shims/dist-es5/TsLibShims.js","../../../../common/temp/node_modules/@microsoft/dynamicproto-js/dist-es5/DynamicProto.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK.Interfaces/IChannelControls.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/AggregationError.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK.Enums/EnumHelperFuncs.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK.Enums/EventsDiscardedReason.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/__DynamicConstants.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/promise/await.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/internal/state.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/promise/event.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/promise/base.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/promise/nativePromise.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/promise/promise.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/internal/constants.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/promise/asyncPromise.js","../../../../common/temp/node_modules/@nevware21/ts-async/dist-es5/promise/itemProcessor.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/InternalConstants.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/HelperFuncs.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/EnvUtils.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/RandomHelper.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/DataCacheHelper.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/ConfigDefaults.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/DynamicSupport.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/DynamicProperty.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/DynamicState.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/DynamicConfig.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/AsyncUtils.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/Config/ConfigDefaultHelpers.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/DbgExtensionUtils.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/DiagnosticLogger.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/CookieMgr.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/NotificationManager.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/PerfManager.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/CoreUtils.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/W3cTraceParent.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/TelemetryHelpers.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/ProcessTelemetryContext.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/UnloadHandlerContainer.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/UnloadHookContainer.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/BaseTelemetryPlugin.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/TelemetryInitializerPlugin.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/AppInsightsCore.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/Constants.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/EventHelpers.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-core-js/dist-es5/JavaScriptSDK/InstrumentHooks.js","../../../../common/temp/node_modules/@microsoft/1ds-core-js/dist-es5/InternalConstants.js","../../../../common/temp/node_modules/@microsoft/1ds-core-js/dist-es5/__DynamicConstants.js","../../../../common/temp/node_modules/@microsoft/1ds-core-js/dist-es5/Utils.js","../../../../common/temp/node_modules/@microsoft/1ds-core-js/dist-es5/AppInsightsCore.js","../../../../common/temp/node_modules/@microsoft/1ds-core-js/dist-es5/Enums.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/DataModels.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/InternalConstants.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/__DynamicConstants.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/EventBatch.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/ClockSkewManager.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/KillSwitch.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/RetryPolicy.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/Serializer.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/TimeoutOverrideWrapper.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/HttpManager.js","../../../../common/temp/node_modules/@microsoft/1ds-post-js/dist-es5/PostChannel.js","../../../../extensions/properties/dist-es5/InternalConstants.js","../../../../extensions/properties/dist-es5/Utils.js","../../../../extensions/properties/dist-es5/ExtensionKeys.js","../../../../extensions/properties/dist-es5/context/Session.js","../../../../extensions/properties/dist-es5/SessionManager.js","../../../../extensions/properties/dist-es5/context/Application.js","../../../../extensions/properties/dist-es5/context/Cloud.js","../../../../extensions/properties/dist-es5/context/Device.js","../../../../extensions/properties/dist-es5/context/IntWeb.js","../../../../extensions/properties/dist-es5/context/Loc.js","../../../../extensions/properties/dist-es5/context/OperatingSystem.js","../../../../extensions/properties/dist-es5/context/Sdk.js","../../../../extensions/properties/dist-es5/context/Trace.js","../../../../extensions/properties/dist-es5/context/User.js","../../../../extensions/properties/dist-es5/context/Utc.js","../../../../extensions/properties/dist-es5/context/Web.js","../../../../extensions/properties/dist-es5/TelemetryContext.js","../../../../extensions/properties/dist-es5/PropertiesPlugin.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Constants.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/__DynamicConstants.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/Common/DataSanitizer.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/UrlHelperFuncs.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Util.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Enums.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/StorageHelperFuncs.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/Event.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/Exception.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/Common/DataPoint.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/Metric.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/HelperFuncs.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/PageView.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/RemoteDependencyData.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/Trace.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/Telemetry/PageViewPerformance.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/TelemetryItemCreator.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/DomHelperFuncs.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-common/dist-es5/applicationinsights-common.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-analytics-js/dist-es5/__DynamicConstants.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-analytics-js/dist-es5/JavaScriptSDK/Telemetry/PageViewManager.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-analytics-js/dist-es5/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-analytics-js/dist-es5/JavaScriptSDK/Telemetry/PageVisitTimeManager.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-analytics-js/dist-es5/JavaScriptSDK/Timing.js","../../../../common/temp/node_modules/@microsoft/applicationinsights-analytics-js/dist-es5/JavaScriptSDK/AnalyticsPlugin.js","../../../../extensions/webAnalytics/dist-es5/common/Utils.js","../../../../extensions/webAnalytics/dist-es5/DataCollector.js","../../../../extensions/webAnalytics/dist-es5/Id.js","../../../../extensions/webAnalytics/dist-es5/Timespan.js","../../../../extensions/webAnalytics/dist-es5/events/WebEvent.js","../../../../extensions/webAnalytics/dist-es5/Behaviors.js","../../../../extensions/webAnalytics/dist-es5/common/Constants.js","../../../../extensions/webAnalytics/dist-es5/events/ContentUpdate.js","../../../../extensions/webAnalytics/dist-es5/Enums.js","../../../../extensions/webAnalytics/dist-es5/events/PageAction.js","../../../../extensions/webAnalytics/dist-es5/events/PageUnload.js","../../../../extensions/webAnalytics/dist-es5/events/PageView.js","../../../../extensions/webAnalytics/dist-es5/events/PageViewPerformance.js","../../../../extensions/webAnalytics/dist-es5/handlers/AutoCaptureHandler.js","../../../../extensions/webAnalytics/dist-es5/handlers/DomContentHandler.js","../../../../extensions/webAnalytics/dist-es5/WebAnalyticsPlugin.js","../../dist-es5/ApplicationInsights.js","../../dist-es5/Index.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport var strShimFunction = \"function\";\r\nexport var strShimObject = \"object\";\r\nexport var strShimUndefined = \"undefined\";\r\nexport var strShimPrototype = \"prototype\";\r\nexport var strDefault = \"default\";\r\nexport var ObjClass = Object;\r\nexport var ObjProto = ObjClass[strShimPrototype];\r\n//# sourceMappingURL=Constants.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\n// These constants are currently NOT exported directly, we may export them later associated with a frozen namespace (maybe)\r\n// For now do NOT expect that we will export these values.\r\nexport var UNDEF_VALUE = undefined;\r\nexport var NULL_VALUE = null;\r\nexport var EMPTY = \"\";\r\nexport var BOOLEAN = \"boolean\";\r\nexport var FUNCTION = \"function\";\r\nexport var NUMBER = \"number\";\r\nexport var OBJECT = \"object\";\r\nexport var PROTOTYPE = \"prototype\";\r\nexport var __PROTO__ = \"__proto__\";\r\nexport var STRING = \"string\";\r\nexport var UNDEFINED = \"undefined\";\r\nexport var CONSTRUCTOR = \"constructor\";\r\nexport var SYMBOL = \"Symbol\";\r\nexport var POLYFILL_TAG = \"_polyfill\";\r\nexport var INDEX_OF = \"indexOf\";\r\nexport var LAST_INDEX_OF = \"lastIndexOf\";\r\nexport var LENGTH = \"length\";\r\nexport var DONE = \"done\";\r\nexport var VALUE = \"value\";\r\nexport var NAME = \"name\";\r\nexport var SLICE = \"slice\";\r\n/**\r\n * @ignore\r\n */\r\nexport var ObjClass = Object;\r\n/**\r\n * @ignore\r\n */\r\nexport var ObjProto = ObjClass[PROTOTYPE];\r\n/**\r\n * @ignore\r\n */\r\nexport var StrCls = String;\r\n/**\r\n * @ignore\r\n */\r\nexport var StrProto = StrCls[PROTOTYPE];\r\n/**\r\n * @ignore\r\n */\r\nexport var MathCls = Math;\r\n/**\r\n * @ignore\r\n */\r\nexport var ArrCls = Array;\r\n/**\r\n * @ignore\r\n */\r\nexport var ArrProto = ArrCls[PROTOTYPE];\r\n//# sourceMappingURL=constants.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\n/**\r\n * Function to safely execute a callback function, if the function throws the provided default\r\n * value will be returned.\r\n * @since 0.9.5\r\n * @group Safe\r\n * @param cb - Callback function be wrapped with an exception\r\n * @param defValue - The default value to return when an exception is thrown\r\n * @returns The result of the callback function or the default if an exception occurred calling the callback\r\n * function.\r\n * @example\r\n * ```ts\r\n * let theExpression = \"{ invalid: json value\";\r\n *\r\n * let result = safeGet(() => {\r\n * return JSON.parse(theExpression);\r\n * }, {});\r\n *\r\n * // result === {};\r\n * ```\r\n */\r\nexport function safeGet(cb, defValue) {\r\n var result = defValue;\r\n try {\r\n result = cb();\r\n }\r\n catch (e) {\r\n // Do nothing\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=safe_get.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { ArrCls, BOOLEAN, FUNCTION, NULL_VALUE, NUMBER, OBJECT, ObjProto, STRING, UNDEFINED, UNDEF_VALUE } from \"../internal/constants\";\r\nimport { safeGet } from \"./safe_get\";\r\nvar PRIMITIVE_TYPES = [STRING, NUMBER, BOOLEAN, UNDEFINED, \"symbol\", \"bigint\"];\r\n/**\r\n * @ignore\r\n * @internal\r\n * Create and returns a function that will return `true` if the argument passed\r\n * to it matches the provided type.\r\n * @param theType - The type to match against the `typeof value`\r\n * @returns A function which takes a single argument and returns a boolean\r\n */\r\nexport function _createIs(theType) {\r\n return function (value) {\r\n return typeof value === theType;\r\n };\r\n}\r\n/**\r\n * @ignore\r\n * @internal\r\n * Create and returns a function that will return `true` if the argument passed\r\n * to it matches the object type specified based on {@link objToString}.\r\n * @param - The object name to match for the `objToString(value)`\r\n * @returns A function which takes a single argument and returns a boolean\r\n */\r\nexport function _createObjIs(theName) {\r\n var theType = \"[object \" + theName + \"]\";\r\n return function (value) {\r\n return !!(value && objToString(value) === theType);\r\n };\r\n}\r\n/**\r\n * The `objToString()` method returns a string representing the object. This explicitly\r\n * always calls the `Object.prototype.toString()` method.\r\n *\r\n * An object's toString() method is most commonly invoked when that object undergoes:\r\n * - explicit type conversion to a string (for example, String(myObject))\r\n * - implicit type coercion into a string (for example, myObject + \"hello world\")\r\n *\r\n * @group Object\r\n * @param value - The object to be converted into a string\r\n * @returns A string representation of the object\r\n * @example\r\n * ```ts\r\n * objToString(new Date()); // [object Date]\r\n * objToString(new String()); // [object String]\r\n *\r\n * // Math has its Symbol.toStringTag\r\n * objToString(Math); // [object Math]\r\n *\r\n * objToString(undefined); // [object Undefined]\r\n * objToString(null); // [object Null]\r\n * ```\r\n */\r\nexport function objToString(value) {\r\n return ObjProto.toString.call(value);\r\n}\r\n/**\r\n * Validate if the provided value object is of the expected type\r\n * @group Type Identity\r\n * @param value - The value to check\r\n * @param theType - The expected type name as a string\r\n * @returns `true` if the value matches the provided type\r\n */\r\nexport function isTypeof(value, theType) {\r\n return typeof value === theType;\r\n}\r\n/**\r\n * Checks if the provided value is undefined or contains the string value \"undefined\",\r\n * if you want to consider the string value as undefined see {@link isStrictUndefined}\r\n * @group Type Identity\r\n * @group Value Check\r\n * @param value - The value to check\r\n * @returns true if the value is undefined or \"undefined\", otherwise false\r\n * @example\r\n * ```ts\r\n * isUndefined(undefined); // true\r\n * isUndefined(\"undefined\"); // true\r\n *\r\n * isUndefined(null); // false\r\n * isUndefined(\"null\"); // false\r\n * isUndefined(\"1\"); // false\r\n * isUndefined(\"aa\"); // false\r\n * isUndefined(new Date()); // false\r\n * isUndefined(1); // false\r\n * isUndefined(\"\"); // false\r\n * isUndefined(_dummyFunction); // false\r\n * isUndefined([]); // false\r\n * isUndefined(new Array(1)); // false\r\n * isUndefined(true); // false\r\n * isUndefined(false); // false\r\n * isUndefined(\"true\"); // false\r\n * isUndefined(\"false\"); // false\r\n * isUndefined(new Boolean(true)); // false\r\n * isUndefined(new Boolean(false)); // false\r\n * isUndefined(new Boolean(\"true\")); // false\r\n * isUndefined(new Boolean(\"false\")); // false\r\n * isUndefined(Boolean(true)); // false\r\n * isUndefined(Boolean(false)); // false\r\n * isUndefined(Boolean(\"true\")); // false\r\n * isUndefined(Boolean(\"false\")); // false\r\n * isUndefined(new RegExp(\"\")); // false\r\n * isUndefined(new ArrayBuffer(0)); // false\r\n * isUndefined(new Error(\"Test Error\"));// false\r\n * isUndefined(new TypeError(\"Test TypeError\")); // false\r\n * isUndefined(new TestError(\"Test TestError\")); // false\r\n * isUndefined(_dummyError()); // false\r\n * isUndefined(Promise.reject()); // false\r\n * isUndefined(Promise.resolve()); // false\r\n * isUndefined(new Promise(() => {})); // false\r\n * isUndefined(_simplePromise()); // false\r\n * isUndefined(_simplePromiseLike()); // false\r\n * isUndefined(Object.create(null)); // false\r\n * isUndefined(polyObjCreate(null)); // false\r\n * ```\r\n */\r\nexport function isUndefined(value) {\r\n return typeof value === UNDEFINED || value === UNDEFINED;\r\n}\r\n/**\r\n * Checks if the provided value is undefined, a string value of \"undefined\" is NOT considered\r\n * to be undefined.\r\n * @group Type Identity\r\n * @group Value Check\r\n * @param value - The value to check\r\n * @returns true if the typeof value === UNDEFINED\r\n * @example\r\n * ```ts\r\n * isStrictUndefined(undefined); // true\r\n *\r\n * isStrictUndefined(null); // false\r\n * isStrictUndefined(\"null\"); // false\r\n * isStrictUndefined(\"undefined\"); // false\r\n * isStrictUndefined(\"1\"); // false\r\n * isStrictUndefined(\"aa\"); // false\r\n * isStrictUndefined(new Date()); // false\r\n * isStrictUndefined(0); // false\r\n * isStrictUndefined(1); // false\r\n * isStrictUndefined(\"\"); // false\r\n * ```\r\n */\r\nexport function isStrictUndefined(arg) {\r\n return !isDefined(arg);\r\n}\r\n/**\r\n * Checks if the provided value is null, undefined or contains the string value of \"undefined\".\r\n * @group Type Identity\r\n * @group Value Check\r\n * @param value - The value to check\r\n * @returns `true` if the value is `null` or `undefined`\r\n * @example\r\n * ```ts\r\n * isNullOrUndefined(null); // true\r\n * isNullOrUndefined(undefined); // true\r\n * isNullOrUndefined(\"undefined\"); // true\r\n *\r\n * let value = null;\r\n * isNullOrUndefined(value); // true\r\n * let value = undefined;\r\n * isNullOrUndefined(value); // true\r\n *\r\n * isNullOrUndefined(\"\"); // false\r\n * isNullOrUndefined(0); // false\r\n * isNullOrUndefined(new Date()); // false\r\n * isNullOrUndefined(true); // false\r\n * isNullOrUndefined(false); // false\r\n * ```\r\n */\r\nexport function isNullOrUndefined(value) {\r\n return value === NULL_VALUE || isUndefined(value);\r\n}\r\n/**\r\n * Checks if the provided value is null, undefined only, a string value of \"undefined\" is NOT considered\r\n * to be undefined.\r\n * @group Type Identity\r\n * @group Value Check\r\n * @param value - The value to check\r\n * @returns\r\n * @example\r\n * ```ts\r\n * isStrictNullOrUndefined(null); // true\r\n * isStrictNullOrUndefined(undefined); // true\r\n * isStrictNullOrUndefined(\"undefined\"); // false\r\n *\r\n * let value = null;\r\n * isStrictNullOrUndefined(value); // true\r\n * let value = undefined;\r\n * isStrictNullOrUndefined(value); // true\r\n *\r\n * isStrictNullOrUndefined(\"\"); // false\r\n * isStrictNullOrUndefined(0); // false\r\n * isStrictNullOrUndefined(new Date()); // false\r\n * isStrictNullOrUndefined(true); // false\r\n * isStrictNullOrUndefined(false); // false\r\n * ```\r\n */\r\nexport function isStrictNullOrUndefined(value) {\r\n return value === NULL_VALUE || !isDefined(value);\r\n}\r\n/**\r\n * Checks if the passed value is defined, which means it has any value and is not undefined.\r\n * A string value of \"undefined\" is considered to be defined.\r\n * @group Value Check\r\n * @param arg - The value to check\r\n * @returns true if arg has a value (is not === undefined)\r\n * @example\r\n * ```ts\r\n * isDefined(null); // false\r\n * isDefined(undefined); // false\r\n * isDefined(\"undefined\"); // true\r\n *\r\n * let value = null;\r\n * isDefined(value); // false\r\n * let value = undefined;\r\n * isDefined(value); // false\r\n *\r\n * isDefined(\"\"); // true\r\n * isDefined(0); // true\r\n * isDefined(new Date()); // true\r\n * isDefined(true); // true\r\n * isDefined(false); // true\r\n * ```\r\n */\r\nexport function isDefined(arg) {\r\n return !!arg || arg !== UNDEF_VALUE;\r\n}\r\n/**\r\n * Identifies whether the provided value is a JavaScript [primitive](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)\r\n * which is when is it not an object and has no methods or properties. There are 7 primitive data types:\r\n * - string\r\n * - number\r\n * - bigint\r\n * - boolean\r\n * - undefined\r\n * - null\r\n * - symbol\r\n *\r\n * Most of the time, a primitive value is represented directly at the lowest level of the language implementation.\r\n *\r\n * All primitives are immutable; that is, they cannot be altered. It is important not to confuse a primitive itself\r\n * with a variable assigned a primitive value. The variable may be reassigned to a new value, but the existing value\r\n * can not be changed in the ways that objects, arrays, and functions can be altered. The language does not offer\r\n * utilities to mutate primitive values.\r\n * @since 0.4.4\r\n * @group Type Identity\r\n * @param value - The value to check whether it's a primitive value\r\n * @example\r\n * ```ts\r\n * isPrimitive(null); // true\r\n * isPrimitive(undefined); // true\r\n * isPrimitive(\"null\"); // true\r\n * isPrimitive(\"undefined\"); // true\r\n * isPrimitive(\"1\"); // true\r\n * isPrimitive(\"aa\"); // true\r\n * isPrimitive(1); // true\r\n * isPrimitive(Number(2)); // true\r\n * isPrimitive(\"\"); // true\r\n * isPrimitive(String(\"\")); // true\r\n * isPrimitive(true); // true\r\n * isPrimitive(false); // true\r\n * isPrimitive(\"true\"); // true\r\n * isPrimitive(\"false\"); // true\r\n * isPrimitive(BigInt(42)); // true\r\n * isPrimitive(Symbol.for(\"Hello\")); // true\r\n *\r\n * isPrimitive(new String(\"aa\")); // false\r\n * isPrimitive(new Date()); // false\r\n * isPrimitive(_dummyFunction); // false\r\n * isPrimitive([]); // false\r\n * isPrimitive(new Array(1)); // false\r\n * isPrimitive(new Boolean(true)); // false\r\n * isPrimitive(new Boolean(false)); // false\r\n * isPrimitive(new Boolean(\"true\")); // false\r\n * isPrimitive(new Boolean(\"false\")); // false\r\n * ```\r\n */\r\nexport var isPrimitive = function (value) {\r\n return value === NULL_VALUE || isPrimitiveType(typeof value);\r\n};\r\n/**\r\n * Identifies whether the provided value is a JavaScript [primitive](https://developer.mozilla.org/en-US/docs/Glossary/Primitive)\r\n * which is when is it not an object and has no methods or properties. There are 6 primitive data types:\r\n * - string\r\n * - number\r\n * - bigint\r\n * - boolean\r\n * - undefined\r\n * - symbol\r\n *\r\n * Most of the time, a primitive value is represented directly at the lowest level of the language implementation.\r\n *\r\n * All primitives are immutable; that is, they cannot be altered. It is important not to confuse a primitive itself\r\n * with a variable assigned a primitive value. The variable may be reassigned to a new value, but the existing value\r\n * can not be changed in the ways that objects, arrays, and functions can be altered. The language does not offer\r\n * utilities to mutate primitive values.\r\n * @since 0.9.6\r\n * @group Type Identity\r\n * @param theType - The type as a string value to be checked whther it's a primitive type, this should be the value\r\n * returned from `typeof value`.\r\n * @example\r\n * ```ts\r\n * isPrimitiveType(null); // false\r\n * isPrimitiveType(undefined); // false\r\n * isPrimitiveType(\"null\"); // false\r\n * isPrimitiveType(\"undefined\"); // false\r\n * isPrimitiveType(\"1\"); // false\r\n * isPrimitiveType(\"aa\"); // false\r\n * isPrimitiveType(1); // false\r\n * isPrimitiveType(Number(2)); // false\r\n * isPrimitiveType(\"\"); // false\r\n * isPrimitiveType(String(\"\")); // false\r\n * isPrimitiveType(true); // false\r\n * isPrimitiveType(false); // false\r\n * isPrimitiveType(\"true\"); // false\r\n * isPrimitiveType(\"false\"); // false\r\n * isPrimitiveType(BigInt(42)); // false\r\n * isPrimitiveType(Symbol.for(\"Hello\")); // false\r\n *\r\n * isPrimitiveType(\"string\"); // true\r\n * isPrimitiveType(\"number\"); // true\r\n * isPrimitiveType(\"boolean\"); // true\r\n * isPrimitiveType(\"undefined\"); // true\r\n * isPrimitiveType(\"symbol\"); // true\r\n * isPrimitiveType(\"bigint\"); // true\r\n * ```\r\n */\r\nexport var isPrimitiveType = function (theType) {\r\n return theType !== OBJECT && PRIMITIVE_TYPES.indexOf(theType) !== -1;\r\n};\r\n/**\r\n * Checks to see if the past value is a string value\r\n * @group Type Identity\r\n * @group String\r\n * @param value - The value to check\r\n * @returns\r\n * @example\r\n * ```ts\r\n * isString(\"\"); // true\r\n * isString(\"null\"); // true\r\n * isString(\"undefined\"); // true\r\n * isString(String(\"\")); // true\r\n *\r\n * isString(null); // false\r\n * isString(undefined); // false\r\n * isString(0); // false\r\n * ```\r\n */\r\nexport var isString = _createIs(STRING);\r\n/**\r\n * Checks to see if the past value is a function value\r\n * @group Type Identity\r\n * @param value - The value to check\r\n * @returns\r\n * @example\r\n * ```ts\r\n * function myFunction() { }\r\n * isFunction(null); // false\r\n * isFunction(undefined); // false\r\n * isFunction(\"null\"); // false\r\n * isFunction(\"undefined\"); // false\r\n * isFunction(\"1\"); // false\r\n * isFunction(\"aa\"); // false\r\n * isFunction(new Date()); // false\r\n * isFunction(1); // false\r\n * isFunction(\"\"); // false\r\n * isFunction(myFunction); // true\r\n * isFunction([]); // false\r\n * isFunction(new Array(1)); // false\r\n * ```\r\n */\r\nexport var isFunction = _createIs(FUNCTION);\r\n/**\r\n * Checks to see if the past value is an object value\r\n * @group Type Identity\r\n * @group Object\r\n * @typeParam T - The object type, defaults to any\r\n * @param value - The value to check\r\n * @returns\r\n */\r\nexport function isObject(value) {\r\n if (!value && isNullOrUndefined(value)) {\r\n return false;\r\n }\r\n return !!value && typeof value === OBJECT;\r\n}\r\n/**\r\n * Checks if the type of value is an Array.\r\n *\r\n * @group Type Identity\r\n * @group Array\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a Array, false otherwise.\r\n * @example\r\n * ```ts\r\n * import { isArray, isObject } from \"@nevware21/ts-utils\";\r\n *\r\n * function performAction(value: any) {\r\n * if (isArray(value) || isObject(value)) {\r\n * // Do something\r\n * } else {\r\n * // Do something else\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport var isArray = ArrCls.isArray;\r\n/**\r\n * Check if an object is of type Date\r\n * @group Type Identity\r\n * @example\r\n * ```ts\r\n * import { isDate } from \"@nevware21/ts-utils\";\r\n *\r\n * let _theDate = null;\r\n *\r\n * function getSetDate(newDate?: any) {\r\n * _theDate = isDate(newDate) ? newDate : new Date();\r\n *\r\n * return _theDate;\r\n * }\r\n * ```\r\n */\r\nexport var isDate = _createObjIs(\"Date\");\r\n/**\r\n * Checks if the type of value is a number.\r\n * @group Type Identity\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 var isNumber = _createIs(NUMBER);\r\n/**\r\n * Checks if the type of value is a boolean.\r\n * @group Type Identity\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 var isBoolean = _createIs(BOOLEAN);\r\n/**\r\n * Determines if a value is a regular expression object.\r\n * @group Type Identity\r\n * @param {*} value Reference to check.\r\n * @returns {boolean} True if `value` is a `RegExp`.\r\n */\r\nexport var isRegExp = _createObjIs(\"RegExp\");\r\n/**\r\n * Checks if the type of value is a File object.\r\n * @group Type Identity\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a File, false otherwise.\r\n */\r\nexport var isFile = _createObjIs(\"File\");\r\n/**\r\n * Checks if the type of value is a FormData object.\r\n * @group Type Identity\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a FormData, false otherwise.\r\n */\r\nexport var isFormData = _createObjIs(\"FormData\");\r\n/**\r\n * Checks if the type of value is a Blob object.\r\n * @group Type Identity\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a Blob, false otherwise.\r\n */\r\nexport var isBlob = _createObjIs(\"Blob\");\r\n/**\r\n * Checks if the type of value is a ArrayBuffer object.\r\n * @group Type Identity\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a ArrayBuffer, false otherwise.\r\n */\r\nexport var isArrayBuffer = _createObjIs(\"ArrayBuffer\");\r\n/**\r\n * Checks if the type of value is a Error object.\r\n * @group Type Identity\r\n * @group Error\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a Error, false otherwise.\r\n */\r\nexport var isError = _createObjIs(\"Error\");\r\n/**\r\n * Checks if the type of value is a PromiseLike instance (contains a then function).\r\n * @group Type Identity\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a PromiseLike, false otherwise.\r\n */\r\nexport function isPromiseLike(value) {\r\n return !!value && isFunction(value.then);\r\n}\r\n/**\r\n * Checks if the type of value is a PromiseLike instance (contains a then function).\r\n * This is an alias for {@link isPromiseLike}.\r\n * @group Type Identity\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a PromiseLike, false otherwise.\r\n */\r\nexport var isThenable = isPromiseLike;\r\n/**\r\n * Checks if the type of value is a Promise instance (contains then and catch functions).\r\n * @group Type Identity\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is a Promise, false otherwise.\r\n */\r\nexport function isPromise(value) {\r\n return isPromiseLike(value) && isFunction(value.catch);\r\n}\r\n/**\r\n * Checks if the type of value does not evaluate to true value, handling some special\r\n * case usages of Boolean(true/false) and new Boolean(true/false).\r\n * @group Value Check\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is not truthy, false otherwise.\r\n */\r\nexport function isNotTruthy(value) {\r\n return !value || !safeGet(function () { return (value && (0 + value)); }, value);\r\n}\r\n/**\r\n * Checks if the type of value evaluates to true value, handling some special\r\n * case usages of Boolean(true/false) and new Boolean(true/false).\r\n * @group Value Check\r\n * @param {any} value - Value to be checked.\r\n * @return {boolean} True if the value is not truthy, false otherwise.\r\n */\r\nexport function isTruthy(value) {\r\n // Objects created with no prototype (Object.create(null)) cannot be converted to primitives\r\n // Which causes this code to throw, additionally just using !! also fails for Boolean objects\r\n // !!(new Boolean(false)) evaluates to true\r\n return !(!value || safeGet(function () { return !(value && (0 + value)); }, !value));\r\n //return !(!value || !(value && (0 + value)));\r\n}\r\n//# sourceMappingURL=base.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { ObjClass } from \"../internal/constants\";\r\n/**\r\n * The objGetOwnPropertyDescriptor() method returns an object describing the configuration of a specific property on\r\n * a given object (that is, one directly present on an object and not in the object's prototype chain). The object\r\n * returned is mutable but mutating it has no effect on the original property's configuration.\r\n * @since 0.4.3\r\n * @group Object\r\n * @param target - Object that contains the property.\r\n * @param prop - Name of the property.\r\n * @returns A property descriptor of the given property if it exists on the object, otherwise undefined.\r\n *\r\n * @example\r\n * ```ts\r\n * o = {};\r\n * objDefineProp(o, 'qux', {\r\n * value: 8675309,\r\n * writable: false,\r\n * enumerable: false\r\n * });\r\n * d = objGetOwnPropertyDescriptor(o, 'qux');\r\n * // d is {\r\n * // value: 8675309,\r\n * // writable: false,\r\n * // enumerable: false,\r\n * // configurable: false\r\n * // }\r\n *\r\n * objGetOwnPropertyDescriptor('foo', 0);\r\n * // TypeError: \"foo\" is not an object // ES5 code\r\n *\r\n * objGetOwnPropertyDescriptor('foo', 0);\r\n * // Object returned by ES2015 code: {\r\n * // configurable: false,\r\n * // enumerable: true,\r\n * // value: \"f\",\r\n * // writable: false\r\n * // }\r\n * ```\r\n * Note: In ES5, if the first argument to this method is not an object (a primitive), then it will cause a TypeError. In ES2015, a non-object first argument will be coerced to an object at first.\r\n */\r\nexport var objGetOwnPropertyDescriptor = ObjClass.getOwnPropertyDescriptor;\r\n//# sourceMappingURL=get_own_prop_desc.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { ObjProto } from \"../internal/constants\";\r\n/**\r\n * The objHasOwnProperty() method returns a boolean indicating whether the object\r\n * has the specified property as its own property (as opposed to inheriting it).\r\n *\r\n * The objHasOwnProperty() method returns true if the specified property is a direct\r\n * property of the object — even if the value is null or undefined. The method returns\r\n * false if the property is inherited, or has not been declared at all. Unlike the in\r\n * operator, this method does not check for the specified property in the object's\r\n * prototype chain.\r\n *\r\n * The method can be called on most JavaScript objects, because most objects descend\r\n * from Object, and hence inherit its methods. For example Array is an Object, so you\r\n * can use objHasOwnProperty() method to check whether an index exists:\r\n * @group Object\r\n * @param obj - The object being evaluated\r\n * @param prop - The String or Symbol of the property to test\r\n * @returns `true` if the object has the specified property as own property; otherwise `false`\r\n * @example\r\n * ```ts\r\n * let example = {};\r\n * objHasOwnProperty(example, 'prop'); // false\r\n *\r\n * example.prop = 'exists';\r\n * objHasOwnProperty(example, 'prop'); // true - 'prop' has been defined\r\n *\r\n * example.prop = null;\r\n * objHasOwnProperty(example, 'prop'); // true - own property exists with value of null\r\n *\r\n * example.prop = undefined;\r\n * objHasOwnProperty(example, 'prop'); // true - own property exists with value of undefined\r\n * ```\r\n */\r\nexport function objHasOwnProperty(obj, prop) {\r\n return obj && ObjProto.hasOwnProperty.call(obj, prop);\r\n}\r\n//# sourceMappingURL=has_own_prop.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { ObjClass } from \"../internal/constants\";\r\nimport { objGetOwnPropertyDescriptor } from \"./get_own_prop_desc\";\r\nimport { objHasOwnProperty } from \"./has_own_prop\";\r\n/**\r\n * The objHasOwn() method returns a boolean indicating whether the object\r\n * has the specified property as its own property (as opposed to inheriting it).\r\n * If the property is inherited, or does not exist, the method returns false.\r\n *\r\n * The objHasOwn() method returns true if the specified property is a direct property\r\n * of the object — even if the property value is null or undefined. The method returns\r\n * false if the property is inherited, or has not been declared at all. Unlike the in operator,\r\n * this method does not check for the specified property in the object's prototype chain.\r\n *\r\n * It is recommended over {@link objHasOwnProperty} () because it works for objects created using\r\n * objCreate(null) and with objects that have overridden the inherited hasOwnProperty() method.\r\n * While it is possible to workaround these problems by calling Object.prototype.hasOwnProperty()\r\n * on an external object, Object.hasOwn() is more intuitive.\r\n *\r\n * @since 0.4.3\r\n * @group Object\r\n * @param obj - The object being evaluated\r\n * @param prop - The String or Symbol of the property to test\r\n * @returns `true` if the object has the specified property as own property; otherwise `false`\r\n * @example\r\n * ```ts\r\n * let example = {};\r\n * objHasOwn(example, 'prop'); // false\r\n *\r\n * example.prop = 'exists';\r\n * objHasOwn(example, 'prop'); // true - 'prop' has been defined\r\n *\r\n * example.prop = null;\r\n * objHasOwn(example, 'prop'); // true - own property exists with value of null\r\n *\r\n * example.prop = undefined;\r\n * objHasOwn(example, 'prop'); // true - own property exists with value of undefined\r\n * ```\r\n */\r\nexport var objHasOwn = ObjClass[\"hasOwn\"] || polyObjHasOwn;\r\n/**\r\n * The polyObjHasOwn() method is a polyfill for {@link objHasOwn} when the native\r\n * [Object.hasOwnreturns](https://caniuse.com/?search=hasOwn) is not supported, it returns a\r\n * boolean indicating whether the object has the specified property as its own property (as\r\n * opposed to inheriting it). If the property is inherited, or does not exist, the method\r\n * returns false.\r\n *\r\n * The objHasOwn() method returns true if the specified property is a direct property\r\n * of the object — even if the property value is null or undefined. The method returns\r\n * false if the property is inherited, or has not been declared at all. Unlike the in operator,\r\n * this method does not check for the specified property in the object's prototype chain.\r\n *\r\n * It is recommended over objHasOwnProperty() because it works for objects created using\r\n * objCreate(null) and with objects that have overridden the inherited hasOwnProperty() method.\r\n * While it is possible to workaround these problems by calling Object.prototype.hasOwnProperty()\r\n * on an external object, Object.hasOwn() is more intuitive.\r\n *\r\n * @since 0.4.3\r\n * @group Object\r\n * @group Polyfill\r\n * @param obj - The object being evaluated\r\n * @param prop - The String or Symbol of the property to test\r\n * @returns `true` if the object has the specified property as own property; otherwise `false`\r\n * @example\r\n * ```ts\r\n * let example = {};\r\n * polyObjHasOwn(example, 'prop'); // false\r\n *\r\n * example.prop = 'exists';\r\n * polyObjHasOwn(example, 'prop'); // true - 'prop' has been defined\r\n *\r\n * example.prop = null;\r\n * polyObjHasOwn(example, 'prop'); // true - own property exists with value of null\r\n *\r\n * example.prop = undefined;\r\n * polyObjHasOwn(example, 'prop'); // true - own property exists with value of undefined\r\n * ```\r\n */\r\nexport function polyObjHasOwn(obj, prop) {\r\n return objHasOwnProperty(obj, prop) || !!objGetOwnPropertyDescriptor(obj, prop);\r\n}\r\n//# sourceMappingURL=has_own.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { isObject } from \"../helpers/base\";\r\nimport { objHasOwn } from \"./has_own\";\r\n/**\r\n * Calls the provided `callbackFn` function once for each key in an object. This is equivelent to `arrForEach(Object.keys(theObject), callbackFn)` or\r\n * if not using the array helper `Object.keys(theObject).forEach(callbackFn)` except that this helper avoid creating a temporary of the object\r\n * keys before iterating over them and like the `arrForEach` helper you CAN stop or break the iteration by returning -1 from the `callbackFn` function.\r\n * @group Object\r\n * @typeParam T - The object type\r\n * @param callbackfn A function that accepts up to two arguments, the key name and the current value of the property represented by the key.\r\n * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, null or undefined\r\n * the object will be used as the this value.\r\n * @example\r\n * ```ts\r\n * function performAction(target: T, source: any) {\r\n * if (!isNullOrUndefined(source)) {\r\n * objForEachKey(source, (key, value) => {\r\n * // Set the target with a reference to the same value with the same name\r\n * target[key] = value;\r\n * });\r\n * }\r\n *\r\n * return target;\r\n * }\r\n * ```\r\n */\r\nexport function objForEachKey(theObject, callbackfn, thisArg) {\r\n if (theObject && isObject(theObject)) {\r\n for (var prop in theObject) {\r\n if (objHasOwn(theObject, prop)) {\r\n if (callbackfn.call(thisArg || theObject, prop, theObject[prop]) === -1) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=for_each_key.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { objForEachKey } from \"../object/for_each_key\";\r\n/**\r\n * @internal\r\n * @ignore\r\n * Internal Helper function to create a key and value mapped representation of the values\r\n * @param values - The source values\r\n * @param keyType - Identifies the value to populate against the key\r\n * @param valueType - Identifies the value to populate against the value\r\n * @param completeFn - The function to call to complete the map (used to freeze the instance)\r\n * @returns\r\n */\r\nexport function _createKeyValueMap(values, keyType, valueType, completeFn) {\r\n var theMap = {};\r\n objForEachKey(values, function (key, value) {\r\n theMap[key] = keyType ? value : key;\r\n theMap[value] = valueType ? value : key;\r\n });\r\n return completeFn(theMap);\r\n}\r\n//# sourceMappingURL=map.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\n/**\r\n * Throw an error exception with the specified optional message\r\n * @group Error\r\n * @param message\r\n */\r\nexport function throwError(message) {\r\n throw new Error(message);\r\n}\r\n/**\r\n * Throw a type error with the specified optional message\r\n * @group Error\r\n * @param message\r\n */\r\nexport function throwTypeError(message) {\r\n throw new TypeError(message);\r\n}\r\n/**\r\n * Throw a RangeError with the specified optional message\r\n * @group Error\r\n * @param message\r\n */\r\nexport function throwRangeError(message) {\r\n throw new RangeError(message);\r\n}\r\n//# sourceMappingURL=throw.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { NULL_VALUE, ObjClass, __PROTO__ } from \"../internal/constants\";\r\nimport { isArray, isObject } from \"../helpers/base\";\r\nimport { throwTypeError } from \"../helpers/throw\";\r\nimport { objForEachKey } from \"./for_each_key\";\r\nimport { polyObjEntries, polyObjValues } from \"../polyfills/object\";\r\nvar _objFreeze = ObjClass[\"freeze\"];\r\nvar _doNothing = function (value) { return value; };\r\nvar _getProto = function (value) { return value[__PROTO__] || NULL_VALUE; };\r\n/**\r\n * The `objAssign()` method copies all enumerable own properties from one or more source objects\r\n * to a target object. It returns the modified target object.\r\n *\r\n * Properties in the target object are overwritten by properties in the sources if they have the\r\n * same key. Later sources' properties overwrite earlier ones.\r\n *\r\n * The objAssign() method only copies enumerable and own properties from a source object to a\r\n * target object. It uses `Get` on the source and `Set` on the target, so it will invoke\r\n * [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) and\r\n * [setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set).\r\n * Therefore it assigns properties, versus copying or defining new properties. This may make it\r\n * unsuitable for merging new properties into a prototype if the merge sources contain getters.\r\n *\r\n * For copying property definitions (including their enumerability) into prototypes, use\r\n * {@link objGetOwnPropertyDescriptor} and {@link objDefineProp} instead.\r\n *\r\n * Both String and Symbol properties are copied.\r\n *\r\n * In case of an error, for example if a property is non-writable, a TypeError is raised, and\r\n * the target object is changed if any properties are added before the error is raised.\r\n * @group Object\r\n * @example\r\n * ```ts\r\n * const obj = { a: 1 };\r\n * const copy = objAssign({}, obj);\r\n * console.log(copy); // { a: 1 }\r\n *\r\n * const o1 = { a: 1 };\r\n * const o2 = { b: 2 };\r\n * const o3 = { c: 3 };\r\n *\r\n * const obj = objAssign(o1, o2, o3);\r\n * console.log(obj); // { a: 1, b: 2, c: 3 }\r\n * console.log(o1); // { a: 1, b: 2, c: 3 }, target object itself is changed.\r\n * ```\r\n */\r\nexport var objAssign = ObjClass[\"assign\"];\r\n/**\r\n * The `objKeys()` method returns an array of a given object's own enumerable property names, iterated in\r\n * the same order that a normal loop would.\r\n *\r\n * objKeys() returns an array whose elements are strings corresponding to the enumerable properties found\r\n * directly upon object. The ordering of the properties is the same as that given by looping over the\r\n * properties of the object manually.\r\n * @group Object\r\n * @param value - The object to obtain a copy of the keys from\r\n * @returns An array of the properties names for the value object.\r\n * @example\r\n * ```ts\r\n * // simple array\r\n * const arr = ['a', 'b', 'c'];\r\n * console.log(objKeys(arr)); // console: ['0', '1', '2']\r\n *\r\n * // array-like object\r\n * const obj = { 0: 'a', 1: 'b', 2: 'c' };\r\n * console.log(objKeys(obj)); // console: ['0', '1', '2']\r\n *\r\n * // array-like object with random key ordering\r\n * const anObj = { 100: 'a', 2: 'b', 7: 'c' };\r\n * console.log(objKeys(anObj)); // console: ['2', '7', '100']\r\n *\r\n * // getFoo is a property which isn't enumerable\r\n * const myObj = objCreate({}, {\r\n * getFoo: {\r\n * value() { return this.foo; }\r\n * }\r\n * });\r\n * myObj.foo = 1;\r\n * console.log(objKeys(myObj)); // console: ['foo']\r\n * ```\r\n */\r\nexport function objKeys(value) {\r\n if (!isObject(value) || value === NULL_VALUE) {\r\n throwTypeError(\"objKeys called on non-object\");\r\n }\r\n return ObjClass.keys(value);\r\n}\r\n/**\r\n * Perform a deep freeze on the object and all of it's contained values / properties by recursively calling\r\n * `objFreeze()` on all enumerable properties of the object and on each property returned.\r\n * @group Object\r\n * @param value - the object to be completly frozen.\r\n * @returns The originally passed in object.\r\n */\r\nexport function objDeepFreeze(value) {\r\n if (_objFreeze) {\r\n objForEachKey(value, function (key, value) {\r\n if (isArray(value) || isObject(value)) {\r\n _objFreeze(value);\r\n }\r\n });\r\n }\r\n return objFreeze(value);\r\n}\r\n/**\r\n * The `objFreeze()` method freezes an object. A frozen object can no longer be changed; freezing an object\r\n * prevents new properties from being added to it, existing properties from being removed, prevents changing the\r\n * enumerability, configurability, or writability of existing properties, and prevents the values of existing\r\n * properties from being changed. In addition, freezing an object also prevents its prototype from being changed.\r\n * `objFreeze()` returns the same object that was passed in.\r\n *\r\n * Nothing can be added to or removed from the properties set of a frozen object. Any attempt to do so will fail,\r\n * either silently or by throwing a TypeError exception (most commonly, but not exclusively, when in strict mode).\r\n *\r\n * For data properties of a frozen object, values cannot be changed, the writable and configurable attributes are\r\n * set to false. Accessor properties (getters and setters) work the same (and still give the illusion that you are\r\n * changing the value). Note that values that are objects can still be modified, unless they are also frozen. As\r\n * an object, an array can be frozen; after doing so, its elements cannot be altered and no elements can be added\r\n * to or removed from the array.\r\n *\r\n * `objFreeze()` returns the same object that was passed into the function. It does not create a frozen copy.\r\n * @group Object\r\n * @param value - The object to freeze.\r\n * @returns The object that was passed to the function.\r\n */\r\nexport var objFreeze = _objFreeze || _doNothing;\r\n/**\r\n * The `objSeal()` method seals an object, preventing new properties from being added to it and marking all\r\n * existing properties as non-configurable. Values of present properties can still be changed as long as they\r\n * are writable.\r\n * @group Object\r\n * @param value - The object which should be sealed.\r\n * @returns The object being sealed.\r\n */\r\nexport var objSeal = ObjClass[\"seal\"] || _doNothing;\r\n/**\r\n * The objGetPrototypeOf() method returns the prototype (i.e. the value of the internal `Prototype` property)\r\n * of the specified value.\r\n * @since 0.4.4\r\n * @group Object\r\n * @param value - The object whose prototype is to be returned, which may be null.\r\n */\r\nexport var objGetPrototypeOf = ObjClass[\"getPrototypeOf\"] || _getProto;\r\n/**\r\n * Returns an array of key/values of the enumerable properties of an object\r\n * @since 0.9.7\r\n * @group Object\r\n * @group ArrayLike\r\n * @param value Object that contains the properties and methods.\r\n * @example\r\n * ```ts\r\n * objEntries({ Hello: \"Darkness\", my: \"old\", friend: \".\" });\r\n * // [ [ \"Hello\", \"Darkness\" ], [ \"my\", \"old\"], [ \"friend\", \".\" ] ]\r\n *\r\n * // Array-like object\r\n * objEntries({ 0: \"a\", 1: \"b\", 2: \"c\" }));\r\n * // [ ['0', 'a'], ['1', 'b'], ['2', 'c'] ]\r\n *\r\n * // Array-like object with random key ordering\r\n * objEntries({ 100: \"a\", 2: \"b\", 7: \"c\" });\r\n * // [ ['2', 'b'], ['7', 'c'], ['100', 'a'] ]*\r\n * ```\r\n */\r\nexport var objEntries = ObjClass.entries || polyObjEntries;\r\n/**\r\n * The objValues() returns an array whose elements are values of enumerable string-keyed properties found\r\n * directly upon object. This is the same as iterating with a for...in loop, except that a for...in loop\r\n * enumerates properties in the prototype chain as well. The order of the array returned by objValues()\r\n * is the same as that provided by a for...in loop.\r\n *\r\n * If you need the property keys, use objKeys() instead. If you need both the property keys and values, use objEntries() instead.\r\n * @since 0.9.7\r\n * @group Object\r\n * @group ArrayLike\r\n * @param value - The object that contains the properties and methods.\r\n * @returns An array containing the given object's own enumerable string-keyed property values.\r\n * @example\r\n * ```ts\r\n * objValues({ Hello: \"Darkness\", my: \"old\", friend: \".\" });\r\n * // [ \"Darkness\", \"old\", \".\" ]\r\n *\r\n * // Array-like object\r\n * objValues({ 0: \"a\", 1: \"b\", 2: \"c\" }));\r\n * // [ 'a', 'b', 'c']\r\n *\r\n * // Array-like object with random key ordering\r\n * objValues({ 100: \"a\", 2: \"b\", 7: \"c\" });\r\n * // [ 'b', 'c', 'a']\r\n * ```\r\n */\r\nexport var objValues = ObjClass.values || polyObjValues;\r\n//# sourceMappingURL=object.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { UNDEFINED } from \"./constants\";\r\nvar GLOBAL_CONFIG_KEY = \"__tsUtils$gblCfg\";\r\nvar _globalCfg;\r\n/**\r\n * @internal\r\n * @ignore\r\n * Helper to get the current global value\r\n * @returns\r\n */\r\nexport function _getGlobalValue() {\r\n var result;\r\n if (typeof globalThis !== UNDEFINED) {\r\n result = globalThis;\r\n }\r\n if (!result && typeof self !== UNDEFINED) {\r\n result = self;\r\n }\r\n if (!result && typeof window !== UNDEFINED) {\r\n result = window;\r\n }\r\n if (!result && typeof global !== UNDEFINED) {\r\n result = global;\r\n }\r\n return result;\r\n}\r\n/**\r\n * @internal\r\n * @ignore\r\n * Gets/Sets the named value from the global config store, this is used to share configuration across\r\n * multiple modules. Primarily used for poly symbol and test hooks.\r\n * @returns The globally registered value.\r\n */\r\nexport function _getGlobalConfig() {\r\n if (!_globalCfg) {\r\n var gbl = _getGlobalValue() || {};\r\n _globalCfg = gbl[GLOBAL_CONFIG_KEY] = gbl[GLOBAL_CONFIG_KEY] || {};\r\n }\r\n return _globalCfg;\r\n}\r\n//# sourceMappingURL=global.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { createEnumKeyMap } from \"../helpers/enum\";\r\n/**\r\n * @ignore\r\n * @internal\r\n */\r\nexport var _wellKnownSymbolMap = createEnumKeyMap({\r\n asyncIterator: 0 /* WellKnownSymbols.asyncIterator */,\r\n hasInstance: 1 /* WellKnownSymbols.hasInstance */,\r\n isConcatSpreadable: 2 /* WellKnownSymbols.isConcatSpreadable */,\r\n iterator: 3 /* WellKnownSymbols.iterator */,\r\n match: 4 /* WellKnownSymbols.match */,\r\n matchAll: 5 /* WellKnownSymbols.matchAll */,\r\n replace: 6 /* WellKnownSymbols.replace */,\r\n search: 7 /* WellKnownSymbols.search */,\r\n species: 8 /* WellKnownSymbols.species */,\r\n split: 9 /* WellKnownSymbols.split */,\r\n toPrimitive: 10 /* WellKnownSymbols.toPrimitive */,\r\n toStringTag: 11 /* WellKnownSymbols.toStringTag */,\r\n unscopables: 12 /* WellKnownSymbols.unscopables */\r\n});\r\n//# sourceMappingURL=well_known.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { _createKeyValueMap } from \"../internal/map\";\r\nimport { objForEachKey } from \"../object/for_each_key\";\r\nimport { objDeepFreeze } from \"../object/object\";\r\n/**\r\n * Create a TypeScript style enum class which is a mapping that maps from the key -> value and the value -> key.\r\n * This is effectively the same as defining a non-constant enum, but this only repeats the \"Name\" of the enum value once.\r\n * @group Enum\r\n * @example\r\n * ```ts\r\n * const enum Animal {\r\n * Dog = 0,\r\n * Cat = 1,\r\n * Butterfly = 2,\r\n * Bear = 3\r\n * }\r\n * const Animals = createEnum({\r\n * Dog: Animal.Dog,\r\n * Cat: Animal.Cat,\r\n * Butterfly: Animal.Butterfly,\r\n * Bear: Animal.Bear\r\n * });\r\n * // You end up with an object that maps everything to the name\r\n * Animals.Dog === 0; // true\r\n * Animals[0] === \"Dog\"; // true\r\n * Animals[\"Dog\"] === 0; // true\r\n * Animals.Cat === 1; // true\r\n * Animals[1] === \"Cat\"; // true\r\n * Animals[\"Cat\"] === 1; // true\r\n * ```\r\n\r\n * @param values - The values to populate on the new object\r\n * @typeParam E - Identifies the const enum type being mapped\r\n * @returns A new frozen (immutable) object which looks and acts like a TypeScript Enum class.\r\n */\r\nexport function createEnum(values) {\r\n return _createKeyValueMap(values, 1 /* eMapValues.Value */, 0 /* eMapValues.Key */, objDeepFreeze);\r\n}\r\n/**\r\n * Create a map object which contains both the property key and value which both map to the key,\r\n * E[key] => key and E[value] => key.\r\n * @group Enum\r\n * @example\r\n * ```ts\r\n * const enum Animal {\r\n * Dog = 0,\r\n * Cat = 1,\r\n * Butterfly = 2,\r\n * Bear = 3\r\n * }\r\n * const animalMap = createEnumKeyMap({\r\n * Dog: Animal.Dog,\r\n * Cat: Animal.Cat,\r\n * Butterfly: Animal.Butterfly,\r\n * Bear: Animal.Bear\r\n * });\r\n * // You end up with an object that maps everything to the name\r\n * animalMap.Dog === \"Dog\"; // true\r\n * animalMap[0] === \"Dog\"; // true\r\n * animalMap[\"Dog\"] === \"Dog\"; // true\r\n * animalMap.Cat === \"Cat\"; // true\r\n * animalMap[1] === \"Cat\"; // true\r\n * animalMap[\"Cat\"] === \"Cat\"; // true\r\n * // Helper function to always return the \"Name\" of the type of animal\r\n * function getAnimalType(type: string | number | Animal) {\r\n * return animalMap[type];\r\n * }\r\n * ```\r\n * @param values - The values to populate on the new object\r\n * @typeParam E - Identifies the const enum type being mapped\r\n * @returns A new frozen (immutable) object which contains a property for each key and value that returns the value.\r\n */\r\nexport function createEnumKeyMap(values) {\r\n return _createKeyValueMap(values, 0 /* eMapValues.Key */, 0 /* eMapValues.Key */, objDeepFreeze);\r\n}\r\n/**\r\n * Create a map object which contains both the perperty key and value which both map to the resulting value,\r\n * E[key] => value and E[value] => value.\r\n * @group Enum\r\n * @example\r\n * ```ts\r\n * const enum Animal {\r\n * Dog = 0,\r\n * Cat = 1,\r\n * Butterfly = 2,\r\n * Bear = 3\r\n * }\r\n * const animalMap = createEnumValueMap({\r\n * Dog: Animal.Dog,\r\n * Cat: Animal.Cat,\r\n * Butterfly: Animal.Butterfly,\r\n * Bear: Animal.Bear\r\n * });\r\n * // You end up with an object that maps everything to the name\r\n * animalMap.Dog === 0; // true\r\n * animalMap[0] === 0; // true\r\n * animalMap[\"Dog\"] === 0; // true\r\n * animalMap.Cat === 1; // true\r\n * animalMap[1] === 1; // true\r\n * animalMap[\"Cat\"] === 1; // true\r\n *\r\n * // Helper function to always return the \"Name\" of the type of animal\r\n * function getAnimalValue(type: string | number | Animal) {\r\n * return animalMap[type];\r\n * }\r\n * ```\r\n\r\n * @param values - The values to populate on the new object\r\n * @typeParam E - Identifies the const enum type being mapped\r\n * @returns A new frozen (immutable) object which contains a property for each key and value that returns the value.\r\n */\r\nexport function createEnumValueMap(values) {\r\n return _createKeyValueMap(values, 1 /* eMapValues.Value */, 1 /* eMapValues.Value */, objDeepFreeze);\r\n}\r\n/**\r\n * Create a map object which contains both the perperty key and value which both map to the requested\r\n * generic mapValue with a type of V, E[key] => mapValue and E[value] => mapValue.\r\n * @group Enum\r\n * @example\r\n * ```ts\r\n * const enum Animal {\r\n * Dog = 0,\r\n * Cat = 1,\r\n * Butterfly = 2,\r\n * Bear = 3\r\n * };\r\n * // Creates a simple mapping to a string value\r\n * const animalFamilyMap = createValueMap({\r\n * Dog: [ Animal.Dog, \"Canidae\"],\r\n * Cat: [ Animal.Cat, \"Felidae\"],\r\n * Butterfly: [ Animal.Butterfly, \"Papilionidae\"],\r\n * Bear: [ Animal.Bear, \"Ursidae\"]\r\n * });\r\n * // You end up with an object that maps everything to the name\r\n * animalMap.Dog === \"Canidae\"; // true with typeof animalMap.Dog is \"string\"\r\n * animalMap[0] === \"Canidae\"; // true with typeof animalMap[0] is \"string\"\r\n * animalMap[\"Dog\"] === \"Canidae\"; // true with typeof animalMap[\"Dog\"] is \"string\"\r\n * animalMap.Cat === \"Felidae\"; // true with typeof animalMap.Cat is \"string\"\r\n * animalMap[1] === \"Felidae\"; // true with typeof animalMap[1] is \"string\"\r\n * animalMap[\"Cat\"] === \"Felidae\"; // true with typeof animalMap[\"Cat\"] is \"string\"\r\n * ```\r\n * @param values - The values to populate on the new object\r\n * @typeParam E - Identifies the const enum type (eg. typeof Animal);\r\n * @typeParam V - Identifies the type of the mapping `string`; `number`; etc is not restructed to primitive types.\r\n * @returns A new frozen (immutable) object which contains a property for each key and value that returns the defiend mapped value.\r\n */\r\nexport function createSimpleMap(values) {\r\n var mapClass = {};\r\n objForEachKey(values, function (key, value) {\r\n mapClass[key] = value[1];\r\n mapClass[value[0]] = value[1];\r\n });\r\n return objDeepFreeze(mapClass);\r\n}\r\n/**\r\n * Create a strongly types map object which contains both the perperty key and value which both map\r\n * to the requested mapValue,\r\n * E[key] => mapValue and E[value] => mapValue.\r\n * - E = the const enum type (typeof Animal);\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 * @group Enum\r\n * @example\r\n * ```ts\r\n * // Create a strongly types map\r\n * const animalFamilyMap = createTypeMap({\r\n * Dog: [ Animal.Dog, \"Canidae\"],\r\n * Cat: [ Animal.Cat, \"Felidae\"],\r\n * Butterfly: [ Animal.Butterfly, \"Papilionidae\"],\r\n * Bear: [ Animal.Bear, \"Ursidae\"]\r\n * });\r\n * // You end up with a strongly types result for each value\r\n * animalMap.Dog === \"Canidae\"; // true with typeof animalMap.Dog is (const) \"Canidae\"\r\n * animalMap[0] === \"Canidae\"; // true with typeof animalMap[0] is \"Canidae\"\r\n * animalMap[\"Dog\"] === \"Canidae\"; // true with typeof animalMap[\"Dog\"] is \"Canidae\"\r\n * animalMap.Cat === \"Felidae\"; // true with typeof animalMap.Cat is \"Felidae\"\r\n * animalMap[1] === \"Felidae\"; // true with typeof animalMap[1] is \"Felidae\"\r\n * animalMap[\"Cat\"] === \"Felidae\"; // true with typeof animalMap[\"Cat\"] is \"Felidae\"\r\n *\r\n * or using an interface to define the direct string mappings\r\n *\r\n * interface IAnimalFamilyMap {\r\n * Dog: \"Canidae\",\r\n * Cat: \"Felidae\",\r\n * Butterfly: \"Papilionidae\",\r\n * Bear: \"Ursidae\"\r\n * }\r\n *\r\n * // Create a strongly types map\r\n * const animalFamilyMap = createTypeMap({\r\n * Dog: [ Animal.Dog, \"Canidae\"],\r\n * Cat: [ Animal.Cat, \"Felidae\"],\r\n * Butterfly: [ Animal.Butterfly, \"Papilionidae\"],\r\n * Bear: [ Animal.Bear, \"Ursidae\"]\r\n * });\r\n *\r\n * // You also end up with a strongly types result for each value\r\n * animalMap.Dog === \"Canidae\"; // true with typeof animalMap.Dog is (const) \"Canidae\"\r\n * animalMap[0] === \"Canidae\"; // true with typeof animalMap[0] is \"Canidae\"\r\n * animalMap[\"Dog\"] === \"Canidae\"; // true with typeof animalMap[\"Dog\"] is \"Canidae\"\r\n * animalMap.Cat === \"Felidae\"; // true with typeof animalMap.Cat is \"Felidae\"\r\n * animalMap[1] === \"Felidae\"; // true with typeof animalMap[1] is \"Felidae\"\r\n * animalMap[\"Cat\"] === \"Felidae\"; // true with typeof animalMap[\"Cat\"] is \"Felidae\"\r\n * ```\r\n * @param values - The values to populate on the new object\r\n * @typeParam E - Identifies the enum type\r\n * @typeParam T - Identifies the return type that is being created via the mapping.\r\n * @returns A new frozen (immutable) object which contains a property for each key and value that returns the defined mapped value.\r\n */\r\nexport function createTypeMap(values) {\r\n return createSimpleMap(values);\r\n}\r\n//# sourceMappingURL=enum.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { StrCls } from \"../internal/constants\";\r\n/**\r\n * The asString() method returns a string representing the value by\r\n * explicitly using `String(`value`)`.\r\n *\r\n * @since 0.4.3\r\n * @group String\r\n * @group Conversion\r\n * @group Value\r\n * @param value - The value to get a string representation of\r\n * @example\r\n * ```ts\r\n * const arr = [ 1, 2, 3];\r\n * asString(arr); // \"1,2,3\"\r\n * asString(null); // \"null\"\r\n * asString(undefined); // \"undefined\"\r\n * asString(42); // \"42\"\r\n * asString(Symbol.for(\"Hello\")); // \"Symbol(Hello)\"\r\n * ```\r\n */\r\nexport var asString = StrCls;\r\n//# sourceMappingURL=as_string.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { EMPTY, NULL_VALUE, UNDEF_VALUE } from \"../internal/constants\";\r\nimport { isError, isNumber, objToString } from \"./base\";\r\n/**\r\n * Returns string representation of an object suitable for diagnostics logging.\r\n * @group Error\r\n * @group Diagnostic\r\n * @param object - The object to be converted to a diagnostic string value\r\n * @param format - Identifies whether the JSON value should be formated\r\n * - `true` - Format with 4 spaces\r\n * - 'number' - The number of spaces to format with\r\n * - `false` (or not Truthy) - Do not format\r\n */\r\nexport function dumpObj(object, format) {\r\n var propertyValueDump = EMPTY;\r\n if (isError(object)) {\r\n propertyValueDump = \"{ stack: '\" + object.stack + \"', message: '\" + object.message + \"', name: '\" + object.name + \"'\";\r\n }\r\n else {\r\n try {\r\n propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? (isNumber(format) ? format : 4) : UNDEF_VALUE);\r\n }\r\n catch (e) {\r\n // Unable to convert object (probably circular)\r\n propertyValueDump = \" - \" + dumpObj(e, format);\r\n }\r\n }\r\n return objToString(object) + \": \" + propertyValueDump;\r\n}\r\n//# sourceMappingURL=diagnostics.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { dumpObj } from \"../helpers/diagnostics\";\r\nimport { throwTypeError } from \"../helpers/throw\";\r\nimport { asString } from \"../string/as_string\";\r\nimport { ArrProto, SLICE } from \"./constants\";\r\nvar _arrSlice = ArrProto[SLICE];\r\nvar _throwMissingFunction = function (funcName, thisArg) {\r\n throwTypeError(\"'\" + asString(funcName) + \"' not defined for \" + dumpObj(thisArg));\r\n};\r\n/**\r\n * @internal\r\n * @ignore\r\n * Internal helper to run the named function on the passed first argument, this does not support polyfill\r\n * or prototype fallback, so the function must exist on the provided first argument.\r\n * If the first argument is null, undefined or the function does not exist an exception will be thrown\r\n * by the runtime\r\n * @param funcName - The function name to call on the first argument passed to the wrapped function\r\n * @returns A function which will call the funcName against the first passed argument and pass on the remaining arguments\r\n */\r\nexport var _unwrapInstFunction = function (funcName) {\r\n return function (thisArg) {\r\n return thisArg[funcName].apply(thisArg, _arrSlice.call(arguments, 1));\r\n };\r\n};\r\n/**\r\n * @internal\r\n * @ignore\r\n * Internal helper to convert an expanded function back into an instance `this` function call\r\n * @param funcName - The function name to call on the first argument passed to the wrapped function\r\n * @param clsProto - The Class or class prototype to fallback to if the instance doesn't have the function.\r\n * @returns A function which will call the funcName against the first passed argument and pass on the remaining arguments\r\n */\r\nexport var _unwrapFunction = function (funcName, clsProto) {\r\n var clsFn = clsProto && clsProto[funcName];\r\n return function (thisArg) {\r\n var theFunc = (thisArg && thisArg[funcName]) || clsFn;\r\n if (theFunc) {\r\n return theFunc.apply(thisArg, _arrSlice.call(arguments, 1));\r\n }\r\n _throwMissingFunction(funcName, thisArg);\r\n };\r\n};\r\n/**\r\n * @internal\r\n * @ignore\r\n * Internal helper to convert an expanded function back into an instance `this` function call\r\n * @param funcName - The function name to call on the first argument passed to the wrapped function\r\n * @param clsProto - The Class or class prototype to fallback to if the instance doesn't have the function.\r\n * @param polyFunc - The function to call if not available on the thisArg, act like the polyfill\r\n * @returns A function which will call the funcName against the first passed argument and pass on the remaining arguments\r\n */\r\nexport var _unwrapFunctionWithPoly = function (funcName, clsProto, polyFunc) {\r\n var clsFn = clsProto && clsProto[funcName];\r\n return function (thisArg) {\r\n var theFunc = (thisArg && thisArg[funcName]) || clsFn;\r\n if (theFunc || polyFunc) {\r\n var theArgs = arguments;\r\n return (theFunc || polyFunc).apply(thisArg, theFunc ? _arrSlice.call(theArgs, 1) : theArgs);\r\n }\r\n _throwMissingFunction(funcName, thisArg);\r\n };\r\n};\r\n/**\r\n * @internal\r\n * @ignore\r\n * Internal helper to lookup and return the named property from the first argument (which becomes the this)\r\n *\r\n * @since 0.4.2\r\n * @typeParam T - The type of the object which contains the propName\r\n * @param propName - The property name\r\n * @returns The value of the property\r\n */\r\nexport function _unwrapProp(propName) {\r\n return function (thisArg) {\r\n return thisArg[propName];\r\n };\r\n}\r\n//# sourceMappingURL=unwrapFunction.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { MathCls } from \"../internal/constants\";\r\n/**\r\n * The mathMin() function returns the lowest-valued number passed into it, or NaN if any\r\n * parameter isn't a number and can't be converted into one.\r\n *\r\n * If no arguments are given, the result is Infinity.\r\n *\r\n * If at least one of arguments cannot be converted to a number, the result is NaN.\r\n *\r\n * @since 0.4.2\r\n * @group Math\r\n * @param values - Zero or more numbers among which the lowest value will be selected and returned.\r\n * @returns The smallest of the given numbers. If any one or more of the parameters cannot\r\n * be converted into a number, NaN is returned. The result is Infinity if no parameters are provided.\r\n * @example\r\n * ```ts\r\n * const x = 10, y = -20;\r\n * const z = Math.min(x, y); // -20\r\n * ```\r\n */\r\nexport var mathMin = MathCls.min;\r\n/**\r\n * The `mathMax()` function returns the largest of the zero or more numbers given as input\r\n * parameters, or NaN if any parameter isn't a number and can't be converted into one.\r\n *\r\n * If no arguments are given, the result is -Infinity.\r\n *\r\n * If at least one of arguments cannot be converted to a number, the result is NaN.\r\n *\r\n * @since 0.4.2\r\n * @group Math\r\n * @param values - Zero or more numbers among which the largest value will be selected and returned.\r\n * @returns The largest of the given numbers. If any one or more of the parameters cannot be\r\n * converted into a number, NaN is returned. The result is -Infinity if no parameters are provided.\r\n * @example\r\n * ```ts\r\n * mathMax(10, 20); // 20\r\n * mathMax(-10, -20); // -10\r\n * mathMax(-10, 20); // 20\r\n * ```\r\n */\r\nexport var mathMax = MathCls.max;\r\n//# sourceMappingURL=min_max.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { SLICE, StrProto } from \"../internal/constants\";\r\nimport { _unwrapFunction } from \"../internal/unwrapFunction\";\r\n/**\r\n * The `strSlice()` method extracts a section of a string and returns it as a new string, without\r\n * modifying the original string.\r\n * `strSlice()` extracts the text from one string and returns a new string. Changes to the text in one\r\n * string do not affect the other string.\r\n * `strSlice()` extracts up to but not including endIndex. str.slice(1, 4) extracts the second character\r\n * through the fourth character (characters indexed 1, 2, and 3).\r\n * As an example, strSlice(2, -1) extracts the third character through the second to last character\r\n * in the string.\r\n * @group String\r\n * @param value - The value to haveextract a number\r\n * @param beginIndex - The zero-based index at which to begin extraction.\r\n * If `beginIndex` is negative, `strSlice()` begins extraction from `value.length + beginIndex`.\r\n * (E.g. `strSlice(\"test\", -2)` returns \"st\")\r\n * If `beginIndex` is omitted, undefined, or cannot be converted to a number (using Number(`beginIndex`)),\r\n * strSlice() begins extraction from the beginning of the string. (E.g. `strSlice(\"test\")` returns \"test\")\r\n * If `beginIndex` is greater than or equal to `value.length`, an empty string is returned.\r\n * (E.g. `strSlice(\"test\", 4)` returns \"\")\r\n * @param endIndex - The index of the first character to exclude from the returned substring.\r\n * If `endIndex` is omitted, undefined, or cannot be converted to a number (using Number(`endIndex`))\r\n * strSlice() extracts to the end of the string. (E.g. `strSlice(\"test\", 2)` returns \"st\")\r\n * If `endIndex` is greater than `value.length`, strSlice() also extracts to the end of the string.\r\n * (E.g. strSlice(\"test\", 2, 10)` returns \"st\")\r\n * If `endIndex` is negative, `strSlice()` treats it as `value.length + endIndex`. (E.g, if `endIndex`\r\n * is -2, it is treated as `value.length - 2` and `strSlice(\"test\", 1, -2)` returns \"e\") .\r\n * If `endIndex` represents a position that is before the one represented by startIndex, `strSlice()`\r\n * returns \"\". (E.g `strSlice(\"test\", 2, -10)`, strSlice(\"test\", -1, -2)` or `strSlice(\"test\", 3, 2)`).\r\n * @returns A new string containing the extracted section of the string.\r\n */\r\nexport var strSlice = _unwrapFunction(SLICE, StrProto);\r\n//# sourceMappingURL=slice.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { isNullOrUndefined, isUndefined } from \"../helpers/base\";\r\nimport { dumpObj } from \"../helpers/diagnostics\";\r\nimport { throwTypeError } from \"../helpers/throw\";\r\nimport { EMPTY, LENGTH, StrProto } from \"../internal/constants\";\r\nimport { _unwrapFunction, _unwrapFunctionWithPoly } from \"../internal/unwrapFunction\";\r\nimport { mathMax } from \"../math/min_max\";\r\nimport { strSlice } from \"./slice\";\r\n/**\r\n * The `strSubstring()` method returns the part of the string between the start and end indexes, or to the end of the string.\r\n *\r\n * `strSubstring()` extracts characters from indexStart up to but not including indexEnd. In particular:\r\n * - If `indexEnd` is omitted, strSubstring() extracts characters to the end of the string.\r\n * - If `indexStart` is equal to indexEnd, strSubstring() returns an empty string.\r\n * - If `indexStart` is greater than indexEnd, then the effect of strSubstring() is as if the two arguments were swapped; see example below.\r\n *\r\n * Any argument value that is less than 0 or greater than `value.length` is treated as if it were 0 and `value.length`, respectively.\r\n *\r\n * Any argument value that is NaN is treated as if it were 0.\r\n * @group String\r\n * @param value - The string value to return the substring from.\r\n * @param indexStart - The index of the first character to include in the returned substring.\r\n * @param indexEnd - The index of the first character to exclude from the returned substring.\r\n * @return A new string containing the specified part of the given string\r\n * @example\r\n * ```ts\r\n * const anyString = 'Nevware21';\r\n * // Displays 'N'\r\n * console.log(strSubstring(anyString, 0, 1));\r\n * console.log(strSubstring(anyString, 1, 0));\r\n *\r\n * // Displays 'Nevwar'\r\n * console.log(strSubstring(anyString, 0, 6));\r\n *\r\n * // Displays 'are21'\r\n * console.log(strSubstring(anyString, 4));\r\n *\r\n * // Displays 'are'\r\n * console.log(strSubstring(anyString, 4, 7));\r\n *\r\n * // Displays '21'\r\n * console.log(strSubstring(anyString, 7, 4));\r\n *\r\n * // Displays 'Nevware'\r\n * console.log(strSubstring(anyString, 0, 7));\r\n *\r\n * // Displays 'Nevware21'\r\n * console.log(strSubstring(anyString, 0, 10));\r\n * ```\r\n */\r\nexport var strSubstring = _unwrapFunction(\"substring\", StrProto);\r\n/**\r\n * The strSubstr() method returns a portion of the string, starting at the specified index and extending for a given\r\n * number of characters afterwards.\r\n *\r\n * @since 0.4.2\r\n * @group String\r\n * @param value - The string value to return the substring from.\r\n * @param start - The index of the first character to include in the returned substring.\r\n * @param length - The number of characters to extract.\r\n * @returns A new string containing the specified part of the given string.\r\n */\r\nexport var strSubstr = _unwrapFunctionWithPoly(\"substr\", StrProto, polyStrSubstr);\r\n/**\r\n * The polyStrSubstr() method returns a portion of the string, starting at the specified index and extending for a given\r\n * number of characters afterwards.\r\n *\r\n * @since 0.4.2\r\n * @group String\r\n * @group Polyfill\r\n * @param value - The string value to return the substring from.\r\n * @param start - The index of the first character to include in the returned substring.\r\n * @param length - The number of characters to extract.\r\n * @returns A new string containing the specified part of the given string.\r\n */\r\nexport function polyStrSubstr(value, start, length) {\r\n if (isNullOrUndefined(value)) {\r\n throwTypeError(\"'polyStrSubstr called with invalid \" + dumpObj(value));\r\n }\r\n if (length < 0) {\r\n return EMPTY;\r\n }\r\n // If start is omitted or undefined, its treated as zero\r\n start = start || 0;\r\n if (start < 0) {\r\n start = mathMax(start + value[LENGTH], 0);\r\n }\r\n if (isUndefined(length)) {\r\n return strSlice(value, start);\r\n }\r\n return strSlice(value, start, start + length);\r\n}\r\n/**\r\n * Returns a substring of the string starting from the left.\r\n *\r\n * `strLeft()` extracts the number of characters from left of the string up to the count. In particular:\r\n * - If `count` is less than zero, strLeft() returns an empty string.\r\n * - If `count` is less than `value.length', strLeft() returns a new string with the `count` number of characters from the left of the string.\r\n * - If `count` is greater than `value.length`, then the value original value is returned.\r\n *\r\n * Any argument value that is NaN is treated as if it were 0.\r\n *\r\n * @since 0.4.2\r\n * @group String\r\n * @param value - The string value to return the substring from.\r\n * @param count - The number of characters to extract\r\n * @returns The substring based on the count number of characters from the right\r\n * @example\r\n * ```ts\r\n * strLeft(\"Nevware21\", -1); // \"\"\r\n * strLeft(\"Nevware21\", 0); // \"\"\r\n * strLeft(\"Nevware21\", 1); // \"N\"\r\n * strLeft(\"Nevware21\", 3); // \"Nev\"\r\n * strLeft(\"Nevware21\", 21); // \"Nevware21\"\r\n * ```\r\n */\r\nexport function strLeft(value, count) {\r\n return strSubstring(value, 0, count);\r\n}\r\n/**\r\n * Returns a substring of the string starting from the right.\r\n *\r\n * `strRight()` extracts the number of characters from right of the string up to the count. In particular:\r\n * - If `count` is less than zero, strRight() returns an empty string.\r\n * - If `count` is less than `value.length', strRight() returns a new string with the `count` number of characters from the right of the string.\r\n * - If `count` is greater than `value.length`, then the value original value is returned.\r\n *\r\n * Any argument value that is NaN is treated as if it were 0.\r\n *\r\n * @since 0.4.2\r\n * @group String\r\n * @param value - The string value to return the substring from.\r\n * @param count - The number of characters to extract\r\n * @returns The substring based on the count number of characters from the right\r\n * @example\r\n * ```ts\r\n * strRight(\"Nevware21\", -1); // \"\"\r\n * strRight(\"Nevware21\", 0); // \"\"\r\n * strRight(\"Nevware21\", 1); // \"1\"\r\n * strRight(\"Nevware21\", 3); // \"e21\"\r\n * strRight(\"Nevware21\", 21); // \"Nevware21\"\r\n * ```\r\n */\r\nexport function strRight(value, count) {\r\n var len = value[LENGTH];\r\n if (count <= 0) {\r\n return EMPTY;\r\n }\r\n return len > count ? strSubstring(value, len - count) : value;\r\n}\r\n//# sourceMappingURL=substring.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { isString } from \"../helpers/base\";\r\nimport { dumpObj } from \"../helpers/diagnostics\";\r\nimport { throwTypeError } from \"../helpers/throw\";\r\nimport { LENGTH, StrProto } from \"../internal/constants\";\r\nimport { _unwrapFunctionWithPoly } from \"../internal/unwrapFunction\";\r\nimport { asString } from \"./as_string\";\r\nimport { strSubstring } from \"./substring\";\r\n/**\r\n * This method lets you determine whether or not a string begins with another string. This method is case-sensitive.\r\n * @group String\r\n * @param value - The value to be checked\r\n * @param searchString - The characters to be searched for at the start of the string\r\n * @param position - [Optional] The position in this string at which to begin searching for `searchString`.\r\n * Defaults to 0\r\n * @returns `true` if the given characters are found at the beginning of the string; otherwise, `false`.\r\n */\r\nexport var strStartsWith = _unwrapFunctionWithPoly(\"startsWith\", StrProto, polyStrStartsWith);\r\n/**\r\n * This method lets you determine whether or not a string begins with another string. This method is case-sensitive.\r\n * @group Polyfill\r\n * @group String\r\n * @param value - The value to be checked\r\n * @param searchString - The characters to be searched for at the start of the string\r\n * @param position - [Optional] The position in this string at which to begin searching for `searchString`.\r\n * Defaults to 0\r\n * @returns `true` if the given characters are found at the beginning of the string; otherwise, `false`.\r\n */\r\nexport function polyStrStartsWith(value, searchString, position) {\r\n if (!isString(value)) {\r\n throwTypeError(\"'\" + dumpObj(value) + \"' is not a string\");\r\n }\r\n var searchValue = isString(searchString) ? searchString : asString(searchString);\r\n var chkLen = searchValue[LENGTH];\r\n var pos = position > 0 ? position : 0;\r\n return strSubstring(value, pos, pos + chkLen) === searchValue;\r\n}\r\n//# sourceMappingURL=starts_with.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { _wellKnownSymbolMap } from \"../symbol/well_known\";\r\nimport { throwTypeError } from \"../helpers/throw\";\r\nimport { POLYFILL_TAG, SYMBOL } from \"../internal/constants\";\r\nimport { objHasOwn } from \"../object/has_own\";\r\nimport { asString } from \"../string/as_string\";\r\nimport { _getGlobalConfig } from \"../internal/global\";\r\nimport { strStartsWith } from \"../string/starts_with\";\r\nimport { objKeys } from \"../object/object\";\r\nvar UNIQUE_REGISTRY_ID = \"_urid\";\r\nvar _polySymbols;\r\nfunction _globalSymbolRegistry() {\r\n if (!_polySymbols) {\r\n var gblCfg = _getGlobalConfig();\r\n _polySymbols = gblCfg.gblSym = gblCfg.gblSym || { k: {}, s: {} };\r\n }\r\n return _polySymbols;\r\n}\r\nvar _wellKnownSymbolCache = {};\r\n/**\r\n * Returns a new (polyfill) Symbol object for the provided description that's guaranteed to be unique.\r\n * Symbols are often used to add unique property keys to an object that won't collide with keys any\r\n * other code might add to the object, and which are hidden from any mechanisms other code will\r\n * typically use to access the object. That enables a form of weak encapsulation, or a weak form of\r\n * information hiding.\r\n * @group Polyfill\r\n * @group Symbol\r\n * @param description - The description of the symbol\r\n * @returns A new polyfill version of a Symbol object\r\n */\r\nexport function polyNewSymbol(description) {\r\n var theSymbol = {\r\n description: asString(description),\r\n toString: function () { return SYMBOL + \"(\" + description + \")\"; }\r\n };\r\n // Tag the symbol so we know it a polyfill\r\n theSymbol[POLYFILL_TAG] = true;\r\n return theSymbol;\r\n}\r\n/**\r\n * Returns a Symbol object from the global symbol registry matching the given key if found.\r\n * Otherwise, returns a new symbol with this key.\r\n * @group Polyfill\r\n * @group Symbol\r\n * @param key key to search for.\r\n */\r\nexport function polySymbolFor(key) {\r\n var registry = _globalSymbolRegistry();\r\n if (!objHasOwn(registry.k, key)) {\r\n var newSymbol_1 = polyNewSymbol(key);\r\n var regId_1 = objKeys(registry.s).length;\r\n newSymbol_1[UNIQUE_REGISTRY_ID] = function () { return regId_1 + \"_\" + newSymbol_1.toString(); };\r\n registry.k[key] = newSymbol_1;\r\n registry.s[newSymbol_1[UNIQUE_REGISTRY_ID]()] = asString(key);\r\n }\r\n return registry.k[key];\r\n}\r\n/**\r\n * Returns a key from the global symbol registry matching the given Symbol if found.\r\n * Otherwise, returns a undefined.\r\n * @group Polyfill\r\n * @group Symbol\r\n * @param sym Symbol to find the key for.\r\n */\r\nexport function polySymbolKeyFor(sym) {\r\n if (!sym || !sym.toString || !strStartsWith(sym.toString(), SYMBOL)) {\r\n throwTypeError(sym + \" is not a symbol\");\r\n }\r\n var regId = sym[POLYFILL_TAG] && sym[UNIQUE_REGISTRY_ID] && sym[UNIQUE_REGISTRY_ID]();\r\n return regId ? _globalSymbolRegistry().s[regId] : undefined;\r\n}\r\n/**\r\n * Returns the polyfill version of a well-known global symbol, this will only return\r\n * known values.\r\n * @example\r\n * ```ts\r\n * // Always returns the polyfill version, even if Symbols are supported in the runtime\r\n * polyGetKnownSymbol(\"toStringTag\") === polyGetKnownSymbol(\"toStringTag\"); // true\r\n * polyGetKnownSymbol(WellKnownSymbols.toStringTag) === polyGetKnownSymbol(\"toStringTag\"); // true\r\n * polyGetKnownSymbol(\"toStringTag\") !== Symbol.toStringTag; // true\r\n * polyGetKnownSymbol(WellKnownSymbols.toStringTag) !== Symbol.toStringTag; // true\r\n * polyGetKnownSymbol(\"toStringTag\") !== polySymbolFor(\"toStringTag\"); // true\r\n * polyGetKnownSymbol(WellKnownSymbols.toStringTag) !== polySymbolFor(\"toStringTag\"); // true\r\n * polyGetKnownSymbol(\"toStringTag\") !== polyNewSymbol(\"toStringTag\"); // true\r\n * polyGetKnownSymbol(WellKnownSymbols.toStringTag) !== polyNewSymbol(\"toStringTag\"); // true\r\n * ```\r\n * @group Polyfill\r\n * @group Symbol\r\n * @param name - The property name to return (if it exists) for Symbol\r\n * @returns The value of the property if present\r\n */\r\nexport function polyGetKnownSymbol(name) {\r\n var result;\r\n var knownName = _wellKnownSymbolMap[name];\r\n if (knownName) {\r\n result = _wellKnownSymbolCache[knownName] = _wellKnownSymbolCache[knownName] || polyNewSymbol(SYMBOL + \".\" + knownName);\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=symbol.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { ObjClass, VALUE } from \"../internal/constants\";\r\nimport { isFunction, isUndefined } from \"../helpers/base\";\r\nimport { objForEachKey } from \"./for_each_key\";\r\nimport { objGetOwnPropertyDescriptor } from \"./get_own_prop_desc\";\r\n/**\r\n * @internal\r\n * @ignore\r\n * Mapping from ObjDefinePropDescriptor key to PropertyDescriptor key\r\n */\r\nvar propMap = {\r\n e: \"enumerable\",\r\n c: \"configurable\",\r\n v: VALUE,\r\n w: \"writable\",\r\n g: \"get\",\r\n s: \"set\"\r\n};\r\n/**\r\n * @internal\r\n * @ignore\r\n * Helper to convert ObjDefinePropDescriptor into PropertyDescriptor\r\n * @param value - The prop descriptor to convert\r\n * @returns\r\n */\r\nfunction _createProp(value) {\r\n var prop = {};\r\n prop[propMap[\"c\"]] = true;\r\n prop[propMap[\"e\"]] = true;\r\n if (value.l) {\r\n // Asign a getter function to return the value when requested\r\n prop.get = function () { return value.l.v; };\r\n // If it has a setter then expose it as well\r\n var desc = objGetOwnPropertyDescriptor(value.l, \"v\");\r\n if (desc && desc.set) {\r\n prop.set = function (newValue) {\r\n value.l.v = newValue;\r\n };\r\n }\r\n }\r\n objForEachKey(value, function (key, value) {\r\n prop[propMap[key]] = isUndefined(value) ? prop[propMap[key]] : value;\r\n });\r\n return prop;\r\n}\r\n/**\r\n * Defines a new property directly on an object, or modifies an existing property on an object, and returns the object.\r\n * This is a wrapper for [Object.defineProperty](https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/object/defineproperty)\r\n *\r\n * This method allows a precise addition to or modification of a property on an object. Normal property addition through\r\n * assignment creates properties which show up during property enumeration (for...in loop or objKeys method), whose\r\n * values may be changed, and which may be deleted. This method allows these extra details to be changed from their\r\n * defaults. By default, properties added using objDefineProp() are not writable, not enumerable, and not configurable.\r\n *\r\n * Property descriptors present in objects come in two main flavors: data descriptors and accessor descriptors. A data\r\n * descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property\r\n * described by a getter-setter pair of functions. A descriptor must be one of these two flavors; it cannot be both.\r\n *\r\n * This is an alias for Object.defineProperty\r\n * @group Object\r\n * @param target - The object on which to define the property.\r\n * @param key - The name or Symbol of the property to be defined or modified.\r\n * @param descriptor - The descriptor for the property being defined or modified.\r\n */\r\nexport var objDefineProp = ObjClass[\"defineProperty\"];\r\n/**\r\n * The objDefineProperties() method defines new or modifies existing properties directly on an object, returning the object.\r\n * This is a wrapper for [Object.defineProperties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties)\r\n * @since 0.6.0\r\n * @group Object\r\n * @param target - The object on which to define or modify properties.\r\n * @param props - An object whose keys represent the names of properties to be defined or modified and whose values are\r\n * objects describing those properties. Each value in props must be either a data descriptor or an accessor descriptor;\r\n * it cannot be both (see {@link ObjDefinePropDescriptorMap} for more details).\r\n * @returns\r\n */\r\nexport var objDefineProperties = ObjClass[\"defineProperties\"];\r\n/**\r\n * Try to define a get object property accessor for the target object, if a function is past as the value this will\r\n * be assumed to be a getter function and NOT the value.\r\n * @deprecated It is recommended that you use {@link objDefine} instead {@link objDefineGet} or {@link objDefineAccessors}\r\n * as it provides a deterministic way for identifying whether the value is a value or a function rather than wrapping any\r\n * function value in another function.\r\n * @group Object\r\n * @param target - The object on which to define the property.\r\n * @param key - The name of the property to be defined or modified\r\n * @param value - The value or a function that returns the value\r\n * @param configurable - Can the value be changed, defaults to true.\r\n * @param enumerable - Should this get property be enumerable, defaults to true.\r\n * @returns The object that was passed to the function\r\n */\r\nexport function objDefineGet(target, key, value, configurable, enumerable) {\r\n var _a;\r\n return objDefineProp(target, key, _createProp((_a = {\r\n e: enumerable,\r\n c: configurable\r\n },\r\n _a[isFunction(value) ? \"g\" : \"v\"] = value,\r\n _a)));\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 * @deprecated It is recommended that you use {@link objDefine} instead {@link objDefineAccessors} as this internally creates\r\n * the {@link ObjDefinePropDescriptor} definition based on your provided arguments. And only using a minimum set of functions\r\n * reduces your overall bundle size.\r\n * @group Object\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 * @param configurable - Can the value be changed, defaults to true\r\n * @param enumerable - Should this get property be enumerable, defaults to true.\r\n * @returns The object that was passed to the function\r\n */\r\nexport function objDefineAccessors(target, prop, getProp, setProp, configurable, enumerable) {\r\n var desc = {\r\n e: enumerable,\r\n c: configurable\r\n };\r\n if (getProp) {\r\n desc.g = getProp;\r\n }\r\n if (setProp) {\r\n desc.s = setProp;\r\n }\r\n return objDefineProp(target, prop, _createProp(desc));\r\n}\r\n/**\r\n * The objDefine() method defines a new or modifies an existing single property accessors for the target object based\r\n * on the configuration defined for the propDesc argument of type {@link ObjDefinePropDescriptor}. This will call\r\n * {@link objDefineProp} after creating the required PropertyDescriptor populating defaults for the propDesc values.\r\n * Note, the default values (true) for `configurable` and `enumerable` are different from the defaults provided by objDefineProp.\r\n * @since 0.6.0\r\n * @group Object\r\n * @param target - The object on which to define the property.\r\n * @param key - The name of the property to be defined or modified\r\n * @param propDesc - An object which defines the Property Descriptor mappings for the mapping.\r\n * @returns The target object.\r\n */\r\nexport function objDefine(target, key, propDesc) {\r\n return objDefineProp(target, key, _createProp(propDesc));\r\n}\r\n/**\r\n * The objDefineProps() method defines new or modifies existing properties directly for the target object using the keys\r\n * and configuration from the propDescMap argument. This will call {@link objDefineProperties} after creating the required\r\n * PropertyDescriptorMap from the propDescMap values.\r\n * Note, the default values (true) for `configurable` and `enumerable` are different from the defaults provided by objDefineProperties.\r\n * @since 0.6.0\r\n * @group Object\r\n * @param target - The object on which to define or modify properties.\r\n * @param propDescMap - An object whose keys represent the names of properties to be defined or modified and whose values are\r\n * objects describing those properties. Each value in props must be either a data descriptor or an accessor descriptor;\r\n * it cannot be both (see {@link ObjDefinePropDescriptorMap} for more details).\r\n * @returns The target object.\r\n */\r\nexport function objDefineProps(target, propDescMap) {\r\n var props = {};\r\n objForEachKey(propDescMap, function (key, value) {\r\n props[key] = _createProp(value);\r\n });\r\n return objDefineProperties(target, props);\r\n}\r\n//# sourceMappingURL=define.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { NULL_VALUE } from \"../internal/constants\";\r\nimport { _getGlobalConfig } from \"../internal/global\";\r\nimport { objDefineProp } from \"../object/define\";\r\n/**\r\n * @internal\r\n * Internal flag which is set by the public {@link setBypassLazyCache}, should not be externally exported\r\n */\r\nexport var _globalLazyTestHooks;\r\nvar _fetchLazyTestHooks = function () {\r\n _globalLazyTestHooks = _getGlobalConfig();\r\n _fetchLazyTestHooks = NULL_VALUE;\r\n};\r\n/**\r\n * Create and return an readonly {@link ILazyValue} instance which will cache and return the value returned\r\n * by the callback function. The callback function will only be called once, multiple access of the value\r\n * does not cause re-execution of the callback as the result from the first call is cached internally.\r\n * @since 0.4.5\r\n * @group Lazy\r\n * @param cb - The callback function to fetch the value to be lazily evaluated and cached\r\n * @returns A new readonly {@link ILazyValue} instance which wraps the callback and will be used to cache\r\n * the result of the callback\r\n * @example\r\n * ```ts\r\n * // This does not cause the evaluation to occur\r\n * let cachedValue = getLazy(() => callSomeExpensiveFunction());\r\n * let theValue;\r\n *\r\n * // Just checking if there is an object still does not cause the evaluation\r\n * if (cachedValue) {\r\n * // This will cause the evaluation to occur and the result will be cached\r\n * theValue = cachedValue.v;\r\n * }\r\n *\r\n * // Accessing the value again will not cause the re-evaluation to occur, it will just return the same\r\n * // result value again.\r\n * theValue === cachedValue.v; // true\r\n *\r\n * ```\r\n */\r\nexport function getLazy(cb) {\r\n var lazyValue = {};\r\n _fetchLazyTestHooks && _fetchLazyTestHooks();\r\n lazyValue.b = _globalLazyTestHooks.lzy;\r\n objDefineProp(lazyValue, \"v\", {\r\n configurable: true,\r\n get: function () {\r\n var result = cb();\r\n if (!_globalLazyTestHooks.lzy) {\r\n // Just replace the value\r\n objDefineProp(lazyValue, \"v\", {\r\n value: result\r\n });\r\n if (lazyValue.b) {\r\n delete lazyValue.b;\r\n }\r\n }\r\n if (_globalLazyTestHooks.lzy && lazyValue.b !== _globalLazyTestHooks.lzy) {\r\n lazyValue.b = _globalLazyTestHooks.lzy;\r\n }\r\n return result;\r\n }\r\n });\r\n return lazyValue;\r\n}\r\n/**\r\n * Test Hook function used to cause the internal caching of objects to be bypassed, this should never\r\n * be enabled for production as it has additional performance impact caused by the repetitive creation\r\n * of the lazy wrappers.\r\n * @group Lazy\r\n * @since 0.5.0\r\n * @param newValue - When `true` will cause all new lazy implementations to bypass the cached lookup.\r\n */\r\nexport function setBypassLazyCache(newValue) {\r\n _fetchLazyTestHooks && _fetchLazyTestHooks();\r\n _globalLazyTestHooks.lzy = newValue;\r\n}\r\n/**\r\n * Create and return a writable {@link ILazyValue} instance which will cache and return the value returned\r\n * by the callback function. The callback function will only be called once, multiple access of the value\r\n * does not cause re-execution of the callback as the result from the first call is cached internally. The\r\n * value may be set as many times as required, if the callback has not been called when you set the value\r\n * it will never get called.\r\n * @since 0.9.4\r\n * @group Lazy\r\n * @param cb - The callback function to fetch the value to be lazily evaluated and cached\r\n * @returns A new writable {@link ILazyValue} instance which wraps the callback and will be used to cache\r\n * the result of the callback\r\n * @example\r\n * ```ts\r\n * // This does not cause the evaluation to occur\r\n * let cachedValue = getWritableLazy(() => callSomeExpensiveFunction());\r\n * let theValue;\r\n *\r\n * // Just checking if there is an object still does not cause the evaluation\r\n * if (cachedValue) {\r\n * // This will cause the evaluation to occur and the result will be cached\r\n * theValue = cachedValue.v;\r\n * }\r\n *\r\n * // Accessing the value again will not cause the re-evaluation to occur, it will just return the same\r\n * // result value again.\r\n * theValue === cachedValue.v; // true\r\n *\r\n * // Setting the value\r\n * let cachedValue = getWritableLazy(() => callSomeExpensiveFunction());\r\n * let theValue = \"new Value\";\r\n *\r\n * // Just checking if there is an object still does not cause the evaluation\r\n * if (cachedValue) {\r\n * // This will set the value to be set explicitly and the callback\r\n * // will now never occur and the result will be cached\r\n * cachedValue.v = theValue;\r\n * }\r\n *\r\n * // Accessing the value again will cause the previously set value to be returned.\r\n * theValue === cachedValue.v; // true\r\n * ```\r\n */\r\nexport function getWritableLazy(cb) {\r\n var lazyValue = {};\r\n _fetchLazyTestHooks && _fetchLazyTestHooks();\r\n lazyValue.b = _globalLazyTestHooks.lzy;\r\n var _setValue = function (newValue) {\r\n // Just replace the value\r\n objDefineProp(lazyValue, \"v\", {\r\n value: newValue,\r\n writable: true\r\n });\r\n if (lazyValue.b) {\r\n delete lazyValue.b;\r\n }\r\n };\r\n objDefineProp(lazyValue, \"v\", {\r\n configurable: true,\r\n get: function () {\r\n var result = cb();\r\n if (!_globalLazyTestHooks.lzy) {\r\n // Just replace the value\r\n _setValue(result);\r\n }\r\n if (_globalLazyTestHooks.lzy && lazyValue.b !== _globalLazyTestHooks.lzy) {\r\n lazyValue.b = _globalLazyTestHooks.lzy;\r\n }\r\n return result;\r\n },\r\n set: _setValue\r\n });\r\n return lazyValue;\r\n}\r\n//# sourceMappingURL=lazy.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { getLazy } from \"./lazy\";\r\nimport { safeGet } from \"./safe_get\";\r\n/**\r\n * Create and return an readonly {@link ILazyValue} instance which will cache and return the value returned\r\n * by the callback function. The callback function will only be called once, multiple access of the value\r\n * does not cause re-execution of the callback as the result from the first call is cached internally.\r\n * If the callback throws the default value will be returned.\r\n * @since 0.9.5\r\n * @group Lazy\r\n * @group Safe\r\n * @param cb - The callback function to fetch the value to be lazily evaluated and cached\r\n * @param defValue - The default value to return when an exception is thrown\r\n * @returns A new readonly {@link ILazyValue} instance which wraps the callback and will be used to cache\r\n * the result of the callback\r\n * @example\r\n * ```ts\r\n * // This does not cause the evaluation to occur\r\n * let cachedValue = safeGetLazy(() => callSomeExpensiveFunctionWhichMightThrow(), \"someDefaultValue\");\r\n * let theValue;\r\n *\r\n * // Just checking if there is an object still does not cause the evaluation\r\n * if (cachedValue) {\r\n * // This will cause the evaluation to occur and the result will be cached\r\n * theValue = cachedValue.v;\r\n * }\r\n *\r\n * // Accessing the value again will not cause the re-evaluation to occur, it will just return the same\r\n * // result value again.\r\n * theValue === cachedValue.v; // true\r\n *\r\n * ```\r\n */\r\nexport function safeGetLazy(cb, defValue) {\r\n return getLazy(function () { return safeGet(cb, defValue); });\r\n}\r\n//# sourceMappingURL=safe_lazy.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { NULL_VALUE, UNDEF_VALUE } from \"../internal/constants\";\r\nimport { _getGlobalValue } from \"../internal/global\";\r\nimport { safeGetLazy } from \"./safe_lazy\";\r\nimport { _globalLazyTestHooks } from \"./lazy\";\r\nvar WINDOW = \"window\";\r\nvar _cachedGlobal;\r\nvar _cachedWindow;\r\nvar _cachedDocument;\r\nvar _cachedNavigator;\r\nvar _cachedHistory;\r\nvar _isWebWorker;\r\nvar _isNode;\r\n/**\r\n * Create and return an readonly {@link ILazyValue} instance which will cache and return the named global\r\n * value if available, will return `null` if the named global object is not available or if the runtime\r\n * throws an exception when attempting to access the global object.\r\n * Unlike {@link getInst} the value is cached after the first access, so if the global value changes after\r\n * the initial fetch the original cached value is still returned.\r\n * @since 0.9.5\r\n * @group Environment\r\n * @group Lazy\r\n * @group Safe\r\n * @param name The name of the global object to get.\r\n * @returns A new readonly {@link ILazyValue} instance which will lazily attempt to return the globally\r\n * available named instance.\r\n * @example\r\n * ```ts\r\n * // This does not cause the evaluation to occur\r\n * window.myGlobal = \"Hello\";\r\n * let cachedValue = lazySafeGetInst(\"myGlobal\");\r\n * // cachedValue.v === \"Hello\"\r\n *\r\n * window.myGlobal = \"Darkness\";\r\n * // cachedValue.v === \"Hello\"\r\n *\r\n * let promiseCls = lazySafeGetInst(\"Promise\");\r\n * // null if Promise is not supported in the runtime\r\n * // otherwise the Promise class.\r\n * ```\r\n */\r\nexport var lazySafeGetInst = function (name) { return safeGetLazy(function () { return getInst(name) || UNDEF_VALUE; }, UNDEF_VALUE); };\r\n/**\r\n * Returns the current global scope object, for a normal web page this will be the current\r\n * window, for a Web Worker this will be current worker global scope via \"self\". The internal\r\n * implementation returns the first available instance object in the following order\r\n * - globalThis (New standard)\r\n * - self (Will return the current window instance for supported browsers)\r\n * - window (fallback for older browser implementations)\r\n * - global (NodeJS standard)\r\n * - (When all else fails)\r\n * While the return type is a Window for the normal case, not all environments will support all\r\n * of the properties or functions. And this caches the lookup of the global as in some environments\r\n * this can be an expensive operation.\r\n * @group Environment\r\n * @param useCached - [Optional] used for testing to bypass the cached lookup, when `true` this will\r\n * cause the cached global to be reset.\r\n */\r\nexport var getGlobal = function (useCached) {\r\n (!_cachedGlobal || useCached === false || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedGlobal.b)) && (_cachedGlobal = safeGetLazy(_getGlobalValue, NULL_VALUE));\r\n return _cachedGlobal.v;\r\n};\r\n/**\r\n * Return the named global object if available, will return null if the object is not available.\r\n * @group Environment\r\n * @param name The globally named object\r\n * @param useCached - [Optional] used for testing to bypass the cached lookup, when `true` this will\r\n * cause the cached global to be reset.\r\n * @example\r\n * ```ts\r\n * // This does not cause the evaluation to occur\r\n * window.myGlobal = \"Hello\";\r\n * let cachedValue = getInst(\"myGlobal\");\r\n * // cachedValue === \"Hello\"\r\n *\r\n * window.myGlobal = \"Darkness\";\r\n * // getInst(\"myGlobal\") === \"Darkness\"\r\n *\r\n * let promiseCls = getInst(\"Promise\");\r\n * // May throw if the global is not supported by the runtime\r\n * // otherwise the Promise class.\r\n * ```\r\n */\r\nexport var getInst = function (name, useCached) {\r\n var gbl = (!_cachedGlobal || useCached === false) ? getGlobal(useCached) : _cachedGlobal.v;\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 === WINDOW && _cachedWindow) {\r\n // tslint:disable-next-line: no-angle-bracket-type-assertion\r\n return _cachedWindow.v;\r\n }\r\n return NULL_VALUE;\r\n};\r\n/**\r\n * Identify whether the runtime contains a `document` object\r\n * @group Environment\r\n * @returns - True if a `document` exists\r\n */\r\nexport var hasDocument = function () { return !!getDocument(); };\r\n/**\r\n * Return the global `document` instance.\r\n * @group Environment\r\n * @returns\r\n */\r\nexport var getDocument = function () {\r\n (!_cachedDocument || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = lazySafeGetInst(\"document\"));\r\n return _cachedDocument.v;\r\n};\r\n/**\r\n * Identify whether the runtime contains a `window` object\r\n * @group Environment\r\n * @returns\r\n */\r\nexport var hasWindow = function () { return !!getWindow(); };\r\n/**\r\n * Return the global `window` instance.\r\n * @group Environment\r\n * @returns\r\n */\r\nexport var getWindow = function () {\r\n (!_cachedWindow || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = lazySafeGetInst(WINDOW));\r\n return _cachedWindow.v;\r\n};\r\n/**\r\n * Identify whether the runtimne contains a `navigator` object\r\n * @group Environment\r\n * @returns\r\n */\r\nexport var hasNavigator = function () { return !!getNavigator(); };\r\n/**\r\n * Returns the global `navigator` instance\r\n * @group Environment\r\n * @returns\r\n */\r\nexport var getNavigator = function () {\r\n (!_cachedNavigator || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = lazySafeGetInst(\"navigator\"));\r\n return _cachedNavigator.v;\r\n};\r\n/**\r\n * Identifies whether the runtime contains a `history` object\r\n * @group Environment\r\n * @returns\r\n */\r\nexport var hasHistory = function () { return !!getHistory(); };\r\n/**\r\n * Returns the global `history` instance\r\n * @group Environment\r\n * @returns\r\n */\r\nexport var getHistory = function () {\r\n (!_cachedHistory || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_cachedHistory.b)) && (_cachedHistory = lazySafeGetInst(\"history\"));\r\n return _cachedHistory.v;\r\n};\r\n/**\r\n * Simple method to determine if we are running in a node environment\r\n * @group Environment\r\n * @returns True if you are\r\n */\r\nexport var isNode = function () {\r\n !_isNode && (_isNode = safeGetLazy(function () { return !!(process && (process.versions || {}).node); }, false));\r\n return _isNode.v;\r\n};\r\n/**\r\n * Helper to identify if you are running as a Dedicated, Shared or Service worker\r\n * @group Environment\r\n * @returns True if the environment you are in looks like a Web Worker\r\n */\r\nexport var isWebWorker = function () {\r\n !_isWebWorker && (_isWebWorker = safeGetLazy(function () { return !!(self && self instanceof WorkerGlobalScope); }, false));\r\n return _isWebWorker.v;\r\n};\r\n//# sourceMappingURL=environment.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { NULL_VALUE, SYMBOL, UNDEF_VALUE } from \"../internal/constants\";\r\nimport { polyGetKnownSymbol, polyNewSymbol, polySymbolFor, polySymbolKeyFor } from \"../polyfills/symbol\";\r\nimport { _wellKnownSymbolMap } from \"./well_known\";\r\nimport { _createIs } from \"../helpers/base\";\r\nimport { _globalLazyTestHooks } from \"../helpers/lazy\";\r\nimport { safeGetLazy } from \"../helpers/safe_lazy\";\r\nimport { lazySafeGetInst } from \"../helpers/environment\";\r\nvar _symbol;\r\nvar _symbolFor;\r\nvar _symbolKeyFor;\r\nfunction _getSymbolValue(name) {\r\n return safeGetLazy(function () {\r\n return (_symbol.v ? _symbol.v[name] : UNDEF_VALUE);\r\n }, UNDEF_VALUE);\r\n}\r\n/**\r\n * Checks if the type of value is a symbol.\r\n * @group Symbol\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 var isSymbol = _createIs(\"symbol\");\r\n/**\r\n * Helper to identify whether the runtime support the Symbols either via native or an installed polyfill\r\n * @group Symbol\r\n * @returns true if Symbol's are support otherwise false\r\n */\r\nexport function hasSymbol() {\r\n return !!getSymbol();\r\n}\r\n/**\r\n * If Symbols are supported then attempt to return the named Symbol\r\n * @group Symbol\r\n * @returns The value of the named Symbol (if available)\r\n */\r\nexport function getSymbol() {\r\n var resetCache = !_symbol || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_symbol.b);\r\n resetCache && (_symbol = lazySafeGetInst(SYMBOL));\r\n (!_symbolFor || resetCache) && (_symbolFor = _getSymbolValue(\"for\"));\r\n (!_symbolKeyFor || resetCache) && (_symbolKeyFor = _getSymbolValue(\"keyFor\"));\r\n return _symbol.v;\r\n}\r\n/**\r\n * If Symbols are supported then get the property of the global Symbol, if Symbol's are\r\n * not supported and noPoly is true it returns null. Used to access the well known symbols.\r\n * @group Symbol\r\n * @param name - The property name to return (if it exists) for Symbol\r\n * @param noPoly - Flag indicating whether to return a polyfill if symbols are not supported.\r\n * @returns The value of the property if present\r\n * @example\r\n * ```ts\r\n * // If Symbol is supported in the runtime\r\n * getKnownSymbol(\"toStringTag\") === Symbol.toStringTag; // true\r\n * getKnownSymbol(WellKnownSymbols.toStringTag) === Symbol.toStringTag; // true\r\n * ```\r\n */\r\nexport function getKnownSymbol(name, noPoly) {\r\n var knownName = _wellKnownSymbolMap[name];\r\n // Cause lazy symbol to get initialized\r\n (!_symbol || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();\r\n return _symbol.v ? _symbol.v[knownName || name] : (!noPoly ? polyGetKnownSymbol(name) : UNDEF_VALUE);\r\n}\r\n/**\r\n * Returns a new unique Symbol value. If noPoly is true and symbols are not supported\r\n * then this will return null.\r\n * @group Symbol\r\n * @param description Description of the new Symbol object.\r\n * @param noPoly - Flag indicating whether to return a polyfil if symbols are not supported.\r\n * @returns The new symbol\r\n */\r\nexport function newSymbol(description, noPoly) {\r\n // Cause lazy _symbol to get initialized\r\n (!_symbol || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();\r\n return _symbol.v ? _symbol.v(description) : (!noPoly ? polyNewSymbol(description) : NULL_VALUE);\r\n}\r\n/**\r\n * Returns a Symbol object from the global symbol registry matching the given key if found.\r\n * Otherwise, returns a new symbol with this key. This will always return a polyfill if symbols\r\n * are not supported.\r\n * @group Symbol\r\n * @param key key to search for.\r\n */\r\nexport function symbolFor(key) {\r\n // Cause lazy symbol to get initialized\r\n (!_symbolFor || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();\r\n return (_symbolFor.v || polySymbolFor)(key);\r\n}\r\n/**\r\n * Returns a key from the global symbol registry matching the given Symbol if found.\r\n * Otherwise, returns a undefined. This will always attempt to lookup the polyfill\r\n * implementation if symbols are not supported\r\n * @group Symbol\r\n * @param sym Symbol to find the key for.\r\n */\r\nexport function symbolKeyFor(sym) {\r\n // Cause lazy symbol to get initialized\r\n (!_symbolKeyFor || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();\r\n return (_symbolKeyFor.v || polySymbolKeyFor)(sym);\r\n}\r\n//# sourceMappingURL=symbol.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { getLazy } from \"../helpers/lazy\";\r\nimport { DONE, VALUE } from \"../internal/constants\";\r\nimport { getKnownSymbol } from \"../symbol/symbol\";\r\nimport { isIterator } from \"./iterator\";\r\nvar _iterSymbol;\r\n/**\r\n * Calls the provided `callbackFn` function once for each element in the iterator or iterator returned by\r\n * the iterable and processed in the same order as returned by the iterator. As with the {@link arrForEach}\r\n * you CAN stop / break the iteration by returning -1 from the`callbackFn` function.\r\n *\r\n * The order of processing is not reset if you add or remove elements to the iterator, the actual behavior\r\n * will depend on the iterator imeplementation.\r\n *\r\n * If the passed `iter` is both an Iterable and Iterator the Iterator interface takes preceedence.\r\n * @remarks\r\n * If Symbols are NOT supported then the iterable MUST be using the same polyFill for the well know symbols,\r\n * if you are targetting a mixed environment you SHOULD either\r\n * - only use the polyfill Symbol's provided by this library\r\n * - ensure that you add any symbol polyfills BEFORE these utilities\r\n * iterForOf expects a `synchronous` function.\r\n * iterForOf does not wait for promises. Make sure you are aware of the implications while using\r\n * promises (or async functions) as forEach callback.\r\n *\r\n * @since 0.4.2\r\n * @group Iterator\r\n * @typeParam T - Identifies the element type of the iterator\r\n * @param callbackfn A `synchronous` function that accepts up to three arguments. iterForOf calls the\r\n * callbackfn function one time for each element returned by the iterator.\r\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is\r\n * omitted, null or undefined the iterator will be used as the this value.\r\n * @throws Any exception thrown while processing the iterator\r\n * @example\r\n * ```ts\r\n * const items = {\r\n * 'item1': 'value1',\r\n * 'item2': 'value2',\r\n * 'item3': 'value3\r\n * };\r\n * const copyItems = [];\r\n *\r\n * iterForOf(items, (item) => {\r\n * copyItems.push(item);\r\n * // May return -1 to abort the iteration\r\n * });\r\n * ```\r\n */\r\nexport function iterForOf(iter, callbackfn, thisArg) {\r\n if (iter) {\r\n if (!isIterator(iter)) {\r\n !_iterSymbol && (_iterSymbol = getLazy(function () { return getKnownSymbol(3 /* WellKnownSymbols.iterator */); }));\r\n iter = iter[_iterSymbol.v] ? iter[_iterSymbol.v]() : null;\r\n }\r\n if (isIterator(iter)) {\r\n var err = void 0;\r\n var iterResult = void 0;\r\n try {\r\n var count = 0;\r\n while (!(iterResult = iter.next())[DONE]) {\r\n if (callbackfn.call(thisArg || iter, iterResult[VALUE], count, iter) === -1) {\r\n break;\r\n }\r\n count++;\r\n }\r\n }\r\n catch (failed) {\r\n err = { e: failed };\r\n if (iter.throw) {\r\n iterResult = null;\r\n iter.throw(err);\r\n }\r\n }\r\n finally {\r\n try {\r\n if (iterResult && !iterResult[DONE]) {\r\n iter.return && iter.return(iterResult);\r\n }\r\n }\r\n finally {\r\n if (err) {\r\n // eslint-disable-next-line no-unsafe-finally\r\n throw err.e;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=forOf.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { getKnownSymbol } from \"../symbol/symbol\";\r\nimport { isFunction, isStrictNullOrUndefined } from \"../helpers/base\";\r\n/**\r\n * Checks if the type of value looks like an iterator instance (contains a next function).\r\n *\r\n * @since 0.4.0\r\n * @group Type Identity\r\n * @group Iterator\r\n * @typeParam T - Identifies the return type of the iterator defaults to any\r\n * @param value - The value to be checked\r\n * @returns {boolean} True if the value is an Iterator, otherwise false\r\n * @example\r\n * ```ts\r\n * isIterator(null); // false\r\n * isIterator(undefined); // false\r\n * isIterator(\"null\"); // false (Strings are iterable but not iterators)\r\n * isIterator([]); // false (Arrays are iterable but not iterators)\r\n * isIterator({\r\n * next: function() { return true }\r\n * }); // true, iterators must contain a \"next\" function\r\n * ```\r\n */\r\nexport function isIterator(value) {\r\n return !!value && isFunction(value.next);\r\n}\r\n/**\r\n * Checks if the value looks like it is iterable, contains a [symbol.iterator].\r\n *\r\n * @since 0.4.0\r\n * @group Type Identity\r\n * @group Iterator\r\n * @typeParam T - Identifies the return type of the iterator\r\n * @param value - The value to be checked\r\n * @returns {boolean} True if the value is an Iterable, otherwise false\r\n * @example\r\n * ```ts\r\n * isIterable(null); // false\r\n * isIterable(undefined); // false\r\n * isIterable(\"null\"); // true (Strings are iterable)\r\n * isIterable([]); // true (Arrays are iterable)\r\n * ```\r\n */\r\nexport function isIterable(value) {\r\n return !isStrictNullOrUndefined(value) && isFunction(value[getKnownSymbol(3 /* WellKnownSymbols.iterator */)]);\r\n}\r\n//# sourceMappingURL=iterator.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2023 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { _unwrapInstFunction } from \"../internal/unwrapFunction\";\r\n/**\r\n * The `fnApply` function calls the specified `fn` function with the given `thisArg` as the `this` value,\r\n * and the optional `argArray` arguments provided as an array (or an Array-Like Object).\r\n *\r\n * Normally, when calling a function, the value of `this` inside the function is the object that the\r\n * function was accessed on. With `fnApply()`, you can assign an arbitrary value as this when calling an\r\n * existing function, without first attaching the function to the object as a property. This allows you\r\n * to use methods of one object as generic utility functions.\r\n *\r\n * You can also use any kind of object which is ArrayLike as the second parameter. In practice, this means\r\n * that it needs to have a length property, and integer (\"index\") properties in the range (0..length - 1).\r\n * For example, you could use a NodeList, or a custom object like `{ 'length': 2, '0': 'eat', '1': 'bananas' }`.\r\n * You can also use `arguments`.\r\n *\r\n * @since 0.9.8\r\n * @group Function\r\n *\r\n * @param fn - The function to be called\r\n * @param thisArg - The value of `this` provided for the call to `fn`. If the function is not in strict mode,\r\n * `null` and `undefined` will be replaced with the global object, and primitive values will be converted to objects.\r\n * @param argArray - An array-like object, specifying the arguments with which `fn` should be called, or `null` or\r\n * `undefined` if no arguments should be provided to the function.\r\n * @returns The result of calling the function with the specified `this` value and arguments.\r\n * @example\r\n * ```ts\r\n * // min / max number in an array\r\n * let max = fnApply(Math.max, null, [ 21, 42, 84, 168, 7, 3 ]);\r\n * // 168\r\n *\r\n * let min = fnApply(Math.min, null, [ 21, 42, 84, 168, 7, 3 ]);\r\n * // 3\r\n *\r\n * const module1 = {\r\n * prefix: \"Hello\",\r\n * x: 21,\r\n * getX() {\r\n * return this.x;\r\n * },\r\n * log(value: string) {\r\n * return this.prefix + \" \" + value + \" : \" + this.x\r\n * }\r\n * };\r\n *\r\n * // The 'this' parameter of 'getX' is bound to 'module'.\r\n * module1.getX(); // 21\r\n * module1.log(\"Darkness\"); // Hello Darkness : 21\r\n *\r\n * // Create a new function 'boundGetX' with the 'this' parameter bound to 'module'.\r\n * let module2 = {\r\n * prefix: \"my\",\r\n * x: 42\r\n * };\r\n *\r\n * // Call the function of module1 with module2 as it's this\r\n * fnApply(module1.getX, module2); // 42\r\n * fnApply(module1.log, module2, [ \"friend\" ]); // my friend : 42\r\n * ```\r\n */\r\nexport var fnApply = _unwrapInstFunction(\"apply\");\r\n//# sourceMappingURL=fnApply.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { isArray, isUndefined } from \"../helpers/base\";\r\nimport { isIterable, isIterator } from \"../iterator/iterator\";\r\nimport { iterForOf } from \"../iterator/forOf\";\r\nimport { fnApply } from \"../funcs/fnApply\";\r\n/**\r\n * Appends the `elms` to the `target` where the elms may be an array, a single object\r\n * or an iterator object\r\n * @group Array\r\n * @group Iterator\r\n * @example\r\n * ```ts\r\n * let theArray = arrAppend([], 1);\r\n * arrAppend(theArray, [ 2, 3, 4 ]);\r\n * arrAppend(theArray, [ \"a\", \"b\", \"c\" ]);\r\n * // theArray is now [ 1, 2, 3, 4, \"a\", \"b\", \"c\" ]\r\n * ```\r\n * @param target - The target array\r\n * @param elms - The item, array of items an iterable or iterator object of items to add to the target\r\n * @returns The passed in target array\r\n * @example\r\n * ```ts\r\n * // Adding a single value\r\n * arrAppend([], undefined); // []\r\n * arrAppend([], 0); // [ 0 ]\r\n * arrAppend([1], undefined); // [ 1 ]\r\n * arrAppend([1], 2); // [ 1, 2 ]\r\n *\r\n * // Adding an array\r\n * arrAppend([], [] as number[]); // []\r\n * arrAppend([], [0]); // [ 0 ]\r\n * arrAppend([1], []); // [ 1 ]\r\n * arrAppend([1], [2]); // [ 1, 2 ]\r\n *\r\n * // Adding with an iterator\r\n * arrAppend([], ([] as number[]).values()); // []\r\n * arrAppend([], [0].values()); // [ 0 ]\r\n * arrAppend([1], [].keys()); // [ 1 ]\r\n * arrAppend([1], [2].values()); // [ 1, 2 ]\r\n * arrAppend([1], [2].keys()); // [ 1, 0 ] - 0 is from the index from the first element\r\n * ```\r\n */\r\nexport function arrAppend(target, elms) {\r\n if (!isUndefined(elms) && target) {\r\n if (isArray(elms)) {\r\n // This is not just \"target.push(elms)\" but becomes effectively \"target.push(elms[0], elms[1], ...)\"\r\n fnApply(target.push, target, elms);\r\n }\r\n else if (isIterator(elms) || isIterable(elms)) {\r\n iterForOf(elms, function (elm) {\r\n target.push(elm);\r\n });\r\n }\r\n else {\r\n target.push(elms);\r\n }\r\n }\r\n return target;\r\n}\r\n//# sourceMappingURL=append.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { LENGTH } from \"../internal/constants\";\r\n/**\r\n * Calls the provided `callbackFn` function once for each element in an array in ascending index order. It is not invoked for index properties\r\n * that have been deleted or are uninitialized. And unlike the ES6 forEach() you CAN stop or break the iteration by returning -1 from the\r\n * `callbackFn` function.\r\n *\r\n * The range (number of elements) processed by arrForEach() is set before the first call to the `callbackFn`. Any elements added beyond the range\r\n * or elements which as assigned to indexes already processed will not be visited by the `callbackFn`.\r\n * @group Array\r\n * @group ArrayLike\r\n * @typeParam T - Identifies the element type of the array\r\n * @param theArray - The array or array like object of elements to be searched.\r\n * @param callbackfn A `synchronous` function that accepts up to three arguments. arrForEach 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, null or undefined\r\n * the array will be used as the this value.\r\n * @remarks\r\n * arrForEach expects a `synchronous` function.\r\n * arrForEach does not wait for promises. Make sure you are aware of the implications while using promises (or async functions) as forEach callback.\r\n * @example\r\n * ```ts\r\n * const items = ['item1', 'item2', 'item3'];\r\n * const copyItems = [];\r\n *\r\n * // before using for loop\r\n * for (let i = 0; i < items.length; i++) {\r\n * copyItems.push(items[i]);\r\n * }\r\n *\r\n * // before using forEach()\r\n * items.forEach((item) => {\r\n * copyItems.push(item);\r\n * });\r\n *\r\n * // after\r\n * arrForEach(items, (item) => {\r\n * copyItems.push(item);\r\n * // May return -1 to abort the iteration\r\n * });\r\n *\r\n * // Also supports input as an array like object\r\n * const items = { length: 3, 0: 'item1', 1: 'item2', 2: 'item3' };\r\n * ```\r\n */\r\nexport function arrForEach(theArray, callbackfn, thisArg) {\r\n if (theArray) {\r\n var len = theArray[LENGTH] >>> 0;\r\n for (var idx = 0; idx < len; idx++) {\r\n if (idx in theArray) {\r\n if (callbackfn.call(thisArg || theArray, theArray[idx], idx, theArray) === -1) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=forEach.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { ArrProto, INDEX_OF, LAST_INDEX_OF } from \"../internal/constants\";\r\nimport { _unwrapFunction } from \"../internal/unwrapFunction\";\r\n/**\r\n * The arrIndexOf() method returns the first index at which a given element can be found in the array,\r\n * or -1 if it is not present.\r\n * `arrIndexOf()` compares searchElement to elements of the Array using strict equality (the same\r\n * method used by the === or triple-equals operator).\r\n * @group Array\r\n * @group ArrayLike\r\n * @typeParam T - Identifies the type of array elements\r\n * @param theArray - The array or array like object of elements to be searched.\r\n * @param searchElement - The element to locate in the array.\r\n * @param fromIndex - The index to start the search at. If the index is greater than or equal to\r\n * the array's length, -1 is returned, which means the array will not be searched. If the provided\r\n * index value is a negative number, it is taken as the offset from the end of the array.\r\n * Note: if the provided index is negative, the array is still searched from front to back. If the\r\n * provided index is 0, then the whole array will be searched. Default: 0 (entire array is searched).\r\n * @return The first index of the element in the array; -1 if not found.\r\n * @example\r\n * ```ts\r\n * const array = [2, 9, 9];\r\n * arrIndexOf(array, 2); // 0\r\n * arrIndexOf(array, 7); // -1\r\n * arrIndexOf(array, 9, 2); // 2\r\n * arrIndexOf(array, 2, -1); // -1\r\n * arrIndexOf(array, 2, -3); // 0\r\n *\r\n * let indices: number[] = [];\r\n * const array = ['a', 'b', 'a', 'c', 'a', 'd'];\r\n * const element = 'a';\r\n * let idx = arrIndexOf(array, element);\r\n * while (idx !== -1) {\r\n * indices.push(idx);\r\n * idx = arrIndexOf(array, element, idx + 1);\r\n * }\r\n * console.log(indices);\r\n * // [0, 2, 4]\r\n *\r\n * function updateVegetablesCollection (veggies, veggie) {\r\n * if (arrIndexOf(veggies, veggie) === -1) {\r\n * veggies.push(veggie);\r\n * console.log('New veggies collection is : ' + veggies);\r\n * } else {\r\n * console.log(veggie + ' already exists in the veggies collection.');\r\n * }\r\n * }\r\n *\r\n * let veggies = ['potato', 'tomato', 'chillies', 'green-pepper'];\r\n *\r\n * updateVegetablesCollection(veggies, 'spinach');\r\n * // New veggies collection is : potato,tomato,chillies,green-pepper,spinach\r\n * updateVegetablesCollection(veggies, 'spinach');\r\n * // spinach already exists in the veggies collection.\r\n *\r\n * // Array Like\r\n * let arrayLike = {\r\n * length: 3,\r\n * 0: \"potato\",\r\n * 1: \"tomato\",\r\n * 2: \"chillies\",\r\n * 3: \"green-pepper\" // Not checked as index is > length\r\n * };\r\n *\r\n * arrIndexOf(arrayLike, \"potato\"); // 0\r\n * arrIndexOf(arrayLike, \"tomato\"); // 1\r\n * arrIndexOf(arrayLike, \"chillies\"); 2\r\n * arrIndexOf(arrayLike, \"green-pepper\"); // -1\r\n * ```\r\n */\r\nexport var arrIndexOf = _unwrapFunction(INDEX_OF, ArrProto);\r\n/**\r\n * The arrLastIndexOf() method returns the last index at which a given element can be found in the array,\r\n * or -1 if it is not present.\r\n * `arrLastIndexOf()` compares searchElement to elements of the Array using strict equality (the same\r\n * method used by the === or triple-equals operator). [NaN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)\r\n * values are never compared as equal, so arrLastIndexOf() always returns -1 when searchElement is NaN.\r\n *\r\n * The arrLastIndexOf() method skips empty slots in sparse arrays.\r\n *\r\n * The arrLastIndexOf() method is generic. It only expects the this value to have a length property and integer-keyed properties.\r\n *\r\n * @since 0.8.0\r\n * @group Array\r\n * @group ArrayLike\r\n * @typeParam T - Identifies the type of array elements\r\n * @param theArray - The array or array like object of elements to be searched.\r\n * @param searchElement - The element to locate in the array.\r\n * @param fromIndex - Zero-based index at which to start searching backwards, converted to an integer.\r\n * - Negative index counts back from the end of the array — if fromIndex < 0, fromIndex + array.length is used.\r\n * - If fromIndex < -array.length, the array is not searched and -1 is returned. You can think of it conceptually\r\n * as starting at a nonexistent position before the beginning of the array and going backwards from there. There\r\n * are no array elements on the way, so searchElement is never found.\r\n * - If fromIndex >= array.length or fromIndex is omitted, array.length - 1 is used, causing the entire array to\r\n * be searched. You can think of it conceptually as starting at a nonexistent position beyond the end of the array and going backwards from there. It eventually reaches the real end position of the array, at which point it starts searching backwards through the actual array elements.\r\n * @return The first index of the element in the array; -1 if not found.\r\n * @example\r\n * ```ts\r\n * const numbers = [2, 5, 9, 2];\r\n * arrLastIndexOf(numbers, 2); // 3\r\n * arrLastIndexOf(numbers, 7); // -1\r\n * arrLastIndexOf(numbers, 2, 3); // 3\r\n * arrLastIndexOf(numbers, 2, 2); // 0\r\n * arrLastIndexOf(numbers, 2, -2); // 0\r\n * arrLastIndexOf(numbers, 2, -1); // 3\r\n *\r\n * let indices: number[] = [];\r\n * const array = [\"a\", \"b\", \"a\", \"c\", \"a\", \"d\"];\r\n * const element = \"a\";\r\n * let idx = arrLastIndexOf(array, element);\r\n * while (idx !== -1) {\r\n * indices.push(idx);\r\n * idx = arrLastIndexOf(array, element, idx ? idx - 1 : -(array.length + 1));\r\n * }\r\n * console.log(indices);\r\n * // [4, 2, 0]\r\n *\r\n * function updateVegetablesCollection (veggies, veggie) {\r\n * if (arrLastIndexOf(veggies, veggie) === -1) {\r\n * veggies.push(veggie);\r\n * console.log('New veggies collection is : ' + veggies);\r\n * } else {\r\n * console.log(veggie + ' already exists in the veggies collection.');\r\n * }\r\n * }\r\n *\r\n * let veggies = ['potato', 'tomato', 'chillies', 'green-pepper'];\r\n *\r\n * updateVegetablesCollection(veggies, 'spinach');\r\n * // New veggies collection is : potato,tomato,chillies,green-pepper,spinach\r\n * updateVegetablesCollection(veggies, 'spinach');\r\n * // spinach already exists in the veggies collection.\r\n *\r\n * // Array Like\r\n * let arrayLike = {\r\n * length: 3,\r\n * 0: \"potato\",\r\n * 1: \"tomato\",\r\n * 2: \"chillies\",\r\n * 3: \"green-pepper\" // Not checked as index is > length\r\n * };\r\n *\r\n * arrLastIndexOf(arrayLike, \"potato\"); // 0\r\n * arrLastIndexOf(arrayLike, \"tomato\"); // 1\r\n * arrLastIndexOf(arrayLike, \"chillies\"); 2\r\n * arrLastIndexOf(arrayLike, \"green-pepper\"); // -1\r\n * ```\r\n */\r\nexport var arrLastIndexOf = _unwrapFunction(LAST_INDEX_OF, ArrProto);\r\n//# sourceMappingURL=indexOf.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { getLazy } from \"../helpers/lazy\";\r\nimport { ObjClass, __PROTO__ } from \"../internal/constants\";\r\nimport { objForEachKey } from \"./for_each_key\";\r\nvar _isProtoArray;\r\n/**\r\n * The objSetPrototypeOf() method sets the prototype (i.e., the internal [Prototype] property) of a specified\r\n * object to another object or null.\r\n * @group Object\r\n * @param obj - The object which is to have it's prototype set.\r\n * @param proto - The object's new prototype (an object or null)\r\n * @returns The specified object.\r\n */\r\nexport function objSetPrototypeOf(obj, proto) {\r\n var fn = ObjClass[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d, b) {\r\n !_isProtoArray && (_isProtoArray = getLazy(function () {\r\n var _a;\r\n return ((_a = {}, _a[__PROTO__] = [], _a) instanceof Array);\r\n }));\r\n _isProtoArray.v ? d[__PROTO__] = b : objForEachKey(b, function (key, value) { return d[key] = value; });\r\n };\r\n return fn(obj, proto);\r\n}\r\n//# sourceMappingURL=set_proto.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { ArrProto } from \"../internal/constants\";\r\nimport { _unwrapFunction } from \"../internal/unwrapFunction\";\r\n/**\r\n * The arrMap() method creates a new array populated with the results of calling a provided function on every\r\n * element in the calling array.\r\n *\r\n * `arrMap` calls a provided callbackFn function once for each element in an array, in order, and constructs\r\n * a new array from the results. callbackFn is invoked only for indexes of the array which have assigned\r\n * values (including undefined).\r\n *\r\n * It is not called for missing elements of the array; that is:\r\n * - indexes that have never been set;\r\n * - indexes which have been deleted.\r\n *\r\n * @since 0.3.3\r\n * @group Array\r\n * @group ArrayLike\r\n * @typeParam T - Identifies the type of the array elements\r\n * @typeParam R - Identifies the type of the elements returned by the callback function, defaults to T.\r\n * @param theArray - The array or array like object of elements to be searched.\r\n * @param callbackFn - The function that is called for evetn element of `theArray`.\r\n * @param thisArg - The value to use as the `this` when executing the `callbackFn`.\r\n * @example\r\n * ```ts\r\n * const numbers = [1, 4, 9];\r\n * const roots = arrMap(numbers, (num) => Math.sqrt(num));\r\n *\r\n * // roots is now [1, 2, 3]\r\n * // numbers is still [1, 4, 9]\r\n *\r\n * const kvArray = [{ key: 1, value: 10 },\r\n * { key: 2, value: 20 },\r\n * { key: 3, value: 30 }];\r\n *\r\n * const reformattedArray = arrMap(kvArray, ({ key, value}) => ({ [key]: value }));\r\n *\r\n * // reformattedArray is now [{1: 10}, {2: 20}, {3: 30}],\r\n *\r\n * // kvArray is still:\r\n * // [{key: 1, value: 10},\r\n * // {key: 2, value: 20},\r\n * // {key: 3, value: 30}]\r\n *\r\n * // Also supports Array Like objects with same output\r\n * const kvArray = {\r\n * length: 3,\r\n * 0: { key: 1, value: 10 },\r\n * 1: { key: 2, value: 20 },\r\n * 2: { key: 3, value: 30 }\r\n * };\r\n * ```\r\n */\r\nexport var arrMap = _unwrapFunction(\"map\", ArrProto);\r\n//# sourceMappingURL=map.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { ArrProto, SLICE } from \"../internal/constants\";\r\nimport { _unwrapFunction } from \"../internal/unwrapFunction\";\r\n/**\r\n * The arrSlice() method returns a shallow copy of a portion of an array into a new array object\r\n * selected from start to end (end not included) where start and end represent the index of items\r\n * in that array. The original array will not be modified.\r\n *\r\n * The `arrSlice()` method is a copying method. It does not alter this but instead returns a shallow\r\n * copy that contains some of the same elements as the ones from the original array.\r\n *\r\n * The `arrSlice()` method preserves empty slots. If the sliced portion is sparse, the returned arra\r\n * is sparse as well.\r\n *\r\n * The `arrSlice()` method is generic. It only expects the this value to have a length property and\r\n * integer-keyed properties.\r\n *\r\n * For both start and end, a negative index can be used to indicate an offset from the end of the array.\r\n * For example, -2 refers to the second to last element of the array.\r\n * @since 0.9.3\r\n * @group Array\r\n * @group ArrayLike\r\n * @param start Zero-based index at which to start extraction, converted to an integer.\r\n * - Negative index counts back from the end of the array — if start < 0, start + array.length is used.\r\n * - If start < -array.length or start is omitted, 0 is used.\r\n * - If start >= array.length, nothing is extracted.\r\n * @param end Zero-based index at which to end extraction, converted to an integer. slice() extracts\r\n * up to but not including end.\r\n * - Negative index counts back from the end of the array — if end < 0, end + array.length is used.\r\n * - If end < -array.length, 0 is used.\r\n * - If end >= array.length or end is omitted, array.length is used, causing all elements until the\r\n * end to be extracted.\r\n * - If end is positioned before or at start after normalization, nothing is extracted.\r\n * @example\r\n * ```ts\r\n * const lyrics = [\"Hello\", \"Darkness\", \"my\", \"old\", \"friend.\", \"I've\", \"come\", \"to\", \"talk\" ];\r\n *\r\n * arrSlice(lyrics); // [ \"Hello\", \"Darkness\", \"my\", \"old\", \"friend.\", \"I've\", \"come\", \"to\", \"talk\" ]\r\n * arrSlice(lyrics, 1, 3); // [ \"Darkness\", \"my\" ]\r\n * arrSlicw(lyrics, 2); // [ \"my\", \"old\", \"friend.\", \"I've\", \"come\", \"to\", \"talk\" ]\r\n * arrSlice(lyrics, 2, 4); // [ \"my\", \"old\" ]\r\n * arrSlice(lyrics, 1, 5); // [ \"Darkness\", \"my\", \"old\", \"friend.\" ]\r\n * arrSlice(lyrics, -2); // [ \"to\", \"talk\" ]\r\n * arrSlice(lyrics, 2, -1); // [ \"my\", \"old\", \"friend.\", \"I've\", \"come\", \"to\" ]\r\n * ```\r\n */\r\nexport var arrSlice = _unwrapFunction(SLICE, ArrProto);\r\n//# sourceMappingURL=slice.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2023 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { _unwrapInstFunction } from \"../internal/unwrapFunction\";\r\n/**\r\n * The `fnCall` function calls the function with the given `thisArg` as the `this` value and with\r\n * al of the `_args` provided as it's `arguments.\r\n *\r\n * > This is almost identical to `fnApply`, except that the function arguments are passed to `fnCall`\r\n * individually as a list, while with `fnApply` that are combined into a single array argument.\r\n *\r\n * Normally, when calling a function, the value of `this` inside the function is the object that the\r\n * function was accessed on. With `fnCall()`, you can pass an arbitrary value as the `this` when calling an\r\n * existing function, without first attaching the function to the object as a property. This allows you\r\n * to use methods of one object as generic utility functions.\r\n *\r\n * @since 0.9.8\r\n * @group Function\r\n *\r\n * @param fn - The function to be called\r\n * @param thisArg - The value of `this` provided for the call to `fn`. If the function is not in strict mode,\r\n * `null` and `undefined` will be replaced with the global object, and primitive values will be converted to objects.\r\n * @param _args - The zero or more arguments to be passed to the `fn` function.\r\n * @returns The result of calling the function with the specified `this` value and arguments.\r\n * @example\r\n * ```ts\r\n * // min / max number in an array\r\n * let max = fnCall(Math.max, null, 21, 42, 84, 168, 7, 3);\r\n * // 168\r\n *\r\n * let min = fnCall(Math.min, null, 21, 42, 84, 168, 7, 3);\r\n * // 3\r\n *\r\n * const module1 = {\r\n * prefix: \"Hello\",\r\n * x: 21,\r\n * getX() {\r\n * return this.x;\r\n * },\r\n * log(value: string) {\r\n * return this.prefix + \" \" + value + \" : \" + this.x\r\n * }\r\n * };\r\n *\r\n * // The 'this' parameter of 'getX' is bound to 'module'.\r\n * module1.getX(); // 21\r\n * module1.log(\"Darkness\"); // Hello Darkness : 21\r\n *\r\n * // Create a new function 'boundGetX' with the 'this' parameter bound to 'module'.\r\n * let module2 = {\r\n * prefix: \"my\",\r\n * x: 42\r\n * };\r\n *\r\n * // Call the function of module1 with module2 as it's this\r\n * fnCall(module1.getX, module2); // 42\r\n * fnCall(module1.log, module2, \"friend\"); // my friend : 42\r\n * ```\r\n */\r\nexport var fnCall = _unwrapInstFunction(\"call\");\r\n//# sourceMappingURL=fnCall.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { FUNCTION, ObjClass, OBJECT, PROTOTYPE } from \"../internal/constants\";\r\nimport { dumpObj } from \"../helpers/diagnostics\";\r\nvar _objCreate = ObjClass[\"create\"];\r\n/**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil\r\n * for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @group Object\r\n * @param obj Object to use as a prototype. May be null\r\n */\r\nexport var objCreate = _objCreate || polyObjCreate;\r\n/**\r\n * Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil\r\n * for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.\r\n * Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations\r\n * @group Polyfill\r\n * @group Object\r\n * @param obj Object to use as a prototype. May be null\r\n */\r\nexport function polyObjCreate(obj) {\r\n if (!obj) {\r\n return {};\r\n }\r\n var type = typeof obj;\r\n if (type !== OBJECT && type !== FUNCTION) {\r\n throw new TypeError(\"Prototype must be an Object or function: \" + dumpObj(obj));\r\n }\r\n function tempFunc() { }\r\n tempFunc[PROTOTYPE] = obj;\r\n return new tempFunc();\r\n}\r\n//# sourceMappingURL=create.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { arrSlice } from \"../array/slice\";\r\nimport { fnApply } from \"../funcs/fnApply\";\r\nimport { CONSTRUCTOR, NAME, NULL_VALUE, PROTOTYPE } from \"../internal/constants\";\r\nimport { objCreate } from \"../object/create\";\r\nimport { objDefine } from \"../object/define\";\r\nimport { objGetPrototypeOf } from \"../object/object\";\r\nimport { objSetPrototypeOf } from \"../object/set_proto\";\r\n/**\r\n * @internal\r\n * @ignore\r\n */\r\nvar _createCustomError = function (name, d, b) {\r\n _safeDefineName(d, name);\r\n d = objSetPrototypeOf(d, b);\r\n function __() {\r\n this.constructor = d;\r\n _safeDefineName(this, name);\r\n }\r\n d[PROTOTYPE] = b === NULL_VALUE ? objCreate(b) : (__[PROTOTYPE] = b[PROTOTYPE], new __());\r\n return d;\r\n};\r\nvar _safeSetName = function (baseClass, name) {\r\n try {\r\n name && (baseClass[NAME] = name);\r\n //name && (baseClass[PROTOTYPE][NAME] = name);\r\n }\r\n catch (e) {\r\n // Do nothing\r\n }\r\n};\r\nvar _safeDefineName = function (target, name) {\r\n try {\r\n objDefine(target, NAME, { v: name, c: true, e: false });\r\n }\r\n catch (e) {\r\n // Do nothing\r\n }\r\n};\r\n/**\r\n * Create a Custom Error class which may be used to throw custom errors.\r\n * @group Error\r\n * @param name - The name of the Custom Error\r\n * @param constructCb - [Optional] An optional callback function to call when a\r\n * new Customer Error instance is being created.\r\n * @param errorBase - [Optional] (since v0.9.6) The error class to extend for this class, defaults to Error.\r\n * @returns A new Error `class`\r\n * @example\r\n * ```ts\r\n * import { createCustomError, isError } from \"@nevware21/ts-utils\";\r\n *\r\n * // For an error that just contains a message\r\n * let myCustomErrorError = createCustomError(\"MessageError\");\r\n *\r\n * try {\r\n * throw new myCustomErrorError(\"Error Message!\");\r\n * } catch(e) {\r\n * // e.name === MessageError\r\n * // isError(e) === true;\r\n * // Object.prototype.toString.call(e) === \"[object Error]\";\r\n * }\r\n *\r\n * // Or a more complex error object\r\n * interface MyCriticalErrorConstructor extends CustomErrorConstructor {\r\n * new(message: string, file: string, line: number, col: number): MyCriticalError;\r\n * (message: string, file: string, line: number, col: number): MyCriticalError;\r\n * }\r\n *\r\n * interface MyCriticalError extends Error {\r\n * readonly errorId: number;\r\n * readonly args: any[]; // Holds all of the arguments passed during construction\r\n * }\r\n *\r\n * let _totalErrors = 0;\r\n * let myCustomError = createCustomError(\"CriticalError\", (self, args) => {\r\n * _totalErrors++;\r\n * self.errorId = _totalErrors;\r\n * self.args = args;\r\n * });\r\n *\r\n * try {\r\n * throw new myCustomError(\"Not Again!\");\r\n * } catch(e) {\r\n * // e.name === CriticalError\r\n * // isError(e) === true;\r\n * // Object.prototype.toString.call(e) === \"[object Error]\";\r\n * }\r\n *\r\n * // ----------------------------------------------------------\r\n * // Extending another custom error class\r\n * // ----------------------------------------------------------\r\n *\r\n * let AppError = createCustomError(\"ApplicationError\");\r\n * let theAppError = new appError();\r\n *\r\n * isError(theAppError); // true\r\n * theAppError instanceof Error; // true\r\n * theAppError instanceof AppError; // true\r\n *\r\n * let StartupError = createCustomError(\"StartupError\", null, AppError);\r\n * let theStartupError = new StartupError();\r\n *\r\n * isError(theStartupError); // true\r\n * theStartupError instanceof Error; // true\r\n * theStartupError instanceof AppError; // true\r\n * theStartupError instanceof StartupError; // true\r\n * ```\r\n */\r\nexport function createCustomError(name, constructCb, errorBase) {\r\n var theBaseClass = errorBase || Error;\r\n var orgName = theBaseClass[PROTOTYPE][NAME];\r\n var captureFn = Error.captureStackTrace;\r\n return _createCustomError(name, function () {\r\n var _this = this;\r\n try {\r\n _safeSetName(theBaseClass, name);\r\n var _self = fnApply(theBaseClass, _this, arrSlice(arguments)) || _this;\r\n if (_self !== _this) {\r\n // Looks like runtime error constructor reset the prototype chain, so restore it\r\n var orgProto = objGetPrototypeOf(_this);\r\n if (orgProto !== objGetPrototypeOf(_self)) {\r\n objSetPrototypeOf(_self, orgProto);\r\n }\r\n }\r\n // Make sure we only capture our stack details\r\n captureFn && captureFn(_self, _this[CONSTRUCTOR]);\r\n // Run the provided construction function\r\n constructCb && constructCb(_self, arguments);\r\n return _self;\r\n }\r\n finally {\r\n _safeSetName(theBaseClass, orgName);\r\n }\r\n }, theBaseClass);\r\n}\r\n/**\r\n * @internal\r\n * @ignore\r\n */\r\nvar _unsupportedError;\r\n/**\r\n * Throw a custom `UnsupportedError` Error instance with the given message.\r\n * @group Error\r\n * @param message - The message to include in the exception\r\n * @example\r\n * ```ts\r\n * import { throwUnsupported } from \"@nevware21/ts-utils\";\r\n *\r\n * if (!window) {\r\n * throwUnsupported(\"A window is needed for this operation\");\r\n * }\r\n * ```\r\n */\r\nexport function throwUnsupported(message) {\r\n if (!_unsupportedError) {\r\n // Lazily create the class\r\n _unsupportedError = createCustomError(\"UnsupportedError\");\r\n }\r\n throw new _unsupportedError(message);\r\n}\r\n//# sourceMappingURL=customError.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\n/**\r\n * Return the number of milliseconds that have elapsed since January 1, 1970 00:00:00 UTC.\r\n *\r\n * To offer protection against timing attacks and fingerprinting, the precision of dateNow()\r\n * might get rounded depending on browser settings. In Firefox, the privacy.reduceTimerPrecision\r\n * preference is enabled by default and defaults to 20µs in Firefox 59; in 60 it will be 2ms.\r\n *\r\n * @since 0.4.4\r\n * @group Timer\r\n *\r\n * @returns A Number representing the milliseconds elapsed since the UNIX epoch.\r\n * @example\r\n * ```ts\r\n * let now = utcNow();\r\n * ```\r\n */\r\nexport function utcNow() {\r\n return (Date.now || polyUtcNow)();\r\n}\r\n/**\r\n * Polyfill fallback to return the number of milliseconds that have elapsed since January 1, 1970 00:00:00 UTC.\r\n *\r\n * To offer protection against timing attacks and fingerprinting, the precision of dateNow()\r\n * might get rounded depending on browser settings. In Firefox, the privacy.reduceTimerPrecision\r\n * preference is enabled by default and defaults to 20µs in Firefox 59; in 60 it will be 2ms.\r\n *\r\n * @since 0.4.4\r\n * @group Timer\r\n * @group Polyfill\r\n *\r\n * @returns A Number representing the milliseconds elapsed since the UNIX epoch.\r\n * @example\r\n * ```ts\r\n * let now = polyUtcNow();\r\n * ```\r\n*/\r\nexport function polyUtcNow() {\r\n return new Date().getTime();\r\n}\r\n//# sourceMappingURL=date.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { isNullOrUndefined } from \"../helpers/base\";\r\nimport { dumpObj } from \"../helpers/diagnostics\";\r\nimport { throwTypeError } from \"../helpers/throw\";\r\nimport { EMPTY } from \"../internal/constants\";\r\nfunction _createTrimFn(exp) {\r\n return function _doTrim(value) {\r\n if (isNullOrUndefined(value)) {\r\n throwTypeError(\"strTrim called [\" + dumpObj(value) + \"]\");\r\n }\r\n if (value && value.replace) {\r\n value = value.replace(exp, EMPTY);\r\n }\r\n return value;\r\n };\r\n}\r\n/**\r\n * The trim() method removes whitespace from both ends of a string and returns a new string,\r\n * without modifying the original string. Whitespace in this context is all the whitespace\r\n * characters (space, tab, no-break space, etc.) and all the line terminator characters\r\n * (LF, CR, etc.).\r\n * @group Polyfill\r\n * @group String\r\n * @param value - The string value to be trimmed.\r\n * @returns A new string representing str stripped of whitespace from both its beginning and end.\r\n * If neither the beginning or end of str has any whitespace, a new string is still returned (essentially\r\n * a copy of str), with no exception being thrown.\r\n * To return a new string with whitespace trimmed from just one end, use `strTrimStart()` or `strTrimEnd()`.\r\n */\r\nexport var polyStrTrim = _createTrimFn(/^\\s+|(?=\\s)\\s+$/g);\r\n/**\r\n * The `polyStrTrimStart()` method removes whitespace from the beginning of a string.\r\n * @group Polyfill\r\n * @group String\r\n * @param value - The value to be trimmed.\r\n * @returns A new string representing str stripped of whitespace from its beginning (left side).\r\n * If the beginning of str has no whitespace, a new string is still returned (essentially a copy of str),\r\n * with no exception being thrown.\r\n */\r\nexport var polyStrTrimStart = _createTrimFn(/^\\s+/g);\r\n/**\r\n * The `polyStrTrimEnd()` method removes whitespace from the end of a string.\r\n * @group Polyfill\r\n * @group String\r\n * @param value - The value to be trimmed.\r\n * @returns A new string representing str stripped of whitespace from its end (right side).\r\n * If the end of str has no whitespace, a new string is still returned (essentially a copy of str),\r\n * with no exception being thrown.\r\n */\r\nexport var polyStrTrimEnd = _createTrimFn(/(?=\\s)\\s+$/g);\r\n//# sourceMappingURL=trim.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { fnCall } from \"../funcs/fnCall\";\r\nimport { getWindow, hasWindow } from \"../helpers/environment\";\r\nimport { CONSTRUCTOR, FUNCTION, ObjClass, OBJECT, PROTOTYPE } from \"../internal/constants\";\r\nimport { objHasOwnProperty } from \"./has_own_prop\";\r\nimport { objGetPrototypeOf } from \"./object\";\r\n// Use to cache the result of Object.cont\r\nvar _fnToString;\r\nvar _objCtrFnString;\r\nvar _gblWindow;\r\n/**\r\n * Checks to see if the past value is a plain object (not a class/array) value.\r\n * Object are considered to be \"plain\" if they are created with no prototype `Object.create(null)`\r\n * or by using the Object global (native) function, all other \"objects\" ar\r\n * @since 0.4.4\r\n * @group Type Identity\r\n * @group Object\r\n * @param value - The value to check\r\n * @returns true if `value` is a normal plain object\r\n * @example\r\n * ```ts\r\n * console.log(isPlainObject({ 0: 'a', 1: 'b', 2: 'c' })); // true\r\n * console.log(isPlainObject({ 100: 'a', 2: 'b', 7: 'c' })); // true\r\n * console.log(isPlainObject(objCreate(null))); // true\r\n *\r\n * const myObj = objCreate({}, {\r\n * getFoo: {\r\n * value() { return this.foo; }\r\n * }\r\n * });\r\n * myObj.foo = 1;\r\n * console.log(isPlainObject(myObj)); // true\r\n *\r\n * console.log(isPlainObject(['a', 'b', 'c'])); // false\r\n * console.log(isPlainObject(new Date())); // false\r\n * console.log(isPlainObject(new Error(\"An Error\"))); // false\r\n * console.log(isPlainObject(null)); // false\r\n * console.log(isPlainObject(undefined)); // false\r\n * console.log(isPlainObject(\"null\")); // false\r\n * console.log(isPlainObject(\"undefined\")); // false\r\n * console.log(isPlainObject(\"1\")); // false\r\n * console.log(isPlainObject(\"aa\")); // false\r\n * ```\r\n */\r\nexport function isPlainObject(value) {\r\n if (!value || typeof value !== OBJECT) {\r\n return false;\r\n }\r\n if (!_gblWindow) {\r\n // Lazily cache the current global window value and default it to \"true\" (so we bypass this check in the future)\r\n _gblWindow = hasWindow() ? getWindow() : true;\r\n }\r\n var result = false;\r\n if (value !== _gblWindow) {\r\n if (!_objCtrFnString) {\r\n // Lazily caching what the runtime reports as the object function constructor (as a string)\r\n // Using an current function lookup to find what this runtime calls a \"native\" function\r\n _fnToString = Function[PROTOTYPE].toString;\r\n _objCtrFnString = fnCall(_fnToString, ObjClass);\r\n }\r\n try {\r\n var proto = objGetPrototypeOf(value);\r\n // No prototype so looks like an object created with Object.create(null)\r\n result = !proto;\r\n if (!result) {\r\n if (objHasOwnProperty(proto, CONSTRUCTOR)) {\r\n proto = proto[CONSTRUCTOR];\r\n }\r\n result = proto && typeof proto === FUNCTION && _fnToString.call(proto) === _objCtrFnString;\r\n }\r\n }\r\n catch (ex) {\r\n // Something went wrong, so it's not an object we are playing with\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=is_plain_object.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { StrProto } from \"../internal/constants\";\r\nimport { _unwrapFunctionWithPoly } from \"../internal/unwrapFunction\";\r\nimport { polyStrTrim, polyStrTrimEnd, polyStrTrimStart } from \"../polyfills/trim\";\r\n/**\r\n * The trim() method removes whitespace from both ends of a string and returns a new string,\r\n * without modifying the original string. Whitespace in this context is all the whitespace\r\n * characters (space, tab, no-break space, etc.) and all the line terminator characters\r\n * (LF, CR, etc.).\r\n * @group String\r\n * @param value - The string value to be trimmed.\r\n * @returns A new string representing str stripped of whitespace from both its beginning and end.\r\n * If neither the beginning or end of str has any whitespace, a new string is still returned (essentially\r\n * a copy of str), with no exception being thrown.\r\n * To return a new string with whitespace trimmed from just one end, use `strTrimStart()` or `strTrimEnd()`.\r\n */\r\nexport var strTrim = _unwrapFunctionWithPoly(\"trim\", StrProto, polyStrTrim);\r\n/**\r\n * The `strTrimStart()` method removes whitespace from the beginning of a string.\r\n * @group String\r\n * @param value - The value to be trimmed.\r\n * @returns A new string representing str stripped of whitespace from its beginning (left side).\r\n * If the beginning of str has no whitespace, a new string is still returned (essentially a copy of str),\r\n * with no exception being thrown.\r\n */\r\nexport var strTrimStart = _unwrapFunctionWithPoly(\"trimStart\", StrProto, polyStrTrimStart);\r\n/**\r\n * Alias for `strTrimStart()` method removes whitespace from the beginning of a string.\r\n * @group String\r\n * @param value - The value to be trimmed.\r\n * @returns A new string representing str stripped of whitespace from its beginning (left side).\r\n * If the beginning of str has no whitespace, a new string is still returned (essentially a copy of str),\r\n * with no exception being thrown.\r\n */\r\nexport var strTrimLeft = strTrimStart;\r\n/**\r\n * The `strTrimEnd()` method removes whitespace from the end of a string.\r\n * @group String\r\n * @param value - The value to be trimmed.\r\n * @returns A new string representing str stripped of whitespace from its end (right side).\r\n * If the end of str has no whitespace, a new string is still returned (essentially a copy of str),\r\n * with no exception being thrown.\r\n */\r\nexport var strTrimEnd = _unwrapFunctionWithPoly(\"trimEnd\", StrProto, polyStrTrimEnd);\r\n/**\r\n * Alias for `strTrimEnd()` method removes whitespace from the end of a string.\r\n * @group String\r\n * @param value - The value to be trimmed.\r\n * @returns A new string representing str stripped of whitespace from its end (right side).\r\n * If the end of str has no whitespace, a new string is still returned (essentially a copy of str),\r\n * with no exception being thrown.\r\n */\r\nexport var strTrimRight = strTrimEnd;\r\n//# sourceMappingURL=trim.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { arrForEach } from \"../array/forEach\";\r\nimport { fnCall } from \"../funcs/fnCall\";\r\nimport { isArray, isDate, isNullOrUndefined, isPrimitiveType } from \"../helpers/base\";\r\nimport { FUNCTION, NULL_VALUE, OBJECT } from \"../internal/constants\";\r\nimport { objDefine } from \"./define\";\r\nimport { isPlainObject } from \"./is_plain_object\";\r\n/**\r\n * @internal\r\n * @ignore\r\n * Generic Object deep copy handler which creates a new plain object and copies enumerable properties from\r\n * the source to the new target plain object. The source object does not have to be a plain object.\r\n * @param details - The details object for the current property being copied\r\n * @returns true if the handler processed the field.\r\n */\r\nvar _defaultDeepCopyHandler = function (details) {\r\n // Make sure we at least copy plain objects\r\n details.value && plainObjDeepCopyHandler(details);\r\n // Always return true so that the iteration completes\r\n return true;\r\n};\r\n/**\r\n * @internal\r\n * @ignore\r\n * The ordered default deep copy handlers\r\n */\r\nvar defaultDeepCopyHandlers = [\r\n arrayDeepCopyHandler,\r\n plainObjDeepCopyHandler,\r\n functionDeepCopyHandler,\r\n dateDeepCopyHandler\r\n];\r\n/**\r\n * @internal\r\n * @ignore\r\n * Helper function used for detecting and handling recursive properties\r\n * @param visitMap - The current map of objects that have been visited\r\n * @param source - The value (object) to be copied\r\n * @param newPath - The new access path from the origin to the current property\r\n * @param cb - The callback function to call if the current object has not already been processed.\r\n * @returns The new deep copied property, may be incomplete as the object is recursive and is still in the process of being copied\r\n */\r\nfunction _getSetVisited(visitMap, source, newPath, cb) {\r\n var theEntry;\r\n arrForEach(visitMap, function (entry) {\r\n if (entry.k === source) {\r\n theEntry = entry;\r\n return -1;\r\n }\r\n });\r\n if (!theEntry) {\r\n // Add the target to the visit map so that deep nested objects refer to the single instance\r\n // Even if we have not finished processing it yet.\r\n theEntry = { k: source, v: source };\r\n visitMap.push(theEntry);\r\n // Now call the copy callback so that it populates the target\r\n cb(theEntry);\r\n }\r\n return theEntry.v;\r\n}\r\n/**\r\n * @internal\r\n * @ignore\r\n * Internal helper which performs the recursive deep copy\r\n * @param visitMap - The current map of objects that have been visited\r\n * @param value - The value being copied\r\n * @param ctx - The current copy context\r\n * @param key - [Optional] the current `key` for the value from the source object\r\n * @returns The new deep copied instance of the value.\r\n */\r\nfunction _deepCopy(visitMap, value, ctx, key) {\r\n var userHandler = ctx.handler;\r\n var newPath = ctx.path ? (key ? ctx.path.concat(key) : ctx.path) : [];\r\n var newCtx = {\r\n handler: ctx.handler,\r\n src: ctx.src,\r\n path: newPath\r\n };\r\n var theType = typeof value;\r\n var isPlain = false;\r\n var isPrim = false;\r\n if (value && theType === OBJECT) {\r\n isPlain = isPlainObject(value);\r\n }\r\n else {\r\n isPrim = value === NULL_VALUE || isPrimitiveType(theType);\r\n }\r\n var details = {\r\n type: theType,\r\n isPrim: isPrim,\r\n isPlain: isPlain,\r\n value: value,\r\n result: value,\r\n path: newPath,\r\n origin: ctx.src,\r\n copy: function (source, newKey) {\r\n return _deepCopy(visitMap, source, newKey ? newCtx : ctx, newKey);\r\n },\r\n copyTo: function (target, source) {\r\n return _copyProps(visitMap, target, source, newCtx);\r\n }\r\n };\r\n if (!details.isPrim) {\r\n return _getSetVisited(visitMap, value, newPath, function (newEntry) {\r\n // Use an accessor to set the new value onto the new entry\r\n objDefine(details, \"result\", {\r\n g: function () {\r\n return newEntry.v;\r\n },\r\n s: function (newValue) {\r\n newEntry.v = newValue;\r\n }\r\n });\r\n var idx = 0;\r\n var handler = userHandler;\r\n while (!fnCall(handler || (idx < defaultDeepCopyHandlers.length ? defaultDeepCopyHandlers[idx++] : _defaultDeepCopyHandler), ctx, details)) {\r\n handler = NULL_VALUE;\r\n }\r\n });\r\n }\r\n // Allow the user handler to override the provided value\r\n if (userHandler && fnCall(userHandler, ctx, details)) {\r\n return details.result;\r\n }\r\n return value;\r\n}\r\n/**\r\n * @internal\r\n * @ignore\r\n * Internal helper to copy all of the enumerable properties from the source object to the new target object\r\n * @param visitMap - The current map of objects that have been visited\r\n * @param target - The target object to copy the properties to.\r\n * @param source - The source object to copy the properties from.\r\n * @param ctx - The current deep copy context\r\n * @returns The populated target object\r\n */\r\nfunction _copyProps(visitMap, target, source, ctx) {\r\n if (!isNullOrUndefined(source)) {\r\n // Copy all properties (not just own properties)\r\n for (var key in source) {\r\n // Perform a deep copy of the object\r\n target[key] = _deepCopy(visitMap, source[key], ctx, key);\r\n }\r\n }\r\n return target;\r\n}\r\n/**\r\n * Object helper to copy all of the enumerable properties from the source object to the target, the\r\n * properties are copied via {@link objDeepCopy}. Automatic handling of recursive properties was added in v0.4.4\r\n * @group Object\r\n * @param target - The target object to populated\r\n * @param source - The source object to copy the properties from\r\n * @param handler - An optional callback that lets you provide / overide the deep cloning (Since 0.4.4)\r\n * @returns The target object\r\n * @example\r\n * ```ts\r\n * let a: any = { a: 1 };\r\n * let b: any = { b: 2, d: new Date(), e: new TestClass(\"Hello Darkness\") };\r\n * a.b = b; // { a: 1, b: { b: 2} }\r\n * b.a = a; // { a: 1, b: { b: 2, a: { a: 1, { b: 2, a: ... }}}}\r\n *\r\n * function copyHandler(details: IObjDeepCopyHandlerDetails) {\r\n * // details.origin === a\r\n * // details.path[] is the path to the current value\r\n * if (details.value && isDate(details.value)) {\r\n * // So for the date path === [ \"b\", \"d\" ] which represents\r\n * // details.origin[\"b\"][\"d\"] === The Date\r\n *\r\n * // Create a clone the Date object and set as the \"newValue\"\r\n * details.value = new Date(details.value.getTime());\r\n *\r\n * // Return true to indicate that we have \"handled\" the conversion\r\n * // See objDeepCopy example for just reusing the original value (just don't replace details.value)\r\n * return true;\r\n * }\r\n *\r\n * return false;\r\n * }\r\n *\r\n * let c: any = objCopyProps({}, a, copyHandler);\r\n *\r\n * assert.notEqual(a, c, \"check a and c are not the same\");\r\n * assert.ok(c !== c.b.a, \"The root object won't be the same for the target reference as are are copying properties to our target\");\r\n * assert.ok(c.b === c.b.a.b, \"Check that the 2 'b' references are the same object\");\r\n * assert.ok(c.b.a === c.b.a.b.a, \"Check that the 2 'a' references are the same object\");\r\n * assert.ok(c.b.d === c.b.a.b.d, \"Check that the 2 'd' references are the same object\");\r\n * assert.ok(isDate(c.b.d), \"The copied date is still real 'Date' instance\");\r\n * assert.notEqual(c.b.d, a.b.d, \"And the copied date is not the same as the original\");\r\n * assert.equal(c.b.d.getTime(), a.b.d.getTime(), \"But the dates are the same\");\r\n *\r\n * assert.ok(isObject(c.b.d), \"The copied date is now an object\");\r\n * ```\r\n */\r\nexport function objCopyProps(target, source, handler) {\r\n var ctx = {\r\n handler: handler,\r\n src: source,\r\n path: []\r\n };\r\n return _copyProps([], target, source, ctx);\r\n}\r\n/**\r\n * Performs a deep copy of the source object, this is designed to work with base (plain) objects, arrays and primitives\r\n * if the source object contains class objects they will either be not cloned or may be considered non-operational after\r\n * performing a deep copy. ie. This is performing a deep copy of the objects properties so that altering the copy will\r\n * not mutate the source object hierarchy.\r\n * Automatic handling of recursive properties was added in v0.4.4.\r\n * @group Object\r\n * @group Object - Deep Copy\r\n * @param source - The source object to be copied\r\n * @param handler - An optional callback that lets you provide / overide the deep cloning (Since 0.4.4)\r\n * @return A new object which contains a deep copy of the source properties\r\n * @example\r\n * ```ts\r\n * let a: any = { a: 1 };\r\n * let b: any = { b: 2, d: new Date(), e: new TestClass(\"Hello Darkness\") };\r\n * a.b = b; // { a: 1, b: { b: 2} }\r\n * b.a = a; // { a: 1, b: { b: 2, a: { a: 1, { b: 2, a: ... }}}}\r\n *\r\n * function copyHandler(details: IObjDeepCopyHandlerDetails) {\r\n * // details.origin === a\r\n * // details.path[] is the path to the current value\r\n * if (details.value && isDate(details.value)) {\r\n * // So for the date path === [ \"b\", \"d\" ] which represents\r\n * // details.origin[\"b\"][\"d\"] === The Date\r\n *\r\n * // Return true to indicate that we have \"handled\" the conversion\r\n * // Which in this case will reuse the existing instance (as we didn't replace details.value)\r\n * // See objCopyProps example for replacing the Date instance\r\n * return true;\r\n * }\r\n *\r\n * return false;\r\n * }\r\n *\r\n * let c: any = objDeepCopy(a, copyHandler);\r\n *\r\n * assert.notEqual(a, c, \"check a and c are not the same\");\r\n * assert.ok(c === c.b.a, \"The root object won't be the same for the target reference\");\r\n * assert.ok(c.b === c.b.a.b, \"Check that the 2 'b' references are the same object\");\r\n * assert.ok(c.b.a === c.b.a.b.a, \"Check that the 2 'a' references are the same object\");\r\n * assert.ok(c.b.d === c.b.a.b.d, \"Check that the 2 'd' references are the same object\");\r\n * assert.ok(isDate(c.b.d), \"The copied date is still real 'Date' instance\");\r\n * assert.equal(c.b.d, a.b.d, \"And the copied date is the original date\");\r\n * assert.equal(c.b.d.getTime(), a.b.d.getTime(), \"But the dates are the same\");\r\n * assert.ok(isObject(c.b.d), \"The copied date is now an object\");\r\n * assert.ok(!isError(c.b.e), \"The copied error is no longer a real 'Error' instance\");\r\n * assert.ok(isObject(c.b.e), \"The copied error is now an object\");\r\n * assert.equal(42, c.b.e.value, \"Expect that the local property was copied\");\r\n * ```\r\n */\r\nexport function objDeepCopy(source, handler) {\r\n var ctx = {\r\n handler: handler,\r\n src: source\r\n };\r\n return _deepCopy([], source, ctx);\r\n}\r\n/**\r\n * Deep copy handler to identify and copy arrays.\r\n * @since 0.4.4\r\n * @group Object - Deep Copy\r\n * @param details - The details object for the current property being copied\r\n * @returns `true` if the current value is a function otherwise `false`\r\n */\r\nexport function arrayDeepCopyHandler(details) {\r\n var value = details.value;\r\n if (isArray(value)) {\r\n // Assign the \"result\" value before performing any additional deep Copying, so any recursive object get a reference to this instance\r\n var target = details.result = [];\r\n target.length = value.length;\r\n // Copying all properties as arrays can contain non-indexed based properties\r\n details.copyTo(target, value);\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Deep copy handler to identify and copy Date instances.\r\n * @since 0.4.4\r\n * @group Object - Deep Copy\r\n * @param details - The details object for the current property being copied\r\n * @returns `true` if the current value is a function otherwise `false`\r\n */\r\nexport function dateDeepCopyHandler(details) {\r\n var value = details.value;\r\n if (isDate(value)) {\r\n details.result = new Date(value.getTime());\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Deep copy handler to identify and copy functions. This handler just returns the original\r\n * function so the original function will be assigned to any new deep copied instance.\r\n * @since 0.4.4\r\n * @group Object - Deep Copy\r\n * @param details - The details object for the current property being copied\r\n * @returns `true` if the current value is a function otherwise `false`\r\n */\r\nexport function functionDeepCopyHandler(details) {\r\n if (details.type === FUNCTION) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Deep copy handler to identify and copy plain objects.\r\n * @since 0.4.4\r\n * @group Object - Deep Copy\r\n * @param details - The details object for the current property being copied\r\n * @returns `true` if the current value is a function otherwise `false`\r\n */\r\nexport function plainObjDeepCopyHandler(details) {\r\n var value = details.value;\r\n if (value && details.isPlain) {\r\n // Assign the \"result\" value before performing any additional deep Copying, so any recursive object get a reference to this instance\r\n var target = details.result = {};\r\n details.copyTo(target, value);\r\n return true;\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=copy.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { arrForEach } from \"../array/forEach\";\r\nimport { arrSlice } from \"../array/slice\";\r\nimport { objCopyProps, objDeepCopy } from \"../object/copy\";\r\n/**\r\n * @internal\r\n * @ignore\r\n */\r\nfunction _doExtend(target, theArgs) {\r\n arrForEach(theArgs, function (theArg) {\r\n objCopyProps(target, theArg);\r\n });\r\n return target;\r\n}\r\nexport function deepExtend(target, obj1, obj2, obj3, obj4, obj5, obj6) {\r\n return _doExtend(objDeepCopy(target) || {}, arrSlice(arguments));\r\n}\r\nexport function objExtend(target, obj1, obj2, obj3, obj4, obj5, obj6) {\r\n return _doExtend(target || {}, arrSlice(arguments));\r\n}\r\n//# sourceMappingURL=extend.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { LENGTH } from \"../internal/constants\";\r\nimport { _unwrapProp } from \"../internal/unwrapFunction\";\r\n/**\r\n * Helper to return the length value of an object, this will return the value\r\n * of the \"length\" property. Generally used to return the length of a string or array.\r\n *\r\n * @since 0.4.2\r\n * @group Array\r\n * @group String\r\n * @group String\r\n * @group Array\r\n * @group Object\r\n * @param value - The value to return the length property from, must contain a `length` property\r\n * @example\r\n * ```ts\r\n * getLength(\"\"); // returns 0\r\n * getLength(\"Hello World\"); // returns 11\r\n * getLength([]); // returns 0;\r\n * getLength([0, 1, 2, 3]); // returns 4;\r\n * getLength({ length: 42}); // returns 42\r\n * getLength({ length: () => 53; }); // returns the function that if called would return 53\r\n * ```\r\n */\r\nexport var getLength = _unwrapProp(LENGTH);\r\n//# sourceMappingURL=length.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { utcNow } from \"./date\";\r\nimport { lazySafeGetInst } from \"./environment\";\r\nimport { _globalLazyTestHooks } from \"./lazy\";\r\nvar _perf;\r\n/**\r\n * Identify whether the runtimne contains a `performance` object\r\n *\r\n * @since 0.4.4\r\n * @group Environment\r\n * @returns\r\n */\r\nexport function hasPerformance() {\r\n return !!getPerformance();\r\n}\r\n/**\r\n * Returns the global `performance` Object if available, which can be used to\r\n * gather performance information about the current document. It serves as the\r\n * point of exposure for the Performance Timeline API, the High Resolution Time\r\n * API, the Navigation Timing API, the User Timing API, and the Resource Timing API.\r\n *\r\n * @since 0.4.4\r\n * @group Environment\r\n * @returns The global performance object if available.\r\n */\r\nexport function getPerformance() {\r\n (!_perf || (!_perf.b && _globalLazyTestHooks && _globalLazyTestHooks.lzy)) && (_perf = lazySafeGetInst(\"performance\"));\r\n return _perf.v;\r\n}\r\n/**\r\n * Returns the number of milliseconds that has elapsed since the time origin, if\r\n * the runtime does not support the `performance` API it will fallback to return\r\n * the number of milliseconds since the unix epoch.\r\n *\r\n * @since 0.4.4\r\n * @group Timer\r\n *\r\n * @returns The number of milliseconds as a `DOMHighResTimeStamp` double value or\r\n * an integer depending on the runtime.\r\n * @example\r\n * ```ts\r\n * let now = perfNow();\r\n * ```\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 utcNow();\r\n}\r\n/**\r\n * Return the number of milliseconds that have elapsed since the provided `startTime`\r\n * the `startTime` MUST be obtained from {@link perfNow} to ensure the correct elapsed\r\n * value is returned.\r\n *\r\n * @since 0.4.4\r\n * @group Timer\r\n *\r\n * @param startTime - The startTime obtained from `perfNow`\r\n * @returns The number of milliseconds that have elapsed since the startTime.\r\n * @example\r\n * ```ts\r\n * let start = perfNow();\r\n * // Do some work\r\n * let totalTime = elapsedTime(start);\r\n * ```\r\n */\r\nexport function elapsedTime(startTime) {\r\n return perfNow() - startTime;\r\n}\r\n//# sourceMappingURL=perf.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { isString, isUndefined } from \"../helpers/base\";\r\nimport { dumpObj } from \"../helpers/diagnostics\";\r\nimport { throwTypeError } from \"../helpers/throw\";\r\nimport { LENGTH, StrProto } from \"../internal/constants\";\r\nimport { _unwrapFunctionWithPoly } from \"../internal/unwrapFunction\";\r\nimport { asString } from \"./as_string\";\r\nimport { strSubstring } from \"./substring\";\r\n/**\r\n * This method lets you determine whether or not a string ends with another string. This method is case-sensitive.\r\n * @group String\r\n * @param value - The value to be checked\r\n * @param searchString - The characters to be searched for at the end of `value` string.\r\n * @param length - If provided, it is used as the length of `value`. Defaults to value.length.\r\n */\r\nexport var strEndsWith = _unwrapFunctionWithPoly(\"endsWith\", StrProto, polyStrEndsWith);\r\n/**\r\n * This method lets you determine whether or not a string ends with another string. This method is case-sensitive.\r\n * @group Polyfill\r\n * @group String\r\n * @param value - The value to be checked\r\n * @param searchString - The characters to be searched for at the end of `value` string.\r\n * @param length - If provided, it is used as the length of `value`. Defaults to value.length.\r\n */\r\nexport function polyStrEndsWith(value, searchString, length) {\r\n if (!isString(value)) {\r\n throwTypeError(\"'\" + dumpObj(value) + \"' is not a string\");\r\n }\r\n var searchValue = isString(searchString) ? searchString : asString(searchString);\r\n var chkLen = searchValue[LENGTH];\r\n var len = value[LENGTH];\r\n var end = !isUndefined(length) && length < len ? length : len;\r\n return strSubstring(value, end - chkLen, end) === searchValue;\r\n}\r\n//# sourceMappingURL=ends_with.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { INDEX_OF, LAST_INDEX_OF, StrProto } from \"../internal/constants\";\r\nimport { _unwrapFunction } from \"../internal/unwrapFunction\";\r\n/**\r\n * The `strIndexOf()` method, given two arguments: the string and a substring to search for, searches\r\n * the entire calling string, and returns the index of the first occurrence of the specified substring.\r\n * Given a thrid argument: a number, the method returns the first occurrence of the specified substring\r\n * at an index greater than or equal to the specified number.\r\n * @group String\r\n * @param value - The value to be checked for the seeach string\r\n * @param searchString - The substring to search for in the value\r\n * @param position - The starting position to search from\r\n * @example\r\n * ```ts\r\n * strIndexOf('hello world', '') // returns 0\r\n * strIndexOf('hello world', '', 0) // returns 0\r\n * strIndexOf('hello world', '', 3) // returns 3\r\n * strIndexOf('hello world', '', 8) // returns 8\r\n *\r\n * // However, if the thrid argument is greater than the length of the string\r\n * strIndexOf('hello world', '', 11) // returns 11\r\n * strIndexOf('hello world', '', 13) // returns 11\r\n * strIndexOf('hello world', '', 22) // returns 11\r\n *\r\n * strIndexOf('Blue Whale', 'Blue') // returns 0\r\n * strIndexOf('Blue Whale', 'Blute') // returns -1\r\n * strIndexOf('Blue Whale', 'Whale', 0) // returns 5\r\n * strIndexOf('Blue Whale', 'Whale', 5) // returns 5\r\n * strIndexOf('Blue Whale', 'Whale', 7) // returns -1\r\n * strIndexOf('Blue Whale', '') // returns 0\r\n * strIndexOf('Blue Whale', '', 9) // returns 9\r\n * strIndexOf('Blue Whale', '', 10) // returns 10\r\n * strIndexOf('Blue Whale', '', 11) // returns 10\r\n * ```\r\n */\r\nexport var strIndexOf = _unwrapFunction(INDEX_OF, StrProto);\r\n/**\r\n * The `strLastIndexOf()` method, given two arguments: the string and a substring to search for, searches\r\n * the entire calling string, and returns the index of the last occurrence of the specified substring.\r\n * Given a third argument: a number, the method returns the last occurrence of the specified substring\r\n * at an index less than or equal to the specified number.\r\n * @group String\r\n * @param value - The value to be checked for the seeach string\r\n * @param searchString - The substring to search for in the value\r\n * @param position - The starting position to search from\r\n * @example\r\n * ```ts\r\n * strLastIndexOf('canal', 'a'); // returns 3\r\n * strLastIndexOf('canal', 'a', 2); // returns 1\r\n * strLastIndexOf('canal', 'a', 0); // returns -1\r\n * strLastIndexOf('canal', 'x'); // returns -1\r\n * strLastIndexOf('canal', 'c', -5); // returns 0\r\n * strLastIndexOf('canal', 'c', 0); // returns 0\r\n * strLastIndexOf('canal', ''); // returns 5\r\n * strLastIndexOf('canal', '', 2); // returns 2\r\n * ```\r\n */\r\nexport var strLastIndexOf = _unwrapFunction(LAST_INDEX_OF, StrProto);\r\n//# sourceMappingURL=index_of.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { NULL_VALUE } from \"../internal/constants\";\r\nimport { objDefineProp } from \"../object/define\";\r\nvar REF = \"ref\";\r\nvar UNREF = \"un\" + REF;\r\nvar HAS_REF = \"hasRef\";\r\nvar ENABLED = \"enabled\";\r\n/**\r\n * @ignore\r\n * @internal\r\n * Internal function to create and manage an ITimerHandler implementation, the object returned from this function\r\n * it directly used / returned by the pulic functions used to create timers (idle, interval and timeout)\r\n * @param startTimer - Should the timer be started as part of creating the handler\r\n * @param refreshFn - The function used to create/start or refresh the timer\r\n * @param cancelFn - The function used to cancel the timer.\r\n * @returns The new ITimerHandler instance\r\n */\r\nexport function _createTimerHandler(startTimer, refreshFn, cancelFn) {\r\n var _a;\r\n var ref = true;\r\n var timerId = startTimer ? refreshFn(NULL_VALUE) : NULL_VALUE;\r\n var theTimerHandler;\r\n var _unref = function () {\r\n ref = false;\r\n timerId && timerId[UNREF] && timerId[UNREF]();\r\n return theTimerHandler;\r\n };\r\n var _ref = function () {\r\n ref = true;\r\n timerId && timerId[REF] && timerId[REF]();\r\n return theTimerHandler;\r\n };\r\n var _hasRef = function () {\r\n if (timerId && timerId[HAS_REF]) {\r\n return timerId[HAS_REF]();\r\n }\r\n return ref;\r\n };\r\n var _refresh = function () {\r\n timerId = refreshFn(timerId);\r\n if (!ref) {\r\n _unref();\r\n }\r\n return theTimerHandler;\r\n };\r\n var _cancel = function () {\r\n timerId && cancelFn(timerId);\r\n timerId = NULL_VALUE;\r\n };\r\n var _setEnabled = function (value) {\r\n !value && timerId && _cancel();\r\n value && !timerId && _refresh();\r\n };\r\n theTimerHandler = (_a = {\r\n cancel: _cancel,\r\n refresh: _refresh\r\n },\r\n _a[HAS_REF] = _hasRef,\r\n _a[REF] = _ref,\r\n _a[UNREF] = _unref,\r\n _a[ENABLED] = false,\r\n _a);\r\n objDefineProp(theTimerHandler, ENABLED, {\r\n get: function () { return !!timerId; },\r\n set: _setEnabled\r\n });\r\n return {\r\n h: theTimerHandler,\r\n dn: function () {\r\n timerId = NULL_VALUE;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=handler.js.map","/*\r\n * @nevware21/ts-utils\r\n * https://github.com/nevware21/ts-utils\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { arrSlice } from \"../array/slice\";\r\nimport { fnApply } from \"../funcs/fnApply\";\r\nimport { isArray } from \"../helpers/base\";\r\nimport { UNDEF_VALUE } from \"../internal/constants\";\r\nimport { _createTimerHandler } from \"./handler\";\r\nfunction _createTimeoutWith(self, startTimer, overrideFn, theArgs) {\r\n var isArr = isArray(overrideFn);\r\n var len = isArr ? overrideFn.length : 0;\r\n var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;\r\n var clearFn = (len > 1 ? overrideFn[1] : UNDEF_VALUE) || clearTimeout;\r\n var timerFn = theArgs[0];\r\n theArgs[0] = function () {\r\n handler.dn();\r\n fnApply(timerFn, self, arrSlice(arguments));\r\n };\r\n var handler = _createTimerHandler(startTimer, function (timerId) {\r\n if (timerId) {\r\n if (timerId.refresh) {\r\n timerId.refresh();\r\n return timerId;\r\n }\r\n fnApply(clearFn, self, [timerId]);\r\n }\r\n return fnApply(setFn, self, theArgs);\r\n }, function (timerId) {\r\n fnApply(clearFn, self, [timerId]);\r\n });\r\n return handler.h;\r\n}\r\nexport function scheduleTimeout(callback, timeout) {\r\n return _createTimeoutWith(this, true, UNDEF_VALUE, arrSlice(arguments));\r\n}\r\nexport function scheduleTimeoutWith(overrideFn, callback, timeout) {\r\n return _createTimeoutWith(this, true, overrideFn, arrSlice(arguments, 1));\r\n}\r\nexport function createTimeout(callback, timeout) {\r\n return _createTimeoutWith(this, false, UNDEF_VALUE, arrSlice(arguments));\r\n}\r\nexport function createTimeoutWith(overrideFn, callback, timeout) {\r\n return _createTimeoutWith(this, false, overrideFn, arrSlice(arguments, 1));\r\n}\r\n//# sourceMappingURL=timeout.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { getGlobal, objAssign, objCreate, objDefineProp, objHasOwnProperty, throwTypeError } from \"@nevware21/ts-utils\";\r\nimport { ObjClass, ObjProto, strDefault, strShimFunction, strShimPrototype } from \"./Constants\";\r\n// Most of these functions have been directly shamelessly \"lifted\" from the https://github.com/@microsoft/tslib and\r\n// modified to be ES5 compatible and applying several minification and tree-shaking techniques so that Application Insights\r\n// can successfully use TypeScript \"importHelpers\" which imports tslib during compilation but it will use these at runtime\r\n// Which is also why all of the functions have not been included as Application Insights currently doesn't use or require\r\n// them.\r\nexport var SymbolObj = (getGlobal() || {})[\"Symbol\"];\r\nexport var ReflectObj = (getGlobal() || {})[\"Reflect\"];\r\nexport var __hasReflect = !!ReflectObj;\r\nvar strDecorate = \"decorate\";\r\nvar strMetadata = \"metadata\";\r\nvar strGetOwnPropertySymbols = \"getOwnPropertySymbols\";\r\nvar strIterator = \"iterator\";\r\nvar strHasOwnProperty = \"hasOwnProperty\";\r\nexport var __objAssignFnImpl = function (t) {\r\n // tslint:disable-next-line: ban-comma-operator\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) {\r\n if (ObjProto[strHasOwnProperty].call(s, p)) {\r\n t[p] = s[p];\r\n }\r\n }\r\n }\r\n return t;\r\n};\r\nexport var __assignFn = objAssign || __objAssignFnImpl;\r\n// tslint:disable-next-line: only-arrow-functions\r\nvar extendStaticsFn = function (d, b) {\r\n extendStaticsFn = ObjClass[\"setPrototypeOf\"] ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n ({ __proto__: [] } instanceof Array && function (d, b) {\r\n d.__proto__ = b;\r\n }) ||\r\n // tslint:disable-next-line: only-arrow-functions\r\n function (d, b) {\r\n for (var p in b) {\r\n if (b[strHasOwnProperty](p)) {\r\n d[p] = b[p];\r\n }\r\n }\r\n };\r\n return extendStaticsFn(d, b);\r\n};\r\nexport function __extendsFn(d, b) {\r\n if (typeof b !== strShimFunction && b !== null) {\r\n throwTypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n }\r\n extendStaticsFn(d, b);\r\n function __() {\r\n this.constructor = d;\r\n }\r\n // tslint:disable-next-line: ban-comma-operator\r\n d[strShimPrototype] = b === null ? objCreate(b) : (__[strShimPrototype] = b[strShimPrototype], new __());\r\n}\r\nexport function __restFn(s, e) {\r\n var t = {};\r\n for (var k in s) {\r\n if (objHasOwnProperty(s, k) && e.indexOf(k) < 0) {\r\n t[k] = s[k];\r\n }\r\n }\r\n if (s != null && typeof ObjClass[strGetOwnPropertySymbols] === strShimFunction) {\r\n for (var i = 0, p = ObjClass[strGetOwnPropertySymbols](s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && ObjProto[\"propertyIsEnumerable\"].call(s, p[i])) {\r\n t[p[i]] = s[p[i]];\r\n }\r\n }\r\n }\r\n return t;\r\n}\r\nexport function __decorateFn(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = ObjClass[\"getOwnPropertyDescriptor\"](target, key) : desc, d;\r\n if (__hasReflect && typeof ReflectObj[strDecorate] === strShimFunction) {\r\n r = ReflectObj[strDecorate](decorators, target, key, desc);\r\n }\r\n else {\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n // eslint-disable-next-line no-cond-assign\r\n if (d = decorators[i]) {\r\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n }\r\n }\r\n }\r\n // tslint:disable-next-line:ban-comma-operator\r\n return c > 3 && r && objDefineProp(target, key, r), r;\r\n}\r\nexport function __paramFn(paramIndex, decorator) {\r\n return function (target, key) {\r\n decorator(target, key, paramIndex);\r\n };\r\n}\r\nexport function __metadataFn(metadataKey, metadataValue) {\r\n if (__hasReflect && ReflectObj[strMetadata] === strShimFunction) {\r\n return ReflectObj[strMetadata](metadataKey, metadataValue);\r\n }\r\n}\r\nexport function __exportStarFn(m, o) {\r\n for (var p in m) {\r\n if (p !== strDefault && !objHasOwnProperty(o, p)) {\r\n __createBindingFn(o, m, p);\r\n }\r\n }\r\n}\r\nexport function __createBindingFn(o, m, k, k2) {\r\n if (k2 === undefined) {\r\n k2 = k;\r\n }\r\n if (!!objDefineProp) {\r\n objDefineProp(o, k2, {\r\n enumerable: true,\r\n get: function () {\r\n return m[k];\r\n }\r\n });\r\n }\r\n else {\r\n o[k2] = m[k];\r\n }\r\n}\r\nexport function __valuesFn(o) {\r\n var s = typeof SymbolObj === strShimFunction && SymbolObj[strIterator], m = s && o[s], i = 0;\r\n if (m) {\r\n return m.call(o);\r\n }\r\n if (o && typeof o.length === \"number\") {\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) {\r\n o = void 0;\r\n }\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n }\r\n throwTypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\nexport function __readFn(o, n) {\r\n var m = typeof SymbolObj === strShimFunction && o[SymbolObj[strIterator]];\r\n if (!m) {\r\n return o;\r\n }\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {\r\n ar.push(r.value);\r\n }\r\n }\r\n catch (error) {\r\n e = {\r\n error: error\r\n };\r\n }\r\n finally {\r\n try {\r\n // tslint:disable-next-line:no-conditional-assignment\r\n if (r && !r.done && (m = i[\"return\"])) {\r\n m.call(i);\r\n }\r\n }\r\n finally {\r\n if (e) {\r\n // eslint-disable-next-line no-unsafe-finally\r\n throw e.error;\r\n }\r\n }\r\n }\r\n return ar;\r\n}\r\n/** @deprecated */\r\nexport function __spreadArraysFn() {\r\n var theArgs = arguments;\r\n // Calculate new total size\r\n for (var s = 0, i = 0, il = theArgs.length; i < il; i++) {\r\n s += theArgs[i].length;\r\n }\r\n // Create new full array\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++) {\r\n for (var a = theArgs[i], j = 0, jl = a.length; j < jl; j++, k++) {\r\n r[k] = a[j];\r\n }\r\n }\r\n return r;\r\n}\r\nexport function __spreadArrayFn(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {\r\n to[j] = from[i];\r\n }\r\n return to;\r\n}\r\nexport function __makeTemplateObjectFn(cooked, raw) {\r\n if (objDefineProp) {\r\n objDefineProp(cooked, \"raw\", { value: raw });\r\n }\r\n else {\r\n cooked.raw = raw;\r\n }\r\n return cooked;\r\n}\r\nexport function __importStarFn(mod) {\r\n if (mod && mod.__esModule) {\r\n return mod;\r\n }\r\n var result = {};\r\n if (mod != null) {\r\n for (var k in mod) {\r\n if (k !== strDefault && Object.prototype.hasOwnProperty.call(mod, k)) {\r\n __createBindingFn(result, mod, k);\r\n }\r\n }\r\n }\r\n // Set default module\r\n if (!!objDefineProp) {\r\n objDefineProp(result, strDefault, { enumerable: true, value: mod });\r\n }\r\n else {\r\n result[strDefault] = mod;\r\n }\r\n return result;\r\n}\r\nexport function __importDefaultFn(mod) {\r\n return (mod && mod.__esModule) ? mod : { strDefault: mod };\r\n}\r\n//# sourceMappingURL=TsLibShims.js.map","// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nvar _a;\r\nimport { getGlobal, objHasOwnProperty, throwTypeError } from \"@nevware21/ts-utils\";\r\n;\r\nvar UNDEFINED = \"undefined\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Constructor = 'constructor';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar Prototype = 'prototype';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strFunction = 'function';\r\n/**\r\n * Used to define the name of the instance function lookup table\r\n * @ignore\r\n */\r\nvar DynInstFuncTable = '_dynInstFuncs';\r\n/**\r\n * Name used to tag the dynamic prototype function\r\n * @ignore\r\n */\r\nvar DynProxyTag = '_isDynProxy';\r\n/**\r\n * Name added to a prototype to define the dynamic prototype \"class\" name used to lookup the function table\r\n * @ignore\r\n */\r\nvar DynClassName = '_dynClass';\r\n/**\r\n * Prefix added to the classname to avoid any name clashes with other instance level properties\r\n * @ignore\r\n */\r\nvar DynClassNamePrefix = '_dynCls$';\r\n/**\r\n * A tag which is used to check if we have already to attempted to set the instance function if one is not present\r\n * @ignore\r\n */\r\nvar DynInstChkTag = '_dynInstChk';\r\n/**\r\n * A tag which is used to check if we are allows to try and set an instance function is one is not present. Using the same\r\n * tag name as the function level but a different const name for readability only.\r\n */\r\nvar DynAllowInstChkTag = DynInstChkTag;\r\n/**\r\n * The global (imported) instances where the global performance options are stored\r\n */\r\nvar DynProtoDefaultOptions = '_dfOpts';\r\n/**\r\n * Value used as the name of a class when it cannot be determined\r\n * @ignore\r\n */\r\nvar UnknownValue = '_unknown_';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar str__Proto = \"__proto__\";\r\n/**\r\n * The polyfill version of __proto__ so that it doesn't cause issues for anyone not expecting it to exist\r\n */\r\nvar DynProtoBaseProto = \"_dyn\" + str__Proto;\r\n/**\r\n * Runtime Global holder for dynamicProto settings\r\n */\r\nvar DynProtoGlobalSettings = \"__dynProto$Gbl\";\r\n/**\r\n * Track the current prototype for IE8 as you can't look back to get the prototype\r\n */\r\nvar DynProtoCurrent = \"_dynInstProto\";\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strUseBaseInst = 'useBaseInst';\r\n/**\r\n * Constant string defined to support minimization\r\n * @ignore\r\n */\r\nvar strSetInstFuncs = 'setInstFuncs';\r\nvar Obj = Object;\r\n/**\r\n * Pre-lookup to check if we are running on a modern browser (i.e. not IE8)\r\n * @ignore\r\n */\r\nvar _objGetPrototypeOf = Obj[\"getPrototypeOf\"];\r\n/**\r\n * Pre-lookup to check for the existence of this function\r\n */\r\nvar _objGetOwnProps = Obj[\"getOwnPropertyNames\"];\r\n// Since 1.1.7 moving these to the runtime global to work around mixed version and module issues\r\n// See Issue https://github.com/microsoft/DynamicProto-JS/issues/57 for details\r\nvar _gbl = getGlobal();\r\nvar _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = {\r\n o: (_a = {},\r\n _a[strSetInstFuncs] = true,\r\n _a[strUseBaseInst] = true,\r\n _a),\r\n n: 1000 // Start new global index @ 1000 so we \"fix\" some cases when mixed with 1.1.6 or earlier\r\n});\r\n/**\r\n * Helper used to check whether the target is an Object prototype or Array prototype\r\n * @ignore\r\n */\r\nfunction _isObjectOrArrayPrototype(target) {\r\n return target && (target === Obj[Prototype] || target === Array[Prototype]);\r\n}\r\n/**\r\n * Helper used to check whether the target is an Object prototype, Array prototype or Function prototype\r\n * @ignore\r\n */\r\nfunction _isObjectArrayOrFunctionPrototype(target) {\r\n return _isObjectOrArrayPrototype(target) || target === Function[Prototype];\r\n}\r\n/**\r\n * Helper used to get the prototype of the target object as getPrototypeOf is not available in an ES3 environment.\r\n * @ignore\r\n */\r\nfunction _getObjProto(target) {\r\n var newProto;\r\n if (target) {\r\n // This method doesn't exist in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n return _objGetPrototypeOf(target);\r\n }\r\n var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);\r\n // Using the pre-calculated value as IE8 doesn't support looking up the prototype of a prototype and thus fails for more than 1 base class\r\n newProto = target[DynProtoBaseProto] || curProto;\r\n if (!objHasOwnProperty(target, DynProtoBaseProto)) {\r\n // As this prototype doesn't have this property then this is from an inherited class so newProto is the base to return so save it\r\n // so we can look it up value (which for a multiple hierarchy dynamicProto will be the base class)\r\n delete target[DynProtoCurrent]; // Delete any current value allocated to this instance so we pick up the value from prototype hierarchy\r\n newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];\r\n target[DynProtoCurrent] = curProto;\r\n }\r\n }\r\n return newProto;\r\n}\r\n/**\r\n * Helper to get the properties of an object, including none enumerable ones as functions on a prototype in ES6\r\n * are not enumerable.\r\n * @param target\r\n */\r\nfunction _forEachProp(target, func) {\r\n var props = [];\r\n if (_objGetOwnProps) {\r\n props = _objGetOwnProps(target);\r\n }\r\n else {\r\n for (var name_1 in target) {\r\n if (typeof name_1 === \"string\" && objHasOwnProperty(target, name_1)) {\r\n props.push(name_1);\r\n }\r\n }\r\n }\r\n if (props && props.length > 0) {\r\n for (var lp = 0; lp < props.length; lp++) {\r\n func(props[lp]);\r\n }\r\n }\r\n}\r\n/**\r\n * Helper function to check whether the provided function name is a potential candidate for dynamic\r\n * callback and prototype generation.\r\n * @param target The target object, may be a prototype or class object\r\n * @param funcName The function name\r\n * @param skipOwn Skips the check for own property\r\n * @ignore\r\n */\r\nfunction _isDynamicCandidate(target, funcName, skipOwn) {\r\n return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || objHasOwnProperty(target, funcName)));\r\n}\r\n/**\r\n * Helper to throw a TypeError exception\r\n * @param message the message\r\n * @ignore\r\n */\r\nfunction _throwTypeError(message) {\r\n throwTypeError(\"DynamicProto: \" + message);\r\n}\r\n/**\r\n * Returns a collection of the instance functions that are defined directly on the thisTarget object, it does\r\n * not return any inherited functions\r\n * @param thisTarget The object to get the instance functions from\r\n * @ignore\r\n */\r\nfunction _getInstanceFuncs(thisTarget) {\r\n // Get the base proto\r\n var instFuncs = {};\r\n // Save any existing instance functions\r\n _forEachProp(thisTarget, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {\r\n // Create an instance callback for passing the base function to the caller\r\n instFuncs[name] = thisTarget[name];\r\n }\r\n });\r\n return instFuncs;\r\n}\r\n/**\r\n * Returns whether the value is included in the array\r\n * @param values The array of values\r\n * @param value The value\r\n */\r\nfunction _hasVisited(values, value) {\r\n for (var lp = values.length - 1; lp >= 0; lp--) {\r\n if (values[lp] === value) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Returns an object that contains callback functions for all \"base/super\" functions, this is used to \"save\"\r\n * enabling calling super.xxx() functions without requiring that the base \"class\" has defined a prototype references\r\n * @param target The current instance\r\n * @ignore\r\n */\r\nfunction _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {\r\n function _instFuncProxy(target, funcHost, funcName) {\r\n var theFunc = funcHost[funcName];\r\n if (theFunc[DynProxyTag] && useBaseInst) {\r\n // grab and reuse the hosted looking function (if available) otherwise the original passed function\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;\r\n }\r\n }\r\n return function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n return theFunc.apply(target, arguments);\r\n };\r\n }\r\n // Start creating a new baseFuncs by creating proxies for the instance functions (as they may get replaced)\r\n var baseFuncs = {};\r\n _forEachProp(instFuncs, function (name) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);\r\n });\r\n // Get the base prototype functions\r\n var baseProto = _getObjProto(classProto);\r\n var visited = [];\r\n // Don't include base object functions for Object, Array or Function\r\n while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {\r\n // look for prototype functions\r\n _forEachProp(baseProto, function (name) {\r\n // Don't include any dynamic prototype instances - as we only want the real functions\r\n // For IE 7/8 the prototype lookup doesn't provide the full chain so we need to bypass the \r\n // hasOwnProperty check we get all of the methods, main difference is that IE7/8 doesn't return\r\n // the Object prototype methods while bypassing the check\r\n if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {\r\n // Create an instance callback for passing the base function to the caller\r\n baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);\r\n }\r\n });\r\n // We need to find all possible functions that might be overloaded by walking the entire prototype chain\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(baseProto);\r\n baseProto = _getObjProto(baseProto);\r\n }\r\n return baseFuncs;\r\n}\r\nfunction _getInstFunc(target, funcName, proto, currentDynProtoProxy) {\r\n var instFunc = null;\r\n // We need to check whether the class name is defined directly on this prototype otherwise\r\n // it will walk the proto chain and return any parent proto classname.\r\n if (target && objHasOwnProperty(proto, DynClassName)) {\r\n var instFuncTable = target[DynInstFuncTable] || {};\r\n instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];\r\n if (!instFunc) {\r\n // Avoid stack overflow from recursive calling the same function\r\n _throwTypeError(\"Missing [\" + funcName + \"] \" + strFunction);\r\n }\r\n // We have the instance function, lets check it we can speed up further calls\r\n // by adding the instance function back directly on the instance (avoiding the dynamic func lookup)\r\n if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {\r\n // If the instance already has an instance function we can't replace it\r\n var canAddInst = !objHasOwnProperty(target, funcName);\r\n // Get current prototype\r\n var objProto = _getObjProto(target);\r\n var visited = [];\r\n // Lookup the function starting at the top (instance level prototype) and traverse down, if the first matching function\r\n // if nothing is found or if the first hit is a dynamic proto instance then we can safely add an instance shortcut\r\n while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {\r\n var protoFunc = objProto[funcName];\r\n if (protoFunc) {\r\n canAddInst = (protoFunc === currentDynProtoProxy);\r\n break;\r\n }\r\n // We need to find all possible initial functions to ensure that we don't bypass a valid override function\r\n visited.push(objProto);\r\n objProto = _getObjProto(objProto);\r\n }\r\n try {\r\n if (canAddInst) {\r\n // This instance doesn't have an instance func and the class hierarchy does have a higher level prototype version\r\n // so it's safe to directly assign for any subsequent calls (for better performance)\r\n target[funcName] = instFunc;\r\n }\r\n // Block further attempts to set the instance function for any\r\n instFunc[DynInstChkTag] = 1;\r\n }\r\n catch (e) {\r\n // Don't crash if the object is readonly or the runtime doesn't allow changing this\r\n // And set a flag so we don't try again for any function\r\n instFuncTable[DynAllowInstChkTag] = false;\r\n }\r\n }\r\n }\r\n return instFunc;\r\n}\r\nfunction _getProtoFunc(funcName, proto, currentDynProtoProxy) {\r\n var protoFunc = proto[funcName];\r\n // Check that the prototype function is not a self reference -- try to avoid stack overflow!\r\n if (protoFunc === currentDynProtoProxy) {\r\n // It is so lookup the base prototype\r\n protoFunc = _getObjProto(proto)[funcName];\r\n }\r\n if (typeof protoFunc !== strFunction) {\r\n _throwTypeError(\"[\" + funcName + \"] is not a \" + strFunction);\r\n }\r\n return protoFunc;\r\n}\r\n/**\r\n * Add the required dynamic prototype methods to the the class prototype\r\n * @param proto - The class prototype\r\n * @param className - The instance classname\r\n * @param target - The target instance\r\n * @param baseInstFuncs - The base instance functions\r\n * @param setInstanceFunc - Flag to allow prototype function to reset the instance function if one does not exist\r\n * @ignore\r\n */\r\nfunction _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {\r\n function _createDynamicPrototype(proto, funcName) {\r\n var dynProtoProxy = function () {\r\n // Use the instance or prototype function\r\n var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);\r\n // eslint-disable-next-line prefer-rest-params\r\n return instFunc.apply(this, arguments);\r\n };\r\n // Tag this function as a proxy to support replacing dynamic proxy elements (primary use case is for unit testing\r\n // via which can dynamically replace the prototype function reference)\r\n dynProtoProxy[DynProxyTag] = 1;\r\n return dynProtoProxy;\r\n }\r\n if (!_isObjectOrArrayPrototype(proto)) {\r\n var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};\r\n var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {}); // fetch and assign if as it may not exist yet\r\n // Set whether we are allow to lookup instances, if someone has set to false then do not re-enable\r\n if (instFuncTable[DynAllowInstChkTag] !== false) {\r\n instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;\r\n }\r\n _forEachProp(target, function (name) {\r\n // Only add overridden functions\r\n if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {\r\n // Save the instance Function to the lookup table and remove it from the instance as it's not a dynamic proto function\r\n instFuncs_1[name] = target[name];\r\n delete target[name];\r\n // Add a dynamic proto if one doesn't exist or if a prototype function exists and it's not a dynamic one\r\n if (!objHasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {\r\n proto[name] = _createDynamicPrototype(proto, name);\r\n }\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Checks whether the passed prototype object appears to be correct by walking the prototype hierarchy of the instance\r\n * @param classProto The class prototype instance\r\n * @param thisTarget The current instance that will be checked whether the passed prototype instance is in the hierarchy\r\n * @ignore\r\n */\r\nfunction _checkPrototype(classProto, thisTarget) {\r\n // This method doesn't existing in older browsers (e.g. IE8)\r\n if (_objGetPrototypeOf) {\r\n // As this is primarily a coding time check, don't bother checking if running in IE8 or lower\r\n var visited = [];\r\n var thisProto = _getObjProto(thisTarget);\r\n while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {\r\n if (thisProto === classProto) {\r\n return true;\r\n }\r\n // This avoids the caller from needing to check whether it's direct base class implements the function or not\r\n // by walking the entire chain it simplifies the usage and issues from upgrading any of the base classes.\r\n visited.push(thisProto);\r\n thisProto = _getObjProto(thisProto);\r\n }\r\n return false;\r\n }\r\n // If objGetPrototypeOf doesn't exist then just assume everything is ok.\r\n return true;\r\n}\r\n/**\r\n * Gets the current prototype name using the ES6 name if available otherwise falling back to a use unknown as the name.\r\n * It's not critical for this to return a name, it's used to decorate the generated unique name for easier debugging only.\r\n * @param target\r\n * @param unknownValue\r\n * @ignore\r\n */\r\nfunction _getObjName(target, unknownValue) {\r\n if (objHasOwnProperty(target, Prototype)) {\r\n // Look like a prototype\r\n return target.name || unknownValue || UnknownValue;\r\n }\r\n return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;\r\n}\r\n/**\r\n * Helper function when creating dynamic (inline) functions for classes, this helper performs the following tasks :-\r\n * - Saves references to all defined base class functions\r\n * - Calls the delegateFunc with the current target (this) and a base object reference that can be used to call all \"super\" functions.\r\n * - Will populate the class prototype for all overridden functions to support class extension that call the prototype instance.\r\n * Callers should use this helper when declaring all function within the constructor of a class, as mentioned above the delegateFunc is\r\n * passed both the target \"this\" and an object that can be used to call any base (super) functions, using this based object in place of\r\n * super.XXX() (which gets expanded to _super.prototype.XXX()) provides a better minification outcome and also ensures the correct \"this\"\r\n * context is maintained as TypeScript creates incorrect references using super.XXXX() for dynamically defined functions i.e. Functions\r\n * defined in the constructor or some other function (rather than declared as complete typescript functions).\r\n * ### Usage\r\n * ```typescript\r\n * import dynamicProto from \"@microsoft/dynamicproto-js\";\r\n * class ExampleClass extends BaseClass {\r\n * constructor() {\r\n * dynamicProto(ExampleClass, this, (_self, base) => {\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.newFunc = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * ...\r\n * }\r\n * }\r\n * // This will define a function that will be converted to a prototype function\r\n * _self.myFunction = () => {\r\n * // Access any \"this\" instance property\r\n * if (_self.someProperty) {\r\n * // Call the base version of the function that we are overriding\r\n * base.myFunction();\r\n * }\r\n * ...\r\n * }\r\n * _self.initialize = () => {\r\n * ...\r\n * }\r\n * // Warnings: While the following will work as _self is simply a reference to\r\n * // this, if anyone overrides myFunction() the overridden will be called first\r\n * // as the normal JavaScript method resolution will occur and the defined\r\n * // _self.initialize() function is actually gets removed from the instance and\r\n * // a proxy prototype version is created to reference the created method.\r\n * _self.initialize();\r\n * });\r\n * }\r\n * }\r\n * ```\r\n * @typeparam DPType This is the generic type of the class, used to keep intellisense valid\r\n * @typeparam DPCls The type that contains the prototype of the current class\r\n * @param theClass - This is the current class instance which contains the prototype for the current class\r\n * @param target - The current \"this\" (target) reference, when the class has been extended this.prototype will not be the 'theClass' value.\r\n * @param delegateFunc - The callback function (closure) that will create the dynamic function\r\n * @param options - Additional options to configure how the dynamic prototype operates\r\n */\r\nexport default function dynamicProto(theClass, target, delegateFunc, options) {\r\n // Make sure that the passed theClass argument looks correct\r\n if (!objHasOwnProperty(theClass, Prototype)) {\r\n _throwTypeError(\"theClass is an invalid class definition.\");\r\n }\r\n // Quick check to make sure that the passed theClass argument looks correct (this is a common copy/paste error)\r\n var classProto = theClass[Prototype];\r\n if (!_checkPrototype(classProto, target)) {\r\n _throwTypeError(\"[\" + _getObjName(theClass) + \"] not in hierarchy of [\" + _getObjName(target) + \"]\");\r\n }\r\n var className = null;\r\n if (objHasOwnProperty(classProto, DynClassName)) {\r\n // Only grab the class name if it's defined on this prototype (i.e. don't walk the prototype chain)\r\n className = classProto[DynClassName];\r\n }\r\n else {\r\n // As not all browser support name on the prototype creating a unique dynamic one if we have not already\r\n // assigned one, so we can use a simple string as the lookup rather than an object for the dynamic instance\r\n // function table lookup.\r\n className = DynClassNamePrefix + _getObjName(theClass, \"_\") + \"$\" + _gblInst.n;\r\n _gblInst.n++;\r\n classProto[DynClassName] = className;\r\n }\r\n var perfOptions = dynamicProto[DynProtoDefaultOptions];\r\n var useBaseInst = !!perfOptions[strUseBaseInst];\r\n if (useBaseInst && options && options[strUseBaseInst] !== undefined) {\r\n useBaseInst = !!options[strUseBaseInst];\r\n }\r\n // Get the current instance functions\r\n var instFuncs = _getInstanceFuncs(target);\r\n // Get all of the functions for any base instance (before they are potentially overridden)\r\n var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);\r\n // Execute the delegate passing in both the current target \"this\" and \"base\" function references\r\n // Note casting the same type as we don't actually have the base class here and this will provide some intellisense support\r\n delegateFunc(target, baseFuncs);\r\n // Don't allow setting instance functions for older IE instances\r\n var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];\r\n if (setInstanceFunc && options) {\r\n setInstanceFunc = !!options[strSetInstFuncs];\r\n }\r\n // Populate the Prototype for any overridden instance functions\r\n _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);\r\n}\r\n/**\r\n * Exposes the default global options to allow global configuration, if the global values are disabled these will override\r\n * any passed values. This is primarily exposed to support unit-testing without the need for individual classes to expose\r\n * their internal usage of dynamic proto.\r\n */\r\ndynamicProto[DynProtoDefaultOptions] = _gblInst.o;\r\n//# sourceMappingURL=DynamicProto.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\"use strict\";\r\nexport var MinChannelPriorty = 100;\r\n//# sourceMappingURL=IChannelControls.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, createCustomError, dumpObj } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nvar aggregationErrorType;\r\n/**\r\n * Throws an Aggregation Error which includes all of the errors that led to this error occurring\r\n * @param message - The message describing the aggregation error (the sourceError details are added to this)\r\n * @param sourceErrors - An array of the errors that caused this situation\r\n */\r\nexport function throwAggregationError(message, sourceErrors) {\r\n if (!aggregationErrorType) {\r\n aggregationErrorType = createCustomError(\"AggregationError\", function (self, args) {\r\n if (args[_DYN_LENGTH /* @min:%2elength */] > 1) {\r\n // Save the provided errors\r\n self.errors = args[1];\r\n }\r\n });\r\n }\r\n var theMessage = message || \"One or more errors occurred.\";\r\n arrForEach(sourceErrors, function (srcError, idx) {\r\n theMessage += \"\\n\".concat(idx, \" > \").concat(dumpObj(srcError));\r\n });\r\n throw new aggregationErrorType(theMessage, sourceErrors || []);\r\n}\r\n//# sourceMappingURL=AggregationError.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { createEnum, createTypeMap } from \"@nevware21/ts-utils\";\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 var createEnumStyle = createEnum;\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 var createValueMap = createTypeMap;\r\n//# sourceMappingURL=EnumHelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { createEnumStyle } from \"../JavaScriptSDK.Enums/EnumHelperFuncs\";\r\n/**\r\n * The EventsDiscardedReason enumeration contains a set of values that specify the reason for discarding an event.\r\n */\r\nexport var EventsDiscardedReason = createEnumStyle({\r\n /**\r\n * Unknown.\r\n */\r\n Unknown: 0 /* eEventsDiscardedReason.Unknown */,\r\n /**\r\n * Status set to non-retryable.\r\n */\r\n NonRetryableStatus: 1 /* eEventsDiscardedReason.NonRetryableStatus */,\r\n /**\r\n * The event is invalid.\r\n */\r\n InvalidEvent: 2 /* eEventsDiscardedReason.InvalidEvent */,\r\n /**\r\n * The size of the event is too large.\r\n */\r\n SizeLimitExceeded: 3 /* eEventsDiscardedReason.SizeLimitExceeded */,\r\n /**\r\n * The server is not accepting events from this instrumentation key.\r\n */\r\n KillSwitch: 4 /* eEventsDiscardedReason.KillSwitch */,\r\n /**\r\n * The event queue is full.\r\n */\r\n QueueFull: 5 /* eEventsDiscardedReason.QueueFull */\r\n});\r\n//# sourceMappingURL=EventsDiscardedReason.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_TO_LOWER_CASE = \"toLowerCase\"; // Count: 9\r\nexport var _DYN_BLK_VAL = \"blkVal\"; // Count: 5\r\nexport var _DYN_LENGTH = \"length\"; // Count: 43\r\nexport var _DYN_RD_ONLY = \"rdOnly\"; // Count: 4\r\nexport var _DYN_NOTIFY = \"notify\"; // Count: 4\r\nexport var _DYN_WARN_TO_CONSOLE = \"warnToConsole\"; // Count: 4\r\nexport var _DYN_THROW_INTERNAL = \"throwInternal\"; // Count: 5\r\nexport var _DYN_SET_DF = \"setDf\"; // Count: 6\r\nexport var _DYN_WATCH = \"watch\"; // Count: 9\r\nexport var _DYN_LOGGER = \"logger\"; // Count: 21\r\nexport var _DYN_APPLY = \"apply\"; // Count: 7\r\nexport var _DYN_PUSH = \"push\"; // Count: 31\r\nexport var _DYN_SPLICE = \"splice\"; // Count: 8\r\nexport var _DYN_HDLR = \"hdlr\"; // Count: 6\r\nexport var _DYN_CANCEL = \"cancel\"; // Count: 5\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 4\r\nexport var _DYN_IDENTIFIER = \"identifier\"; // Count: 8\r\nexport var _DYN_IS_INITIALIZED = \"isInitialized\"; // Count: 10\r\nexport var _DYN_GET_PLUGIN = \"getPlugin\"; // Count: 6\r\nexport var _DYN_POLL_INTERNAL_LOGS = \"pollInternalLogs\"; // Count: 2\r\nexport var _DYN_NAME = \"name\"; // Count: 11\r\nexport var _DYN_TIME = \"time\"; // Count: 6\r\nexport var _DYN_PROCESS_NEXT = \"processNext\"; // Count: 15\r\nexport var _DYN_GET_PROCESS_TEL_CONT0 = \"getProcessTelContext\"; // Count: 2\r\nexport var _DYN_GET_NOTIFY_MGR = \"getNotifyMgr\"; // Count: 5\r\nexport var _DYN_ADD_NOTIFICATION_LIS1 = \"addNotificationListener\"; // Count: 4\r\nexport var _DYN_REMOVE_NOTIFICATION_2 = \"removeNotificationListener\"; // Count: 4\r\nexport var _DYN_ENABLED = \"enabled\"; // Count: 6\r\nexport var _DYN_STOP_POLLING_INTERNA3 = \"stopPollingInternalLogs\"; // Count: 2\r\nexport var _DYN_UNLOAD = \"unload\"; // Count: 9\r\nexport var _DYN_ON_COMPLETE = \"onComplete\"; // Count: 5\r\nexport var _DYN_VERSION = \"version\"; // Count: 6\r\nexport var _DYN_LOGGING_LEVEL_CONSOL4 = \"loggingLevelConsole\"; // Count: 2\r\nexport var _DYN_CREATE_NEW = \"createNew\"; // Count: 7\r\nexport var _DYN_TEARDOWN = \"teardown\"; // Count: 9\r\nexport var _DYN_MESSAGE_ID = \"messageId\"; // Count: 4\r\nexport var _DYN_MESSAGE = \"message\"; // Count: 6\r\nexport var _DYN_IS_ASYNC = \"isAsync\"; // Count: 6\r\nexport var _DYN_DIAG_LOG = \"diagLog\"; // Count: 10\r\nexport var _DYN__DO_TEARDOWN = \"_doTeardown\"; // Count: 4\r\nexport var _DYN_UPDATE = \"update\"; // Count: 6\r\nexport var _DYN_GET_NEXT = \"getNext\"; // Count: 12\r\nexport var _DYN_SET_NEXT_PLUGIN = \"setNextPlugin\"; // Count: 5\r\nexport var _DYN_USER_AGENT = \"userAgent\"; // Count: 5\r\nexport var _DYN_SPLIT = \"split\"; // Count: 6\r\nexport var _DYN_NODE_TYPE = \"nodeType\"; // Count: 3\r\nexport var _DYN_REPLACE = \"replace\"; // Count: 8\r\nexport var _DYN_LOG_INTERNAL_MESSAGE = \"logInternalMessage\"; // Count: 2\r\nexport var _DYN_TYPE = \"type\"; // Count: 14\r\nexport var _DYN_HANDLER = \"handler\"; // Count: 5\r\nexport var _DYN_IS_CHILD_EVT = \"isChildEvt\"; // Count: 3\r\nexport var _DYN_GET_CTX = \"getCtx\"; // Count: 6\r\nexport var _DYN_SET_CTX = \"setCtx\"; // Count: 10\r\nexport var _DYN_COMPLETE = \"complete\"; // Count: 3\r\nexport var _DYN_TRACE_ID = \"traceId\"; // Count: 5\r\nexport var _DYN_SPAN_ID = \"spanId\"; // Count: 5\r\nexport var _DYN_TRACE_FLAGS = \"traceFlags\"; // Count: 6\r\n//# sourceMappingURL=__DynamicConstants.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { isPromiseLike } from \"@nevware21/ts-utils\";\r\nexport function doAwaitResponse(value, cb) {\r\n return doAwait(value, function (value) {\r\n cb && cb({\r\n value: value,\r\n rejected: false\r\n });\r\n }, function (reason) {\r\n cb && cb({\r\n rejected: true,\r\n reason: reason\r\n });\r\n });\r\n}\r\n/**\r\n * Wait for the promise to resolve or reject, if resolved the callback function will be called with it's value and if\r\n * rejected the rejectFn will be called with the reason. If the passed promise argument is not a promise the callback\r\n * will be called synchronously with the value.\r\n * @group Await Helper\r\n * @param value - The value or promise like value to wait for\r\n * @param resolveFn - The callback to call on the promise successful resolving.\r\n * @param rejectFn - The callback to call when the promise rejects\r\n * @returns The passed value, if it is a promise and there is either a resolve or reject handler\r\n * then it will return a chained promise with the value from the resolve or reject handler (depending\r\n * whether it resolve or rejects)\r\n * @example\r\n * ```ts\r\n * let promise = createPromise((resolve, reject) => {\r\n * resolve(42);\r\n * });\r\n *\r\n * // Handle via a chained promise\r\n * let chainedPromise = promise.then((value) => {\r\n * // Do something with the value\r\n * });\r\n *\r\n * // Handle via doAwait\r\n * doAwait(promise, (value) => {\r\n * // Do something with the value\r\n * });\r\n *\r\n * // It can also handle the raw value, so you could process the result of either a\r\n * // synchrounous return of the value or a Promise\r\n * doAwait(42, (value) => {\r\n * // Do something with the value\r\n * });\r\n * ```\r\n */\r\nexport function doAwait(value, resolveFn, rejectFn, finallyFn) {\r\n var result = value;\r\n if (isPromiseLike(value)) {\r\n if (resolveFn || rejectFn) {\r\n result = value.then(resolveFn, rejectFn);\r\n }\r\n }\r\n else {\r\n resolveFn && resolveFn(value);\r\n }\r\n if (finallyFn) {\r\n result = doFinally(result, finallyFn);\r\n }\r\n return result;\r\n}\r\n/**\r\n * Wait for the promise to resolve or reject and then call the finallyFn. If the passed promise argument is not a promise the callback\r\n * will be called synchronously with the value. If the passed promise doesn't implement finally then a finally implementation will be\r\n * simulated using then(..., ...).\r\n * @group Await Helper\r\n * @param value - The value or promise like value to wait for\r\n * @param finallyFn - The finally function to call once the promise has resolved or rejected\r\n */\r\nexport function doFinally(value, finallyFn) {\r\n var result = value;\r\n if (finallyFn) {\r\n if (isPromiseLike(value)) {\r\n if (value.finally) {\r\n result = value.finally(finallyFn);\r\n }\r\n else {\r\n // Simulate finally if not available\r\n result = value.then(function (value) {\r\n finallyFn();\r\n return value;\r\n }, function (reason) {\r\n finallyFn();\r\n throw reason;\r\n });\r\n }\r\n }\r\n else {\r\n finallyFn();\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=await.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\n/**\r\n * @ignore -- Don't include in the generated documentation\r\n * @internal\r\n */\r\nexport var STRING_STATES = [\r\n \"pending\", \"resolving\", \"resolved\", \"rejected\"\r\n];\r\n//# sourceMappingURL=state.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { dumpObj, getDocument, safeGetLazy, getInst } from \"@nevware21/ts-utils\";\r\nvar DISPATCH_EVENT = \"dispatchEvent\";\r\nvar _hasInitEvent;\r\n/**\r\n * @internal\r\n * @ignore\r\n * @param target\r\n * @param evtName\r\n * @param populateEvent\r\n * @param useNewEvent\r\n */\r\nexport function emitEvent(target, evtName, populateEvent, useNewEvent) {\r\n var doc = getDocument();\r\n !_hasInitEvent && (_hasInitEvent = safeGetLazy(function () {\r\n var evt;\r\n if (doc && doc.createEvent) {\r\n evt = doc.createEvent(\"Event\");\r\n }\r\n return (!!evt && evt.initEvent);\r\n }, null));\r\n var theEvt = _hasInitEvent.v ? doc.createEvent(\"Event\") : (useNewEvent ? new Event(evtName) : {});\r\n populateEvent && populateEvent(theEvt);\r\n if (_hasInitEvent.v) {\r\n theEvt.initEvent(evtName, false, true);\r\n }\r\n if (theEvt && target[DISPATCH_EVENT]) {\r\n target[DISPATCH_EVENT](theEvt);\r\n }\r\n else {\r\n var handler = target[\"on\" + evtName];\r\n if (handler) {\r\n handler(theEvt);\r\n }\r\n else {\r\n var theConsole = getInst(\"console\");\r\n theConsole && (theConsole[\"error\"] || theConsole[\"log\"])(evtName, dumpObj(theEvt));\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=event.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { arrForEach, arrSlice, dumpObj, getKnownSymbol, hasSymbol, isFunction, isPromiseLike, isUndefined, throwTypeError, objToString, scheduleTimeout, getWindow, isNode, getGlobal, objDefine, objDefineProp, lazySafeGetInst } from \"@nevware21/ts-utils\";\r\nimport { doAwait } from \"./await\";\r\nimport { _addDebugState, _promiseDebugEnabled } from \"./debug\";\r\nimport { STRING_STATES } from \"../internal/state\";\r\nimport { emitEvent } from \"./event\";\r\nimport { STR_PROMISE } from \"../internal/constants\";\r\nvar NODE_UNHANDLED_REJECTION = \"unhandledRejection\";\r\nvar UNHANDLED_REJECTION = NODE_UNHANDLED_REJECTION.toLowerCase();\r\nvar _currentPromiseId = [];\r\nvar _uniquePromiseId = 0;\r\nvar _unhandledRejectionTimeout = 10;\r\nvar _hasPromiseRejectionEvent;\r\nfunction dumpFnObj(value) {\r\n if (isFunction(value)) {\r\n return value.toString();\r\n }\r\n return dumpObj(value);\r\n}\r\nexport function _createPromise(newPromise, processor, executor) {\r\n var additionalArgs = arrSlice(arguments, 3);\r\n var _state = 0 /* ePromiseState.Pending */;\r\n var _hasResolved = false;\r\n var _settledValue;\r\n var _queue = [];\r\n var _id = _uniquePromiseId++;\r\n var _parentId = _currentPromiseId.length > 0 ? _currentPromiseId[_currentPromiseId.length - 1] : undefined;\r\n var _handled = false;\r\n var _unHandledRejectionHandler = null;\r\n var _thePromise;\r\n !_hasPromiseRejectionEvent && (_hasPromiseRejectionEvent = lazySafeGetInst(STR_PROMISE + \"RejectionEvent\"));\r\n // https://tc39.es/ecma262/#sec-promise.prototype.then\r\n var _then = function (onResolved, onRejected) {\r\n try {\r\n _currentPromiseId.push(_id);\r\n _handled = true;\r\n _unHandledRejectionHandler && _unHandledRejectionHandler.cancel();\r\n _unHandledRejectionHandler = null;\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"then(\" + dumpFnObj(onResolved)+ \", \" + dumpFnObj(onResolved) + \")\");\r\n //#endif\r\n var thenPromise = newPromise(function (resolve, reject) {\r\n // Queue the new promise returned to be resolved or rejected\r\n // when this promise settles.\r\n _queue.push(function () {\r\n // https://tc39.es/ecma262/#sec-newpromisereactionjob\r\n //let value: any;\r\n try {\r\n // First call the onFulfilled or onRejected handler, on the settled value\r\n // of this promise. If the corresponding `handler` does not exist, simply\r\n // pass through the settled value.\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Handling settled value \" + dumpFnObj(_settledValue));\r\n //#endif\r\n var handler = _state === 2 /* ePromiseState.Resolved */ ? onResolved : onRejected;\r\n var value = isUndefined(handler) ? _settledValue : (isFunction(handler) ? handler(_settledValue) : handler);\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Handling Result \" + dumpFnObj(value));\r\n //#endif\r\n if (isPromiseLike(value)) {\r\n // The called handlers returned a new promise, so the chained promise\r\n // will follow the state of this promise.\r\n value.then(resolve, reject);\r\n }\r\n else if (handler) {\r\n // If we have a handler then chained promises are always \"resolved\" with the result returned\r\n resolve(value);\r\n }\r\n else if (_state === 3 /* ePromiseState.Rejected */) {\r\n // If this promise is rejected then the chained promise should be rejected\r\n // with either the settled value of this promise or the return value of the handler.\r\n reject(value);\r\n }\r\n else {\r\n // If this promise is fulfilled, then the chained promise is also fulfilled\r\n // with either the settled value of this promise or the return value of the handler.\r\n resolve(value);\r\n }\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n });\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Added to Queue \" + _queue.length);\r\n //#endif\r\n // If this promise is already settled, then immediately process the callback we\r\n // just added to the queue.\r\n if (_hasResolved) {\r\n _processQueue();\r\n }\r\n }, additionalArgs);\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Created -> \" + thenPromise.toString());\r\n //#endif\r\n return thenPromise;\r\n }\r\n finally {\r\n _currentPromiseId.pop();\r\n }\r\n };\r\n // https://tc39.es/ecma262/#sec-promise.prototype.catch\r\n var _catch = function (onRejected) {\r\n // Reuse then onRejected to support rejection\r\n return _then(undefined, onRejected);\r\n };\r\n // https://tc39.es/ecma262/#sec-promise.prototype.finally\r\n var _finally = function (onFinally) {\r\n var thenFinally = onFinally;\r\n var catchFinally = onFinally;\r\n if (isFunction(onFinally)) {\r\n thenFinally = function (value) {\r\n onFinally && onFinally();\r\n return value;\r\n };\r\n catchFinally = function (reason) {\r\n onFinally && onFinally();\r\n throw reason;\r\n };\r\n }\r\n return _then(thenFinally, catchFinally);\r\n };\r\n var _strState = function () {\r\n return STRING_STATES[_state];\r\n };\r\n var _processQueue = function () {\r\n if (_queue.length > 0) {\r\n // The onFulfilled and onRejected handlers must be called asynchronously. Thus,\r\n // we make a copy of the queue and work on it once the current call stack unwinds.\r\n var pending = _queue.slice();\r\n _queue = [];\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Processing queue \" + pending.length);\r\n //#endif\r\n _handled = true;\r\n processor(pending);\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Processing done\");\r\n //#endif\r\n _unHandledRejectionHandler && _unHandledRejectionHandler.cancel();\r\n _unHandledRejectionHandler = null;\r\n }\r\n else {\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Empty Processing queue \");\r\n //#endif\r\n }\r\n };\r\n var _createSettleIfFn = function (newState, allowState) {\r\n return function (theValue) {\r\n if (_state === allowState) {\r\n if (newState === 2 /* ePromiseState.Resolved */ && isPromiseLike(theValue)) {\r\n _state = 1 /* ePromiseState.Resolving */;\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Resolving\");\r\n //#endif\r\n theValue.then(_createSettleIfFn(2 /* ePromiseState.Resolved */, 1 /* ePromiseState.Resolving */), _createSettleIfFn(3 /* ePromiseState.Rejected */, 1 /* ePromiseState.Resolving */));\r\n return;\r\n }\r\n _state = newState;\r\n _hasResolved = true;\r\n _settledValue = theValue;\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), _strState());\r\n //#endif\r\n _processQueue();\r\n if (!_handled && newState === 3 /* ePromiseState.Rejected */ && !_unHandledRejectionHandler) {\r\n _unHandledRejectionHandler = scheduleTimeout(_notifyUnhandledRejection, _unhandledRejectionTimeout);\r\n }\r\n }\r\n else {\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Already \" + _strState());\r\n //#endif\r\n }\r\n };\r\n };\r\n var _notifyUnhandledRejection = function () {\r\n if (!_handled) {\r\n if (isNode()) {\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Emitting \" + NODE_UNHANDLED_REJECTION);\r\n //#endif\r\n process.emit(NODE_UNHANDLED_REJECTION, _settledValue, _thePromise);\r\n }\r\n else {\r\n var gbl = getWindow() || getGlobal();\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Emitting \" + UNHANDLED_REJECTION);\r\n //#endif\r\n emitEvent(gbl, UNHANDLED_REJECTION, function (theEvt) {\r\n objDefine(theEvt, \"promise\", { g: function () { return _thePromise; } });\r\n theEvt.reason = _settledValue;\r\n return theEvt;\r\n }, !!_hasPromiseRejectionEvent.v);\r\n }\r\n }\r\n };\r\n _thePromise = {\r\n then: _then,\r\n \"catch\": _catch,\r\n finally: _finally\r\n };\r\n objDefineProp(_thePromise, \"state\", {\r\n get: _strState\r\n });\r\n if (_promiseDebugEnabled) {\r\n // eslint-disable-next-line brace-style\r\n _addDebugState(_thePromise, _strState, function () { return objToString(_settledValue); }, function () { return _handled; });\r\n }\r\n if (hasSymbol()) {\r\n _thePromise[getKnownSymbol(11 /* WellKnownSymbols.toStringTag */)] = \"IPromise\";\r\n }\r\n var _toString = function () {\r\n return \"IPromise\" + (_promiseDebugEnabled ? \"[\" + _id + (!isUndefined(_parentId) ? (\":\" + _parentId) : \"\") + \"]\" : \"\") + \" \" + _strState() + (_hasResolved ? (\" - \" + dumpFnObj(_settledValue)) : \"\");\r\n };\r\n _thePromise.toString = _toString;\r\n (function _initialize() {\r\n if (!isFunction(executor)) {\r\n throwTypeError(STR_PROMISE + \": executor is not a function - \" + dumpFnObj(executor));\r\n }\r\n var _rejectFn = _createSettleIfFn(3 /* ePromiseState.Rejected */, 0 /* ePromiseState.Pending */);\r\n try {\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Executing\");\r\n //#endif\r\n executor.call(_thePromise, _createSettleIfFn(2 /* ePromiseState.Resolved */, 0 /* ePromiseState.Pending */), _rejectFn);\r\n }\r\n catch (e) {\r\n _rejectFn(e);\r\n }\r\n })();\r\n //#ifdef DEBUG\r\n //#:(!DEBUG) _debugLog(_toString(), \"Returning\");\r\n //#endif\r\n return _thePromise;\r\n}\r\n/**\r\n * @ignore\r\n * @internal\r\n * Returns a function which when called will return a new Promise object that resolves to an array of the\r\n * results from the input promises. The returned promise will resolve when all of the inputs' promises have\r\n * resolved, or if the input contains no promises. It rejects immediately upon any of the input promises\r\n * rejected or non-promises throwing an error, and will reject with this first rejection message / error.\r\n * @param newPromise - The delegate function used to create a new promise object the new promise instance.\r\n * @returns A function to create a promise that will be resolved when all arguments are resolved.\r\n */\r\nexport function _createAllPromise(newPromise) {\r\n return function (input) {\r\n var additionalArgs = arrSlice(arguments, 1);\r\n return newPromise(function (resolve, reject) {\r\n try {\r\n var values_1 = [];\r\n var pending_1 = 1; // Prefix to 1 so we finish iterating over all of the input promises first\r\n arrForEach(input, function (item, idx) {\r\n if (item) {\r\n pending_1++;\r\n doAwait(item, function (value) {\r\n // Set the result values\r\n values_1[idx] = value;\r\n if (--pending_1 === 0) {\r\n resolve(values_1);\r\n }\r\n }, reject);\r\n }\r\n });\r\n // Now decrement the pending so that we finish correctly\r\n pending_1--;\r\n if (pending_1 === 0) {\r\n // All promises were either resolved or where not a promise\r\n resolve(values_1);\r\n }\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n }, additionalArgs);\r\n };\r\n}\r\n/**\r\n * @ignore\r\n * @internal\r\n * The createResolvedPromise returns a PromiseLike object that is resolved with a given value. If the value is\r\n * PromiseLike (i.e. has a \"then\" method), the returned promise will \"follow\" that thenable, adopting its eventual\r\n * state; otherwise the returned promise will be fulfilled with the value. This function flattens nested layers\r\n * of promise-like objects (e.g. a promise that resolves to a promise that resolves to something) into a single layer.\r\n * @param newPromise - The delegate function used to create a new promise object\r\n * @param value Argument to be resolved by this Promise. Can also be a Promise or a thenable to resolve.\r\n * @param additionalArgs - Any additional arguments that should be passed to the delegate to assist with the creation of\r\n * the new promise instance.\r\n */\r\nexport function _createResolvedPromise(newPromise) {\r\n return function (value) {\r\n var additionalArgs = arrSlice(arguments, 1);\r\n if (isPromiseLike(value)) {\r\n return value;\r\n }\r\n return newPromise(function (resolve) {\r\n resolve(value);\r\n }, additionalArgs);\r\n };\r\n}\r\n/**\r\n * @ignore\r\n * @internal\r\n * Return a promise like object that is rejected with the given reason.\r\n * @param newPromise - The delegate function used to create a new promise object\r\n * @param reason - The rejection reason\r\n * @param additionalArgs - Any additional arguments that should be passed to the delegate to assist with the creation of\r\n * the new promise instance.\r\n */\r\nexport function _createRejectedPromise(newPromise) {\r\n return function (reason) {\r\n var additionalArgs = arrSlice(arguments, 1);\r\n return newPromise(function (_resolve, reject) {\r\n reject(reason);\r\n }, additionalArgs);\r\n };\r\n}\r\n//# sourceMappingURL=base.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { createAsyncPromise } from \"./asyncPromise\";\r\nimport { _createAllPromise, _createRejectedPromise, _createResolvedPromise } from \"./base\";\r\nimport { STRING_STATES } from \"../internal/state\";\r\nimport { dumpObj, lazySafeGetInst, isFunction, objDefineProp, throwTypeError } from \"@nevware21/ts-utils\";\r\nimport { STR_PROMISE } from \"../internal/constants\";\r\nvar _isPromiseSupported;\r\n/**\r\n * Creates a Promise instance that when resolved or rejected will execute it's pending chained operations using the\r\n * available native Promise implementation.\r\n * If runtime does not support native `Promise` class (or no polyfill is available) this function will fallback to using\r\n * `createAsyncPromise` which will resolve them __asynchronously__ using the optional provided timeout value to\r\n * schedule when the chained items will be executed.\r\n * @group Alias\r\n * @group Promise\r\n * @group Native\r\n * @param executor - The function to be executed during the creation of the promise. Any errors thrown in the executor will\r\n * cause the promise to be rejected. The return value of the executor is always ignored\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport function createNativePromise(executor, timeout) {\r\n !_isPromiseSupported && (_isPromiseSupported = lazySafeGetInst(STR_PROMISE));\r\n var PrmCls = _isPromiseSupported.v;\r\n if (!PrmCls) {\r\n return createAsyncPromise(executor);\r\n }\r\n if (!isFunction(executor)) {\r\n throwTypeError(STR_PROMISE + \": executor is not a function - \" + dumpObj(executor));\r\n }\r\n var _state = 0 /* ePromiseState.Pending */;\r\n function _strState() {\r\n return STRING_STATES[_state];\r\n }\r\n var thePromise = new PrmCls(function (resolve, reject) {\r\n function _resolve(value) {\r\n _state = 2 /* ePromiseState.Resolved */;\r\n resolve(value);\r\n }\r\n function _reject(reason) {\r\n _state = 3 /* ePromiseState.Rejected */;\r\n reject(reason);\r\n }\r\n executor(_resolve, _reject);\r\n });\r\n objDefineProp(thePromise, \"state\", {\r\n get: _strState\r\n });\r\n return thePromise;\r\n}\r\n/**\r\n * Returns a single asynchronous Promise instance that resolves to an array of the results from the input promises.\r\n * This returned promise will resolve and execute it's pending chained operations __asynchronously__ using the optional\r\n * provided timeout value to schedule when the chained items will be executed, or if the input contains no promises.\r\n * It rejects immediately upon any of the input promises rejected or non-promises throwing an error,\r\n * and will reject with this first rejection message / error.\r\n * If the runtime doesn't support the Promise.all it will fallback back to an asynchronous Promise implementation.\r\n * @group Alias\r\n * @group All\r\n * @group Native\r\n * @param input - The array of promises to wait to be resolved / rejected before resolving or rejecting the new promise\r\n * @param timeout\r\n * @returns\r\n *
    \r\n *
  • An already resolved `Promise`, if the input passed is empty.\r\n *
  • A pending `Promise` in all other cases. This returned promise is then resolved/rejected __synchronously__\r\n * (as soon as the pending items is empty) when all the promises in the given input have resolved, or if any of the\r\n * promises reject.\r\n *
\r\n */\r\nexport var createNativeAllPromise = _createAllPromise(createNativePromise);\r\n/**\r\n * Returns a single asynchronous Promise instance that is already resolved with the given value. If the value passed is\r\n * a promise then that promise is returned instead of creating a new asynchronous promise instance.\r\n * If a new instance is returned then any chained operations will execute __asynchronously__ using the optional\r\n * timeout value to schedule when the chained items will be executed.(eg. `then()`; `finally()`).\r\n * @group Alias\r\n * @group Resolved\r\n * @group Native\r\n * @param value - The value to be used by this `Promise`. Can also be a `Promise` or a thenable to resolve.\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport var createNativeResolvedPromise = _createResolvedPromise(createNativePromise);\r\n/**\r\n * Returns a single asynchronous Promise instance that is already rejected with the given reason.\r\n * Any chained operations will execute __asynchronously__ using the optional timeout value to schedule\r\n * when then chained items will be executed. (eg. `catch()`; `finally()`).\r\n * @group Alias\r\n * @group Rejected\r\n * @group Native\r\n * @param reason - The rejection reason\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport var createNativeRejectedPromise = _createRejectedPromise(createNativePromise);\r\n//# sourceMappingURL=nativePromise.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { getLazy } from \"@nevware21/ts-utils\";\r\nimport { _createAllPromise, _createRejectedPromise, _createResolvedPromise } from \"./base\";\r\nimport { createNativePromise } from \"./nativePromise\";\r\nvar _promiseCreator;\r\n/**\r\n * Set the default promise implementation to use when calling `createPromise`; `createAllPromise`; `createResolvedPromise`\r\n * and `createRejectedPromise`. This is effective a global value and changing this will affect ALL callers of these\r\n * functions, as such these functions should only be used when switching implementations would have not unexpected\r\n * consequences like switching from a `createSyncPromise` to `createIdlePromise` where idle promises have a possibility\r\n * of never getting called during application shutdown or during an expected timeframe.\r\n * @group Alias\r\n * @group Promise\r\n * @param creator - The creator function to call when a new promise is required.\r\n */\r\nexport function setCreatePromiseImpl(creator) {\r\n _promiseCreator = creator ? getLazy(function () { return creator; }) : null;\r\n}\r\n/**\r\n * Creates a Promise instance using the current default promise creator that when resolved or rejected will execute\r\n * it's pending chained operations.\r\n * @group Alias\r\n * @group Promise\r\n * @param executor - The function to be executed during the creation of the promise. Any errors thrown in the executor will\r\n * cause the promise to be rejected. The return value of the executor is always ignored\r\n * @param timeout - [Optional] timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport function createPromise(executor, timeout) {\r\n !_promiseCreator && (_promiseCreator = getLazy(function () { return createNativePromise; }));\r\n return _promiseCreator.v.call(this, executor, timeout);\r\n}\r\n/**\r\n * Returns a single asynchronous Promise instance that resolves to an array of the results from the input promises.\r\n * This returned promise will resolve and execute it's pending chained operations __asynchronously__ using the optional\r\n * provided timeout value to schedule when the chained items will be executed, or if the input contains no promises.\r\n * It rejects immediately upon any of the input promises rejected or non-promises throwing an error,\r\n * and will reject with this first rejection message / error.\r\n * If the runtime doesn't support the Promise.all it will fallback back to an asynchronous Promise implementation.\r\n * @group Alias\r\n * @group All\r\n * @param input - The array of promises to wait to be resolved / rejected before resolving or rejecting the new promise\r\n * @param timeout\r\n * @returns\r\n *
    \r\n *
  • An already resolved `Promise`, if the input passed is empty.\r\n *
  • A pending `Promise` in all other cases. This returned promise is then resolved/rejected __synchronously__\r\n * (as soon as the pending items is empty) when all the promises in the given input have resolved, or if any of the\r\n * promises reject.\r\n *
\r\n */\r\nexport var createAllPromise = _createAllPromise(createPromise);\r\n/**\r\n * Returns a single asynchronous Promise instance that is already resolved with the given value. If the value passed is\r\n * a promise then that promise is returned instead of creating a new asynchronous promise instance.\r\n * If a new instance is returned then any chained operations will execute __asynchronously__ using the optional\r\n * timeout value to schedule when the chained items will be executed.(eg. `then()`; `finally()`).\r\n * @group Alias\r\n * @group Resolved\r\n * @param value - The value to be used by this `Promise`. Can also be a `Promise` or a thenable to resolve.\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport var createResolvedPromise = _createResolvedPromise(createPromise);\r\n/**\r\n * Returns a single asynchronous Promise instance that is already rejected with the given reason.\r\n * Any chained operations will execute __asynchronously__ using the optional timeout value to schedule\r\n * when then chained items will be executed. (eg. `catch()`; `finally()`).\r\n * @group Alias\r\n * @group Rejected\r\n * @param reason - The rejection reason\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport var createRejectedPromise = _createRejectedPromise(createPromise);\r\n//# sourceMappingURL=promise.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2023 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nexport var STR_PROMISE = \"Promise\";\r\n//# sourceMappingURL=constants.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { _createAllPromise, _createPromise, _createRejectedPromise, _createResolvedPromise } from \"./base\";\r\nimport { timeoutItemProcessor } from \"./itemProcessor\";\r\n/**\r\n * Creates an asynchronous Promise instance that when resolved or rejected will execute it's pending chained operations\r\n * __asynchronously__ using the optional provided timeout value to schedule when the chained items will be ececuted.\r\n * @group Async\r\n * @group Promise\r\n * @param executor - The function to be executed during the creation of the promise. Any errors thrown in the executor will\r\n * cause the promise to be rejected. The return value of the executor is always ignored\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport function createAsyncPromise(executor, timeout) {\r\n return _createPromise(createAsyncPromise, timeoutItemProcessor(timeout), executor, timeout);\r\n}\r\n/**\r\n * Returns a single asynchronous Promise instance that resolves to an array of the results from the input promises.\r\n * This returned promise will resolve and execute it's pending chained operations __asynchronously__ using the optional\r\n * provided timeout value to schedule when the chained items will be executed, or if the input contains no promises.\r\n * It rejects immediately upon any of the input promises rejected or non-promises throwing an error,\r\n * and will reject with this first rejection message / error.\r\n * When resolved or rejected any additional chained operations will execute __asynchronously__ using the optional\r\n * timeout value to schedul when the chained item will be executed (eg. `then()`; `catch()`; `finally()`).\r\n * @group Async\r\n * @group All\r\n * @param input - The array of promises to wait to be resolved / rejected before resolving or rejecting the new promise\r\n * @param timeout\r\n * @returns\r\n *
    \r\n *
  • An already resolved `Promise`, if the input passed is empty.\r\n *
  • A pending `Promise` in all other cases. This returned promise is then resolved/rejected __synchronously__\r\n * (as soon as the pending items is empty) when all the promises in the given input have resolved, or if any of the\r\n * promises reject.\r\n *
\r\n */\r\nexport var createAsyncAllPromise = _createAllPromise(createAsyncPromise);\r\n// /**\r\n// * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved\r\n// * or rejected.\r\n// * @param values An array of Promises.\r\n// * @returns A new Promise.\r\n// */\r\n// race(values: T): Promise>;\r\n//export const createAsyncRacePromise: (values: T): IPromise;\r\n/**\r\n * Returns a single asynchronous Promise instance that is already resolved with the given value. If the value passed is\r\n * a promise then that promise is returned instead of creating a new asynchronous promise instance.\r\n * If a new instance is returned then any chained operations will execute __asynchronously__ using the optional\r\n * timeout value to schedule when the chained items will be executed.(eg. `then()`; `finally()`).\r\n * @group Async\r\n * @group Resolved\r\n * @param value - The value to be used by this `Promise`. Can also be a `Promise` or a thenable to resolve.\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport var createAsyncResolvedPromise = _createResolvedPromise(createAsyncPromise);\r\n/**\r\n * Returns a single asynchronous Promise instance that is already rejected with the given reason.\r\n * Any chained operations will execute __asynchronously__ using the optional timeout value to schedule\r\n * when then chained items will be executed. (eg. `catch()`; `finally()`).\r\n * @group Async\r\n * @group Rejected\r\n * @param reason - The rejection reason\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n */\r\nexport var createAsyncRejectedPromise = _createRejectedPromise(createAsyncPromise);\r\n//# sourceMappingURL=asyncPromise.js.map","/*\r\n * @nevware21/ts-async\r\n * https://github.com/nevware21/ts-async\r\n *\r\n * Copyright (c) 2022 Nevware21\r\n * Licensed under the MIT license.\r\n */\r\nimport { arrForEach, isNumber, scheduleIdleCallback, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nvar _processPendingItems = function (pending) {\r\n arrForEach(pending, function (fn) {\r\n try {\r\n fn();\r\n }\r\n catch (e) {\r\n // Don't let 1 failing handler break all others\r\n // TODO: Add some form of error reporting (i.e. Call any registered JS error handler so the error is reported)\r\n }\r\n });\r\n};\r\n/**\r\n * @internal\r\n * @ignore\r\n * Return an item processor that processes all of the pending items synchronously\r\n * @return An item processor\r\n */\r\nexport function syncItemProcessor() {\r\n return _processPendingItems;\r\n}\r\n/**\r\n * @internal\r\n * @ignore\r\n * Return an item processor that processes all of the pending items asynchronously using the optional timeout.\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n * @return An item processor\r\n */\r\nexport function timeoutItemProcessor(timeout) {\r\n var callbackTimeout = isNumber(timeout) ? timeout : 0;\r\n return function (pending) {\r\n scheduleTimeout(function () {\r\n _processPendingItems(pending);\r\n }, callbackTimeout);\r\n };\r\n}\r\n/**\r\n * @internal\r\n * @ignore\r\n * Return an item processor that processes all of the pending items using an idle callback (if available) or based on\r\n * a timeout (when `requestIdenCallback` is not supported) using the optional timeout.\r\n * @param timeout - Optional timeout to wait before processing the items, defaults to zero.\r\n * @return An item processor\r\n */\r\nexport function idleItemProcessor(timeout) {\r\n var options;\r\n if (timeout >= 0) {\r\n options = {\r\n timeout: +timeout\r\n };\r\n }\r\n return function (pending) {\r\n scheduleIdleCallback(function (deadline) {\r\n _processPendingItems(pending);\r\n }, options);\r\n };\r\n}\r\n//# sourceMappingURL=itemProcessor.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n// ###################################################################################################################################################\r\n// Note: DON'T Export these const from the package as we are still targeting IE/ES5 this will export a mutable variables that someone could change ###\r\n// ###################################################################################################################################################\r\nexport var UNDEFINED_VALUE = undefined;\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_CHANNELS = \"channels\";\r\nexport var STR_CORE = \"core\";\r\nexport var STR_CREATE_PERF_MGR = \"createPerfMgr\";\r\nexport var STR_DISABLED = \"disabled\";\r\nexport var STR_EXTENSION_CONFIG = \"extensionConfig\";\r\nexport var STR_EXTENSIONS = \"extensions\";\r\nexport var STR_PROCESS_TELEMETRY = \"processTelemetry\";\r\nexport var STR_PRIORITY = \"priority\";\r\nexport var STR_EVENTS_SENT = \"eventsSent\";\r\nexport var STR_EVENTS_DISCARDED = \"eventsDiscarded\";\r\nexport var STR_EVENTS_SEND_REQUEST = \"eventsSendRequest\";\r\nexport var STR_PERF_EVENT = \"perfEvent\";\r\nexport var STR_GET_PERF_MGR = \"getPerfMgr\";\r\nexport var STR_DOMAIN = \"domain\";\r\nexport var STR_PATH = \"path\";\r\nexport var STR_NOT_DYNAMIC_ERROR = \"Not dynamic - \";\r\n//# sourceMappingURL=InternalConstants.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { ObjAssign, ObjClass } from \"@microsoft/applicationinsights-shims\";\r\nimport { arrForEach, asString as asString21, isArray, isBoolean, isError, isFunction, isNullOrUndefined, isObject, isPlainObject, isString, isUndefined, objDeepFreeze, objDefine, objForEachKey, objHasOwn, strIndexOf } from \"@nevware21/ts-utils\";\r\nimport { _DYN_APPLY, _DYN_LENGTH, _DYN_NAME, _DYN_REPLACE } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// RESTRICT and AVOID circular dependencies you should not import other contained modules or export the contents of this file directly\r\n// Added to help with minification\r\nvar strGetPrototypeOf = \"getPrototypeOf\";\r\nvar rCamelCase = /-([a-z])/g;\r\nvar rNormalizeInvalid = /([^\\w\\d_$])/g;\r\nvar rLeadingNumeric = /^(\\d+[\\w\\d_$])/;\r\nexport var _getObjProto = Object[strGetPrototypeOf];\r\nexport function isNotUndefined(value) {\r\n return !isUndefined(value);\r\n}\r\nexport function isNotNullOrUndefined(value) {\r\n return !isNullOrUndefined(value);\r\n}\r\n/**\r\n * Validates that the string name conforms to the JS IdentifierName specification and if not\r\n * normalizes the name so that it would. This method does not identify or change any keywords\r\n * meaning that if you pass in a known keyword the same value will be returned.\r\n * This is a simplified version\r\n * @param name - The name to validate\r\n */\r\nexport function normalizeJsName(name) {\r\n var value = name;\r\n if (value && isString(value)) {\r\n // CamelCase everything after the \"-\" and remove the dash\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rCamelCase, function (_all, letter) {\r\n return letter.toUpperCase();\r\n });\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rNormalizeInvalid, \"_\");\r\n value = value[_DYN_REPLACE /* @min:%2ereplace */](rLeadingNumeric, function (_all, match) {\r\n return \"_\" + match;\r\n });\r\n }\r\n return value;\r\n}\r\n/**\r\n * 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 strIndexOf(value, search) !== -1;\r\n }\r\n return false;\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 return date && date.toISOString() || \"\";\r\n}\r\nexport var deepFreeze = objDeepFreeze;\r\n/**\r\n * Returns the name of object if it's an Error. Otherwise, returns empty string.\r\n */\r\nexport function getExceptionName(object) {\r\n if (isError(object)) {\r\n return object[_DYN_NAME /* @min:%2ename */];\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Sets the provided value on the target instance using the field name when the provided chk function returns true, the chk\r\n * function will only be called if the new value is no equal to the original value.\r\n * @param target - The target object\r\n * @param field - The key of the target\r\n * @param value - The value to set\r\n * @param valChk - [Optional] Callback to check the value that if supplied will be called check if the new value can be set\r\n * @param srcChk - [Optional] Callback to check to original value that if supplied will be called if the new value should be set (if allowed)\r\n * @returns The existing or new value, depending what was set\r\n */\r\nexport function setValue(target, field, value, valChk, srcChk) {\r\n var theValue = value;\r\n if (target) {\r\n theValue = target[field];\r\n if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {\r\n theValue = value;\r\n target[field] = theValue;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Returns the current value from the target object if not null or undefined otherwise sets the new value and returns it\r\n * @param target - The target object to return or set the default value\r\n * @param field - The key for the field to set on the target\r\n * @param defValue - [Optional] The value to set if not already present, when not provided a empty object will be added\r\n */\r\nexport function getSetValue(target, field, defValue) {\r\n var theValue;\r\n if (target) {\r\n theValue = target[field];\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n // Supports having the default as null\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n target[field] = theValue;\r\n }\r\n }\r\n else {\r\n // Expanded for performance so we only check defValue if required\r\n theValue = !isUndefined(defValue) ? defValue : {};\r\n }\r\n return theValue;\r\n}\r\nfunction _createProxyFunction(source, funcName) {\r\n var srcFunc = null;\r\n var src = null;\r\n if (isFunction(source)) {\r\n srcFunc = source;\r\n }\r\n else {\r\n src = source;\r\n }\r\n return function () {\r\n // Capture the original arguments passed to the method\r\n var originalArguments = arguments;\r\n if (srcFunc) {\r\n src = srcFunc();\r\n }\r\n if (src) {\r\n return src[funcName][_DYN_APPLY /* @min:%2eapply */](src, originalArguments);\r\n }\r\n };\r\n}\r\n/**\r\n * Effectively assigns all enumerable properties (not just own properties) and functions (including inherited prototype) from\r\n * the source object to the target, it attempts to use proxy getters / setters (if possible) and proxy functions to avoid potential\r\n * implementation issues by assigning prototype functions as instance ones\r\n *\r\n * This method is the primary method used to \"update\" the snippet proxy with the ultimate implementations.\r\n *\r\n * Special ES3 Notes:\r\n * Updates (setting) of direct property values on the target or indirectly on the source object WILL NOT WORK PROPERLY, updates to the\r\n * properties of \"referenced\" object will work (target.context.newValue = 10 => will be reflected in the source.context as it's the\r\n * same object). ES3 Failures: assigning target.myProp = 3 -> Won't change source.myProp = 3, likewise the reverse would also fail.\r\n * @param target - The target object to be assigned with the source properties and functions\r\n * @param source - The source object which will be assigned / called by setting / calling the targets proxies\r\n * @param chkSet - An optional callback to determine whether a specific property/function should be proxied\r\n */\r\nexport function proxyAssign(target, source, chkSet) {\r\n if (target && source && isObject(target) && isObject(source)) {\r\n var _loop_1 = function (field) {\r\n if (isString(field)) {\r\n var value = source[field];\r\n if (isFunction(value)) {\r\n if (!chkSet || chkSet(field, true, source, target)) {\r\n // Create a proxy function rather than just copying the (possible) prototype to the new object as an instance function\r\n target[field] = _createProxyFunction(source, field);\r\n }\r\n }\r\n else if (!chkSet || chkSet(field, false, source, target)) {\r\n if (objHasOwn(target, field)) {\r\n // Remove any previous instance property\r\n delete target[field];\r\n }\r\n objDefine(target, field, {\r\n g: function () {\r\n return source[field];\r\n },\r\n s: function (theValue) {\r\n source[field] = theValue;\r\n }\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 = this;\r\n if (defaults) {\r\n objForEachKey(defaults, function (field, value) {\r\n _this[field] = value;\r\n });\r\n }\r\n }\r\n return class_1;\r\n }());\r\n}\r\n/**\r\n * A helper function to assist with JIT performance for objects that have properties added / removed dynamically\r\n * this is primarily for chromium based browsers and has limited effects on Firefox and none of IE. Only call this\r\n * function after you have finished \"updating\" the object, calling this within loops reduces or defeats the benefits.\r\n * This helps when iterating using for..in, objKeys() and objForEach()\r\n * @param theObject - The object to be optimized if possible\r\n */\r\nexport function optimizeObject(theObject) {\r\n // V8 Optimization to cause the JIT compiler to create a new optimized object for looking up the own properties\r\n // primarily for object with <= 19 properties for >= 20 the effect is reduced or non-existent\r\n if (theObject && ObjAssign) {\r\n theObject = ObjClass(ObjAssign({}, theObject));\r\n }\r\n return theObject;\r\n}\r\nexport function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {\r\n // Variables\r\n var theArgs = arguments;\r\n var extended = theArgs[0] || {};\r\n var argLen = theArgs[_DYN_LENGTH /* @min:%2elength */];\r\n var deep = false;\r\n var idx = 1;\r\n // Check for \"Deep\" flag\r\n if (argLen > 0 && isBoolean(extended)) {\r\n deep = extended;\r\n extended = theArgs[idx] || {};\r\n idx++;\r\n }\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if (!isObject(extended)) {\r\n extended = {};\r\n }\r\n // Loop through each remaining object and conduct a merge\r\n for (; idx < argLen; idx++) {\r\n var arg = theArgs[idx];\r\n var isArgArray = isArray(arg);\r\n var isArgObj = isObject(arg);\r\n for (var prop in arg) {\r\n var propOk = (isArgArray && (prop in arg)) || (isArgObj && objHasOwn(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\nexport var asString = asString21;\r\nexport function isFeatureEnabled(feature, cfg) {\r\n var rlt = false;\r\n var ft = cfg && cfg.featureOptIn && cfg.featureOptIn[feature];\r\n if (feature && ft) {\r\n var mode = ft.mode;\r\n // NOTE: None will be considered as true\r\n rlt = (mode == 3 /* FeatureOptInMode.enable */) || (mode == 1 /* FeatureOptInMode.none */);\r\n }\r\n return rlt;\r\n}\r\n//# sourceMappingURL=HelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { getGlobal, strShimObject, strShimPrototype, strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { getDocument, getInst, getNavigator, getPerformance, hasNavigator, isFunction, isString, isUndefined, strIndexOf } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH, _DYN_NAME, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_USER_AGENT } from \"../__DynamicConstants\";\r\nimport { strContains } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n/**\r\n * This file exists to hold environment utilities that are required to check and\r\n * validate the current operating environment. Unless otherwise required, please\r\n * only use defined methods (functions) in this class so that users of these\r\n * functions/properties only need to include those that are used within their own modules.\r\n */\r\nvar strDocumentMode = \"documentMode\";\r\nvar strLocation = \"location\";\r\nvar strConsole = \"console\";\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 * 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 = getInst(\"__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 getInst(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 getInst(strConsole);\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) || getInst(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 || getInst(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 getInst(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 getInst(strMsCrypto);\r\n}\r\n/**\r\n * Returns whether the environment is reporting that we are running in a React Native Environment\r\n */\r\nexport function isReactNative() {\r\n // If running in React Native, navigator.product will be populated\r\n var nav = getNavigator();\r\n if (nav && nav.product) {\r\n return nav.product === strReactNative;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Identifies whether the current environment appears to be IE\r\n */\r\nexport function isIE() {\r\n var nav = getNavigator();\r\n if (nav && (nav[_DYN_USER_AGENT /* @min:%2euserAgent */] !== _navUserAgentCheck || _isTrident === null)) {\r\n // Added to support test mocking of the user agent\r\n _navUserAgentCheck = nav[_DYN_USER_AGENT /* @min:%2euserAgent */];\r\n var userAgent = (_navUserAgentCheck || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));\r\n }\r\n return _isTrident;\r\n}\r\n/**\r\n * Gets IE version returning the document emulation mode if we are running on IE, or null otherwise\r\n */\r\nexport function getIEVersion(userAgentStr) {\r\n if (userAgentStr === void 0) { userAgentStr = null; }\r\n if (!userAgentStr) {\r\n var navigator_1 = getNavigator() || {};\r\n userAgentStr = navigator_1 ? (navigator_1.userAgent || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() : STR_EMPTY;\r\n }\r\n var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n // Also check for documentMode in case X-UA-Compatible meta tag was included in HTML.\r\n if (strContains(ua, strMsie)) {\r\n var doc = getDocument() || {};\r\n return Math.max(parseInt(ua[_DYN_SPLIT /* @min:%2esplit */](strMsie)[1]), (doc[strDocumentMode] || 0));\r\n }\r\n else if (strContains(ua, strTrident)) {\r\n var tridentVer = parseInt(ua[_DYN_SPLIT /* @min:%2esplit */](strTrident)[1]);\r\n if (tridentVer) {\r\n return tridentVer + 4;\r\n }\r\n }\r\n return null;\r\n}\r\nexport function isSafari(userAgentStr) {\r\n if (!userAgentStr || !isString(userAgentStr)) {\r\n var navigator_2 = getNavigator() || {};\r\n userAgentStr = navigator_2 ? (navigator_2.userAgent || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() : STR_EMPTY;\r\n }\r\n var ua = (userAgentStr || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n return (strIndexOf(ua, \"safari\") >= 0);\r\n}\r\n/**\r\n * Checks if HTML5 Beacons are supported in the current environment.\r\n * @param useCached - [Optional] used for testing to bypass the cached lookup, when `true` this will\r\n * cause the cached global to be reset.\r\n * @returns True if supported, false otherwise.\r\n */\r\nexport function isBeaconsSupported(useCached) {\r\n if (_beaconsSupported === null || useCached === false) {\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 = !!getInst(\"fetch\");\r\n var request = getInst(\"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(getInst(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 = getInst(strXMLHttpRequest);\r\n isSupported = !!xmlHttpRequest;\r\n }\r\n catch (e) {\r\n // Just Swallow any failure during availability checks\r\n }\r\n return isSupported;\r\n}\r\nfunction _getNamedValue(values, name) {\r\n if (values) {\r\n for (var i = 0; i < values[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var value = values[i];\r\n if (value[_DYN_NAME /* @min:%2ename */]) {\r\n if (value[_DYN_NAME /* @min:%2ename */] === name) {\r\n return value;\r\n }\r\n }\r\n }\r\n }\r\n return {};\r\n}\r\n/**\r\n * Helper function to fetch the named meta-tag from the page.\r\n * @param name\r\n */\r\nexport function findMetaTag(name) {\r\n var doc = getDocument();\r\n if (doc && name) {\r\n // Look for a meta-tag\r\n return _getNamedValue(doc.querySelectorAll(\"meta\"), name).content;\r\n }\r\n return null;\r\n}\r\n/**\r\n * Helper function to fetch the named server timing value from the page response (first navigation event).\r\n * @param name\r\n */\r\nexport function findNamedServerTiming(name) {\r\n var value;\r\n var perf = getPerformance();\r\n if (perf) {\r\n // Try looking for a server-timing header\r\n var navPerf = perf.getEntriesByType(\"navigation\") || [];\r\n value = _getNamedValue((navPerf[_DYN_LENGTH /* @min:%2elength */] > 0 ? navPerf[0] : {}).serverTiming, name).description;\r\n }\r\n return value;\r\n}\r\n// TODO: should reuse this method for analytics plugin\r\nexport function dispatchEvent(target, evnt) {\r\n if (target && target.dispatchEvent && evnt) {\r\n target.dispatchEvent(evnt);\r\n return true;\r\n }\r\n return false;\r\n}\r\nexport function createCustomDomEvent(eventName, details) {\r\n var event = null;\r\n var detail = { detail: details || null };\r\n if (isFunction(CustomEvent)) { // Use CustomEvent constructor when available\r\n event = new CustomEvent(eventName, detail);\r\n }\r\n else { // CustomEvent has no constructor in IE\r\n var doc = getDocument();\r\n if (doc && doc.createEvent) {\r\n event = doc.createEvent(\"CustomEvent\");\r\n event.initCustomEvent(eventName, true, true, detail);\r\n }\r\n }\r\n return event;\r\n}\r\nexport function sendCustomEvent(evtName, cfg, customDetails) {\r\n var global = getGlobal();\r\n if (global && global.CustomEvent) {\r\n try {\r\n var details = { cfg: cfg || null, customDetails: customDetails || null };\r\n return dispatchEvent(global, createCustomDomEvent(evtName, details));\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=EnvUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { utcNow } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { getCrypto, getMsCrypto, isIE } from \"./EnvUtils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nvar UInt32Mask = 0x100000000;\r\nvar MaxUInt32 = 0xffffffff;\r\nvar SEED1 = 123456789;\r\nvar SEED2 = 987654321;\r\n// MWC based Random generator (for IE)\r\nvar _mwcSeeded = false;\r\nvar _mwcW = SEED1;\r\nvar _mwcZ = SEED2;\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 = (SEED1 + seedValue) & MaxUInt32;\r\n _mwcZ = (SEED2 - 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 = utcNow() & 0x7fffffff;\r\n _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);\r\n }\r\n catch (e) {\r\n // Don't crash if something goes wrong\r\n }\r\n}\r\n/**\r\n * Generate a random value between 0 and maxValue, max value should be limited to a 32-bit maximum.\r\n * So maxValue(16) will produce a number from 0..16 (range of 17)\r\n * @param maxValue\r\n */\r\nexport function randomValue(maxValue) {\r\n if (maxValue > 0) {\r\n return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;\r\n }\r\n return 0;\r\n}\r\n/**\r\n * generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function random32(signed) {\r\n var value = 0;\r\n var c = getCrypto() || getMsCrypto();\r\n if (c && c.getRandomValues) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;\r\n }\r\n if (value === 0 && isIE()) {\r\n // For IE 6, 7, 8 (especially on XP) Math.random is not very random\r\n if (!_mwcSeeded) {\r\n // Set the seed for the Mwc algorithm\r\n _autoSeedMwc();\r\n }\r\n // Don't use Math.random for IE\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = mwcRandom32() & MaxUInt32;\r\n }\r\n if (value === 0) {\r\n // Make sure the number is converted into the specified range (-0x80000000..0x7FFFFFFF)\r\n value = Math.floor((UInt32Mask * Math.random()) | 0);\r\n }\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Seed the MWC random number generator with the specified seed or a random value\r\n * @param value - optional the number to used as the seed, if undefined, null or zero a random value will be chosen\r\n */\r\nexport function mwcRandomSeed(value) {\r\n if (!value) {\r\n _autoSeedMwc();\r\n }\r\n else {\r\n _mwcSeed(value);\r\n }\r\n}\r\n/**\r\n * Generate a random 32-bit number between (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), using MWC (Multiply with carry)\r\n * instead of Math.random() defaults to un-signed.\r\n * Used as a replacement random generator for IE to avoid issues with older IE instances.\r\n * @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)\r\n */\r\nexport function mwcRandom32(signed) {\r\n _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;\r\n _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;\r\n var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;\r\n if (!signed) {\r\n // Make sure we end up with a positive number and not -ve one.\r\n value >>>= 0;\r\n }\r\n return value;\r\n}\r\n/**\r\n * Generate random base64 id string.\r\n * The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)\r\n * @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22\r\n */\r\nexport function newId(maxLength) {\r\n if (maxLength === void 0) { maxLength = 22; }\r\n var base64chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\r\n // Start with an initial random number, consuming the value in reverse byte order\r\n var number = random32() >>> 0; // Make sure it's a +ve number\r\n var chars = 0;\r\n var result = STR_EMPTY;\r\n while (result[_DYN_LENGTH /* @min:%2elength */] < maxLength) {\r\n chars++;\r\n result += base64chars.charAt(number & 0x3F);\r\n number >>>= 6; // Zero fill with right shift\r\n if (chars === 5) {\r\n // 5 base64 characters === 30 bits so we don't have enough bits for another base64 char\r\n // So add on another 30 bits and make sure it's +ve\r\n number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;\r\n chars = 0; // We need to reset the number every 5 chars (30 bits)\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=RandomHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { objDefine } from \"@nevware21/ts-utils\";\r\nimport { _DYN_NODE_TYPE } from \"../__DynamicConstants\";\r\nimport { normalizeJsName } from \"./HelperFuncs\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { newId } from \"./RandomHelper\";\r\nvar version = '3.0.3';\r\nvar instanceName = \".\" + newId(6);\r\nvar _dataUid = 0;\r\n// Accepts only:\r\n// - Node\r\n// - Node.ELEMENT_NODE\r\n// - Node.DOCUMENT_NODE\r\n// - Object\r\n// - Any\r\nfunction _canAcceptData(target) {\r\n return target[_DYN_NODE_TYPE /* @min:%2enodeType */] === 1 || target[_DYN_NODE_TYPE /* @min:%2enodeType */] === 9 || !(+target[_DYN_NODE_TYPE /* @min:%2enodeType */]);\r\n}\r\nfunction _getCache(data, target) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n theCache = {};\r\n try {\r\n if (_canAcceptData(target)) {\r\n objDefine(target, data.id, {\r\n e: false,\r\n v: theCache\r\n });\r\n }\r\n }\r\n catch (e) {\r\n // Not all environments allow extending all objects, so just ignore the cache in those cases\r\n }\r\n }\r\n return theCache;\r\n}\r\nexport function createUniqueNamespace(name, includeVersion) {\r\n if (includeVersion === void 0) { includeVersion = false; }\r\n return normalizeJsName(name + (_dataUid++) + (includeVersion ? \".\" + version : STR_EMPTY) + instanceName);\r\n}\r\nexport function createElmNodeData(name) {\r\n var data = {\r\n id: createUniqueNamespace(\"_aiData-\" + (name || STR_EMPTY) + \".\" + version),\r\n accept: function (target) {\r\n return _canAcceptData(target);\r\n },\r\n get: function (target, name, defValue, addDefault) {\r\n var theCache = target[data.id];\r\n if (!theCache) {\r\n if (addDefault) {\r\n // Side effect is adds the cache\r\n theCache = _getCache(data, target);\r\n theCache[normalizeJsName(name)] = defValue;\r\n }\r\n return defValue;\r\n }\r\n return theCache[normalizeJsName(name)];\r\n },\r\n kill: function (target, name) {\r\n if (target && target[name]) {\r\n try {\r\n delete target[name];\r\n }\r\n catch (e) {\r\n // Just cleaning up, so if this fails -- ignore\r\n }\r\n }\r\n }\r\n };\r\n return data;\r\n}\r\n//# sourceMappingURL=DataCacheHelper.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { asString, isArray, isDefined, isNullOrUndefined, isObject, isPlainObject, isUndefined, objForEachKey, objHasOwn } from \"@nevware21/ts-utils\";\r\nimport { _DYN_BLK_VAL, _DYN_LENGTH, _DYN_RD_ONLY } from \"../__DynamicConstants\";\r\nfunction _isConfigDefaults(value) {\r\n return (value && isObject(value) && (value.isVal || value.fb || objHasOwn(value, \"v\") || objHasOwn(value, \"mrg\") || objHasOwn(value, \"ref\") || value.set));\r\n}\r\nfunction _getDefault(dynamicHandler, theConfig, cfgDefaults) {\r\n var defValue;\r\n var isDefaultValid = cfgDefaults.dfVal || isDefined;\r\n // There is a fallback config key so try and grab that first\r\n if (theConfig && cfgDefaults.fb) {\r\n var fallbacks = cfgDefaults.fb;\r\n if (!isArray(fallbacks)) {\r\n fallbacks = [fallbacks];\r\n }\r\n for (var lp = 0; lp < fallbacks[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var fallback = fallbacks[lp];\r\n var fbValue = theConfig[fallback];\r\n if (isDefaultValid(fbValue)) {\r\n defValue = fbValue;\r\n }\r\n else if (dynamicHandler) {\r\n // Needed to ensure that the fallback value (and potentially) new field is also dynamic even if null/undefined\r\n fbValue = dynamicHandler.cfg[fallback];\r\n if (isDefaultValid(fbValue)) {\r\n defValue = fbValue;\r\n }\r\n // Needed to ensure that the fallback value (and potentially) new field is also dynamic even if null/undefined\r\n dynamicHandler.set(dynamicHandler.cfg, asString(fallback), fbValue);\r\n }\r\n if (isDefaultValid(defValue)) {\r\n // We have a valid default so break out of the look\r\n break;\r\n }\r\n }\r\n }\r\n // If the value is still not defined and we have a default value then use that\r\n if (!isDefaultValid(defValue) && isDefaultValid(cfgDefaults.v)) {\r\n defValue = cfgDefaults.v;\r\n }\r\n return defValue;\r\n}\r\n/**\r\n * Recursively resolve the default value\r\n * @param dynamicHandler\r\n * @param theConfig\r\n * @param cfgDefaults\r\n * @returns\r\n */\r\nfunction _resolveDefaultValue(dynamicHandler, theConfig, cfgDefaults) {\r\n var theValue = cfgDefaults;\r\n if (cfgDefaults && _isConfigDefaults(cfgDefaults)) {\r\n theValue = _getDefault(dynamicHandler, theConfig, cfgDefaults);\r\n }\r\n if (theValue) {\r\n if (_isConfigDefaults(theValue)) {\r\n theValue = _resolveDefaultValue(dynamicHandler, theConfig, theValue);\r\n }\r\n var newValue_1;\r\n if (isArray(theValue)) {\r\n newValue_1 = [];\r\n newValue_1[_DYN_LENGTH /* @min:%2elength */] = theValue[_DYN_LENGTH /* @min:%2elength */];\r\n }\r\n else if (isPlainObject(theValue)) {\r\n newValue_1 = {};\r\n }\r\n if (newValue_1) {\r\n objForEachKey(theValue, function (key, value) {\r\n if (value && _isConfigDefaults(value)) {\r\n value = _resolveDefaultValue(dynamicHandler, theConfig, value);\r\n }\r\n newValue_1[key] = value;\r\n });\r\n theValue = newValue_1;\r\n }\r\n }\r\n return theValue;\r\n}\r\n/**\r\n * Applies the default value on the config property and makes sure that it's dynamic\r\n * @param theConfig\r\n * @param name\r\n * @param defaultValue\r\n */\r\nexport function _applyDefaultValue(dynamicHandler, theConfig, name, defaultValue) {\r\n // Resolve the initial config value from the provided value or use the defined default\r\n var isValid;\r\n var setFn;\r\n var defValue;\r\n var cfgDefaults = defaultValue;\r\n var mergeDf;\r\n var reference;\r\n var readOnly;\r\n var blkDynamicValue;\r\n if (_isConfigDefaults(cfgDefaults)) {\r\n // looks like a IConfigDefault\r\n isValid = cfgDefaults.isVal;\r\n setFn = cfgDefaults.set;\r\n readOnly = cfgDefaults[_DYN_RD_ONLY /* @min:%2erdOnly */];\r\n blkDynamicValue = cfgDefaults[_DYN_BLK_VAL /* @min:%2eblkVal */];\r\n mergeDf = cfgDefaults.mrg;\r\n reference = cfgDefaults.ref;\r\n if (!reference && isUndefined(reference)) {\r\n reference = !!mergeDf;\r\n }\r\n defValue = _getDefault(dynamicHandler, theConfig, cfgDefaults);\r\n }\r\n else {\r\n defValue = defaultValue;\r\n }\r\n if (blkDynamicValue) {\r\n // Mark the property so that any value assigned will be blocked from conversion, we need to do this\r\n // before assigning or fetching the value to ensure it's not converted\r\n dynamicHandler[_DYN_BLK_VAL /* @min:%2eblkVal */](theConfig, name);\r\n }\r\n // Set the value to the default value;\r\n var theValue;\r\n var usingDefault = true;\r\n var cfgValue = theConfig[name];\r\n // try and get and user provided values\r\n if (cfgValue || !isNullOrUndefined(cfgValue)) {\r\n // Use the defined theConfig[name] value\r\n theValue = cfgValue;\r\n usingDefault = false;\r\n // The values are different and we have a special default value check, which is used to\r\n // override config values like empty strings to continue using the default\r\n if (isValid && theValue !== defValue && !isValid(theValue)) {\r\n theValue = defValue;\r\n usingDefault = true;\r\n }\r\n if (setFn) {\r\n theValue = setFn(theValue, defValue, theConfig);\r\n usingDefault = theValue === defValue;\r\n }\r\n }\r\n if (!usingDefault) {\r\n if (isPlainObject(theValue) || isArray(defValue)) {\r\n // we are using the user supplied value and it's an object\r\n if (mergeDf && defValue && (isPlainObject(defValue) || isArray(defValue))) {\r\n // Resolve/apply the defaults\r\n objForEachKey(defValue, function (dfName, dfValue) {\r\n // Sets the value and makes it dynamic (if it doesn't already exist)\r\n _applyDefaultValue(dynamicHandler, theValue, dfName, dfValue);\r\n });\r\n }\r\n }\r\n }\r\n else if (defValue) {\r\n // Just resolve the default\r\n theValue = _resolveDefaultValue(dynamicHandler, theConfig, defValue);\r\n }\r\n else {\r\n theValue = defValue;\r\n }\r\n // if (theValue && usingDefault && (isPlainObject(theValue) || isArray(theValue))) {\r\n // theValue = _cfgDeepCopy(theValue);\r\n // }\r\n // Needed to ensure that the (potentially) new field is dynamic even if null/undefined\r\n dynamicHandler.set(theConfig, name, theValue);\r\n if (reference) {\r\n dynamicHandler.ref(theConfig, name);\r\n }\r\n if (readOnly) {\r\n dynamicHandler[_DYN_RD_ONLY /* @min:%2erdOnly */](theConfig, name);\r\n }\r\n}\r\n//# sourceMappingURL=ConfigDefaults.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { isArray, isPlainObject, objForEachKey, symbolFor, throwTypeError } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\n// Using Symbol.for so that if the same symbol was already created it would be returned\r\n// To handle multiple instances using potentially different versions we are not using\r\n// createUniqueNamespace()\r\nexport var CFG_HANDLER_LINK = symbolFor(\"[[ai_dynCfg_1]]\");\r\n/**\r\n * @internal\r\n * @ignore\r\n * The symbol to tag objects / arrays with if they should not be converted\r\n */\r\nvar BLOCK_DYNAMIC = symbolFor(\"[[ai_blkDynCfg_1]]\");\r\n/**\r\n * @internal\r\n * @ignore\r\n * The symbol to tag objects to indicate that when included into the configuration that\r\n * they should be converted into a trackable dynamic object.\r\n */\r\nvar FORCE_DYNAMIC = symbolFor(\"[[ai_frcDynCfg_1]]\");\r\nexport function _cfgDeepCopy(source) {\r\n if (source) {\r\n var target_1;\r\n if (isArray(source)) {\r\n target_1 = [];\r\n target_1[_DYN_LENGTH /* @min:%2elength */] = source[_DYN_LENGTH /* @min:%2elength */];\r\n }\r\n else if (isPlainObject(source)) {\r\n target_1 = {};\r\n }\r\n if (target_1) {\r\n // Copying index values by property name as the extensionConfig can be an array or object\r\n objForEachKey(source, function (key, value) {\r\n // Perform a deep copy of the object\r\n target_1[key] = _cfgDeepCopy(value);\r\n });\r\n return target_1;\r\n }\r\n }\r\n return source;\r\n}\r\n/**\r\n * @internal\r\n * Get the dynamic config handler if the value is already dynamic\r\n * @param value\r\n * @returns\r\n */\r\nexport function getDynamicConfigHandler(value) {\r\n if (value) {\r\n var handler = value[CFG_HANDLER_LINK] || value;\r\n if (handler.cfg && (handler.cfg === value || handler.cfg[CFG_HANDLER_LINK] === handler)) {\r\n return handler;\r\n }\r\n }\r\n return null;\r\n}\r\n/**\r\n * Mark the provided value so that if it's included into the configuration it will NOT have\r\n * its properties converted into a dynamic (reactive) object. If the object is not a plain object\r\n * or an array (ie. a class) this function has not affect as only Objects and Arrays are converted\r\n * into dynamic objects in the dynamic configuration.\r\n *\r\n * When you have tagged a value as both {@link forceDynamicConversion} and blocked force will take precedence.\r\n *\r\n * You should only need to use this function, if you are creating dynamic \"classes\" from objects\r\n * which confirm to the require interface. A common case for this is during unit testing where it's\r\n * easier to create mock extensions.\r\n *\r\n * If `value` is falsy (null / undefined / 0 / empty string etc) it will not be tagged and\r\n * if there is an exception adding the property to the value (because its frozen etc) the\r\n * exception will be swallowed\r\n *\r\n * @example\r\n * ```ts\r\n * // This is a valid \"extension\", but it is technically an object\r\n * // So when included in the config.extensions it WILL be cloned and then\r\n * // converted into a dynamic object, where all of its properties will become\r\n * // get/set object properties and will be tracked. While this WILL still\r\n * // function, when attempt to use a mocking framework on top of this the\r\n * // functions are now technically get accessors which return a function\r\n * // and this can cause some mocking frameworks to fail.\r\n * let mockChannel = {\r\n * pause: () => { },\r\n* resume: () => { },\r\n* teardown: () => { },\r\n* flush: (async: any, callBack: any) => { },\r\n* processTelemetry: (env: any) => { },\r\n* setNextPlugin: (next: any) => { },\r\n* initialize: (config: any, core: any, extensions: any) => { },\r\n* identifier: \"testChannel\",\r\n* priority: 1003\r\n* };\r\n * ```\r\n * @param value - The object that you want to block from being converted into a\r\n * trackable dynamic object\r\n * @returns The original value\r\n */\r\nexport function blockDynamicConversion(value) {\r\n if (value && (isPlainObject(value) || isArray(value))) {\r\n try {\r\n value[BLOCK_DYNAMIC] = true;\r\n }\r\n catch (e) {\r\n // Don't throw for this case as it's an ask only\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * This is the reverse case of {@link blockDynamicConversion} in that this will tag an\r\n * object to indicate that it should always be converted into a dynamic trackable object\r\n * even when not an object or array. So all properties of this object will become\r\n * get / set accessor functions.\r\n *\r\n * When you have tagged a value as both {@link forceDynamicConversion} and blocked force will take precedence.\r\n *\r\n * If `value` is falsy (null / undefined / 0 / empty string etc) it will not be tagged and\r\n * if there is an exception adding the property to the value (because its frozen etc) the\r\n * exception will be swallowed.\r\n * @param value - The object that should be tagged and converted if included into a dynamic\r\n * configuration.\r\n * @returns The original value\r\n */\r\nexport function forceDynamicConversion(value) {\r\n if (value) {\r\n try {\r\n value[FORCE_DYNAMIC] = true;\r\n }\r\n catch (e) {\r\n // Don't throw for this case as it's an ask only\r\n }\r\n }\r\n return value;\r\n}\r\n/**\r\n * @internal\r\n * @ignore\r\n * Helper function to check whether an object can or should be converted into a dynamic\r\n * object.\r\n * @param value - The object to check whether it should be converted\r\n * @returns `true` if the value should be converted otherwise `false`.\r\n */\r\nexport function _canMakeDynamic(getFunc, state, value) {\r\n var result = false;\r\n // Object must exist and be truthy\r\n if (value && !getFunc[state.blkVal]) {\r\n // Tagged as always convert\r\n result = value[FORCE_DYNAMIC];\r\n // Check that it's not explicitly tagged as blocked\r\n if (!result && !value[BLOCK_DYNAMIC]) {\r\n // Only convert plain objects or arrays by default\r\n result = isPlainObject(value) || isArray(value);\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Throws an invalid access exception\r\n * @param message - The message to include in the exception\r\n */\r\nexport function throwInvalidAccess(message) {\r\n throwTypeError(\"InvalidAccess:\" + message);\r\n}\r\n//# sourceMappingURL=DynamicSupport.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, arrIndexOf, dumpObj, isArray, objDefine, objDefineProp, objForEachKey, objGetOwnPropertyDescriptor } from \"@nevware21/ts-utils\";\r\nimport { UNDEFINED_VALUE } from \"../JavaScriptSDK/InternalConstants\";\r\nimport { _DYN_APPLY, _DYN_HDLR, _DYN_LOGGER, _DYN_PUSH, _DYN_SPLICE, _DYN_THROW_INTERNAL } from \"../__DynamicConstants\";\r\nimport { CFG_HANDLER_LINK, _canMakeDynamic, blockDynamicConversion, throwInvalidAccess } from \"./DynamicSupport\";\r\nvar arrayMethodsToPatch = [\r\n \"push\",\r\n \"pop\",\r\n \"shift\",\r\n \"unshift\",\r\n \"splice\"\r\n];\r\nexport var _throwDynamicError = function (logger, name, desc, e) {\r\n logger && logger[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](3 /* eLoggingSeverity.DEBUG */, 108 /* _eInternalMessageId.DynamicConfigException */, \"\".concat(desc, \" [\").concat(name, \"] failed - \") + dumpObj(e));\r\n};\r\nfunction _patchArray(state, target, name) {\r\n if (isArray(target)) {\r\n // Monkey Patch the methods that might change the array\r\n arrForEach(arrayMethodsToPatch, function (method) {\r\n var orgMethod = target[method];\r\n target[method] = function () {\r\n var args = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n args[_i] = arguments[_i];\r\n }\r\n var result = orgMethod[_DYN_APPLY /* @min:%2eapply */](this, args);\r\n // items may be added, removed or moved so need to make some new dynamic properties\r\n _makeDynamicObject(state, target, name, \"Patching\");\r\n return result;\r\n };\r\n });\r\n }\r\n}\r\nfunction _getOwnPropGetter(target, name) {\r\n var propDesc = objGetOwnPropertyDescriptor(target, name);\r\n return propDesc && propDesc.get;\r\n}\r\nfunction _createDynamicProperty(state, theConfig, name, value) {\r\n // Does not appear to be dynamic so lets make it so\r\n var detail = {\r\n n: name,\r\n h: [],\r\n trk: function (handler) {\r\n if (handler && handler.fn) {\r\n if (arrIndexOf(detail.h, handler) === -1) {\r\n // Add this handler to the collection that should be notified when the value changes\r\n detail.h[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n state.trk(handler, detail);\r\n }\r\n },\r\n clr: function (handler) {\r\n var idx = arrIndexOf(detail.h, handler);\r\n if (idx !== -1) {\r\n detail.h[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n }\r\n }\r\n };\r\n // Flag to optimize lookup response time by avoiding additional function calls\r\n var checkDynamic = true;\r\n var isObjectOrArray = false;\r\n function _getProperty() {\r\n if (checkDynamic) {\r\n isObjectOrArray = isObjectOrArray || _canMakeDynamic(_getProperty, state, value);\r\n // Make sure that if it's an object that we make it dynamic\r\n if (value && !value[CFG_HANDLER_LINK] && isObjectOrArray) {\r\n // It doesn't look like it's already dynamic so lets make sure it's converted the object into a dynamic Config as well\r\n value = _makeDynamicObject(state, value, name, \"Converting\");\r\n }\r\n // If it needed to be converted it now has been\r\n checkDynamic = false;\r\n }\r\n // If there is an active handler then add it to the tracking set of handlers\r\n var activeHandler = state.act;\r\n if (activeHandler) {\r\n detail.trk(activeHandler);\r\n }\r\n return value;\r\n }\r\n // Tag this getter as our dynamic property and provide shortcut for notifying a change\r\n _getProperty[state.prop] = {\r\n chng: function () {\r\n state.add(detail);\r\n }\r\n };\r\n function _setProperty(newValue) {\r\n if (value !== newValue) {\r\n if (!!_getProperty[state.ro] && !state.upd) {\r\n // field is marked as readonly so return false\r\n throwInvalidAccess(\"[\" + name + \"] is read-only:\" + dumpObj(theConfig));\r\n }\r\n if (checkDynamic) {\r\n isObjectOrArray = isObjectOrArray || _canMakeDynamic(_getProperty, state, value);\r\n checkDynamic = false;\r\n }\r\n // The value must be a plain object or an array to enforce the reference (in-place updates)\r\n var isReferenced = isObjectOrArray && _getProperty[state.rf];\r\n if (isObjectOrArray) {\r\n // We are about to replace a plain object or an array\r\n if (isReferenced) {\r\n // Reassign the properties from the current value to the same properties from the newValue\r\n // This will set properties not in the newValue to undefined\r\n objForEachKey(value, function (key) {\r\n value[key] = newValue ? newValue[key] : UNDEFINED_VALUE;\r\n });\r\n // Now assign / re-assign value with all of the keys from newValue\r\n try {\r\n objForEachKey(newValue, function (key, theValue) {\r\n _setDynamicProperty(state, value, key, theValue);\r\n });\r\n // Now drop newValue so when we assign value later it keeps the existing reference\r\n newValue = value;\r\n }\r\n catch (e) {\r\n // Unable to convert to dynamic property so just leave as non-dynamic\r\n _throwDynamicError((state.hdlr || {})[_DYN_LOGGER /* @min:%2elogger */], name, \"Assigning\", e);\r\n // Mark as not an object or array so we don't try and do this again\r\n isObjectOrArray = false;\r\n }\r\n }\r\n else if (value && value[CFG_HANDLER_LINK]) {\r\n // As we are replacing the value, if it's already dynamic then we need to notify the listeners\r\n // for every property it has already\r\n objForEachKey(value, function (key) {\r\n // Check if the value is dynamic\r\n var getter = _getOwnPropGetter(value, key);\r\n if (getter) {\r\n // And if it is tell it's listeners that the value has changed\r\n var valueState = getter[state.prop];\r\n valueState && valueState.chng();\r\n }\r\n });\r\n }\r\n }\r\n if (newValue !== value) {\r\n var newIsObjectOrArray = newValue && _canMakeDynamic(_getProperty, state, newValue);\r\n if (!isReferenced && newIsObjectOrArray) {\r\n // As the newValue is an object/array lets preemptively make it dynamic\r\n newValue = _makeDynamicObject(state, newValue, name, \"Converting\");\r\n }\r\n // Now assign the internal \"value\" to the newValue\r\n value = newValue;\r\n isObjectOrArray = newIsObjectOrArray;\r\n }\r\n // Cause any listeners to be scheduled for notification\r\n state.add(detail);\r\n }\r\n }\r\n objDefine(theConfig, detail.n, { g: _getProperty, s: _setProperty });\r\n}\r\nexport function _setDynamicProperty(state, target, name, value) {\r\n if (target) {\r\n // To be a dynamic property it needs to have a get function\r\n var getter = _getOwnPropGetter(target, name);\r\n var isDynamic = getter && !!getter[state.prop];\r\n if (!isDynamic) {\r\n _createDynamicProperty(state, target, name, value);\r\n }\r\n else {\r\n // Looks like it's already dynamic just assign the new value\r\n target[name] = value;\r\n }\r\n }\r\n return target;\r\n}\r\nexport function _setDynamicPropertyState(state, target, name, flags) {\r\n if (target) {\r\n // To be a dynamic property it needs to have a get function\r\n var getter = _getOwnPropGetter(target, name);\r\n var isDynamic = getter && !!getter[state.prop];\r\n var inPlace = flags && flags[0 /* _eSetDynamicPropertyFlags.inPlace */];\r\n var rdOnly = flags && flags[1 /* _eSetDynamicPropertyFlags.readOnly */];\r\n var blkProp = flags && flags[2 /* _eSetDynamicPropertyFlags.blockDynamicProperty */];\r\n if (!isDynamic) {\r\n if (blkProp) {\r\n try {\r\n // Attempt to mark the target as blocked from conversion\r\n blockDynamicConversion(target);\r\n }\r\n catch (e) {\r\n _throwDynamicError((state.hdlr || {})[_DYN_LOGGER /* @min:%2elogger */], name, \"Blocking\", e);\r\n }\r\n }\r\n try {\r\n // Make sure it's dynamic so that we can tag the property as per the state\r\n _setDynamicProperty(state, target, name, target[name]);\r\n getter = _getOwnPropGetter(target, name);\r\n }\r\n catch (e) {\r\n // Unable to convert to dynamic property so just leave as non-dynamic\r\n _throwDynamicError((state.hdlr || {})[_DYN_LOGGER /* @min:%2elogger */], name, \"State\", e);\r\n }\r\n }\r\n // Assign the optional flags if true\r\n if (inPlace) {\r\n getter[state.rf] = inPlace;\r\n }\r\n if (rdOnly) {\r\n getter[state.ro] = rdOnly;\r\n }\r\n if (blkProp) {\r\n getter[state.blkVal] = true;\r\n }\r\n }\r\n return target;\r\n}\r\nexport function _makeDynamicObject(state, target, name, desc) {\r\n try {\r\n // Assign target with new value properties (converting into dynamic properties in the process)\r\n objForEachKey(target, function (key, value) {\r\n // Assign and/or make the property dynamic\r\n _setDynamicProperty(state, target, key, value);\r\n });\r\n if (!target[CFG_HANDLER_LINK]) {\r\n // Link the config back to the dynamic config details\r\n objDefineProp(target, CFG_HANDLER_LINK, {\r\n get: function () {\r\n return state[_DYN_HDLR /* @min:%2ehdlr */];\r\n }\r\n });\r\n _patchArray(state, target, name);\r\n }\r\n }\r\n catch (e) {\r\n // Unable to convert to dynamic property so just leave as non-dynamic\r\n _throwDynamicError((state.hdlr || {})[_DYN_LOGGER /* @min:%2elogger */], name, desc, e);\r\n }\r\n return target;\r\n}\r\n//# sourceMappingURL=DynamicProperty.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, arrIndexOf, dumpObj, newSymbol, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { throwAggregationError } from \"../JavaScriptSDK/AggregationError\";\r\nimport { _DYN_BLK_VAL, _DYN_CANCEL, _DYN_HDLR, _DYN_LENGTH, _DYN_LOGGER, _DYN_NOTIFY, _DYN_PUSH, _DYN_RD_ONLY, _DYN_SET_DF, _DYN_THROW_INTERNAL } from \"../__DynamicConstants\";\r\nvar symPrefix = \"[[ai_\";\r\nvar symPostfix = \"]]\";\r\nexport function _createState(cfgHandler) {\r\n var _a;\r\n var dynamicPropertySymbol = newSymbol(symPrefix + \"get\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyReadOnly = newSymbol(symPrefix + \"ro\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyReferenced = newSymbol(symPrefix + \"rf\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyBlockValue = newSymbol(symPrefix + \"blkVal\" + cfgHandler.uid + symPostfix);\r\n var dynamicPropertyDetail = newSymbol(symPrefix + \"dtl\" + cfgHandler.uid + symPostfix);\r\n var _waitingHandlers = null;\r\n var _watcherTimer = null;\r\n var theState;\r\n function _useHandler(activeHandler, callback) {\r\n var prevWatcher = theState.act;\r\n try {\r\n theState.act = activeHandler;\r\n if (activeHandler && activeHandler[dynamicPropertyDetail]) {\r\n // Clear out the previously tracked details for this handler, so that access are re-evaluated\r\n arrForEach(activeHandler[dynamicPropertyDetail], function (detail) {\r\n detail.clr(activeHandler);\r\n });\r\n activeHandler[dynamicPropertyDetail] = [];\r\n }\r\n callback({\r\n cfg: cfgHandler.cfg,\r\n set: cfgHandler.set.bind(cfgHandler),\r\n setDf: cfgHandler[_DYN_SET_DF /* @min:%2esetDf */].bind(cfgHandler),\r\n ref: cfgHandler.ref.bind(cfgHandler),\r\n rdOnly: cfgHandler[_DYN_RD_ONLY /* @min:%2erdOnly */].bind(cfgHandler)\r\n });\r\n }\r\n catch (e) {\r\n var logger = cfgHandler[_DYN_LOGGER /* @min:%2elogger */];\r\n if (logger) {\r\n // Don't let one individual failure break everyone\r\n logger[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](1 /* eLoggingSeverity.CRITICAL */, 107 /* _eInternalMessageId.ConfigWatcherException */, dumpObj(e));\r\n }\r\n // Re-throw the exception so that any true \"error\" is reported back to the called\r\n throw e;\r\n }\r\n finally {\r\n theState.act = prevWatcher || null;\r\n }\r\n }\r\n function _notifyWatchers() {\r\n if (_waitingHandlers) {\r\n var notifyHandlers = _waitingHandlers;\r\n _waitingHandlers = null;\r\n // Stop any timer as we are running them now anyway\r\n _watcherTimer && _watcherTimer[_DYN_CANCEL /* @min:%2ecancel */]();\r\n _watcherTimer = null;\r\n var watcherFailures_1 = [];\r\n // Now run the handlers\r\n arrForEach(notifyHandlers, function (handler) {\r\n if (handler) {\r\n if (handler[dynamicPropertyDetail]) {\r\n arrForEach(handler[dynamicPropertyDetail], function (detail) {\r\n // Clear out this handler from previously tracked details, so that access are re-evaluated\r\n detail.clr(handler);\r\n });\r\n handler[dynamicPropertyDetail] = null;\r\n }\r\n // The handler may have self removed as part of another handler so re-check\r\n if (handler.fn) {\r\n try {\r\n _useHandler(handler, handler.fn);\r\n }\r\n catch (e) {\r\n // Don't let a single failing watcher cause other watches to fail\r\n watcherFailures_1[_DYN_PUSH /* @min:%2epush */](e);\r\n }\r\n }\r\n }\r\n });\r\n // During notification we may have had additional updates -- so notify those updates as well\r\n if (_waitingHandlers) {\r\n try {\r\n _notifyWatchers();\r\n }\r\n catch (e) {\r\n watcherFailures_1[_DYN_PUSH /* @min:%2epush */](e);\r\n }\r\n }\r\n if (watcherFailures_1[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n throwAggregationError(\"Watcher error(s): \", watcherFailures_1);\r\n }\r\n }\r\n }\r\n function _addWatcher(detail) {\r\n if (detail && detail.h[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n if (!_waitingHandlers) {\r\n _waitingHandlers = [];\r\n }\r\n if (!_watcherTimer) {\r\n _watcherTimer = scheduleTimeout(function () {\r\n _watcherTimer = null;\r\n _notifyWatchers();\r\n }, 0);\r\n }\r\n // Add all of the handlers for this detail (if not already present) - using normal for-loop for performance\r\n for (var idx = 0; idx < detail.h[_DYN_LENGTH /* @min:%2elength */]; idx++) {\r\n var handler = detail.h[idx];\r\n // Add this handler to the collection of handlers to re-execute\r\n if (handler && arrIndexOf(_waitingHandlers, handler) === -1) {\r\n _waitingHandlers[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n }\r\n }\r\n }\r\n function _trackHandler(handler, detail) {\r\n if (handler) {\r\n var details = handler[dynamicPropertyDetail] = handler[dynamicPropertyDetail] || [];\r\n if (arrIndexOf(details, detail) === -1) {\r\n // If this detail is not already listed as tracked then add it so that we re-evaluate it's usage\r\n details[_DYN_PUSH /* @min:%2epush */](detail);\r\n }\r\n }\r\n }\r\n theState = (_a = {\r\n prop: dynamicPropertySymbol,\r\n ro: dynamicPropertyReadOnly,\r\n rf: dynamicPropertyReferenced\r\n },\r\n _a[_DYN_BLK_VAL /* @min:blkVal */] = dynamicPropertyBlockValue,\r\n _a[_DYN_HDLR /* @min:hdlr */] = cfgHandler,\r\n _a.add = _addWatcher,\r\n _a[_DYN_NOTIFY /* @min:notify */] = _notifyWatchers,\r\n _a.use = _useHandler,\r\n _a.trk = _trackHandler,\r\n _a);\r\n return theState;\r\n}\r\n//# sourceMappingURL=DynamicState.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { dumpObj, isUndefined, objDefine, objForEachKey } from \"@nevware21/ts-utils\";\r\nimport { createUniqueNamespace } from \"../JavaScriptSDK/DataCacheHelper\";\r\nimport { STR_NOT_DYNAMIC_ERROR } from \"../JavaScriptSDK/InternalConstants\";\r\nimport { _DYN_BLK_VAL, _DYN_LOGGER, _DYN_NOTIFY, _DYN_RD_ONLY, _DYN_SET_DF, _DYN_THROW_INTERNAL, _DYN_WARN_TO_CONSOLE, _DYN_WATCH } from \"../__DynamicConstants\";\r\nimport { _applyDefaultValue } from \"./ConfigDefaults\";\r\nimport { _makeDynamicObject, _setDynamicProperty, _setDynamicPropertyState, _throwDynamicError } from \"./DynamicProperty\";\r\nimport { _createState } from \"./DynamicState\";\r\nimport { CFG_HANDLER_LINK, _cfgDeepCopy, getDynamicConfigHandler, throwInvalidAccess } from \"./DynamicSupport\";\r\n/**\r\n * Identifies a function which will be re-called whenever any of it's accessed configuration values\r\n * change.\r\n * @param configHandler - The callback that will be called for the initial request and then whenever any\r\n * accessed configuration changes are identified.\r\n */\r\nfunction _createAndUseHandler(state, configHandler) {\r\n var handler = {\r\n fn: configHandler,\r\n rm: function () {\r\n // Clear all references to the handler so it can be garbage collected\r\n // This will also cause this handler to never get called and eventually removed\r\n handler.fn = null;\r\n state = null;\r\n configHandler = null;\r\n }\r\n };\r\n state.use(handler, configHandler);\r\n return handler;\r\n}\r\n/**\r\n * Creates the dynamic config handler and associates with the target config as the root object\r\n * @param target - The config that you want to be root of the dynamic config\r\n * @param inPlace - Should the passed config be converted in-place or a new proxy returned\r\n * @returns The existing dynamic handler or a new instance with the provided config values\r\n */\r\nfunction _createDynamicHandler(logger, target, inPlace) {\r\n var _a;\r\n var dynamicHandler = getDynamicConfigHandler(target);\r\n if (dynamicHandler) {\r\n // The passed config is already dynamic so return it's tracker\r\n return dynamicHandler;\r\n }\r\n var uid = createUniqueNamespace(\"dyncfg\", true);\r\n var newTarget = (target && inPlace !== false) ? target : _cfgDeepCopy(target);\r\n var theState;\r\n function _notifyWatchers() {\r\n theState[_DYN_NOTIFY /* @min:%2enotify */]();\r\n }\r\n function _setValue(target, name, value) {\r\n try {\r\n target = _setDynamicProperty(theState, target, name, value);\r\n }\r\n catch (e) {\r\n // Unable to convert to dynamic property so just leave as non-dynamic\r\n _throwDynamicError(logger, name, \"Setting value\", e);\r\n }\r\n return target[name];\r\n }\r\n function _watch(configHandler) {\r\n return _createAndUseHandler(theState, configHandler);\r\n }\r\n function _block(configHandler, allowUpdate) {\r\n theState.use(null, function (details) {\r\n var prevUpd = theState.upd;\r\n try {\r\n if (!isUndefined(allowUpdate)) {\r\n theState.upd = allowUpdate;\r\n }\r\n configHandler(details);\r\n }\r\n finally {\r\n theState.upd = prevUpd;\r\n }\r\n });\r\n }\r\n function _ref(target, name) {\r\n var _a;\r\n // Make sure it's dynamic and mark as referenced with it's current value\r\n return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[0 /* _eSetDynamicPropertyFlags.inPlace */] = true, _a))[name];\r\n }\r\n function _rdOnly(target, name) {\r\n var _a;\r\n // Make sure it's dynamic and mark as readonly with it's current value\r\n return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[1 /* _eSetDynamicPropertyFlags.readOnly */] = true, _a))[name];\r\n }\r\n function _blkPropValue(target, name) {\r\n var _a;\r\n // Make sure it's dynamic and mark as readonly with it's current value\r\n return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[2 /* _eSetDynamicPropertyFlags.blockDynamicProperty */] = true, _a))[name];\r\n }\r\n function _applyDefaults(theConfig, defaultValues) {\r\n if (defaultValues) {\r\n // Resolve/apply the defaults\r\n objForEachKey(defaultValues, function (name, value) {\r\n // Sets the value and makes it dynamic (if it doesn't already exist)\r\n _applyDefaultValue(cfgHandler, theConfig, name, value);\r\n });\r\n }\r\n return theConfig;\r\n }\r\n var cfgHandler = (_a = {\r\n uid: null,\r\n cfg: newTarget\r\n },\r\n _a[_DYN_LOGGER /* @min:logger */] = logger,\r\n _a[_DYN_NOTIFY /* @min:notify */] = _notifyWatchers,\r\n _a.set = _setValue,\r\n _a[_DYN_SET_DF /* @min:setDf */] = _applyDefaults,\r\n _a[_DYN_WATCH /* @min:watch */] = _watch,\r\n _a.ref = _ref,\r\n _a[_DYN_RD_ONLY /* @min:rdOnly */] = _rdOnly,\r\n _a[_DYN_BLK_VAL /* @min:blkVal */] = _blkPropValue,\r\n _a._block = _block,\r\n _a);\r\n objDefine(cfgHandler, \"uid\", {\r\n c: false,\r\n e: false,\r\n w: false,\r\n v: uid\r\n });\r\n theState = _createState(cfgHandler);\r\n // Setup tracking for all defined default keys\r\n _makeDynamicObject(theState, newTarget, \"config\", \"Creating\");\r\n return cfgHandler;\r\n}\r\n/**\r\n * Log an invalid access message to the console\r\n * @param message\r\n */\r\nfunction _logInvalidAccess(logger, message) {\r\n if (logger) {\r\n logger[_DYN_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](message);\r\n logger[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](2 /* eLoggingSeverity.WARNING */, 108 /* _eInternalMessageId.DynamicConfigException */, message);\r\n }\r\n else {\r\n // We don't have a logger so just throw an exception\r\n throwInvalidAccess(message);\r\n }\r\n}\r\n/**\r\n * Create or return a dynamic version of the passed config, if it is not already dynamic\r\n * @param config - The config to be converted into a dynamic config\r\n * @param defaultConfig - The default values to apply on the config if the properties don't already exist\r\n * @param inPlace - Should the config be converted in-place into a dynamic config or a new instance returned, defaults to true\r\n * @returns The dynamic config handler for the config (whether new or existing)\r\n */\r\nexport function createDynamicConfig(config, defaultConfig, logger, inPlace) {\r\n var dynamicHandler = _createDynamicHandler(logger, config || {}, inPlace);\r\n if (defaultConfig) {\r\n dynamicHandler[_DYN_SET_DF /* @min:%2esetDf */](dynamicHandler.cfg, defaultConfig);\r\n }\r\n return dynamicHandler;\r\n}\r\n/**\r\n * Watch and track changes for accesses to the current config, the provided config MUST already be\r\n * a dynamic config or a child accessed via the dynamic config\r\n * @param config\r\n * @param configHandler\r\n * @param logger - The logger instance to use if there is no existing handler\r\n * @returns A watcher handler instance that can be used to remove itself when being unloaded\r\n * @throws TypeError if the provided config is not a dynamic config instance\r\n */\r\nexport function onConfigChange(config, configHandler, logger) {\r\n var handler = config[CFG_HANDLER_LINK] || config;\r\n if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) {\r\n return handler[_DYN_WATCH /* @min:%2ewatch */](configHandler);\r\n }\r\n _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));\r\n return createDynamicConfig(config, null, logger)[_DYN_WATCH /* @min:%2ewatch */](configHandler);\r\n}\r\n//# sourceMappingURL=DynamicConfig.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { createPromise, doAwaitResponse } from \"@nevware21/ts-async\";\r\nimport { arrSlice, getLength } from \"@nevware21/ts-utils\";\r\nimport { _DYN_UNLOAD } from \"../__DynamicConstants\";\r\n/**\r\n * Run the unload function of the target object if it exists\r\n * @param target - The target object that contains the unload function\r\n * @param isAsync - The caller identifies whether it is expecting the operation to complete synchronously or asynchronously. Even\r\n * if the caller is not waiting the operation may still be performed asynchronously depending on the component and the reverse is\r\n * also true.\r\n * @returns The result of the target function\r\n */\r\nexport function runTargetUnload(target, isAsync) {\r\n if (target && target[_DYN_UNLOAD /* @min:%2eunload */]) {\r\n return target[_DYN_UNLOAD /* @min:%2eunload */](isAsync);\r\n }\r\n}\r\n/**\r\n * Call the unload function on all targets handling any returned [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * / Promise before calling the next targets unload\r\n * @param targets - An array of the targets to unload\r\n * @param isAsync - The caller identifies whether it is expecting the operations to complete synchronously or asynchronously. Even\r\n * if the caller is not waiting the operation may still be performed asynchronously depending on the component and the reverse is\r\n * also true.\r\n * @param done - Optional callback function to call once all of the unload functions have been called.\r\n */\r\nexport function doUnloadAll(targets, isAsync, done) {\r\n var result;\r\n if (!done) {\r\n result = createPromise(function (resolved) {\r\n done = resolved;\r\n });\r\n }\r\n if (targets && getLength(targets) > 0) {\r\n doAwaitResponse(runTargetUnload(targets[0], isAsync), function () {\r\n doUnloadAll(arrSlice(targets, 1), isAsync, done);\r\n });\r\n }\r\n else {\r\n done();\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=AsyncUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { asString, isBoolean, isFunction, isNullOrUndefined, isString } from \"@nevware21/ts-utils\";\r\nimport { STR_EMPTY } from \"../JavaScriptSDK/InternalConstants\";\r\nimport { _DYN_BLK_VAL, _DYN_TO_LOWER_CASE } from \"../__DynamicConstants\";\r\n/**\r\n * @internal\r\n * @ignore\r\n * @param str\r\n * @param defaultValue\r\n * @returns\r\n */\r\nfunction _stringToBoolOrDefault(theValue, defaultValue, theConfig) {\r\n if (!theValue && isNullOrUndefined(theValue)) {\r\n return defaultValue;\r\n }\r\n if (isBoolean(theValue)) {\r\n return theValue;\r\n }\r\n return asString(theValue)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === \"true\";\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance with the field defined as an object\r\n * that should be merged\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfMerge(defaultValue) {\r\n return {\r\n mrg: true,\r\n v: defaultValue\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance with the provided field set function\r\n * @param setter - The IConfigCheckFn function to validate the user provided value\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfSet(setter, defaultValue) {\r\n return {\r\n set: setter,\r\n v: defaultValue\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance with the provided field validator\r\n * @param validator - The IConfigCheckFn function to validate the user provided value\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @param fallBackName - The fallback configuration name if the current value is not available\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfValidate(validator, defaultValue, fallBackName) {\r\n return {\r\n fb: fallBackName,\r\n isVal: validator,\r\n v: defaultValue\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance that will validate and convert the user\r\n * provided value to a boolean from a string or boolean value\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @param fallBackName - The fallback configuration name if the current value is not available\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfBoolean(defaultValue, fallBackName) {\r\n return {\r\n fb: fallBackName,\r\n set: _stringToBoolOrDefault,\r\n v: !!defaultValue\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance that will validate that the user\r\n * provided value is a function.\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfFunc(defaultValue) {\r\n return {\r\n isVal: isFunction,\r\n v: defaultValue || null\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance that will validate that the user\r\n * provided value is a function.\r\n * @param defaultValue - The default string value to apply it not provided or it's not valid, defaults to an empty string\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfString(defaultValue) {\r\n return {\r\n isVal: isString,\r\n v: asString(defaultValue || STR_EMPTY)\r\n };\r\n}\r\n/**\r\n * Helper which returns an IConfigDefaultCheck instance identifying that value associated with this property\r\n * should not have it's properties converted into a dynamic config properties.\r\n * @param defaultValue - The default value to apply it not provided or it's not valid\r\n * @returns a new IConfigDefaultCheck structure\r\n */\r\nexport function cfgDfBlockPropValue(defaultValue) {\r\n var _a;\r\n return _a = {},\r\n _a[_DYN_BLK_VAL /* @min:blkVal */] = true,\r\n _a.v = defaultValue,\r\n _a;\r\n}\r\n//# sourceMappingURL=ConfigDefaultHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { getInst } from \"@nevware21/ts-utils\";\r\nimport { _DYN_APPLY, _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_EVENTS_SENT, STR_PERF_EVENT } from \"./InternalConstants\";\r\nvar listenerFuncs = [STR_EVENTS_SENT, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_PERF_EVENT];\r\nvar _aiNamespace = null;\r\nvar _debugListener;\r\nfunction _listenerProxyFunc(name, config) {\r\n return function () {\r\n var args = arguments;\r\n var dbgExt = getDebugExt(config);\r\n if (dbgExt) {\r\n var listener = dbgExt.listener;\r\n if (listener && listener[name]) {\r\n listener[name][_DYN_APPLY /* @min:%2eapply */](listener, args);\r\n }\r\n }\r\n };\r\n}\r\nfunction _getExtensionNamespace() {\r\n // Cache the lookup of the global namespace object\r\n var target = getInst(\"Microsoft\");\r\n if (target) {\r\n _aiNamespace = target[\"ApplicationInsights\"];\r\n }\r\n return _aiNamespace;\r\n}\r\nexport function getDebugExt(config) {\r\n var ns = _aiNamespace;\r\n if (!ns && config.disableDbgExt !== true) {\r\n ns = _aiNamespace || _getExtensionNamespace();\r\n }\r\n return ns ? ns[\"ChromeDbgExt\"] : null;\r\n}\r\nexport function getDebugListener(config) {\r\n if (!_debugListener) {\r\n _debugListener = {};\r\n for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);\r\n }\r\n }\r\n return _debugListener;\r\n}\r\n//# sourceMappingURL=DbgExtensionUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nvar _a;\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { dumpObj, isFunction, isUndefined } from \"@nevware21/ts-utils\";\r\nimport { createDynamicConfig, onConfigChange } from \"../Config/DynamicConfig\";\r\nimport { _DYN_DIAG_LOG, _DYN_LOGGER, _DYN_LOGGING_LEVEL_CONSOL4, _DYN_LOG_INTERNAL_MESSAGE, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_PUSH, _DYN_REPLACE, _DYN_THROW_INTERNAL, _DYN_UNLOAD, _DYN_WARN_TO_CONSOLE } from \"../__DynamicConstants\";\r\nimport { getDebugExt } from \"./DbgExtensionUtils\";\r\nimport { getConsole, getJSON, hasJSON } from \"./EnvUtils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nvar STR_WARN_TO_CONSOLE = \"warnToConsole\";\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 defaultValues = {\r\n loggingLevelConsole: 0,\r\n loggingLevelTelemetry: 1,\r\n maxMessageLimit: 25,\r\n enableDebug: false\r\n};\r\nvar _logFuncs = (_a = {},\r\n _a[0 /* eLoggingSeverity.DISABLED */] = null,\r\n _a[1 /* eLoggingSeverity.CRITICAL */] = \"errorToConsole\",\r\n _a[2 /* eLoggingSeverity.WARNING */] = STR_WARN_TO_CONSOLE,\r\n _a[3 /* eLoggingSeverity.DEBUG */] = \"debugToConsole\",\r\n _a);\r\nfunction _sanitizeDiagnosticText(text) {\r\n if (text) {\r\n return \"\\\"\" + text[_DYN_REPLACE /* @min:%2ereplace */](/\\\"/g, STR_EMPTY) + \"\\\"\";\r\n }\r\n return STR_EMPTY;\r\n}\r\nfunction _logToConsole(func, message) {\r\n var theConsole = getConsole();\r\n if (!!theConsole) {\r\n var logFunc = \"log\";\r\n if (theConsole[func]) {\r\n logFunc = func;\r\n }\r\n if (isFunction(theConsole[logFunc])) {\r\n theConsole[logFunc](message);\r\n }\r\n }\r\n}\r\nvar _InternalLogMessage = /** @class */ (function () {\r\n function _InternalLogMessage(msgId, msg, isUserAct, properties) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n var _self = this;\r\n _self[_DYN_MESSAGE_ID /* @min:%2emessageId */] = msgId;\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] =\r\n (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +\r\n msgId;\r\n var strProps = STR_EMPTY;\r\n if (hasJSON()) {\r\n strProps = getJSON().stringify(properties);\r\n }\r\n var diagnosticText = (msg ? \" message:\" + _sanitizeDiagnosticText(msg) : STR_EMPTY) +\r\n (properties ? \" props:\" + _sanitizeDiagnosticText(strProps) : STR_EMPTY);\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] += diagnosticText;\r\n }\r\n _InternalLogMessage.dataType = \"MessageData\";\r\n return _InternalLogMessage;\r\n}());\r\nexport { _InternalLogMessage };\r\nexport function safeGetLogger(core, config) {\r\n return (core || {})[_DYN_LOGGER /* @min:%2elogger */] || new DiagnosticLogger(config);\r\n}\r\nvar DiagnosticLogger = /** @class */ (function () {\r\n function DiagnosticLogger(config) {\r\n this.identifier = \"DiagnosticLogger\";\r\n /**\r\n * The internal logging queue\r\n */\r\n this.queue = [];\r\n /**\r\n * Count of internal messages sent\r\n */\r\n var _messageCount = 0;\r\n /**\r\n * Holds information about what message types were already logged to console or sent to server.\r\n */\r\n var _messageLogged = {};\r\n var _loggingLevelConsole;\r\n var _loggingLevelTelemetry;\r\n var _maxInternalMessageLimit;\r\n var _enableDebug;\r\n var _unloadHandler;\r\n dynamicProto(DiagnosticLogger, this, function (_self) {\r\n _unloadHandler = _setDefaultsFromConfig(config || {});\r\n _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };\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[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */] = 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 (_enableDebug) {\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 = _logFuncs[severity] || STR_WARN_TO_CONSOLE;\r\n if (!isUndefined(message[_DYN_MESSAGE /* @min:%2emessage */])) {\r\n if (isUserAct) {\r\n // check if this message type was already logged to console for this page view and if so, don't log it again\r\n var messageKey = +message[_DYN_MESSAGE_ID /* @min:%2emessageId */];\r\n if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {\r\n _self[logFunc](message[_DYN_MESSAGE /* @min:%2emessage */]);\r\n _messageLogged[messageKey] = true;\r\n }\r\n }\r\n else {\r\n // Only log traces if the console Logging Level is >= the throwInternal severity level\r\n if (_loggingLevelConsole >= severity) {\r\n _self[logFunc](message[_DYN_MESSAGE /* @min:%2emessage */]);\r\n }\r\n }\r\n _logInternalMessage(severity, message);\r\n }\r\n else {\r\n _debugExtMsg(\"throw\" + (severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"Critical\" : \"Warning\"), message);\r\n }\r\n }\r\n };\r\n _self.debugToConsole = function (message) {\r\n _logToConsole(\"debug\", message);\r\n _debugExtMsg(\"warning\", message);\r\n };\r\n _self[_DYN_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */] = function (message) {\r\n _logToConsole(\"warn\", message);\r\n _debugExtMsg(\"warning\", message);\r\n };\r\n _self.errorToConsole = function (message) {\r\n _logToConsole(\"error\", message);\r\n _debugExtMsg(\"error\", message);\r\n };\r\n _self.resetInternalMessageCount = function () {\r\n _messageCount = 0;\r\n _messageLogged = {};\r\n };\r\n _self[_DYN_LOG_INTERNAL_MESSAGE /* @min:%2elogInternalMessage */] = _logInternalMessage;\r\n _self[_DYN_UNLOAD /* @min:%2eunload */] = function (isAsync) {\r\n _unloadHandler && _unloadHandler.rm();\r\n _unloadHandler = null;\r\n };\r\n function _logInternalMessage(severity, message) {\r\n if (_areInternalMessagesThrottled()) {\r\n return;\r\n }\r\n // check if this message type was already logged for this session and if so, don't log it again\r\n var logMessage = true;\r\n var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID /* @min:%2emessageId */];\r\n // if the session storage is not available, limit to only one message type per page view\r\n if (_messageLogged[messageKey]) {\r\n logMessage = false;\r\n }\r\n else {\r\n _messageLogged[messageKey] = true;\r\n }\r\n if (logMessage) {\r\n // Push the event in the internal queue\r\n if (severity <= _loggingLevelTelemetry) {\r\n _self.queue[_DYN_PUSH /* @min:%2epush */](message);\r\n _messageCount++;\r\n _debugExtMsg((severity === 1 /* eLoggingSeverity.CRITICAL */ ? \"error\" : \"warn\"), message);\r\n }\r\n // When throttle limit reached, send a special event\r\n if (_messageCount === _maxInternalMessageLimit) {\r\n var throttleLimitMessage = \"Internal events throttle limit per PageView reached for this app.\";\r\n var throttleMessage = new _InternalLogMessage(23 /* _eInternalMessageId.MessageLimitPerPVExceeded */, throttleLimitMessage, false);\r\n _self.queue[_DYN_PUSH /* @min:%2epush */](throttleMessage);\r\n if (severity === 1 /* eLoggingSeverity.CRITICAL */) {\r\n _self.errorToConsole(throttleLimitMessage);\r\n }\r\n else {\r\n _self[_DYN_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](throttleLimitMessage);\r\n }\r\n }\r\n }\r\n }\r\n function _setDefaultsFromConfig(config) {\r\n // make sure the config is dynamic\r\n return onConfigChange(createDynamicConfig(config, defaultValues, _self).cfg, function (details) {\r\n var config = details.cfg;\r\n _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 /* @min:%2eloggingLevelConsole */];\r\n _loggingLevelTelemetry = config.loggingLevelTelemetry;\r\n _maxInternalMessageLimit = config.maxMessageLimit;\r\n _enableDebug = config.enableDebug;\r\n });\r\n }\r\n function _areInternalMessagesThrottled() {\r\n return _messageCount >= _maxInternalMessageLimit;\r\n }\r\n function _debugExtMsg(name, data) {\r\n var dbgExt = getDebugExt(config || {});\r\n if (dbgExt && dbgExt[_DYN_DIAG_LOG /* @min:%2ediagLog */]) {\r\n dbgExt[_DYN_DIAG_LOG /* @min:%2ediagLog */](name, data);\r\n }\r\n }\r\n });\r\n }\r\n// Removed Stub for DiagnosticLogger.prototype.consoleLoggingLevel.\r\n// Removed Stub for DiagnosticLogger.prototype.throwInternal.\r\n// Removed Stub for DiagnosticLogger.prototype.debugToConsole.\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// Removed Stub for DiagnosticLogger.prototype.unload.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n DiagnosticLogger.__ieDyn=1;\n\n return DiagnosticLogger;\r\n}());\r\nexport { DiagnosticLogger };\r\nfunction _getLogger(logger) {\r\n return (logger || new DiagnosticLogger());\r\n}\r\n/**\r\n * This is a helper method which will call throwInternal on the passed logger, will throw exceptions in\r\n * debug mode or attempt to log the error as a console warning. This helper is provided mostly to better\r\n * support minification as logger.throwInternal() will not compress the publish \"throwInternal\" used throughout\r\n * the code.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity - {LoggingSeverity} - The severity of the log message\r\n * @param message - {_InternalLogMessage} - The log message.\r\n */\r\nexport function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {\r\n if (isUserAct === void 0) { isUserAct = false; }\r\n _getLogger(logger)[_DYN_THROW_INTERNAL /* @min:%2ethrowInternal */](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)[_DYN_WARN_TO_CONSOLE /* @min:%2ewarnToConsole */](message);\r\n}\r\n/**\r\n * Logs a message to the internal queue.\r\n * @param logger - The Diagnostic Logger instance to use.\r\n * @param severity - {LoggingSeverity} - The severity of the log message\r\n * @param message - {_InternalLogMessage} - The message to log.\r\n */\r\nexport function _logInternalMessage(logger, severity, message) {\r\n _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE /* @min:%2elogInternalMessage */](severity, message);\r\n}\r\n//# sourceMappingURL=DiagnosticLogger.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nvar _a, _b;\r\nimport { arrForEach, arrIndexOf, dumpObj, getDocument, getLazy, getNavigator, isArray, isFunction, isNullOrUndefined, isString, isTruthy, isUndefined, objForEachKey, strEndsWith, strIndexOf, strLeft, strSubstring, strTrim, utcNow } from \"@nevware21/ts-utils\";\r\nimport { cfgDfMerge } from \"../Config/ConfigDefaultHelpers\";\r\nimport { createDynamicConfig, onConfigChange } from \"../Config/DynamicConfig\";\r\nimport { _DYN_ENABLED, _DYN_LENGTH, _DYN_LOGGER, _DYN_SET_DF, _DYN_SPLIT, _DYN_UNLOAD, _DYN_USER_AGENT } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { getLocation, isIE } from \"./EnvUtils\";\r\nimport { getExceptionName, isNotNullOrUndefined, setValue, strContains } from \"./HelperFuncs\";\r\nimport { STR_DOMAIN, STR_EMPTY, STR_PATH, UNDEFINED_VALUE } from \"./InternalConstants\";\r\nvar strToGMTString = \"toGMTString\";\r\nvar strToUTCString = \"toUTCString\";\r\nvar strCookie = \"cookie\";\r\nvar strExpires = \"expires\";\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;\r\nvar _cookieCache = {};\r\nvar _globalCookieConfig = {};\r\n// // `isCookieUseDisabled` is deprecated, so explicitly casting as a key of IConfiguration to avoid typing error\r\n// // when both isCookieUseDisabled and disableCookiesUsage are used disableCookiesUsage will take precedent, which is\r\n// // why its listed first\r\n/**\r\n * Set the supported dynamic config values as undefined (or an empty object) so that\r\n * any listeners will be informed of any changes.\r\n * Explicitly NOT including the deprecated `isCookieUseDisabled` as we don't want to support\r\n * the v1 deprecated field as dynamic for updates\r\n */\r\nvar rootDefaultConfig = (_a = {\r\n cookieCfg: cfgDfMerge((_b = {},\r\n _b[STR_DOMAIN] = { fb: \"cookieDomain\", dfVal: isNotNullOrUndefined },\r\n _b.path = { fb: \"cookiePath\", dfVal: isNotNullOrUndefined },\r\n _b.enabled = UNDEFINED_VALUE,\r\n _b.ignoreCookies = UNDEFINED_VALUE,\r\n _b.blockedCookies = UNDEFINED_VALUE,\r\n _b)),\r\n cookieDomain: UNDEFINED_VALUE,\r\n cookiePath: UNDEFINED_VALUE\r\n },\r\n _a[strDisableCookiesUsage] = UNDEFINED_VALUE,\r\n _a);\r\nfunction _getDoc() {\r\n !_doc && (_doc = getLazy(function () { return getDocument(); }));\r\n}\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\nfunction _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 _isIgnoredCookie(cookieMgrCfg, name) {\r\n if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {\r\n return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1;\r\n }\r\n return false;\r\n}\r\nfunction _isBlockedCookie(cookieMgrCfg, name) {\r\n if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {\r\n if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) {\r\n return true;\r\n }\r\n }\r\n return _isIgnoredCookie(cookieMgrCfg, name);\r\n}\r\nfunction _isCfgEnabled(rootConfig, cookieMgrConfig) {\r\n var isCfgEnabled = cookieMgrConfig[_DYN_ENABLED /* @min:%2eenabled */];\r\n if (isNullOrUndefined(isCfgEnabled)) {\r\n // Set the enabled from the provided setting or the legacy root values\r\n var cookieEnabled = void 0;\r\n // This field is deprecated and dynamic updates will not be fully supported\r\n if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {\r\n cookieEnabled = !rootConfig[strIsCookieUseDisabled];\r\n }\r\n // If this value is defined it takes precedent over the above\r\n if (!isUndefined(rootConfig[strDisableCookiesUsage])) {\r\n cookieEnabled = !rootConfig[strDisableCookiesUsage];\r\n }\r\n // Not setting the cookieMgrConfig.enabled as that will update (set) the global dynamic config\r\n // So future \"updates\" then may not be as expected\r\n isCfgEnabled = cookieEnabled;\r\n }\r\n return isCfgEnabled;\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 && cookieCfg[strConfigCookieMgr]) {\r\n cookieMgr = cookieCfg[strConfigCookieMgr];\r\n }\r\n else {\r\n cookieMgr = createCookieMgr(config);\r\n }\r\n }\r\n if (!cookieMgr) {\r\n // Get or initialize the default global (legacy) cookie manager if we couldn't find one\r\n cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\r\n return cookieMgr;\r\n}\r\nexport function createCookieMgr(rootConfig, logger) {\r\n var _a;\r\n var cookieMgrConfig;\r\n var _path;\r\n var _domain;\r\n var unloadHandler;\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n var _enabled;\r\n var _getCookieFn;\r\n var _setCookieFn;\r\n var _delCookieFn;\r\n // Make sure the root config is dynamic as it may be the global config\r\n rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;\r\n // Will get recalled if the referenced configuration is changed\r\n unloadHandler = onConfigChange(rootConfig, function (details) {\r\n // Make sure the root config has all of the the defaults to the root config to ensure they are dynamic\r\n details[_DYN_SET_DF /* @min:%2esetDf */](details.cfg, rootDefaultConfig);\r\n // Create and apply the defaults to the cookieCfg element\r\n cookieMgrConfig = details.ref(details.cfg, \"cookieCfg\"); // details.setDf(details.cfg.cookieCfg, defaultConfig);\r\n _path = cookieMgrConfig[STR_PATH /* @min:%2epath */] || \"/\";\r\n _domain = cookieMgrConfig[STR_DOMAIN /* @min:%2edomain */];\r\n // Explicitly checking against false, so that setting to undefined will === true\r\n _enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false;\r\n _getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;\r\n _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;\r\n _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;\r\n }, logger);\r\n var cookieMgr = (_a = {\r\n isEnabled: function () {\r\n var enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false && _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 cookieMgrConfig[_DYN_ENABLED /* @min:%2eenabled */] = value;\r\n },\r\n set: function (name, value, maxAgeSec, domain, path) {\r\n var result = false;\r\n if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {\r\n var values = {};\r\n var theValue = strTrim(value || STR_EMPTY);\r\n var idx = strIndexOf(theValue, \";\");\r\n if (idx !== -1) {\r\n theValue = strTrim(strLeft(value, idx));\r\n values = _extractParts(strSubstring(value, 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, STR_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 = utcNow();\r\n // Only add expires if not already present\r\n var expireMs = nowMs + (maxAgeSec * 1000);\r\n // Sanity check, if zero or -ve then ignore\r\n if (expireMs > 0) {\r\n var expiry = new Date();\r\n expiry.setTime(expireMs);\r\n setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);\r\n }\r\n }\r\n if (!_isIE) {\r\n // Only replace if not already present\r\n setValue(values, \"max-age\", STR_EMPTY + maxAgeSec, null, isUndefined);\r\n }\r\n }\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol === \"https:\") {\r\n setValue(values, \"secure\", null, null, isUndefined);\r\n // Only set same site if not also secure\r\n if (_allowUaSameSite === null) {\r\n _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT /* @min:%2euserAgent */]);\r\n }\r\n if (_allowUaSameSite) {\r\n setValue(values, \"SameSite\", \"None\", null, isUndefined);\r\n }\r\n }\r\n setValue(values, STR_PATH, path || _path, null, isUndefined);\r\n //let 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 = STR_EMPTY;\r\n if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {\r\n value = _getCookieFn(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[STR_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 // let delCookie = cookieMgrConfig.delCookie || _setCookieValue;\r\n _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));\r\n result = true;\r\n }\r\n return result;\r\n }\r\n },\r\n _a[_DYN_UNLOAD /* @min:unload */] = function (isAsync) {\r\n unloadHandler && unloadHandler.rm();\r\n unloadHandler = null;\r\n },\r\n _a);\r\n // Associated this cookie manager with the config\r\n cookieMgr[strConfigCookieMgr] = cookieMgr;\r\n return cookieMgr;\r\n}\r\n/*\r\n* Helper method to tell if document.cookie object is supported by the runtime\r\n*/\r\nexport function areCookiesSupported(logger) {\r\n if (_supportsCookies === null) {\r\n _supportsCookies = false;\r\n !_doc && _getDoc();\r\n try {\r\n var doc = _doc.v || {};\r\n _supportsCookies = doc[strCookie] !== undefined;\r\n }\r\n catch (e) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 68 /* _eInternalMessageId.CannotAccessCookie */, \"Cannot access document.cookie - \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return _supportsCookies;\r\n}\r\nfunction _extractParts(theValue) {\r\n var values = {};\r\n if (theValue && theValue[_DYN_LENGTH /* @min:%2elength */]) {\r\n var parts = strTrim(theValue)[_DYN_SPLIT /* @min:%2esplit */](\";\");\r\n arrForEach(parts, function (thePart) {\r\n thePart = strTrim(thePart || STR_EMPTY);\r\n if (thePart) {\r\n var idx = strIndexOf(thePart, \"=\");\r\n if (idx === -1) {\r\n values[thePart] = null;\r\n }\r\n else {\r\n values[strTrim(strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1));\r\n }\r\n }\r\n });\r\n }\r\n return values;\r\n}\r\nfunction _formatDate(theDate, func) {\r\n if (isFunction(theDate[func])) {\r\n return theDate[func]();\r\n }\r\n return null;\r\n}\r\nfunction _formatCookieValue(value, values) {\r\n var cookieValue = value || STR_EMPTY;\r\n objForEachKey(values, function (name, theValue) {\r\n cookieValue += \"; \" + name + (!isNullOrUndefined(theValue) ? \"=\" + theValue : STR_EMPTY);\r\n });\r\n return cookieValue;\r\n}\r\nfunction _getCookieValue(name) {\r\n var cookieValue = STR_EMPTY;\r\n !_doc && _getDoc();\r\n if (_doc.v) {\r\n var theCookie = _doc.v[strCookie] || STR_EMPTY;\r\n if (_parsedCookieValue !== theCookie) {\r\n _cookieCache = _extractParts(theCookie);\r\n _parsedCookieValue = theCookie;\r\n }\r\n cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);\r\n }\r\n return cookieValue;\r\n}\r\nfunction _setCookieValue(name, cookieValue) {\r\n !_doc && _getDoc();\r\n if (_doc.v) {\r\n _doc.v[strCookie] = name + \"=\" + cookieValue;\r\n }\r\n}\r\nexport function uaDisallowsSameSiteNone(userAgent) {\r\n if (!isString(userAgent)) {\r\n return false;\r\n }\r\n // Cover all iOS based browsers here. This includes:\r\n // - Safari on iOS 12 for iPhone, iPod Touch, iPad\r\n // - WkWebview on iOS 12 for iPhone, iPod Touch, iPad\r\n // - Chrome on iOS 12 for iPhone, iPod Touch, iPad\r\n // All of which are broken by SameSite=None, because they use the iOS networking stack\r\n if (strContains(userAgent, \"CPU iPhone OS 12\") || strContains(userAgent, \"iPad; CPU OS 12\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X based browsers that use the Mac OS networking stack. This includes:\r\n // - Safari on Mac OS X\r\n // This does not include:\r\n // - Internal browser on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strContains(userAgent, \"Version/\") && strContains(userAgent, \"Safari\")) {\r\n return true;\r\n }\r\n // Cover Mac OS X internal browsers that use the Mac OS networking stack. This includes:\r\n // - Internal browser on Mac OS X\r\n // This does not include:\r\n // - Safari on Mac OS X\r\n // - Chrome on Mac OS X\r\n // - Chromium on Mac OS X\r\n // Because they do not use the Mac OS networking stack.\r\n if (strContains(userAgent, \"Macintosh; Intel Mac OS X 10_14\") && strEndsWith(userAgent, \"AppleWebKit/605.1.15 (KHTML, like Gecko)\")) {\r\n return true;\r\n }\r\n // Cover Chrome 50-69, because some versions are broken by SameSite=None, and none in this range require it.\r\n // Note: this covers some pre-Chromium Edge versions, but pre-Chromim Edge does not require SameSite=None, so this is fine.\r\n // Note: this regex applies to Windows, Mac OS X, and Linux, deliberately.\r\n if (strContains(userAgent, \"Chrome/5\") || strContains(userAgent, \"Chrome/6\")) {\r\n return true;\r\n }\r\n // Unreal Engine runs Chromium 59, but does not advertise as Chrome until 4.23. Treat versions of Unreal\r\n // that don't specify their Chrome version as lacking support for SameSite=None.\r\n if (strContains(userAgent, \"UnrealEngine\") && !strContains(userAgent, \"Chrome\")) {\r\n return true;\r\n }\r\n // UCBrowser < 12.13.2 ignores Set-Cookie headers with SameSite=None\r\n // NB: this rule isn't complete - you need regex to make a complete rule.\r\n // See: https://www.chromium.org/updates/same-site/incompatible-clients\r\n if (strContains(userAgent, \"UCBrowser/12\") || strContains(userAgent, \"UCBrowser/11\")) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=CookieMgr.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { createAllPromise, createPromise, doAwaitResponse } from \"@nevware21/ts-async\";\r\nimport { arrForEach, arrIndexOf, objDefine, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { createDynamicConfig } from \"../Config/DynamicConfig\";\r\nimport { _DYN_ADD_NOTIFICATION_LIS1, _DYN_IS_ASYNC, _DYN_IS_CHILD_EVT, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_2, _DYN_SPLICE, _DYN_UNLOAD, _DYN_WATCH } from \"../__DynamicConstants\";\r\nimport { STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_EVENTS_SENT, STR_PERF_EVENT } from \"./InternalConstants\";\r\nvar defaultValues = {\r\n perfEvtsSendAll: false\r\n};\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 scheduleTimeout(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;\r\n var unloadHandler;\r\n var _listeners = [];\r\n var cfgHandler = createDynamicConfig(config, defaultValues);\r\n unloadHandler = cfgHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {\r\n perfEvtsSendAll = !!details.cfg.perfEvtsSendAll;\r\n });\r\n dynamicProto(NotificationManager, this, function (_self) {\r\n objDefine(_self, \"listeners\", {\r\n g: function () { return _listeners; }\r\n });\r\n _self[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */] = function (listener) {\r\n _listeners[_DYN_PUSH /* @min:%2epush */](listener);\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param listener - AWTNotificationListener to remove.\r\n */\r\n _self[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */] = function (listener) {\r\n var index = arrIndexOf(_listeners, listener);\r\n while (index > -1) {\r\n _listeners[_DYN_SPLICE /* @min:%2esplice */](index, 1);\r\n index = arrIndexOf(_listeners, listener);\r\n }\r\n };\r\n /**\r\n * Notification for events sent.\r\n * @param events - The array of events that have been sent.\r\n */\r\n _self[STR_EVENTS_SENT /* @min:%2eeventsSent */] = function (events) {\r\n _runListeners(_listeners, STR_EVENTS_SENT, true, function (listener) {\r\n listener[STR_EVENTS_SENT /* @min:%2eeventsSent */](events);\r\n });\r\n };\r\n /**\r\n * Notification for events being discarded.\r\n * @param events - The array of events that have been discarded by the SDK.\r\n * @param 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[STR_EVENTS_DISCARDED /* @min:%2eeventsDiscarded */] = function (events, reason) {\r\n _runListeners(_listeners, STR_EVENTS_DISCARDED, true, function (listener) {\r\n listener[STR_EVENTS_DISCARDED /* @min:%2eeventsDiscarded */](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 sendReason - The reason why the event batch is being sent.\r\n * @param isAsync - A flag which identifies whether the requests are being sent in an async or sync manner.\r\n */\r\n _self[STR_EVENTS_SEND_REQUEST /* @min:%2eeventsSendRequest */] = function (sendReason, isAsync) {\r\n _runListeners(_listeners, STR_EVENTS_SEND_REQUEST, isAsync, function (listener) {\r\n listener[STR_EVENTS_SEND_REQUEST /* @min:%2eeventsSendRequest */](sendReason, isAsync);\r\n });\r\n };\r\n _self[STR_PERF_EVENT /* @min:%2eperfEvent */] = function (perfEvent) {\r\n if (perfEvent) {\r\n // Send all events or only parent events\r\n if (perfEvtsSendAll || !perfEvent[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */]()) {\r\n _runListeners(_listeners, STR_PERF_EVENT, false, function (listener) {\r\n if (perfEvent[_DYN_IS_ASYNC /* @min:%2eisAsync */]) {\r\n scheduleTimeout(function () { return listener[STR_PERF_EVENT /* @min:%2eperfEvent */](perfEvent); }, 0);\r\n }\r\n else {\r\n listener[STR_PERF_EVENT /* @min:%2eperfEvent */](perfEvent);\r\n }\r\n });\r\n }\r\n }\r\n };\r\n _self[_DYN_UNLOAD /* @min:%2eunload */] = function (isAsync) {\r\n var _finishUnload = function () {\r\n unloadHandler && unloadHandler.rm();\r\n unloadHandler = null;\r\n _listeners = [];\r\n };\r\n var waiting;\r\n _runListeners(_listeners, \"unload\", false, function (listener) {\r\n var asyncUnload = listener[_DYN_UNLOAD /* @min:%2eunload */](isAsync);\r\n if (asyncUnload) {\r\n if (!waiting) {\r\n waiting = [];\r\n }\r\n waiting[_DYN_PUSH /* @min:%2epush */](asyncUnload);\r\n }\r\n });\r\n if (waiting) {\r\n return createPromise(function (resolve) {\r\n return doAwaitResponse(createAllPromise(waiting), function () {\r\n _finishUnload();\r\n resolve();\r\n });\r\n });\r\n }\r\n else {\r\n _finishUnload();\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// Removed Stub for NotificationManager.prototype.perfEvent.\r\n// Removed Stub for NotificationManager.prototype.unload.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n NotificationManager.__ieDyn=1;\n\n return NotificationManager;\r\n}());\r\nexport { NotificationManager };\r\n//# sourceMappingURL=NotificationManager.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isArray, isFunction, objDefine, utcNow } from \"@nevware21/ts-utils\";\r\nimport { _DYN_COMPLETE, _DYN_GET_CTX, _DYN_IS_ASYNC, _DYN_IS_CHILD_EVT, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_CTX, _DYN_TIME } from \"../__DynamicConstants\";\r\nimport { STR_GET_PERF_MGR, STR_PERF_EVENT } from \"./InternalConstants\";\r\nvar strExecutionContextKey = \"ctx\";\r\nvar strParentContextKey = \"ParentContextKey\";\r\nvar strChildrenContextKey = \"ChildrenContextKey\";\r\nvar _defaultPerfManager = null;\r\nvar PerfEvent = /** @class */ (function () {\r\n function PerfEvent(name, payloadDetails, isAsync) {\r\n var _self = this;\r\n _self.start = utcNow();\r\n _self[_DYN_NAME /* @min:%2ename */] = name;\r\n _self[_DYN_IS_ASYNC /* @min:%2eisAsync */] = isAsync;\r\n _self[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */] = function () { return false; };\r\n if (isFunction(payloadDetails)) {\r\n // Create an accessor to minimize the potential performance impact of executing the payloadDetails callback\r\n var theDetails_1;\r\n objDefine(_self, \"payload\", {\r\n g: 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 }\r\n _self[_DYN_GET_CTX /* @min:%2egetCtx */] = function (key) {\r\n if (key) {\r\n // The parent and child links are located directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent[strParentContextKey] || key === PerfEvent[strChildrenContextKey]) {\r\n return _self[key];\r\n }\r\n return (_self[strExecutionContextKey] || {})[key];\r\n }\r\n return null;\r\n };\r\n _self[_DYN_SET_CTX /* @min:%2esetCtx */] = function (key, value) {\r\n if (key) {\r\n // Put the parent and child links directly on the object (for better viewing in the DebugPlugin)\r\n if (key === PerfEvent[strParentContextKey]) {\r\n // Simple assumption, if we are setting a parent then we must be a child\r\n if (!_self[key]) {\r\n _self[_DYN_IS_CHILD_EVT /* @min:%2eisChildEvt */] = function () { return true; };\r\n }\r\n _self[key] = value;\r\n }\r\n else if (key === PerfEvent[strChildrenContextKey]) {\r\n _self[key] = value;\r\n }\r\n else {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n }\r\n };\r\n _self[_DYN_COMPLETE /* @min:%2ecomplete */] = function () {\r\n var childTime = 0;\r\n var childEvts = _self[_DYN_GET_CTX /* @min:%2egetCtx */](PerfEvent[strChildrenContextKey]);\r\n if (isArray(childEvts)) {\r\n for (var lp = 0; lp < childEvts[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var childEvt = childEvts[lp];\r\n if (childEvt) {\r\n childTime += childEvt[_DYN_TIME /* @min:%2etime */];\r\n }\r\n }\r\n }\r\n _self[_DYN_TIME /* @min:%2etime */] = utcNow() - _self.start;\r\n _self.exTime = _self[_DYN_TIME /* @min:%2etime */] - childTime;\r\n _self[_DYN_COMPLETE /* @min:%2ecomplete */] = function () { };\r\n };\r\n }\r\n PerfEvent.ParentContextKey = \"parent\";\r\n PerfEvent.ChildrenContextKey = \"childEvts\";\r\n return PerfEvent;\r\n}());\r\nexport { PerfEvent };\r\nvar PerfManager = /** @class */ (function () {\r\n function PerfManager(manager) {\r\n /**\r\n * General bucket used for execution context set and retrieved via setCtx() and getCtx.\r\n * Defined as private so it can be visualized via the DebugPlugin\r\n */\r\n this.ctx = {};\r\n dynamicProto(PerfManager, this, function (_self) {\r\n _self.create = function (src, payloadDetails, isAsync) {\r\n // TODO (@MSNev): at some point we will want to add additional configuration to \"select\" which events to instrument\r\n // for now this is just a simple do everything.\r\n return new PerfEvent(src, payloadDetails, isAsync);\r\n };\r\n _self.fire = function (perfEvent) {\r\n if (perfEvent) {\r\n perfEvent[_DYN_COMPLETE /* @min:%2ecomplete */]();\r\n if (manager && isFunction(manager[STR_PERF_EVENT /* @min:%2eperfEvent */])) {\r\n manager[STR_PERF_EVENT /* @min:%2eperfEvent */](perfEvent);\r\n }\r\n }\r\n };\r\n _self[_DYN_SET_CTX /* @min:%2esetCtx */] = function (key, value) {\r\n if (key) {\r\n var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {};\r\n ctx[key] = value;\r\n }\r\n };\r\n _self[_DYN_GET_CTX /* @min:%2egetCtx */] = function (key) {\r\n return (_self[strExecutionContextKey] || {})[key];\r\n };\r\n });\r\n }\r\n// Removed Stub for PerfManager.prototype.create.\r\n// Removed Stub for PerfManager.prototype.fire.\r\n// Removed Stub for PerfManager.prototype.setCtx.\r\n// Removed Stub for PerfManager.prototype.getCtx.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n PerfManager.__ieDyn=1;\n\n return PerfManager;\r\n}());\r\nexport { PerfManager };\r\nvar doPerfActiveKey = \"CoreUtils.doPerf\";\r\n/**\r\n * Helper function to wrap a function with a perf event\r\n * @param mgrSource - The Performance Manager or a Performance provider source (may be null)\r\n * @param getSource - The callback to create the source name for the event (if perf monitoring is enabled)\r\n * @param func - The function to call and measure\r\n * @param details - A function to return the payload details\r\n * @param isAsync - Is the event / function being call asynchronously or synchronously\r\n */\r\nexport function doPerf(mgrSource, getSource, func, details, isAsync) {\r\n if (mgrSource) {\r\n var perfMgr = mgrSource;\r\n if (perfMgr[STR_GET_PERF_MGR]) {\r\n // Looks like a perf manager provider object\r\n perfMgr = perfMgr[STR_GET_PERF_MGR]();\r\n }\r\n if (perfMgr) {\r\n var perfEvt = void 0;\r\n var currentActive = perfMgr[_DYN_GET_CTX /* @min:%2egetCtx */](doPerfActiveKey);\r\n try {\r\n perfEvt = perfMgr.create(getSource(), details, isAsync);\r\n if (perfEvt) {\r\n if (currentActive && perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */](PerfEvent[strParentContextKey], currentActive);\r\n if (currentActive[_DYN_GET_CTX /* @min:%2egetCtx */] && currentActive[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n var children = currentActive[_DYN_GET_CTX /* @min:%2egetCtx */](PerfEvent[strChildrenContextKey]);\r\n if (!children) {\r\n children = [];\r\n currentActive[_DYN_SET_CTX /* @min:%2esetCtx */](PerfEvent[strChildrenContextKey], children);\r\n }\r\n children[_DYN_PUSH /* @min:%2epush */](perfEvt);\r\n }\r\n }\r\n // Set this event as the active event now\r\n perfMgr[_DYN_SET_CTX /* @min:%2esetCtx */](doPerfActiveKey, perfEvt);\r\n return func(perfEvt);\r\n }\r\n }\r\n catch (ex) {\r\n if (perfEvt && perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */]) {\r\n perfEvt[_DYN_SET_CTX /* @min:%2esetCtx */](\"exception\", ex);\r\n }\r\n }\r\n finally {\r\n // fire the perf event\r\n if (perfEvt) {\r\n perfMgr.fire(perfEvt);\r\n }\r\n // Reset the active event to the previous value\r\n perfMgr[_DYN_SET_CTX /* @min:%2esetCtx */](doPerfActiveKey, currentActive);\r\n }\r\n }\r\n }\r\n return func();\r\n}\r\n/**\r\n * Set the global performance manager to use when there is no core instance or it has not been initialized yet.\r\n * @param perfManager - The IPerfManager instance to use when no performance manager is supplied.\r\n */\r\nexport function setGblPerfMgr(perfManager) {\r\n _defaultPerfManager = perfManager;\r\n}\r\n/**\r\n * Get the current global performance manager that will be used with no performance manager is supplied.\r\n * @returns - The current default manager\r\n */\r\nexport function getGblPerfMgr() {\r\n return _defaultPerfManager;\r\n}\r\n//# sourceMappingURL=PerfManager.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { strShimUndefined } from \"@microsoft/applicationinsights-shims\";\r\nimport { strSubstr, strSubstring } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH } from \"../__DynamicConstants\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { random32 } from \"./RandomHelper\";\r\n// Added to help with minfication\r\nexport var Undefined = strShimUndefined;\r\nexport function newGuid() {\r\n var uuid = generateW3CId();\r\n return strSubstring(uuid, 0, 8) + \"-\" + strSubstring(uuid, 8, 12) + \"-\" + strSubstring(uuid, 12, 16) + \"-\" + strSubstring(uuid, 16, 20) + \"-\" + strSubstring(uuid, 20);\r\n}\r\n/**\r\n * The strEndsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.\r\n * @param value - The value to check whether it ends with the search value.\r\n * @param search - The characters to be searched for at the end of the value.\r\n * @returns true if the given search value is found at the end of the string, otherwise false.\r\n */\r\nexport function strEndsWith(value, search) {\r\n if (value && search) {\r\n var len = value[_DYN_LENGTH /* @min:%2elength */];\r\n var start = len - search[_DYN_LENGTH /* @min:%2elength */];\r\n return strSubstring(value, start >= 0 ? start : 0, len) === search;\r\n }\r\n return false;\r\n}\r\n/**\r\n * generate W3C trace id\r\n */\r\nexport function generateW3CId() {\r\n var hexValues = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\r\n // rfc4122 version 4 UUID without dashes and with lowercase letters\r\n var oct = STR_EMPTY, tmp;\r\n for (var a = 0; a < 4; a++) {\r\n tmp = random32();\r\n oct +=\r\n hexValues[tmp & 0xF] +\r\n hexValues[tmp >> 4 & 0xF] +\r\n hexValues[tmp >> 8 & 0xF] +\r\n hexValues[tmp >> 12 & 0xF] +\r\n hexValues[tmp >> 16 & 0xF] +\r\n hexValues[tmp >> 20 & 0xF] +\r\n hexValues[tmp >> 24 & 0xF] +\r\n hexValues[tmp >> 28 & 0xF];\r\n }\r\n // \"Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively\"\r\n var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];\r\n return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + \"4\" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12);\r\n}\r\n//# sourceMappingURL=CoreUtils.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\nimport { isArray, isString, strLeft, strTrim } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH, _DYN_SPAN_ID, _DYN_SPLIT, _DYN_TO_LOWER_CASE, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN_VERSION } from \"../__DynamicConstants\";\r\nimport { generateW3CId } from \"./CoreUtils\";\r\nimport { findMetaTag, findNamedServerTiming } from \"./EnvUtils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// using {0,16} for leading and trailing whitespace just to constrain the possible runtime of a random string\r\nvar TRACE_PARENT_REGEX = /^([\\da-f]{2})-([\\da-f]{32})-([\\da-f]{16})-([\\da-f]{2})(-[^\\s]{1,64})?$/i;\r\nvar DEFAULT_VERSION = \"00\";\r\nvar INVALID_VERSION = \"ff\";\r\nvar INVALID_TRACE_ID = \"00000000000000000000000000000000\";\r\nvar INVALID_SPAN_ID = \"0000000000000000\";\r\nvar SAMPLED_FLAG = 0x01;\r\nfunction _isValid(value, len, invalidValue) {\r\n if (value && value[_DYN_LENGTH /* @min:%2elength */] === len && value !== invalidValue) {\r\n return !!value.match(/^[\\da-f]*$/i);\r\n }\r\n return false;\r\n}\r\nfunction _formatValue(value, len, defValue) {\r\n if (_isValid(value, len)) {\r\n return value;\r\n }\r\n return defValue;\r\n}\r\nfunction _formatFlags(value) {\r\n if (isNaN(value) || value < 0 || value > 255) {\r\n value = 0x01;\r\n }\r\n var result = value.toString(16);\r\n while (result[_DYN_LENGTH /* @min:%2elength */] < 2) {\r\n result = \"0\" + result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Create a new ITraceParent instance using the provided values.\r\n * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.\r\n * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.\r\n * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid\r\n * @param version - The version to used, defaults to version \"01\" if not supplied or invalid.\r\n * @returns\r\n */\r\nexport function createTraceParent(traceId, spanId, flags, version) {\r\n var _a;\r\n return _a = {},\r\n _a[_DYN_VERSION /* @min:version */] = _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,\r\n _a[_DYN_TRACE_ID /* @min:traceId */] = isValidTraceId(traceId) ? traceId : generateW3CId(),\r\n _a[_DYN_SPAN_ID /* @min:spanId */] = isValidSpanId(spanId) ? spanId : strLeft(generateW3CId(), 16),\r\n _a.traceFlags = flags >= 0 && flags <= 0xFF ? flags : 1,\r\n _a;\r\n}\r\n/**\r\n * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)\r\n *\r\n * @param value - The value to be parsed\r\n * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first\r\n * @returns\r\n */\r\nexport function parseTraceParent(value, selectIdx) {\r\n var _a;\r\n if (!value) {\r\n // Don't pass a null/undefined or empty string\r\n return null;\r\n }\r\n if (isArray(value)) {\r\n // The value may have been encoded on the page into an array so handle this automatically\r\n value = value[0] || \"\";\r\n }\r\n if (!value || !isString(value) || value[_DYN_LENGTH /* @min:%2elength */] > 8192) {\r\n // limit potential processing based on total length\r\n return null;\r\n }\r\n if (value.indexOf(\",\") !== -1) {\r\n var values = value[_DYN_SPLIT /* @min:%2esplit */](\",\");\r\n value = values[selectIdx > 0 && values[_DYN_LENGTH /* @min:%2elength */] > selectIdx ? selectIdx : 0];\r\n }\r\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\r\n var match = TRACE_PARENT_REGEX.exec(strTrim(value));\r\n if (!match || // No match\r\n match[1] === INVALID_VERSION || // version ff is forbidden\r\n match[2] === INVALID_TRACE_ID || // All zeros is considered to be invalid\r\n match[3] === INVALID_SPAN_ID) { // All zeros is considered to be invalid\r\n return null;\r\n }\r\n return _a = {\r\n version: (match[1] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n traceId: (match[2] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](),\r\n spanId: (match[3] || STR_EMPTY)[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]()\r\n },\r\n _a[_DYN_TRACE_FLAGS /* @min:traceFlags */] = parseInt(match[4], 16),\r\n _a;\r\n}\r\n/**\r\n * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string\r\n * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.\r\n * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.\r\n * @param value - The W3c trace Id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\nexport function isValidTraceId(value) {\r\n return _isValid(value, 32, INVALID_TRACE_ID);\r\n}\r\n/**\r\n * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character\r\n * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.\r\n * If all characters are zero (0000000000000000) this is considered an invalid value.\r\n * @param value - The W3c span id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\nexport function isValidSpanId(value) {\r\n return _isValid(value, 16, INVALID_SPAN_ID);\r\n}\r\n/**\r\n * Validates that the provided ITraceParent instance conforms to the currently supported specifications\r\n * @param value\r\n * @returns\r\n */\r\nexport function isValidTraceParent(value) {\r\n if (!value ||\r\n !_isValid(value[_DYN_VERSION /* @min:%2eversion */], 2, INVALID_VERSION) ||\r\n !_isValid(value[_DYN_TRACE_ID /* @min:%2etraceId */], 32, INVALID_TRACE_ID) ||\r\n !_isValid(value[_DYN_SPAN_ID /* @min:%2espanId */], 16, INVALID_SPAN_ID) ||\r\n !_isValid(_formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]), 2)) {\r\n // Each known field must contain a valid value\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Is the parsed traceParent indicating that the trace is currently sampled.\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\nexport function isSampledFlag(value) {\r\n if (isValidTraceParent(value)) {\r\n return (value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] & SAMPLED_FLAG) === SAMPLED_FLAG;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Format the ITraceParent value as a string using the supported and know version formats.\r\n * So even if the passed traceParent is a later version the string value returned from this\r\n * function will convert it to only the known version formats.\r\n * This currently only supports version \"00\" and invalid \"ff\"\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\nexport function formatTraceParent(value) {\r\n if (value) {\r\n // Special Note: This only supports formatting as version 00, future versions should encode any known supported version\r\n // So parsing a future version will populate the correct version value but reformatting will reduce it to version 00.\r\n var flags = _formatFlags(value[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */]);\r\n if (!_isValid(flags, 2)) {\r\n flags = \"01\";\r\n }\r\n var version = value[_DYN_VERSION /* @min:%2eversion */] || DEFAULT_VERSION;\r\n if (version !== \"00\" && version !== \"ff\") {\r\n // Reduce version to \"00\"\r\n version = DEFAULT_VERSION;\r\n }\r\n // Format as version 00\r\n return \"\".concat(version.toLowerCase(), \"-\").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID).toLowerCase(), \"-\").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID).toLowerCase(), \"-\").concat(flags.toLowerCase());\r\n }\r\n return \"\";\r\n}\r\n/**\r\n * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.\r\n * @param selectIdx - If the found value is comma separated which is the preferred entry to select, defaults to the first\r\n * @returns\r\n */\r\nexport function findW3cTraceParent(selectIdx) {\r\n var name = \"traceparent\";\r\n var traceParent = parseTraceParent(findMetaTag(name), selectIdx);\r\n if (!traceParent) {\r\n traceParent = parseTraceParent(findNamedServerTiming(name), selectIdx);\r\n }\r\n return traceParent;\r\n}\r\n//# sourceMappingURL=W3cTraceParent.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { arrForEach, isFunction } from \"@nevware21/ts-utils\";\r\nimport { _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_INITIALIZE, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_SPAN_ID, _DYN_TEARDOWN, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { createElmNodeData } from \"./DataCacheHelper\";\r\nimport { STR_CORE, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { isValidSpanId, isValidTraceId } from \"./W3cTraceParent\";\r\nvar pluginStateData = createElmNodeData(\"plugin\");\r\nexport function _getPluginState(plugin) {\r\n return pluginStateData.get(plugin, \"state\", {}, true);\r\n}\r\n/**\r\n * Initialize the queue of plugins\r\n * @param plugins - The array of plugins to initialize and setting of the next plugin\r\n * @param config - The current config for the instance\r\n * @param core - THe current core instance\r\n * @param extensions - The extensions\r\n */\r\nexport function initializePlugins(processContext, extensions) {\r\n // Set the next plugin and identified the uninitialized plugins\r\n var initPlugins = [];\r\n var lastPlugin = null;\r\n var proxy = processContext[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n var pluginState;\r\n while (proxy) {\r\n var thePlugin = proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (thePlugin) {\r\n if (lastPlugin && lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */] && thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */]) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](thePlugin);\r\n }\r\n pluginState = _getPluginState(thePlugin);\r\n var isInitialized = !!pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */];\r\n if (thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]) {\r\n isInitialized = thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]();\r\n }\r\n if (!isInitialized) {\r\n initPlugins[_DYN_PUSH /* @min:%2epush */](thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n }\r\n // Now initialize the plugins\r\n arrForEach(initPlugins, function (thePlugin) {\r\n var core = processContext[STR_CORE /* @min:%2ecore */]();\r\n thePlugin[_DYN_INITIALIZE /* @min:%2einitialize */](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n pluginState = _getPluginState(thePlugin);\r\n // Only add the core to the state if the plugin didn't set it (doesn't extend from BaseTelemetryPlugin)\r\n if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {\r\n pluginState[STR_CORE] = core;\r\n }\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = true;\r\n delete pluginState[_DYN_TEARDOWN /* @min:%2eteardown */];\r\n });\r\n}\r\nexport function sortPlugins(plugins) {\r\n // Sort by priority\r\n return plugins.sort(function (extA, extB) {\r\n var result = 0;\r\n if (extB) {\r\n var bHasProcess = extB[STR_PROCESS_TELEMETRY];\r\n if (extA[STR_PROCESS_TELEMETRY]) {\r\n result = bHasProcess ? extA[STR_PRIORITY] - extB[STR_PRIORITY] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n }\r\n else {\r\n result = extA ? 1 : -1;\r\n }\r\n return result;\r\n });\r\n // sort complete\r\n}\r\n/**\r\n * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any\r\n * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.\r\n * @param components - The components you want to unload\r\n * @param unloadCtx - This is the context that should be used during unloading.\r\n * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.\r\n * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.\r\n * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.\r\n */\r\nexport function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {\r\n var idx = 0;\r\n function _doUnload() {\r\n while (idx < components[_DYN_LENGTH /* @min:%2elength */]) {\r\n var component = components[idx++];\r\n if (component) {\r\n var func = component._doUnload || component[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */];\r\n if (isFunction(func)) {\r\n if (func.call(component, unloadCtx, unloadState, _doUnload) === true) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return _doUnload();\r\n}\r\n/**\r\n * Creates a IDistributedTraceContext which optionally also \"sets\" the value on a parent\r\n * @param parentCtx - An optional parent distributed trace instance\r\n * @returns A new IDistributedTraceContext instance that uses an internal temporary object\r\n */\r\nexport function createDistributedTraceContext(parentCtx) {\r\n var trace = {};\r\n return {\r\n getName: function () {\r\n return trace[_DYN_NAME /* @min:%2ename */];\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace[_DYN_NAME /* @min:%2ename */] = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace[_DYN_TRACE_ID /* @min:%2etraceId */];\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace[_DYN_TRACE_ID /* @min:%2etraceId */] = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace[_DYN_SPAN_ID /* @min:%2espanId */];\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace[_DYN_SPAN_ID /* @min:%2espanId */] = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */];\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nimport { arrForEach, dumpObj, isArray, isFunction, isNullOrUndefined, isUndefined, objForEachKey, objFreeze, objKeys } from \"@nevware21/ts-utils\";\r\nimport { _applyDefaultValue } from \"../Config/ConfigDefaults\";\r\nimport { createDynamicConfig } from \"../Config/DynamicConfig\";\r\nimport { _DYN_CREATE_NEW, _DYN_DIAG_LOG, _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_IDENTIFIER, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_SET_DF, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_UNLOAD, _DYN_UPDATE } from \"../__DynamicConstants\";\r\nimport { _throwInternal, safeGetLogger } from \"./DiagnosticLogger\";\r\nimport { proxyFunctions } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_DISABLED, STR_EMPTY, STR_EXTENSION_CONFIG, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { _getPluginState } from \"./TelemetryHelpers\";\r\nvar strTelemetryPluginChain = \"TelemetryPluginChain\";\r\nvar strHasRunFlags = \"_hasRun\";\r\nvar strGetTelCtx = \"_getTelCtx\";\r\nvar _chainId = 0;\r\nfunction _getNextProxyStart(proxy, core, startAt) {\r\n while (proxy) {\r\n if (proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]() === startAt) {\r\n return proxy;\r\n }\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n // This wasn't found in the existing chain so create an isolated one with just this plugin\r\n return createTelemetryProxyChain([startAt], core.config || {}, core);\r\n}\r\n/**\r\n * @ignore\r\n * @param telemetryChain\r\n * @param dynamicHandler\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, dynamicHandler, 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 (!dynamicHandler) {\r\n dynamicHandler = createDynamicConfig({}, null, core[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\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, dynamicHandler.cfg);\r\n },\r\n getCfg: function () {\r\n return dynamicHandler.cfg;\r\n },\r\n getExtCfg: _resolveExtCfg,\r\n getConfig: _getConfig,\r\n hasNext: function () {\r\n return !!_nextProxy;\r\n },\r\n getNext: function () {\r\n return _nextProxy;\r\n },\r\n setNext: function (nextPlugin) {\r\n _nextProxy = nextPlugin;\r\n },\r\n iterate: _iterateChain,\r\n onComplete: _addOnComplete\r\n }\r\n };\r\n function _addOnComplete(onComplete, that) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n if (onComplete) {\r\n _onComplete[_DYN_PUSH /* @min:%2epush */]({\r\n func: onComplete,\r\n self: !isUndefined(that) ? that : context.ctx,\r\n args: args\r\n });\r\n }\r\n }\r\n function _moveNext() {\r\n var nextProxy = _nextProxy;\r\n // Automatically move to the next plugin\r\n _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT /* @min:%2egetNext */]() : null;\r\n if (!nextProxy) {\r\n var onComplete = _onComplete;\r\n if (onComplete && onComplete[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(onComplete, function (completeDetails) {\r\n try {\r\n completeDetails.func.call(completeDetails.self, completeDetails.args);\r\n }\r\n catch (e) {\r\n _throwInternal(core[_DYN_LOGGER /* @min:%2elogger */], 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected Exception during onComplete - \" + dumpObj(e));\r\n }\r\n });\r\n _onComplete = [];\r\n }\r\n }\r\n return nextProxy;\r\n }\r\n function _getExtCfg(identifier, createIfMissing) {\r\n var idCfg = null;\r\n var cfg = dynamicHandler.cfg;\r\n if (cfg && identifier) {\r\n var extCfg = cfg[STR_EXTENSION_CONFIG /* @min:%2eextensionConfig */];\r\n if (!extCfg && createIfMissing) {\r\n extCfg = {};\r\n }\r\n // Always set the value so that the property always exists\r\n cfg[STR_EXTENSION_CONFIG] = extCfg; // Note: it is valid for the \"value\" to be undefined\r\n // Calling `ref()` has a side effect of causing the referenced property to become dynamic (if not already)\r\n extCfg = dynamicHandler.ref(cfg, STR_EXTENSION_CONFIG);\r\n if (extCfg) {\r\n idCfg = extCfg[identifier];\r\n if (!idCfg && createIfMissing) {\r\n idCfg = {};\r\n }\r\n // Always set the value so that the property always exists\r\n extCfg[identifier] = idCfg; // Note: it is valid for the \"value\" to be undefined\r\n // Calling `ref()` has a side effect of causing the referenced property to become dynamic (if not already)\r\n idCfg = dynamicHandler.ref(extCfg, identifier);\r\n }\r\n }\r\n return idCfg;\r\n }\r\n function _resolveExtCfg(identifier, defaultValues) {\r\n var newConfig = _getExtCfg(identifier, true);\r\n if (defaultValues) {\r\n // Enumerate over the defaultValues and if not already populated attempt to\r\n // find a value from the root config or use the default value\r\n objForEachKey(defaultValues, function (field, defaultValue) {\r\n // for each unspecified field, set the default value\r\n if (isNullOrUndefined(newConfig[field])) {\r\n var cfgValue = dynamicHandler.cfg[field];\r\n if (cfgValue || !isNullOrUndefined(cfgValue)) {\r\n newConfig[field] = cfgValue;\r\n }\r\n }\r\n _applyDefaultValue(dynamicHandler, newConfig, field, defaultValue);\r\n });\r\n }\r\n return dynamicHandler[_DYN_SET_DF /* @min:%2esetDf */](newConfig, defaultValues);\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, false);\r\n var rootConfig = dynamicHandler.cfg;\r\n if (extConfig && (extConfig[field] || !isNullOrUndefined(extConfig[field]))) {\r\n theValue = extConfig[field];\r\n }\r\n else if (rootConfig[field] || !isNullOrUndefined(rootConfig[field])) {\r\n theValue = rootConfig[field];\r\n }\r\n return (theValue || !isNullOrUndefined(theValue)) ? theValue : defaultValue;\r\n }\r\n function _iterateChain(cb) {\r\n // Keep processing until we reach the end of the chain\r\n var nextPlugin;\r\n while (!!(nextPlugin = context._next())) {\r\n var plugin = nextPlugin[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (plugin) {\r\n // callback with the current on\r\n cb(plugin);\r\n }\r\n }\r\n }\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryContext(telemetryChain, cfg, core, startAt) {\r\n var config = createDynamicConfig(cfg);\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 if (nextPlugin) {\r\n // Run the next plugin which will call \"processNext()\"\r\n nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, context);\r\n }\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.cfg, core, startAt);\r\n }\r\n return createProcessTelemetryContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), config.cfg, core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for handling the unloading of the chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {\r\n var config = createDynamicConfig(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[_DYN_UNLOAD /* @min:%2eunload */](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.cfg, core, startAt);\r\n }\r\n return createProcessTelemetryUnloadContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain for updating the configuration\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n * @param startAt - Identifies the next plugin to execute, if null there is no \"next\" plugin and if undefined it should assume the start of the chain\r\n */\r\nexport function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {\r\n var config = createDynamicConfig(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[_DYN_UPDATE /* @min:%2eupdate */])) {\r\n plugin[_DYN_UPDATE /* @min:%2eupdate */](context, updateState);\r\n }\r\n });\r\n }\r\n function _createNew(plugins, startAt) {\r\n if (plugins === void 0) { plugins = null; }\r\n if (isArray(plugins)) {\r\n plugins = createTelemetryProxyChain(plugins, config.cfg, core, startAt);\r\n }\r\n return createProcessTelemetryUpdateContext(plugins || context[_DYN_GET_NEXT /* @min:%2egetNext */](), core, startAt);\r\n }\r\n context[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = _processNext;\r\n context[_DYN_CREATE_NEW /* @min:%2ecreateNew */] = _createNew;\r\n return context;\r\n}\r\n/**\r\n * Creates an execution chain from the array of plugins\r\n * @param plugins - The array of plugins that will be executed in this order\r\n * @param defItemCtx - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n */\r\nexport function createTelemetryProxyChain(plugins, config, core, startAt) {\r\n var firstProxy = null;\r\n var add = startAt ? false : true;\r\n if (isArray(plugins) && plugins[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Create the proxies and wire up the next plugin chain\r\n var lastProxy_1 = null;\r\n arrForEach(plugins, function (thePlugin) {\r\n if (!add && startAt === thePlugin) {\r\n add = true;\r\n }\r\n if (add && thePlugin && isFunction(thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Only add plugins that are processors\r\n var newProxy = createTelemetryPluginProxy(thePlugin, config, core);\r\n if (!firstProxy) {\r\n firstProxy = newProxy;\r\n }\r\n if (lastProxy_1) {\r\n // Set this new proxy as the next for the previous one\r\n lastProxy_1._setNext(newProxy);\r\n }\r\n lastProxy_1 = newProxy;\r\n }\r\n });\r\n }\r\n if (startAt && !firstProxy) {\r\n // Special case where the \"startAt\" was not in the original list of plugins\r\n return createTelemetryProxyChain([startAt], config, core);\r\n }\r\n return firstProxy;\r\n}\r\n/**\r\n * Create the processing telemetry proxy instance, the proxy is used to abstract the current plugin to allow monitoring and\r\n * execution plugins while passing around the dynamic execution state (IProcessTelemetryContext), the proxy instance no longer\r\n * contains any execution state and can be reused between requests (this was not the case for 2.7.2 and earlier with the\r\n * TelemetryPluginChain class).\r\n * @param plugin - The plugin instance to proxy\r\n * @param config - The default execution context to use when no telemetry context is passed to processTelemetry(), this\r\n * should be for legacy plugins only. Currently, only used for passing the current core instance and to provide better error\r\n * reporting (hasRun) when errors occur.\r\n * @returns\r\n */\r\nexport function createTelemetryPluginProxy(plugin, config, core) {\r\n var nextProxy = null;\r\n var hasProcessTelemetry = isFunction(plugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */]);\r\n var hasSetNext = isFunction(plugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */]);\r\n var chainId;\r\n if (plugin) {\r\n chainId = plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] + \"-\" + plugin[STR_PRIORITY /* @min:%2epriority */] + \"-\" + _chainId++;\r\n }\r\n else {\r\n chainId = \"Unknown-0-\" + _chainId++;\r\n }\r\n var proxyChain = {\r\n getPlugin: function () {\r\n return plugin;\r\n },\r\n getNext: function () {\r\n return nextProxy;\r\n },\r\n processTelemetry: _processTelemetry,\r\n unload: _unloadPlugin,\r\n update: _updatePlugin,\r\n _id: chainId,\r\n _setNext: function (nextPlugin) {\r\n nextProxy = nextPlugin;\r\n }\r\n };\r\n function _getTelCtx() {\r\n var itemCtx;\r\n // Looks like a plugin didn't pass the (optional) context, so create a new one\r\n if (plugin && isFunction(plugin[strGetTelCtx])) {\r\n // This plugin extends from the BaseTelemetryPlugin so lets use it\r\n itemCtx = plugin[strGetTelCtx]();\r\n }\r\n if (!itemCtx) {\r\n // Create a temporary one\r\n itemCtx = createProcessTelemetryContext(proxyChain, config, core);\r\n }\r\n return itemCtx;\r\n }\r\n function _processChain(itemCtx, processPluginFn, name, details, isAsync) {\r\n var hasRun = false;\r\n var identifier = plugin ? plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] : strTelemetryPluginChain;\r\n var hasRunContext = itemCtx[strHasRunFlags];\r\n if (!hasRunContext) {\r\n // Assign and populate\r\n hasRunContext = itemCtx[strHasRunFlags] = {};\r\n }\r\n // Ensure that we keep the context in sync\r\n itemCtx.setNext(nextProxy);\r\n if (plugin) {\r\n doPerf(itemCtx[STR_CORE /* @min:%2ecore */](), function () { return identifier + \":\" + name; }, function () {\r\n // Mark this component as having run\r\n hasRunContext[chainId] = true;\r\n try {\r\n // Set a flag on the next plugin so we know if it was attempted to be executed\r\n var nextId = nextProxy ? nextProxy._id : STR_EMPTY;\r\n if (nextId) {\r\n hasRunContext[nextId] = false;\r\n }\r\n hasRun = processPluginFn(itemCtx);\r\n }\r\n catch (error) {\r\n var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;\r\n if (hasNextRun) {\r\n // The next plugin after us has already run so set this one as complete\r\n hasRun = true;\r\n }\r\n if (!nextProxy || !hasNextRun) {\r\n // Either we have no next plugin or the current one did not attempt to call the next plugin\r\n // Which means the current one is the root of the failure so log/report this failure\r\n _throwInternal(itemCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 73 /* _eInternalMessageId.PluginException */, \"Plugin [\" + identifier + \"] failed during \" + name + \" - \" + dumpObj(error) + \", run flags: \" + dumpObj(hasRunContext));\r\n }\r\n }\r\n }, details, isAsync);\r\n }\r\n return hasRun;\r\n }\r\n function _processTelemetry(env, itemCtx) {\r\n itemCtx = itemCtx || _getTelCtx();\r\n function _callProcessTelemetry(itemCtx) {\r\n if (!plugin || !hasProcessTelemetry) {\r\n return false;\r\n }\r\n var pluginState = _getPluginState(plugin);\r\n if (pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] || pluginState[STR_DISABLED]) {\r\n return false;\r\n }\r\n // Ensure that we keep the context in sync (for processNext()), just in case a plugin\r\n // doesn't calls processTelemetry() instead of itemContext.processNext() or some\r\n // other form of error occurred\r\n if (hasSetNext) {\r\n // Backward compatibility setting the next plugin on the instance\r\n plugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](nextProxy);\r\n }\r\n plugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, itemCtx);\r\n // Process Telemetry is expected to call itemCtx.processNext() or nextPlugin.processTelemetry()\r\n return true;\r\n }\r\n if (!_processChain(itemCtx, _callProcessTelemetry, \"processTelemetry\", function () { return ({ item: env }); }, !(env.sync))) {\r\n // The underlying plugin is either not defined, not enabled or does not have a processTelemetry implementation\r\n // so we still want the next plugin to be executed.\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](env);\r\n }\r\n }\r\n function _unloadPlugin(unloadCtx, unloadState) {\r\n function _callTeardown() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE /* @min:%2ecore */];\r\n // Only teardown the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */]) {\r\n // Handle plugins that don't extend from the BaseTelemetryPlugin\r\n pluginState[STR_CORE /* @min:%2ecore */] = null;\r\n pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] = true;\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = false;\r\n if (plugin[_DYN_TEARDOWN /* @min:%2eteardown */] && plugin[_DYN_TEARDOWN /* @min:%2eteardown */](unloadCtx, unloadState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(unloadCtx, _callTeardown, \"unload\", function () { }, unloadState[_DYN_IS_ASYNC /* @min:%2eisAsync */])) {\r\n // Only called if we hasRun was not true\r\n unloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);\r\n }\r\n }\r\n function _updatePlugin(updateCtx, updateState) {\r\n function _callUpdate() {\r\n // Setting default of hasRun as false so the proxyProcessFn() is called as teardown() doesn't have to exist or call unloadNext().\r\n var hasRun = false;\r\n if (plugin) {\r\n var pluginState = _getPluginState(plugin);\r\n var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE /* @min:%2ecore */];\r\n // Only update the plugin if it was initialized by the current core (i.e. It's not a shared plugin)\r\n if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */]) {\r\n if (plugin[_DYN_UPDATE /* @min:%2eupdate */] && plugin[_DYN_UPDATE /* @min:%2eupdate */](updateCtx, updateState) === true) {\r\n // plugin told us that it was going to (or has) call unloadCtx.processNext()\r\n hasRun = true;\r\n }\r\n }\r\n }\r\n return hasRun;\r\n }\r\n if (!_processChain(updateCtx, _callUpdate, \"update\", function () { }, false)) {\r\n // Only called if we hasRun was not true\r\n updateCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](updateState);\r\n }\r\n }\r\n return objFreeze(proxyChain);\r\n}\r\n/**\r\n * This class will be removed!\r\n * @deprecated use createProcessTelemetryContext() instead\r\n */\r\nvar ProcessTelemetryContext = /** @class */ (function () {\r\n /**\r\n * Creates a new Telemetry Item context with the current config, core and plugin execution chain\r\n * @param plugins - The plugin instances that will be executed\r\n * @param config - The current config\r\n * @param core - The current core instance\r\n */\r\n function ProcessTelemetryContext(pluginChain, config, core, startAt) {\r\n var _self = this;\r\n var context = createProcessTelemetryContext(pluginChain, config, core, startAt);\r\n // Proxy all functions of the context to this object\r\n proxyFunctions(_self, context, objKeys(context));\r\n }\r\n return ProcessTelemetryContext;\r\n}());\r\nexport { ProcessTelemetryContext };\r\n//# sourceMappingURL=ProcessTelemetryContext.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, dumpObj } from \"@nevware21/ts-utils\";\r\nimport { _DYN_DIAG_LOG, _DYN_PUSH } from \"../__DynamicConstants\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nexport function createUnloadHandlerContainer() {\r\n var handlers = [];\r\n function _addHandler(handler) {\r\n if (handler) {\r\n handlers[_DYN_PUSH /* @min:%2epush */](handler);\r\n }\r\n }\r\n function _runHandlers(unloadCtx, unloadState) {\r\n arrForEach(handlers, function (handler) {\r\n try {\r\n handler(unloadCtx, unloadState);\r\n }\r\n catch (e) {\r\n _throwInternal(unloadCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unexpected error calling unload handler - \" + dumpObj(e));\r\n }\r\n });\r\n handlers = [];\r\n }\r\n return {\r\n add: _addHandler,\r\n run: _runHandlers\r\n };\r\n}\r\n//# sourceMappingURL=UnloadHandlerContainer.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrAppend, arrForEach, dumpObj } from \"@nevware21/ts-utils\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\n/**\r\n * Create a IUnloadHookContainer which can be used to remember unload hook functions to be executed during the component unloading\r\n * process.\r\n * @returns A new IUnloadHookContainer instance\r\n */\r\nexport function createUnloadHookContainer() {\r\n var _hooks = [];\r\n function _doUnload(logger) {\r\n var oldHooks = _hooks;\r\n _hooks = [];\r\n // Remove all registered unload hooks\r\n arrForEach(oldHooks, function (fn) {\r\n // allow either rm or remove callback function\r\n try {\r\n (fn.rm || fn.remove).call(fn);\r\n }\r\n catch (e) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, \"Unloading:\" + dumpObj(e));\r\n }\r\n });\r\n }\r\n function _addHook(hooks) {\r\n if (hooks) {\r\n arrAppend(_hooks, hooks);\r\n }\r\n }\r\n return {\r\n run: _doUnload,\r\n add: _addHook\r\n };\r\n}\r\n//# sourceMappingURL=UnloadHookContainer.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nvar _a;\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isFunction, objDefine } from \"@nevware21/ts-utils\";\r\nimport { createDynamicConfig } from \"../Config/DynamicConfig\";\r\nimport { _DYN_CREATE_NEW, _DYN_DIAG_LOG, _DYN_GET_NEXT, _DYN_GET_PROCESS_TEL_CONT0, _DYN_INITIALIZE, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_PROCESS_NEXT, _DYN_SET_NEXT_PLUGIN, _DYN_TEARDOWN, _DYN_UPDATE, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { safeGetLogger } from \"./DiagnosticLogger\";\r\nimport { isNotNullOrUndefined, proxyFunctionAs } from \"./HelperFuncs\";\r\nimport { STR_CORE, STR_EXTENSION_CONFIG, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext } from \"./ProcessTelemetryContext\";\r\nimport { createUnloadHandlerContainer } from \"./UnloadHandlerContainer\";\r\nimport { createUnloadHookContainer } from \"./UnloadHookContainer\";\r\nvar strGetPlugin = \"getPlugin\";\r\nvar defaultValues = (_a = {},\r\n _a[STR_EXTENSION_CONFIG] = { isVal: isNotNullOrUndefined, v: {} },\r\n _a);\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 _hookContainer;\r\n _initDefaults();\r\n dynamicProto(BaseTelemetryPlugin, _self, function (_self) {\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, core, extensions, pluginChain) {\r\n _setDefaults(config, core, pluginChain);\r\n _isinitialized = true;\r\n };\r\n _self[_DYN_TEARDOWN /* @min:%2eteardown */] = function (unloadCtx, unloadState) {\r\n var _a;\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self[STR_CORE /* @min:%2ecore */];\r\n if (!core || (unloadCtx && core !== unloadCtx[STR_CORE /* @min:%2ecore */]())) {\r\n // Do Nothing as either the plugin is not initialized or was not initialized by the current core\r\n return;\r\n }\r\n var result;\r\n var unloadDone = false;\r\n var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUnloadState = unloadState || (_a = {\r\n reason: 0 /* TelemetryUnloadReason.ManualTeardown */\r\n },\r\n _a[_DYN_IS_ASYNC /* @min:isAsync */] = false,\r\n _a);\r\n function _unloadCallback() {\r\n if (!unloadDone) {\r\n unloadDone = true;\r\n _unloadHandlerContainer.run(theUnloadCtx, unloadState);\r\n _hookContainer.run(theUnloadCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */]());\r\n if (result === true) {\r\n theUnloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](theUnloadState);\r\n }\r\n _initDefaults();\r\n }\r\n }\r\n if (!_self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */] || _self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {\r\n _unloadCallback();\r\n }\r\n else {\r\n // Tell the caller that we will be calling processNext()\r\n result = true;\r\n }\r\n return result;\r\n };\r\n _self[_DYN_UPDATE /* @min:%2eupdate */] = function (updateCtx, updateState) {\r\n // If this plugin has already been torn down (not operational) or is not initialized (core is not set)\r\n // or the core being used for unload was not the same core used for initialization.\r\n var core = _self[STR_CORE /* @min:%2ecore */];\r\n if (!core || (updateCtx && core !== updateCtx[STR_CORE /* @min:%2ecore */]())) {\r\n // Do Nothing\r\n return;\r\n }\r\n var result;\r\n var updateDone = false;\r\n var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);\r\n var theUpdateState = updateState || {\r\n reason: 0 /* TelemetryUpdateReason.Unknown */\r\n };\r\n function _updateCallback() {\r\n if (!updateDone) {\r\n updateDone = true;\r\n _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n }\r\n }\r\n if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {\r\n _updateCallback();\r\n }\r\n else {\r\n result = true;\r\n }\r\n return result;\r\n };\r\n proxyFunctionAs(_self, \"_addUnloadCb\", function () { return _unloadHandlerContainer; }, \"add\");\r\n proxyFunctionAs(_self, \"_addHook\", function () { return _hookContainer; }, \"add\");\r\n objDefine(_self, \"_unloadHooks\", { g: function () { return _hookContainer; } });\r\n });\r\n // These are added after the dynamicProto so that are not moved to the prototype\r\n _self[_DYN_DIAG_LOG /* @min:%2ediagLog */] = function (itemCtx) {\r\n return _getTelCtx(itemCtx)[_DYN_DIAG_LOG /* @min:%2ediagLog */]();\r\n };\r\n _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () {\r\n return _isinitialized;\r\n };\r\n _self.setInitialized = function (isInitialized) {\r\n _isinitialized = isInitialized;\r\n };\r\n // _self.getNextPlugin = () => DO NOT IMPLEMENT\r\n // Sub-classes of this base class *should* not be relying on this value and instead\r\n // should use processNext() function. If you require access to the plugin use the\r\n // IProcessTelemetryContext.getNext().getPlugin() while in the pipeline, Note getNext() may return null.\r\n _self[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */] = function (next) {\r\n _nextPlugin = next;\r\n };\r\n _self[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */] = function (env, itemCtx) {\r\n if (itemCtx) {\r\n // Normal core execution sequence\r\n itemCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](env);\r\n }\r\n else if (_nextPlugin && isFunction(_nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */])) {\r\n // Looks like backward compatibility or out of band processing. And as it looks\r\n // like a ITelemetryPlugin or ITelemetryPluginChain, just call processTelemetry\r\n _nextPlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */](env, null);\r\n }\r\n };\r\n _self._getTelCtx = _getTelCtx;\r\n function _getTelCtx(currentCtx) {\r\n if (currentCtx === void 0) { currentCtx = null; }\r\n var itemCtx = currentCtx;\r\n if (!itemCtx) {\r\n var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self[STR_CORE /* @min:%2ecore */]);\r\n // tslint:disable-next-line: prefer-conditional-expression\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // Looks like a chain object\r\n itemCtx = rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](null, _nextPlugin[strGetPlugin]);\r\n }\r\n else {\r\n itemCtx = rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](null, _nextPlugin);\r\n }\r\n }\r\n return itemCtx;\r\n }\r\n function _setDefaults(config, core, pluginChain) {\r\n // Make sure the extensionConfig exists and the config is dynamic\r\n createDynamicConfig(config, defaultValues, safeGetLogger(core));\r\n if (!pluginChain && core) {\r\n // Get the first plugin from the core\r\n pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 /* @min:%2egetProcessTelContext */]()[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n var nextPlugin = _nextPlugin;\r\n if (_nextPlugin && _nextPlugin[strGetPlugin]) {\r\n // If it looks like a proxy/chain then get the plugin\r\n nextPlugin = _nextPlugin[strGetPlugin]();\r\n }\r\n // Support legacy plugins where core was defined as a property\r\n _self[STR_CORE /* @min:%2ecore */] = core;\r\n _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);\r\n }\r\n function _initDefaults() {\r\n _isinitialized = false;\r\n _self[STR_CORE /* @min:%2ecore */] = null;\r\n _rootCtx = null;\r\n _nextPlugin = null;\r\n _hookContainer = createUnloadHookContainer();\r\n _unloadHandlerContainer = createUnloadHandlerContainer();\r\n }\r\n }\r\n// Removed Stub for BaseTelemetryPlugin.prototype.initialize.\r\n// Removed Stub for BaseTelemetryPlugin.prototype.teardown.\r\n// Removed Stub for BaseTelemetryPlugin.prototype.update.\r\n// Removed Stub for BaseTelemetryPlugin.prototype._addUnloadCb.\r\n// Removed Stub for BaseTelemetryPlugin.prototype._addHook.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n BaseTelemetryPlugin.__ieDyn=1;\n\n return BaseTelemetryPlugin;\r\n}());\r\nexport { BaseTelemetryPlugin };\r\n//# sourceMappingURL=BaseTelemetryPlugin.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.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 { arrAppend, arrForEach, dumpObj } from \"@nevware21/ts-utils\";\r\nimport { _DYN_APPLY, _DYN_DIAG_LOG, _DYN_LENGTH, _DYN_PROCESS_NEXT, _DYN_SPLICE, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { BaseTelemetryPlugin } from \"./BaseTelemetryPlugin\";\r\nimport { _throwInternal } from \"./DiagnosticLogger\";\r\nimport { getExceptionName } from \"./HelperFuncs\";\r\nimport { STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nfunction _addInitializer(_initializers, id, telemetryInitializer) {\r\n var theInitializer = {\r\n id: id,\r\n fn: telemetryInitializer\r\n };\r\n arrAppend(_initializers, 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[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n return -1;\r\n }\r\n });\r\n }\r\n };\r\n return handler;\r\n}\r\nfunction _runInitializers(_initializers, item, logger) {\r\n var doNotSendItem = false;\r\n var telemetryInitializersCount = _initializers[_DYN_LENGTH /* @min:%2elength */];\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[_DYN_APPLY /* @min:%2eapply */](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(logger, 2 /* eLoggingSeverity.WARNING */, 64 /* _eInternalMessageId.TelemetryInitializerFailed */, \"Telemetry initializer failed: \" + getExceptionName(e), { exception: dumpObj(e) }, true);\r\n }\r\n }\r\n }\r\n return !doNotSendItem;\r\n}\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 return _addInitializer(_initializers, _id++, telemetryInitializer);\r\n };\r\n _self[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */] = function (item, itemCtx) {\r\n if (_runInitializers(_initializers, item, itemCtx ? itemCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */]() : _self[_DYN_DIAG_LOG /* @min:%2ediagLog */]())) {\r\n _self[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](item, itemCtx);\r\n }\r\n };\r\n _self[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */] = 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 // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n TelemetryInitializerPlugin.__ieDyn=1;\n\n return TelemetryInitializerPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { TelemetryInitializerPlugin };\r\n//# sourceMappingURL=TelemetryInitializerPlugin.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n\"use strict\";\r\nvar _a;\r\nimport { __spreadArrayFn as __spreadArray } from \"@microsoft/applicationinsights-shims\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { createPromise } from \"@nevware21/ts-async\";\r\nimport { arrAppend, arrForEach, arrIndexOf, createTimeout, deepExtend, hasDocument, isFunction, isNullOrUndefined, isPlainObject, objDeepFreeze, objDefine, objForEachKey, objFreeze, objHasOwn, scheduleTimeout, throwError } from \"@nevware21/ts-utils\";\r\nimport { createDynamicConfig, onConfigChange } from \"../Config/DynamicConfig\";\r\nimport { _DYN_ADD_NOTIFICATION_LIS1, _DYN_CANCEL, _DYN_CREATE_NEW, _DYN_ENABLED, _DYN_GET_NOTIFY_MGR, _DYN_GET_PLUGIN, _DYN_GET_PROCESS_TEL_CONT0, _DYN_IDENTIFIER, _DYN_INITIALIZE, _DYN_IS_ASYNC, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_LOGGER, _DYN_LOGGING_LEVEL_CONSOL4, _DYN_MESSAGE, _DYN_MESSAGE_ID, _DYN_NAME, _DYN_NOTIFY, _DYN_ON_COMPLETE, _DYN_POLL_INTERNAL_LOGS, _DYN_PROCESS_NEXT, _DYN_PUSH, _DYN_REMOVE_NOTIFICATION_2, _DYN_SET_DF, _DYN_SPLICE, _DYN_STOP_POLLING_INTERNA3, _DYN_TEARDOWN, _DYN_TIME, _DYN_UNLOAD, _DYN_VERSION, _DYN_WATCH } from \"../__DynamicConstants\";\r\nimport { doUnloadAll, runTargetUnload } from \"./AsyncUtils\";\r\nimport { ChannelControllerPriority } from \"./Constants\";\r\nimport { createCookieMgr } from \"./CookieMgr\";\r\nimport { createUniqueNamespace } from \"./DataCacheHelper\";\r\nimport { getDebugListener } from \"./DbgExtensionUtils\";\r\nimport { DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole } from \"./DiagnosticLogger\";\r\nimport { getSetValue, proxyFunctionAs, proxyFunctions, toISOString } from \"./HelperFuncs\";\r\nimport { STR_CHANNELS, STR_CORE, STR_CREATE_PERF_MGR, STR_DISABLED, STR_EMPTY, STR_EVENTS_DISCARDED, STR_EXTENSIONS, STR_EXTENSION_CONFIG, STR_GET_PERF_MGR, STR_PRIORITY, UNDEFINED_VALUE } from \"./InternalConstants\";\r\nimport { NotificationManager } from \"./NotificationManager\";\r\nimport { PerfManager, doPerf, getGblPerfMgr } from \"./PerfManager\";\r\nimport { createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext, createTelemetryProxyChain } from \"./ProcessTelemetryContext\";\r\nimport { _getPluginState, createDistributedTraceContext, initializePlugins, sortPlugins } from \"./TelemetryHelpers\";\r\nimport { TelemetryInitializerPlugin } from \"./TelemetryInitializerPlugin\";\r\nimport { createUnloadHandlerContainer } from \"./UnloadHandlerContainer\";\r\nimport { createUnloadHookContainer } from \"./UnloadHookContainer\";\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\n/**\r\n * The default settings for the config.\r\n * WE MUST include all defaults here to ensure that the config is created with all of the properties\r\n * defined as dynamic.\r\n */\r\nvar defaultConfig = objDeepFreeze((_a = {\r\n cookieCfg: {}\r\n },\r\n _a[STR_EXTENSIONS] = { rdOnly: true, ref: true, v: [] },\r\n _a[STR_CHANNELS] = { rdOnly: true, ref: true, v: [] },\r\n _a[STR_EXTENSION_CONFIG] = { ref: true, v: {} },\r\n _a[STR_CREATE_PERF_MGR] = UNDEFINED_VALUE,\r\n _a.loggingLevelConsole = 0 /* eLoggingSeverity.DISABLED */,\r\n _a.diagnosticLogInterval = UNDEFINED_VALUE,\r\n _a));\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 var _a;\r\n // Concat all available extensions\r\n var coreExtensions = [];\r\n var channels = [];\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 // Check for ext.initialize\r\n if (isNullOrUndefined(ext) || isNullOrUndefined(ext[_DYN_INITIALIZE /* @min:%2einitialize */])) {\r\n throwError(strValidationError);\r\n }\r\n var extPriority = ext[STR_PRIORITY /* @min:%2epriority */];\r\n var identifier = ext[_DYN_IDENTIFIER /* @min:%2eidentifier */];\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 channels\r\n if (!extPriority || extPriority < channelPriority) {\r\n // Add to core extension that will be managed by AppInsightsCore\r\n coreExtensions[_DYN_PUSH /* @min:%2epush */](ext);\r\n }\r\n else {\r\n channels[_DYN_PUSH /* @min:%2epush */](ext);\r\n }\r\n });\r\n return _a = {},\r\n _a[STR_CORE /* @min:core */] = coreExtensions,\r\n _a[STR_CHANNELS /* @min:channels */] = channels,\r\n _a;\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 _deepMergeConfig(details, target, newValues, merge) {\r\n // Lets assign the new values to the existing config\r\n if (newValues) {\r\n objForEachKey(newValues, function (key, value) {\r\n if (merge) {\r\n if (isPlainObject(value) && isPlainObject(target[key])) {\r\n // The target is an object and it has a value\r\n _deepMergeConfig(details, target[key], value, merge);\r\n }\r\n }\r\n if (merge && isPlainObject(value) && isPlainObject(target[key])) {\r\n // The target is an object and it has a value\r\n _deepMergeConfig(details, target[key], value, merge);\r\n }\r\n else {\r\n // Just Assign (replace) and/or make the property dynamic\r\n details.set(target, key, value);\r\n }\r\n });\r\n }\r\n}\r\nfunction _findWatcher(listeners, newWatcher) {\r\n var theListener = null;\r\n var idx = -1;\r\n arrForEach(listeners, function (listener, lp) {\r\n if (listener.w === newWatcher) {\r\n theListener = listener;\r\n idx = lp;\r\n return -1;\r\n }\r\n });\r\n return { i: idx, l: theListener };\r\n}\r\nfunction _addDelayedCfgListener(listeners, newWatcher) {\r\n var theListener = _findWatcher(listeners, newWatcher).l;\r\n if (!theListener) {\r\n theListener = {\r\n w: newWatcher,\r\n rm: function () {\r\n var fnd = _findWatcher(listeners, newWatcher);\r\n if (fnd.i !== -1) {\r\n listeners[_DYN_SPLICE /* @min:%2esplice */](fnd.i, 1);\r\n }\r\n }\r\n };\r\n listeners[_DYN_PUSH /* @min:%2epush */](theListener);\r\n }\r\n return theListener;\r\n}\r\nfunction _registerDelayedCfgListener(config, listeners, logger) {\r\n arrForEach(listeners, function (listener) {\r\n var unloadHdl = onConfigChange(config, listener.w, logger);\r\n delete listener.w; // Clear the listener reference so it will get garbage collected.\r\n // replace the remove function\r\n listener.rm = function () {\r\n unloadHdl.rm();\r\n };\r\n });\r\n}\r\n/**\r\n * @group Classes\r\n * @group Entrypoint\r\n */\r\nvar AppInsightsCore = /** @class */ (function () {\r\n function AppInsightsCore() {\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 _configHandler;\r\n var _isInitialized;\r\n var _logger;\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 _channelConfig;\r\n var _channels;\r\n var _isUnloading;\r\n var _telemetryInitializerPlugin;\r\n var _internalLogsEventName;\r\n var _evtNamespace;\r\n var _unloadHandlers;\r\n var _hookContainer;\r\n var _debugListener;\r\n var _traceCtx;\r\n var _instrumentationKey;\r\n var _cfgListeners;\r\n var _extensions;\r\n var _pluginVersionStringArr;\r\n var _pluginVersionString;\r\n /**\r\n * Internal log poller\r\n */\r\n var _internalLogPoller;\r\n var _internalLogPollerListening;\r\n var _forceStopInternalLogPoller;\r\n dynamicProto(AppInsightsCore, this, function (_self) {\r\n // Set the default values (also called during teardown)\r\n _initDefaults();\r\n // Special internal method to allow the unit tests and DebugPlugin to hook embedded objects\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_extensions];\r\n };\r\n _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = function () { return _isInitialized; };\r\n // Creating the self.initialize = ()\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = 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[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]()) {\r\n throwError(\"Core cannot be initialized more than once\");\r\n }\r\n _configHandler = createDynamicConfig(config, defaultConfig, logger || _self[_DYN_LOGGER /* @min:%2elogger */], false);\r\n // Re-assigning the local config property so we don't have any references to the passed value and it can be garbage collected\r\n config = _configHandler.cfg;\r\n // This will be \"re-run\" if the referenced config properties are changed\r\n _addUnloadHook(_configHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {\r\n _instrumentationKey = details.cfg.instrumentationKey;\r\n // Mark the extensionConfig and all first level keys as referenced\r\n // This is so that calls to getExtCfg() will always return the same object\r\n // Even when a user may \"re-assign\" the plugin properties (or it's unloaded/reloaded)\r\n var extCfg = details.ref(details.cfg, STR_EXTENSION_CONFIG);\r\n objForEachKey(extCfg, function (key) {\r\n details.ref(extCfg, key);\r\n });\r\n if (isNullOrUndefined(_instrumentationKey)) {\r\n throwError(\"Please provide instrumentation key\");\r\n }\r\n }));\r\n _notificationManager = notificationManager;\r\n _initDebugListener();\r\n _initPerfManager();\r\n _self[_DYN_LOGGER /* @min:%2elogger */] = logger;\r\n var cfgExtensions = config[STR_EXTENSIONS /* @min:%2eextensions */];\r\n // Extension validation\r\n _configExtensions = [];\r\n _configExtensions[_DYN_PUSH /* @min:%2epush */].apply(_configExtensions, __spreadArray(__spreadArray([], extensions, false), cfgExtensions, false));\r\n _channelConfig = config[STR_CHANNELS /* @min:%2echannels */];\r\n _initPluginChain(null);\r\n if (!_channels || _channels[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n throwError(\"No \" + STR_CHANNELS + \" available\");\r\n }\r\n if (_channelConfig && _channelConfig[_DYN_LENGTH /* @min:%2elength */] > 1) {\r\n var teeController = _self[_DYN_GET_PLUGIN /* @min:%2egetPlugin */](\"TeeChannelController\");\r\n if (!teeController || !teeController.plugin) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 28 /* _eInternalMessageId.SenderNotInitialized */, \"TeeChannel required\");\r\n }\r\n }\r\n _registerDelayedCfgListener(config, _cfgListeners, _logger);\r\n _cfgListeners = null;\r\n _isInitialized = true;\r\n _self.releaseQueue();\r\n _self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */]();\r\n };\r\n _self.getChannels = function () {\r\n var controls = [];\r\n if (_channels) {\r\n arrForEach(_channels, function (channel) {\r\n controls[_DYN_PUSH /* @min:%2epush */](channel);\r\n });\r\n }\r\n return objFreeze(controls);\r\n };\r\n _self.track = function (telemetryItem) {\r\n doPerf(_self[STR_GET_PERF_MGR /* @min:%2egetPerfMgr */](), 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 if (!telemetryItem[_DYN_NAME /* @min:%2ename */] && isNullOrUndefined(telemetryItem[_DYN_NAME /* @min:%2ename */])) {\r\n _notifyInvalidEvent(telemetryItem);\r\n throwError(\"telemetry name required\");\r\n }\r\n // setup default iKey if not passed in\r\n telemetryItem.iKey = telemetryItem.iKey || _instrumentationKey;\r\n // add default timestamp if not passed in\r\n telemetryItem[_DYN_TIME /* @min:%2etime */] = telemetryItem[_DYN_TIME /* @min:%2etime */] || toISOString(new Date());\r\n // Common Schema 4.0\r\n telemetryItem.ver = telemetryItem.ver || \"4.0\";\r\n if (!_isUnloading && _self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]()) {\r\n // Process the telemetry plugin chain\r\n _createTelCtx()[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](telemetryItem);\r\n }\r\n else {\r\n // Queue events until all extensions are initialized\r\n _eventQueue[_DYN_PUSH /* @min:%2epush */](telemetryItem);\r\n }\r\n }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));\r\n };\r\n _self[_DYN_GET_PROCESS_TEL_CONT0 /* @min:%2egetProcessTelContext */] = _createTelCtx;\r\n _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */] = function () {\r\n if (!_notificationManager) {\r\n _notificationManager = new NotificationManager(_configHandler.cfg);\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 listener - An INotificationListener object.\r\n */\r\n _self[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */] = function (listener) {\r\n _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */]()[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */](listener);\r\n };\r\n /**\r\n * Removes all instances of the listener.\r\n * @param listener - INotificationListener to remove.\r\n */\r\n _self[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */] = function (listener) {\r\n if (_notificationManager) {\r\n _notificationManager[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */](listener);\r\n }\r\n };\r\n _self.getCookieMgr = function () {\r\n if (!_cookieManager) {\r\n _cookieManager = createCookieMgr(_configHandler.cfg, _self[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\r\n return _cookieManager;\r\n };\r\n _self.setCookieMgr = function (cookieMgr) {\r\n if (_cookieManager !== cookieMgr) {\r\n runTargetUnload(_cookieManager, false);\r\n _cookieManager = cookieMgr;\r\n }\r\n };\r\n _self[STR_GET_PERF_MGR /* @min:%2egetPerfMgr */] = function () {\r\n if (!_perfManager && !_cfgPerfManager) {\r\n _addUnloadHook(_configHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {\r\n if (details.cfg.enablePerfMgr) {\r\n var createPerfMgr = details.cfg[STR_CREATE_PERF_MGR /* @min:%2ecreatePerfMgr */];\r\n if (isFunction(createPerfMgr)) {\r\n _cfgPerfManager = createPerfMgr(_self, _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */]());\r\n }\r\n }\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[_DYN_LENGTH /* @min:%2elength */];\r\n };\r\n _self.releaseQueue = function () {\r\n if (_isInitialized && _eventQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var eventQueue = _eventQueue;\r\n _eventQueue = [];\r\n arrForEach(eventQueue, function (event) {\r\n _createTelCtx()[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](event);\r\n });\r\n }\r\n };\r\n _self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {\r\n _internalLogsEventName = eventName || null;\r\n _forceStopInternalLogPoller = false;\r\n _internalLogPoller && _internalLogPoller[_DYN_CANCEL /* @min:%2ecancel */]();\r\n return _startLogPoller(true);\r\n };\r\n function _startLogPoller(alwaysStart) {\r\n if ((!_internalLogPoller || !_internalLogPoller[_DYN_ENABLED /* @min:%2eenabled */]) && !_forceStopInternalLogPoller) {\r\n var shouldStart = alwaysStart || (_logger && _logger.queue[_DYN_LENGTH /* @min:%2elength */] > 0);\r\n if (shouldStart) {\r\n if (!_internalLogPollerListening) {\r\n _internalLogPollerListening = true;\r\n // listen for any configuration changes so that changes to the\r\n // interval will cause the timer to be re-initialized\r\n _addUnloadHook(_configHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {\r\n var interval = details.cfg.diagnosticLogInterval;\r\n if (!interval || !(interval > 0)) {\r\n interval = 10000;\r\n }\r\n var isRunning = false;\r\n if (_internalLogPoller) {\r\n // It was already created so remember it's running and cancel\r\n isRunning = _internalLogPoller[_DYN_ENABLED /* @min:%2eenabled */];\r\n _internalLogPoller[_DYN_CANCEL /* @min:%2ecancel */]();\r\n }\r\n // Create / reconfigure\r\n _internalLogPoller = createTimeout(_flushInternalLogs, interval);\r\n _internalLogPoller.unref();\r\n // Restart if previously running\r\n _internalLogPoller[_DYN_ENABLED /* @min:%2eenabled */] = isRunning;\r\n }));\r\n }\r\n _internalLogPoller[_DYN_ENABLED /* @min:%2eenabled */] = true;\r\n }\r\n }\r\n return _internalLogPoller;\r\n }\r\n _self[_DYN_STOP_POLLING_INTERNA3 /* @min:%2estopPollingInternalLogs */] = function () {\r\n _forceStopInternalLogPoller = true;\r\n _internalLogPoller && _internalLogPoller[_DYN_CANCEL /* @min:%2ecancel */]();\r\n _flushInternalLogs();\r\n };\r\n // Add addTelemetryInitializer\r\n proxyFunctions(_self, function () { return _telemetryInitializerPlugin; }, [\"addTelemetryInitializer\"]);\r\n _self[_DYN_UNLOAD /* @min:%2eunload */] = function (isAsync, unloadComplete, cbTimeout) {\r\n var _a;\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 = (_a = {\r\n reason: 50 /* TelemetryUnloadReason.SdkUnload */\r\n },\r\n _a[_DYN_IS_ASYNC /* @min:isAsync */] = isAsync,\r\n _a.flushComplete = false,\r\n _a);\r\n var result;\r\n if (isAsync && !unloadComplete) {\r\n result = createPromise(function (resolve) {\r\n // Set the callback to the promise resolve callback\r\n unloadComplete = resolve;\r\n });\r\n }\r\n var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self);\r\n processUnloadCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](function () {\r\n _hookContainer.run(_self[_DYN_LOGGER /* @min:%2elogger */]);\r\n // Run any \"unload\" functions for the _cookieManager, _notificationManager and _logger\r\n doUnloadAll([_cookieManager, _notificationManager, _logger], isAsync, function () {\r\n _initDefaults();\r\n unloadComplete && unloadComplete(unloadState);\r\n });\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[_DYN_STOP_POLLING_INTERNA3 /* @min:%2estopPollingInternalLogs */]();\r\n // Start unloading the components, from this point onwards the SDK should be considered to be in an unstable state\r\n processUnloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);\r\n }\r\n _flushInternalLogs();\r\n if (!_flushChannels(isAsync, _doUnload, 6 /* SendRequestReason.SdkUnload */, cbTimeout)) {\r\n _doUnload(false);\r\n }\r\n return result;\r\n };\r\n _self[_DYN_GET_PLUGIN /* @min:%2egetPlugin */] = _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[_DYN_IDENTIFIER /* @min:%2eidentifier */]);\r\n if (existingPlugin && !replaceExisting) {\r\n addCb && addCb(false);\r\n _logOrThrowError(\"Plugin [\" + plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] + \"] is already loaded!\");\r\n return;\r\n }\r\n var updateState = {\r\n reason: 16 /* TelemetryUpdateReason.PluginAdded */\r\n };\r\n function _addPlugin(removed) {\r\n _configExtensions[_DYN_PUSH /* @min:%2epush */](plugin);\r\n updateState.added = [plugin];\r\n // Re-Initialize the plugin chain\r\n _initPluginChain(updateState);\r\n addCb && addCb(true);\r\n }\r\n if (existingPlugin) {\r\n var removedPlugins_1 = [existingPlugin.plugin];\r\n var unloadState = {\r\n reason: 2 /* TelemetryUnloadReason.PluginReplace */,\r\n isAsync: !!isAsync\r\n };\r\n _removePlugins(removedPlugins_1, unloadState, function (removed) {\r\n if (!removed) {\r\n // Previous plugin was successfully removed or was not installed\r\n addCb && addCb(false);\r\n }\r\n else {\r\n updateState.removed = removedPlugins_1;\r\n updateState.reason |= 32 /* TelemetryUpdateReason.PluginRemoved */;\r\n _addPlugin(true);\r\n }\r\n });\r\n }\r\n else {\r\n _addPlugin(false);\r\n }\r\n };\r\n _self.updateCfg = function (newConfig, mergeExisting) {\r\n if (mergeExisting === void 0) { mergeExisting = true; }\r\n var updateState;\r\n if (_self[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]()) {\r\n updateState = {\r\n reason: 1 /* TelemetryUpdateReason.ConfigurationChanged */,\r\n cfg: _configHandler.cfg,\r\n oldCfg: deepExtend({}, _configHandler.cfg),\r\n newConfig: deepExtend({}, newConfig),\r\n merge: mergeExisting\r\n };\r\n newConfig = updateState.newConfig;\r\n var cfg = _configHandler.cfg;\r\n // replace the immutable (if initialized) values\r\n // We don't currently allow updating the extensions and channels via the update config\r\n // So overwriting any user provided values to reuse the existing values\r\n newConfig[STR_EXTENSIONS /* @min:%2eextensions */] = cfg[STR_EXTENSIONS /* @min:%2eextensions */];\r\n newConfig[STR_CHANNELS /* @min:%2echannels */] = cfg[STR_CHANNELS /* @min:%2echannels */];\r\n }\r\n // Explicitly blocking any previous config watchers so that they don't get called because\r\n // of this bulk update (Probably not necessary)\r\n _configHandler._block(function (details) {\r\n // Lets assign the new values to the existing config either overwriting or re-assigning\r\n var theConfig = details.cfg;\r\n _deepMergeConfig(details, theConfig, newConfig, mergeExisting);\r\n if (!mergeExisting) {\r\n // Remove (unassign) the values \"missing\" from the newConfig and also not in the default config\r\n objForEachKey(theConfig, function (key) {\r\n if (!objHasOwn(newConfig, key)) {\r\n // Set the value to undefined\r\n details.set(theConfig, key, UNDEFINED_VALUE);\r\n }\r\n });\r\n }\r\n // Apply defaults to the new config\r\n details[_DYN_SET_DF /* @min:%2esetDf */](theConfig, defaultConfig);\r\n }, true);\r\n // Now execute all of the listeners (synchronously) so they update their values immediately\r\n _configHandler[_DYN_NOTIFY /* @min:%2enotify */]();\r\n if (updateState) {\r\n _doUpdate(updateState);\r\n }\r\n };\r\n _self.evtNamespace = function () {\r\n return _evtNamespace;\r\n };\r\n _self.flush = _flushChannels;\r\n _self.getTraceCtx = function (createNew) {\r\n if (!_traceCtx) {\r\n _traceCtx = createDistributedTraceContext();\r\n }\r\n return _traceCtx;\r\n };\r\n _self.setTraceCtx = function (traceCtx) {\r\n _traceCtx = traceCtx || null;\r\n };\r\n _self.addUnloadHook = _addUnloadHook;\r\n // Create the addUnloadCb\r\n proxyFunctionAs(_self, \"addUnloadCb\", function () { return _unloadHandlers; }, \"add\");\r\n _self.onCfgChange = function (handler) {\r\n var unloadHook;\r\n if (!_isInitialized) {\r\n unloadHook = _addDelayedCfgListener(_cfgListeners, handler);\r\n }\r\n else {\r\n unloadHook = onConfigChange(_configHandler.cfg, handler, _self[_DYN_LOGGER /* @min:%2elogger */]);\r\n }\r\n return {\r\n rm: function () {\r\n unloadHook.rm();\r\n }\r\n };\r\n };\r\n _self.getWParam = function () {\r\n return (hasDocument() || !!_configHandler.cfg.enableWParam) ? 0 : -1;\r\n };\r\n function _setPluginVersions() {\r\n var thePlugins = {};\r\n _pluginVersionStringArr = [];\r\n var _addPluginVersions = function (plugins) {\r\n if (plugins) {\r\n arrForEach(plugins, function (plugin) {\r\n if (plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] && plugin[_DYN_VERSION /* @min:%2eversion */] && !thePlugins[plugin.identifier]) {\r\n var ver = plugin[_DYN_IDENTIFIER /* @min:%2eidentifier */] + \"=\" + plugin[_DYN_VERSION /* @min:%2eversion */];\r\n _pluginVersionStringArr[_DYN_PUSH /* @min:%2epush */](ver);\r\n thePlugins[plugin.identifier] = plugin;\r\n }\r\n });\r\n }\r\n };\r\n _addPluginVersions(_channels);\r\n if (_channelConfig) {\r\n arrForEach(_channelConfig, function (channels) {\r\n _addPluginVersions(channels);\r\n });\r\n }\r\n _addPluginVersions(_configExtensions);\r\n }\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 _configHandler = createDynamicConfig({}, defaultConfig, _self[_DYN_LOGGER /* @min:%2elogger */]);\r\n // Set the logging level to critical so that any critical initialization failures are displayed on the console\r\n _configHandler.cfg[_DYN_LOGGING_LEVEL_CONSOL4 /* @min:%2eloggingLevelConsole */] = 1 /* eLoggingSeverity.CRITICAL */;\r\n // Define _self.config\r\n objDefine(_self, \"config\", {\r\n g: function () { return _configHandler.cfg; },\r\n s: function (newValue) {\r\n _self.updateCfg(newValue, false);\r\n }\r\n });\r\n objDefine(_self, \"pluginVersionStringArr\", {\r\n g: function () {\r\n if (!_pluginVersionStringArr) {\r\n _setPluginVersions();\r\n }\r\n return _pluginVersionStringArr;\r\n }\r\n });\r\n objDefine(_self, \"pluginVersionString\", {\r\n g: function () {\r\n if (!_pluginVersionString) {\r\n if (!_pluginVersionStringArr) {\r\n _setPluginVersions();\r\n }\r\n _pluginVersionString = _pluginVersionStringArr.join(\";\");\r\n }\r\n return _pluginVersionString || STR_EMPTY;\r\n }\r\n });\r\n objDefine(_self, \"logger\", {\r\n g: function () {\r\n if (!_logger) {\r\n _logger = new DiagnosticLogger(_configHandler.cfg);\r\n _configHandler[_DYN_LOGGER /* @min:%2elogger */] = _logger;\r\n }\r\n return _logger;\r\n },\r\n s: function (newLogger) {\r\n _configHandler[_DYN_LOGGER /* @min:%2elogger */] = newLogger;\r\n if (_logger !== newLogger) {\r\n runTargetUnload(_logger, false);\r\n _logger = newLogger;\r\n }\r\n }\r\n });\r\n _self[_DYN_LOGGER /* @min:%2elogger */] = new DiagnosticLogger(_configHandler.cfg);\r\n _extensions = [];\r\n var cfgExtensions = _self.config[STR_EXTENSIONS /* @min:%2eextensions */] || [];\r\n cfgExtensions.splice(0, cfgExtensions[_DYN_LENGTH /* @min:%2elength */]);\r\n arrAppend(cfgExtensions, _extensions);\r\n _telemetryInitializerPlugin = new TelemetryInitializerPlugin();\r\n _eventQueue = [];\r\n runTargetUnload(_notificationManager, false);\r\n _notificationManager = null;\r\n _perfManager = null;\r\n _cfgPerfManager = null;\r\n runTargetUnload(_cookieManager, false);\r\n _cookieManager = null;\r\n _pluginChain = null;\r\n _configExtensions = [];\r\n _channelConfig = null;\r\n _channels = null;\r\n _isUnloading = false;\r\n _internalLogsEventName = null;\r\n _evtNamespace = createUniqueNamespace(\"AIBaseCore\", true);\r\n _unloadHandlers = createUnloadHandlerContainer();\r\n _traceCtx = null;\r\n _instrumentationKey = null;\r\n _hookContainer = createUnloadHookContainer();\r\n _cfgListeners = [];\r\n _pluginVersionString = null;\r\n _pluginVersionStringArr = null;\r\n _forceStopInternalLogPoller = false;\r\n }\r\n function _createTelCtx() {\r\n var theCtx = createProcessTelemetryContext(_getPluginChain(), _configHandler.cfg, _self);\r\n theCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](_startLogPoller);\r\n return theCtx;\r\n }\r\n // Initialize or Re-initialize the plugins\r\n function _initPluginChain(updateState) {\r\n // Extension validation\r\n var theExtensions = _validateExtensions(_self[_DYN_LOGGER /* @min:%2elogger */], ChannelControllerPriority, _configExtensions);\r\n _pluginChain = null;\r\n _pluginVersionString = null;\r\n _pluginVersionStringArr = null;\r\n // Get the primary channel queue and include as part of the normal extensions\r\n _channels = (_channelConfig || [])[0] || [];\r\n // Add any channels provided in the extensions and sort them\r\n _channels = sortPlugins(arrAppend(_channels, theExtensions[STR_CHANNELS /* @min:%2echannels */]));\r\n // Create an array of all extensions, including the _channels\r\n var allExtensions = arrAppend(sortPlugins(theExtensions[STR_CORE /* @min:%2ecore */]), _channels);\r\n // Required to allow plugins to call core.getPlugin() during their own initialization\r\n _extensions = objFreeze(allExtensions);\r\n // This has a side effect of adding the extensions passed during initialization\r\n // into the config.extensions, so you can see all of the extensions loaded.\r\n // This will also get updated by the addPlugin() and remove plugin code.\r\n var cfgExtensions = _self.config[STR_EXTENSIONS /* @min:%2eextensions */] || [];\r\n cfgExtensions.splice(0, cfgExtensions[_DYN_LENGTH /* @min:%2elength */]);\r\n arrAppend(cfgExtensions, _extensions);\r\n var rootCtx = _createTelCtx();\r\n // Initializing the channels first\r\n if (_channels && _channels[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n initializePlugins(rootCtx[_DYN_CREATE_NEW /* @min:%2ecreateNew */](_channels), allExtensions);\r\n }\r\n // Now initialize the normal extensions (explicitly not including the _channels as this can cause duplicate initialization)\r\n initializePlugins(rootCtx, allExtensions);\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 var channelHosts = [];\r\n arrForEach(_extensions, function (ext) {\r\n if (ext[_DYN_IDENTIFIER /* @min:%2eidentifier */] === pluginIdentifier && ext !== _telemetryInitializerPlugin) {\r\n thePlugin = ext;\r\n return -1;\r\n }\r\n if (ext.getChannel) {\r\n channelHosts[_DYN_PUSH /* @min:%2epush */](ext);\r\n }\r\n });\r\n if (!thePlugin && channelHosts[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(channelHosts, function (host) {\r\n thePlugin = host.getChannel(pluginIdentifier);\r\n if (!thePlugin) {\r\n return -1;\r\n }\r\n });\r\n }\r\n if (thePlugin) {\r\n theExt = {\r\n plugin: thePlugin,\r\n setEnabled: function (enabled) {\r\n _getPluginState(thePlugin)[STR_DISABLED] = !enabled;\r\n },\r\n isEnabled: function () {\r\n var pluginState = _getPluginState(thePlugin);\r\n return !pluginState[_DYN_TEARDOWN /* @min:%2eteardown */] && !pluginState[STR_DISABLED];\r\n },\r\n remove: function (isAsync, removeCb) {\r\n var _a;\r\n if (isAsync === void 0) { isAsync = true; }\r\n var pluginsToRemove = [thePlugin];\r\n var unloadState = (_a = {\r\n reason: 1 /* TelemetryUnloadReason.PluginUnload */\r\n },\r\n _a[_DYN_IS_ASYNC /* @min:isAsync */] = isAsync,\r\n _a);\r\n _removePlugins(pluginsToRemove, unloadState, function (removed) {\r\n if (removed) {\r\n // Re-Initialize the plugin chain\r\n _initPluginChain({\r\n reason: 32 /* TelemetryUpdateReason.PluginRemoved */,\r\n removed: pluginsToRemove\r\n });\r\n }\r\n removeCb && removeCb(removed);\r\n });\r\n }\r\n };\r\n }\r\n return theExt;\r\n }\r\n function _getPluginChain() {\r\n if (!_pluginChain) {\r\n // copy the collection of extensions\r\n var extensions = (_extensions || []).slice();\r\n // During add / remove this may get called again, so don't read if already present\r\n if (arrIndexOf(extensions, _telemetryInitializerPlugin) === -1) {\r\n extensions[_DYN_PUSH /* @min:%2epush */](_telemetryInitializerPlugin);\r\n }\r\n _pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _configHandler.cfg, _self);\r\n }\r\n return _pluginChain;\r\n }\r\n function _removePlugins(thePlugins, unloadState, removeComplete) {\r\n if (thePlugins && thePlugins[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var unloadChain = createTelemetryProxyChain(thePlugins, _configHandler.cfg, _self);\r\n var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self);\r\n unloadCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](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[_DYN_PUSH /* @min:%2epush */](plugin);\r\n }\r\n else {\r\n removed = true;\r\n }\r\n });\r\n _configExtensions = newConfigExtensions;\r\n _pluginVersionString = null;\r\n _pluginVersionStringArr = null;\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[_DYN_PUSH /* @min:%2epush */](channel);\r\n }\r\n else {\r\n removed = true;\r\n }\r\n });\r\n newChannelConfig[_DYN_PUSH /* @min:%2epush */](newQueue);\r\n });\r\n _channelConfig = newChannelConfig;\r\n }\r\n removeComplete && removeComplete(removed);\r\n _startLogPoller();\r\n });\r\n unloadCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](unloadState);\r\n }\r\n else {\r\n removeComplete(false);\r\n }\r\n }\r\n function _flushInternalLogs() {\r\n if (_logger && _logger.queue) {\r\n var queue = _logger.queue.slice(0);\r\n _logger.queue[_DYN_LENGTH /* @min:%2elength */] = 0;\r\n arrForEach(queue, function (logMessage) {\r\n var _a;\r\n var item = (_a = {},\r\n _a[_DYN_NAME /* @min:name */] = _internalLogsEventName ? _internalLogsEventName : \"InternalMessageId: \" + logMessage[_DYN_MESSAGE_ID /* @min:%2emessageId */],\r\n _a.iKey = _instrumentationKey,\r\n _a[_DYN_TIME /* @min:time */] = toISOString(new Date()),\r\n _a.baseType = _InternalLogMessage.dataType,\r\n _a.baseData = { message: logMessage[_DYN_MESSAGE /* @min:%2emessage */] },\r\n _a);\r\n _self.track(item);\r\n });\r\n }\r\n }\r\n function _flushChannels(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 cbTimer && cbTimer[_DYN_CANCEL /* @min:%2ecancel */]();\r\n cbTimer = null;\r\n callBack && callBack(doneIterating);\r\n callBack = null;\r\n }\r\n }\r\n if (_channels && _channels[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var flushCtx = _createTelCtx()[_DYN_CREATE_NEW /* @min:%2ecreateNew */](_channels);\r\n flushCtx.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 = scheduleTimeout(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 }\r\n doneIterating = true;\r\n doCallback();\r\n return true;\r\n }\r\n function _initDebugListener() {\r\n // Lazily ensure that the notification manager is created\r\n !_notificationManager && _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */]();\r\n // Will get recalled if any referenced config values are changed\r\n _addUnloadHook(_configHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {\r\n var disableDbgExt = details.cfg.disableDbgExt;\r\n if (disableDbgExt === true && _debugListener) {\r\n // Remove any previously loaded debug listener\r\n _notificationManager[_DYN_REMOVE_NOTIFICATION_2 /* @min:%2eremoveNotificationListener */](_debugListener);\r\n _debugListener = null;\r\n }\r\n if (_notificationManager && !_debugListener && disableDbgExt !== true) {\r\n _debugListener = getDebugListener(details.cfg);\r\n _notificationManager[_DYN_ADD_NOTIFICATION_LIS1 /* @min:%2eaddNotificationListener */](_debugListener);\r\n }\r\n }));\r\n }\r\n function _initPerfManager() {\r\n // Will get recalled if any referenced config values are changed\r\n _addUnloadHook(_configHandler[_DYN_WATCH /* @min:%2ewatch */](function (details) {\r\n var enablePerfMgr = details.cfg.enablePerfMgr;\r\n if (!enablePerfMgr && _cfgPerfManager) {\r\n // Remove any existing config based performance manager\r\n _cfgPerfManager = null;\r\n }\r\n if (enablePerfMgr) {\r\n // Set the performance manager creation function if not defined\r\n getSetValue(details.cfg, STR_CREATE_PERF_MGR, _createPerfManager);\r\n }\r\n }));\r\n }\r\n function _doUpdate(updateState) {\r\n var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self);\r\n updateCtx[_DYN_ON_COMPLETE /* @min:%2eonComplete */](_startLogPoller);\r\n if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) {\r\n updateCtx[_DYN_PROCESS_NEXT /* @min:%2eprocessNext */](updateState);\r\n }\r\n }\r\n function _logOrThrowError(message) {\r\n var logger = _self[_DYN_LOGGER /* @min:%2elogger */];\r\n if (logger) {\r\n // there should always be a logger\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 73 /* _eInternalMessageId.PluginException */, message);\r\n _startLogPoller();\r\n }\r\n else {\r\n throwError(message);\r\n }\r\n }\r\n function _notifyInvalidEvent(telemetryItem) {\r\n var manager = _self[_DYN_GET_NOTIFY_MGR /* @min:%2egetNotifyMgr */]();\r\n if (manager) {\r\n manager[STR_EVENTS_DISCARDED /* @min:%2eeventsDiscarded */]([telemetryItem], 2 /* eEventsDiscardedReason.InvalidEvent */);\r\n }\r\n }\r\n function _addUnloadHook(hooks) {\r\n _hookContainer.add(hooks);\r\n }\r\n });\r\n }\r\n// Removed Stub for AppInsightsCore.prototype.initialize.\r\n// Removed Stub for AppInsightsCore.prototype.getChannels.\r\n// Removed Stub for AppInsightsCore.prototype.track.\r\n// Removed Stub for AppInsightsCore.prototype.getProcessTelContext.\r\n// Removed Stub for AppInsightsCore.prototype.getNotifyMgr.\r\n// Removed Stub for AppInsightsCore.prototype.addNotificationListener.\r\n// Removed Stub for AppInsightsCore.prototype.removeNotificationListener.\r\n// Removed Stub for AppInsightsCore.prototype.getCookieMgr.\r\n// Removed Stub for AppInsightsCore.prototype.setCookieMgr.\r\n// Removed Stub for AppInsightsCore.prototype.getPerfMgr.\r\n// Removed Stub for AppInsightsCore.prototype.setPerfMgr.\r\n// Removed Stub for AppInsightsCore.prototype.eventCnt.\r\n// Removed Stub for AppInsightsCore.prototype.pollInternalLogs.\r\n// Removed Stub for AppInsightsCore.prototype.stopPollingInternalLogs.\r\n// Removed Stub for AppInsightsCore.prototype.addTelemetryInitializer.\r\n// Removed Stub for AppInsightsCore.prototype.unload.\r\n// Removed Stub for AppInsightsCore.prototype.getPlugin.\r\n// Removed Stub for AppInsightsCore.prototype.addPlugin.\r\n// Removed Stub for AppInsightsCore.prototype.updateCfg.\r\n// Removed Stub for AppInsightsCore.prototype.evtNamespace.\r\n// Removed Stub for AppInsightsCore.prototype.addUnloadCb.\r\n// Removed Stub for AppInsightsCore.prototype.flush.\r\n// Removed Stub for AppInsightsCore.prototype.getTraceCtx.\r\n// Removed Stub for AppInsightsCore.prototype.setTraceCtx.\r\n// Removed Stub for AppInsightsCore.prototype.addUnloadHook.\r\n// Removed Stub for AppInsightsCore.prototype.onCfgChange.\r\n// Removed Stub for AppInsightsCore.prototype.releaseQueue.\r\n// Removed Stub for AppInsightsCore.prototype._updateHook.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n AppInsightsCore.__ieDyn=1;\n\n return AppInsightsCore;\r\n}());\r\nexport { AppInsightsCore };\r\n//# sourceMappingURL=AppInsightsCore.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nexport var ChannelControllerPriority = 500;\r\n//# sourceMappingURL=Constants.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, arrIndexOf, getDocument, getWindow, isArray, objForEachKey, objKeys } from \"@nevware21/ts-utils\";\r\nimport { _DYN_HANDLER, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_REPLACE, _DYN_SPLICE, _DYN_SPLIT, _DYN_TYPE } from \"../__DynamicConstants\";\r\nimport { createElmNodeData, createUniqueNamespace } from \"./DataCacheHelper\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\n// Added to help with minfication\r\nvar strOnPrefix = \"on\";\r\nvar strAttachEvent = \"attachEvent\";\r\nvar strAddEventHelper = \"addEventListener\";\r\nvar strDetachEvent = \"detachEvent\";\r\nvar strRemoveEventListener = \"removeEventListener\";\r\nvar strEvents = \"events\";\r\nvar strVisibilityChangeEvt = \"visibilitychange\";\r\nvar strPageHide = \"pagehide\";\r\nvar strPageShow = \"pageshow\";\r\nvar strUnload = \"unload\";\r\nvar strBeforeUnload = \"beforeunload\";\r\nvar strPageHideNamespace = createUniqueNamespace(\"aiEvtPageHide\");\r\nvar strPageShowNamespace = createUniqueNamespace(\"aiEvtPageShow\");\r\nvar rRemoveEmptyNs = /\\.[\\.]+/g;\r\nvar rRemoveTrailingEmptyNs = /[\\.]+$/;\r\nvar _guid = 1;\r\nvar elmNodeData = createElmNodeData(\"events\");\r\nvar eventNamespace = /^([^.]*)(?:\\.(.+)|)/;\r\nfunction _normalizeNamespace(name) {\r\n if (name && name[_DYN_REPLACE /* @min:%2ereplace */]) {\r\n return name[_DYN_REPLACE /* @min:%2ereplace */](/^[\\s\\.]+|(?=[\\s\\.])[\\.\\s]+$/g, STR_EMPTY);\r\n }\r\n return name;\r\n}\r\nfunction _getEvtNamespace(eventName, evtNamespace) {\r\n var _a;\r\n if (evtNamespace) {\r\n var theNamespace_1 = STR_EMPTY;\r\n if (isArray(evtNamespace)) {\r\n theNamespace_1 = STR_EMPTY;\r\n arrForEach(evtNamespace, function (name) {\r\n name = _normalizeNamespace(name);\r\n if (name) {\r\n if (name[0] !== \".\") {\r\n name = \".\" + name;\r\n }\r\n theNamespace_1 += name;\r\n }\r\n });\r\n }\r\n else {\r\n theNamespace_1 = _normalizeNamespace(evtNamespace);\r\n }\r\n if (theNamespace_1) {\r\n if (theNamespace_1[0] !== \".\") {\r\n theNamespace_1 = \".\" + theNamespace_1;\r\n }\r\n // We may only have the namespace and not an eventName\r\n eventName = (eventName || STR_EMPTY) + theNamespace_1;\r\n }\r\n }\r\n var parsedEvent = (eventNamespace.exec(eventName || STR_EMPTY) || []);\r\n return _a = {},\r\n _a[_DYN_TYPE /* @min:type */] = parsedEvent[1],\r\n _a.ns = ((parsedEvent[2] || STR_EMPTY).replace(rRemoveEmptyNs, \".\").replace(rRemoveTrailingEmptyNs, STR_EMPTY)[_DYN_SPLIT /* @min:%2esplit */](\".\").sort()).join(\".\"),\r\n _a;\r\n}\r\n/**\r\n * Get all of the registered events on the target object, this is primarily used for testing cleanup but may also be used by\r\n * applications to remove their own events\r\n * @param target - The EventTarget that has registered events\r\n * @param eventName - [Optional] The name of the event to return the registered handlers and full name (with namespaces)\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n */\r\nexport function __getRegisteredEvents(target, eventName, evtNamespace) {\r\n var theEvents = [];\r\n var eventCache = elmNodeData.get(target, strEvents, {}, false);\r\n var evtName = _getEvtNamespace(eventName, evtNamespace);\r\n objForEachKey(eventCache, function (evtType, registeredEvents) {\r\n arrForEach(registeredEvents, function (value) {\r\n var _a;\r\n if (!evtName[_DYN_TYPE /* @min:%2etype */] || evtName[_DYN_TYPE /* @min:%2etype */] === value.evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n if (!evtName.ns || evtName.ns === evtName.ns) {\r\n theEvents[_DYN_PUSH /* @min:%2epush */]((_a = {},\r\n _a[_DYN_NAME /* @min:name */] = value.evtName[_DYN_TYPE /* @min:%2etype */] + (value.evtName.ns ? \".\" + value.evtName.ns : STR_EMPTY),\r\n _a.handler = value[_DYN_HANDLER /* @min:%2ehandler */],\r\n _a));\r\n }\r\n }\r\n });\r\n });\r\n return theEvents;\r\n}\r\n// Exported for internal unit testing only\r\nfunction _getRegisteredEvents(target, evtName, addDefault) {\r\n if (addDefault === void 0) { addDefault = true; }\r\n var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);\r\n var registeredEvents = aiEvts[evtName];\r\n if (!registeredEvents) {\r\n registeredEvents = aiEvts[evtName] = [];\r\n }\r\n return registeredEvents;\r\n}\r\nfunction _doDetach(obj, evtName, handlerRef, useCapture) {\r\n if (obj && evtName && evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n if (obj[strRemoveEventListener]) {\r\n obj[strRemoveEventListener](evtName[_DYN_TYPE /* @min:%2etype */], handlerRef, useCapture);\r\n }\r\n else if (obj[strDetachEvent]) {\r\n obj[strDetachEvent](strOnPrefix + evtName[_DYN_TYPE /* @min:%2etype */], handlerRef);\r\n }\r\n }\r\n}\r\nfunction _doAttach(obj, evtName, handlerRef, useCapture) {\r\n var result = false;\r\n if (obj && evtName && evtName[_DYN_TYPE /* @min:%2etype */] && handlerRef) {\r\n if (obj[strAddEventHelper]) {\r\n // all browsers except IE before version 9\r\n obj[strAddEventHelper](evtName[_DYN_TYPE /* @min:%2etype */], handlerRef, useCapture);\r\n result = true;\r\n }\r\n else if (obj[strAttachEvent]) {\r\n // IE before version 9\r\n obj[strAttachEvent](strOnPrefix + evtName[_DYN_TYPE /* @min:%2etype */], handlerRef);\r\n result = true;\r\n }\r\n }\r\n return result;\r\n}\r\nfunction _doUnregister(target, events, evtName, unRegFn) {\r\n var idx = events[_DYN_LENGTH /* @min:%2elength */];\r\n while (idx--) {\r\n var theEvent = events[idx];\r\n if (theEvent) {\r\n if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {\r\n if (!unRegFn || unRegFn(theEvent)) {\r\n _doDetach(target, theEvent.evtName, theEvent[_DYN_HANDLER /* @min:%2ehandler */], theEvent.capture);\r\n // Remove the registered event\r\n events[_DYN_SPLICE /* @min:%2esplice */](idx, 1);\r\n }\r\n }\r\n }\r\n }\r\n}\r\nfunction _unregisterEvents(target, evtName, unRegFn) {\r\n if (evtName[_DYN_TYPE /* @min:%2etype */]) {\r\n _doUnregister(target, _getRegisteredEvents(target, evtName[_DYN_TYPE /* @min:%2etype */]), evtName, unRegFn);\r\n }\r\n else {\r\n var eventCache = elmNodeData.get(target, strEvents, {});\r\n objForEachKey(eventCache, function (evtType, events) {\r\n _doUnregister(target, events, evtName, unRegFn);\r\n });\r\n // Cleanup\r\n if (objKeys(eventCache)[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n elmNodeData.kill(target, strEvents);\r\n }\r\n }\r\n}\r\nexport function mergeEvtNamespace(theNamespace, namespaces) {\r\n var newNamespaces;\r\n if (namespaces) {\r\n if (isArray(namespaces)) {\r\n newNamespaces = [theNamespace].concat(namespaces);\r\n }\r\n else {\r\n newNamespaces = [theNamespace, namespaces];\r\n }\r\n // resort the namespaces so they are always in order\r\n newNamespaces = (_getEvtNamespace(\"xx\", newNamespaces).ns)[_DYN_SPLIT /* @min:%2esplit */](\".\");\r\n }\r\n else {\r\n newNamespaces = theNamespace;\r\n }\r\n return newNamespaces;\r\n}\r\n/**\r\n * Binds the specified function to an event, so that the function gets called whenever the event fires on the object\r\n * @param obj - Object to add the event too.\r\n * @param eventName - String that specifies any of the standard DHTML Events without \"on\" prefix, if may also include an optional (dot \".\" prefixed)\r\n * namespaces \"click\" \"click.mynamespace\" in addition to specific namespaces.\r\n * @param handlerRef - Pointer that specifies the function to call when event fires\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n * @param useCapture - [Optional] Defaults to false\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\nexport function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {\r\n var _a;\r\n if (useCapture === void 0) { useCapture = false; }\r\n var result = false;\r\n if (target) {\r\n try {\r\n var evtName = _getEvtNamespace(eventName, evtNamespace);\r\n result = _doAttach(target, evtName, handlerRef, useCapture);\r\n if (result && elmNodeData.accept(target)) {\r\n var registeredEvent = (_a = {\r\n guid: _guid++,\r\n evtName: evtName\r\n },\r\n _a[_DYN_HANDLER /* @min:handler */] = handlerRef,\r\n _a.capture = useCapture,\r\n _a);\r\n _getRegisteredEvents(target, evtName.type)[_DYN_PUSH /* @min:%2epush */](registeredEvent);\r\n }\r\n }\r\n catch (e) {\r\n // Just Ignore any error so that we don't break any execution path\r\n }\r\n }\r\n return result;\r\n}\r\n/**\r\n * Removes an event handler for the specified event\r\n * @param Object - to remove the event from\r\n * @param eventName - {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param handlerRef - {any} - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param evtNamespace - [Optional] Additional namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace,\r\n * if the eventName also includes a namespace the namespace(s) are merged into a single namespace\r\n * @param useCapture - [Optional] Defaults to false\r\n */\r\nexport function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n if (target) {\r\n try {\r\n var evtName_1 = _getEvtNamespace(eventName, evtNamespace);\r\n var found_1 = false;\r\n _unregisterEvents(target, evtName_1, function (regEvent) {\r\n if ((evtName_1.ns && !handlerRef) || regEvent[_DYN_HANDLER /* @min:%2ehandler */] === handlerRef) {\r\n found_1 = true;\r\n return true;\r\n }\r\n return false;\r\n });\r\n if (!found_1) {\r\n // fallback to try and remove as requested\r\n _doDetach(target, evtName_1, handlerRef, useCapture);\r\n }\r\n }\r\n catch (e) {\r\n // Just Ignore any error so that we don't break any execution path\r\n }\r\n }\r\n}\r\n/**\r\n * Binds the specified function to an event, so that the function gets called whenever the event fires on the object\r\n * @param obj - Object to add the event too.\r\n * @param eventNameWithoutOn - String that specifies any of the standard DHTML Events without \"on\" prefix and optional (dot \".\" prefixed) namespaces \"click\" \"click.mynamespace\".\r\n * @param handlerRef - Pointer that specifies the function to call when event fires\r\n * @param useCapture - [Optional] Defaults to false\r\n * @returns True if the function was bound successfully to the event, otherwise false\r\n */\r\nexport function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);\r\n}\r\n/**\r\n * Removes an event handler for the specified event\r\n * @param Object - to remove the event from\r\n * @param eventNameWithoutOn - {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param handlerRef - {any} - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param useCapture - [Optional] Defaults to false\r\n */\r\nexport function detachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {\r\n if (useCapture === void 0) { useCapture = false; }\r\n eventOff(obj, eventNameWithoutOn, handlerRef, null, useCapture);\r\n}\r\n/**\r\n * Trys to add an event handler for the specified event to the window, body and document\r\n * @param eventName - {string} - The name of the event\r\n * @param callback - {any} - The callback function that needs to be executed for the given event\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @return {boolean} - true if the handler was successfully added\r\n */\r\nexport function addEventHandler(eventName, callback, evtNamespace) {\r\n var result = false;\r\n var w = getWindow();\r\n if (w) {\r\n result = eventOn(w, eventName, callback, evtNamespace);\r\n result = eventOn(w[\"body\"], eventName, callback, evtNamespace) || result;\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n result = eventOn(doc, eventName, callback, evtNamespace) || result;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Trys to remove event handler(s) for the specified event/namespace to the window, body and document\r\n * @param eventName - {string} - The name of the event, with optional namespaces or just the namespaces,\r\n * such as \"click\", \"click.mynamespace\" or \".mynamespace\"\r\n * @param callback - {any} - - The callback function that needs to be removed from the given event, when using a\r\n * namespace (with or without a qualifying event) this may be null to remove all previously attached event handlers\r\n * otherwise this will only remove events with this specific handler.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n */\r\nexport function removeEventHandler(eventName, callback, evtNamespace) {\r\n var w = getWindow();\r\n if (w) {\r\n eventOff(w, eventName, callback, evtNamespace);\r\n eventOff(w[\"body\"], eventName, callback, evtNamespace);\r\n }\r\n var doc = getDocument();\r\n if (doc) {\r\n eventOff(doc, eventName, callback, evtNamespace);\r\n }\r\n}\r\n/**\r\n * Bind the listener to the array of events\r\n * @param events - An string array of event names to bind the listener to\r\n * @param listener - The event callback to call when the event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nfunction _addEventListeners(events, listener, excludeEvents, evtNamespace) {\r\n var added = false;\r\n if (listener && events && events[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(events, function (name) {\r\n if (name) {\r\n if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {\r\n added = addEventHandler(name, listener, evtNamespace) || added;\r\n }\r\n }\r\n });\r\n }\r\n return added;\r\n}\r\n/**\r\n * Bind the listener to the array of events\r\n * @param events - An string array of event names to bind the listener to\r\n * @param listener - The event callback to call when the event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addEventListeners(events, listener, excludeEvents, evtNamespace) {\r\n var added = false;\r\n if (listener && events && isArray(events)) {\r\n added = _addEventListeners(events, listener, excludeEvents, evtNamespace);\r\n if (!added && excludeEvents && excludeEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Failed to add any listeners and we excluded some, so just attempt to add the excluded events\r\n added = _addEventListeners(events, listener, null, evtNamespace);\r\n }\r\n }\r\n return added;\r\n}\r\n/**\r\n * Remove the listener from the array of events\r\n * @param events - An string array of event names to bind the listener to\r\n * @param listener - The event callback to call when the event is triggered\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n */\r\nexport function removeEventListeners(events, listener, evtNamespace) {\r\n if (events && isArray(events)) {\r\n arrForEach(events, function (name) {\r\n if (name) {\r\n removeEventHandler(name, listener, evtNamespace);\r\n }\r\n });\r\n }\r\n}\r\n/**\r\n * Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring,\r\n * this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden\r\n * it does not *necessarily* mean that the page is being completely unloaded, it can mean that the user is\r\n * just navigating to a different Tab and may come back (without unloading the page). As such you may also\r\n * need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.\r\n * @param listener - The event callback to call when a page unload event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked, unless no other events can be.\r\n * @param evtNamespace - [Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {\r\n // Hook the unload event for the document, window and body to ensure that the client events are flushed to the server\r\n // As just hooking the window does not always fire (on chrome) for page navigation's.\r\n return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);\r\n}\r\n/**\r\n * Remove any matching 'beforeunload', 'unload' and 'pagehide' events that may have been added via addEventListener,\r\n * addEventListeners, addPageUnloadEventListener or addPageHideEventListener.\r\n * @param listener - The specific event callback to to be removed\r\n * @param evtNamespace - [Optional] Namespace(s) uniquely identified and removed based on this namespace.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function removePageUnloadEventListener(listener, evtNamespace) {\r\n removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);\r\n}\r\n/**\r\n * Listen to the pagehide and visibility changing to 'hidden' events, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call\r\n * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The event callback to call when a page hide event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional] A Namespace to append to the event listeners so they can be uniquely identified and removed\r\n * based on this namespace. This call also adds an additional unique \"pageshow\" namespace to the events\r\n * so that only the matching \"removePageHideEventListener\" can remove these events.\r\n * Suggestion: pass as true if you are also calling addPageUnloadEventListener as that also hooks pagehide\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageHideEventListener(listener, excludeEvents, evtNamespace) {\r\n function _handlePageVisibility(evt) {\r\n var doc = getDocument();\r\n if (listener && doc && doc.visibilityState === \"hidden\") {\r\n listener(evt);\r\n }\r\n }\r\n // add the unique page show namespace to any provided namespace so we can only remove the ones added by \"pagehide\"\r\n var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);\r\n var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);\r\n if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {\r\n pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;\r\n }\r\n if (!pageUnloadAdded && excludeEvents) {\r\n // Failed to add any listeners and we where requested to exclude some, so just call again without excluding anything\r\n pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);\r\n }\r\n return pageUnloadAdded;\r\n}\r\n/**\r\n * Removes the pageHide event listeners added by addPageHideEventListener, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageHideEventListener\r\n * as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\r\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\r\n */\r\nexport function removePageHideEventListener(listener, evtNamespace) {\r\n // add the unique page show namespace to any provided namespace so we only remove the ones added by \"pagehide\"\r\n var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);\r\n removeEventListeners([strPageHide], listener, newNamespaces);\r\n removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);\r\n}\r\n/**\r\n * Listen to the pageshow and visibility changing to 'visible' events, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when if you plan to call\r\n * removePageShowEventListener as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The event callback to call when a page is show event is triggered\r\n * @param excludeEvents - [Optional] An array of events that should not be hooked (if possible), unless no other events can be.\r\n * @param evtNamespace - [Optional/Recommended] A Namespace to append to the event listeners so they can be uniquely\r\n * identified and removed based on this namespace. This call also adds an additional unique \"pageshow\" namespace to the events\r\n * so that only the matching \"removePageShowEventListener\" can remove these events.\r\n * @returns true - when at least one of the events was registered otherwise false\r\n */\r\nexport function addPageShowEventListener(listener, excludeEvents, evtNamespace) {\r\n function _handlePageVisibility(evt) {\r\n var doc = getDocument();\r\n if (listener && doc && doc.visibilityState === \"visible\") {\r\n listener(evt);\r\n }\r\n }\r\n // add the unique page show namespace to any provided namespace so we can only remove the ones added by \"pageshow\"\r\n var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);\r\n var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);\r\n pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;\r\n if (!pageShowAdded && excludeEvents) {\r\n // Failed to add any listeners and we where requested to exclude some, so just call again without excluding anything\r\n pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);\r\n }\r\n return pageShowAdded;\r\n}\r\n/**\r\n * Removes the pageShow event listeners added by addPageShowEventListener, because the 'visibilitychange' uses\r\n * an internal proxy to detect the visibility state you SHOULD use a unique namespace when calling addPageShowEventListener\r\n * as the remove ignores the listener argument for the 'visibilitychange' event.\r\n * @param listener - The specific listener to remove for the 'pageshow' event only (ignored for 'visibilitychange')\r\n * @param evtNamespace - The unique namespace used when calling addPageShowEventListener\r\n */\r\nexport function removePageShowEventListener(listener, evtNamespace) {\r\n // add the unique page show namespace to any provided namespace so we only remove the ones added by \"pageshow\"\r\n var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);\r\n removeEventListeners([strPageShow], listener, newNamespaces);\r\n removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);\r\n}\r\n//# sourceMappingURL=EventHelpers.js.map","/*\n * Application Insights JavaScript SDK - Core, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { strShimFunction, strShimPrototype } from \"@microsoft/applicationinsights-shims\";\r\nimport { getInst, objHasOwnProperty } from \"@nevware21/ts-utils\";\r\nimport { _DYN_APPLY, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SPLICE } from \"../__DynamicConstants\";\r\nimport { _getObjProto } from \"./HelperFuncs\";\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[_DYN_LENGTH /* @min:%2elength */]; 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 /* CallbackType.Request */ && type <= 2 /* CallbackType.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[_DYN_APPLY /* @min:%2eapply */](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 /* CallbackType.HookError */]];\r\n if (hookErrorCb) {\r\n callDetails.err = err;\r\n hookErrorCb[_DYN_APPLY /* @min:%2eapply */](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 _a;\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 = (_a = {},\r\n _a[_DYN_NAME /* @min:name */] = aiHook.n,\r\n _a.inst = funcThis,\r\n _a.ctx = null,\r\n _a.set = _replaceArg,\r\n _a);\r\n var hookCtx = [];\r\n var cbArgs = _createArgs([funcArgs], orgArgs);\r\n funcArgs.evt = getInst(\"event\");\r\n function _createArgs(target, theArgs) {\r\n _arrLoop(theArgs, function (arg) {\r\n target[_DYN_PUSH /* @min:%2epush */](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 /* CallbackType.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[_DYN_APPLY /* @min:%2eapply */](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 /* CallbackType.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 /* CallbackType.Response */);\r\n return funcArgs.rslt;\r\n };\r\n}\r\n/** @ignore */\r\nfunction _getOwner(target, name, checkPrototype, checkParentProto) {\r\n var owner = null;\r\n if (target) {\r\n if (objHasOwnProperty(target, name)) {\r\n owner = target;\r\n }\r\n else if (checkPrototype) {\r\n owner = _getOwner(_getObjProto(target), name, checkParentProto, 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[_DYN_SPLICE /* @min:%2esplice */](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[_DYN_PUSH /* @min:%2epush */](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 * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype\r\n */\r\nexport function InstrumentFunc(target, funcName, callbacks, checkPrototype, checkParentProto) {\r\n if (checkPrototype === void 0) { checkPrototype = true; }\r\n if (target && funcName && callbacks) {\r\n var owner = _getOwner(target, funcName, checkPrototype, checkParentProto);\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 * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype\r\n */\r\nexport function InstrumentFuncs(target, funcNames, callbacks, checkPrototype, checkParentProto) {\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, checkParentProto);\r\n if (hook) {\r\n if (!hooks) {\r\n hooks = [];\r\n }\r\n hooks[_DYN_PUSH /* @min:%2epush */](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 * @param checkParentProto - If the function doesn't exist on the target or it's prototype should it attempt to hook the parent's prototype\r\n */\r\nexport function InstrumentEvent(target, evtName, callbacks, checkPrototype, checkParentProto) {\r\n if (target && evtName && callbacks) {\r\n var owner = _getOwner(target, evtName, checkPrototype, checkParentProto) || 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 * 1DS JS SDK Core, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n\r\n// Licensed under the MIT License.\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)\r\n// as when using \"short\" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_DEFAULT_ENDPOINT_URL = \"https://browser.events.data.microsoft.com/OneCollector/1.0/\";\r\nexport var STR_VERSION = \"version\";\r\nexport var STR_PROPERTIES = \"properties\";\r\n//# sourceMappingURL=InternalConstants.js.map","/*\n * 1DS JS SDK Core, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 4\r\nexport var _DYN_LOGGER = \"logger\"; // Count: 4\r\nexport var _DYN_INDEX_OF = \"indexOf\"; // Count: 4\r\nexport var _DYN_TIMINGS = \"timings\"; // Count: 4\r\nexport var _DYN_POLL_INTERNAL_LOGS = \"pollInternalLogs\"; // Count: 4\r\nexport var _DYN_VALUE = \"value\"; // Count: 20\r\nexport var _DYN_KIND = \"kind\"; // Count: 5\r\nexport var _DYN_LENGTH = \"length\"; // Count: 7\r\nexport var _DYN_PROCESS_TELEMETRY_ST0 = \"processTelemetryStart\"; // Count: 3\r\nexport var _DYN_HANDLE_FIELD = \"handleField\"; // Count: 3\r\nexport var _DYN_RM_SANITIZER = \"rmSanitizer\"; // Count: 3\r\nexport var _DYN_RM_FIELD_SANITIZER = \"rmFieldSanitizer\"; // Count: 3\r\nexport var _DYN_CAN_HANDLE = \"canHandle\"; // Count: 7\r\n//# sourceMappingURL=__DynamicConstants.js.map","/*\n * 1DS JS SDK Core, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nvar _a;\r\n/**\r\n* Utils.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n* File containing utility functions.\r\n*/\r\nimport { arrForEach, getGlobalInst, getNavigator, hasDocument, hasWindow, isArray, isBoolean, isNullOrUndefined, isNumber, isObject, isReactNative, isString, isUndefined, newGuid, objForEachKey, perfNow } from \"@microsoft/applicationinsights-core-js\";\r\nimport { ObjProto, strShimObject } from \"@microsoft/applicationinsights-shims\";\r\nimport { strIndexOf, strLeft } from \"@nevware21/ts-utils\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { _DYN_INDEX_OF, _DYN_KIND, _DYN_LENGTH, _DYN_PROCESS_TELEMETRY_ST0, _DYN_TIMINGS, _DYN_VALUE } from \"./__DynamicConstants\";\r\nexport var Version = '4.0.2';\r\nexport var FullVersionString = \"1DS-Web-JS-\" + Version;\r\nvar ObjHasOwnProperty = ObjProto.hasOwnProperty;\r\n// Defining here so we don't need to take (import) the ApplicationInsights Common module\r\nvar strDisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nvar strWithCredentials = \"withCredentials\";\r\nvar strTimeout = \"timeout\";\r\n// If value is array just get the type for the first element\r\nvar _fieldTypeEventPropMap = (_a = {},\r\n _a[0 /* FieldValueSanitizerType.NotSet */] = 0 /* eEventPropertyType.Unspecified */,\r\n _a[2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 2 /* FieldValueSanitizerType.Number */] = 6 /* eEventPropertyType.Double */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 1 /* FieldValueSanitizerType.String */] = 1 /* eEventPropertyType.String */,\r\n _a[4096 /* FieldValueSanitizerType.Array */ | 3 /* FieldValueSanitizerType.Boolean */] = 7 /* eEventPropertyType.Bool */,\r\n _a);\r\n/**\r\n * @ignore\r\n */\r\n// let _uaDisallowsSameSiteNone = null;\r\nvar uInt8ArraySupported = null;\r\n// var _areCookiesAvailable: boolean | undefined;\r\n/**\r\n * Checks if document object is available\r\n */\r\nexport var isDocumentObjectAvailable = hasDocument();\r\n/**\r\n * Checks if window object is available\r\n */\r\nexport var isWindowObjectAvailable = hasWindow();\r\n/**\r\n * Checks if value is assigned to the given param.\r\n * @param value - The token from which the tenant id is to be extracted.\r\n * @returns True/false denoting if value is assigned to the param.\r\n */\r\nexport function isValueAssigned(value) {\r\n /// takes a value and checks for undefined, null and empty string \r\n /// value to be tested \r\n /// true if value is null undefined or emptyString \r\n return !(value === STR_EMPTY || isNullOrUndefined(value));\r\n}\r\n/**\r\n * Gets the tenant id from the tenant token.\r\n * @param apiKey - The token from which the tenant id is to be extracted.\r\n * @returns The tenant id.\r\n */\r\nexport function getTenantId(apiKey) {\r\n if (apiKey) {\r\n var indexTenantId = strIndexOf(apiKey, \"-\");\r\n if (indexTenantId > -1) {\r\n return strLeft(apiKey, indexTenantId);\r\n }\r\n }\r\n return STR_EMPTY;\r\n}\r\n/**\r\n * Checks if Uint8Array are available in the current environment. Safari and Firefox along with\r\n * ReactNative are known to not support Uint8Array properly.\r\n * @returns True if available, false otherwise.\r\n */\r\nexport function isUint8ArrayAvailable() {\r\n if (uInt8ArraySupported === null) {\r\n uInt8ArraySupported = !isUndefined(Uint8Array) && !isSafariOrFirefox() && !isReactNative();\r\n }\r\n return uInt8ArraySupported;\r\n}\r\n/**\r\n * Checks if the value is a valid EventLatency.\r\n * @param value - The value that needs to be checked.\r\n * @returns True if the value is in AWTEventLatency, false otherwise.\r\n */\r\nexport function isLatency(value) {\r\n if (value && isNumber(value) && value >= 1 /* EventLatencyValue.Normal */ && value <= 4 /* EventLatencyValue.Immediate */) {\r\n return true;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Sanitizes the Property. It checks the that the property name and value are valid. It also\r\n * checks/populates the correct type and pii of the property value.\r\n * @param name - property name - The property name.\r\n * @param property - The property value or an IEventProperty containing value,\r\n * type ,pii and customer content.\r\n * @returns IEventProperty containing valid name, value, pii and type or null if invalid.\r\n */\r\nexport function sanitizeProperty(name, property, stringifyObjects) {\r\n // Check that property is valid\r\n if ((!property && !isValueAssigned(property)) || typeof name !== \"string\") {\r\n return null;\r\n }\r\n // Perf optimization -- only need to get the type once not multiple times\r\n var propType = typeof property;\r\n // If the property isn't IEventProperty (and is either string, number, boolean or array), convert it into one.\r\n if (propType === \"string\" || propType === \"number\" || propType === \"boolean\" || isArray(property)) {\r\n property = { value: property };\r\n }\r\n else if (propType === \"object\" && !ObjHasOwnProperty.call(property, \"value\")) {\r\n property = { value: stringifyObjects ? JSON.stringify(property) : property };\r\n }\r\n else if (isNullOrUndefined(property[_DYN_VALUE /* @min:%2evalue */])\r\n || property[_DYN_VALUE /* @min:%2evalue */] === STR_EMPTY || (!isString(property[_DYN_VALUE /* @min:%2evalue */])\r\n && !isNumber(property[_DYN_VALUE /* @min:%2evalue */]) && !isBoolean(property[_DYN_VALUE /* @min:%2evalue */])\r\n && !isArray(property[_DYN_VALUE /* @min:%2evalue */]))) {\r\n // Since property is IEventProperty, we need to validate its value\r\n return null;\r\n }\r\n // We need to check that if the property value is an array, it is valid\r\n if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) &&\r\n !isArrayValid(property[_DYN_VALUE /* @min:%2evalue */])) {\r\n return null;\r\n }\r\n // If either pii or cc is set convert value to string (since only string pii/cc is allowed).\r\n // If the value is a complex type like an array that can't be converted to string we will drop\r\n // the property.\r\n if (!isNullOrUndefined(property[_DYN_KIND /* @min:%2ekind */])) {\r\n if (isArray(property[_DYN_VALUE /* @min:%2evalue */]) || !isValueKind(property[_DYN_KIND /* @min:%2ekind */])) {\r\n return null;\r\n }\r\n property[_DYN_VALUE /* @min:%2evalue */] = property[_DYN_VALUE /* @min:%2evalue */].toString();\r\n }\r\n return property;\r\n}\r\nexport function getCommonSchemaMetaData(value, kind, type) {\r\n var encodedTypeValue = -1;\r\n if (!isUndefined(value)) {\r\n if (kind > 0) {\r\n if (kind === 32) {\r\n // encode customer content. Value can only be string. bit 13-16 are for cc\r\n encodedTypeValue = (1 << 13);\r\n }\r\n else if (kind <= 13) {\r\n // encode PII. Value can only be string. bits 5-12 are for Pii\r\n encodedTypeValue = (kind << 5);\r\n }\r\n }\r\n // isDataType checks that the \"type\" is a number so we don't need to check for undefined\r\n if (isDataType(type)) {\r\n // Data Type is provided and valid, so use that\r\n if (encodedTypeValue === -1) {\r\n // Don't return -1\r\n encodedTypeValue = 0;\r\n }\r\n encodedTypeValue |= type;\r\n }\r\n else {\r\n var propType = _fieldTypeEventPropMap[getFieldValueType(value)] || -1;\r\n if (encodedTypeValue !== -1 && propType !== -1) {\r\n // pii exists so we must return correct type\r\n encodedTypeValue |= propType;\r\n }\r\n else if (propType === 6 /* eEventPropertyType.Double */) {\r\n encodedTypeValue = propType;\r\n }\r\n }\r\n }\r\n return encodedTypeValue;\r\n}\r\n/**\r\n * Helper to get and decode the cookie value using decodeURIComponent, this is for historical\r\n * backward compatibility where the document.cookie value was decoded before parsing.\r\n * @param cookieMgr - The cookie manager to use\r\n * @param name - The name of the cookie to get\r\n * @param decode - A flag to indicate whether the cookie value should be decoded\r\n * @returns The decoded cookie value (if available) otherwise an empty string.\r\n */\r\nexport function getCookieValue(cookieMgr, name, decode) {\r\n if (decode === void 0) { decode = true; }\r\n var cookieValue;\r\n if (cookieMgr) {\r\n cookieValue = cookieMgr.get(name);\r\n if (decode && cookieValue && decodeURIComponent) {\r\n cookieValue = decodeURIComponent(cookieValue);\r\n }\r\n }\r\n return cookieValue || STR_EMPTY;\r\n}\r\n/**\r\n * Create a new guid.\r\n * @param style - The style of guid to generated, defaults to Digits\r\n * Digits (Default) : 32 digits separated by hyphens: 00000000-0000-0000-0000-000000000000\r\n * Braces - 32 digits separated by hyphens, enclosed in braces: {00000000-0000-0000-0000-000000000000}\r\n * Parentheses - 32 digits separated by hyphens, enclosed in parentheses: (00000000-0000-0000-0000-000000000000)\r\n * Numeric - 32 digits: 00000000000000000000000000000000\r\n * @returns The formatted guid.\r\n */\r\nexport function createGuid(style) {\r\n if (style === void 0) { style = \"D\" /* GuidStyle.Digits */; }\r\n var theGuid = newGuid();\r\n if (style === \"B\" /* GuidStyle.Braces */) {\r\n theGuid = \"{\" + theGuid + \"}\";\r\n }\r\n else if (style === \"P\" /* GuidStyle.Parentheses */) {\r\n theGuid = \"(\" + theGuid + \")\";\r\n }\r\n else if (style === \"N\" /* GuidStyle.Numeric */) {\r\n theGuid = theGuid.replace(/-/g, STR_EMPTY);\r\n }\r\n return theGuid;\r\n}\r\n/**\r\n * Pass in the objects to merge as arguments.\r\n * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.\r\n * @param obj2 - object to merge.\r\n * @param obj3 - object to merge.\r\n * @param obj4 - object to merge.\r\n * @param obj5 - object to merge.\r\n * @returns The extended object.\r\n */\r\nexport function extend(obj, obj2, obj3, obj4, obj5) {\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n var length = arguments[_DYN_LENGTH /* @min:%2elength */];\r\n var theArgs = arguments;\r\n // Check if a deep merge\r\n if (isBoolean(theArgs[0])) {\r\n deep = theArgs[0];\r\n i++;\r\n }\r\n // Loop through each object and conduct a merge\r\n for (; i < length; i++) {\r\n var obj = theArgs[i];\r\n objForEachKey(obj, function (prop, value) {\r\n // If deep merge and property is an object, merge properties\r\n if (deep && value && isObject(value)) {\r\n if (isArray(value)) {\r\n extended[prop] = extended[prop] || [];\r\n arrForEach(value, function (arrayValue, arrayIndex) {\r\n if (arrayValue && isObject(arrayValue)) {\r\n extended[prop][arrayIndex] = extend(true, extended[prop][arrayIndex], arrayValue);\r\n }\r\n else {\r\n extended[prop][arrayIndex] = arrayValue;\r\n }\r\n });\r\n }\r\n else {\r\n extended[prop] = extend(true, extended[prop], value);\r\n }\r\n }\r\n else {\r\n extended[prop] = value;\r\n }\r\n });\r\n }\r\n return extended;\r\n}\r\nexport var getTime = perfNow;\r\nexport function isValueKind(value) {\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value === 0 /* eValueKind.NotSet */ || ((value > 0 /* eValueKind.NotSet */ && value <= 13 /* eValueKind.Pii_IPV4AddressLegacy */) || value === 32 /* eValueKind.CustomerContent_GenericContent */)) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isDataType(value) {\r\n // Remark: 0 returns false, but it doesn't affect encoding anyways\r\n // Always assume that it's a number (no type checking) for performance as this is used during the JSON serialization\r\n if (value >= 0 && value <= 9) {\r\n return true;\r\n }\r\n return false;\r\n}\r\nfunction isSafariOrFirefox() {\r\n var nav = getNavigator();\r\n // If non-browser navigator will be undefined\r\n if (!isUndefined(nav) && nav.userAgent) {\r\n var ua = nav.userAgent.toLowerCase();\r\n if ((ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"safari\") >= 0 || ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"firefox\") >= 0) && ua[_DYN_INDEX_OF /* @min:%2eindexOf */](\"chrome\") < 0) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\nexport function isArrayValid(value) {\r\n return value[_DYN_LENGTH /* @min:%2elength */] > 0;\r\n}\r\nexport function setProcessTelemetryTimings(event, identifier) {\r\n var evt = event;\r\n evt[_DYN_TIMINGS /* @min:%2etimings */] = evt[_DYN_TIMINGS /* @min:%2etimings */] || {};\r\n evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */] = evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */] || {};\r\n evt[_DYN_TIMINGS /* @min:%2etimings */][_DYN_PROCESS_TELEMETRY_ST0 /* @min:%2eprocessTelemetryStart */][identifier] = getTime();\r\n}\r\n/**\r\n * Returns a bitwise value for the FieldValueSanitizerType enum representing the decoded type of the passed value\r\n * @param value The value to determine the type\r\n */\r\nexport function getFieldValueType(value) {\r\n var theType = 0 /* FieldValueSanitizerType.NotSet */;\r\n if (value !== null && value !== undefined) {\r\n var objType = typeof value;\r\n if (objType === \"string\") {\r\n theType = 1 /* FieldValueSanitizerType.String */;\r\n }\r\n else if (objType === \"number\") {\r\n theType = 2 /* FieldValueSanitizerType.Number */;\r\n }\r\n else if (objType === \"boolean\") {\r\n theType = 3 /* FieldValueSanitizerType.Boolean */;\r\n }\r\n else if (objType === strShimObject) {\r\n theType = 4 /* FieldValueSanitizerType.Object */;\r\n if (isArray(value)) {\r\n theType = 4096 /* FieldValueSanitizerType.Array */;\r\n if (value[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Empty arrays are not supported and are considered to be the same as null\r\n theType |= getFieldValueType(value[0]);\r\n }\r\n }\r\n else if (ObjHasOwnProperty.call(value, \"value\")) {\r\n // Looks like an IEventProperty\r\n theType = 8192 /* FieldValueSanitizerType.EventProperty */ | getFieldValueType(value[_DYN_VALUE /* @min:%2evalue */]);\r\n }\r\n }\r\n }\r\n return theType;\r\n}\r\n/**\r\n * Helper to identify whether we are running in a chromium based browser environment\r\n */\r\nexport function isChromium() {\r\n return !!getGlobalInst(\"chrome\");\r\n}\r\n/**\r\n * Create and open an XMLHttpRequest object\r\n * @param method - The request method\r\n * @param urlString - The url\r\n * @param withCredentials - Option flag indicating that credentials should be sent\r\n * @param disabled - Optional flag indicating that the XHR object should be marked as disabled and not tracked (default is false)\r\n * @param isSync - Optional flag indicating if the instance should be a synchronous request (defaults to false)\r\n * @param timeout - Optional value identifying the timeout value that should be assigned to the XHR request\r\n * @returns A new opened XHR request\r\n */\r\nexport function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) {\r\n if (disabled === void 0) { disabled = false; }\r\n if (isSync === void 0) { isSync = false; }\r\n function _wrapSetXhrProp(xhr, prop, value) {\r\n try {\r\n xhr[prop] = value;\r\n }\r\n catch (e) {\r\n // - Wrapping as depending on the environment setting the property may fail (non-terminally)\r\n }\r\n }\r\n var xhr = new XMLHttpRequest();\r\n if (disabled) {\r\n // Tag the instance so it's not tracked (trackDependency)\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);\r\n }\r\n if (withCredentials) {\r\n // Some libraries require that the withCredentials flag is set \"before\" open and\r\n // - Wrapping as IE 10 has started throwing when setting before open\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n xhr.open(method, urlString, !isSync);\r\n if (withCredentials) {\r\n // withCredentials should be set AFTER open (https://xhr.spec.whatwg.org/#the-withcredentials-attribute)\r\n // And older firefox instances from 11+ will throw for sync events (current versions don't) which happens during unload processing\r\n _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);\r\n }\r\n // Only set the timeout for asynchronous requests as\r\n // \"Timeout shouldn't be used for synchronous XMLHttpRequests requests used in a document environment or it will throw an InvalidAccessError exception.\"\"\r\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\r\n if (!isSync && timeout) {\r\n _wrapSetXhrProp(xhr, strTimeout, timeout);\r\n }\r\n return xhr;\r\n}\r\n/**\r\n * Check to see if the value is > 0\r\n * @param value - The value to check\r\n * @returns true if > 0 otherwise false\r\n */\r\nexport function isGreaterThanZero(value) {\r\n return value > 0;\r\n}\r\n//# sourceMappingURL=Utils.js.map","/*\n * 1DS JS SDK Core, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\n/**\r\n* AppInsightsCore.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AppInsightsCore as InternalCore, _throwInternal, createDynamicConfig, doPerf, dumpObj, throwError } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { STR_DEFAULT_ENDPOINT_URL, STR_EMPTY, STR_PROPERTIES, STR_VERSION } from \"./InternalConstants\";\r\nimport { FullVersionString, getTime, isLatency } from \"./Utils\";\r\nimport { _DYN_INDEX_OF, _DYN_INITIALIZE, _DYN_LOGGER, _DYN_POLL_INTERNAL_LOGS, _DYN_TIMINGS } from \"./__DynamicConstants\";\r\n/**\r\n * The default settings for the config.\r\n * WE MUST include all defaults here to ensure that the config is created with all of the properties\r\n * defined as dynamic.\r\n */\r\nvar defaultConfig = objDeepFreeze({\r\n endpointUrl: STR_DEFAULT_ENDPOINT_URL,\r\n propertyStorageOverride: { isVal: _chkPropOverride }\r\n});\r\nfunction _chkPropOverride(propertyStorageOverride) {\r\n // Validate property storage override\r\n if (propertyStorageOverride && (!propertyStorageOverride.getProperty || !propertyStorageOverride.setProperty)) {\r\n throwError(\"Invalid property storage override passed.\");\r\n }\r\n return true;\r\n}\r\n/**\r\n * @group Classes\r\n * @group Entrypoint\r\n */\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[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, extensions, logger, notificationManager) {\r\n doPerf(_self, function () { return \"AppInsightsCore.initialize\"; }, function () {\r\n try {\r\n _base[_DYN_INITIALIZE /* @min:%2einitialize */](createDynamicConfig(config, defaultConfig, logger || _self[_DYN_LOGGER /* @min:%2elogger */], false).cfg, extensions, logger, notificationManager);\r\n }\r\n catch (e) {\r\n var logger_1 = _self[_DYN_LOGGER /* @min:%2elogger */];\r\n var message = dumpObj(e);\r\n if (message[_DYN_INDEX_OF /* @min:%2eindexOf */](\"channels\") !== -1) {\r\n // Add some additional context to the underlying reported error\r\n message += \"\\n - Channels must be provided through config.channels only!\";\r\n }\r\n _throwInternal(logger_1, 1 /* eLoggingSeverity.CRITICAL */, 514 /* _eExtendedInternalMessageId.FailedToInitializeSDK */, \"SDK Initialization Failed - no telemetry will be sent: \" + message);\r\n }\r\n }, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });\r\n };\r\n _self.track = function (item) {\r\n doPerf(_self, function () { return \"AppInsightsCore.track\"; }, function () {\r\n var telemetryItem = item;\r\n if (telemetryItem) {\r\n telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] = telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] || {};\r\n telemetryItem[_DYN_TIMINGS /* @min:%2etimings */].trackStart = getTime();\r\n if (!isLatency(telemetryItem.latency)) {\r\n telemetryItem.latency = 1 /* EventLatencyValue.Normal */;\r\n }\r\n var itemExt = telemetryItem.ext = telemetryItem.ext || {};\r\n itemExt.sdk = itemExt.sdk || {};\r\n itemExt.sdk.ver = FullVersionString;\r\n var baseData = telemetryItem.baseData = telemetryItem.baseData || {};\r\n baseData[STR_PROPERTIES /* @min:%2eproperties */] = baseData[STR_PROPERTIES /* @min:%2eproperties */] || {};\r\n var itemProperties = baseData[STR_PROPERTIES /* @min:%2eproperties */];\r\n itemProperties[STR_VERSION] = itemProperties[STR_VERSION] || _self.pluginVersionString || STR_EMPTY;\r\n }\r\n _base.track(telemetryItem);\r\n }, function () { return ({ item: item }); }, !(item.sync));\r\n };\r\n _self[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */] = function (eventName) {\r\n return _base[_DYN_POLL_INTERNAL_LOGS /* @min:%2epollInternalLogs */](eventName || \"InternalLog\");\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// Removed Stub for AppInsightsCore.prototype.pollInternalLogs.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n AppInsightsCore.__ieDyn=1;\n\n return AppInsightsCore;\r\n}(InternalCore));\r\nexport { AppInsightsCore };\r\n//# sourceMappingURL=AppInsightsCore.js.map","/*\n * 1DS JS SDK Core, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Enums.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n* File containing the enums as constants.\r\n*/\r\nimport { createEnumStyle } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * The ValueKind contains a set of values that specify value kind of the property.\r\n * Either PII (Personal Identifiable Information) or customer content.\r\n */\r\nexport var ValueKind = createEnumStyle({\r\n NotSet: 0 /* eValueKind.NotSet */,\r\n Pii_DistinguishedName: 1 /* eValueKind.Pii_DistinguishedName */,\r\n Pii_GenericData: 2 /* eValueKind.Pii_GenericData */,\r\n Pii_IPV4Address: 3 /* eValueKind.Pii_IPV4Address */,\r\n Pii_IPv6Address: 4 /* eValueKind.Pii_IPv6Address */,\r\n Pii_MailSubject: 5 /* eValueKind.Pii_MailSubject */,\r\n Pii_PhoneNumber: 6 /* eValueKind.Pii_PhoneNumber */,\r\n Pii_QueryString: 7 /* eValueKind.Pii_QueryString */,\r\n Pii_SipAddress: 8 /* eValueKind.Pii_SipAddress */,\r\n Pii_SmtpAddress: 9 /* eValueKind.Pii_SmtpAddress */,\r\n Pii_Identity: 10 /* eValueKind.Pii_Identity */,\r\n Pii_Uri: 11 /* eValueKind.Pii_Uri */,\r\n Pii_Fqdn: 12 /* eValueKind.Pii_Fqdn */,\r\n Pii_IPV4AddressLegacy: 13 /* eValueKind.Pii_IPV4AddressLegacy */,\r\n CustomerContent_GenericContent: 32 /* eValueKind.CustomerContent_GenericContent */\r\n});\r\n/**\r\n * The EventLatency contains a set of values that specify the latency with which an event is sent.\r\n */\r\nexport var EventLatency = createEnumStyle({\r\n /**\r\n * Normal latency.\r\n */\r\n Normal: 1 /* EventLatencyValue.Normal */,\r\n /**\r\n * Cost deferred latency. At the moment this latency is treated as Normal latency.\r\n */\r\n CostDeferred: 2 /* EventLatencyValue.CostDeferred */,\r\n /**\r\n * Real time latency.\r\n */\r\n RealTime: 3 /* EventLatencyValue.RealTime */,\r\n /**\r\n * Bypass normal batching/timing and send as soon as possible, this will still send asynchronously.\r\n * Added in v3.1.1\r\n */\r\n Immediate: 4 /* EventLatencyValue.Immediate */\r\n});\r\n/**\r\n * Enum for property types.\r\n */\r\nexport var EventPropertyType = createEnumStyle({\r\n Unspecified: 0 /* eEventPropertyType.Unspecified */,\r\n String: 1 /* eEventPropertyType.String */,\r\n Int32: 2 /* eEventPropertyType.Int32 */,\r\n UInt32: 3 /* eEventPropertyType.UInt32 */,\r\n Int64: 4 /* eEventPropertyType.Int64 */,\r\n UInt64: 5 /* eEventPropertyType.UInt64 */,\r\n Double: 6 /* eEventPropertyType.Double */,\r\n Bool: 7 /* eEventPropertyType.Bool */,\r\n Guid: 8 /* eEventPropertyType.Guid */,\r\n DateTime: 9 /* eEventPropertyType.DateTime */\r\n});\r\n/**\r\n * The EventPersistence contains a set of values that specify the event's persistence.\r\n */\r\nexport var EventPersistence = createEnumStyle({\r\n /**\r\n * Normal persistence.\r\n */\r\n Normal: 1 /* EventPersistenceValue.Normal */,\r\n /**\r\n * Critical persistence.\r\n */\r\n Critical: 2 /* EventPersistenceValue.Critical */\r\n});\r\nexport var TraceLevel = createEnumStyle({\r\n NONE: 0 /* eTraceLevel.NONE */,\r\n ERROR: 1 /* eTraceLevel.ERROR */,\r\n WARNING: 2 /* eTraceLevel.WARNING */,\r\n INFORMATION: 3 /* eTraceLevel.INFORMATION */\r\n});\r\n//# sourceMappingURL=Enums.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n * Real Time profile (default profile). RealTime Latency events are sent every 1 sec and\r\n * Normal Latency events are sent every 2 sec.\r\n */\r\nexport var RT_PROFILE = \"REAL_TIME\";\r\n/**\r\n * Near Real Time profile. RealTime Latency events are sent every 3 sec and\r\n * Normal Latency events are sent every 6 sec.\r\n */\r\nexport var NRT_PROFILE = \"NEAR_REAL_TIME\";\r\n/**\r\n * Best Effort. RealTime Latency events are sent every 9 sec and\r\n * Normal Latency events are sent every 18 sec.\r\n */\r\nexport var BE_PROFILE = \"BEST_EFFORT\";\r\n//# sourceMappingURL=DataModels.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n\r\n// Licensed under the MIT License.\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)\r\n// as when using \"short\" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.\r\nexport var STR_EMPTY = \"\";\r\nexport var STR_POST_METHOD = \"POST\";\r\nexport var STR_DISABLED_PROPERTY_NAME = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nexport var STR_DROPPED = \"drop\";\r\nexport var STR_SENDING = \"send\";\r\nexport var STR_REQUEUE = \"requeue\";\r\nexport var STR_RESPONSE_FAIL = \"rspFail\";\r\nexport var STR_OTHER = \"oth\";\r\nexport var DEFAULT_CACHE_CONTROL = \"no-cache, no-store\";\r\nexport var DEFAULT_CONTENT_TYPE = \"application/x-json-stream\";\r\nexport var STR_CACHE_CONTROL = \"cache-control\";\r\nexport var STR_CONTENT_TYPE_HEADER = \"content-type\";\r\nexport var STR_KILL_TOKENS_HEADER = \"kill-tokens\";\r\nexport var STR_KILL_DURATION_HEADER = \"kill-duration\";\r\nexport var STR_KILL_DURATION_SECONDS_HEADER = \"kill-duration-seconds\";\r\nexport var STR_TIME_DELTA_HEADER = \"time-delta-millis\";\r\nexport var STR_CLIENT_VERSION = \"client-version\";\r\nexport var STR_CLIENT_ID = \"client-id\";\r\nexport var STR_TIME_DELTA_TO_APPLY = \"time-delta-to-apply-millis\";\r\nexport var STR_UPLOAD_TIME = \"upload-time\";\r\nexport var STR_API_KEY = \"apikey\";\r\nexport var STR_MSA_DEVICE_TICKET = \"AuthMsaDeviceTicket\";\r\nexport var STR_AUTH_XTOKEN = \"AuthXToken\";\r\nexport var STR_SDK_VERSION = \"sdk-version\";\r\nexport var STR_NO_RESPONSE_BODY = \"NoResponseBody\";\r\nexport var STR_MSFPC = \"msfpc\";\r\nexport var STR_TRACE = \"trace\";\r\nexport var STR_USER = \"user\";\r\n//# sourceMappingURL=InternalConstants.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_ALLOW_REQUEST_SENDIN0 = \"allowRequestSending\"; // Count: 3\r\nexport var _DYN_FIRST_REQUEST_SENT = \"firstRequestSent\"; // Count: 2\r\nexport var _DYN_SHOULD_ADD_CLOCK_SKE1 = \"shouldAddClockSkewHeaders\"; // Count: 2\r\nexport var _DYN_GET_CLOCK_SKEW_HEADE2 = \"getClockSkewHeaderValue\"; // Count: 2\r\nexport var _DYN_SET_CLOCK_SKEW = \"setClockSkew\"; // Count: 3\r\nexport var _DYN_DATA = \"data\"; // Count: 12\r\nexport var _DYN_LENGTH = \"length\"; // Count: 37\r\nexport var _DYN_CONCAT = \"concat\"; // Count: 9\r\nexport var _DYN_I_KEY = \"iKey\"; // Count: 10\r\nexport var _DYN_COUNT = \"count\"; // Count: 18\r\nexport var _DYN_EVENTS = \"events\"; // Count: 8\r\nexport var _DYN_PUSH = \"push\"; // Count: 13\r\nexport var _DYN_SPLIT = \"split\"; // Count: 7\r\nexport var _DYN_SPLICE = \"splice\"; // Count: 4\r\nexport var _DYN_TO_LOWER_CASE = \"toLowerCase\"; // Count: 5\r\nexport var _DYN_HDRS = \"hdrs\"; // Count: 6\r\nexport var _DYN_USE_HDRS = \"useHdrs\"; // Count: 5\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 4\r\nexport var _DYN_SET_TIMEOUT_OVERRIDE = \"setTimeoutOverride\"; // Count: 3\r\nexport var _DYN_CLEAR_TIMEOUT_OVERRI3 = \"clearTimeoutOverride\"; // Count: 3\r\nexport var _DYN_PAYLOAD_PREPROCESSOR = \"payloadPreprocessor\"; // Count: 2\r\nexport var _DYN_OVERRIDE_ENDPOINT_UR4 = \"overrideEndpointUrl\"; // Count: 3\r\nexport var _DYN_AVOID_OPTIONS = \"avoidOptions\"; // Count: 3\r\nexport var _DYN_DISABLE_EVENT_TIMING5 = \"disableEventTimings\"; // Count: 2\r\nexport var _DYN_STRINGIFY_OBJECTS = \"stringifyObjects\"; // Count: 2\r\nexport var _DYN_ENABLE_COMPOUND_KEY = \"enableCompoundKey\"; // Count: 4\r\nexport var _DYN_DISABLE_XHR_SYNC = \"disableXhrSync\"; // Count: 6\r\nexport var _DYN_DISABLE_FETCH_KEEP_A6 = \"disableFetchKeepAlive\"; // Count: 5\r\nexport var _DYN_USE_SEND_BEACON = \"useSendBeacon\"; // Count: 3\r\nexport var _DYN_ALWAYS_USE_XHR_OVERR7 = \"alwaysUseXhrOverride\"; // Count: 3\r\nexport var _DYN_UNLOAD_TRANSPORTS = \"unloadTransports\"; // Count: 2\r\nexport var _DYN_URL_STRING = \"urlString\"; // Count: 7\r\nexport var _DYN_TIMEOUT = \"timeout\"; // Count: 9\r\nexport var _DYN_ONTIMEOUT = \"ontimeout\"; // Count: 3\r\nexport var _DYN__SEND_REASON = \"_sendReason\"; // Count: 5\r\nexport var _DYN_HEADERS = \"headers\"; // Count: 12\r\nexport var _DYN_GET_RESPONSE_HEADER = \"getResponseHeader\"; // Count: 2\r\nexport var _DYN_GET_ALL_RESPONSE_HEA8 = \"getAllResponseHeaders\"; // Count: 2\r\nexport var _DYN__THE_PAYLOAD = \"_thePayload\"; // Count: 6\r\nexport var _DYN_BATCHES = \"batches\"; // Count: 15\r\nexport var _DYN_SEND_TYPE = \"sendType\"; // Count: 13\r\nexport var _DYN_CAN_SEND_REQUEST = \"canSendRequest\"; // Count: 3\r\nexport var _DYN_SEND_QUEUED_REQUESTS = \"sendQueuedRequests\"; // Count: 5\r\nexport var _DYN_IS_COMPLETELY_IDLE = \"isCompletelyIdle\"; // Count: 2\r\nexport var _DYN_SET_UNLOADING = \"setUnloading\"; // Count: 3\r\nexport var _DYN_IS_TENANT_KILLED = \"isTenantKilled\"; // Count: 3\r\nexport var _DYN_SEND_SYNCHRONOUS_BAT9 = \"sendSynchronousBatch\"; // Count: 2\r\nexport var _DYN__TRANSPORT = \"_transport\"; // Count: 4\r\nexport var _DYN_GET_WPARAM = \"getWParam\"; // Count: 4\r\nexport var _DYN_IS_BEACON = \"isBeacon\"; // Count: 4\r\nexport var _DYN_TIMINGS = \"timings\"; // Count: 4\r\nexport var _DYN_IS_TEARDOWN = \"isTeardown\"; // Count: 3\r\nexport var _DYN_IS_SYNC = \"isSync\"; // Count: 4\r\nexport var _DYN_SEND_POST = \"sendPOST\"; // Count: 3\r\nexport var _DYN_SET_KILL_SWITCH_TENA10 = \"setKillSwitchTenants\"; // Count: 2\r\nexport var _DYN__BACK_OFF_TRANSMISSI11 = \"_backOffTransmission\"; // Count: 2\r\nexport var _DYN_IDENTIFIER = \"identifier\"; // Count: 4\r\nexport var _DYN_DISABLE_OPTIMIZE_OBJ = \"disableOptimizeObj\"; // Count: 2\r\nexport var _DYN_IGNORE_MC1_MS0_COOKI12 = \"ignoreMc1Ms0CookieProcessing\"; // Count: 2\r\nexport var _DYN_EVENTS_LIMIT_IN_MEM = \"eventsLimitInMem\"; // Count: 2\r\nexport var _DYN_AUTO_FLUSH_EVENTS_LI13 = \"autoFlushEventsLimit\"; // Count: 2\r\nexport var _DYN_DISABLE_AUTO_BATCH_F14 = \"disableAutoBatchFlushLimit\"; // Count: 2\r\nexport var _DYN_OVERRIDE_INSTRUMENTA15 = \"overrideInstrumentationKey\"; // Count: 2\r\nexport var _DYN_DISABLE_TELEMETRY = \"disableTelemetry\"; // Count: 2\r\nexport var _DYN_SEND_ATTEMPT = \"sendAttempt\"; // Count: 4\r\nexport var _DYN_LATENCY = \"latency\"; // Count: 7\r\nexport var _DYN_BASE_DATA = \"baseData\"; // Count: 3\r\nexport var _DYN_SYNC = \"sync\"; // Count: 7\r\n//# sourceMappingURL=__DynamicConstants.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* EventBatch.ts\r\n* @author Nev Wylie (newylie)\r\n* @copyright Microsoft 2020\r\n*/\r\nimport { isNullOrUndefined, isValueAssigned } from \"@microsoft/1ds-core-js\";\r\nimport { STR_EMPTY, STR_MSFPC } from \"./InternalConstants\";\r\nimport { _DYN_CONCAT, _DYN_COUNT, _DYN_EVENTS, _DYN_I_KEY, _DYN_LENGTH, _DYN_PUSH, _DYN_SPLICE, _DYN_SPLIT } from \"./__DynamicConstants\";\r\nfunction _getEventMsfpc(theEvent) {\r\n var intWeb = ((theEvent.ext || {})[\"intweb\"]);\r\n if (intWeb && isValueAssigned(intWeb[STR_MSFPC])) {\r\n return intWeb[STR_MSFPC];\r\n }\r\n return null;\r\n}\r\nfunction _getMsfpc(theEvents) {\r\n var msfpc = null;\r\n for (var lp = 0; msfpc === null && lp < theEvents[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n msfpc = _getEventMsfpc(theEvents[lp]);\r\n }\r\n return msfpc;\r\n}\r\n/**\r\n* This class defines a \"batch\" events related to a specific iKey, it is used by the PostChannel and HttpManager\r\n* to collect and transfer ownership of events without duplicating them in-memory. This reduces the previous\r\n* array duplication and shared ownership issues that occurred due to race conditions caused by the async nature\r\n* of sending requests.\r\n*/\r\nvar EventBatch = /** @class */ (function () {\r\n /**\r\n * Private constructor so that caller is forced to use the static create method.\r\n * @param iKey - The iKey to associate with the events (not validated)\r\n * @param addEvents - The optional collection of events to assign to this batch - defaults to an empty array.\r\n */\r\n function EventBatch(iKey, addEvents) {\r\n var events = addEvents ? [][_DYN_CONCAT /* @min:%2econcat */](addEvents) : [];\r\n var _self = this;\r\n var _msfpc = _getMsfpc(events);\r\n _self[_DYN_I_KEY /* @min:%2eiKey */] = function () {\r\n return iKey;\r\n };\r\n _self.Msfpc = function () {\r\n // return the cached value unless it's undefined -- used to avoid cpu\r\n return _msfpc || STR_EMPTY;\r\n };\r\n _self[_DYN_COUNT /* @min:%2ecount */] = function () {\r\n return events[_DYN_LENGTH /* @min:%2elength */];\r\n };\r\n _self[_DYN_EVENTS /* @min:%2eevents */] = function () {\r\n return events;\r\n };\r\n _self.addEvent = function (theEvent) {\r\n if (theEvent) {\r\n events[_DYN_PUSH /* @min:%2epush */](theEvent);\r\n if (!_msfpc) {\r\n // Not found so try and find one\r\n _msfpc = _getEventMsfpc(theEvent);\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n _self[_DYN_SPLIT /* @min:%2esplit */] = function (fromEvent, numEvents) {\r\n // Create a new batch with the same iKey\r\n var theEvents;\r\n if (fromEvent < events[_DYN_LENGTH /* @min:%2elength */]) {\r\n var cnt = events[_DYN_LENGTH /* @min:%2elength */] - fromEvent;\r\n if (!isNullOrUndefined(numEvents)) {\r\n cnt = numEvents < cnt ? numEvents : cnt;\r\n }\r\n theEvents = events[_DYN_SPLICE /* @min:%2esplice */](fromEvent, cnt);\r\n // reset the fetched msfpc value\r\n _msfpc = _getMsfpc(events);\r\n }\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n }\r\n /**\r\n * Creates a new Event Batch object\r\n * @param iKey The iKey associated with this batch of events\r\n */\r\n EventBatch.create = function (iKey, theEvents) {\r\n return new EventBatch(iKey, theEvents);\r\n };\r\n return EventBatch;\r\n}());\r\nexport { EventBatch };\r\n//# sourceMappingURL=EventBatch.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* ClockSkewManager.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _DYN_ALLOW_REQUEST_SENDIN0, _DYN_FIRST_REQUEST_SENT, _DYN_GET_CLOCK_SKEW_HEADE2, _DYN_SET_CLOCK_SKEW, _DYN_SHOULD_ADD_CLOCK_SKE1 } from \"./__DynamicConstants\";\r\n/**\r\n* Class to manage clock skew correction.\r\n*/\r\nvar ClockSkewManager = /** @class */ (function () {\r\n function ClockSkewManager() {\r\n var _allowRequestSending = true;\r\n var _shouldAddClockSkewHeaders = true;\r\n var _isFirstRequest = true;\r\n var _clockSkewHeaderValue = \"use-collector-delta\";\r\n var _clockSkewSet = false;\r\n dynamicProto(ClockSkewManager, this, function (_self) {\r\n /**\r\n * Determine if requests can be sent.\r\n * @returns True if requests can be sent, false otherwise.\r\n */\r\n _self[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */] = function () {\r\n return _allowRequestSending;\r\n };\r\n /**\r\n * Tells the ClockSkewManager that it should assume that the first request has now been sent,\r\n * If this method had not yet been called AND the clock Skew had not been set this will set\r\n * allowRequestSending to false until setClockSet() is called.\r\n */\r\n _self[_DYN_FIRST_REQUEST_SENT /* @min:%2efirstRequestSent */] = function () {\r\n if (_isFirstRequest) {\r\n _isFirstRequest = false;\r\n if (!_clockSkewSet) {\r\n // Block sending until we get the first clock Skew\r\n _allowRequestSending = false;\r\n }\r\n }\r\n };\r\n /**\r\n * Determine if clock skew headers should be added to the request.\r\n * @returns True if clock skew headers should be added, false otherwise.\r\n */\r\n _self[_DYN_SHOULD_ADD_CLOCK_SKE1 /* @min:%2eshouldAddClockSkewHeaders */] = function () {\r\n return _shouldAddClockSkewHeaders;\r\n };\r\n /**\r\n * Gets the clock skew header value.\r\n * @returns The clock skew header value.\r\n */\r\n _self[_DYN_GET_CLOCK_SKEW_HEADE2 /* @min:%2egetClockSkewHeaderValue */] = function () {\r\n return _clockSkewHeaderValue;\r\n };\r\n /**\r\n * Sets the clock skew header value. Once clock skew is set this method\r\n * is no-op.\r\n * @param timeDeltaInMillis - Time delta to be saved as the clock skew header value.\r\n */\r\n _self[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */] = function (timeDeltaInMillis) {\r\n if (!_clockSkewSet) {\r\n if (timeDeltaInMillis) {\r\n _clockSkewHeaderValue = timeDeltaInMillis;\r\n _shouldAddClockSkewHeaders = true;\r\n _clockSkewSet = true;\r\n }\r\n else {\r\n _shouldAddClockSkewHeaders = false;\r\n }\r\n // Unblock sending\r\n _allowRequestSending = true;\r\n }\r\n };\r\n });\r\n }\r\n// Removed Stub for ClockSkewManager.prototype.allowRequestSending.\r\n// Removed Stub for ClockSkewManager.prototype.firstRequestSent.\r\n// Removed Stub for ClockSkewManager.prototype.shouldAddClockSkewHeaders.\r\n// Removed Stub for ClockSkewManager.prototype.getClockSkewHeaderValue.\r\n// Removed Stub for ClockSkewManager.prototype.setClockSkew.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n ClockSkewManager.__ieDyn=1;\n\n return ClockSkewManager;\r\n}());\r\nexport { ClockSkewManager };\r\n//# sourceMappingURL=ClockSkewManager.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* KillSwitch.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrForEach, dateNow, strTrim } from \"@microsoft/1ds-core-js\";\r\nimport { _DYN_IS_TENANT_KILLED, _DYN_LENGTH, _DYN_PUSH, _DYN_SET_KILL_SWITCH_TENA10, _DYN_SPLIT } from \"./__DynamicConstants\";\r\nvar SecToMsMultiplier = 1000;\r\n/**\r\n* Class to stop certain tenants sending events.\r\n*/\r\nvar KillSwitch = /** @class */ (function () {\r\n function KillSwitch() {\r\n var _killedTokenDictionary = {};\r\n function _normalizeTenants(values) {\r\n var result = [];\r\n if (values) {\r\n arrForEach(values, function (value) {\r\n result[_DYN_PUSH /* @min:%2epush */](strTrim(value));\r\n });\r\n }\r\n return result;\r\n }\r\n dynamicProto(KillSwitch, this, function (_self) {\r\n _self[_DYN_SET_KILL_SWITCH_TENA10 /* @min:%2esetKillSwitchTenants */] = function (killTokens, killDuration) {\r\n if (killTokens && killDuration) {\r\n try {\r\n var killedTokens = _normalizeTenants(killTokens[_DYN_SPLIT /* @min:%2esplit */](\",\"));\r\n if (killDuration === \"this-request-only\") {\r\n return killedTokens;\r\n }\r\n var durationMs = parseInt(killDuration, 10) * SecToMsMultiplier;\r\n for (var i = 0; i < killedTokens[_DYN_LENGTH /* @min:%2elength */]; ++i) {\r\n _killedTokenDictionary[killedTokens[i]] = dateNow() + durationMs;\r\n }\r\n }\r\n catch (ex) {\r\n return [];\r\n }\r\n }\r\n return [];\r\n };\r\n _self[_DYN_IS_TENANT_KILLED /* @min:%2eisTenantKilled */] = function (tenantToken) {\r\n var killDictionary = _killedTokenDictionary;\r\n var name = strTrim(tenantToken);\r\n if (killDictionary[name] !== undefined && killDictionary[name] > dateNow()) {\r\n return true;\r\n }\r\n delete killDictionary[name];\r\n return false;\r\n };\r\n });\r\n }\r\n// Removed Stub for KillSwitch.prototype.setKillSwitchTenants.\r\n// Removed Stub for KillSwitch.prototype.isTenantKilled.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n KillSwitch.__ieDyn=1;\n\n return KillSwitch;\r\n}());\r\nexport { KillSwitch };\r\n//# sourceMappingURL=KillSwitch.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* RetryPolicy.ts\r\n* @author Abhilash Panwar (abpanwar)\r\n* @copyright Microsoft 2018\r\n*/\r\nvar RandomizationLowerThreshold = 0.8;\r\nvar RandomizationUpperThreshold = 1.2;\r\nvar BaseBackoff = 3000;\r\nvar MaxBackoff = 600000;\r\n/**\r\n * Determine if the request should be retried for the given status code.\r\n * The below expression reads that we should only retry for:\r\n * - HttpStatusCodes that are smaller than 300.\r\n * - HttpStatusCodes greater or equal to 500 (except for 501-NotImplement\r\n * and 505-HttpVersionNotSupport).\r\n * - HttpStatusCode 408-RequestTimeout.\r\n * - HttpStatusCode 429.\r\n * This is based on Microsoft.WindowsAzure.Storage.RetryPolicies.ExponentialRetry class\r\n * @param httpStatusCode - The status code returned for the request.\r\n * @returns True if request should be retried, false otherwise.\r\n */\r\nexport function retryPolicyShouldRetryForStatus(httpStatusCode) {\r\n /* tslint:disable:triple-equals */\r\n // Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value\r\n return !((httpStatusCode >= 300 && httpStatusCode < 500 && httpStatusCode != 408 && httpStatusCode != 429)\r\n || (httpStatusCode == 501)\r\n || (httpStatusCode == 505));\r\n /* tslint:enable:triple-equals */\r\n}\r\n/**\r\n * Gets the number of milliseconds to back off before retrying the request. The\r\n * back off duration is exponentially scaled based on the number of retries already\r\n * done for the request.\r\n * @param retriesSoFar - The number of times the request has already been retried.\r\n * @returns The back off duration for the request before it can be retried.\r\n */\r\nexport function retryPolicyGetMillisToBackoffForRetry(retriesSoFar) {\r\n var waitDuration = 0;\r\n var minBackoff = BaseBackoff * RandomizationLowerThreshold;\r\n var maxBackoff = BaseBackoff * RandomizationUpperThreshold;\r\n var randomBackoff = Math.floor(Math.random() * (maxBackoff - minBackoff)) + minBackoff;\r\n waitDuration = Math.pow(2, retriesSoFar) * randomBackoff;\r\n return Math.min(waitDuration, MaxBackoff);\r\n}\r\n//# sourceMappingURL=RetryPolicy.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Serializer.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\n// @skip-file-minify\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { arrIndexOf, doPerf, getCommonSchemaMetaData, getTenantId, isArray, isValueAssigned, objForEachKey, sanitizeProperty, strStartsWith } from \"@microsoft/1ds-core-js\";\r\nimport { EventBatch } from \"./EventBatch\";\r\nimport { STR_EMPTY } from \"./InternalConstants\";\r\nimport { strSubstr } from \"@nevware21/ts-utils\";\r\n/**\r\n * Note: This is an optimization for V8-based browsers. When V8 concatenates a string,\r\n * the strings are only joined logically using a \"cons string\" or \"constructed/concatenated\r\n * string\". These containers keep references to one another and can result in very large\r\n * memory usage. For example, if a 2MB string is constructed by concatenating 4 bytes\r\n * together at a time, the memory usage will be ~44MB; so ~22x increase. The strings are\r\n * only joined together when an operation requiring their joining takes place, such as\r\n * substr(). This function is called when adding data to this buffer to ensure these\r\n * types of strings are periodically joined to reduce the memory footprint.\r\n * Setting to every 20 events as the JSON.stringify() may have joined many strings\r\n * and calling this too much causes a minor delay while processing.\r\n */\r\nvar _MAX_STRING_JOINS = 20;\r\nvar RequestSizeLimitBytes = 3984588; // approx 3.8 Mb\r\nvar BeaconRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)\r\nvar MaxRecordSize = 2000000; // approx 2 Mb\r\nvar MaxBeaconRecordSize = Math.min(MaxRecordSize, BeaconRequestSizeLimitBytes);\r\nvar metadata = \"metadata\";\r\nvar f = \"f\";\r\nvar rCheckDot = /\\./;\r\n/**\r\n* Class to handle serialization of event and request.\r\n* Currently uses Bond for serialization. Please note that this may be subject to change.\r\n*/\r\nvar Serializer = /** @class */ (function () {\r\n function Serializer(perfManager, valueSanitizer, stringifyObjects, enableCompoundKey) {\r\n var strData = \"data\";\r\n var strBaseData = \"baseData\";\r\n var strExt = \"ext\";\r\n var _checkForCompoundkey = !!enableCompoundKey;\r\n var _processSubMetaData = true;\r\n var _theSanitizer = valueSanitizer;\r\n var _isReservedCache = {};\r\n dynamicProto(Serializer, this, function (_self) {\r\n _self.createPayload = function (retryCnt, isTeardown, isSync, isReducedPayload, sendReason, sendType) {\r\n return {\r\n apiKeys: [],\r\n payloadBlob: STR_EMPTY,\r\n overflow: null,\r\n sizeExceed: [],\r\n failedEvts: [],\r\n batches: [],\r\n numEvents: 0,\r\n retryCnt: retryCnt,\r\n isTeardown: isTeardown,\r\n isSync: isSync,\r\n isBeacon: isReducedPayload,\r\n sendType: sendType,\r\n sendReason: sendReason\r\n };\r\n };\r\n _self.appendPayload = function (payload, theBatch, maxEventsPerBatch) {\r\n var canAddEvents = payload && theBatch && !payload.overflow;\r\n if (canAddEvents) {\r\n doPerf(perfManager, function () { return \"Serializer:appendPayload\"; }, function () {\r\n var theEvents = theBatch.events();\r\n var payloadBlob = payload.payloadBlob;\r\n var payloadEvents = payload.numEvents;\r\n var eventsAdded = false;\r\n var sizeExceeded = [];\r\n var failedEvts = [];\r\n var isBeaconPayload = payload.isBeacon;\r\n var requestMaxSize = isBeaconPayload ? BeaconRequestSizeLimitBytes : RequestSizeLimitBytes;\r\n var recordMaxSize = isBeaconPayload ? MaxBeaconRecordSize : MaxRecordSize;\r\n var lp = 0;\r\n var joinCount = 0;\r\n while (lp < theEvents.length) {\r\n var theEvent = theEvents[lp];\r\n if (theEvent) {\r\n if (payloadEvents >= maxEventsPerBatch) {\r\n // Maximum events per payload reached, so don't add any more\r\n payload.overflow = theBatch.split(lp);\r\n break;\r\n }\r\n var eventBlob = _self.getEventBlob(theEvent);\r\n if (eventBlob && eventBlob.length <= recordMaxSize) {\r\n // This event will fit into the payload\r\n var blobLength = eventBlob.length;\r\n var currentSize = payloadBlob.length;\r\n if (currentSize + blobLength > requestMaxSize) {\r\n // Request or batch size exceeded, so don't add any more to the payload\r\n payload.overflow = theBatch.split(lp);\r\n break;\r\n }\r\n if (payloadBlob) {\r\n payloadBlob += \"\\n\";\r\n }\r\n payloadBlob += eventBlob;\r\n joinCount++;\r\n // v8 memory optimization only\r\n if (joinCount > _MAX_STRING_JOINS) {\r\n // this substr() should cause the constructed string to join\r\n strSubstr(payloadBlob, 0, 1);\r\n joinCount = 0;\r\n }\r\n eventsAdded = true;\r\n payloadEvents++;\r\n }\r\n else {\r\n if (eventBlob) {\r\n // Single event size exceeded so remove from the batch\r\n sizeExceeded.push(theEvent);\r\n }\r\n else {\r\n failedEvts.push(theEvent);\r\n }\r\n // We also need to remove this event from the existing array, otherwise a notification will be sent\r\n // indicating that it was successfully sent\r\n theEvents.splice(lp, 1);\r\n lp--;\r\n }\r\n }\r\n lp++;\r\n }\r\n if (sizeExceeded.length > 0) {\r\n payload.sizeExceed.push(EventBatch.create(theBatch.iKey(), sizeExceeded));\r\n // Remove the exceeded events from the batch\r\n }\r\n if (failedEvts.length > 0) {\r\n payload.failedEvts.push(EventBatch.create(theBatch.iKey(), failedEvts));\r\n // Remove the failed events from the batch\r\n }\r\n if (eventsAdded) {\r\n payload.batches.push(theBatch);\r\n payload.payloadBlob = payloadBlob;\r\n payload.numEvents = payloadEvents;\r\n var apiKey = theBatch.iKey();\r\n if (arrIndexOf(payload.apiKeys, apiKey) === -1) {\r\n payload.apiKeys.push(apiKey);\r\n }\r\n }\r\n }, function () { return ({ payload: payload, theBatch: { iKey: theBatch.iKey(), evts: theBatch.events() }, max: maxEventsPerBatch }); });\r\n }\r\n return canAddEvents;\r\n };\r\n _self.getEventBlob = function (eventData) {\r\n try {\r\n return doPerf(perfManager, function () { return \"Serializer.getEventBlob\"; }, function () {\r\n var serializedEvent = {};\r\n // Adding as dynamic keys for v8 performance\r\n serializedEvent.name = eventData.name;\r\n serializedEvent.time = eventData.time;\r\n serializedEvent.ver = eventData.ver;\r\n serializedEvent.iKey = \"o:\" + getTenantId(eventData.iKey);\r\n // Assigning local var so usage in part b/c don't throw if there is no ext\r\n var serializedExt = {};\r\n // Part A\r\n var eventExt = eventData[strExt];\r\n if (eventExt) {\r\n // Only assign ext if the event had one (There are tests covering this use case)\r\n serializedEvent[strExt] = serializedExt;\r\n objForEachKey(eventExt, function (key, value) {\r\n var data = serializedExt[key] = {};\r\n // Don't include a metadata callback as we don't currently set metadata Part A fields\r\n _processPathKeys(value, data, \"ext.\" + key, true, null, null, true);\r\n });\r\n }\r\n var serializedData = serializedEvent[strData] = {};\r\n serializedData.baseType = eventData.baseType;\r\n var serializedBaseData = serializedData[strBaseData] = {};\r\n // Part B\r\n _processPathKeys(eventData.baseData, serializedBaseData, strBaseData, false, [strBaseData], function (pathKeys, name, value) {\r\n _addJSONPropertyMetaData(serializedExt, pathKeys, name, value);\r\n }, _processSubMetaData);\r\n // Part C\r\n _processPathKeys(eventData.data, serializedData, strData, false, [], function (pathKeys, name, value) {\r\n _addJSONPropertyMetaData(serializedExt, pathKeys, name, value);\r\n }, _processSubMetaData);\r\n return JSON.stringify(serializedEvent);\r\n }, function () { return ({ item: eventData }); });\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n };\r\n function _isReservedField(path, name) {\r\n var result = _isReservedCache[path];\r\n if (result === undefined) {\r\n if (path.length >= 7) {\r\n // Do not allow the changing of fields located in the ext.metadata or ext.web extension\r\n result = strStartsWith(path, \"ext.metadata\") || strStartsWith(path, \"ext.web\");\r\n }\r\n _isReservedCache[path] = result;\r\n }\r\n return result;\r\n }\r\n function _processPathKeys(srcObj, target, thePath, checkReserved, metadataPathKeys, metadataCallback, processSubKeys) {\r\n objForEachKey(srcObj, function (key, srcValue) {\r\n var prop = null;\r\n if (srcValue || isValueAssigned(srcValue)) {\r\n var path = thePath;\r\n var name_1 = key;\r\n var theMetaPathKeys = metadataPathKeys;\r\n var destObj = target;\r\n // Handle keys with embedded '.', like \"TestObject.testProperty\"\r\n if (_checkForCompoundkey && !checkReserved && rCheckDot.test(key)) {\r\n var subKeys = key.split(\".\");\r\n var keyLen = subKeys.length;\r\n if (keyLen > 1) {\r\n if (theMetaPathKeys) {\r\n // Create a copy of the meta path keys so we can add the extra ones\r\n theMetaPathKeys = theMetaPathKeys.slice();\r\n }\r\n for (var lp = 0; lp < keyLen - 1; lp++) {\r\n var subKey = subKeys[lp];\r\n // Add/reuse the sub key object\r\n destObj = destObj[subKey] = destObj[subKey] || {};\r\n path += \".\" + subKey;\r\n if (theMetaPathKeys) {\r\n theMetaPathKeys.push(subKey);\r\n }\r\n }\r\n name_1 = subKeys[keyLen - 1];\r\n }\r\n }\r\n var isReserved = checkReserved && _isReservedField(path, name_1);\r\n if (!isReserved && _theSanitizer && _theSanitizer.handleField(path, name_1)) {\r\n prop = _theSanitizer.value(path, name_1, srcValue, stringifyObjects);\r\n }\r\n else {\r\n prop = sanitizeProperty(name_1, srcValue, stringifyObjects);\r\n }\r\n if (prop) {\r\n // Set the value\r\n var newValue = prop.value;\r\n destObj[name_1] = newValue;\r\n if (metadataCallback) {\r\n metadataCallback(theMetaPathKeys, name_1, prop);\r\n }\r\n if (processSubKeys && typeof newValue === \"object\" && !isArray(newValue)) {\r\n var newPath = theMetaPathKeys;\r\n if (newPath) {\r\n newPath = newPath.slice();\r\n newPath.push(name_1);\r\n }\r\n // Make sure we process sub objects as well (for value sanitization and metadata)\r\n _processPathKeys(srcValue, newValue, path + \".\" + name_1, checkReserved, newPath, metadataCallback, processSubKeys);\r\n }\r\n }\r\n }\r\n });\r\n }\r\n });\r\n }\r\n// Removed Stub for Serializer.prototype.createPayload.\r\n// Removed Stub for Serializer.prototype.appendPayload.\r\n// Removed Stub for Serializer.prototype.getEventBlob.\r\n// Removed Stub for Serializer.prototype.handleField.\r\n// Removed Stub for Serializer.prototype.getSanitizer.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n Serializer.__ieDyn=1;\n\n return Serializer;\r\n}());\r\nexport { Serializer };\r\n/**\r\n * @ignore\r\n */\r\nfunction _addJSONPropertyMetaData(json, propKeys, name, propertyValue) {\r\n if (propertyValue && json) {\r\n var encodedTypeValue = getCommonSchemaMetaData(propertyValue.value, propertyValue.kind, propertyValue.propertyType);\r\n if (encodedTypeValue > -1) {\r\n // Add the root metadata\r\n var metaData = json[metadata];\r\n if (!metaData) {\r\n // Sets the root 'f'\r\n metaData = json[metadata] = { f: {} };\r\n }\r\n var metaTarget = metaData[f];\r\n if (!metaTarget) {\r\n // This can occur if someone has manually added an ext.metadata object\r\n // Such as ext.metadata.privLevel and ext.metadata.privTags\r\n metaTarget = metaData[f] = {};\r\n }\r\n // Traverse the metadata path and build each object (contains an 'f' key) -- if required\r\n if (propKeys) {\r\n for (var lp = 0; lp < propKeys.length; lp++) {\r\n var key = propKeys[lp];\r\n if (!metaTarget[key]) {\r\n metaTarget[key] = { f: {} };\r\n }\r\n var newTarget = metaTarget[key][f];\r\n if (!newTarget) {\r\n // Not expected, but can occur if the metadata context was pre-created as part of the event\r\n newTarget = metaTarget[key][f] = {};\r\n }\r\n metaTarget = newTarget;\r\n }\r\n }\r\n metaTarget = metaTarget[name] = {};\r\n if (isArray(propertyValue.value)) {\r\n metaTarget[\"a\"] = {\r\n t: encodedTypeValue\r\n };\r\n }\r\n else {\r\n metaTarget[\"t\"] = encodedTypeValue;\r\n }\r\n }\r\n }\r\n}\r\n//# sourceMappingURL=Serializer.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* TimeoutOverrideWrapper.ts\r\n* @author Nev Wylie (newylie)\r\n* @copyright Microsoft 2022\r\n* Simple internal timeout wrapper\r\n*/\r\nimport { scheduleTimeoutWith } from \"@nevware21/ts-utils\";\r\nexport function createTimeoutWrapper(argSetTimeout, argClearTimeout) {\r\n return {\r\n set: function (callback, ms) {\r\n var args = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n args[_i - 2] = arguments[_i];\r\n }\r\n return scheduleTimeoutWith([argSetTimeout, argClearTimeout], callback, ms, args);\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TimeoutOverrideWrapper.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nvar _a;\r\n/**\r\n* HttpManager.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { FullVersionString, _throwInternal, _warnToConsole, arrForEach, dateNow, doPerf, dumpObj, extend, getLocation, getNavigator, getTime, hasOwnProperty, isArray, isBeaconsSupported, isFetchSupported, isNullOrUndefined, isNumber, isReactNative, isString, isUndefined, isValueAssigned, isXhrSupported, objForEachKey, objKeys, onConfigChange, openXhr, strTrim, strUndefined, useXDomainRequest } from \"@microsoft/1ds-core-js\";\r\nimport { arrAppend } from \"@nevware21/ts-utils\";\r\nimport { ClockSkewManager } from \"./ClockSkewManager\";\r\nimport { DEFAULT_CACHE_CONTROL, DEFAULT_CONTENT_TYPE, STR_API_KEY, STR_AUTH_XTOKEN, STR_CACHE_CONTROL, STR_CLIENT_ID, STR_CLIENT_VERSION, STR_CONTENT_TYPE_HEADER, STR_DISABLED_PROPERTY_NAME, STR_DROPPED, STR_EMPTY, STR_KILL_DURATION_HEADER, STR_KILL_DURATION_SECONDS_HEADER, STR_KILL_TOKENS_HEADER, STR_MSA_DEVICE_TICKET, STR_MSFPC, STR_NO_RESPONSE_BODY, STR_OTHER, STR_POST_METHOD, STR_REQUEUE, STR_RESPONSE_FAIL, STR_SENDING, STR_TIME_DELTA_HEADER, STR_TIME_DELTA_TO_APPLY, STR_UPLOAD_TIME } from \"./InternalConstants\";\r\nimport { KillSwitch } from \"./KillSwitch\";\r\nimport { retryPolicyGetMillisToBackoffForRetry, retryPolicyShouldRetryForStatus } from \"./RetryPolicy\";\r\nimport { Serializer } from \"./Serializer\";\r\nimport { createTimeoutWrapper } from \"./TimeoutOverrideWrapper\";\r\nimport { _DYN_ALLOW_REQUEST_SENDIN0, _DYN_ALWAYS_USE_XHR_OVERR7, _DYN_AVOID_OPTIONS, _DYN_BATCHES, _DYN_CAN_SEND_REQUEST, _DYN_CLEAR_TIMEOUT_OVERRI3, _DYN_CONCAT, _DYN_COUNT, _DYN_DATA, _DYN_DISABLE_EVENT_TIMING5, _DYN_DISABLE_FETCH_KEEP_A6, _DYN_DISABLE_XHR_SYNC, _DYN_ENABLE_COMPOUND_KEY, _DYN_EVENTS, _DYN_FIRST_REQUEST_SENT, _DYN_GET_ALL_RESPONSE_HEA8, _DYN_GET_CLOCK_SKEW_HEADE2, _DYN_GET_RESPONSE_HEADER, _DYN_GET_WPARAM, _DYN_HDRS, _DYN_HEADERS, _DYN_INITIALIZE, _DYN_IS_BEACON, _DYN_IS_COMPLETELY_IDLE, _DYN_IS_SYNC, _DYN_IS_TEARDOWN, _DYN_I_KEY, _DYN_LENGTH, _DYN_ONTIMEOUT, _DYN_OVERRIDE_ENDPOINT_UR4, _DYN_PAYLOAD_PREPROCESSOR, _DYN_PUSH, _DYN_SEND_POST, _DYN_SEND_QUEUED_REQUESTS, _DYN_SEND_SYNCHRONOUS_BAT9, _DYN_SEND_TYPE, _DYN_SET_CLOCK_SKEW, _DYN_SET_KILL_SWITCH_TENA10, _DYN_SET_TIMEOUT_OVERRIDE, _DYN_SET_UNLOADING, _DYN_SHOULD_ADD_CLOCK_SKE1, _DYN_SPLICE, _DYN_SPLIT, _DYN_STRINGIFY_OBJECTS, _DYN_TIMEOUT, _DYN_TIMINGS, _DYN_TO_LOWER_CASE, _DYN_UNLOAD_TRANSPORTS, _DYN_URL_STRING, _DYN_USE_HDRS, _DYN_USE_SEND_BEACON, _DYN__BACK_OFF_TRANSMISSI11, _DYN__SEND_REASON, _DYN__THE_PAYLOAD, _DYN__TRANSPORT } from \"./__DynamicConstants\";\r\nvar strSendAttempt = \"sendAttempt\";\r\nvar _noResponseQs = \"&\" + STR_NO_RESPONSE_BODY + \"=true\";\r\nvar UrlQueryString = \"?cors=true&\" + STR_CONTENT_TYPE_HEADER[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() + \"=\" + DEFAULT_CONTENT_TYPE;\r\n/**\r\n * Identifies the default notification reason to the action names\r\n */\r\nvar _eventActionMap = (_a = {},\r\n _a[1 /* EventBatchNotificationReason.Paused */] = STR_REQUEUE,\r\n _a[100 /* EventBatchNotificationReason.RequeueEvents */] = STR_REQUEUE,\r\n _a[200 /* EventBatchNotificationReason.Complete */] = \"sent\",\r\n _a[8004 /* EventBatchNotificationReason.KillSwitch */] = STR_DROPPED,\r\n _a[8003 /* EventBatchNotificationReason.SizeLimitExceeded */] = STR_DROPPED,\r\n _a);\r\nvar _collectorQsHeaders = {};\r\nvar _collectorHeaderToQs = {};\r\nfunction _addCollectorHeaderQsMapping(qsName, headerName, allowQs) {\r\n _collectorQsHeaders[qsName] = headerName;\r\n if (allowQs !== false) {\r\n _collectorHeaderToQs[headerName] = qsName;\r\n }\r\n}\r\n_addCollectorHeaderQsMapping(STR_MSA_DEVICE_TICKET, STR_MSA_DEVICE_TICKET, false);\r\n_addCollectorHeaderQsMapping(STR_CLIENT_VERSION, STR_CLIENT_VERSION);\r\n_addCollectorHeaderQsMapping(STR_CLIENT_ID, \"Client-Id\");\r\n_addCollectorHeaderQsMapping(STR_API_KEY, STR_API_KEY);\r\n_addCollectorHeaderQsMapping(STR_TIME_DELTA_TO_APPLY, STR_TIME_DELTA_TO_APPLY);\r\n_addCollectorHeaderQsMapping(STR_UPLOAD_TIME, STR_UPLOAD_TIME);\r\n_addCollectorHeaderQsMapping(STR_AUTH_XTOKEN, STR_AUTH_XTOKEN);\r\nfunction _getResponseText(xhr) {\r\n try {\r\n return xhr.responseText;\r\n }\r\n catch (e) {\r\n // Best effort, as XHR may throw while XDR wont so just ignore\r\n }\r\n return STR_EMPTY;\r\n}\r\nfunction _hasHeader(headers, header) {\r\n var hasHeader = false;\r\n if (headers && header) {\r\n var keys = objKeys(headers);\r\n if (keys && keys[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var lowerHeader = header[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n for (var lp = 0; lp < keys[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var value = keys[lp];\r\n if (value && hasOwnProperty(header, value) &&\r\n value[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === lowerHeader) {\r\n hasHeader = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return hasHeader;\r\n}\r\nfunction _addRequestDetails(details, name, value, useHeaders) {\r\n if (name && value && value[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n if (useHeaders && _collectorQsHeaders[name]) {\r\n details[_DYN_HDRS /* @min:%2ehdrs */][_collectorQsHeaders[name]] = value;\r\n details[_DYN_USE_HDRS /* @min:%2euseHdrs */] = true;\r\n }\r\n else {\r\n details.url += \"&\" + name + \"=\" + value;\r\n }\r\n }\r\n}\r\nfunction _prependTransports(theTransports, newTransports) {\r\n if (newTransports) {\r\n if (isNumber(newTransports)) {\r\n theTransports = [newTransports][_DYN_CONCAT /* @min:%2econcat */](theTransports);\r\n }\r\n else if (isArray(newTransports)) {\r\n theTransports = newTransports[_DYN_CONCAT /* @min:%2econcat */](theTransports);\r\n }\r\n }\r\n return theTransports;\r\n}\r\nfunction _addQueryStringParameter(qsParams, name, value) {\r\n for (var i = 0; i < qsParams[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n if (qsParams[i].name === name) {\r\n qsParams[i].value = value;\r\n return;\r\n }\r\n }\r\n qsParams[_DYN_PUSH /* @min:%2epush */]({ name: name, value: value });\r\n}\r\nfunction _removeQueryStringParameter(qsParams, name) {\r\n for (var i = 0; i < qsParams[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n if (qsParams[i].name === name) {\r\n qsParams[_DYN_SPLICE /* @min:%2esplice */](i, 1);\r\n return;\r\n }\r\n }\r\n}\r\n/**\r\n * Class managing the sending of requests.\r\n */\r\nvar HttpManager = /** @class */ (function () {\r\n /**\r\n * @constructor\r\n * @param requestQueue - The queue that contains the requests to be sent.\r\n */\r\n function HttpManager(maxEventsPerBatch, maxConnections, maxRequestRetriesBeforeBackoff, actions) {\r\n var _urlString;\r\n var _killSwitch = new KillSwitch();\r\n var _paused = false;\r\n var _clockSkewManager = new ClockSkewManager();\r\n var _useBeacons = false;\r\n var _outstandingRequests = 0; // Holds the number of outstanding async requests that have not returned a response yet\r\n var _postManager;\r\n var _logger;\r\n var _sendInterfaces;\r\n var _core;\r\n var _customHttpInterface = true;\r\n var _queryStringParameters = [];\r\n var _headers = {};\r\n var _batchQueue = [];\r\n var _serializer = null;\r\n var _enableEventTimings = false;\r\n var _cookieMgr;\r\n var _isUnloading = false;\r\n var _useHeaders = false;\r\n var _xhrTimeout;\r\n var _disableXhrSync;\r\n var _disableFetchKeepAlive;\r\n var _canHaveReducedPayload;\r\n var _addNoResponse;\r\n var _unloadHooks = [];\r\n var _sendHook;\r\n var _sendListener;\r\n var _responseHandlers = [];\r\n var _isInitialized;\r\n var _timeoutWrapper;\r\n dynamicProto(HttpManager, this, function (_self) {\r\n _initDefaults();\r\n var _sendCredentials = true;\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (theConfig, core, postChannel) {\r\n if (!_isInitialized) {\r\n _core = core;\r\n _cookieMgr = core.getCookieMgr();\r\n _postManager = postChannel;\r\n _logger = _postManager.diagLog();\r\n arrAppend(_unloadHooks, onConfigChange(theConfig, function (details) {\r\n var _a;\r\n var coreConfig = details.cfg;\r\n var channelConfig = details.cfg.extensionConfig[postChannel.identifier];\r\n _timeoutWrapper = createTimeoutWrapper(channelConfig[_DYN_SET_TIMEOUT_OVERRIDE /* @min:%2esetTimeoutOverride */], channelConfig[_DYN_CLEAR_TIMEOUT_OVERRI3 /* @min:%2eclearTimeoutOverride */]);\r\n if (isValueAssigned(coreConfig.anonCookieName)) {\r\n _addQueryStringParameter(_queryStringParameters, \"anoncknm\", coreConfig.anonCookieName);\r\n }\r\n else {\r\n _removeQueryStringParameter(_queryStringParameters, \"anoncknm\");\r\n }\r\n _sendHook = channelConfig[_DYN_PAYLOAD_PREPROCESSOR /* @min:%2epayloadPreprocessor */];\r\n _sendListener = channelConfig.payloadListener;\r\n var httpInterface = channelConfig.httpXHROverride;\r\n // Override endpointUrl if provided in Post config\r\n var endpointUrl = channelConfig[_DYN_OVERRIDE_ENDPOINT_UR4 /* @min:%2eoverrideEndpointUrl */] ? channelConfig[_DYN_OVERRIDE_ENDPOINT_UR4 /* @min:%2eoverrideEndpointUrl */] : coreConfig.endpointUrl;\r\n _urlString = endpointUrl + UrlQueryString;\r\n _useHeaders = !isUndefined(channelConfig[_DYN_AVOID_OPTIONS /* @min:%2eavoidOptions */]) ? !channelConfig[_DYN_AVOID_OPTIONS /* @min:%2eavoidOptions */] : true;\r\n _enableEventTimings = !channelConfig[_DYN_DISABLE_EVENT_TIMING5 /* @min:%2edisableEventTimings */];\r\n var valueSanitizer = channelConfig.valueSanitizer;\r\n var stringifyObjects = channelConfig[_DYN_STRINGIFY_OBJECTS /* @min:%2estringifyObjects */];\r\n var enableCompoundKey = !!coreConfig[_DYN_ENABLE_COMPOUND_KEY /* @min:%2eenableCompoundKey */];\r\n if (!isUndefined(channelConfig[_DYN_ENABLE_COMPOUND_KEY /* @min:%2eenableCompoundKey */])) {\r\n enableCompoundKey = !!channelConfig[_DYN_ENABLE_COMPOUND_KEY /* @min:%2eenableCompoundKey */];\r\n }\r\n _xhrTimeout = channelConfig.xhrTimeout;\r\n _disableXhrSync = !!channelConfig[_DYN_DISABLE_XHR_SYNC /* @min:%2edisableXhrSync */];\r\n _disableFetchKeepAlive = !!channelConfig[_DYN_DISABLE_FETCH_KEEP_A6 /* @min:%2edisableFetchKeepAlive */];\r\n _addNoResponse = channelConfig.addNoResponse !== false;\r\n _useBeacons = !isReactNative(); // Only use beacons if not running in React Native\r\n _serializer = new Serializer(_core, valueSanitizer, stringifyObjects, enableCompoundKey);\r\n if (!isNullOrUndefined(channelConfig[_DYN_USE_SEND_BEACON /* @min:%2euseSendBeacon */])) {\r\n _useBeacons = !!channelConfig[_DYN_USE_SEND_BEACON /* @min:%2euseSendBeacon */];\r\n }\r\n var syncHttpInterface = httpInterface;\r\n var beaconHttpInterface = channelConfig[_DYN_ALWAYS_USE_XHR_OVERR7 /* @min:%2ealwaysUseXhrOverride */] ? httpInterface : null;\r\n var fetchSyncHttpInterface = channelConfig[_DYN_ALWAYS_USE_XHR_OVERR7 /* @min:%2ealwaysUseXhrOverride */] ? httpInterface : null;\r\n var beaconUnloadTransports = [3 /* TransportType.Beacon */, 2 /* TransportType.Fetch */];\r\n if (!httpInterface) {\r\n _customHttpInterface = false;\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol && location_1.protocol[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === \"file:\") {\r\n // Special case where a local html file fails with a CORS error on Chromium browsers\r\n _sendCredentials = false;\r\n }\r\n var theTransports = [];\r\n if (isReactNative()) {\r\n // Use Fetch or XDR/XHR\r\n theTransports = [2 /* TransportType.Fetch */, 1 /* TransportType.Xhr */];\r\n beaconUnloadTransports = [2 /* TransportType.Fetch */, 1 /* TransportType.Xhr */, 3 /* TransportType.Beacon */];\r\n }\r\n else {\r\n // Use XDR/XHR, Fetch or beacons\r\n theTransports = [1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */];\r\n }\r\n // Prefix any user requested transport(s) values\r\n theTransports = _prependTransports(theTransports, channelConfig.transports);\r\n httpInterface = _getSenderInterface(theTransports, false);\r\n if (!httpInterface) {\r\n _warnToConsole(_logger, \"No available transport to send events\");\r\n }\r\n syncHttpInterface = _getSenderInterface(theTransports, true);\r\n }\r\n if (!beaconHttpInterface) {\r\n // Allow overriding the usage of sendBeacon\r\n beaconUnloadTransports = _prependTransports(beaconUnloadTransports, channelConfig[_DYN_UNLOAD_TRANSPORTS /* @min:%2eunloadTransports */]);\r\n beaconHttpInterface = _getSenderInterface(beaconUnloadTransports, true);\r\n }\r\n _canHaveReducedPayload = !_customHttpInterface && ((_useBeacons && isBeaconsSupported()) || (!_disableFetchKeepAlive && isFetchSupported(true)));\r\n _sendInterfaces = (_a = {},\r\n _a[0 /* EventSendType.Batched */] = httpInterface,\r\n _a[1 /* EventSendType.Synchronous */] = syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */], true),\r\n _a[2 /* EventSendType.SendBeacon */] = beaconHttpInterface || syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */], true),\r\n _a[3 /* EventSendType.SyncFetch */] = fetchSyncHttpInterface || _getSenderInterface([2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */], true) || syncHttpInterface || _getSenderInterface([1 /* TransportType.Xhr */], true),\r\n _a);\r\n }));\r\n _isInitialized = true;\r\n }\r\n };\r\n _self.addResponseHandler = function (responseHandler) {\r\n _responseHandlers[_DYN_PUSH /* @min:%2epush */](responseHandler);\r\n return {\r\n rm: function () {\r\n var index = _responseHandlers.indexOf(responseHandler);\r\n if (index >= 0) {\r\n _responseHandlers[_DYN_SPLICE /* @min:%2esplice */](index, 1);\r\n }\r\n }\r\n };\r\n };\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n function _getSenderInterface(transports, syncSupport) {\r\n var transportType = 0 /* TransportType.NotSet */;\r\n var sendPostFunc = null;\r\n var lp = 0;\r\n while (sendPostFunc == null && lp < transports[_DYN_LENGTH /* @min:%2elength */]) {\r\n transportType = transports[lp];\r\n if (transportType === 1 /* TransportType.Xhr */) {\r\n if (useXDomainRequest()) {\r\n sendPostFunc = _xdrSendPost;\r\n }\r\n else if (isXhrSupported()) {\r\n sendPostFunc = _xhrSendPost;\r\n }\r\n }\r\n else if (transportType === 2 /* TransportType.Fetch */ && isFetchSupported(syncSupport) && (!syncSupport || (syncSupport && !_disableFetchKeepAlive))) {\r\n sendPostFunc = _fetchSendPost;\r\n }\r\n else if (_useBeacons && transportType === 3 /* TransportType.Beacon */ && isBeaconsSupported()) {\r\n sendPostFunc = _beaconSendPost;\r\n }\r\n lp++;\r\n }\r\n if (sendPostFunc) {\r\n return {\r\n _transport: transportType,\r\n _isSync: syncSupport,\r\n sendPOST: sendPostFunc\r\n };\r\n }\r\n return null;\r\n }\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_sendInterfaces[0 /* EventSendType.Batched */], _killSwitch, _serializer, _sendInterfaces];\r\n };\r\n function _xdrSendPost(payload, oncomplete, sync) {\r\n // It doesn't support custom headers, so no action is taken with current requestHeaders\r\n var xdr = new XDomainRequest();\r\n xdr.open(STR_POST_METHOD, payload[_DYN_URL_STRING /* @min:%2eurlString */]);\r\n if (payload[_DYN_TIMEOUT /* @min:%2etimeout */]) {\r\n xdr[_DYN_TIMEOUT /* @min:%2etimeout */] = payload[_DYN_TIMEOUT /* @min:%2etimeout */];\r\n }\r\n // can't get the status code in xdr.\r\n xdr.onload = function () {\r\n // we will assume onload means the request succeeded.\r\n var response = _getResponseText(xdr);\r\n _doOnComplete(oncomplete, 200, {}, response);\r\n _handleCollectorResponse(response);\r\n };\r\n // we will assume onerror means we need to drop the events.\r\n xdr.onerror = function () {\r\n _doOnComplete(oncomplete, 400, {});\r\n };\r\n // we will assume ontimeout means we need to retry the events.\r\n xdr[_DYN_ONTIMEOUT /* @min:%2eontimeout */] = function () {\r\n _doOnComplete(oncomplete, 500, {});\r\n };\r\n // https://cypressnorth.com/web-programming-and-development/internet-explorer-aborting-ajax-requests-fixed/\r\n // tslint:disable-next-line:no-empty\r\n xdr.onprogress = function () { };\r\n if (sync) {\r\n xdr.send(payload[_DYN_DATA /* @min:%2edata */]);\r\n }\r\n else {\r\n _timeoutWrapper.set(function () {\r\n xdr.send(payload[_DYN_DATA /* @min:%2edata */]);\r\n }, 0);\r\n }\r\n }\r\n function _initDefaults() {\r\n var undefValue;\r\n _urlString = null;\r\n _killSwitch = new KillSwitch();\r\n _paused = false;\r\n _clockSkewManager = new ClockSkewManager();\r\n _useBeacons = false;\r\n _outstandingRequests = 0; // Holds the number of outstanding async requests that have not returned a response yet\r\n _postManager = null;\r\n _logger = null;\r\n _sendInterfaces = null;\r\n _core = null;\r\n _customHttpInterface = true;\r\n _queryStringParameters = [];\r\n _headers = {};\r\n _batchQueue = [];\r\n _serializer = null;\r\n _enableEventTimings = false;\r\n _cookieMgr = null;\r\n _isUnloading = false;\r\n _useHeaders = false;\r\n _xhrTimeout = undefValue;\r\n _disableXhrSync = undefValue;\r\n _disableFetchKeepAlive = undefValue;\r\n _canHaveReducedPayload = undefValue;\r\n _addNoResponse = undefValue;\r\n _unloadHooks = [];\r\n _sendHook = undefValue;\r\n _sendListener = undefValue;\r\n _responseHandlers = [];\r\n _isInitialized = false;\r\n _timeoutWrapper = createTimeoutWrapper();\r\n }\r\n function _fetchSendPost(payload, oncomplete, sync) {\r\n var _a;\r\n var theUrl = payload[_DYN_URL_STRING /* @min:%2eurlString */];\r\n var ignoreResponse = false;\r\n var responseHandled = false;\r\n var requestInit = (_a = {\r\n body: payload[_DYN_DATA /* @min:%2edata */],\r\n method: STR_POST_METHOD\r\n },\r\n _a[STR_DISABLED_PROPERTY_NAME] = true,\r\n _a);\r\n if (sync) {\r\n requestInit.keepalive = true;\r\n if (payload[_DYN__SEND_REASON /* @min:%2e_sendReason */] === 2 /* SendRequestReason.Unload */) {\r\n // As a sync request (during unload), it is unlikely that we will get a chance to process the response so\r\n // just like beacon send assume that the events have been accepted and processed\r\n ignoreResponse = true;\r\n if (_addNoResponse) {\r\n theUrl += _noResponseQs;\r\n }\r\n }\r\n }\r\n if (_sendCredentials) {\r\n // Don't send credentials when URL is file://\r\n requestInit.credentials = \"include\";\r\n }\r\n // Only add headers if there are headers to add, due to issue with some polyfills\r\n if (payload.headers && objKeys(payload.headers)[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n requestInit[_DYN_HEADERS /* @min:%2eheaders */] = payload[_DYN_HEADERS /* @min:%2eheaders */];\r\n }\r\n fetch(theUrl, requestInit).then(function (response) {\r\n var headerMap = {};\r\n var responseText = STR_EMPTY;\r\n var headers = response[_DYN_HEADERS /* @min:%2eheaders */];\r\n if (headers) {\r\n headers[\"forEach\"](function (value, name) {\r\n headerMap[name] = value;\r\n });\r\n }\r\n if (response.body) {\r\n response.text().then(function (text) {\r\n responseText = text;\r\n });\r\n }\r\n if (!responseHandled) {\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, response.status, headerMap, responseText);\r\n _handleCollectorResponse(responseText);\r\n }\r\n }).catch(function (error) {\r\n // In case there is an error in the request. Set the status to 0\r\n // so that the events can be retried later.\r\n if (!responseHandled) {\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 0, {});\r\n }\r\n });\r\n if (ignoreResponse && !responseHandled) {\r\n // Assume success during unload processing\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 200, {});\r\n }\r\n if (!responseHandled && payload[_DYN_TIMEOUT /* @min:%2etimeout */] > 0) {\r\n // Simulate timeout\r\n _timeoutWrapper.set(function () {\r\n if (!responseHandled) {\r\n // Assume a 500 response (which will cause a retry)\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 500, {});\r\n }\r\n }, payload[_DYN_TIMEOUT /* @min:%2etimeout */]);\r\n }\r\n }\r\n function _xhrSendPost(payload, oncomplete, sync) {\r\n var theUrl = payload[_DYN_URL_STRING /* @min:%2eurlString */];\r\n function _appendHeader(theHeaders, xhr, name) {\r\n if (!theHeaders[name] && xhr && xhr[_DYN_GET_RESPONSE_HEADER /* @min:%2egetResponseHeader */]) {\r\n var value = xhr[_DYN_GET_RESPONSE_HEADER /* @min:%2egetResponseHeader */](name);\r\n if (value) {\r\n theHeaders[name] = strTrim(value);\r\n }\r\n }\r\n return theHeaders;\r\n }\r\n function _getAllResponseHeaders(xhr) {\r\n var theHeaders = {};\r\n if (!xhr[_DYN_GET_ALL_RESPONSE_HEA8 /* @min:%2egetAllResponseHeaders */]) {\r\n // Firefox 2-63 doesn't have getAllResponseHeaders function but it does have getResponseHeader\r\n // Only call these if getAllResponseHeaders doesn't exist, otherwise we can get invalid response errors\r\n // as collector is not currently returning the correct header to allow JS to access these headers\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);\r\n theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);\r\n }\r\n else {\r\n theHeaders = _convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA8 /* @min:%2egetAllResponseHeaders */]());\r\n }\r\n return theHeaders;\r\n }\r\n function xhrComplete(xhr, responseTxt) {\r\n _doOnComplete(oncomplete, xhr.status, _getAllResponseHeaders(xhr), responseTxt);\r\n }\r\n if (sync && payload[_DYN_DISABLE_XHR_SYNC /* @min:%2edisableXhrSync */]) {\r\n sync = false;\r\n }\r\n var xhrRequest = openXhr(STR_POST_METHOD, theUrl, _sendCredentials, true, sync, payload[_DYN_TIMEOUT /* @min:%2etimeout */]);\r\n // Set custom headers (e.g. gzip) here (after open())\r\n objForEachKey(payload[_DYN_HEADERS /* @min:%2eheaders */], function (name, value) {\r\n xhrRequest.setRequestHeader(name, value);\r\n });\r\n xhrRequest.onload = function () {\r\n var response = _getResponseText(xhrRequest);\r\n xhrComplete(xhrRequest, response);\r\n _handleCollectorResponse(response);\r\n };\r\n xhrRequest.onerror = function () {\r\n xhrComplete(xhrRequest);\r\n };\r\n xhrRequest[_DYN_ONTIMEOUT /* @min:%2eontimeout */] = function () {\r\n xhrComplete(xhrRequest);\r\n };\r\n xhrRequest.send(payload[_DYN_DATA /* @min:%2edata */]);\r\n }\r\n function _doOnComplete(oncomplete, status, headers, response) {\r\n try {\r\n oncomplete(status, headers, response);\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 518 /* _eExtendedInternalMessageId.SendPostOnCompleteFailure */, dumpObj(e));\r\n }\r\n }\r\n function _beaconSendPost(payload, oncomplete, sync) {\r\n // Custom headers not supported in sendBeacon payload.headers would be ignored\r\n var internalPayloadData = payload;\r\n var status = 200;\r\n var thePayload = internalPayloadData[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */];\r\n var theUrl = payload[_DYN_URL_STRING /* @min:%2eurlString */] + (_addNoResponse ? _noResponseQs : STR_EMPTY);\r\n try {\r\n var nav_1 = getNavigator();\r\n if (!nav_1.sendBeacon(theUrl, payload[_DYN_DATA /* @min:%2edata */])) {\r\n if (thePayload) {\r\n // Failed to send entire payload so try and split data and try to send as much events as possible\r\n var droppedBatches_1 = [];\r\n arrForEach(thePayload[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {\r\n if (droppedBatches_1 && theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {\r\n var theEvents = theBatch[_DYN_EVENTS /* @min:%2eevents */]();\r\n for (var lp = 0; lp < theEvents[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n if (!nav_1.sendBeacon(theUrl, _serializer.getEventBlob(theEvents[lp]))) {\r\n // Can't send anymore, so split the batch and drop the rest\r\n droppedBatches_1[_DYN_PUSH /* @min:%2epush */](theBatch[_DYN_SPLIT /* @min:%2esplit */](lp));\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n // Remove all of the events from the existing batch in the payload as the copy includes the original\r\n droppedBatches_1[_DYN_PUSH /* @min:%2epush */](theBatch[_DYN_SPLIT /* @min:%2esplit */](0));\r\n }\r\n });\r\n _sendBatchesNotification(droppedBatches_1, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], true);\r\n }\r\n else {\r\n status = 0;\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n _warnToConsole(_logger, \"Failed to send telemetry using sendBeacon API. Ex:\" + dumpObj(ex));\r\n status = 0;\r\n }\r\n finally {\r\n _doOnComplete(oncomplete, status, {}, STR_EMPTY);\r\n }\r\n }\r\n function _isBeaconPayload(sendType) {\r\n // Sync Fetch has the same payload limitation as sendBeacon -- 64kb limit, so treat both as a beacon send\r\n return sendType === 2 /* EventSendType.SendBeacon */ || sendType === 3 /* EventSendType.SyncFetch */;\r\n }\r\n function _adjustSendType(sendType) {\r\n if (_isUnloading && _isBeaconPayload(sendType)) {\r\n sendType = 2 /* EventSendType.SendBeacon */;\r\n }\r\n return sendType;\r\n }\r\n _self.addHeader = function (name, value) {\r\n _headers[name] = value;\r\n };\r\n _self[_DYN_CAN_SEND_REQUEST /* @min:%2ecanSendRequest */] = function () {\r\n return _hasIdleConnection() && _clockSkewManager[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */]();\r\n };\r\n _self[_DYN_SEND_QUEUED_REQUESTS /* @min:%2esendQueuedRequests */] = function (sendType, sendReason) {\r\n if (isUndefined(sendType)) {\r\n sendType = 0 /* EventSendType.Batched */;\r\n }\r\n if (_isUnloading) {\r\n sendType = _adjustSendType(sendType);\r\n sendReason = 2 /* SendRequestReason.Unload */;\r\n }\r\n if (_canSendPayload(_batchQueue, sendType, 0)) {\r\n _sendBatches(_clearQueue(), 0, false, sendType, sendReason || 0 /* SendRequestReason.Undefined */);\r\n }\r\n };\r\n _self[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */] = function () {\r\n return !_paused && _outstandingRequests === 0 && _batchQueue[_DYN_LENGTH /* @min:%2elength */] === 0;\r\n };\r\n _self[_DYN_SET_UNLOADING /* @min:%2esetUnloading */] = function (value) {\r\n _isUnloading = value;\r\n };\r\n _self.addBatch = function (theBatch) {\r\n if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {\r\n // Try and kill the event faster\r\n if (_killSwitch.isTenantKilled(theBatch[_DYN_I_KEY /* @min:%2eiKey */]())) {\r\n return false;\r\n }\r\n _batchQueue[_DYN_PUSH /* @min:%2epush */](theBatch);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Queue all the remaining requests to be sent. The requests will be\r\n * sent using HTML5 Beacons if they are available.\r\n */\r\n _self.teardown = function () {\r\n if (_batchQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _sendBatches(_clearQueue(), 0, true, 2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n arrForEach(_unloadHooks, function (hook) {\r\n hook && hook.rm && hook.rm();\r\n });\r\n _unloadHooks = [];\r\n };\r\n /**\r\n * Pause the sending of requests. No new requests will be sent.\r\n */\r\n _self.pause = function () {\r\n _paused = true;\r\n };\r\n /**\r\n * Resume the sending of requests.\r\n */\r\n _self.resume = function () {\r\n _paused = false;\r\n _self[_DYN_SEND_QUEUED_REQUESTS /* @min:%2esendQueuedRequests */](0 /* EventSendType.Batched */, 4 /* SendRequestReason.Resumed */);\r\n };\r\n /**\r\n * Sends a request synchronously to the Aria collector. This api is used to send\r\n * a request containing a single immediate event.\r\n *\r\n * @param batch - The request to be sent.\r\n * @param sendReason - The token used to send the request.\r\n */\r\n _self[_DYN_SEND_SYNCHRONOUS_BAT9 /* @min:%2esendSynchronousBatch */] = function (batch, sendType, sendReason) {\r\n // This will not take into account the max connections restriction. Since this is sync, we can\r\n // only send one of this request at a time and thus should not worry about multiple connections\r\n // being used to send synchronous events.\r\n // Increment active connection since we are still going to use a connection to send the request.\r\n if (batch && batch[_DYN_COUNT /* @min:%2ecount */]() > 0) {\r\n if (isNullOrUndefined(sendType)) {\r\n sendType = 1 /* EventSendType.Synchronous */;\r\n }\r\n if (_isUnloading) {\r\n sendType = _adjustSendType(sendType);\r\n sendReason = 2 /* SendRequestReason.Unload */;\r\n }\r\n // For sync requests we will not wait for the clock skew.\r\n _sendBatches([batch], 0, false, sendType, sendReason || 0 /* SendRequestReason.Undefined */);\r\n }\r\n };\r\n function _hasIdleConnection() {\r\n return !_paused && _outstandingRequests < maxConnections;\r\n }\r\n function _clearQueue() {\r\n var theQueue = _batchQueue;\r\n _batchQueue = [];\r\n return theQueue;\r\n }\r\n function _canSendPayload(theBatches, sendType, retryCnt) {\r\n var result = false;\r\n if (theBatches && theBatches[_DYN_LENGTH /* @min:%2elength */] > 0 && !_paused && _sendInterfaces[sendType] && _serializer) {\r\n // Always attempt to send synchronous events don't wait for idle or clockSkew\r\n // and don't block retry requests if clockSkew is not yet set\r\n result = (sendType !== 0 /* EventSendType.Batched */) || (_hasIdleConnection() && (retryCnt > 0 || _clockSkewManager[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */]()));\r\n }\r\n return result;\r\n }\r\n function _createDebugBatches(theBatches) {\r\n var values = {};\r\n if (theBatches) {\r\n arrForEach(theBatches, function (theBatch, idx) {\r\n values[idx] = {\r\n iKey: theBatch[_DYN_I_KEY /* @min:%2eiKey */](),\r\n evts: theBatch[_DYN_EVENTS /* @min:%2eevents */]()\r\n };\r\n });\r\n }\r\n return values;\r\n }\r\n function _sendBatches(theBatches, retryCount, isTeardown, sendType, sendReason) {\r\n if (!theBatches || theBatches[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n // Nothing to do\r\n return;\r\n }\r\n if (_paused) {\r\n _sendBatchesNotification(theBatches, 1 /* EventBatchNotificationReason.Paused */, sendType);\r\n return;\r\n }\r\n // Make sure that if we are unloading the sendType is a supported version\r\n sendType = _adjustSendType(sendType);\r\n try {\r\n var orgBatches_1 = theBatches;\r\n var isSynchronous_1 = sendType !== 0 /* EventSendType.Batched */;\r\n doPerf(_core, function () { return \"HttpManager:_sendBatches\"; }, function (perfEvt) {\r\n if (perfEvt) {\r\n // Perf Monitoring is enabled, so create a \"Quick\" copy of the original batches so we still report\r\n // the original values as part of the perfEvent. This is because theBatches uses .shift() to remove each\r\n // batch as they are processed - removing from the original array, so by the time the _createDebugBatches()\r\n // function is called the passed in value has changed and therefore the reported value for the perfEvent is incorrect\r\n theBatches = theBatches.slice(0);\r\n }\r\n var droppedBatches = [];\r\n var thePayload = null;\r\n var serializationStart = getTime();\r\n var sendInterface = _sendInterfaces[sendType] || (isSynchronous_1 ? _sendInterfaces[1 /* EventSendType.Synchronous */] : _sendInterfaces[0 /* EventSendType.Batched */]);\r\n var sendTransport = sendInterface && sendInterface[_DYN__TRANSPORT /* @min:%2e_transport */];\r\n // Sync Fetch has the same payload limitation as sendBeacon -- 64kb limit\r\n var isReducedPayload = _canHaveReducedPayload && (_isUnloading || _isBeaconPayload(sendType) || (sendTransport === 3 /* TransportType.Beacon */ || (sendInterface._isSync && sendTransport === 2 /* TransportType.Fetch */)));\r\n while (_canSendPayload(theBatches, sendType, retryCount)) {\r\n var theBatch = theBatches.shift();\r\n if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {\r\n if (!_killSwitch.isTenantKilled(theBatch[_DYN_I_KEY /* @min:%2eiKey */]())) {\r\n // Make sure we have a payload object\r\n thePayload = thePayload || _serializer.createPayload(retryCount, isTeardown, isSynchronous_1, isReducedPayload, sendReason, sendType);\r\n // Add the batch to the current payload\r\n if (!_serializer.appendPayload(thePayload, theBatch, maxEventsPerBatch)) {\r\n // Entire batch was not added so send the payload and retry adding this batch\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n serializationStart = getTime();\r\n theBatches = [theBatch][_DYN_CONCAT /* @min:%2econcat */](theBatches);\r\n thePayload = null;\r\n }\r\n else if (thePayload.overflow !== null) {\r\n // Total Payload size was exceeded so send the payload and add the unsent as the next batch to send\r\n theBatches = [thePayload.overflow][_DYN_CONCAT /* @min:%2econcat */](theBatches);\r\n thePayload.overflow = null;\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n serializationStart = getTime();\r\n thePayload = null;\r\n }\r\n }\r\n else {\r\n droppedBatches[_DYN_PUSH /* @min:%2epush */](theBatch);\r\n }\r\n }\r\n }\r\n // Make sure to flush any remaining payload\r\n if (thePayload) {\r\n _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);\r\n }\r\n if (theBatches[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Add any unsent batches back to the head of the queue\r\n _batchQueue = theBatches[_DYN_CONCAT /* @min:%2econcat */](_batchQueue);\r\n }\r\n // Now send notification about any dropped events\r\n _sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, sendType);\r\n }, function () { return ({ batches: _createDebugBatches(orgBatches_1), retryCount: retryCount, isTeardown: isTeardown, isSynchronous: isSynchronous_1, sendReason: sendReason, useSendBeacon: _isBeaconPayload(sendType), sendType: sendType }); }, !isSynchronous_1);\r\n }\r\n catch (ex) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 48 /* _eInternalMessageId.CannotSerializeObject */, \"Unexpected Exception sending batch: \" + dumpObj(ex));\r\n }\r\n }\r\n function _buildRequestDetails(thePayload, useHeaders) {\r\n var requestDetails = {\r\n url: _urlString,\r\n hdrs: {},\r\n useHdrs: false // Assume no headers\r\n };\r\n if (!useHeaders) {\r\n // Attempt to map headers to a query string if possible\r\n objForEachKey(_headers, function (name, value) {\r\n if (_collectorHeaderToQs[name]) {\r\n _addRequestDetails(requestDetails, _collectorHeaderToQs[name], value, false);\r\n }\r\n else {\r\n // No mapping, so just include in the headers anyway (may not get sent if using sendBeacon())\r\n requestDetails[_DYN_HDRS /* @min:%2ehdrs */][name] = value;\r\n requestDetails[_DYN_USE_HDRS /* @min:%2euseHdrs */] = true;\r\n }\r\n });\r\n }\r\n else {\r\n // Copy the pre-defined headers into the payload headers\r\n requestDetails[_DYN_HDRS /* @min:%2ehdrs */] = extend(requestDetails[_DYN_HDRS /* @min:%2ehdrs */], _headers);\r\n requestDetails.useHdrs = (objKeys(requestDetails.hdrs)[_DYN_LENGTH /* @min:%2elength */] > 0);\r\n }\r\n _addRequestDetails(requestDetails, STR_CLIENT_ID, \"NO_AUTH\", useHeaders);\r\n _addRequestDetails(requestDetails, STR_CLIENT_VERSION, FullVersionString, useHeaders);\r\n var apiQsKeys = STR_EMPTY;\r\n arrForEach(thePayload.apiKeys, function (apiKey) {\r\n if (apiQsKeys[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n apiQsKeys += \",\";\r\n }\r\n apiQsKeys += apiKey;\r\n });\r\n _addRequestDetails(requestDetails, STR_API_KEY, apiQsKeys, useHeaders);\r\n _addRequestDetails(requestDetails, STR_UPLOAD_TIME, dateNow().toString(), useHeaders);\r\n var msfpc = _getMsfpc(thePayload);\r\n if (isValueAssigned(msfpc)) {\r\n requestDetails.url += \"&ext.intweb.msfpc=\" + msfpc;\r\n }\r\n if (_clockSkewManager[_DYN_SHOULD_ADD_CLOCK_SKE1 /* @min:%2eshouldAddClockSkewHeaders */]()) {\r\n _addRequestDetails(requestDetails, STR_TIME_DELTA_TO_APPLY, _clockSkewManager[_DYN_GET_CLOCK_SKEW_HEADE2 /* @min:%2egetClockSkewHeaderValue */](), useHeaders);\r\n }\r\n if (_core[_DYN_GET_WPARAM /* @min:%2egetWParam */]) {\r\n var wParam = _core[_DYN_GET_WPARAM /* @min:%2egetWParam */]();\r\n if (wParam >= 0) {\r\n requestDetails.url += \"&w=\" + wParam;\r\n }\r\n }\r\n for (var i = 0; i < _queryStringParameters[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n requestDetails.url += \"&\" + _queryStringParameters[i].name + \"=\" + _queryStringParameters[i].value;\r\n }\r\n return requestDetails;\r\n }\r\n function _setTimingValue(timings, name, value) {\r\n timings[name] = timings[name] || {};\r\n timings[name][_postManager.identifier] = value;\r\n }\r\n function _doPayloadSend(thePayload, serializationStart, serializationCompleted, sendReason) {\r\n if (thePayload && thePayload.payloadBlob && thePayload.payloadBlob[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var useSendHook_1 = !!_sendHook;\r\n var sendInterface_1 = _sendInterfaces[thePayload.sendType];\r\n // Send all data using a beacon style transport if closing mode is on or channel was teared down\r\n if (!_isBeaconPayload(thePayload[_DYN_SEND_TYPE /* @min:%2esendType */]) && thePayload[_DYN_IS_BEACON /* @min:%2eisBeacon */] && thePayload.sendReason === 2 /* SendRequestReason.Unload */) {\r\n sendInterface_1 = _sendInterfaces[2 /* EventSendType.SendBeacon */] || _sendInterfaces[3 /* EventSendType.SyncFetch */] || sendInterface_1;\r\n }\r\n var useHeaders_1 = _useHeaders;\r\n // Disable header usage if we know we are using sendBeacon as additional headers are not supported\r\n if (thePayload.isBeacon || sendInterface_1[_DYN__TRANSPORT /* @min:%2e_transport */] === 3 /* TransportType.Beacon */) {\r\n useHeaders_1 = false;\r\n }\r\n var requestDetails_1 = _buildRequestDetails(thePayload, useHeaders_1);\r\n useHeaders_1 = useHeaders_1 || requestDetails_1[_DYN_USE_HDRS /* @min:%2euseHdrs */];\r\n var sendEventStart_1 = getTime();\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend\"; }, function () {\r\n // Increment the send attempt count and add timings after packaging (So it's not serialized in the 1st attempt)\r\n for (var batchLp = 0; batchLp < thePayload.batches[_DYN_LENGTH /* @min:%2elength */]; batchLp++) {\r\n var theBatch = thePayload[_DYN_BATCHES /* @min:%2ebatches */][batchLp];\r\n var theEvents = theBatch[_DYN_EVENTS /* @min:%2eevents */]();\r\n for (var evtLp = 0; evtLp < theEvents[_DYN_LENGTH /* @min:%2elength */]; evtLp++) {\r\n var telemetryItem = theEvents[evtLp];\r\n if (_enableEventTimings) {\r\n var timings = telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] = telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] || {};\r\n _setTimingValue(timings, \"sendEventStart\", sendEventStart_1);\r\n _setTimingValue(timings, \"serializationStart\", serializationStart);\r\n _setTimingValue(timings, \"serializationCompleted\", serializationCompleted);\r\n }\r\n telemetryItem[strSendAttempt] > 0 ? telemetryItem[strSendAttempt]++ : telemetryItem[strSendAttempt] = 1;\r\n }\r\n }\r\n // Note: always sending this notification in a synchronous manner.\r\n _sendBatchesNotification(thePayload[_DYN_BATCHES /* @min:%2ebatches */], (1000 /* EventBatchNotificationReason.SendingUndefined */ + (sendReason || 0 /* SendRequestReason.Undefined */)), thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], true);\r\n // Disabling the use of const because of Issue:\r\n // - Task 9227844: [1DS] Some environments and packagers automatically \"freeze\" objects which are defined as const which causes any mutations to throw\r\n // eslint-disable-next-line prefer-const\r\n var orgPayloadData = {\r\n data: thePayload.payloadBlob,\r\n urlString: requestDetails_1.url,\r\n headers: requestDetails_1[_DYN_HDRS /* @min:%2ehdrs */],\r\n _thePayload: thePayload,\r\n _sendReason: sendReason,\r\n timeout: _xhrTimeout,\r\n disableXhrSync: _disableXhrSync,\r\n disableFetchKeepAlive: _disableFetchKeepAlive\r\n };\r\n // Only automatically add the following headers if already sending headers and we are not attempting to avoid an options call\r\n if (useHeaders_1) {\r\n if (!_hasHeader(orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */], STR_CACHE_CONTROL)) {\r\n orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */][STR_CACHE_CONTROL] = DEFAULT_CACHE_CONTROL;\r\n }\r\n if (!_hasHeader(orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */], STR_CONTENT_TYPE_HEADER)) {\r\n orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */][STR_CONTENT_TYPE_HEADER] = DEFAULT_CONTENT_TYPE;\r\n }\r\n }\r\n var sender = null;\r\n if (sendInterface_1) {\r\n // Send sync requests if the request is immediate or we are tearing down telemetry.\r\n sender = function (payload) {\r\n // Notify the clock skew manager that we are sending the first request (Potentially blocking all further requests)\r\n _clockSkewManager[_DYN_FIRST_REQUEST_SENT /* @min:%2efirstRequestSent */]();\r\n var onComplete = function (status, headers) {\r\n _retryRequestIfNeeded(status, headers, thePayload, sendReason);\r\n };\r\n var isSync = thePayload[_DYN_IS_TEARDOWN /* @min:%2eisTeardown */] || thePayload[_DYN_IS_SYNC /* @min:%2eisSync */];\r\n try {\r\n sendInterface_1[_DYN_SEND_POST /* @min:%2esendPOST */](payload, onComplete, isSync);\r\n if (_sendListener) {\r\n // Send the original payload to the listener\r\n _sendListener(orgPayloadData, payload, isSync, thePayload[_DYN_IS_BEACON /* @min:%2eisBeacon */]);\r\n }\r\n }\r\n catch (ex) {\r\n _warnToConsole(_logger, \"Unexpected exception sending payload. Ex:\" + dumpObj(ex));\r\n _doOnComplete(onComplete, 0, {});\r\n }\r\n };\r\n }\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend.sender\"; }, function () {\r\n if (sender) {\r\n if (thePayload[_DYN_SEND_TYPE /* @min:%2esendType */] === 0 /* EventSendType.Batched */) {\r\n _outstandingRequests++;\r\n }\r\n // Only call the hook if it's defined and we are not using sendBeacon as additional headers are not supported\r\n if (useSendHook_1 && !thePayload.isBeacon && sendInterface_1[_DYN__TRANSPORT /* @min:%2e_transport */] !== 3 /* TransportType.Beacon */) {\r\n // Create a new IPayloadData that is sent into the hook method, so that the hook method\r\n // can't change the object references to the orgPayloadData (it can still change the content -- mainly the headers)\r\n // Disabling the use of const because of Issue:\r\n // - Task 9227844: [1DS] Some environments and packagers automatically \"freeze\" objects which are defined as const which causes any mutations to throw\r\n // eslint-disable-next-line prefer-const\r\n var hookData_1 = {\r\n data: orgPayloadData[_DYN_DATA /* @min:%2edata */],\r\n urlString: orgPayloadData[_DYN_URL_STRING /* @min:%2eurlString */],\r\n headers: extend({}, orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */]),\r\n timeout: orgPayloadData[_DYN_TIMEOUT /* @min:%2etimeout */],\r\n disableXhrSync: orgPayloadData[_DYN_DISABLE_XHR_SYNC /* @min:%2edisableXhrSync */],\r\n disableFetchKeepAlive: orgPayloadData[_DYN_DISABLE_FETCH_KEEP_A6 /* @min:%2edisableFetchKeepAlive */]\r\n };\r\n var senderCalled_1 = false;\r\n doPerf(_core, function () { return \"HttpManager:_doPayloadSend.sendHook\"; }, function () {\r\n try {\r\n _sendHook(hookData_1, function (payload) {\r\n senderCalled_1 = true;\r\n // Add back the internal properties\r\n if (!_customHttpInterface && !payload[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */]) {\r\n payload[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */] = payload[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */] || orgPayloadData[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */];\r\n payload[_DYN__SEND_REASON /* @min:%2e_sendReason */] = payload[_DYN__SEND_REASON /* @min:%2e_sendReason */] || orgPayloadData[_DYN__SEND_REASON /* @min:%2e_sendReason */];\r\n }\r\n sender(payload);\r\n }, thePayload.isSync || thePayload[_DYN_IS_TEARDOWN /* @min:%2eisTeardown */]);\r\n }\r\n catch (ex) {\r\n if (!senderCalled_1) {\r\n // The hook never called the sender -- assume that it never will\r\n sender(orgPayloadData);\r\n }\r\n }\r\n });\r\n }\r\n else {\r\n sender(orgPayloadData);\r\n }\r\n }\r\n });\r\n }, function () { return ({ thePayload: thePayload, serializationStart: serializationStart, serializationCompleted: serializationCompleted, sendReason: sendReason }); }, thePayload[_DYN_IS_SYNC /* @min:%2eisSync */]);\r\n }\r\n if (thePayload.sizeExceed && thePayload.sizeExceed[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Ensure that we send any discard events for oversize events even when there was no payload to send\r\n _sendBatchesNotification(thePayload.sizeExceed, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */]);\r\n }\r\n if (thePayload.failedEvts && thePayload.failedEvts[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n // Ensure that we send any discard events for events that could not be serialized even when there was no payload to send\r\n _sendBatchesNotification(thePayload.failedEvts, 8002 /* EventBatchNotificationReason.InvalidEvent */, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */]);\r\n }\r\n }\r\n function _addEventCompletedTimings(theEvents, sendEventCompleted) {\r\n if (_enableEventTimings) {\r\n arrForEach(theEvents, function (theEvent) {\r\n var timings = theEvent[_DYN_TIMINGS /* @min:%2etimings */] = theEvent[_DYN_TIMINGS /* @min:%2etimings */] || {};\r\n _setTimingValue(timings, \"sendEventCompleted\", sendEventCompleted);\r\n });\r\n }\r\n }\r\n function _retryRequestIfNeeded(status, headers, thePayload, sendReason) {\r\n var reason = 9000 /* EventBatchNotificationReason.ResponseFailure */;\r\n var droppedBatches = null;\r\n var isRetrying = false;\r\n var backOffTrans = false;\r\n try {\r\n var shouldRetry = true;\r\n if (typeof status !== strUndefined) {\r\n if (headers) {\r\n _clockSkewManager[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */](headers[STR_TIME_DELTA_HEADER]);\r\n var killDuration = headers[STR_KILL_DURATION_HEADER] || headers[\"kill-duration-seconds\"];\r\n arrForEach(_killSwitch[_DYN_SET_KILL_SWITCH_TENA10 /* @min:%2esetKillSwitchTenants */](headers[STR_KILL_TOKENS_HEADER], killDuration), function (killToken) {\r\n arrForEach(thePayload[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {\r\n if (theBatch[_DYN_I_KEY /* @min:%2eiKey */]() === killToken) {\r\n // Make sure we have initialized the array\r\n droppedBatches = droppedBatches || [];\r\n // Create a copy of the batch with all of the events (and more importantly the action functions)\r\n var removedEvents = theBatch[_DYN_SPLIT /* @min:%2esplit */](0);\r\n // And then remove the events for the payload batch and reduce the actual number of processed\r\n thePayload.numEvents -= removedEvents[_DYN_COUNT /* @min:%2ecount */]();\r\n droppedBatches[_DYN_PUSH /* @min:%2epush */](removedEvents);\r\n }\r\n });\r\n });\r\n }\r\n // Disabling triple-equals rule to avoid httpOverrides from failing because they are returning a string value\r\n // tslint:disable-next-line:triple-equals\r\n if (status == 200 || status == 204) {\r\n // Response was successfully sent\r\n reason = 200 /* EventBatchNotificationReason.Complete */;\r\n return;\r\n }\r\n if (!retryPolicyShouldRetryForStatus(status) || thePayload.numEvents <= 0) {\r\n // Only retry for specific response codes and if there is still events after kill switch processing\r\n shouldRetry = false;\r\n }\r\n // Derive the notification response from the HttpStatus Code\r\n reason = 9000 /* EventBatchNotificationReason.ResponseFailure */ + (status % 1000);\r\n }\r\n if (shouldRetry) {\r\n // The events should be retried -- so change notification to requeue them\r\n reason = 100 /* EventBatchNotificationReason.RequeueEvents */;\r\n var retryCount_1 = thePayload.retryCnt;\r\n if (thePayload[_DYN_SEND_TYPE /* @min:%2esendType */] === 0 /* EventSendType.Batched */) {\r\n // attempt to resend the entire batch\r\n if (retryCount_1 < maxRequestRetriesBeforeBackoff) {\r\n isRetrying = true;\r\n _doAction(function () {\r\n // try to resend the same batches\r\n if (thePayload[_DYN_SEND_TYPE /* @min:%2esendType */] === 0 /* EventSendType.Batched */) {\r\n // Reduce the outstanding request count (if this was an async request) as we didn't reduce the count\r\n // previously and we are about to reschedule our retry attempt and we want an attempt to send\r\n // to occur, it's also required to ensure that a follow up handleRequestFinished() call occurs\r\n _outstandingRequests--;\r\n }\r\n _sendBatches(thePayload[_DYN_BATCHES /* @min:%2ebatches */], retryCount_1 + 1, thePayload[_DYN_IS_TEARDOWN /* @min:%2eisTeardown */], _isUnloading ? 2 /* EventSendType.SendBeacon */ : thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], 5 /* SendRequestReason.Retry */);\r\n }, _isUnloading, retryPolicyGetMillisToBackoffForRetry(retryCount_1));\r\n }\r\n else {\r\n backOffTrans = true;\r\n if (_isUnloading) {\r\n // we are unloading so don't try and requeue the events otherwise let the events get requeued and resent during the backoff sending\r\n // This will also cause the events to be purged based on the priority (if necessary)\r\n reason = 8001 /* EventBatchNotificationReason.NonRetryableStatus */;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n finally {\r\n if (!isRetrying) {\r\n // Make sure the clockSkewManager doesn't blocking further sending of requests once we have a proper response\r\n // This won't override any previously sent clock Skew value\r\n _clockSkewManager[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */]();\r\n _handleRequestFinished(thePayload, reason, sendReason, backOffTrans);\r\n }\r\n _sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */]);\r\n }\r\n }\r\n function _handleRequestFinished(thePayload, batchReason, sendReason, backOffTrans) {\r\n try {\r\n if (backOffTrans) {\r\n // Slow down the transmission requests\r\n _postManager[_DYN__BACK_OFF_TRANSMISSI11 /* @min:%2e_backOffTransmission */]();\r\n }\r\n if (batchReason === 200 /* EventBatchNotificationReason.Complete */) {\r\n if (!backOffTrans && !thePayload[_DYN_IS_SYNC /* @min:%2eisSync */]) {\r\n // We have a successful async response, so the lets open the floodgates\r\n // The reason for checking isSync is to avoid unblocking if beacon send occurred as it\r\n // doesn't wait for a response.\r\n _postManager._clearBackOff();\r\n }\r\n _addCompleteTimings(thePayload[_DYN_BATCHES /* @min:%2ebatches */]);\r\n }\r\n // Send the notifications synchronously\r\n _sendBatchesNotification(thePayload[_DYN_BATCHES /* @min:%2ebatches */], batchReason, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], true);\r\n }\r\n finally {\r\n if (thePayload[_DYN_SEND_TYPE /* @min:%2esendType */] === 0 /* EventSendType.Batched */) {\r\n // we always need to decrement this value otherwise the httpmanager locks up and won't send any more events\r\n _outstandingRequests--;\r\n // Don't try to send additional queued events if this is a retry operation as the retried\r\n // response will eventually call _handleRequestFinished for the retried event\r\n if (sendReason !== 5 /* SendRequestReason.Retry */) {\r\n // Try and send any other queued batched events\r\n _self.sendQueuedRequests(thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], sendReason);\r\n }\r\n }\r\n }\r\n }\r\n function _addCompleteTimings(theBatches) {\r\n if (_enableEventTimings) {\r\n var sendEventCompleted_1 = getTime();\r\n arrForEach(theBatches, function (theBatch) {\r\n if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {\r\n _addEventCompletedTimings(theBatch[_DYN_EVENTS /* @min:%2eevents */](), sendEventCompleted_1);\r\n }\r\n });\r\n }\r\n }\r\n function _doAction(cb, isSync, interval) {\r\n if (isSync) {\r\n cb();\r\n }\r\n else {\r\n _timeoutWrapper.set(cb, interval);\r\n }\r\n }\r\n /**\r\n * Converts the XHR getAllResponseHeaders to a map containing the header key and value.\r\n */\r\n // tslint:disable-next-line: align\r\n function _convertAllHeadersToMap(headersString) {\r\n var headers = {};\r\n if (isString(headersString)) {\r\n var headersArray = strTrim(headersString)[_DYN_SPLIT /* @min:%2esplit */](/[\\r\\n]+/);\r\n arrForEach(headersArray, function (headerEntry) {\r\n if (headerEntry) {\r\n var idx = headerEntry.indexOf(\": \");\r\n if (idx !== -1) {\r\n // The new spec has the headers returning all as lowercase -- but not all browsers do this yet\r\n var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n var value = strTrim(headerEntry.substring(idx + 1));\r\n headers[header] = value;\r\n }\r\n else {\r\n headers[strTrim(headerEntry)] = 1;\r\n }\r\n }\r\n });\r\n }\r\n return headers;\r\n }\r\n function _getMsfpc(thePayload) {\r\n for (var lp = 0; lp < thePayload.batches[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var msfpc = thePayload[_DYN_BATCHES /* @min:%2ebatches */][lp].Msfpc();\r\n if (msfpc) {\r\n return encodeURIComponent(msfpc);\r\n }\r\n }\r\n return STR_EMPTY;\r\n }\r\n function _handleCollectorResponse(responseText) {\r\n var responseHandlers = _responseHandlers;\r\n try {\r\n for (var i = 0; i < responseHandlers[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n try {\r\n responseHandlers[i](responseText);\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 519 /* _eExtendedInternalMessageId.PostResponseHandler */, \"Response handler failed: \" + e);\r\n }\r\n }\r\n if (responseText) {\r\n var response = JSON.parse(responseText);\r\n if (isValueAssigned(response.webResult) && isValueAssigned(response.webResult[STR_MSFPC])) {\r\n // Set cookie\r\n _cookieMgr.set(\"MSFPC\", response.webResult[STR_MSFPC], 365 * 86400);\r\n }\r\n }\r\n }\r\n catch (ex) {\r\n // Doing nothing\r\n }\r\n }\r\n function _sendBatchesNotification(theBatches, batchReason, sendType, sendSync) {\r\n if (theBatches && theBatches[_DYN_LENGTH /* @min:%2elength */] > 0 && actions) {\r\n var theAction_1 = actions[_getNotificationAction(batchReason)];\r\n if (theAction_1) {\r\n var isSyncRequest_1 = sendType !== 0 /* EventSendType.Batched */;\r\n doPerf(_core, function () { return \"HttpManager:_sendBatchesNotification\"; }, function () {\r\n _doAction(function () {\r\n try {\r\n theAction_1.call(actions, theBatches, batchReason, isSyncRequest_1, sendType);\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 74 /* _eInternalMessageId.NotificationException */, \"send request notification failed: \" + e);\r\n }\r\n }, sendSync || isSyncRequest_1, 0);\r\n }, function () { return ({ batches: _createDebugBatches(theBatches), reason: batchReason, isSync: isSyncRequest_1, sendSync: sendSync, sendType: sendType }); }, !isSyncRequest_1);\r\n }\r\n }\r\n }\r\n function _getNotificationAction(reason) {\r\n var action = _eventActionMap[reason];\r\n if (!isValueAssigned(action)) {\r\n action = STR_OTHER;\r\n if (reason >= 9000 /* EventBatchNotificationReason.ResponseFailure */ && reason <= 9999 /* EventBatchNotificationReason.ResponseFailureMax */) {\r\n action = STR_RESPONSE_FAIL;\r\n }\r\n else if (reason >= 8000 /* EventBatchNotificationReason.EventsDropped */ && reason <= 8999 /* EventBatchNotificationReason.EventsDroppedMax */) {\r\n action = STR_DROPPED;\r\n }\r\n else if (reason >= 1000 /* EventBatchNotificationReason.SendingUndefined */ && reason <= 1999 /* EventBatchNotificationReason.SendingEventMax */) {\r\n action = STR_SENDING;\r\n }\r\n }\r\n return action;\r\n }\r\n });\r\n }\r\n// Removed Stub for HttpManager.prototype.initialize.\r\n// Removed Stub for HttpManager.prototype.addHeader.\r\n// Removed Stub for HttpManager.prototype.addResponseHandler.\r\n// Removed Stub for HttpManager.prototype.addBatch.\r\n// Removed Stub for HttpManager.prototype.canSendRequest.\r\n// Removed Stub for HttpManager.prototype.sendQueuedRequests.\r\n// Removed Stub for HttpManager.prototype.isCompletelyIdle.\r\n// Removed Stub for HttpManager.prototype.setUnloading.\r\n// Removed Stub for HttpManager.prototype.teardown.\r\n// Removed Stub for HttpManager.prototype.pause.\r\n// Removed Stub for HttpManager.prototype.resume.\r\n// Removed Stub for HttpManager.prototype.sendSynchronousBatch.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n HttpManager.__ieDyn=1;\n\n return HttpManager;\r\n}());\r\nexport { HttpManager };\r\n//# sourceMappingURL=HttpManager.js.map","/*\n * 1DS JS SDK POST plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\n/**\r\n* PostManager.ts\r\n* @author Abhilash Panwar (abpanwar); Hector Hernandez (hectorh); Nev Wylie (newylie)\r\n* @copyright Microsoft 2018-2020\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin, EventsDiscardedReason, _throwInternal, addPageHideEventListener, addPageShowEventListener, addPageUnloadEventListener, arrForEach, createProcessTelemetryContext, createUniqueNamespace, doPerf, getWindow, isChromium, isGreaterThanZero, isNumber, mergeEvtNamespace, objForEachKey, onConfigChange, optimizeObject, proxyFunctions, removePageHideEventListener, removePageShowEventListener, removePageUnloadEventListener, setProcessTelemetryTimings } from \"@microsoft/1ds-core-js\";\r\nimport { createPromise } from \"@nevware21/ts-async\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { BE_PROFILE, NRT_PROFILE, RT_PROFILE } from \"./DataModels\";\r\nimport { EventBatch } from \"./EventBatch\";\r\nimport { HttpManager } from \"./HttpManager\";\r\nimport { STR_MSA_DEVICE_TICKET, STR_TRACE, STR_USER } from \"./InternalConstants\";\r\nimport { retryPolicyGetMillisToBackoffForRetry } from \"./RetryPolicy\";\r\nimport { createTimeoutWrapper } from \"./TimeoutOverrideWrapper\";\r\nimport { _DYN_AUTO_FLUSH_EVENTS_LI13, _DYN_BASE_DATA, _DYN_BATCHES, _DYN_CAN_SEND_REQUEST, _DYN_CLEAR_TIMEOUT_OVERRI3, _DYN_CONCAT, _DYN_COUNT, _DYN_DATA, _DYN_DISABLE_AUTO_BATCH_F14, _DYN_DISABLE_OPTIMIZE_OBJ, _DYN_DISABLE_TELEMETRY, _DYN_EVENTS, _DYN_EVENTS_LIMIT_IN_MEM, _DYN_GET_WPARAM, _DYN_IDENTIFIER, _DYN_IGNORE_MC1_MS0_COOKI12, _DYN_INITIALIZE, _DYN_IS_COMPLETELY_IDLE, _DYN_I_KEY, _DYN_LATENCY, _DYN_LENGTH, _DYN_OVERRIDE_INSTRUMENTA15, _DYN_PUSH, _DYN_SEND_ATTEMPT, _DYN_SEND_POST, _DYN_SEND_QUEUED_REQUESTS, _DYN_SEND_SYNCHRONOUS_BAT9, _DYN_SET_TIMEOUT_OVERRIDE, _DYN_SET_UNLOADING, _DYN_SPLICE, _DYN_SPLIT, _DYN_SYNC, _DYN__BACK_OFF_TRANSMISSI11 } from \"./__DynamicConstants\";\r\nvar FlushCheckTimer = 0.250; // This needs to be in seconds, so this is 250ms\r\nvar MaxNumberEventPerBatch = 500;\r\nvar EventsDroppedAtOneTime = 20;\r\nvar MaxSendAttempts = 6;\r\nvar MaxSyncUnloadSendAttempts = 2; // Assuming 2 based on beforeunload and unload\r\nvar MaxBackoffCount = 4;\r\nvar MaxConnections = 2;\r\nvar MaxRequestRetriesBeforeBackoff = 1;\r\nvar MaxEventsLimitInMem = 10000;\r\nvar strEventsDiscarded = \"eventsDiscarded\";\r\nvar undefValue = undefined;\r\n/**\r\n * The default settings for the config.\r\n * WE MUST include all defaults here to ensure that the config is created with all of the properties\r\n * defined as dynamic.\r\n */\r\nvar defaultPostChannelConfig = objDeepFreeze({\r\n eventsLimitInMem: { isVal: isGreaterThanZero, v: MaxEventsLimitInMem },\r\n immediateEventLimit: { isVal: isGreaterThanZero, v: 500 },\r\n autoFlushEventsLimit: { isVal: isGreaterThanZero, v: 0 },\r\n disableAutoBatchFlushLimit: false,\r\n httpXHROverride: { isVal: isOverrideFn, v: undefValue },\r\n overrideInstrumentationKey: undefValue,\r\n overrideEndpointUrl: undefValue,\r\n disableTelemetry: false,\r\n ignoreMc1Ms0CookieProcessing: false,\r\n setTimeoutOverride: undefValue,\r\n clearTimeoutOverride: undefValue,\r\n payloadPreprocessor: undefValue,\r\n payloadListener: undefValue,\r\n disableEventTimings: undefValue,\r\n valueSanitizer: undefValue,\r\n stringifyObjects: undefValue,\r\n enableCompoundKey: undefValue,\r\n disableOptimizeObj: false,\r\n // disableCacheHeader: undefValue, // See Task #7178858 - Collector requires a change to support this\r\n transports: undefValue,\r\n unloadTransports: undefValue,\r\n useSendBeacon: undefValue,\r\n disableFetchKeepAlive: undefValue,\r\n avoidOptions: false,\r\n xhrTimeout: undefValue,\r\n disableXhrSync: undefValue,\r\n alwaysUseXhrOverride: false,\r\n maxEventRetryAttempts: { isVal: isNumber, v: MaxSendAttempts },\r\n maxUnloadEventRetryAttempts: { isVal: isNumber, v: MaxSyncUnloadSendAttempts },\r\n addNoResponse: undefValue\r\n});\r\nfunction isOverrideFn(httpXHROverride) {\r\n return httpXHROverride && httpXHROverride[_DYN_SEND_POST /* @min:%2esendPOST */];\r\n}\r\n/**\r\n * Class that manages adding events to inbound queues and batching of events\r\n * into requests.\r\n * @group Classes\r\n * @group Entrypoint\r\n */\r\nvar PostChannel = /** @class */ (function (_super) {\r\n __extends(PostChannel, _super);\r\n function PostChannel() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"PostChannel\";\r\n _this.priority = 1011;\r\n _this.version = '4.0.2';\r\n var _postConfig;\r\n var _isTeardownCalled = false;\r\n var _flushCallbackQueue = [];\r\n var _flushCallbackTimer;\r\n var _paused = false;\r\n var _immediateQueueSize = 0;\r\n var _immediateQueueSizeLimit;\r\n var _queueSize = 0;\r\n var _queueSizeLimit;\r\n var _profiles = {};\r\n var _currentProfile = RT_PROFILE;\r\n var _scheduledTimer;\r\n var _immediateTimer;\r\n var _currentBackoffCount;\r\n var _timerCount;\r\n var _httpManager;\r\n var _batchQueues;\r\n var _autoFlushEventsLimit;\r\n // either MaxBatchSize * (1+ Max Connections) or _queueLimit / 6 (where 3 latency Queues [normal, realtime, cost deferred] * 2 [allow half full -- allow for retry])\r\n var _autoFlushBatchLimit;\r\n var _delayedBatchSendLatency;\r\n var _delayedBatchReason;\r\n var _optimizeObject;\r\n var _isPageUnloadTriggered;\r\n var _maxEventSendAttempts;\r\n var _maxUnloadEventSendAttempts;\r\n var _evtNamespace;\r\n var _timeoutWrapper;\r\n var _ignoreMc1Ms0CookieProcessing;\r\n var _disableAutoBatchFlushLimit;\r\n var _notificationManager;\r\n var _unloadHandlersAdded;\r\n var _overrideInstrumentationKey;\r\n var _disableTelemetry;\r\n dynamicProto(PostChannel, _this, function (_self, _base) {\r\n _initDefaults();\r\n // Special internal method to allow the DebugPlugin to hook embedded objects\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_httpManager, _postConfig];\r\n };\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (theConfig, core, extensions) {\r\n doPerf(core, function () { return \"PostChannel:initialize\"; }, function () {\r\n _base[_DYN_INITIALIZE /* @min:%2einitialize */](theConfig, core, extensions);\r\n _notificationManager = core.getNotifyMgr();\r\n try {\r\n _evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self[_DYN_IDENTIFIER /* @min:%2eidentifier */]), core.evtNamespace && core.evtNamespace());\r\n _self._addHook(onConfigChange(theConfig, function (details) {\r\n var coreConfig = details.cfg;\r\n var ctx = createProcessTelemetryContext(null, coreConfig, core);\r\n _postConfig = ctx.getExtCfg(_self[_DYN_IDENTIFIER /* @min:%2eidentifier */], defaultPostChannelConfig);\r\n _timeoutWrapper = createTimeoutWrapper(_postConfig[_DYN_SET_TIMEOUT_OVERRIDE /* @min:%2esetTimeoutOverride */], _postConfig[_DYN_CLEAR_TIMEOUT_OVERRI3 /* @min:%2eclearTimeoutOverride */]);\r\n // Only try and use the optimizeObject() if this appears to be a chromium based browser and it has not been explicitly disabled\r\n _optimizeObject = !_postConfig[_DYN_DISABLE_OPTIMIZE_OBJ /* @min:%2edisableOptimizeObj */] && isChromium();\r\n _ignoreMc1Ms0CookieProcessing = _postConfig[_DYN_IGNORE_MC1_MS0_COOKI12 /* @min:%2eignoreMc1Ms0CookieProcessing */];\r\n _hookWParam(core); // _hookWParam uses _ignoreMc1Ms0CookieProcessing\r\n _queueSizeLimit = _postConfig[_DYN_EVENTS_LIMIT_IN_MEM /* @min:%2eeventsLimitInMem */];\r\n _immediateQueueSizeLimit = _postConfig.immediateEventLimit;\r\n _autoFlushEventsLimit = _postConfig[_DYN_AUTO_FLUSH_EVENTS_LI13 /* @min:%2eautoFlushEventsLimit */];\r\n _maxEventSendAttempts = _postConfig.maxEventRetryAttempts;\r\n _maxUnloadEventSendAttempts = _postConfig.maxUnloadEventRetryAttempts;\r\n _disableAutoBatchFlushLimit = _postConfig[_DYN_DISABLE_AUTO_BATCH_F14 /* @min:%2edisableAutoBatchFlushLimit */];\r\n _setAutoLimits();\r\n // Override iKey if provided in Post config if provided for during initialization\r\n _overrideInstrumentationKey = _postConfig[_DYN_OVERRIDE_INSTRUMENTA15 /* @min:%2eoverrideInstrumentationKey */];\r\n // DisableTelemetry was defined in the config provided during initialization\r\n _disableTelemetry = !!_postConfig[_DYN_DISABLE_TELEMETRY /* @min:%2edisableTelemetry */];\r\n if (_unloadHandlersAdded) {\r\n _removeUnloadHandlers();\r\n }\r\n var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents || [];\r\n // When running in Web browsers try to send all telemetry if page is unloaded\r\n _unloadHandlersAdded = addPageUnloadEventListener(_handleUnloadEvents, excludePageUnloadEvents, _evtNamespace);\r\n _unloadHandlersAdded = addPageHideEventListener(_handleUnloadEvents, excludePageUnloadEvents, _evtNamespace) || _unloadHandlersAdded;\r\n _unloadHandlersAdded = addPageShowEventListener(_handleShowEvents, coreConfig.disablePageShowEvents, _evtNamespace) || _unloadHandlersAdded;\r\n }));\r\n // only initialize the manager once\r\n _httpManager[_DYN_INITIALIZE /* @min:%2einitialize */](theConfig, _self.core, _self);\r\n }\r\n catch (e) {\r\n // resetting the initialized state because of failure\r\n _self.setInitialized(false);\r\n throw e;\r\n }\r\n }, function () { return ({ theConfig: theConfig, core: core, extensions: extensions }); });\r\n };\r\n _self.processTelemetry = function (ev, itemCtx) {\r\n setProcessTelemetryTimings(ev, _self[_DYN_IDENTIFIER /* @min:%2eidentifier */]);\r\n itemCtx = itemCtx || _self._getTelCtx(itemCtx);\r\n var event = ev;\r\n if (!_disableTelemetry && !_isTeardownCalled) {\r\n // Override iKey if provided in Post config if provided for during initialization\r\n if (_overrideInstrumentationKey) {\r\n event[_DYN_I_KEY /* @min:%2eiKey */] = _overrideInstrumentationKey;\r\n }\r\n _addEventToQueues(event, true);\r\n if (_isPageUnloadTriggered) {\r\n // Unload event has been received so we need to try and flush new events\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n else {\r\n _scheduleTimer();\r\n }\r\n }\r\n _self.processNext(event, itemCtx);\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n _isTeardownCalled = true;\r\n _httpManager.teardown();\r\n _removeUnloadHandlers();\r\n // Just register to remove all events associated with this namespace\r\n _initDefaults();\r\n };\r\n function _removeUnloadHandlers() {\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n removePageShowEventListener(null, _evtNamespace);\r\n }\r\n function _hookWParam(core) {\r\n var existingGetWParamMethod = core[_DYN_GET_WPARAM /* @min:%2egetWParam */];\r\n core[_DYN_GET_WPARAM /* @min:%2egetWParam */] = function () {\r\n var wparam = 0;\r\n if (_ignoreMc1Ms0CookieProcessing) {\r\n wparam = wparam | 2;\r\n }\r\n return wparam | existingGetWParamMethod.call(core);\r\n };\r\n }\r\n // Moving event handlers out from the initialize closure so that any local variables can be garbage collected\r\n function _handleUnloadEvents(evt) {\r\n var theEvt = evt || getWindow().event; // IE 8 does not pass the event\r\n if (theEvt.type !== \"beforeunload\") {\r\n // Only set the unload trigger if not beforeunload event as beforeunload can be cancelled while the other events can't\r\n _isPageUnloadTriggered = true;\r\n _httpManager[_DYN_SET_UNLOADING /* @min:%2esetUnloading */](_isPageUnloadTriggered);\r\n }\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n function _handleShowEvents(evt) {\r\n // Handle the page becoming visible again\r\n _isPageUnloadTriggered = false;\r\n _httpManager[_DYN_SET_UNLOADING /* @min:%2esetUnloading */](_isPageUnloadTriggered);\r\n }\r\n function _addEventToQueues(event, append) {\r\n // If send attempt field is undefined we should set it to 0.\r\n if (!event[_DYN_SEND_ATTEMPT /* @min:%2esendAttempt */]) {\r\n event[_DYN_SEND_ATTEMPT /* @min:%2esendAttempt */] = 0;\r\n }\r\n // Add default latency\r\n if (!event[_DYN_LATENCY /* @min:%2elatency */]) {\r\n event[_DYN_LATENCY /* @min:%2elatency */] = 1 /* EventLatencyValue.Normal */;\r\n }\r\n // Remove extra AI properties if present\r\n if (event.ext && event.ext[STR_TRACE]) {\r\n delete (event.ext[STR_TRACE]);\r\n }\r\n if (event.ext && event.ext[STR_USER] && event.ext[STR_USER][\"id\"]) {\r\n delete (event.ext[STR_USER][\"id\"]);\r\n }\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n event.ext = optimizeObject(event.ext);\r\n if (event[_DYN_BASE_DATA /* @min:%2ebaseData */]) {\r\n event[_DYN_BASE_DATA /* @min:%2ebaseData */] = optimizeObject(event[_DYN_BASE_DATA /* @min:%2ebaseData */]);\r\n }\r\n if (event[_DYN_DATA /* @min:%2edata */]) {\r\n event[_DYN_DATA /* @min:%2edata */] = optimizeObject(event[_DYN_DATA /* @min:%2edata */]);\r\n }\r\n }\r\n if (event[_DYN_SYNC /* @min:%2esync */]) {\r\n // If the transmission is backed off then do not send synchronous events.\r\n // We will convert these events to Real time latency instead.\r\n if (_currentBackoffCount || _paused) {\r\n event[_DYN_LATENCY /* @min:%2elatency */] = 3 /* EventLatencyValue.RealTime */;\r\n event[_DYN_SYNC /* @min:%2esync */] = false;\r\n }\r\n else {\r\n // Log the event synchronously\r\n if (_httpManager) {\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n event = optimizeObject(event);\r\n }\r\n _httpManager[_DYN_SEND_SYNCHRONOUS_BAT9 /* @min:%2esendSynchronousBatch */](EventBatch.create(event[_DYN_I_KEY /* @min:%2eiKey */], [event]), event[_DYN_SYNC /* @min:%2esync */] === true ? 1 /* EventSendType.Synchronous */ : event[_DYN_SYNC /* @min:%2esync */], 3 /* SendRequestReason.SyncEvent */);\r\n return;\r\n }\r\n }\r\n }\r\n var evtLatency = event[_DYN_LATENCY /* @min:%2elatency */];\r\n var queueSize = _queueSize;\r\n var queueLimit = _queueSizeLimit;\r\n if (evtLatency === 4 /* EventLatencyValue.Immediate */) {\r\n queueSize = _immediateQueueSize;\r\n queueLimit = _immediateQueueSizeLimit;\r\n }\r\n var eventDropped = false;\r\n // Only add the event if the queue isn't full or it's a direct event (which don't add to the queue sizes)\r\n if (queueSize < queueLimit) {\r\n eventDropped = !_addEventToProperQueue(event, append);\r\n }\r\n else {\r\n var dropLatency = 1 /* EventLatencyValue.Normal */;\r\n var dropNumber = EventsDroppedAtOneTime;\r\n if (evtLatency === 4 /* EventLatencyValue.Immediate */) {\r\n // Only drop other immediate events as they are not technically sharing the general queue\r\n dropLatency = 4 /* EventLatencyValue.Immediate */;\r\n dropNumber = 1;\r\n }\r\n // Drop old event from lower or equal latency\r\n eventDropped = true;\r\n if (_dropEventWithLatencyOrLess(event[_DYN_I_KEY /* @min:%2eiKey */], event[_DYN_LATENCY /* @min:%2elatency */], dropLatency, dropNumber)) {\r\n eventDropped = !_addEventToProperQueue(event, append);\r\n }\r\n }\r\n if (eventDropped) {\r\n // Can't drop events from current queues because the all the slots are taken by queues that are being flushed.\r\n _notifyEvents(strEventsDiscarded, [event], EventsDiscardedReason.QueueFull);\r\n }\r\n }\r\n _self.setEventQueueLimits = function (eventLimit, autoFlushLimit) {\r\n _postConfig[_DYN_EVENTS_LIMIT_IN_MEM /* @min:%2eeventsLimitInMem */] = _queueSizeLimit = isGreaterThanZero(eventLimit) ? eventLimit : MaxEventsLimitInMem;\r\n _postConfig[_DYN_AUTO_FLUSH_EVENTS_LI13 /* @min:%2eautoFlushEventsLimit */] = _autoFlushEventsLimit = isGreaterThanZero(autoFlushLimit) ? autoFlushLimit : 0;\r\n _setAutoLimits();\r\n // We only do this check here as during normal event addition if the queue is > then events start getting dropped\r\n var doFlush = _queueSize > eventLimit;\r\n if (!doFlush && _autoFlushBatchLimit > 0) {\r\n // Check the auto flush max batch size\r\n for (var latency = 1 /* EventLatencyValue.Normal */; !doFlush && latency <= 3 /* EventLatencyValue.RealTime */; latency++) {\r\n var batchQueue = _batchQueues[latency];\r\n if (batchQueue && batchQueue[_DYN_BATCHES /* @min:%2ebatches */]) {\r\n arrForEach(batchQueue[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {\r\n if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() >= _autoFlushBatchLimit) {\r\n // If any 1 batch is > than the limit then trigger an auto flush\r\n doFlush = true;\r\n }\r\n });\r\n }\r\n }\r\n }\r\n _performAutoFlush(true, doFlush);\r\n };\r\n _self.pause = function () {\r\n _clearScheduledTimer();\r\n _paused = true;\r\n _httpManager.pause();\r\n };\r\n _self.resume = function () {\r\n _paused = false;\r\n _httpManager.resume();\r\n _scheduleTimer();\r\n };\r\n _self._loadTransmitProfiles = function (profiles) {\r\n _resetTransmitProfiles();\r\n objForEachKey(profiles, function (profileName, profileValue) {\r\n var profLen = profileValue[_DYN_LENGTH /* @min:%2elength */];\r\n if (profLen >= 2) {\r\n var directValue = (profLen > 2 ? profileValue[2] : 0);\r\n profileValue[_DYN_SPLICE /* @min:%2esplice */](0, profLen - 2);\r\n // Make sure if a higher latency is set to not send then don't send lower latency\r\n if (profileValue[1] < 0) {\r\n profileValue[0] = -1;\r\n }\r\n // Make sure each latency is multiple of the latency higher then it. If not a multiple\r\n // we round up so that it becomes a multiple.\r\n if (profileValue[1] > 0 && profileValue[0] > 0) {\r\n var timerMultiplier = profileValue[0] / profileValue[1];\r\n profileValue[0] = Math.ceil(timerMultiplier) * profileValue[1];\r\n }\r\n // Add back the direct profile timeout\r\n if (directValue >= 0 && profileValue[1] >= 0 && directValue > profileValue[1]) {\r\n // Make sure if it's not disabled (< 0) then make sure it's not larger than RealTime\r\n directValue = profileValue[1];\r\n }\r\n profileValue[_DYN_PUSH /* @min:%2epush */](directValue);\r\n _profiles[profileName] = profileValue;\r\n }\r\n });\r\n };\r\n _self.flush = function (async, callback, sendReason) {\r\n if (async === void 0) { async = true; }\r\n var result;\r\n if (!_paused) {\r\n sendReason = sendReason || 1 /* SendRequestReason.ManualFlush */;\r\n if (async) {\r\n if (!callback) {\r\n result = createPromise(function (resolve) {\r\n // Set the callback to the promise resolve callback\r\n callback = resolve;\r\n });\r\n }\r\n if (_flushCallbackTimer == null) {\r\n // Clear the normal schedule timer as we are going to try and flush ASAP\r\n _clearScheduledTimer();\r\n // Move all queued events to the HttpManager so that we don't discard new events (Auto flush scenario)\r\n _queueBatches(1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, sendReason);\r\n _flushCallbackTimer = _createTimer(function () {\r\n _flushCallbackTimer = null;\r\n _flushImpl(callback, sendReason);\r\n }, 0);\r\n }\r\n else {\r\n // Even if null (no callback) this will ensure after the flushImpl finishes waiting\r\n // for a completely idle connection it will attempt to re-flush any queued events on the next cycle\r\n _flushCallbackQueue[_DYN_PUSH /* @min:%2epush */](callback);\r\n }\r\n }\r\n else {\r\n // Clear the normal schedule timer as we are going to try and flush ASAP\r\n var cleared = _clearScheduledTimer();\r\n // Now cause all queued events to be sent synchronously\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, 1 /* EventSendType.Synchronous */, sendReason);\r\n callback && callback();\r\n if (cleared) {\r\n // restart the normal event timer if it was cleared\r\n _scheduleTimer();\r\n }\r\n }\r\n }\r\n return result;\r\n };\r\n _self.setMsaAuthTicket = function (ticket) {\r\n _httpManager.addHeader(STR_MSA_DEVICE_TICKET, ticket);\r\n };\r\n _self.hasEvents = _hasEvents;\r\n _self._setTransmitProfile = function (profileName) {\r\n if (_currentProfile !== profileName && _profiles[profileName] !== undefined) {\r\n _clearScheduledTimer();\r\n _currentProfile = profileName;\r\n _scheduleTimer();\r\n }\r\n };\r\n proxyFunctions(_self, function () { return _httpManager; }, [\"addResponseHandler\"]);\r\n /**\r\n * Batch and send events currently in the queue for the given latency.\r\n * @param latency - Latency for which to send events.\r\n */\r\n function _sendEventsForLatencyAndAbove(latency, sendType, sendReason) {\r\n var queued = _queueBatches(latency, sendType, sendReason);\r\n // Always trigger the request as while the post channel may not have queued additional events, the httpManager may already have waiting events\r\n _httpManager[_DYN_SEND_QUEUED_REQUESTS /* @min:%2esendQueuedRequests */](sendType, sendReason);\r\n return queued;\r\n }\r\n function _hasEvents() {\r\n return _queueSize > 0;\r\n }\r\n /**\r\n * Try to schedule the timer after which events will be sent. If there are\r\n * no events to be sent, or there is already a timer scheduled, or the\r\n * http manager doesn't have any idle connections this method is no-op.\r\n */\r\n function _scheduleTimer() {\r\n // If we had previously attempted to send requests, but the http manager didn't have any idle connections then the requests where delayed\r\n // so try and requeue then again now\r\n if (_delayedBatchSendLatency >= 0 && _queueBatches(_delayedBatchSendLatency, 0 /* EventSendType.Batched */, _delayedBatchReason)) {\r\n _httpManager[_DYN_SEND_QUEUED_REQUESTS /* @min:%2esendQueuedRequests */](0 /* EventSendType.Batched */, _delayedBatchReason);\r\n }\r\n if (_immediateQueueSize > 0 && !_immediateTimer && !_paused) {\r\n // During initialization _profiles enforce that the direct [2] is less than real time [1] timer value\r\n // If the immediateTimeout is disabled the immediate events will be sent with Real Time events\r\n var immediateTimeOut = _profiles[_currentProfile][2];\r\n if (immediateTimeOut >= 0) {\r\n _immediateTimer = _createTimer(function () {\r\n _immediateTimer = null;\r\n // Only try to send direct events\r\n _sendEventsForLatencyAndAbove(4 /* EventLatencyValue.Immediate */, 0 /* EventSendType.Batched */, 1 /* SendRequestReason.NormalSchedule */);\r\n _scheduleTimer();\r\n }, immediateTimeOut);\r\n }\r\n }\r\n // During initialization the _profiles enforce that the normal [0] is a multiple of the real time [1] timer value\r\n var timeOut = _profiles[_currentProfile][1];\r\n if (!_scheduledTimer && !_flushCallbackTimer && timeOut >= 0 && !_paused) {\r\n if (_hasEvents()) {\r\n _scheduledTimer = _createTimer(function () {\r\n _scheduledTimer = null;\r\n _sendEventsForLatencyAndAbove(_timerCount === 0 ? 3 /* EventLatencyValue.RealTime */ : 1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, 1 /* SendRequestReason.NormalSchedule */);\r\n // Increment the count for next cycle\r\n _timerCount++;\r\n _timerCount %= 2;\r\n _scheduleTimer();\r\n }, timeOut);\r\n }\r\n else {\r\n _timerCount = 0;\r\n }\r\n }\r\n }\r\n _self[_DYN__BACK_OFF_TRANSMISSI11 /* @min:%2e_backOffTransmission */] = function () {\r\n if (_currentBackoffCount < MaxBackoffCount) {\r\n _currentBackoffCount++;\r\n _clearScheduledTimer();\r\n _scheduleTimer();\r\n }\r\n };\r\n _self._clearBackOff = function () {\r\n if (_currentBackoffCount) {\r\n _currentBackoffCount = 0;\r\n _clearScheduledTimer();\r\n _scheduleTimer();\r\n }\r\n };\r\n function _initDefaults() {\r\n _postConfig = null;\r\n _isTeardownCalled = false;\r\n _flushCallbackQueue = [];\r\n _flushCallbackTimer = null;\r\n _paused = false;\r\n _immediateQueueSize = 0;\r\n _immediateQueueSizeLimit = 500;\r\n _queueSize = 0;\r\n _queueSizeLimit = MaxEventsLimitInMem;\r\n _profiles = {};\r\n _currentProfile = RT_PROFILE;\r\n _scheduledTimer = null;\r\n _immediateTimer = null;\r\n _currentBackoffCount = 0;\r\n _timerCount = 0;\r\n _batchQueues = {};\r\n _autoFlushEventsLimit = 0;\r\n _unloadHandlersAdded = false;\r\n // either MaxBatchSize * (1+ Max Connections) or _queueLimit / 6 (where 3 latency Queues [normal, realtime, cost deferred] * 2 [allow half full -- allow for retry])\r\n _autoFlushBatchLimit = 0;\r\n _delayedBatchSendLatency = -1;\r\n _delayedBatchReason = null;\r\n _optimizeObject = true;\r\n _isPageUnloadTriggered = false;\r\n _maxEventSendAttempts = MaxSendAttempts;\r\n _maxUnloadEventSendAttempts = MaxSyncUnloadSendAttempts;\r\n _evtNamespace = null;\r\n _overrideInstrumentationKey = null;\r\n _disableTelemetry = false;\r\n _timeoutWrapper = createTimeoutWrapper();\r\n _httpManager = new HttpManager(MaxNumberEventPerBatch, MaxConnections, MaxRequestRetriesBeforeBackoff, {\r\n requeue: _requeueEvents,\r\n send: _sendingEvent,\r\n sent: _eventsSentEvent,\r\n drop: _eventsDropped,\r\n rspFail: _eventsResponseFail,\r\n oth: _otherEvent\r\n });\r\n _initializeProfiles();\r\n _clearQueues();\r\n _setAutoLimits();\r\n }\r\n function _createTimer(theTimerFunc, timeOut) {\r\n // If the transmission is backed off make the timer at least 1 sec to allow for back off.\r\n if (timeOut === 0 && _currentBackoffCount) {\r\n timeOut = 1;\r\n }\r\n var timerMultiplier = 1000;\r\n if (_currentBackoffCount) {\r\n timerMultiplier = retryPolicyGetMillisToBackoffForRetry(_currentBackoffCount - 1);\r\n }\r\n return _timeoutWrapper.set(theTimerFunc, timeOut * timerMultiplier);\r\n }\r\n function _clearScheduledTimer() {\r\n if (_scheduledTimer !== null) {\r\n _scheduledTimer.cancel();\r\n _scheduledTimer = null;\r\n _timerCount = 0;\r\n return true;\r\n }\r\n return false;\r\n }\r\n // Try to send all queued events using beacons if available\r\n function _releaseAllQueues(sendType, sendReason) {\r\n _clearScheduledTimer();\r\n // Cancel all flush callbacks\r\n if (_flushCallbackTimer) {\r\n _flushCallbackTimer.cancel();\r\n _flushCallbackTimer = null;\r\n }\r\n if (!_paused) {\r\n // Queue all the remaining requests to be sent. The requests will be sent using HTML5 Beacons if they are available.\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, sendType, sendReason);\r\n }\r\n }\r\n /**\r\n * Add empty queues for all latencies in the inbound queues map. This is called\r\n * when Transmission Manager is being flushed. This ensures that new events added\r\n * after flush are stored separately till we flush the current events.\r\n */\r\n function _clearQueues() {\r\n _batchQueues[4 /* EventLatencyValue.Immediate */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[3 /* EventLatencyValue.RealTime */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[2 /* EventLatencyValue.CostDeferred */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n _batchQueues[1 /* EventLatencyValue.Normal */] = {\r\n batches: [],\r\n iKeyMap: {}\r\n };\r\n }\r\n function _getEventBatch(iKey, latency, create) {\r\n var batchQueue = _batchQueues[latency];\r\n if (!batchQueue) {\r\n latency = 1 /* EventLatencyValue.Normal */;\r\n batchQueue = _batchQueues[latency];\r\n }\r\n var eventBatch = batchQueue.iKeyMap[iKey];\r\n if (!eventBatch && create) {\r\n eventBatch = EventBatch.create(iKey);\r\n batchQueue.batches[_DYN_PUSH /* @min:%2epush */](eventBatch);\r\n batchQueue.iKeyMap[iKey] = eventBatch;\r\n }\r\n return eventBatch;\r\n }\r\n function _performAutoFlush(isAsync, doFlush) {\r\n // Only perform the auto flush check if the httpManager has an idle connection and we are not in a backoff situation\r\n if (_httpManager[_DYN_CAN_SEND_REQUEST /* @min:%2ecanSendRequest */]() && !_currentBackoffCount) {\r\n if (_autoFlushEventsLimit > 0 && _queueSize > _autoFlushEventsLimit) {\r\n // Force flushing\r\n doFlush = true;\r\n }\r\n if (doFlush && _flushCallbackTimer == null) {\r\n // Auto flush the queue, adding a callback to avoid the creation of a promise\r\n _self.flush(isAsync, function () { }, 20 /* SendRequestReason.MaxQueuedEvents */);\r\n }\r\n }\r\n }\r\n function _addEventToProperQueue(event, append) {\r\n // v8 performance optimization for iterating over the keys\r\n if (_optimizeObject) {\r\n event = optimizeObject(event);\r\n }\r\n var latency = event[_DYN_LATENCY /* @min:%2elatency */];\r\n var eventBatch = _getEventBatch(event[_DYN_I_KEY /* @min:%2eiKey */], latency, true);\r\n if (eventBatch.addEvent(event)) {\r\n if (latency !== 4 /* EventLatencyValue.Immediate */) {\r\n _queueSize++;\r\n // Check for auto flushing based on total events in the queue, but not for requeued or retry events\r\n if (append && event[_DYN_SEND_ATTEMPT /* @min:%2esendAttempt */] === 0) {\r\n // Force the flushing of the batch if the batch (specific iKey / latency combination) reaches it's auto flush limit\r\n _performAutoFlush(!event.sync, _autoFlushBatchLimit > 0 && eventBatch[_DYN_COUNT /* @min:%2ecount */]() >= _autoFlushBatchLimit);\r\n }\r\n }\r\n else {\r\n // Direct events don't need auto flushing as they are scheduled (by default) for immediate delivery\r\n _immediateQueueSize++;\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n function _dropEventWithLatencyOrLess(iKey, latency, currentLatency, dropNumber) {\r\n while (currentLatency <= latency) {\r\n var eventBatch = _getEventBatch(iKey, latency, true);\r\n if (eventBatch && eventBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {\r\n // Dropped oldest events from lowest possible latency\r\n var droppedEvents = eventBatch[_DYN_SPLIT /* @min:%2esplit */](0, dropNumber);\r\n var droppedCount = droppedEvents[_DYN_COUNT /* @min:%2ecount */]();\r\n if (droppedCount > 0) {\r\n if (currentLatency === 4 /* EventLatencyValue.Immediate */) {\r\n _immediateQueueSize -= droppedCount;\r\n }\r\n else {\r\n _queueSize -= droppedCount;\r\n }\r\n _notifyBatchEvents(strEventsDiscarded, [droppedEvents], EventsDiscardedReason.QueueFull);\r\n return true;\r\n }\r\n }\r\n currentLatency++;\r\n }\r\n // Unable to drop any events -- lets just make sure the queue counts are correct to avoid exhaustion\r\n _resetQueueCounts();\r\n return false;\r\n }\r\n /**\r\n * Internal helper to reset the queue counts, used as a backstop to avoid future queue exhaustion errors\r\n * that might occur because of counting issues.\r\n */\r\n function _resetQueueCounts() {\r\n var immediateQueue = 0;\r\n var normalQueue = 0;\r\n var _loop_1 = function (latency) {\r\n var batchQueue = _batchQueues[latency];\r\n if (batchQueue && batchQueue[_DYN_BATCHES /* @min:%2ebatches */]) {\r\n arrForEach(batchQueue[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {\r\n if (latency === 4 /* EventLatencyValue.Immediate */) {\r\n immediateQueue += theBatch[_DYN_COUNT /* @min:%2ecount */]();\r\n }\r\n else {\r\n normalQueue += theBatch[_DYN_COUNT /* @min:%2ecount */]();\r\n }\r\n });\r\n }\r\n };\r\n for (var latency = 1 /* EventLatencyValue.Normal */; latency <= 4 /* EventLatencyValue.Immediate */; latency++) {\r\n _loop_1(latency);\r\n }\r\n _queueSize = normalQueue;\r\n _immediateQueueSize = immediateQueue;\r\n }\r\n function _queueBatches(latency, sendType, sendReason) {\r\n var eventsQueued = false;\r\n var isAsync = sendType === 0 /* EventSendType.Batched */;\r\n // Only queue batches (to the HttpManager) if this is a sync request or the httpManager has an idle connection\r\n // Thus keeping the events within the PostChannel until the HttpManager has a connection available\r\n // This is so we can drop \"old\" events if the queue is getting full because we can't successfully send events\r\n if (!isAsync || _httpManager[_DYN_CAN_SEND_REQUEST /* @min:%2ecanSendRequest */]()) {\r\n doPerf(_self.core, function () { return \"PostChannel._queueBatches\"; }, function () {\r\n var droppedEvents = [];\r\n var latencyToProcess = 4 /* EventLatencyValue.Immediate */;\r\n while (latencyToProcess >= latency) {\r\n var batchQueue = _batchQueues[latencyToProcess];\r\n if (batchQueue && batchQueue.batches && batchQueue.batches[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(batchQueue[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {\r\n // Add the batch to the http manager to send the requests\r\n if (!_httpManager.addBatch(theBatch)) {\r\n // The events from this iKey are being dropped (killed)\r\n droppedEvents = droppedEvents[_DYN_CONCAT /* @min:%2econcat */](theBatch[_DYN_EVENTS /* @min:%2eevents */]());\r\n }\r\n else {\r\n eventsQueued = eventsQueued || (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0);\r\n }\r\n if (latencyToProcess === 4 /* EventLatencyValue.Immediate */) {\r\n _immediateQueueSize -= theBatch[_DYN_COUNT /* @min:%2ecount */]();\r\n }\r\n else {\r\n _queueSize -= theBatch[_DYN_COUNT /* @min:%2ecount */]();\r\n }\r\n });\r\n // Remove all batches from this Queue\r\n batchQueue[_DYN_BATCHES /* @min:%2ebatches */] = [];\r\n batchQueue.iKeyMap = {};\r\n }\r\n latencyToProcess--;\r\n }\r\n if (droppedEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _notifyEvents(strEventsDiscarded, droppedEvents, EventsDiscardedReason.KillSwitch);\r\n }\r\n if (eventsQueued && _delayedBatchSendLatency >= latency) {\r\n // We have queued events at the same level as the delayed values so clear the setting\r\n _delayedBatchSendLatency = -1;\r\n _delayedBatchReason = 0 /* SendRequestReason.Undefined */;\r\n }\r\n }, function () { return ({ latency: latency, sendType: sendType, sendReason: sendReason }); }, !isAsync);\r\n }\r\n else {\r\n // remember the min latency so that we can re-trigger later\r\n _delayedBatchSendLatency = _delayedBatchSendLatency >= 0 ? Math.min(_delayedBatchSendLatency, latency) : latency;\r\n _delayedBatchReason = Math.max(_delayedBatchReason, sendReason);\r\n }\r\n return eventsQueued;\r\n }\r\n /**\r\n * This is the callback method is called as part of the manual flushing process.\r\n * @param callback\r\n * @param sendReason\r\n */\r\n function _flushImpl(callback, sendReason) {\r\n // Add any additional queued events and cause all queued events to be sent asynchronously\r\n _sendEventsForLatencyAndAbove(1 /* EventLatencyValue.Normal */, 0 /* EventSendType.Batched */, sendReason);\r\n // All events (should) have been queue -- lets just make sure the queue counts are correct to avoid queue exhaustion (previous bug #9685112)\r\n _resetQueueCounts();\r\n _waitForIdleManager(function () {\r\n // Only called AFTER the httpManager does not have any outstanding requests\r\n if (callback) {\r\n callback();\r\n }\r\n if (_flushCallbackQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _flushCallbackTimer = _createTimer(function () {\r\n _flushCallbackTimer = null;\r\n _flushImpl(_flushCallbackQueue.shift(), sendReason);\r\n }, 0);\r\n }\r\n else {\r\n // No more flush requests\r\n _flushCallbackTimer = null;\r\n // Restart the normal timer schedule\r\n _scheduleTimer();\r\n }\r\n });\r\n }\r\n function _waitForIdleManager(callback) {\r\n if (_httpManager[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */]()) {\r\n callback();\r\n }\r\n else {\r\n _flushCallbackTimer = _createTimer(function () {\r\n _flushCallbackTimer = null;\r\n _waitForIdleManager(callback);\r\n }, FlushCheckTimer);\r\n }\r\n }\r\n /**\r\n * Resets the transmit profiles to the default profiles of Real Time, Near Real Time\r\n * and Best Effort. This removes all the custom profiles that were loaded.\r\n */\r\n function _resetTransmitProfiles() {\r\n _clearScheduledTimer();\r\n _initializeProfiles();\r\n _currentProfile = RT_PROFILE;\r\n _scheduleTimer();\r\n }\r\n function _initializeProfiles() {\r\n _profiles = {};\r\n _profiles[RT_PROFILE] = [2, 1, 0];\r\n _profiles[NRT_PROFILE] = [6, 3, 0];\r\n _profiles[BE_PROFILE] = [18, 9, 0];\r\n }\r\n /**\r\n * The notification handler for requeue events\r\n * @ignore\r\n */\r\n function _requeueEvents(batches, reason) {\r\n var droppedEvents = [];\r\n var maxSendAttempts = _maxEventSendAttempts;\r\n if (_isPageUnloadTriggered) {\r\n // If a page unlaod has been triggered reduce the number of times we try to \"retry\"\r\n maxSendAttempts = _maxUnloadEventSendAttempts;\r\n }\r\n arrForEach(batches, function (theBatch) {\r\n if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {\r\n arrForEach(theBatch[_DYN_EVENTS /* @min:%2eevents */](), function (theEvent) {\r\n if (theEvent) {\r\n // Check if the request being added back is for a sync event in which case mark it no longer a sync event\r\n if (theEvent[_DYN_SYNC /* @min:%2esync */]) {\r\n theEvent[_DYN_LATENCY /* @min:%2elatency */] = 4 /* EventLatencyValue.Immediate */;\r\n theEvent[_DYN_SYNC /* @min:%2esync */] = false;\r\n }\r\n if (theEvent[_DYN_SEND_ATTEMPT /* @min:%2esendAttempt */] < maxSendAttempts) {\r\n // Reset the event timings\r\n setProcessTelemetryTimings(theEvent, _self[_DYN_IDENTIFIER /* @min:%2eidentifier */]);\r\n _addEventToQueues(theEvent, false);\r\n }\r\n else {\r\n droppedEvents[_DYN_PUSH /* @min:%2epush */](theEvent);\r\n }\r\n }\r\n });\r\n }\r\n });\r\n if (droppedEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _notifyEvents(strEventsDiscarded, droppedEvents, EventsDiscardedReason.NonRetryableStatus);\r\n }\r\n if (_isPageUnloadTriggered) {\r\n // Unload event has been received so we need to try and flush new events\r\n _releaseAllQueues(2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);\r\n }\r\n }\r\n function _callNotification(evtName, theArgs) {\r\n var manager = (_notificationManager || {});\r\n var notifyFunc = manager[evtName];\r\n if (notifyFunc) {\r\n try {\r\n notifyFunc.apply(manager, theArgs);\r\n }\r\n catch (e) {\r\n _throwInternal(_self.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 74 /* _eInternalMessageId.NotificationException */, evtName + \" notification failed: \" + e);\r\n }\r\n }\r\n }\r\n function _notifyEvents(evtName, theEvents) {\r\n var extraArgs = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n extraArgs[_i - 2] = arguments[_i];\r\n }\r\n if (theEvents && theEvents[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _callNotification(evtName, [theEvents][_DYN_CONCAT /* @min:%2econcat */](extraArgs));\r\n }\r\n }\r\n function _notifyBatchEvents(evtName, batches) {\r\n var extraArgs = [];\r\n for (var _i = 2; _i < arguments.length; _i++) {\r\n extraArgs[_i - 2] = arguments[_i];\r\n }\r\n if (batches && batches[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n arrForEach(batches, function (theBatch) {\r\n if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {\r\n _callNotification(evtName, [theBatch.events()][_DYN_CONCAT /* @min:%2econcat */](extraArgs));\r\n }\r\n });\r\n }\r\n }\r\n /**\r\n * The notification handler for when batches are about to be sent\r\n * @ignore\r\n */\r\n function _sendingEvent(batches, reason, isSyncRequest) {\r\n if (batches && batches[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _callNotification(\"eventsSendRequest\", [(reason >= 1000 /* EventBatchNotificationReason.SendingUndefined */ && reason <= 1999 /* EventBatchNotificationReason.SendingEventMax */ ?\r\n reason - 1000 /* EventBatchNotificationReason.SendingUndefined */ :\r\n 0 /* SendRequestReason.Undefined */), isSyncRequest !== true]);\r\n }\r\n }\r\n /**\r\n * This event represents that a batch of events have been successfully sent and a response received\r\n * @param batches The notification handler for when the batches have been successfully sent\r\n * @param reason For this event the reason will always be EventBatchNotificationReason.Complete\r\n */\r\n function _eventsSentEvent(batches, reason) {\r\n _notifyBatchEvents(\"eventsSent\", batches, reason);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _eventsDropped(batches, reason) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, (reason >= 8000 /* EventBatchNotificationReason.EventsDropped */ && reason <= 8999 /* EventBatchNotificationReason.EventsDroppedMax */ ?\r\n reason - 8000 /* EventBatchNotificationReason.EventsDropped */ :\r\n EventsDiscardedReason.Unknown));\r\n }\r\n function _eventsResponseFail(batches) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, EventsDiscardedReason.NonRetryableStatus);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _otherEvent(batches, reason) {\r\n _notifyBatchEvents(strEventsDiscarded, batches, EventsDiscardedReason.Unknown);\r\n // Try and schedule the processing timer if we have events\r\n _scheduleTimer();\r\n }\r\n function _setAutoLimits() {\r\n if (!_disableAutoBatchFlushLimit) {\r\n _autoFlushBatchLimit = Math.max(MaxNumberEventPerBatch * (MaxConnections + 1), _queueSizeLimit / 6);\r\n }\r\n else {\r\n _autoFlushBatchLimit = 0;\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n// Removed Stub for PostChannel.prototype.initialize.\r\n// Removed Stub for PostChannel.prototype.processTelemetry.\r\n// Removed Stub for PostChannel.prototype.setEventQueueLimits.\r\n// Removed Stub for PostChannel.prototype.pause.\r\n// Removed Stub for PostChannel.prototype.resume.\r\n// Removed Stub for PostChannel.prototype.addResponseHandler.\r\n// Removed Stub for PostChannel.prototype.flush.\r\n// Removed Stub for PostChannel.prototype.setMsaAuthTicket.\r\n// Removed Stub for PostChannel.prototype.hasEvents.\r\n// Removed Stub for PostChannel.prototype._loadTransmitProfiles.\r\n// Removed Stub for PostChannel.prototype._setTransmitProfile.\r\n// Removed Stub for PostChannel.prototype._backOffTransmission.\r\n// Removed Stub for PostChannel.prototype._clearBackOff.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n PostChannel.__ieDyn=1;\n\n return PostChannel;\r\n}(BaseTelemetryPlugin));\r\nexport { PostChannel };\r\n//# sourceMappingURL=PostChannel.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n\r\n// Licensed under the MIT License.\r\nimport { strShimPrototype } from \"@microsoft/applicationinsights-shims\";\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)\r\n// as when using \"short\" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.\r\nexport var STR_DEVICE = \"device\";\r\nexport var STR_LOCALE = \"locale\";\r\nexport var STR_VER = \"ver\";\r\nexport var STR_BROWSER = \"browser\";\r\nexport var STR_BROWSER_VER = \"browserVer\";\r\nexport var STR_POP_SAMPLE = \"popSample\";\r\nexport var STR_EVENT_FLAGS = \"eventFlags\";\r\nexport var STR_NAME = \"name\";\r\nexport var STR_SERVICE_NAME = \"serviceName\";\r\nexport var STR_LENGTH = \"length\";\r\nexport var STR_SESSION_EXPIRATION_MS = \"sessionExpirationMs\";\r\nexport var STR_SESSION_RENEWAL_MS = \"sessionRenewalMs\";\r\nexport var STR_USER_AGENT = \"userAgent\";\r\nexport var STR_USER_AGENT_DATA = \"userAgentData\";\r\nexport var STR_NAME_PREFIX = \"namePrefix\";\r\nexport var STR_PROTOTYPE = strShimPrototype;\r\n//# sourceMappingURL=InternalConstants.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Utils.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n* File containing utility functions.\r\n*/\r\nimport { getGlobal, isFunction, _throwInternal } from \"@microsoft/1ds-core-js\";\r\nvar _canUseLocalStorage;\r\n/**\r\n * Check if the browser supports local storage.\r\n *\r\n * @returns {boolean} True if local storage is supported.\r\n */\r\nexport function canUseLocalStorage() {\r\n if (_canUseLocalStorage === undefined) {\r\n _canUseLocalStorage = !!_getVerifiedStorageObject(0 /* StorageType.LocalStorage */);\r\n }\r\n return _canUseLocalStorage;\r\n}\r\n/**\r\n* Gets the localStorage object if available\r\n* @returns Returns the storage object if available else returns null\r\n*/\r\nfunction _getLocalStorageObject() {\r\n if (canUseLocalStorage()) {\r\n return _getVerifiedStorageObject(0 /* StorageType.LocalStorage */);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Tests storage object (localStorage or sessionStorage) to verify that it is usable\r\n * More details here: https://mathiasbynens.be/notes/localstorage-pattern\r\n * @param storageType - Type of storage\r\n * @returns Returns storage object verified that it is usable\r\n */\r\nfunction _getVerifiedStorageObject(storageType) {\r\n var storage = null;\r\n var fail;\r\n var uid;\r\n try {\r\n var global_1 = getGlobal();\r\n if (!global_1) {\r\n return null;\r\n }\r\n uid = new Date();\r\n storage = storageType === 0 /* StorageType.LocalStorage */ ? global_1.localStorage : global_1.sessionStorage;\r\n if (storage && isFunction(storage.setItem)) {\r\n storage.setItem(uid, uid);\r\n fail = storage.getItem(uid) !== uid;\r\n storage.removeItem(uid);\r\n if (fail) {\r\n storage = null;\r\n }\r\n }\r\n }\r\n catch (exception) {\r\n storage = null;\r\n }\r\n return storage;\r\n}\r\n/**\r\n * Set the contents of an object in the browser's local storage\r\n *\r\n * @param name - the name of the object to set in storage\r\n * @param data - the contents of the object to set in storage\r\n * @returns True if the storage object could be written.\r\n */\r\nexport function setStorage(logger, name, data) {\r\n var storage = _getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.setItem(name, data);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseLocalStorage = false;\r\n _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 504 /* _eExtendedInternalMessageId.BrowserCannotWriteLocalStorage */, \"Browser failed write to local storage. \" + e);\r\n }\r\n }\r\n return false;\r\n}\r\n/**\r\n * Get an object from the browser's local storage\r\n *\r\n * @param name - the name of the object to get from storage\r\n * @returns The contents of the storage object with the given name. Null if storage is not supported.\r\n */\r\nexport function getStorage(logger, name) {\r\n var storage = _getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n return storage.getItem(name);\r\n }\r\n catch (e) {\r\n _canUseLocalStorage = false;\r\n _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 503 /* _eExtendedInternalMessageId.BrowserCannotReadLocalStorage */, \"Browser failed read of local storage. \" + e);\r\n }\r\n }\r\n return null;\r\n}\r\n//# sourceMappingURL=Utils.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* TelemetryContext.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\n// @skip-file-minify - Skip attempting to minify this file\r\nimport { createValueMap } from \"@microsoft/applicationinsights-core-js\";\r\nimport { STR_BROWSER, STR_BROWSER_VER, STR_DEVICE, STR_EVENT_FLAGS, STR_LOCALE, STR_NAME, STR_POP_SAMPLE, STR_SERVICE_NAME, STR_VER } from \"./InternalConstants\";\r\nexport var Extensions = createValueMap({\r\n UserExt: [0 /* eExtensions.UserExt */, \"user\"],\r\n DeviceExt: [1 /* eExtensions.DeviceExt */, STR_DEVICE],\r\n TraceExt: [2 /* eExtensions.TraceExt */, \"trace\"],\r\n WebExt: [3 /* eExtensions.WebExt */, \"web\"],\r\n AppExt: [4 /* eExtensions.AppExt */, \"app\"],\r\n OSExt: [5 /* eExtensions.OSExt */, \"os\"],\r\n SdkExt: [6 /* eExtensions.SdkExt */, \"sdk\"],\r\n IntWebExt: [7 /* eExtensions.IntWebExt */, \"intweb\"],\r\n UtcExt: [8 /* eExtensions.UtcExt */, \"utc\"],\r\n LocExt: [9 /* eExtensions.LocExt */, \"loc\"],\r\n CloudExt: [10 /* eExtensions.CloudExt */, \"cloud\"],\r\n DtExt: [11 /* eExtensions.DtExt */, \"dt\"]\r\n});\r\nexport var AppExtensionKeys = createValueMap({\r\n id: [0 /* eAppExtensionKeys.id */, \"id\"],\r\n ver: [1 /* eAppExtensionKeys.ver */, STR_VER],\r\n appName: [2 /* eAppExtensionKeys.appName */, STR_NAME],\r\n locale: [3 /* eAppExtensionKeys.locale */, STR_LOCALE],\r\n expId: [4 /* eAppExtensionKeys.expId */, \"expId\"],\r\n env: [5 /* eAppExtensionKeys.env */, \"env\"]\r\n});\r\nexport var WebExtensionKeys = createValueMap({\r\n domain: [0 /* eWebExtensionKeys.domain */, \"domain\"],\r\n browser: [1 /* eWebExtensionKeys.browser */, STR_BROWSER],\r\n browserVer: [2 /* eWebExtensionKeys.browserVer */, STR_BROWSER_VER],\r\n screenRes: [3 /* eWebExtensionKeys.screenRes */, \"screenRes\"],\r\n userConsent: [4 /* eWebExtensionKeys.userConsent */, \"userConsent\"],\r\n consentDetails: [5 /* eWebExtensionKeys.consentDetails */, \"consentDetails\"]\r\n});\r\nexport var UserExtensionKeys = createValueMap({\r\n locale: [0 /* eUserExtensionKeys.locale */, STR_LOCALE],\r\n localId: [1 /* eUserExtensionKeys.localId */, \"localId\"],\r\n id: [2 /* eUserExtensionKeys.id */, \"id\"]\r\n});\r\nexport var OSExtKeys = createValueMap({\r\n osName: [0 /* eOSExtKeys.osName */, STR_NAME],\r\n ver: [1 /* eOSExtKeys.ver */, STR_VER]\r\n});\r\nexport var SDKExtKeys = createValueMap({\r\n ver: [0 /* eSDKExtKeys.ver */, STR_VER],\r\n seq: [1 /* eSDKExtKeys.seq */, \"seq\"],\r\n installId: [2 /* eSDKExtKeys.installId */, \"installId\"],\r\n epoch: [3 /* eSDKExtKeys.epoch */, \"epoch\"]\r\n});\r\nexport var IntWebExtKeys = createValueMap({\r\n msfpc: [0 /* eIntWebExtKeys.msfpc */, \"msfpc\"],\r\n anid: [1 /* eIntWebExtKeys.anid */, \"anid\"],\r\n serviceName: [2 /* eIntWebExtKeys.serviceName */, STR_SERVICE_NAME]\r\n});\r\nexport var UtcExtKeys = createValueMap({\r\n popSample: [0 /* eUtcExtKeys.popSample */, STR_POP_SAMPLE],\r\n eventFlags: [1 /* eUtcExtKeys.eventFlags */, STR_EVENT_FLAGS]\r\n});\r\nexport var LocExtKeys = createValueMap({\r\n tz: [0 /* eLocExtKeys.tz */, \"tz\"]\r\n});\r\nexport var SessionExtKeys = createValueMap({\r\n sessionId: [0 /* eSessionExtKeys.sessionId */, \"sesId\"]\r\n});\r\nexport var DeviceExtKeys = createValueMap({\r\n localId: [0 /* eDeviceExtKeys.localId */, \"localId\"],\r\n deviceClass: [1 /* eDeviceExtKeys.deviceClass */, \"deviceClass\"],\r\n make: [2 /* eDeviceExtKeys.make */, \"make\"],\r\n model: [3 /* eDeviceExtKeys.model */, \"model\"]\r\n});\r\nexport var CloudExtKeys = createValueMap({\r\n role: [0 /* eCloudExtKeys.role */, \"role\"],\r\n roleInstance: [1 /* eCloudExtKeys.roleInstance */, \"roleInstance\"],\r\n roleVer: [2 /* eCloudExtKeys.roleVer */, \"roleVer\"]\r\n});\r\nexport var TraceExtKeys = createValueMap({\r\n traceId: [0 /* eTraceExtKeys.traceId */, \"traceID\"],\r\n traceName: [1 /* eTraceExtKeys.traceName */, STR_NAME],\r\n parentId: [2 /* eTraceExtKeys.parentId */, \"parentID\"]\r\n});\r\nexport var DistributedTraceExtKeys = createValueMap({\r\n traceId: [0 /* eDistributedTraceExtKeys.traceId */, \"traceId\"],\r\n spanId: [1 /* eDistributedTraceExtKeys.spanId */, \"spanId\"],\r\n traceFlags: [2 /* eDistributedTraceExtKeys.traceFlags */, \"traceFlags\"]\r\n});\r\n//# sourceMappingURL=ExtensionKeys.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Session.ts\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isString } from \"@microsoft/1ds-core-js\";\r\nimport { objDefine } from \"@nevware21/ts-utils\";\r\nfunction _getId() {\r\n return this.getId();\r\n}\r\nfunction _setId(id) {\r\n this.setId(id);\r\n}\r\nvar Session = /** @class */ (function () {\r\n function Session() {\r\n dynamicProto(Session, this, function (_self) {\r\n _self.setId = function (id) {\r\n _self.customId = id;\r\n };\r\n _self.getId = function () {\r\n if (isString(_self.customId)) {\r\n return _self.customId;\r\n }\r\n else {\r\n return _self.automaticId;\r\n }\r\n };\r\n });\r\n }\r\n// Removed Stub for Session.prototype.setId.\r\n// Removed Stub for Session.prototype.getId.\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n Session._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n objDefine(Session.prototype, \"id\", { g: _getId, s: _setId }); // change this\r\n })();\r\n return Session;\r\n}());\r\nexport { Session };\r\n//# sourceMappingURL=Session.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* SessionManager.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _throwInternal, createGuid, isBoolean, isFunction, isUndefined, newId, onConfigChange, safeGetCookieMgr, safeGetLogger } from \"@microsoft/1ds-core-js\";\r\nimport { canUseLocalStorage, getStorage, setStorage } from \"./Utils\";\r\nimport { Session } from \"./context/Session\";\r\nvar cookieNameConst = \"ai_session\";\r\nvar SessionManager = /** @class */ (function () {\r\n function SessionManager(core, propConfig, unloadHookContainer) {\r\n var _cookieUpdatedTimestamp;\r\n var _logger = safeGetLogger(core);\r\n var cookieMgr = safeGetCookieMgr(core);\r\n var _storageNamePrefix;\r\n var _config;\r\n dynamicProto(SessionManager, this, function (_self) {\r\n var unloadHook = onConfigChange(propConfig, function () {\r\n _config = propConfig;\r\n _self.config = _config;\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n _storageNamePrefix = function () { return _self.config.namePrefix ? cookieNameConst + _self.config.namePrefix : cookieNameConst; };\r\n _self.automaticSession = new Session();\r\n _self.update = function () {\r\n if (!_self.automaticSession.getId()) {\r\n _initializeAutomaticSession();\r\n }\r\n var autoSession = _self.automaticSession;\r\n var config = _self.config;\r\n var now = new Date().getTime();\r\n var acquisitionExpired = now - autoSession.acquisitionDate > config.sessionExpirationMs;\r\n var renewalExpired = now - autoSession.renewalDate > config.sessionRenewalMs;\r\n // renew if acquisitionSpan or renewalSpan has ellapsed\r\n if (acquisitionExpired || renewalExpired) {\r\n // update automaticSession so session state has correct id\r\n _renew();\r\n }\r\n else {\r\n // do not update the cookie more often than cookieUpdateInterval\r\n var cookieUpdatedTimestamp = _cookieUpdatedTimestamp;\r\n if (!cookieUpdatedTimestamp || now - cookieUpdatedTimestamp > SessionManager.cookieUpdateInterval) {\r\n autoSession.renewalDate = now;\r\n _setCookie(autoSession.getId(), autoSession.acquisitionDate, autoSession.renewalDate);\r\n }\r\n }\r\n };\r\n _self.backup = function () {\r\n var automaticSession = _self.automaticSession;\r\n _setStorage(automaticSession.getId(), automaticSession.acquisitionDate, automaticSession.renewalDate);\r\n };\r\n /**\r\n * @ignore\r\n * Use config.namePrefix + ai_session cookie data or local storage data (when the cookie is unavailable) to\r\n * initialize the automatic session.\r\n */\r\n function _initializeAutomaticSession() {\r\n var cookie = cookieMgr.get(_storageNamePrefix());\r\n if (cookie && isFunction(cookie.split)) {\r\n _initializeAutomaticSessionWithData(cookie);\r\n }\r\n else {\r\n // There's no cookie, but we might have session data in local storage\r\n // This can happen if the session expired or the user actively deleted the cookie\r\n // We only want to recover data if the cookie is missing from expiry. We should respect the user's wishes if the cookie was deleted actively.\r\n // The User class handles this for us and deletes our local storage object if the persistent user cookie was removed.\r\n var storage = getStorage(_logger, _storageNamePrefix());\r\n if (storage) {\r\n _initializeAutomaticSessionWithData(storage);\r\n }\r\n }\r\n if (!_self.automaticSession.getId()) {\r\n _renew();\r\n }\r\n }\r\n /**\r\n * @ignore\r\n * Extract id, aquisitionDate, and renewalDate from an ai_session payload string and\r\n * use this data to initialize automaticSession.\r\n *\r\n * @param sessionData - The string stored in an ai_session cookie or local storage backup\r\n */\r\n function _initializeAutomaticSessionWithData(sessionData) {\r\n var automaticSession = _self.automaticSession;\r\n var params = sessionData.split(\"|\");\r\n if (params.length > 0) {\r\n automaticSession.setId(params[0]);\r\n }\r\n try {\r\n if (params.length > 1) {\r\n var acq = +params[1];\r\n automaticSession.acquisitionDate = +new Date(acq);\r\n automaticSession.acquisitionDate = automaticSession.acquisitionDate > 0 ? automaticSession.acquisitionDate : 0;\r\n }\r\n if (params.length > 2) {\r\n var renewal = +params[2];\r\n automaticSession.renewalDate = +new Date(renewal);\r\n automaticSession.renewalDate = automaticSession.renewalDate > 0 ? automaticSession.renewalDate : 0;\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 510 /* _eExtendedInternalMessageId.ErrorParsingAISessionCookie */, \"Error parsing ai_session cookie, session will be reset: \" + e);\r\n }\r\n if (automaticSession.renewalDate === 0) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 517 /* _eExtendedInternalMessageId.SessionRenewalDateIsZero */, \"AI session renewal date is 0, session will be reset.\");\r\n }\r\n }\r\n function _renew() {\r\n var automaticSession = _self.automaticSession;\r\n var now = new Date().getTime();\r\n var sessionAsGuid = _self.config.sessionAsGuid;\r\n if (!isUndefined(sessionAsGuid) && sessionAsGuid) {\r\n if (!isBoolean(sessionAsGuid)) {\r\n automaticSession.setId(createGuid(sessionAsGuid));\r\n }\r\n else {\r\n automaticSession.setId(createGuid());\r\n }\r\n }\r\n else {\r\n automaticSession.setId(newId(_config.idLength || 22));\r\n }\r\n automaticSession.acquisitionDate = now;\r\n automaticSession.renewalDate = now;\r\n _setCookie(automaticSession.getId(), automaticSession.acquisitionDate, automaticSession.renewalDate);\r\n // If this browser does not support local storage, fire an internal log to keep track of it at this point\r\n if (!canUseLocalStorage()) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 505 /* _eExtendedInternalMessageId.BrowserDoesNotSupportLocalStorage */, \"Browser does not support local storage. Session durations will be inaccurate.\");\r\n }\r\n }\r\n function _setCookie(guid, acq, renewal) {\r\n // Set cookie to expire after the session expiry time passes or the session renewal deadline, whichever is sooner\r\n // Expiring the cookie will cause the session to expire even if the user isn't on the page\r\n var acquisitionExpiry = acq + _self.config.sessionExpirationMs;\r\n var renewalExpiry = renewal + _self.config.sessionRenewalMs;\r\n var cookieExpiry = new Date();\r\n var cookie = [guid, acq, renewal];\r\n if (acquisitionExpiry < renewalExpiry) {\r\n cookieExpiry.setTime(acquisitionExpiry);\r\n }\r\n else {\r\n cookieExpiry.setTime(renewalExpiry);\r\n }\r\n var cookieDomain = _self.config.cookieDomain || null;\r\n cookieMgr.set(_storageNamePrefix(), cookie.join(\"|\") + \";expires=\" + cookieExpiry.toUTCString(), null, cookieDomain);\r\n _cookieUpdatedTimestamp = new Date().getTime();\r\n }\r\n function _setStorage(guid, acq, renewal) {\r\n // Keep data in local storage to retain the last session id, allowing us to cleanly end the session when it expires\r\n // Browsers that don't support local storage won't be able to end sessions cleanly from the client\r\n // The server will notice this and end the sessions itself, with loss of accurate session duration\r\n setStorage(_logger, _storageNamePrefix(), [guid, acq, renewal].join(\"|\"));\r\n }\r\n });\r\n }\r\n// Removed Stub for SessionManager.prototype.update.\r\n// Removed Stub for SessionManager.prototype.backup.\r\n SessionManager.cookieUpdateInterval = 60000; // 1 minute in ms\r\n return SessionManager;\r\n}());\r\nexport { SessionManager };\r\n//# sourceMappingURL=SessionManager.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Application.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, getDocument, hasDocument, onConfigChange } from \"@microsoft/1ds-core-js\";\r\nimport { objDefine } from \"@nevware21/ts-utils\";\r\nexport var defaultFlightIdNameSpaces = [\r\n \"AX\",\r\n \"EX\",\r\n \"SF\",\r\n \"CS\",\r\n \"CF\",\r\n \"CT\",\r\n \"CU\",\r\n \"DC\",\r\n \"DF\",\r\n \"H5\",\r\n \"HL\",\r\n \"WS\",\r\n \"WP\" // WINDOWSPHONE\r\n];\r\n/// Validate each flight id in appExpId against the app flight ID\r\n/// format and create a comma seperated appExpId with valid flight ids.Ignore invalid flight IDs< /summary>\r\n/// A list of comma seperated appExpId\r\n/// none\r\nfunction _validateAppExpId(appExpIdNew, flightIdNameSpaces) {\r\n if (flightIdNameSpaces === void 0) { flightIdNameSpaces = defaultFlightIdNameSpaces; }\r\n var appExpId = null;\r\n if (appExpIdNew) {\r\n var expIdArray = appExpIdNew.split(\",\");\r\n for (var i = 0; i < expIdArray.length; i++) {\r\n if (_isValidAppFlightId(expIdArray[i], flightIdNameSpaces)) {\r\n if (!appExpId) {\r\n appExpId = expIdArray[i];\r\n }\r\n else {\r\n appExpId += \",\" + expIdArray[i];\r\n }\r\n }\r\n else {\r\n // this._traceLogger.w('Unsupported flight id format for this app expId: ' + expIdArray[i]);\r\n }\r\n }\r\n }\r\n return appExpId;\r\n}\r\n/// Verify an expId against the CS2.1 spec\r\n/// expId to verify in string format\r\n/// true if expId is valid, false otherwise\r\nfunction _isValidAppFlightId(appFlightId, flightIdNameSpaces) {\r\n if (flightIdNameSpaces === void 0) { flightIdNameSpaces = defaultFlightIdNameSpaces; }\r\n if (!appFlightId || appFlightId.length < 4) {\r\n return false;\r\n }\r\n var isValid = false;\r\n var MAXFLIGHTIDLENGTH = 256;\r\n var curNameSpace = (appFlightId.substring(0, 3)).toString().toUpperCase();\r\n // The prefix check must include ':', else strings starting with prefixes will slip through\r\n for (var i = 0; i < flightIdNameSpaces.length; i++) {\r\n if (flightIdNameSpaces[i] + \":\" === curNameSpace && appFlightId.length <= MAXFLIGHTIDLENGTH) {\r\n isValid = true;\r\n break;\r\n }\r\n }\r\n return isValid;\r\n}\r\nfunction _getExpId() {\r\n return this.getExpId();\r\n}\r\nvar Application = /** @class */ (function () {\r\n function Application(propertiesConfig, core, unloadHookContainer) {\r\n var _appExpId = null;\r\n // Create a copy of the defaultNamespaces\r\n var flightIdNameSpaces = defaultFlightIdNameSpaces.slice(0);\r\n var expIdCookieName = \"Treatments\";\r\n var _cookieMgr;\r\n var _propertiesConfig = null;\r\n dynamicProto(Application, this, function (_self) {\r\n _populateDefaults(propertiesConfig);\r\n // Add app language\r\n if (hasDocument()) {\r\n var documentElement = getDocument().documentElement;\r\n if (documentElement) {\r\n _self.locale = documentElement.lang;\r\n }\r\n }\r\n _self.getExpId = function () {\r\n return _propertiesConfig.expId ? _readExpIdFromCoreData(_propertiesConfig.expId) : _readExpIdFromCookie();\r\n };\r\n /**\r\n * Retrieve a specified metadata tag value from the DOM.\r\n * @param prefix - Prefix to search the metatags with.\r\n * @returns Metadata collection/property bag\r\n */\r\n function _getMetaDataFromDOM(prefix) {\r\n var metaElements;\r\n var metaData = {};\r\n var doc = getDocument();\r\n if (doc) {\r\n metaElements = doc && doc.querySelectorAll(\"meta\");\r\n for (var i = 0; i < metaElements.length; i++) {\r\n var meta = metaElements[i];\r\n if (meta.name) {\r\n var mt = meta.name.toLowerCase();\r\n if (mt.indexOf(prefix) === 0) {\r\n var name = meta.name.replace(prefix, \"\");\r\n metaData[name] = meta.content;\r\n }\r\n }\r\n }\r\n }\r\n return metaData;\r\n }\r\n /// Validate each flight id in appExpId against the app flight ID\r\n /// format and create a comma seperated appExpId with valid flight ids.Ignore invalid flight IDs< /summary>\r\n /// A list of comma seperated appExpId\r\n /// none\r\n function _setAppExpId(appExpIdNew) {\r\n if (appExpIdNew === _appExpId) {\r\n return; // Nothing to do if seen before\r\n }\r\n // Reset to empty first. The new but invalid appExpId should not be logged and we cannot leave the old one hanging around\r\n // since it means old experiment id cannot represent the new experiment with an invalid appExpId.\r\n _appExpId = _validateAppExpId(appExpIdNew, flightIdNameSpaces);\r\n }\r\n function _readExpIdFromCookie() {\r\n var cookieValue = getCookieValue(_cookieMgr, expIdCookieName);\r\n _setAppExpId(cookieValue);\r\n return _appExpId;\r\n }\r\n function _readExpIdFromCoreData(expId) {\r\n _setAppExpId(expId);\r\n return _appExpId;\r\n }\r\n function _populateDefaults(config) {\r\n // This function will be re-called whenever any referenced configuration is changed\r\n var unloadHook = onConfigChange(config, function () {\r\n _cookieMgr = core && core.getCookieMgr();\r\n _propertiesConfig = config || {};\r\n // config.env default is set at properities plugin level with \"\"\r\n _self.env = _propertiesConfig.env || _getMetaDataFromDOM(\"awa-\")[\"env\"];\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n }\r\n });\r\n }\r\n// Removed Stub for Application.prototype.getExpId.\r\n /// Validate each flight id in appExpId against the app flight ID\r\n /// format and create a comma seperated appExpId with valid flight ids.Ignore invalid flight IDs< /summary>\r\n /// A list of comma seperated appExpId\r\n /// none\r\n /**\r\n * Validate each flight id in appExpId against the app flight ID format and create\r\n * a comma seperated appExpId with valid flight ids.Ignore invalid flight IDs\r\n * @param appExpId - The current experiment id\r\n * @param appExpIdNew - The new experiment id to set (if valid)\r\n * @param flightIdNameSpaces - The valid set of flight id names\r\n * @returns The validated experiment id,\r\n */\r\n Application.validateAppExpId = _validateAppExpId;\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n Application._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n objDefine(Application.prototype, \"expId\", { g: _getExpId });\r\n })();\r\n return Application;\r\n}());\r\nexport { Application };\r\n//# sourceMappingURL=Application.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Cloud.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2020\r\n*/\r\nvar Cloud = /** @class */ (function () {\r\n function Cloud() {\r\n }\r\n return Cloud;\r\n}());\r\nexport { Cloud };\r\n//# sourceMappingURL=Cloud.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Device.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nvar Device = /** @class */ (function () {\r\n function Device() {\r\n }\r\n return Device;\r\n}());\r\nexport { Device };\r\n//# sourceMappingURL=Device.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* IntWeb.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, onConfigChange } from \"@microsoft/1ds-core-js\";\r\nimport { objDefine } from \"@nevware21/ts-utils\";\r\nfunction _getMsfpc() {\r\n return this.getMsfpc();\r\n}\r\nfunction _getAnid() {\r\n return this.getAnid();\r\n}\r\nvar IntWeb = /** @class */ (function () {\r\n function IntWeb(propertiesConfig, core, unloadHookContainer) {\r\n var _cookieMgr;\r\n dynamicProto(IntWeb, this, function (_self) {\r\n _populateDefaults(propertiesConfig);\r\n _self.getMsfpc = function () {\r\n return getCookieValue(_cookieMgr, \"MSFPC\");\r\n };\r\n _self.getAnid = function () {\r\n return getCookieValue(_cookieMgr, \"ANON\").slice(0, 34);\r\n };\r\n function _populateDefaults(config) {\r\n // This function will be re-called whenever any referenced configuration is changed\r\n var unloadHook = onConfigChange(config, function () {\r\n _cookieMgr = core && core.getCookieMgr();\r\n var _config = config || {};\r\n if (_config.serviceName) {\r\n _self.serviceName = _config.serviceName; // change serviceName only if incoming values is not null, undefined or \"\"\r\n }\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n }\r\n });\r\n }\r\n// Removed Stub for IntWeb.prototype.getMsfpc.\r\n// Removed Stub for IntWeb.prototype.getAnid.\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n IntWeb._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n var proto = IntWeb.prototype;\r\n objDefine(proto, \"msfpc\", { g: _getMsfpc });\r\n objDefine(proto, \"anid\", { g: _getAnid });\r\n })();\r\n return IntWeb;\r\n}());\r\nexport { IntWeb };\r\n//# sourceMappingURL=IntWeb.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Loc.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nvar Loc = /** @class */ (function () {\r\n function Loc() {\r\n // Add time zone\r\n var timeZone = new Date().getTimezoneOffset();\r\n var minutes = timeZone % 60;\r\n var hours = (timeZone - minutes) / 60;\r\n var timeZonePrefix = \"+\";\r\n if (hours > 0) {\r\n timeZonePrefix = \"-\";\r\n }\r\n hours = Math.abs(hours);\r\n minutes = Math.abs(minutes);\r\n this.tz = timeZonePrefix + (hours < 10 ? \"0\" + hours : hours.toString()) + \":\"\r\n + (minutes < 10 ? \"0\" + minutes : minutes.toString());\r\n }\r\n return Loc;\r\n}());\r\nexport { Loc };\r\n//# sourceMappingURL=Loc.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* OperatingSystem.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport { getNavigator, isString, onConfigChange } from \"@microsoft/1ds-core-js\";\r\nimport { objDefine } from \"@nevware21/ts-utils\";\r\nvar OSNAMEREGEX = {\r\n WIN: /(windows|win32)/i,\r\n WINRT: / arm;/i,\r\n WINPHONE: /windows\\sphone\\s\\d+\\.\\d+/i,\r\n OSX: /(macintosh|mac os x)/i,\r\n IOS: /(ipad|iphone|ipod)(?=.*like mac os x)/i,\r\n LINUX: /(linux|joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)/i,\r\n ANDROID: /android/i,\r\n CROS: /CrOS/i\r\n};\r\nvar VERSION_MAPPINGS = {\r\n \"5.1\": \"XP\",\r\n \"6.0\": \"Vista\",\r\n \"6.1\": \"7\",\r\n \"6.2\": \"8\",\r\n \"6.3\": \"8.1\",\r\n \"10.0\": \"10\"\r\n};\r\nvar REGEX_VERSION = \"([\\\\d,.]+)\";\r\nvar REGEX_VERSION_MAC = \"([\\\\d,_,.]+)\";\r\nvar UNKNOWN = \"Unknown\";\r\nvar OSNAMES = [\r\n { r: OSNAMEREGEX.WINPHONE, os: \"Windows Phone\" },\r\n { r: OSNAMEREGEX.WINRT, os: \"Windows RT\" },\r\n { r: OSNAMEREGEX.WIN, os: \"Windows\" /* OPERATING_SYSTEMS.WINDOWS */ },\r\n { r: OSNAMEREGEX.IOS, os: \"iOS\" /* OPERATING_SYSTEMS.IOS */ },\r\n { r: OSNAMEREGEX.ANDROID, os: \"Android\" /* OPERATING_SYSTEMS.ANDROID */ },\r\n { r: OSNAMEREGEX.LINUX, os: \"Linux\" },\r\n { r: OSNAMEREGEX.CROS, os: \"Chrome OS\" },\r\n { s: \"x11\", os: \"Unix\" },\r\n { s: \"blackberry\", os: \"BlackBerry\" },\r\n { s: \"symbian\", os: \"Symbian\" },\r\n { s: \"nokia\", os: \"Nokia\" },\r\n { r: OSNAMEREGEX.OSX, os: \"Mac OS X\" /* OPERATING_SYSTEMS.MACOSX */ }\r\n];\r\nvar strSetSysName = \"setSysName\";\r\nvar strSetSysVer = \"setSysVer\";\r\nvar strGetSysName = \"getSysName\";\r\nvar strGetSysVer = \"getSysVer\";\r\nfunction _getOsName(lowerCaseUserAgent) {\r\n for (var lp = 0; lp < OSNAMES.length; lp++) {\r\n var match = OSNAMES[lp];\r\n if (match.r && lowerCaseUserAgent.match(match.r)) {\r\n return match.os;\r\n }\r\n else if (match.s && lowerCaseUserAgent.indexOf(match.s) !== -1) {\r\n return match.os;\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getOsVersion(userAgent, osName) {\r\n if (osName === \"Windows\" /* OPERATING_SYSTEMS.WINDOWS */) {\r\n return _getGenericOsVersion(userAgent, \"Windows NT\");\r\n }\r\n if (osName === \"Android\" /* OPERATING_SYSTEMS.ANDROID */) {\r\n return _getGenericOsVersion(userAgent, osName);\r\n }\r\n if (osName === \"Mac OS X\" /* OPERATING_SYSTEMS.MACOSX */) {\r\n return _getMacOsxVersion(userAgent);\r\n }\r\n if (osName === \"iOS\" /* OPERATING_SYSTEMS.IOS */) {\r\n return _getIosVersion(userAgent);\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getGenericOsVersion(userAgent, osName) {\r\n var ntVersionMatches = userAgent.match(new RegExp(osName + \" \" + REGEX_VERSION));\r\n if (ntVersionMatches) {\r\n if (VERSION_MAPPINGS[ntVersionMatches[1]]) {\r\n return VERSION_MAPPINGS[ntVersionMatches[1]];\r\n }\r\n return ntVersionMatches[1];\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getMacOsxVersion(userAgent) {\r\n var macOsxVersionInUserAgentMatches = userAgent.match(new RegExp(\"Mac OS X\" /* OPERATING_SYSTEMS.MACOSX */ + \" \" + REGEX_VERSION_MAC));\r\n if (macOsxVersionInUserAgentMatches) {\r\n var versionString = macOsxVersionInUserAgentMatches[1].replace(/_/g, \".\");\r\n if (versionString) {\r\n var delimiter = _getDelimiter(versionString);\r\n if (delimiter) {\r\n var components = versionString.split(delimiter);\r\n return components[0];\r\n }\r\n else {\r\n return versionString;\r\n }\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getIosVersion(userAgent) {\r\n var iosVersionInUserAgentMatches = userAgent.match(new RegExp(\"OS \" + REGEX_VERSION_MAC));\r\n if (iosVersionInUserAgentMatches) {\r\n var versionString = iosVersionInUserAgentMatches[1].replace(/_/g, \".\");\r\n if (versionString) {\r\n var delimiter = _getDelimiter(versionString);\r\n if (delimiter) {\r\n var components = versionString.split(delimiter);\r\n return components[0];\r\n }\r\n else {\r\n return versionString;\r\n }\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getDelimiter(versionString) {\r\n if (versionString.indexOf(\".\") > -1) {\r\n return \".\";\r\n }\r\n if (versionString.indexOf(\"_\") > -1) {\r\n return \"_\";\r\n }\r\n return null;\r\n}\r\nvar OperatingSystem = /** @class */ (function () {\r\n function OperatingSystem(propertiesConfig, unloadHookContainer) {\r\n var self = this;\r\n var _config;\r\n var _name = null;\r\n var _ver = null;\r\n var _userName = null; // save user defined name. If defined, this value will overwrite dynamic config values\r\n var _userVer = null; // save user defined ver. If defined, this value will overwrite dynamic config values\r\n var _setSysName = function (value) {\r\n _userName = value;\r\n };\r\n var _setSysVer = function (value) {\r\n _userVer = value;\r\n };\r\n var _getSysName = function () {\r\n return _userName || _name;\r\n };\r\n var _getSysVer = function () {\r\n return _userVer || _ver;\r\n };\r\n var unloadHook = onConfigChange(propertiesConfig, function () {\r\n _config = propertiesConfig || {};\r\n // if populateOperatingSystemInfo is set to false, previous name and ver will be used\r\n if (_config.populateOperatingSystemInfo) {\r\n var theNav = getNavigator() || {};\r\n var userAgent = propertiesConfig.userAgent || theNav.userAgent || \"\";\r\n var userAgentDataPlatform = (propertiesConfig.userAgentData || {}).platform || (theNav.userAgentData || {}).platform;\r\n if (userAgent) {\r\n var osName = _getOsName(userAgent.toLowerCase());\r\n _name = osName;\r\n _ver = _getOsVersion(userAgent, osName);\r\n }\r\n if ((!_name || _name === UNKNOWN) && isString(userAgentDataPlatform)) {\r\n _name = userAgentDataPlatform;\r\n }\r\n }\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n objDefine(self, \"name\", { s: _setSysName, g: _getSysName });\r\n objDefine(self, \"ver\", { s: _setSysVer, g: _getSysVer });\r\n }\r\n return OperatingSystem;\r\n}());\r\nexport { OperatingSystem };\r\n//# sourceMappingURL=OperatingSystem.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Sdk.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, newGuid, onConfigChange, random32 } from \"@microsoft/1ds-core-js\";\r\nvar DEVICE_ID_COOKIE = \"MicrosoftApplicationsTelemetryDeviceId\";\r\nfunction _saveData(mgr, propertyStorage, name, value) {\r\n if (propertyStorage) {\r\n propertyStorage.setProperty(name, value);\r\n }\r\n else {\r\n // Expires in 365 days (365 * 24 * 60 * 60)\r\n mgr.set(name, value, 31536000);\r\n }\r\n}\r\nfunction _getData(mgr, propertyStorage, name) {\r\n if (propertyStorage) {\r\n return propertyStorage.getProperty(name) || \"\";\r\n }\r\n return getCookieValue(mgr, name);\r\n}\r\nvar Sdk = /** @class */ (function () {\r\n function Sdk(coreConfig, core, unloadHookContainer) {\r\n var _sequenceId = 0;\r\n var _cookieMgr;\r\n dynamicProto(Sdk, this, function (_self) {\r\n // Start sequence\r\n _self.seq = _sequenceId;\r\n _self.epoch = random32(false).toString();\r\n _self.getSequenceId = function () {\r\n return ++_sequenceId;\r\n };\r\n var unloadHook = onConfigChange(coreConfig, function (details) {\r\n _cookieMgr = core && core.getCookieMgr();\r\n var coreConfig = details.cfg;\r\n var propertyStorage = coreConfig.propertyStorageOverride;\r\n var cookieMgrEnabled = _cookieMgr.isEnabled();\r\n if (cookieMgrEnabled || propertyStorage) {\r\n // Only collect device id if it can be stored\r\n var deviceId = _getData(_cookieMgr, propertyStorage, DEVICE_ID_COOKIE);\r\n if (!deviceId) {\r\n deviceId = newGuid();\r\n }\r\n _saveData(_cookieMgr, propertyStorage, DEVICE_ID_COOKIE, deviceId);\r\n _self.installId = deviceId;\r\n }\r\n else {\r\n _cookieMgr.purge(DEVICE_ID_COOKIE);\r\n }\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n });\r\n }\r\n // Get seq value\r\n// Removed Stub for Sdk.prototype.getSequenceId.\r\n // This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n // this will be removed when ES3 support is dropped.\n Sdk.__ieDyn=1;\n\n return Sdk;\r\n}());\r\nexport { Sdk };\r\n//# sourceMappingURL=Sdk.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* AITrace.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport { generateW3CId, getLocation, onConfigChange } from \"@microsoft/1ds-core-js\";\r\nvar Trace = /** @class */ (function () {\r\n function Trace(propertiesConfig, id, parentId, name, unloadHookContainer) {\r\n var self = this;\r\n self.traceId = id || generateW3CId();\r\n var unloadHook = onConfigChange(propertiesConfig, function () {\r\n var _config = propertiesConfig;\r\n if (_config.enableDistributedTracing && !parentId) {\r\n // When dt is enabled, both the traceId and spanId are required\r\n parentId = generateW3CId().substring(0, 16);\r\n }\r\n self.parentId = self.parentId || parentId; // change parentId only if it was not set previously\r\n if (_config.enableApplicationInsightsTrace && !name) {\r\n var loc = getLocation();\r\n if (loc && loc.pathname) {\r\n name = loc.pathname;\r\n }\r\n }\r\n self.name = self.name || name; // change name only if it was not set previously\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n }\r\n return Trace;\r\n}());\r\nexport { Trace };\r\n//# sourceMappingURL=Trace.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* User.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, getISOString, isUndefined, newId, onConfigChange } from \"@microsoft/1ds-core-js\";\r\nimport { objDefine } from \"@nevware21/ts-utils\";\r\nvar strSetLocalId = \"setLocalId\";\r\nfunction _getLocalId() {\r\n return this.getLocalId();\r\n}\r\nfunction _setLocalId(value) {\r\n this[strSetLocalId](value);\r\n}\r\nvar User = /** @class */ (function () {\r\n function User(coreConfig, propertiesConfig, core, unloadHookContainer) {\r\n var _propertiesConfig;\r\n var _customLocalId;\r\n var _cookieMgr;\r\n dynamicProto(User, this, function (_self) {\r\n _populateDefaults(propertiesConfig);\r\n // Add user language\r\n if (typeof navigator !== \"undefined\") {\r\n var nav = navigator;\r\n _self.locale = nav.userLanguage || nav.language;\r\n }\r\n _self.getLocalId = function () {\r\n if (_customLocalId) {\r\n return _customLocalId;\r\n }\r\n return _populateMuidFromCookie();\r\n };\r\n _self[strSetLocalId] = function (value) {\r\n _customLocalId = value;\r\n };\r\n function _populateMuidFromCookie() {\r\n // Only add default local ID is hash or drop config are not enabled\r\n if (!_propertiesConfig.hashIdentifiers && !_propertiesConfig.dropIdentifiers) {\r\n var muidValue = getCookieValue(_cookieMgr, \"MUID\");\r\n if (muidValue) {\r\n _customLocalId = \"t:\" + muidValue;\r\n }\r\n }\r\n return _customLocalId;\r\n }\r\n function _populateDefaults(config) {\r\n // This function will be re-called whenever any referenced configuration is changed\r\n var unloadHook = onConfigChange(config, function () {\r\n _cookieMgr = core && core.getCookieMgr();\r\n _propertiesConfig = config;\r\n // reset it since this value is dependent on cookieMgr, config.hashIdentifiers and config.dropIdentifiers\r\n _customLocalId = null;\r\n if (_cookieMgr && _cookieMgr.isEnabled()) {\r\n _populateMuidFromCookie();\r\n if (_propertiesConfig.enableApplicationInsightsUser) {\r\n // get userId or create new one if none exists\r\n var aiUser = getCookieValue(_cookieMgr, User.userCookieName);\r\n if (aiUser) {\r\n var params = aiUser.split(User.cookieSeparator);\r\n if (params.length > 0) {\r\n _self.id = params[0];\r\n }\r\n }\r\n if (!_self.id) {\r\n _self.id = newId((coreConfig && !isUndefined(coreConfig.idLength)) ? coreConfig.idLength : 22);\r\n var acqStr = getISOString(new Date());\r\n _self.accountAcquisitionDate = acqStr;\r\n // without expiration, cookies expire at the end of the session\r\n // set it to 365 days from now\r\n // 365 * 24 * 60 * 60 * 1000 = 31536000\r\n var newCookie = [_self.id, acqStr];\r\n var cookieDomain = _propertiesConfig.cookieDomain ? _propertiesConfig.cookieDomain : undefined;\r\n _cookieMgr.set(User.userCookieName, newCookie.join(User.cookieSeparator), 31536000, cookieDomain);\r\n }\r\n }\r\n }\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n }\r\n });\r\n }\r\n// Removed Stub for User.prototype.getLocalId.\r\n// Removed Stub for User.prototype.setLocalId.\r\n User.cookieSeparator = \"|\";\r\n User.userCookieName = \"ai_user\";\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n User._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n objDefine(User.prototype, \"localId\", { g: _getLocalId, s: _setLocalId });\r\n })();\r\n return User;\r\n}());\r\nexport { User };\r\n//# sourceMappingURL=User.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Utc.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport { onConfigChange } from \"@microsoft/1ds-core-js\";\r\n/**\r\n * See details {@link https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events | here}.\r\n * Client has hashed or dropped any PII information in the event. Vortex will hash any server-supplied PII fields such\r\n * as PUID or Global Device ID. This value is used to populate the `ext.utc.eventFlags`.\r\n * See https://1dsdocs.azurewebsites.net/schema/PartA/utc.html#eventflags and\r\n * further details https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events.\r\n */\r\nexport var HASH_IDENTIFIERS_FLAG = 0x100000;\r\n/**\r\n * See details {@link https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events | here}.\r\n * Client has dropped any PII information in the event. Information contained within attached MSA token will not be inserted.\r\n * This value is used to populate the `ext.utc.eventFlags`.\r\n * See https://1dsdocs.azurewebsites.net/schema/PartA/utc.html#eventflags and\r\n * further details https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events.\r\n */\r\nexport var DROP_IDENTIFIERS_FLAG = 0x200000;\r\n/**\r\n * See details {@link https://www.osgwiki.com/wiki/Telemetry#De-Identification_of_Telemetry_Events | here}. Collector to scrub `ext.ingest.clientIp`\r\n * field stamped server-side. This takes precedence over both Hash Identifier and Drop Identifier flags above, so as long as this bit is set,\r\n * the client IP will be scrubbed as \"xxx.xxx.xxx.*\" for IPv4 and will not be dropped. The main use case for this flag is Interchange customers\r\n * that need to use OriginalMessage feature but wish not to have IP info in Geneva data store. For more details on this scenario, please see link\r\n * here: {@link https://eng.ms/docs/products/geneva/connectors/asimov_to_geneva/management#default-commonschema | 1DS Interchange Default CommonSchema }\r\n * See also {@link https://www.osgwiki.com/wiki/CommonSchema/flags | CommonSchema/flags}\r\n * @since 3.2.11\r\n */\r\nexport var SCRUB_IP_FLAG = 0x400000;\r\nvar Utc = /** @class */ (function () {\r\n function Utc(propertiesConfig, unloadHookContainer) {\r\n var self = this;\r\n var _config;\r\n self.popSample = 100;\r\n var unloadHook = onConfigChange(propertiesConfig, function () {\r\n _config = propertiesConfig;\r\n self.eventFlags = 0;\r\n if (propertiesConfig.hashIdentifiers) {\r\n // set value when user didn't set values\r\n self.eventFlags = self.eventFlags | HASH_IDENTIFIERS_FLAG;\r\n }\r\n if (propertiesConfig.dropIdentifiers) {\r\n // set value when user didn't set values\r\n self.eventFlags = self.eventFlags | DROP_IDENTIFIERS_FLAG;\r\n }\r\n if (propertiesConfig.scrubIpOnly) {\r\n // set value when user didn't set values\r\n self.eventFlags = self.eventFlags | SCRUB_IP_FLAG;\r\n }\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n }\r\n return Utc;\r\n}());\r\nexport { Utc };\r\n//# sourceMappingURL=Utc.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Web.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { getCookieValue, getLocation, getNavigator, getWindow, isArray, onConfigChange, safeGetCookieMgr } from \"@microsoft/1ds-core-js\";\r\nimport { isBoolean, objDefine, objDefineProps } from \"@nevware21/ts-utils\";\r\nvar USER_CONSENT_DETAILS = [\r\n \"Required\", \"Analytics\", \"SocialMedia\", \"Advertising\"\r\n];\r\nvar REGEX_VERSION = \"([\\\\d,.]+)\";\r\nvar UNKNOWN = \"Unknown\";\r\nvar EDGE_CHROMIUM = \"Edg/\";\r\nvar USER_AGENTS = [\r\n { ua: \"OPR/\", b: \"Opera\" /* BROWSERS.OPERA */ },\r\n { ua: \"PhantomJS\" /* BROWSERS.PHANTOMJS */, b: \"PhantomJS\" /* BROWSERS.PHANTOMJS */ },\r\n { ua: \"Edge\" /* BROWSERS.EDGE */, b: \"Edge\" /* BROWSERS.EDGE */ },\r\n { ua: EDGE_CHROMIUM, b: \"Edge\" /* BROWSERS.EDGE */ },\r\n { ua: \"Electron\" /* BROWSERS.ELECTRON */, b: \"Electron\" /* BROWSERS.ELECTRON */ },\r\n { ua: \"Chrome\" /* BROWSERS.CHROME */, b: \"Chrome\" /* BROWSERS.CHROME */ },\r\n { ua: \"Trident\", b: \"MSIE\" /* BROWSERS.MSIE */ },\r\n { ua: \"MSIE \", b: \"MSIE\" /* BROWSERS.MSIE */ },\r\n { ua: \"Firefox\" /* BROWSERS.FIREFOX */, b: \"Firefox\" /* BROWSERS.FIREFOX */ },\r\n { ua: \"Safari\" /* BROWSERS.SAFARI */, b: \"Safari\" /* BROWSERS.SAFARI */ },\r\n { ua: \"SkypeShell\" /* BROWSERS.SKYPE_SHELL */, b: \"SkypeShell\" /* BROWSERS.SKYPE_SHELL */ } // Check for Skype shell\r\n];\r\nvar BRANDS = [\r\n { br: \"Microsoft Edge\", b: \"Edge\" /* BROWSERS.EDGE */ },\r\n { br: \"Google Chrome\", b: \"Chrome\" /* BROWSERS.CHROME */ },\r\n { br: \"Opera\", b: \"Opera\" /* BROWSERS.OPERA */ }\r\n];\r\nfunction _userAgentContainsString(searchString, userAgent) {\r\n return userAgent.indexOf(searchString) > -1;\r\n}\r\nfunction _getBrandVersion(match, brands) {\r\n for (var lp = 0; lp < brands.length; lp++) {\r\n if (match == brands[lp].brand) {\r\n return brands[lp].version;\r\n }\r\n }\r\n return null;\r\n}\r\nfunction _getBrowserName(userAgent) {\r\n if (userAgent) {\r\n for (var lp = 0; lp < USER_AGENTS.length; lp++) {\r\n var ua = USER_AGENTS[lp].ua;\r\n if (_userAgentContainsString(ua, userAgent)) {\r\n return USER_AGENTS[lp].b;\r\n }\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\nfunction _getBrowserVersion(userAgent, browserName) {\r\n if (browserName === \"MSIE\" /* BROWSERS.MSIE */) {\r\n return _getIeVersion(userAgent);\r\n }\r\n return _getOtherVersion(browserName, userAgent);\r\n}\r\nfunction _getIeVersion(userAgent) {\r\n var classicIeVersionMatches = userAgent.match(new RegExp(\"MSIE\" /* BROWSERS.MSIE */ + \" \" + REGEX_VERSION));\r\n if (classicIeVersionMatches) {\r\n return classicIeVersionMatches[1];\r\n }\r\n var ieVersionMatches = userAgent.match(new RegExp(\"rv:\" + REGEX_VERSION));\r\n if (ieVersionMatches) {\r\n return ieVersionMatches[1];\r\n }\r\n}\r\nfunction _getOtherVersion(browserString, userAgent) {\r\n if (browserString === \"Safari\" /* BROWSERS.SAFARI */) {\r\n browserString = \"Version\";\r\n }\r\n else if (browserString === \"Edge\" /* BROWSERS.EDGE */) {\r\n if (_userAgentContainsString(EDGE_CHROMIUM, userAgent)) {\r\n browserString = \"Edg\";\r\n }\r\n }\r\n var matches = userAgent.match(new RegExp(browserString + \"/\" + REGEX_VERSION));\r\n if (matches) {\r\n return matches[1];\r\n }\r\n if (browserString === \"Opera\" /* BROWSERS.OPERA */) {\r\n matches = userAgent.match(new RegExp(\"OPR/\" + REGEX_VERSION));\r\n if (matches) {\r\n return matches[1];\r\n }\r\n }\r\n return UNKNOWN;\r\n}\r\n/**\r\n* Get Screen resolution\r\n* @returns {ScreenResolution} - Screen resolution\r\n*/\r\nfunction _getScreenResolution() {\r\n var screenRes = { h: 0, w: 0 };\r\n var win = getWindow();\r\n if (win && win.screen) {\r\n screenRes.h = screen.height;\r\n screenRes.w = screen.width;\r\n }\r\n return screenRes;\r\n}\r\nfunction _getUserConsent() {\r\n return this.getUserConsent();\r\n}\r\nvar Web = /** @class */ (function () {\r\n function Web(propertiesConfig, core, unloadHookContainer) {\r\n var _cookieMgr = safeGetCookieMgr(core);\r\n var _propertiesConfig = propertiesConfig || {};\r\n var _userAgent = null;\r\n var _userAgentBrands = null;\r\n var _userBrowser = null; // save user defined browser. If defined, this value will overwrite dynamic config values\r\n var _userBrowserVer = null; // save user defined browser ver. If defined, this value will overwrite dynamic config values\r\n var _browser = null;\r\n var _browserVer = null;\r\n var _gpcDataSharingOption = null;\r\n dynamicProto(Web, this, function (_self) {\r\n _populateDefaults(propertiesConfig);\r\n // Add the domain\r\n var windowLocation = getLocation();\r\n if (windowLocation) {\r\n var domain = windowLocation.hostname;\r\n if (domain) {\r\n _self.domain = windowLocation.protocol === \"file:\" ? \"local\" : domain;\r\n }\r\n }\r\n var screenRes = _getScreenResolution();\r\n _self.screenRes = screenRes.w + \"X\" + screenRes.h;\r\n _self.getUserConsent = function () {\r\n return _propertiesConfig.userConsented || (getCookieValue(_cookieMgr, _propertiesConfig.userConsentCookieName || \"MSCC\") ? true : false);\r\n };\r\n /**\r\n *\r\n ** Function to retrieve user consent details.\r\n * @param callback - Callback function to get user consent details\r\n * @returns IUserContentDetails stringified object\r\n */\r\n _self.getUserConsentDetails = function () {\r\n var consentDetails = null;\r\n try {\r\n var callback = _propertiesConfig.callback;\r\n if (callback && callback.userConsentDetails) {\r\n var result = callback.userConsentDetails();\r\n if (result) {\r\n if (_propertiesConfig.disableConsentDetailsSanitize) {\r\n consentDetails = result;\r\n }\r\n else {\r\n consentDetails = {};\r\n }\r\n // Apply default values if missing\r\n for (var lp = 0; lp < USER_CONSENT_DETAILS.length; lp++) {\r\n var key = USER_CONSENT_DETAILS[lp];\r\n consentDetails[key] = result[key] || false;\r\n }\r\n }\r\n }\r\n // Only set if the configuration was provided\r\n if (_gpcDataSharingOption !== null) {\r\n consentDetails = consentDetails || {};\r\n consentDetails.GPC_DataSharingOptIn = !!_gpcDataSharingOption;\r\n }\r\n return consentDetails ? JSON.stringify(consentDetails) : null;\r\n }\r\n catch (e) {\r\n // Unexpected - Just making sure we don't crash\r\n }\r\n };\r\n function _parseUserAgent(userAgent, userAgentBrands) {\r\n if (isArray(userAgentBrands)) {\r\n try {\r\n // Go through the ordered list of \"known\" brands and use the first matching value\r\n for (var lp = 0; lp < BRANDS.length; lp++) {\r\n var version = _getBrandVersion(BRANDS[lp].br, userAgentBrands);\r\n if (version) {\r\n _browser = BRANDS[lp].b;\r\n _browserVer = version;\r\n return;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Unexpected - Just making sure we don't crash\r\n }\r\n }\r\n if (userAgent) {\r\n var browserName = _getBrowserName(userAgent);\r\n _browser = browserName;\r\n _browserVer = _getBrowserVersion(userAgent, browserName);\r\n }\r\n }\r\n function _setBrowser(value) {\r\n _userBrowser = value;\r\n }\r\n function _setBrowserVer(value) {\r\n _userBrowserVer = value;\r\n }\r\n function _getBrowser() {\r\n return _userBrowser || _browser;\r\n }\r\n function _getBrowserVer() {\r\n return _userBrowserVer || _browserVer;\r\n }\r\n var _getGpcDataSharing = function () {\r\n return _gpcDataSharingOption;\r\n };\r\n var _setGpcDataSharing = function (value) {\r\n // Setting directly, rather than waiting for the onConfigChange so that the new value is available immediately\r\n _gpcDataSharingOption = isBoolean(value) ? value : null;\r\n // Also update the configuration so any listeners are also notified in the next JS cycle\r\n _propertiesConfig.gpcDataSharingOptIn = _gpcDataSharingOption;\r\n };\r\n function _populateDefaults(config) {\r\n // This function will be re-called whenever any referenced configuration is changed\r\n var unloadHook = onConfigChange(config, function () {\r\n _propertiesConfig = config;\r\n // if populateBrowserInfo is set to false, it will use previous values (so, it will not reset)\r\n if (_propertiesConfig.populateBrowserInfo) {\r\n var userAgent = _propertiesConfig.userAgent;\r\n var userAgentBrands = (_propertiesConfig.userAgentData || {}).brands;\r\n if (userAgent !== _userAgent || userAgentBrands !== _userAgentBrands) {\r\n if (!userAgent || !userAgentBrands || userAgentBrands.length === 0) {\r\n // One or more values not specified so try and derive from the navigator (if available)\r\n var theNav = getNavigator();\r\n if (theNav) {\r\n userAgent = userAgent || theNav.userAgent || \"\";\r\n userAgentBrands = userAgentBrands || (theNav.userAgentData || {}).brands;\r\n }\r\n }\r\n _parseUserAgent(userAgent, userAgentBrands);\r\n _userAgent = userAgent;\r\n _userAgentBrands = userAgentBrands;\r\n }\r\n }\r\n // Only set if the configuration was provided\r\n _gpcDataSharingOption = isBoolean(_propertiesConfig.gpcDataSharingOptIn) ? _propertiesConfig.gpcDataSharingOptIn : null;\r\n });\r\n unloadHookContainer && unloadHookContainer.add(unloadHook);\r\n }\r\n // Remap this get userContext for this instance\r\n objDefineProps(_self, {\r\n \"userConsent\": { g: _self.getUserConsent },\r\n \"browser\": { s: _setBrowser, g: _getBrowser },\r\n \"browserVer\": { s: _setBrowserVer, g: _getBrowserVer },\r\n \"gpcDataSharingOptIn\": { g: _getGpcDataSharing, s: _setGpcDataSharing }\r\n });\r\n });\r\n }\r\n// Removed Stub for Web.prototype.getUserConsent.\r\n// Removed Stub for Web.prototype.getUserConsentDetails.\r\n /**\r\n * Static constructor, attempt to create accessors\r\n */\r\n Web._staticInit = (function () {\r\n // Dynamically create get/set property accessors\r\n //objDefineAccessors(Web.prototype, \"userConsent\", _getUserConsent);\r\n objDefine(Web.prototype, \"userConsent\", { g: _getUserConsent });\r\n })();\r\n return Web;\r\n}());\r\nexport { Web };\r\n//# sourceMappingURL=Web.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* TelemetryContext.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { isBoolean, isNullOrUndefined, isNumber, isString, isValidSpanId, isValidTraceId, objForEachKey } from \"@microsoft/1ds-core-js\";\r\nimport { AppExtensionKeys, CloudExtKeys, DeviceExtKeys, DistributedTraceExtKeys, Extensions, IntWebExtKeys, LocExtKeys, OSExtKeys, SDKExtKeys, SessionExtKeys, TraceExtKeys, UserExtensionKeys, UtcExtKeys, WebExtensionKeys } from \"./ExtensionKeys\";\r\nimport { SessionManager } from \"./SessionManager\";\r\nimport { Application } from \"./context/Application\";\r\nimport { Cloud } from \"./context/Cloud\";\r\nimport { Device } from \"./context/Device\";\r\nimport { IntWeb } from \"./context/IntWeb\";\r\nimport { Loc } from \"./context/Loc\";\r\nimport { OperatingSystem } from \"./context/OperatingSystem\";\r\nimport { Sdk } from \"./context/Sdk\";\r\nimport { Session } from \"./context/Session\";\r\nimport { Trace } from \"./context/Trace\";\r\nimport { User } from \"./context/User\";\r\nimport { Utc } from \"./context/Utc\";\r\nimport { Web } from \"./context/Web\";\r\nfunction _applyExtValues(extension, event, names, map, overwriteTarget) {\r\n var target = event.ext[Extensions[extension]];\r\n if (target) {\r\n try {\r\n objForEachKey(map, function (field, value) {\r\n if (isString(value) || isNumber(value) || isBoolean(value)) {\r\n var targetValue = target[names[field]];\r\n if (!overwriteTarget && (targetValue || isString(targetValue) || isNumber(targetValue) || isBoolean(targetValue))) {\r\n value = targetValue;\r\n }\r\n target[names[field]] = value;\r\n }\r\n });\r\n }\r\n catch (e) {\r\n // During unload some accesses may cause a TypeError due to accessing a dead object\r\n }\r\n }\r\n return target;\r\n}\r\nvar TelemetryContext = /** @class */ (function () {\r\n function TelemetryContext(coreConfig, propertiesConfig, core, unloadHookContainer) {\r\n dynamicProto(TelemetryContext, this, function (_self) {\r\n _self.app = new Application(propertiesConfig, core, unloadHookContainer);\r\n _self.cloud = new Cloud();\r\n _self.user = new User(coreConfig, propertiesConfig, core, unloadHookContainer);\r\n _self.os = new OperatingSystem(propertiesConfig, unloadHookContainer);\r\n _self.web = new Web(propertiesConfig, core, unloadHookContainer);\r\n var _sdk = new Sdk(coreConfig, core, unloadHookContainer);\r\n var _intWeb = new IntWeb(propertiesConfig, core, unloadHookContainer);\r\n var _utc = new Utc(propertiesConfig, unloadHookContainer);\r\n _self.loc = new Loc();\r\n _self.device = new Device();\r\n var _sessionManager = new SessionManager(core, propertiesConfig, unloadHookContainer);\r\n _self.session = new Session();\r\n var undefValue = undefined;\r\n var _distributedTraceCtx = createDistributedTraceContextFromTraceCtx(new Trace(propertiesConfig, undefValue, undefValue, undefValue, unloadHookContainer), _getTraceCtx());\r\n var _overwriteEventPartA = !(propertiesConfig || {}).eventContainExtFields;\r\n function _getSessionId() {\r\n var session = _self.session;\r\n if (session && isString(session.customId)) {\r\n return session.customId;\r\n }\r\n _sessionManager.update();\r\n var autoSession = _sessionManager.automaticSession;\r\n if (autoSession) {\r\n var autoId = autoSession.getId();\r\n if (autoId && isString(autoId)) {\r\n session.automaticId = autoId;\r\n }\r\n }\r\n return session.automaticId;\r\n }\r\n _self.getTraceCtx = function () {\r\n return _distributedTraceCtx;\r\n };\r\n _self.getSessionId = _getSessionId;\r\n _self.applyApplicationContext = function (event) {\r\n var _a;\r\n var app = _self.app;\r\n _applyExtValues(4 /* eExtensions.AppExt */, event, AppExtensionKeys, (_a = {},\r\n _a[0 /* eAppExtensionKeys.id */] = app.id,\r\n _a[1 /* eAppExtensionKeys.ver */] = app.ver,\r\n _a[2 /* eAppExtensionKeys.appName */] = app.name,\r\n _a[3 /* eAppExtensionKeys.locale */] = app.locale,\r\n _a[4 /* eAppExtensionKeys.expId */] = app.getExpId(),\r\n _a[5 /* eAppExtensionKeys.env */] = app.env,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyUserContext = function (event) {\r\n var _a;\r\n var user = _self.user;\r\n _applyExtValues(0 /* eExtensions.UserExt */, event, UserExtensionKeys, (_a = {},\r\n _a[1 /* eUserExtensionKeys.localId */] = user.getLocalId(),\r\n _a[0 /* eUserExtensionKeys.locale */] = user.locale,\r\n _a[2 /* eUserExtensionKeys.id */] = user.id,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyWebContext = function (event) {\r\n var _a;\r\n var web = _self.web;\r\n _applyExtValues(3 /* eExtensions.WebExt */, event, WebExtensionKeys, (_a = {},\r\n _a[0 /* eWebExtensionKeys.domain */] = web.domain,\r\n _a[1 /* eWebExtensionKeys.browser */] = web.browser,\r\n _a[2 /* eWebExtensionKeys.browserVer */] = web.browserVer,\r\n _a[3 /* eWebExtensionKeys.screenRes */] = web.screenRes,\r\n _a[5 /* eWebExtensionKeys.consentDetails */] = web.getUserConsentDetails(),\r\n _a[4 /* eWebExtensionKeys.userConsent */] = web.getUserConsent(),\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyOsContext = function (event) {\r\n var _a;\r\n var os = _self.os;\r\n _applyExtValues(5 /* eExtensions.OSExt */, event, OSExtKeys, (_a = {},\r\n _a[0 /* eOSExtKeys.osName */] = os.name,\r\n _a[1 /* eOSExtKeys.ver */] = os.ver,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applySdkContext = function (event) {\r\n var _a;\r\n _applyExtValues(6 /* eExtensions.SdkExt */, event, SDKExtKeys, (_a = {},\r\n _a[2 /* eSDKExtKeys.installId */] = _sdk.installId,\r\n _a[1 /* eSDKExtKeys.seq */] = _sdk.getSequenceId(),\r\n _a[3 /* eSDKExtKeys.epoch */] = _sdk.epoch,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyIntWebContext = function (event) {\r\n var _a;\r\n _applyExtValues(7 /* eExtensions.IntWebExt */, event, IntWebExtKeys, (_a = {},\r\n _a[0 /* eIntWebExtKeys.msfpc */] = _intWeb.getMsfpc(),\r\n _a[1 /* eIntWebExtKeys.anid */] = _intWeb.getAnid(),\r\n _a[2 /* eIntWebExtKeys.serviceName */] = _intWeb.serviceName,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyUtcContext = function (event) {\r\n var _a;\r\n var utcFields = (_a = {},\r\n _a[0 /* eUtcExtKeys.popSample */] = _utc.popSample,\r\n _a);\r\n if (_utc.eventFlags > 0) {\r\n utcFields[1 /* eUtcExtKeys.eventFlags */] = _utc.eventFlags;\r\n }\r\n _applyExtValues(8 /* eExtensions.UtcExt */, event, UtcExtKeys, utcFields, _overwriteEventPartA);\r\n };\r\n _self.applyLocContext = function (event) {\r\n var _a;\r\n _applyExtValues(9 /* eExtensions.LocExt */, event, LocExtKeys, (_a = {},\r\n _a[0 /* eLocExtKeys.tz */] = _self.loc.tz,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applySessionContext = function (event) {\r\n var _a;\r\n _applyExtValues(4 /* eExtensions.AppExt */, event, SessionExtKeys, (_a = {},\r\n _a[0 /* eSessionExtKeys.sessionId */] = _getSessionId(),\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyDeviceContext = function (event) {\r\n var _a;\r\n var device = _self.device;\r\n _applyExtValues(1 /* eExtensions.DeviceExt */, event, DeviceExtKeys, (_a = {},\r\n _a[0 /* eDeviceExtKeys.localId */] = device.localId,\r\n _a[2 /* eDeviceExtKeys.make */] = device.make,\r\n _a[3 /* eDeviceExtKeys.model */] = device.model,\r\n _a[1 /* eDeviceExtKeys.deviceClass */] = device.deviceClass,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyCloudContext = function (event) {\r\n var _a;\r\n var cloud = _self.cloud;\r\n _applyExtValues(10 /* eExtensions.CloudExt */, event, CloudExtKeys, (_a = {},\r\n _a[0 /* eCloudExtKeys.role */] = cloud.role,\r\n _a[1 /* eCloudExtKeys.roleInstance */] = cloud.roleInstance,\r\n _a[2 /* eCloudExtKeys.roleVer */] = cloud.roleVer,\r\n _a), _overwriteEventPartA);\r\n };\r\n _self.applyAITraceContext = function (event) {\r\n var _a;\r\n if (propertiesConfig.enableApplicationInsightsTrace) {\r\n var distributedTrace = _getTraceCtx();\r\n if (distributedTrace) {\r\n _applyExtValues(2 /* eExtensions.TraceExt */, event, TraceExtKeys, (_a = {},\r\n _a[0 /* eTraceExtKeys.traceId */] = distributedTrace.getTraceId(),\r\n _a[1 /* eTraceExtKeys.traceName */] = distributedTrace.getName(),\r\n _a[2 /* eTraceExtKeys.parentId */] = distributedTrace.getSpanId(),\r\n _a), false); // Always allow the event to define these values\r\n }\r\n }\r\n };\r\n _self.applyDistributedTraceContext = function (event) {\r\n var _a;\r\n var distributedTrace = _getTraceCtx();\r\n if (distributedTrace) {\r\n var traceFields = (_a = {},\r\n _a[0 /* eDistributedTraceExtKeys.traceId */] = distributedTrace.getTraceId(),\r\n _a[1 /* eDistributedTraceExtKeys.spanId */] = distributedTrace.getSpanId(),\r\n _a);\r\n var traceFlags = distributedTrace.getTraceFlags();\r\n if (!isNullOrUndefined(traceFlags)) {\r\n traceFields[2 /* eDistributedTraceExtKeys.traceFlags */] = traceFlags;\r\n }\r\n // Always allow the event to define these values\r\n _applyExtValues(11 /* eExtensions.DtExt */, event, DistributedTraceExtKeys, traceFields, false);\r\n }\r\n };\r\n function _getTraceCtx() {\r\n var traceCtx = _distributedTraceCtx;\r\n if (core && core.getTraceCtx) {\r\n traceCtx = core.getTraceCtx(false) || _distributedTraceCtx;\r\n }\r\n return traceCtx;\r\n }\r\n });\r\n }\r\n// Removed Stub for TelemetryContext.prototype.getTraceCtx.\r\n// Removed Stub for TelemetryContext.prototype.getSessionId.\r\n// Removed Stub for TelemetryContext.prototype.applyApplicationContext.\r\n// Removed Stub for TelemetryContext.prototype.applyUserContext.\r\n// Removed Stub for TelemetryContext.prototype.applyWebContext.\r\n// Removed Stub for TelemetryContext.prototype.applyOsContext.\r\n// Removed Stub for TelemetryContext.prototype.applySdkContext.\r\n// Removed Stub for TelemetryContext.prototype.applyIntWebContext.\r\n// Removed Stub for TelemetryContext.prototype.applyUtcContext.\r\n// Removed Stub for TelemetryContext.prototype.applyLocContext.\r\n// Removed Stub for TelemetryContext.prototype.applySessionContext.\r\n// Removed Stub for TelemetryContext.prototype.applyDeviceContext.\r\n// Removed Stub for TelemetryContext.prototype.applyCloudContext.\r\n// Removed Stub for TelemetryContext.prototype.applyAITraceContext.\r\n// Removed Stub for TelemetryContext.prototype.applyDistributedTraceContext.\r\n // This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n // this will be removed when ES3 support is dropped.\n TelemetryContext.__ieDyn=1;\n\n return TelemetryContext;\r\n}());\r\nexport { TelemetryContext };\r\n/**\r\n * Creates a IDistributedTraceContext from an optional telemetryTrace\r\n * @param traceContext - The ITraceContext instance that is being wrapped\r\n * @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.\r\n * @returns A new IDistributedTraceContext instance that is backed by the traceContext or temporary object\r\n */\r\nfunction createDistributedTraceContextFromTraceCtx(traceContext, parentCtx) {\r\n var trace = traceContext || {};\r\n return {\r\n getName: function () {\r\n return trace.name;\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace.name = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace.traceId;\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace.traceId = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace.parentId;\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace.parentId = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace.traceFlags;\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace.traceFlags = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryContext.js.map","/*\n * 1DS JS SDK Properties plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\n/**\r\n* PropertiesPlugin.ts\r\n* @author Abhilash Panwar (abpanwar) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin, arrForEach, createProcessTelemetryContext, objForEachKey, objKeys, onConfigChange, setProcessTelemetryTimings } from \"@microsoft/1ds-core-js\";\r\nimport { cfgDfMerge, cfgDfString } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { Extensions } from \"./ExtensionKeys\";\r\nimport { TelemetryContext } from \"./TelemetryContext\";\r\nvar undefValue;\r\nvar extensions = [\r\n Extensions[4 /* eExtensions.AppExt */],\r\n Extensions[0 /* eExtensions.UserExt */],\r\n Extensions[3 /* eExtensions.WebExt */],\r\n Extensions[5 /* eExtensions.OSExt */],\r\n Extensions[6 /* eExtensions.SdkExt */],\r\n Extensions[7 /* eExtensions.IntWebExt */],\r\n Extensions[8 /* eExtensions.UtcExt */],\r\n Extensions[9 /* eExtensions.LocExt */],\r\n Extensions[1 /* eExtensions.DeviceExt */],\r\n Extensions[2 /* eExtensions.TraceExt */],\r\n Extensions[11 /* eExtensions.DtExt */],\r\n Extensions[10 /* eExtensions.CloudExt */]\r\n];\r\nvar defaultPropertyConfig = objDeepFreeze({\r\n populateBrowserInfo: false,\r\n populateOperatingSystemInfo: false,\r\n userAgent: cfgDfString(),\r\n userAgentData: cfgDfMerge({\r\n brands: undefValue,\r\n mobile: undefValue,\r\n platform: undefValue\r\n }),\r\n userConsentCookieName: cfgDfString(),\r\n userConsented: false,\r\n serviceName: cfgDfString(),\r\n env: cfgDfString(),\r\n expId: cfgDfString(),\r\n sessionRenewalMs: 1800000,\r\n sessionExpirationMs: 86400000,\r\n sessionAsGuid: null,\r\n cookieDomain: cfgDfString(),\r\n namePrefix: cfgDfString(),\r\n enableApplicationInsightsTrace: false,\r\n enableApplicationInsightsUser: false,\r\n hashIdentifiers: false,\r\n dropIdentifiers: false,\r\n scrubIpOnly: false,\r\n callback: cfgDfMerge({\r\n userConsentDetails: null\r\n }),\r\n gpcDataSharingOptIn: undefValue,\r\n idLength: 22,\r\n enableDistributedTracing: false,\r\n eventContainExtFields: false // Added in v3.2.5\r\n});\r\nvar PropertiesPlugin = /** @class */ (function (_super) {\r\n __extends(PropertiesPlugin, _super);\r\n function PropertiesPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = \"SystemPropertiesCollector\";\r\n _this.priority = 3;\r\n _this.version = '4.0.2';\r\n // Do not set default values here, set them in the _initDefaults() which is also called during teardown()\r\n var _context;\r\n var _properties;\r\n var _config;\r\n dynamicProto(PropertiesPlugin, _this, function (_self, _base) {\r\n _initDefaults();\r\n _self.initialize = function (coreConfig, core, extensions) {\r\n _base.initialize(coreConfig, core, extensions);\r\n _populateDefaults(coreConfig);\r\n };\r\n /**\r\n * Process the event and add part A fields to it.\r\n * @param event - The event that needs to be stored.\r\n * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances\r\n * can optionally use this to access the current core instance or define / pass additional information\r\n * to later plugins (vs appending items to the telemetry item)\r\n */\r\n _self.processTelemetry = function (event, itemCtx) {\r\n setProcessTelemetryTimings(event, _self.identifier);\r\n itemCtx = _self._getTelCtx(itemCtx);\r\n var evtExt = event.ext = event.ext ? event.ext : {};\r\n event.data = event.data ? event.data : {};\r\n arrForEach(extensions, function (value) {\r\n evtExt[value] = evtExt[value] || {};\r\n });\r\n if (_context) {\r\n // Always apply the utc properties first as this sets the `ext.utc.eventFlags` which is required to tell\r\n // the collector to mask some fields\r\n _context.applyUtcContext(event);\r\n _context.applyApplicationContext(event);\r\n _context.applyUserContext(event);\r\n _context.applyWebContext(event);\r\n _context.applyOsContext(event);\r\n _context.applySdkContext(event);\r\n _context.applyIntWebContext(event);\r\n _context.applyLocContext(event);\r\n _context.applySessionContext(event);\r\n _context.applyDeviceContext(event);\r\n if (_config.enableApplicationInsightsTrace) {\r\n _context.applyAITraceContext(event);\r\n }\r\n if (_config.enableDistributedTracing) {\r\n _context.applyDistributedTraceContext(event);\r\n }\r\n _context.applyCloudContext(event);\r\n }\r\n // Delete empty ext fields\r\n arrForEach(objKeys(evtExt), function (key) {\r\n if (objKeys(evtExt[key]).length === 0) {\r\n delete evtExt[key];\r\n }\r\n });\r\n // Add custom properties\r\n _addPropertiesIfAbsent(_properties, event.data);\r\n _self.processNext(event, itemCtx);\r\n };\r\n /**\r\n * Get properties context to override or specify specific part A properties\r\n * @returns the Context\r\n */\r\n _self.getPropertiesContext = function () {\r\n return _context;\r\n };\r\n /**\r\n * Sets a custom property to be sent with every event. IEventProperty can be used to tag the property as\r\n * pii or customer content.\r\n * @param name - The name of the property.\r\n * @param value - The context property's value.\r\n */\r\n _self.setProperty = function (name, value) {\r\n _properties[name] = value;\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n var core = (unloadCtx || {}).core();\r\n if (core && core.getTraceCtx && _context) {\r\n var traceCtx = core.getTraceCtx(false);\r\n if (traceCtx && traceCtx === _context.getTraceCtx()) {\r\n core.setTraceCtx(null);\r\n }\r\n }\r\n _initDefaults();\r\n };\r\n _self[\"_getDbgPlgTargets\"] = function () {\r\n return [_config];\r\n };\r\n function _initDefaults() {\r\n _context = null;\r\n _properties = {};\r\n }\r\n function _populateDefaults(config) {\r\n var identifier = _self.identifier;\r\n var core = _self.core;\r\n // This function will be re-called whenever any referenced configuration is changed\r\n _self._addHook(onConfigChange(config, function () {\r\n var ctx = createProcessTelemetryContext(null, config, core);\r\n // Apply and re-apply defaults\r\n _config = ctx.getExtCfg(identifier, defaultPropertyConfig);\r\n }));\r\n // _context should be outside onConfigChange to avoid creating new instance every time\r\n _context = new TelemetryContext(config, _config, core, _self._unloadHooks);\r\n if (core && core.setTraceCtx) {\r\n core.setTraceCtx(_context.getTraceCtx());\r\n }\r\n }\r\n function _addPropertiesIfAbsent(inputMap, outputMap) {\r\n if (inputMap) {\r\n objForEachKey(inputMap, function (name, inputValue) {\r\n if (!outputMap[name]) {\r\n outputMap[name] = inputValue;\r\n }\r\n });\r\n }\r\n }\r\n });\r\n return _this;\r\n }\r\n// Removed Stub for PropertiesPlugin.prototype.initialize.\r\n// Removed Stub for PropertiesPlugin.prototype.processTelemetry.\r\n// Removed Stub for PropertiesPlugin.prototype.getPropertiesContext.\r\n// Removed Stub for PropertiesPlugin.prototype.setProperty.\r\n // This is a workaround for an IE8 bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n // this will be removed when ES3 support is dropped.\n PropertiesPlugin.__ieDyn=1;\n\n return PropertiesPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { PropertiesPlugin };\r\n//# sourceMappingURL=PropertiesPlugin.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n/**\r\n * This is an internal property used to cause internal (reporting) requests to be ignored from reporting\r\n * additional telemetry, to handle polyfil implementations ALL urls used with a disabled request will\r\n * also be ignored for future requests even when this property is not provided.\r\n * Tagging as Ignore as this is an internal value and is not expected to be used outside of the SDK\r\n * @ignore\r\n */\r\nexport var DisabledPropertyName = \"Microsoft_ApplicationInsights_BypassAjaxInstrumentation\";\r\nexport var SampleRate = \"sampleRate\";\r\nexport var ProcessLegacy = \"ProcessLegacy\";\r\nexport var HttpMethod = \"http.method\";\r\nexport var DEFAULT_BREEZE_ENDPOINT = \"https://dc.services.visualstudio.com\";\r\nexport var DEFAULT_BREEZE_PATH = \"/v2/track\";\r\nexport var strNotSpecified = \"not_specified\";\r\nexport var strIkey = \"iKey\";\r\n//# sourceMappingURL=Constants.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_SPLIT = \"split\"; // Count: 6\r\nexport var _DYN_LENGTH = \"length\"; // Count: 41\r\nexport var _DYN_TO_LOWER_CASE = \"toLowerCase\"; // Count: 6\r\nexport var _DYN_INGESTIONENDPOINT = \"ingestionendpoint\"; // Count: 4\r\nexport var _DYN_TO_STRING = \"toString\"; // Count: 9\r\nexport var _DYN_REMOVE_ITEM = \"removeItem\"; // Count: 3\r\nexport var _DYN_NAME = \"name\"; // Count: 11\r\nexport var _DYN_MESSAGE = \"message\"; // Count: 10\r\nexport var _DYN_COUNT = \"count\"; // Count: 8\r\nexport var _DYN_PRE_TRIGGER_DATE = \"preTriggerDate\"; // Count: 4\r\nexport var _DYN_DISABLED = \"disabled\"; // Count: 3\r\nexport var _DYN_INTERVAL = \"interval\"; // Count: 3\r\nexport var _DYN_DAYS_OF_MONTH = \"daysOfMonth\"; // Count: 3\r\nexport var _DYN_DATE = \"date\"; // Count: 5\r\nexport var _DYN_GET_UTCDATE = \"getUTCDate\"; // Count: 3\r\nexport var _DYN_STRINGIFY = \"stringify\"; // Count: 4\r\nexport var _DYN_PATHNAME = \"pathname\"; // Count: 4\r\nexport var _DYN_CORRELATION_HEADER_E0 = \"correlationHeaderExcludePatterns\"; // Count: 2\r\nexport var _DYN_EXTENSION_CONFIG = \"extensionConfig\"; // Count: 4\r\nexport var _DYN_EXCEPTIONS = \"exceptions\"; // Count: 6\r\nexport var _DYN_PARSED_STACK = \"parsedStack\"; // Count: 13\r\nexport var _DYN_PROPERTIES = \"properties\"; // Count: 9\r\nexport var _DYN_MEASUREMENTS = \"measurements\"; // Count: 9\r\nexport var _DYN_SIZE_IN_BYTES = \"sizeInBytes\"; // Count: 11\r\nexport var _DYN_TYPE_NAME = \"typeName\"; // Count: 11\r\nexport var _DYN_SEVERITY_LEVEL = \"severityLevel\"; // Count: 5\r\nexport var _DYN_PROBLEM_GROUP = \"problemGroup\"; // Count: 3\r\nexport var _DYN_IS_MANUAL = \"isManual\"; // Count: 3\r\nexport var _DYN__CREATE_FROM_INTERFA1 = \"CreateFromInterface\"; // Count: 2\r\nexport var _DYN_ASSEMBLY = \"assembly\"; // Count: 7\r\nexport var _DYN_FILE_NAME = \"fileName\"; // Count: 8\r\nexport var _DYN_HAS_FULL_STACK = \"hasFullStack\"; // Count: 6\r\nexport var _DYN_LEVEL = \"level\"; // Count: 5\r\nexport var _DYN_METHOD = \"method\"; // Count: 7\r\nexport var _DYN_LINE = \"line\"; // Count: 6\r\nexport var _DYN_DURATION = \"duration\"; // Count: 4\r\nexport var _DYN_RECEIVED_RESPONSE = \"receivedResponse\"; // Count: 2\r\n//# sourceMappingURL=__DynamicConstants.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { _throwInternal, getJSON, hasJSON, isObject, objForEachKey, strTrim } from \"@microsoft/applicationinsights-core-js\";\r\nimport { asString, strSubstr, strSubstring } from \"@nevware21/ts-utils\";\r\nimport { _DYN_LENGTH, _DYN_STRINGIFY, _DYN_TO_STRING } from \"../../__DynamicConstants\";\r\nexport function dataSanitizeKeyAndAddUniqueness(logger, key, map) {\r\n var origLength = key[_DYN_LENGTH /* @min:%2elength */];\r\n var field = dataSanitizeKey(logger, key);\r\n // validation truncated the length. We need to add uniqueness\r\n if (field[_DYN_LENGTH /* @min:%2elength */] !== origLength) {\r\n var i = 0;\r\n var uniqueField = field;\r\n while (map[uniqueField] !== undefined) {\r\n i++;\r\n uniqueField = strSubstring(field, 0, 150 /* DataSanitizerValues.MAX_NAME_LENGTH */ - 3) + dsPadNumber(i);\r\n }\r\n field = uniqueField;\r\n }\r\n return field;\r\n}\r\nexport function dataSanitizeKey(logger, name) {\r\n var nameTrunc;\r\n if (name) {\r\n // Remove any leading or trailing whitespace\r\n name = strTrim(asString(name));\r\n // truncate the string to 150 chars\r\n if (name[_DYN_LENGTH /* @min:%2elength */] > 150 /* DataSanitizerValues.MAX_NAME_LENGTH */) {\r\n nameTrunc = strSubstring(name, 0, 150 /* DataSanitizerValues.MAX_NAME_LENGTH */);\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 57 /* _eInternalMessageId.NameTooLong */, \"name is too long. It has been truncated to \" + 150 /* DataSanitizerValues.MAX_NAME_LENGTH */ + \" characters.\", { name: name }, true);\r\n }\r\n }\r\n return nameTrunc || name;\r\n}\r\nexport function dataSanitizeString(logger, value, maxLength) {\r\n if (maxLength === void 0) { maxLength = 1024 /* DataSanitizerValues.MAX_STRING_LENGTH */; }\r\n var valueTrunc;\r\n if (value) {\r\n maxLength = maxLength ? maxLength : 1024 /* DataSanitizerValues.MAX_STRING_LENGTH */; // in case default parameters dont work\r\n value = strTrim(asString(value));\r\n if (value[_DYN_LENGTH /* @min:%2elength */] > maxLength) {\r\n valueTrunc = strSubstring(value, 0, maxLength);\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 61 /* _eInternalMessageId.StringValueTooLong */, \"string value is too long. It has been truncated to \" + maxLength + \" characters.\", { value: value }, true);\r\n }\r\n }\r\n return valueTrunc || value;\r\n}\r\nexport function dataSanitizeUrl(logger, url) {\r\n return dataSanitizeInput(logger, url, 2048 /* DataSanitizerValues.MAX_URL_LENGTH */, 66 /* _eInternalMessageId.UrlTooLong */);\r\n}\r\nexport function dataSanitizeMessage(logger, message) {\r\n var messageTrunc;\r\n if (message) {\r\n if (message[_DYN_LENGTH /* @min:%2elength */] > 32768 /* DataSanitizerValues.MAX_MESSAGE_LENGTH */) {\r\n messageTrunc = strSubstring(message, 0, 32768 /* DataSanitizerValues.MAX_MESSAGE_LENGTH */);\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 56 /* _eInternalMessageId.MessageTruncated */, \"message is too long, it has been truncated to \" + 32768 /* DataSanitizerValues.MAX_MESSAGE_LENGTH */ + \" characters.\", { message: message }, true);\r\n }\r\n }\r\n return messageTrunc || message;\r\n}\r\nexport function dataSanitizeException(logger, exception) {\r\n var exceptionTrunc;\r\n if (exception) {\r\n // Make surte its a string\r\n var value = \"\" + exception;\r\n if (value[_DYN_LENGTH /* @min:%2elength */] > 32768 /* DataSanitizerValues.MAX_EXCEPTION_LENGTH */) {\r\n exceptionTrunc = strSubstring(value, 0, 32768 /* DataSanitizerValues.MAX_EXCEPTION_LENGTH */);\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 52 /* _eInternalMessageId.ExceptionTruncated */, \"exception is too long, it has been truncated to \" + 32768 /* DataSanitizerValues.MAX_EXCEPTION_LENGTH */ + \" characters.\", { exception: exception }, true);\r\n }\r\n }\r\n return exceptionTrunc || exception;\r\n}\r\nexport function dataSanitizeProperties(logger, properties) {\r\n if (properties) {\r\n var tempProps_1 = {};\r\n objForEachKey(properties, function (prop, value) {\r\n if (isObject(value) && hasJSON()) {\r\n // Stringify any part C properties\r\n try {\r\n value = getJSON()[_DYN_STRINGIFY /* @min:%2estringify */](value);\r\n }\r\n catch (e) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 49 /* _eInternalMessageId.CannotSerializeObjectNonSerializable */, \"custom property is not valid\", { exception: e }, true);\r\n }\r\n }\r\n value = dataSanitizeString(logger, value, 8192 /* DataSanitizerValues.MAX_PROPERTY_LENGTH */);\r\n prop = dataSanitizeKeyAndAddUniqueness(logger, prop, tempProps_1);\r\n tempProps_1[prop] = value;\r\n });\r\n properties = tempProps_1;\r\n }\r\n return properties;\r\n}\r\nexport function dataSanitizeMeasurements(logger, measurements) {\r\n if (measurements) {\r\n var tempMeasurements_1 = {};\r\n objForEachKey(measurements, function (measure, value) {\r\n measure = dataSanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements_1);\r\n tempMeasurements_1[measure] = value;\r\n });\r\n measurements = tempMeasurements_1;\r\n }\r\n return measurements;\r\n}\r\nexport function dataSanitizeId(logger, id) {\r\n return id ? dataSanitizeInput(logger, id, 128 /* DataSanitizerValues.MAX_ID_LENGTH */, 69 /* _eInternalMessageId.IdTooLong */)[_DYN_TO_STRING /* @min:%2etoString */]() : id;\r\n}\r\nexport function dataSanitizeInput(logger, input, maxLength, _msgId) {\r\n var inputTrunc;\r\n if (input) {\r\n input = strTrim(asString(input));\r\n if (input[_DYN_LENGTH /* @min:%2elength */] > maxLength) {\r\n inputTrunc = strSubstring(input, 0, maxLength);\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, _msgId, \"input is too long, it has been truncated to \" + maxLength + \" characters.\", { data: input }, true);\r\n }\r\n }\r\n return inputTrunc || input;\r\n}\r\nexport function dsPadNumber(num) {\r\n var s = \"00\" + num;\r\n return strSubstr(s, s[_DYN_LENGTH /* @min:%2elength */] - 3);\r\n}\r\n//# sourceMappingURL=DataSanitizer.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { getDocument, isString } from \"@microsoft/applicationinsights-core-js\";\r\nimport { _DYN_LENGTH, _DYN_PATHNAME, _DYN_TO_LOWER_CASE } from \"./__DynamicConstants\";\r\nvar _document = getDocument() || {};\r\nvar _htmlAnchorIdx = 0;\r\n// Use an array of temporary values as it's possible for multiple calls to parseUrl() will be called with different URLs\r\n// Using a cache size of 5 for now as it current depth usage is at least 2, so adding a minor buffer to handle future updates\r\nvar _htmlAnchorElement = [null, null, null, null, null];\r\nexport function urlParseUrl(url) {\r\n var anchorIdx = _htmlAnchorIdx;\r\n var anchorCache = _htmlAnchorElement;\r\n var tempAnchor = anchorCache[anchorIdx];\r\n if (!_document.createElement) {\r\n // Always create the temp instance if createElement is not available\r\n tempAnchor = { host: urlParseHost(url, true) };\r\n }\r\n else if (!anchorCache[anchorIdx]) {\r\n // Create and cache the unattached anchor instance\r\n tempAnchor = anchorCache[anchorIdx] = _document.createElement(\"a\");\r\n }\r\n tempAnchor.href = url;\r\n // Move the cache index forward\r\n anchorIdx++;\r\n if (anchorIdx >= anchorCache[_DYN_LENGTH /* @min:%2elength */]) {\r\n anchorIdx = 0;\r\n }\r\n _htmlAnchorIdx = anchorIdx;\r\n return tempAnchor;\r\n}\r\nexport function urlGetAbsoluteUrl(url) {\r\n var result;\r\n var a = urlParseUrl(url);\r\n if (a) {\r\n result = a.href;\r\n }\r\n return result;\r\n}\r\nexport function urlGetPathName(url) {\r\n var result;\r\n var a = urlParseUrl(url);\r\n if (a) {\r\n result = a[_DYN_PATHNAME /* @min:%2epathname */];\r\n }\r\n return result;\r\n}\r\nexport function urlGetCompleteUrl(method, absoluteUrl) {\r\n if (method) {\r\n return method.toUpperCase() + \" \" + absoluteUrl;\r\n }\r\n return absoluteUrl;\r\n}\r\n// Fallback method to grab host from url if document.createElement method is not available\r\nexport function urlParseHost(url, inclPort) {\r\n var fullHost = urlParseFullHost(url, inclPort) || \"\";\r\n if (fullHost) {\r\n var match = fullHost.match(/(www\\d{0,5}\\.)?([^\\/:]{1,256})(:\\d{1,20})?/i);\r\n if (match != null && match[_DYN_LENGTH /* @min:%2elength */] > 3 && isString(match[2]) && match[2][_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n return match[2] + (match[3] || \"\");\r\n }\r\n }\r\n return fullHost;\r\n}\r\nexport function urlParseFullHost(url, inclPort) {\r\n var result = null;\r\n if (url) {\r\n var match = url.match(/(\\w{1,150}):\\/\\/([^\\/:]{1,256})(:\\d{1,20})?/i);\r\n if (match != null && match[_DYN_LENGTH /* @min:%2elength */] > 2 && isString(match[2]) && match[2][_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n result = match[2] || \"\";\r\n if (inclPort && match[_DYN_LENGTH /* @min:%2elength */] > 2) {\r\n var protocol = (match[1] || \"\")[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n var port = match[3] || \"\";\r\n // IE includes the standard port so pass it off if it's the same as the protocol\r\n if (protocol === \"http\" && port === \":80\") {\r\n port = \"\";\r\n }\r\n else if (protocol === \"https\" && port === \":443\") {\r\n port = \"\";\r\n }\r\n result += port;\r\n }\r\n }\r\n }\r\n return result;\r\n}\r\n//# sourceMappingURL=UrlHelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, arrIndexOf, dateNow, getPerformance, isNullOrUndefined, isValidSpanId, isValidTraceId } from \"@microsoft/applicationinsights-core-js\";\r\nimport { strIndexOf } from \"@nevware21/ts-utils\";\r\nimport { DEFAULT_BREEZE_ENDPOINT, DEFAULT_BREEZE_PATH } from \"./Constants\";\r\nimport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nimport { dataSanitizeString } from \"./Telemetry/Common/DataSanitizer\";\r\nimport { urlParseFullHost, urlParseUrl } from \"./UrlHelperFuncs\";\r\nimport { _DYN_CORRELATION_HEADER_E0, _DYN_LENGTH, _DYN_NAME, _DYN_PATHNAME, _DYN_SPLIT, _DYN_TO_LOWER_CASE } from \"./__DynamicConstants\";\r\n// listing only non-geo specific locations\r\nvar _internalEndpoints = [\r\n DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH,\r\n \"https://breeze.aimon.applicationinsights.io\" + DEFAULT_BREEZE_PATH,\r\n \"https://dc-int.services.visualstudio.com\" + DEFAULT_BREEZE_PATH\r\n];\r\nvar _correlationIdPrefix = \"cid-v1:\";\r\nexport function isInternalApplicationInsightsEndpoint(endpointUrl) {\r\n return arrIndexOf(_internalEndpoints, endpointUrl[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]()) !== -1;\r\n}\r\nexport function correlationIdSetPrefix(prefix) {\r\n _correlationIdPrefix = prefix;\r\n}\r\nexport function correlationIdGetPrefix() {\r\n return _correlationIdPrefix;\r\n}\r\n/**\r\n * Checks if a request url is not on a excluded domain list and if it is safe to add correlation headers.\r\n * Headers are always included if the current domain matches the request domain. If they do not match (CORS),\r\n * they are regex-ed across correlationHeaderDomains and correlationHeaderExcludedDomains to determine if headers are included.\r\n * Some environments don't give information on currentHost via window.location.host (e.g. Cordova). In these cases, the user must\r\n * manually supply domains to include correlation headers on. Else, no headers will be included at all.\r\n */\r\nexport function correlationIdCanIncludeCorrelationHeader(config, requestUrl, currentHost) {\r\n if (!requestUrl || (config && config.disableCorrelationHeaders)) {\r\n return false;\r\n }\r\n if (config && config[_DYN_CORRELATION_HEADER_E0 /* @min:%2ecorrelationHeaderExcludePatterns */]) {\r\n for (var i = 0; i < config.correlationHeaderExcludePatterns[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n if (config[_DYN_CORRELATION_HEADER_E0 /* @min:%2ecorrelationHeaderExcludePatterns */][i].test(requestUrl)) {\r\n return false;\r\n }\r\n }\r\n }\r\n var requestHost = urlParseUrl(requestUrl).host[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n if (requestHost && (strIndexOf(requestHost, \":443\") !== -1 || strIndexOf(requestHost, \":80\") !== -1)) {\r\n // [Bug #1260] IE can include the port even for http and https URLs so if present\r\n // try and parse it to remove if it matches the default protocol port\r\n requestHost = (urlParseFullHost(requestUrl, true) || \"\")[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();\r\n }\r\n if ((!config || !config.enableCorsCorrelation) && (requestHost && requestHost !== currentHost)) {\r\n return false;\r\n }\r\n var includedDomains = config && config.correlationHeaderDomains;\r\n if (includedDomains) {\r\n var matchExists_1;\r\n arrForEach(includedDomains, function (domain) {\r\n var regex = new RegExp(domain.toLowerCase().replace(/\\\\/g, \"\\\\\\\\\").replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\"));\r\n matchExists_1 = matchExists_1 || regex.test(requestHost);\r\n });\r\n if (!matchExists_1) {\r\n return false;\r\n }\r\n }\r\n var excludedDomains = config && config.correlationHeaderExcludedDomains;\r\n if (!excludedDomains || excludedDomains[_DYN_LENGTH /* @min:%2elength */] === 0) {\r\n return true;\r\n }\r\n for (var i = 0; i < excludedDomains[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var regex = new RegExp(excludedDomains[i].toLowerCase().replace(/\\\\/g, \"\\\\\\\\\").replace(/\\./g, \"\\\\.\").replace(/\\*/g, \".*\"));\r\n if (regex.test(requestHost)) {\r\n return false;\r\n }\r\n }\r\n // if we don't know anything about the requestHost, require the user to use included/excludedDomains.\r\n // Previously we always returned false for a falsy requestHost\r\n return requestHost && requestHost[_DYN_LENGTH /* @min:%2elength */] > 0;\r\n}\r\n/**\r\n * Combines target appId and target role name from response header.\r\n */\r\nexport function correlationIdGetCorrelationContext(responseHeader) {\r\n if (responseHeader) {\r\n var correlationId = correlationIdGetCorrelationContextValue(responseHeader, RequestHeaders[1 /* eRequestHeaders.requestContextTargetKey */]);\r\n if (correlationId && correlationId !== _correlationIdPrefix) {\r\n return correlationId;\r\n }\r\n }\r\n}\r\n/**\r\n * Gets key from correlation response header\r\n */\r\nexport function correlationIdGetCorrelationContextValue(responseHeader, key) {\r\n if (responseHeader) {\r\n var keyValues = responseHeader[_DYN_SPLIT /* @min:%2esplit */](\",\");\r\n for (var i = 0; i < keyValues[_DYN_LENGTH /* @min:%2elength */]; ++i) {\r\n var keyValue = keyValues[i][_DYN_SPLIT /* @min:%2esplit */](\"=\");\r\n if (keyValue[_DYN_LENGTH /* @min:%2elength */] === 2 && keyValue[0] === key) {\r\n return keyValue[1];\r\n }\r\n }\r\n }\r\n}\r\nexport function AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName) {\r\n var target, name = commandName, data = commandName;\r\n if (absoluteUrl && absoluteUrl[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n var parsedUrl = urlParseUrl(absoluteUrl);\r\n target = parsedUrl.host;\r\n if (!name) {\r\n if (parsedUrl[_DYN_PATHNAME /* @min:%2epathname */] != null) {\r\n var pathName = (parsedUrl.pathname[_DYN_LENGTH /* @min:%2elength */] === 0) ? \"/\" : parsedUrl[_DYN_PATHNAME /* @min:%2epathname */];\r\n if (pathName.charAt(0) !== \"/\") {\r\n pathName = \"/\" + pathName;\r\n }\r\n data = parsedUrl[_DYN_PATHNAME /* @min:%2epathname */];\r\n name = dataSanitizeString(logger, method ? method + \" \" + pathName : pathName);\r\n }\r\n else {\r\n name = dataSanitizeString(logger, absoluteUrl);\r\n }\r\n }\r\n }\r\n else {\r\n target = commandName;\r\n name = commandName;\r\n }\r\n return {\r\n target: target,\r\n name: name,\r\n data: data\r\n };\r\n}\r\nexport function dateTimeUtilsNow() {\r\n // returns the window or webworker performance object\r\n var perf = getPerformance();\r\n if (perf && perf.now && perf.timing) {\r\n var now = perf.now() + perf.timing.navigationStart;\r\n // Known issue with IE where this calculation can be negative, so if it is then ignore and fallback\r\n if (now > 0) {\r\n return now;\r\n }\r\n }\r\n return dateNow();\r\n}\r\nexport function dateTimeUtilsDuration(start, end) {\r\n var result = null;\r\n if (start !== 0 && end !== 0 && !isNullOrUndefined(start) && !isNullOrUndefined(end)) {\r\n result = end - start;\r\n }\r\n return result;\r\n}\r\n/**\r\n * Creates a IDistributedTraceContext from an optional telemetryTrace\r\n * @param telemetryTrace - The telemetryTrace instance that is being wrapped\r\n * @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.\r\n * @returns A new IDistributedTraceContext instance that is backed by the telemetryTrace or temporary object\r\n */\r\nexport function createDistributedTraceContextFromTrace(telemetryTrace, parentCtx) {\r\n var trace = telemetryTrace || {};\r\n return {\r\n getName: function () {\r\n return trace[_DYN_NAME /* @min:%2ename */];\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace[_DYN_NAME /* @min:%2ename */] = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace.traceID;\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace.traceID = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace.parentID;\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace.parentID = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace.traceFlags;\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace.traceFlags = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=Util.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { createEnumStyle } from \"@microsoft/applicationinsights-core-js\";\r\nexport var StorageType = createEnumStyle({\r\n LocalStorage: 0 /* eStorageType.LocalStorage */,\r\n SessionStorage: 1 /* eStorageType.SessionStorage */\r\n});\r\nexport var DistributedTracingModes = createEnumStyle({\r\n AI: 0 /* eDistributedTracingModes.AI */,\r\n AI_AND_W3C: 1 /* eDistributedTracingModes.AI_AND_W3C */,\r\n W3C: 2 /* eDistributedTracingModes.W3C */\r\n});\r\n//# sourceMappingURL=Enums.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { _throwInternal, dumpObj, getExceptionName, getGlobal, getGlobalInst, isNullOrUndefined, objForEachKey } from \"@microsoft/applicationinsights-core-js\";\r\nimport { StorageType } from \"./Enums\";\r\nimport { _DYN_REMOVE_ITEM, _DYN_TO_STRING } from \"./__DynamicConstants\";\r\nvar _canUseLocalStorage = undefined;\r\nvar _canUseSessionStorage = undefined;\r\nvar _storagePrefix = \"\";\r\n/**\r\n * Gets the localStorage object if available\r\n * @return {Storage} - Returns the storage object if available else returns null\r\n */\r\nfunction _getLocalStorageObject() {\r\n if (utlCanUseLocalStorage()) {\r\n return _getVerifiedStorageObject(StorageType.LocalStorage);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Tests storage object (localStorage or sessionStorage) to verify that it is usable\r\n * More details here: https://mathiasbynens.be/notes/localstorage-pattern\r\n * @param storageType - Type of storage\r\n * @return {Storage} Returns storage object verified that it is usable\r\n */\r\nfunction _getVerifiedStorageObject(storageType) {\r\n try {\r\n if (isNullOrUndefined(getGlobal())) {\r\n return null;\r\n }\r\n var uid = (new Date)[_DYN_TO_STRING /* @min:%2etoString */]();\r\n var storage = getGlobalInst(storageType === StorageType.LocalStorage ? \"localStorage\" : \"sessionStorage\");\r\n var name_1 = _storagePrefix + uid;\r\n storage.setItem(name_1, uid);\r\n var fail = storage.getItem(name_1) !== uid;\r\n storage[_DYN_REMOVE_ITEM /* @min:%2eremoveItem */](name_1);\r\n if (!fail) {\r\n return storage;\r\n }\r\n }\r\n catch (exception) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n return null;\r\n}\r\n/**\r\n * Gets the sessionStorage object if available\r\n * @return {Storage} - Returns the storage object if available else returns null\r\n */\r\nfunction _getSessionStorageObject() {\r\n if (utlCanUseSessionStorage()) {\r\n return _getVerifiedStorageObject(StorageType.SessionStorage);\r\n }\r\n return null;\r\n}\r\n/**\r\n * Disables the global SDK usage of local or session storage if available\r\n */\r\nexport function utlDisableStorage() {\r\n _canUseLocalStorage = false;\r\n _canUseSessionStorage = false;\r\n}\r\nexport function utlSetStoragePrefix(storagePrefix) {\r\n _storagePrefix = storagePrefix || \"\";\r\n}\r\n/**\r\n * Re-enables the global SDK usage of local or session storage if available\r\n */\r\nexport function utlEnableStorage() {\r\n _canUseLocalStorage = utlCanUseLocalStorage(true);\r\n _canUseSessionStorage = utlCanUseSessionStorage(true);\r\n}\r\n/**\r\n * Returns whether LocalStorage can be used, if the reset parameter is passed a true this will override\r\n * any previous disable calls.\r\n * @param reset - Should the usage be reset and determined only based on whether LocalStorage is available\r\n */\r\nexport function utlCanUseLocalStorage(reset) {\r\n if (reset || _canUseLocalStorage === undefined) {\r\n _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);\r\n }\r\n return _canUseLocalStorage;\r\n}\r\nexport function utlGetLocalStorage(logger, name) {\r\n var storage = _getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n return storage.getItem(name);\r\n }\r\n catch (e) {\r\n _canUseLocalStorage = false;\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 1 /* _eInternalMessageId.BrowserCannotReadLocalStorage */, \"Browser failed read of local storage. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return null;\r\n}\r\nexport function utlSetLocalStorage(logger, name, data) {\r\n var storage = _getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.setItem(name, data);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseLocalStorage = false;\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 3 /* _eInternalMessageId.BrowserCannotWriteLocalStorage */, \"Browser failed write to local storage. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return false;\r\n}\r\nexport function utlRemoveStorage(logger, name) {\r\n var storage = _getLocalStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage[_DYN_REMOVE_ITEM /* @min:%2eremoveItem */](name);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseLocalStorage = false;\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 5 /* _eInternalMessageId.BrowserFailedRemovalFromLocalStorage */, \"Browser failed removal of local storage item. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return false;\r\n}\r\nexport function utlCanUseSessionStorage(reset) {\r\n if (reset || _canUseSessionStorage === undefined) {\r\n _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);\r\n }\r\n return _canUseSessionStorage;\r\n}\r\nexport function utlGetSessionStorageKeys() {\r\n var keys = [];\r\n if (utlCanUseSessionStorage()) {\r\n objForEachKey(getGlobalInst(\"sessionStorage\"), function (key) {\r\n keys.push(key);\r\n });\r\n }\r\n return keys;\r\n}\r\nexport function utlGetSessionStorage(logger, name) {\r\n var storage = _getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n return storage.getItem(name);\r\n }\r\n catch (e) {\r\n _canUseSessionStorage = false;\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 2 /* _eInternalMessageId.BrowserCannotReadSessionStorage */, \"Browser failed read of session storage. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return null;\r\n}\r\nexport function utlSetSessionStorage(logger, name, data) {\r\n var storage = _getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage.setItem(name, data);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseSessionStorage = false;\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 4 /* _eInternalMessageId.BrowserCannotWriteSessionStorage */, \"Browser failed write to session storage. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return false;\r\n}\r\nexport function utlRemoveSessionStorage(logger, name) {\r\n var storage = _getSessionStorageObject();\r\n if (storage !== null) {\r\n try {\r\n storage[_DYN_REMOVE_ITEM /* @min:%2eremoveItem */](name);\r\n return true;\r\n }\r\n catch (e) {\r\n _canUseSessionStorage = false;\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 6 /* _eInternalMessageId.BrowserFailedRemovalFromSessionStorage */, \"Browser failed removal of session storage item. \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n }\r\n return false;\r\n}\r\n//# sourceMappingURL=StorageHelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { strNotSpecified } from \"../Constants\";\r\nimport { _DYN_MEASUREMENTS, _DYN_NAME, _DYN_PROPERTIES } from \"../__DynamicConstants\";\r\nimport { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString } from \"./Common/DataSanitizer\";\r\nvar Event = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the EventTelemetry object\r\n */\r\n function Event(logger, name, properties, measurements) {\r\n this.aiDataContract = {\r\n ver: 1 /* FieldType.Required */,\r\n name: 1 /* FieldType.Required */,\r\n properties: 0 /* FieldType.Default */,\r\n measurements: 0 /* FieldType.Default */\r\n };\r\n var _self = this;\r\n _self.ver = 2;\r\n _self[_DYN_NAME /* @min:%2ename */] = dataSanitizeString(logger, name) || strNotSpecified;\r\n _self[_DYN_PROPERTIES /* @min:%2eproperties */] = dataSanitizeProperties(logger, properties);\r\n _self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = dataSanitizeMeasurements(logger, measurements);\r\n }\r\n Event.envelopeType = \"Microsoft.ApplicationInsights.{0}.Event\";\r\n Event.dataType = \"EventData\";\r\n return Event;\r\n}());\r\nexport { Event };\r\n//# sourceMappingURL=Event.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { __assignFn as __assign } from \"@microsoft/applicationinsights-shims\";\r\nimport { arrForEach, arrMap, isArray, isError, isFunction, isNullOrUndefined, isObject, isString, strTrim } from \"@microsoft/applicationinsights-core-js\";\r\nimport { strIndexOf } from \"@nevware21/ts-utils\";\r\nimport { strNotSpecified } from \"../Constants\";\r\nimport { _DYN_ASSEMBLY, _DYN_EXCEPTIONS, _DYN_FILE_NAME, _DYN_HAS_FULL_STACK, _DYN_IS_MANUAL, _DYN_LENGTH, _DYN_LEVEL, _DYN_LINE, _DYN_MEASUREMENTS, _DYN_MESSAGE, _DYN_METHOD, _DYN_NAME, _DYN_PARSED_STACK, _DYN_PROBLEM_GROUP, _DYN_PROPERTIES, _DYN_SEVERITY_LEVEL, _DYN_SIZE_IN_BYTES, _DYN_SPLIT, _DYN_STRINGIFY, _DYN_TO_STRING, _DYN_TYPE_NAME, _DYN__CREATE_FROM_INTERFA1 } from \"../__DynamicConstants\";\r\nimport { dataSanitizeException, dataSanitizeMeasurements, dataSanitizeMessage, dataSanitizeProperties, dataSanitizeString } from \"./Common/DataSanitizer\";\r\nvar NoMethod = \"\";\r\nvar strError = \"error\";\r\nvar strStack = \"stack\";\r\nvar strStackDetails = \"stackDetails\";\r\nvar strErrorSrc = \"errorSrc\";\r\nvar strMessage = \"message\";\r\nvar strDescription = \"description\";\r\nfunction _stringify(value, convertToString) {\r\n var result = value;\r\n if (result && !isString(result)) {\r\n if (JSON && JSON[_DYN_STRINGIFY /* @min:%2estringify */]) {\r\n result = JSON[_DYN_STRINGIFY /* @min:%2estringify */](value);\r\n if (convertToString && (!result || result === \"{}\")) {\r\n if (isFunction(value[_DYN_TO_STRING /* @min:%2etoString */])) {\r\n result = value[_DYN_TO_STRING /* @min:%2etoString */]();\r\n }\r\n else {\r\n result = \"\" + value;\r\n }\r\n }\r\n }\r\n else {\r\n result = \"\" + value + \" - (Missing JSON.stringify)\";\r\n }\r\n }\r\n return result || \"\";\r\n}\r\nfunction _formatMessage(theEvent, errorType) {\r\n var evtMessage = theEvent;\r\n if (theEvent) {\r\n if (evtMessage && !isString(evtMessage)) {\r\n evtMessage = theEvent[strMessage] || theEvent[strDescription] || evtMessage;\r\n }\r\n // Make sure the message is a string\r\n if (evtMessage && !isString(evtMessage)) {\r\n // tslint:disable-next-line: prefer-conditional-expression\r\n evtMessage = _stringify(evtMessage, true);\r\n }\r\n if (theEvent[\"filename\"]) {\r\n // Looks like an event object with filename\r\n evtMessage = evtMessage + \" @\" + (theEvent[\"filename\"] || \"\") + \":\" + (theEvent[\"lineno\"] || \"?\") + \":\" + (theEvent[\"colno\"] || \"?\");\r\n }\r\n }\r\n // Automatically add the error type to the message if it does already appear to be present\r\n if (errorType && errorType !== \"String\" && errorType !== \"Object\" && errorType !== \"Error\" && strIndexOf(evtMessage || \"\", errorType) === -1) {\r\n evtMessage = errorType + \": \" + evtMessage;\r\n }\r\n return evtMessage || \"\";\r\n}\r\nfunction _isExceptionDetailsInternal(value) {\r\n try {\r\n if (isObject(value)) {\r\n return \"hasFullStack\" in value && \"typeName\" in value;\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 return false;\r\n}\r\nfunction _isExceptionInternal(value) {\r\n try {\r\n if (isObject(value)) {\r\n return (\"ver\" in value && \"exceptions\" in value && \"properties\" in value);\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 return false;\r\n}\r\nfunction _isStackDetails(details) {\r\n return details && details.src && isString(details.src) && details.obj && isArray(details.obj);\r\n}\r\nfunction _convertStackObj(errorStack) {\r\n var src = errorStack || \"\";\r\n if (!isString(src)) {\r\n if (isString(src[strStack])) {\r\n src = src[strStack];\r\n }\r\n else {\r\n src = \"\" + src;\r\n }\r\n }\r\n var items = src[_DYN_SPLIT /* @min:%2esplit */](\"\\n\");\r\n return {\r\n src: src,\r\n obj: items\r\n };\r\n}\r\nfunction _getOperaStack(errorMessage) {\r\n var stack = [];\r\n var lines = errorMessage[_DYN_SPLIT /* @min:%2esplit */](\"\\n\");\r\n for (var lp = 0; lp < lines[_DYN_LENGTH /* @min:%2elength */]; lp++) {\r\n var entry = lines[lp];\r\n if (lines[lp + 1]) {\r\n entry += \"@\" + lines[lp + 1];\r\n lp++;\r\n }\r\n stack.push(entry);\r\n }\r\n return {\r\n src: errorMessage,\r\n obj: stack\r\n };\r\n}\r\nfunction _getStackFromErrorObj(errorObj) {\r\n var details = null;\r\n if (errorObj) {\r\n try {\r\n /* Using bracket notation is support older browsers (IE 7/8 -- dont remember the version) that throw when using dot\r\n notation for undefined objects and we don't want to loose the error from being reported */\r\n if (errorObj[strStack]) {\r\n // Chrome/Firefox\r\n details = _convertStackObj(errorObj[strStack]);\r\n }\r\n else if (errorObj[strError] && errorObj[strError][strStack]) {\r\n // Edge error event provides the stack and error object\r\n details = _convertStackObj(errorObj[strError][strStack]);\r\n }\r\n else if (errorObj[\"exception\"] && errorObj.exception[strStack]) {\r\n details = _convertStackObj(errorObj.exception[strStack]);\r\n }\r\n else if (_isStackDetails(errorObj)) {\r\n details = errorObj;\r\n }\r\n else if (_isStackDetails(errorObj[strStackDetails])) {\r\n details = errorObj[strStackDetails];\r\n }\r\n else if (window && window[\"opera\"] && errorObj[strMessage]) {\r\n // Opera\r\n details = _getOperaStack(errorObj[_DYN_MESSAGE /* @min:%2emessage */]);\r\n }\r\n else if (errorObj[\"reason\"] && errorObj.reason[strStack]) {\r\n // UnhandledPromiseRejection\r\n details = _convertStackObj(errorObj.reason[strStack]);\r\n }\r\n else if (isString(errorObj)) {\r\n details = _convertStackObj(errorObj);\r\n }\r\n else {\r\n var evtMessage = errorObj[strMessage] || errorObj[strDescription] || \"\";\r\n if (isString(errorObj[strErrorSrc])) {\r\n if (evtMessage) {\r\n evtMessage += \"\\n\";\r\n }\r\n evtMessage += \" from \" + errorObj[strErrorSrc];\r\n }\r\n if (evtMessage) {\r\n details = _convertStackObj(evtMessage);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // something unexpected happened so to avoid failing to report any error lets swallow the exception\r\n // and fallback to the callee/caller method\r\n details = _convertStackObj(e);\r\n }\r\n }\r\n return details || {\r\n src: \"\",\r\n obj: null\r\n };\r\n}\r\nfunction _formatStackTrace(stackDetails) {\r\n var stack = \"\";\r\n if (stackDetails) {\r\n if (stackDetails.obj) {\r\n arrForEach(stackDetails.obj, function (entry) {\r\n stack += entry + \"\\n\";\r\n });\r\n }\r\n else {\r\n stack = stackDetails.src || \"\";\r\n }\r\n }\r\n return stack;\r\n}\r\nfunction _parseStack(stack) {\r\n var parsedStack;\r\n var frames = stack.obj;\r\n if (frames && frames[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n parsedStack = [];\r\n var level_1 = 0;\r\n var totalSizeInBytes_1 = 0;\r\n arrForEach(frames, function (frame) {\r\n var theFrame = frame[_DYN_TO_STRING /* @min:%2etoString */]();\r\n if (_StackFrame.regex.test(theFrame)) {\r\n var parsedFrame = new _StackFrame(theFrame, level_1++);\r\n totalSizeInBytes_1 += parsedFrame[_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */];\r\n parsedStack.push(parsedFrame);\r\n }\r\n });\r\n // DP Constraint - exception parsed stack must be < 32KB\r\n // remove frames from the middle to meet the threshold\r\n var exceptionParsedStackThreshold = 32 * 1024;\r\n if (totalSizeInBytes_1 > exceptionParsedStackThreshold) {\r\n var left = 0;\r\n var right = parsedStack[_DYN_LENGTH /* @min:%2elength */] - 1;\r\n var size = 0;\r\n var acceptedLeft = left;\r\n var acceptedRight = right;\r\n while (left < right) {\r\n // check size\r\n var lSize = parsedStack[left][_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */];\r\n var rSize = parsedStack[right][_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */];\r\n size += lSize + rSize;\r\n if (size > exceptionParsedStackThreshold) {\r\n // remove extra frames from the middle\r\n var howMany = acceptedRight - acceptedLeft + 1;\r\n parsedStack.splice(acceptedLeft, howMany);\r\n break;\r\n }\r\n // update pointers\r\n acceptedLeft = left;\r\n acceptedRight = right;\r\n left++;\r\n right--;\r\n }\r\n }\r\n }\r\n return parsedStack;\r\n}\r\nfunction _getErrorType(errorType) {\r\n // Gets the Error Type by passing the constructor (used to get the true type of native error object).\r\n var typeName = \"\";\r\n if (errorType) {\r\n typeName = errorType.typeName || errorType[_DYN_NAME /* @min:%2ename */] || \"\";\r\n if (!typeName) {\r\n try {\r\n var funcNameRegex = /function (.{1,200})\\(/;\r\n var results = (funcNameRegex).exec((errorType).constructor[_DYN_TO_STRING /* @min:%2etoString */]());\r\n typeName = (results && results[_DYN_LENGTH /* @min:%2elength */] > 1) ? results[1] : \"\";\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty -- Ignoring any failures as nothing we can do\r\n }\r\n }\r\n }\r\n return typeName;\r\n}\r\n/**\r\n * Formats the provided errorObj for display and reporting, it may be a String, Object, integer or undefined depending on the browser.\r\n * @param errorObj - The supplied errorObj\r\n */\r\nexport function _formatErrorCode(errorObj) {\r\n if (errorObj) {\r\n try {\r\n if (!isString(errorObj)) {\r\n var errorType = _getErrorType(errorObj);\r\n var result = _stringify(errorObj, false);\r\n if (!result || result === \"{}\") {\r\n if (errorObj[strError]) {\r\n // Looks like an MS Error Event\r\n errorObj = errorObj[strError];\r\n errorType = _getErrorType(errorObj);\r\n }\r\n result = _stringify(errorObj, true);\r\n }\r\n if (strIndexOf(result, errorType) !== 0 && errorType !== \"String\") {\r\n return errorType + \":\" + result;\r\n }\r\n return result;\r\n }\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty -- Ignoring any failures as nothing we can do\r\n }\r\n }\r\n // Fallback to just letting the object format itself into a string\r\n return \"\" + (errorObj || \"\");\r\n}\r\nvar Exception = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the ExceptionTelemetry object\r\n */\r\n function Exception(logger, exception, properties, measurements, severityLevel, id) {\r\n this.aiDataContract = {\r\n ver: 1 /* FieldType.Required */,\r\n exceptions: 1 /* FieldType.Required */,\r\n severityLevel: 0 /* FieldType.Default */,\r\n properties: 0 /* FieldType.Default */,\r\n measurements: 0 /* FieldType.Default */\r\n };\r\n var _self = this;\r\n _self.ver = 2; // TODO: handle the CS\"4.0\" ==> breeze 2 conversion in a better way\r\n if (!_isExceptionInternal(exception)) {\r\n if (!properties) {\r\n properties = {};\r\n }\r\n _self[_DYN_EXCEPTIONS /* @min:%2eexceptions */] = [new _ExceptionDetails(logger, exception, properties)];\r\n _self[_DYN_PROPERTIES /* @min:%2eproperties */] = dataSanitizeProperties(logger, properties);\r\n _self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = dataSanitizeMeasurements(logger, measurements);\r\n if (severityLevel) {\r\n _self[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */] = severityLevel;\r\n }\r\n if (id) {\r\n _self.id = id;\r\n }\r\n }\r\n else {\r\n _self[_DYN_EXCEPTIONS /* @min:%2eexceptions */] = exception[_DYN_EXCEPTIONS /* @min:%2eexceptions */] || [];\r\n _self[_DYN_PROPERTIES /* @min:%2eproperties */] = exception[_DYN_PROPERTIES /* @min:%2eproperties */];\r\n _self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = exception[_DYN_MEASUREMENTS /* @min:%2emeasurements */];\r\n if (exception[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */]) {\r\n _self[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */] = exception[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */];\r\n }\r\n if (exception.id) {\r\n _self.id = exception.id;\r\n }\r\n if (exception[_DYN_PROBLEM_GROUP /* @min:%2eproblemGroup */]) {\r\n _self[_DYN_PROBLEM_GROUP /* @min:%2eproblemGroup */] = exception[_DYN_PROBLEM_GROUP /* @min:%2eproblemGroup */];\r\n }\r\n // bool/int types, use isNullOrUndefined\r\n if (!isNullOrUndefined(exception[_DYN_IS_MANUAL /* @min:%2eisManual */])) {\r\n _self[_DYN_IS_MANUAL /* @min:%2eisManual */] = exception[_DYN_IS_MANUAL /* @min:%2eisManual */];\r\n }\r\n }\r\n }\r\n Exception.CreateAutoException = function (message, url, lineNumber, columnNumber, error, evt, stack, errorSrc) {\r\n var _a;\r\n var errorType = _getErrorType(error || evt || message);\r\n return _a = {},\r\n _a[_DYN_MESSAGE /* @min:message */] = _formatMessage(message, errorType),\r\n _a.url = url,\r\n _a.lineNumber = lineNumber,\r\n _a.columnNumber = columnNumber,\r\n _a.error = _formatErrorCode(error || evt || message),\r\n _a.evt = _formatErrorCode(evt || message),\r\n _a[_DYN_TYPE_NAME /* @min:typeName */] = errorType,\r\n _a.stackDetails = _getStackFromErrorObj(stack || error || evt),\r\n _a.errorSrc = errorSrc,\r\n _a;\r\n };\r\n Exception.CreateFromInterface = function (logger, exception, properties, measurements) {\r\n var exceptions = exception[_DYN_EXCEPTIONS /* @min:%2eexceptions */]\r\n && arrMap(exception[_DYN_EXCEPTIONS /* @min:%2eexceptions */], function (ex) { return _ExceptionDetails[_DYN__CREATE_FROM_INTERFA1 /* @min:%2eCreateFromInterface */](logger, ex); });\r\n var exceptionData = new Exception(logger, __assign(__assign({}, exception), { exceptions: exceptions }), properties, measurements);\r\n return exceptionData;\r\n };\r\n Exception.prototype.toInterface = function () {\r\n var _a;\r\n var _b = this, exceptions = _b.exceptions, properties = _b.properties, measurements = _b.measurements, severityLevel = _b.severityLevel, problemGroup = _b.problemGroup, id = _b.id, isManual = _b.isManual;\r\n var exceptionDetailsInterface = exceptions instanceof Array\r\n && arrMap(exceptions, function (exception) { return exception.toInterface(); })\r\n || undefined;\r\n return _a = {\r\n ver: \"4.0\"\r\n },\r\n _a[_DYN_EXCEPTIONS /* @min:exceptions */] = exceptionDetailsInterface,\r\n _a.severityLevel = severityLevel,\r\n _a.properties = properties,\r\n _a.measurements = measurements,\r\n _a.problemGroup = problemGroup,\r\n _a.id = id,\r\n _a.isManual = isManual,\r\n _a;\r\n };\r\n /**\r\n * Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.\r\n */\r\n Exception.CreateSimpleException = function (message, typeName, assembly, fileName, details, line) {\r\n var _a;\r\n return {\r\n exceptions: [\r\n (_a = {},\r\n _a[_DYN_HAS_FULL_STACK /* @min:hasFullStack */] = true,\r\n _a.message = message,\r\n _a.stack = details,\r\n _a.typeName = typeName,\r\n _a)\r\n ]\r\n };\r\n };\r\n Exception.envelopeType = \"Microsoft.ApplicationInsights.{0}.Exception\";\r\n Exception.dataType = \"ExceptionData\";\r\n Exception.formatError = _formatErrorCode;\r\n return Exception;\r\n}());\r\nexport { Exception };\r\nvar _ExceptionDetails = /** @class */ (function () {\r\n function _ExceptionDetails(logger, exception, properties) {\r\n this.aiDataContract = {\r\n id: 0 /* FieldType.Default */,\r\n outerId: 0 /* FieldType.Default */,\r\n typeName: 1 /* FieldType.Required */,\r\n message: 1 /* FieldType.Required */,\r\n hasFullStack: 0 /* FieldType.Default */,\r\n stack: 0 /* FieldType.Default */,\r\n parsedStack: 2 /* FieldType.Array */\r\n };\r\n var _self = this;\r\n if (!_isExceptionDetailsInternal(exception)) {\r\n var error = exception;\r\n var evt = error && error.evt;\r\n if (!isError(error)) {\r\n error = error[strError] || evt || error;\r\n }\r\n _self[_DYN_TYPE_NAME /* @min:%2etypeName */] = dataSanitizeString(logger, _getErrorType(error)) || strNotSpecified;\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] = dataSanitizeMessage(logger, _formatMessage(exception || error, _self[_DYN_TYPE_NAME /* @min:%2etypeName */])) || strNotSpecified;\r\n var stack = exception[strStackDetails] || _getStackFromErrorObj(exception);\r\n _self[_DYN_PARSED_STACK /* @min:%2eparsedStack */] = _parseStack(stack);\r\n // after parsedStack is inited, iterate over each frame object, sanitize its assembly field\r\n if (isArray(_self[_DYN_PARSED_STACK /* @min:%2eparsedStack */])) {\r\n arrMap(_self[_DYN_PARSED_STACK /* @min:%2eparsedStack */], function (frame) {\r\n frame[_DYN_ASSEMBLY /* @min:%2eassembly */] = dataSanitizeString(logger, frame[_DYN_ASSEMBLY /* @min:%2eassembly */]);\r\n frame[_DYN_FILE_NAME /* @min:%2efileName */] = dataSanitizeString(logger, frame[_DYN_FILE_NAME /* @min:%2efileName */]);\r\n });\r\n }\r\n _self[strStack] = dataSanitizeException(logger, _formatStackTrace(stack));\r\n _self.hasFullStack = isArray(_self.parsedStack) && _self.parsedStack[_DYN_LENGTH /* @min:%2elength */] > 0;\r\n if (properties) {\r\n properties[_DYN_TYPE_NAME /* @min:%2etypeName */] = properties[_DYN_TYPE_NAME /* @min:%2etypeName */] || _self[_DYN_TYPE_NAME /* @min:%2etypeName */];\r\n }\r\n }\r\n else {\r\n _self[_DYN_TYPE_NAME /* @min:%2etypeName */] = exception[_DYN_TYPE_NAME /* @min:%2etypeName */];\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] = exception[_DYN_MESSAGE /* @min:%2emessage */];\r\n _self[strStack] = exception[strStack];\r\n _self[_DYN_PARSED_STACK /* @min:%2eparsedStack */] = exception[_DYN_PARSED_STACK /* @min:%2eparsedStack */] || [];\r\n _self[_DYN_HAS_FULL_STACK /* @min:%2ehasFullStack */] = exception[_DYN_HAS_FULL_STACK /* @min:%2ehasFullStack */];\r\n }\r\n }\r\n _ExceptionDetails.prototype.toInterface = function () {\r\n var _a;\r\n var _self = this;\r\n var parsedStack = _self[_DYN_PARSED_STACK /* @min:%2eparsedStack */] instanceof Array\r\n && arrMap(_self[_DYN_PARSED_STACK /* @min:%2eparsedStack */], function (frame) { return frame.toInterface(); });\r\n var exceptionDetailsInterface = (_a = {\r\n id: _self.id,\r\n outerId: _self.outerId,\r\n typeName: _self[_DYN_TYPE_NAME /* @min:%2etypeName */],\r\n message: _self[_DYN_MESSAGE /* @min:%2emessage */],\r\n hasFullStack: _self[_DYN_HAS_FULL_STACK /* @min:%2ehasFullStack */],\r\n stack: _self[strStack]\r\n },\r\n _a[_DYN_PARSED_STACK /* @min:parsedStack */] = parsedStack || undefined,\r\n _a);\r\n return exceptionDetailsInterface;\r\n };\r\n _ExceptionDetails.CreateFromInterface = function (logger, exception) {\r\n var parsedStack = (exception[_DYN_PARSED_STACK /* @min:%2eparsedStack */] instanceof Array\r\n && arrMap(exception[_DYN_PARSED_STACK /* @min:%2eparsedStack */], function (frame) { return _StackFrame[_DYN__CREATE_FROM_INTERFA1 /* @min:%2eCreateFromInterface */](frame); }))\r\n || exception[_DYN_PARSED_STACK /* @min:%2eparsedStack */];\r\n var exceptionDetails = new _ExceptionDetails(logger, __assign(__assign({}, exception), { parsedStack: parsedStack }));\r\n return exceptionDetails;\r\n };\r\n return _ExceptionDetails;\r\n}());\r\nexport { _ExceptionDetails };\r\nvar _StackFrame = /** @class */ (function () {\r\n function _StackFrame(sourceFrame, level) {\r\n this.aiDataContract = {\r\n level: 1 /* FieldType.Required */,\r\n method: 1 /* FieldType.Required */,\r\n assembly: 0 /* FieldType.Default */,\r\n fileName: 0 /* FieldType.Default */,\r\n line: 0 /* FieldType.Default */\r\n };\r\n var _self = this;\r\n _self[_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */] = 0;\r\n // Not converting this to isString() as typescript uses this logic to \"understand\" the different\r\n // types for the 2 different code paths\r\n if (typeof sourceFrame === \"string\") {\r\n var frame = sourceFrame;\r\n _self[_DYN_LEVEL /* @min:%2elevel */] = level;\r\n _self[_DYN_METHOD /* @min:%2emethod */] = NoMethod;\r\n _self[_DYN_ASSEMBLY /* @min:%2eassembly */] = strTrim(frame);\r\n _self[_DYN_FILE_NAME /* @min:%2efileName */] = \"\";\r\n _self[_DYN_LINE /* @min:%2eline */] = 0;\r\n var matches = frame.match(_StackFrame.regex);\r\n if (matches && matches[_DYN_LENGTH /* @min:%2elength */] >= 5) {\r\n _self[_DYN_METHOD /* @min:%2emethod */] = strTrim(matches[2]) || _self[_DYN_METHOD /* @min:%2emethod */];\r\n _self[_DYN_FILE_NAME /* @min:%2efileName */] = strTrim(matches[4]);\r\n _self[_DYN_LINE /* @min:%2eline */] = parseInt(matches[5]) || 0;\r\n }\r\n }\r\n else {\r\n _self[_DYN_LEVEL /* @min:%2elevel */] = sourceFrame[_DYN_LEVEL /* @min:%2elevel */];\r\n _self[_DYN_METHOD /* @min:%2emethod */] = sourceFrame[_DYN_METHOD /* @min:%2emethod */];\r\n _self[_DYN_ASSEMBLY /* @min:%2eassembly */] = sourceFrame[_DYN_ASSEMBLY /* @min:%2eassembly */];\r\n _self[_DYN_FILE_NAME /* @min:%2efileName */] = sourceFrame[_DYN_FILE_NAME /* @min:%2efileName */];\r\n _self[_DYN_LINE /* @min:%2eline */] = sourceFrame[_DYN_LINE /* @min:%2eline */];\r\n _self[_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */] = 0;\r\n }\r\n _self.sizeInBytes += _self.method[_DYN_LENGTH /* @min:%2elength */];\r\n _self.sizeInBytes += _self.fileName[_DYN_LENGTH /* @min:%2elength */];\r\n _self.sizeInBytes += _self.assembly[_DYN_LENGTH /* @min:%2elength */];\r\n // todo: these might need to be removed depending on how the back-end settles on their size calculation\r\n _self[_DYN_SIZE_IN_BYTES /* @min:%2esizeInBytes */] += _StackFrame.baseSize;\r\n _self.sizeInBytes += _self.level.toString()[_DYN_LENGTH /* @min:%2elength */];\r\n _self.sizeInBytes += _self.line.toString()[_DYN_LENGTH /* @min:%2elength */];\r\n }\r\n _StackFrame.CreateFromInterface = function (frame) {\r\n return new _StackFrame(frame, null /* level is available in frame interface */);\r\n };\r\n _StackFrame.prototype.toInterface = function () {\r\n var _self = this;\r\n return {\r\n level: _self[_DYN_LEVEL /* @min:%2elevel */],\r\n method: _self[_DYN_METHOD /* @min:%2emethod */],\r\n assembly: _self[_DYN_ASSEMBLY /* @min:%2eassembly */],\r\n fileName: _self[_DYN_FILE_NAME /* @min:%2efileName */],\r\n line: _self[_DYN_LINE /* @min:%2eline */]\r\n };\r\n };\r\n // regex to match stack frames from ie/chrome/ff\r\n // methodName=$2, fileName=$4, lineNo=$5, column=$6\r\n _StackFrame.regex = /^([\\s]+at)?[\\s]{0,50}([^\\@\\()]+?)[\\s]{0,50}(\\@|\\()([^\\(\\n]+):([0-9]+):([0-9]+)(\\)?)$/;\r\n _StackFrame.baseSize = 58; // '{\"method\":\"\",\"level\":,\"assembly\":\"\",\"fileName\":\"\",\"line\":}'.length\r\n return _StackFrame;\r\n}());\r\nexport { _StackFrame };\r\n//# sourceMappingURL=Exception.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nvar DataPoint = /** @class */ (function () {\r\n function DataPoint() {\r\n /**\r\n * The data contract for serializing this object.\r\n */\r\n this.aiDataContract = {\r\n name: 1 /* FieldType.Required */,\r\n kind: 0 /* FieldType.Default */,\r\n value: 1 /* FieldType.Required */,\r\n count: 0 /* FieldType.Default */,\r\n min: 0 /* FieldType.Default */,\r\n max: 0 /* FieldType.Default */,\r\n stdDev: 0 /* FieldType.Default */\r\n };\r\n /**\r\n * Metric type. Single measurement or the aggregated value.\r\n */\r\n this.kind = 0 /* DataPointType.Measurement */;\r\n }\r\n return DataPoint;\r\n}());\r\nexport { DataPoint };\r\n//# sourceMappingURL=DataPoint.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { strNotSpecified } from \"../Constants\";\r\nimport { _DYN_COUNT, _DYN_MEASUREMENTS, _DYN_NAME, _DYN_PROPERTIES } from \"../__DynamicConstants\";\r\nimport { DataPoint } from \"./Common/DataPoint\";\r\nimport { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString } from \"./Common/DataSanitizer\";\r\nvar Metric = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the MetricTelemetry object\r\n */\r\n function Metric(logger, name, value, count, min, max, stdDev, properties, measurements) {\r\n this.aiDataContract = {\r\n ver: 1 /* FieldType.Required */,\r\n metrics: 1 /* FieldType.Required */,\r\n properties: 0 /* FieldType.Default */\r\n };\r\n var _self = this;\r\n _self.ver = 2;\r\n var dataPoint = new DataPoint();\r\n dataPoint[_DYN_COUNT /* @min:%2ecount */] = count > 0 ? count : undefined;\r\n dataPoint.max = isNaN(max) || max === null ? undefined : max;\r\n dataPoint.min = isNaN(min) || min === null ? undefined : min;\r\n dataPoint[_DYN_NAME /* @min:%2ename */] = dataSanitizeString(logger, name) || strNotSpecified;\r\n dataPoint.value = value;\r\n dataPoint.stdDev = isNaN(stdDev) || stdDev === null ? undefined : stdDev;\r\n _self.metrics = [dataPoint];\r\n _self[_DYN_PROPERTIES /* @min:%2eproperties */] = dataSanitizeProperties(logger, properties);\r\n _self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = dataSanitizeMeasurements(logger, measurements);\r\n }\r\n Metric.envelopeType = \"Microsoft.ApplicationInsights.{0}.Metric\";\r\n Metric.dataType = \"MetricData\";\r\n return Metric;\r\n}());\r\nexport { Metric };\r\n//# sourceMappingURL=Metric.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { arrForEach, isString } from \"@microsoft/applicationinsights-core-js\";\r\nimport { _DYN_LENGTH, _DYN_TO_LOWER_CASE } from \"./__DynamicConstants\";\r\nvar strEmpty = \"\";\r\nexport function stringToBoolOrDefault(str, defaultValue) {\r\n if (defaultValue === void 0) { defaultValue = false; }\r\n if (str === undefined || str === null) {\r\n return defaultValue;\r\n }\r\n return str.toString()[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === \"true\";\r\n}\r\n/**\r\n * Convert ms to c# time span format\r\n */\r\nexport function msToTimeSpan(totalms) {\r\n if (isNaN(totalms) || totalms < 0) {\r\n totalms = 0;\r\n }\r\n totalms = Math.round(totalms);\r\n var ms = strEmpty + totalms % 1000;\r\n var sec = strEmpty + Math.floor(totalms / 1000) % 60;\r\n var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;\r\n var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;\r\n var days = Math.floor(totalms / (1000 * 60 * 60 * 24));\r\n ms = ms[_DYN_LENGTH /* @min:%2elength */] === 1 ? \"00\" + ms : ms[_DYN_LENGTH /* @min:%2elength */] === 2 ? \"0\" + ms : ms;\r\n sec = sec[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + sec : sec;\r\n min = min[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + min : min;\r\n hour = hour[_DYN_LENGTH /* @min:%2elength */] < 2 ? \"0\" + hour : hour;\r\n return (days > 0 ? days + \".\" : strEmpty) + hour + \":\" + min + \":\" + sec + \".\" + ms;\r\n}\r\nexport function getExtensionByName(extensions, identifier) {\r\n var extension = null;\r\n arrForEach(extensions, function (value) {\r\n if (value.identifier === identifier) {\r\n extension = value;\r\n return -1;\r\n }\r\n });\r\n return extension;\r\n}\r\nexport function isCrossOriginError(message, url, lineNumber, columnNumber, error) {\r\n return !error && isString(message) && (message === \"Script error.\" || message === \"Script error\");\r\n}\r\n//# sourceMappingURL=HelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { strNotSpecified } from \"../Constants\";\r\nimport { msToTimeSpan } from \"../HelperFuncs\";\r\nimport { _DYN_DURATION, _DYN_MEASUREMENTS, _DYN_NAME, _DYN_PROPERTIES } from \"../__DynamicConstants\";\r\nimport { dataSanitizeId, dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from \"./Common/DataSanitizer\";\r\nvar PageView = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the PageEventTelemetry object\r\n */\r\n function PageView(logger, name, url, durationMs, properties, measurements, id) {\r\n this.aiDataContract = {\r\n ver: 1 /* FieldType.Required */,\r\n name: 0 /* FieldType.Default */,\r\n url: 0 /* FieldType.Default */,\r\n duration: 0 /* FieldType.Default */,\r\n properties: 0 /* FieldType.Default */,\r\n measurements: 0 /* FieldType.Default */,\r\n id: 0 /* FieldType.Default */\r\n };\r\n var _self = this;\r\n _self.ver = 2;\r\n _self.id = dataSanitizeId(logger, id);\r\n _self.url = dataSanitizeUrl(logger, url);\r\n _self[_DYN_NAME /* @min:%2ename */] = dataSanitizeString(logger, name) || strNotSpecified;\r\n if (!isNaN(durationMs)) {\r\n _self[_DYN_DURATION /* @min:%2eduration */] = msToTimeSpan(durationMs);\r\n }\r\n _self[_DYN_PROPERTIES /* @min:%2eproperties */] = dataSanitizeProperties(logger, properties);\r\n _self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = dataSanitizeMeasurements(logger, measurements);\r\n }\r\n PageView.envelopeType = \"Microsoft.ApplicationInsights.{0}.Pageview\";\r\n PageView.dataType = \"PageviewData\";\r\n return PageView;\r\n}());\r\nexport { PageView };\r\n//# sourceMappingURL=PageView.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { msToTimeSpan } from \"../HelperFuncs\";\r\nimport { AjaxHelperParseDependencyPath } from \"../Util\";\r\nimport { _DYN_DURATION, _DYN_MEASUREMENTS, _DYN_NAME, _DYN_PROPERTIES } from \"../__DynamicConstants\";\r\nimport { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from \"./Common/DataSanitizer\";\r\nvar RemoteDependencyData = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the RemoteDependencyData object\r\n */\r\n function RemoteDependencyData(logger, id, absoluteUrl, commandName, value, success, resultCode, method, requestAPI, correlationContext, properties, measurements) {\r\n if (requestAPI === void 0) { requestAPI = \"Ajax\"; }\r\n this.aiDataContract = {\r\n id: 1 /* FieldType.Required */,\r\n ver: 1 /* FieldType.Required */,\r\n name: 0 /* FieldType.Default */,\r\n resultCode: 0 /* FieldType.Default */,\r\n duration: 0 /* FieldType.Default */,\r\n success: 0 /* FieldType.Default */,\r\n data: 0 /* FieldType.Default */,\r\n target: 0 /* FieldType.Default */,\r\n type: 0 /* FieldType.Default */,\r\n properties: 0 /* FieldType.Default */,\r\n measurements: 0 /* FieldType.Default */,\r\n kind: 0 /* FieldType.Default */,\r\n value: 0 /* FieldType.Default */,\r\n count: 0 /* FieldType.Default */,\r\n min: 0 /* FieldType.Default */,\r\n max: 0 /* FieldType.Default */,\r\n stdDev: 0 /* FieldType.Default */,\r\n dependencyKind: 0 /* FieldType.Default */,\r\n dependencySource: 0 /* FieldType.Default */,\r\n commandName: 0 /* FieldType.Default */,\r\n dependencyTypeName: 0 /* FieldType.Default */\r\n };\r\n var _self = this;\r\n _self.ver = 2;\r\n _self.id = id;\r\n _self[_DYN_DURATION /* @min:%2eduration */] = msToTimeSpan(value);\r\n _self.success = success;\r\n _self.resultCode = resultCode + \"\";\r\n _self.type = dataSanitizeString(logger, requestAPI);\r\n var dependencyFields = AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName);\r\n _self.data = dataSanitizeUrl(logger, commandName) || dependencyFields.data; // get a value from hosturl if commandName not available\r\n _self.target = dataSanitizeString(logger, dependencyFields.target);\r\n if (correlationContext) {\r\n _self.target = \"\".concat(_self.target, \" | \").concat(correlationContext);\r\n }\r\n _self[_DYN_NAME /* @min:%2ename */] = dataSanitizeString(logger, dependencyFields[_DYN_NAME /* @min:%2ename */]);\r\n _self[_DYN_PROPERTIES /* @min:%2eproperties */] = dataSanitizeProperties(logger, properties);\r\n _self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = dataSanitizeMeasurements(logger, measurements);\r\n }\r\n RemoteDependencyData.envelopeType = \"Microsoft.ApplicationInsights.{0}.RemoteDependency\";\r\n RemoteDependencyData.dataType = \"RemoteDependencyData\";\r\n return RemoteDependencyData;\r\n}());\r\nexport { RemoteDependencyData };\r\n//# sourceMappingURL=RemoteDependencyData.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { strNotSpecified } from \"../Constants\";\r\nimport { _DYN_MEASUREMENTS, _DYN_MESSAGE, _DYN_PROPERTIES, _DYN_SEVERITY_LEVEL } from \"../__DynamicConstants\";\r\nimport { dataSanitizeMeasurements, dataSanitizeMessage, dataSanitizeProperties } from \"./Common/DataSanitizer\";\r\nvar Trace = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the TraceTelemetry object\r\n */\r\n function Trace(logger, message, severityLevel, properties, measurements) {\r\n this.aiDataContract = {\r\n ver: 1 /* FieldType.Required */,\r\n message: 1 /* FieldType.Required */,\r\n severityLevel: 0 /* FieldType.Default */,\r\n properties: 0 /* FieldType.Default */\r\n };\r\n var _self = this;\r\n _self.ver = 2;\r\n message = message || strNotSpecified;\r\n _self[_DYN_MESSAGE /* @min:%2emessage */] = dataSanitizeMessage(logger, message);\r\n _self[_DYN_PROPERTIES /* @min:%2eproperties */] = dataSanitizeProperties(logger, properties);\r\n _self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = dataSanitizeMeasurements(logger, measurements);\r\n if (severityLevel) {\r\n _self[_DYN_SEVERITY_LEVEL /* @min:%2eseverityLevel */] = severityLevel;\r\n }\r\n }\r\n Trace.envelopeType = \"Microsoft.ApplicationInsights.{0}.Message\";\r\n Trace.dataType = \"MessageData\";\r\n return Trace;\r\n}());\r\nexport { Trace };\r\n//# sourceMappingURL=Trace.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { strNotSpecified } from \"../Constants\";\r\nimport { _DYN_DURATION, _DYN_MEASUREMENTS, _DYN_NAME, _DYN_PROPERTIES, _DYN_RECEIVED_RESPONSE } from \"../__DynamicConstants\";\r\nimport { dataSanitizeMeasurements, dataSanitizeProperties, dataSanitizeString, dataSanitizeUrl } from \"./Common/DataSanitizer\";\r\nvar PageViewPerformance = /** @class */ (function () {\r\n /**\r\n * Constructs a new instance of the PageEventTelemetry object\r\n */\r\n function PageViewPerformance(logger, name, url, unused, properties, measurements, cs4BaseData) {\r\n this.aiDataContract = {\r\n ver: 1 /* FieldType.Required */,\r\n name: 0 /* FieldType.Default */,\r\n url: 0 /* FieldType.Default */,\r\n duration: 0 /* FieldType.Default */,\r\n perfTotal: 0 /* FieldType.Default */,\r\n networkConnect: 0 /* FieldType.Default */,\r\n sentRequest: 0 /* FieldType.Default */,\r\n receivedResponse: 0 /* FieldType.Default */,\r\n domProcessing: 0 /* FieldType.Default */,\r\n properties: 0 /* FieldType.Default */,\r\n measurements: 0 /* FieldType.Default */\r\n };\r\n var _self = this;\r\n _self.ver = 2;\r\n _self.url = dataSanitizeUrl(logger, url);\r\n _self[_DYN_NAME /* @min:%2ename */] = dataSanitizeString(logger, name) || strNotSpecified;\r\n _self[_DYN_PROPERTIES /* @min:%2eproperties */] = dataSanitizeProperties(logger, properties);\r\n _self[_DYN_MEASUREMENTS /* @min:%2emeasurements */] = dataSanitizeMeasurements(logger, measurements);\r\n if (cs4BaseData) {\r\n _self.domProcessing = cs4BaseData.domProcessing;\r\n _self[_DYN_DURATION /* @min:%2eduration */] = cs4BaseData[_DYN_DURATION /* @min:%2eduration */];\r\n _self.networkConnect = cs4BaseData.networkConnect;\r\n _self.perfTotal = cs4BaseData.perfTotal;\r\n _self[_DYN_RECEIVED_RESPONSE /* @min:%2ereceivedResponse */] = cs4BaseData[_DYN_RECEIVED_RESPONSE /* @min:%2ereceivedResponse */];\r\n _self.sentRequest = cs4BaseData.sentRequest;\r\n }\r\n }\r\n PageViewPerformance.envelopeType = \"Microsoft.ApplicationInsights.{0}.PageviewPerformance\";\r\n PageViewPerformance.dataType = \"PageviewPerformanceData\";\r\n return PageViewPerformance;\r\n}());\r\nexport { PageViewPerformance };\r\n//# sourceMappingURL=PageViewPerformance.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { isNullOrUndefined, objForEachKey, throwError, toISOString } from \"@microsoft/applicationinsights-core-js\";\r\nimport { strIkey, strNotSpecified } from \"./Constants\";\r\nimport { dataSanitizeString } from \"./Telemetry/Common/DataSanitizer\";\r\nimport { _DYN_NAME } from \"./__DynamicConstants\";\r\n/**\r\n * Create a telemetry item that the 1DS channel understands\r\n * @param item - domain specific properties; part B\r\n * @param baseType - telemetry item type. ie PageViewData\r\n * @param envelopeName - name of the envelope. ie Microsoft.ApplicationInsights..PageView\r\n * @param customProperties - user defined custom properties; part C\r\n * @param systemProperties - system properties that are added to the context; part A\r\n * @returns ITelemetryItem that is sent to channel\r\n */\r\nexport function createTelemetryItem(item, baseType, envelopeName, logger, customProperties, systemProperties) {\r\n var _a;\r\n envelopeName = dataSanitizeString(logger, envelopeName) || strNotSpecified;\r\n if (isNullOrUndefined(item) ||\r\n isNullOrUndefined(baseType) ||\r\n isNullOrUndefined(envelopeName)) {\r\n throwError(\"Input doesn't contain all required fields\");\r\n }\r\n var iKey = \"\";\r\n if (item[strIkey]) {\r\n iKey = item[strIkey];\r\n delete item[strIkey];\r\n }\r\n var telemetryItem = (_a = {},\r\n _a[_DYN_NAME /* @min:name */] = envelopeName,\r\n _a.time = toISOString(new Date()),\r\n _a.iKey = iKey,\r\n _a.ext = systemProperties ? systemProperties : {},\r\n _a.tags = [],\r\n _a.data = {},\r\n _a.baseType = baseType,\r\n _a.baseData = item // Part B\r\n ,\r\n _a);\r\n // Part C\r\n if (!isNullOrUndefined(customProperties)) {\r\n objForEachKey(customProperties, function (prop, value) {\r\n telemetryItem.data[prop] = value;\r\n });\r\n }\r\n return telemetryItem;\r\n}\r\nvar TelemetryItemCreator = /** @class */ (function () {\r\n function TelemetryItemCreator() {\r\n }\r\n /**\r\n * Create a telemetry item that the 1DS channel understands\r\n * @param item - domain specific properties; part B\r\n * @param baseType - telemetry item type. ie PageViewData\r\n * @param envelopeName - name of the envelope. ie Microsoft.ApplicationInsights..PageView\r\n * @param customProperties - user defined custom properties; part C\r\n * @param systemProperties - system properties that are added to the context; part A\r\n * @returns ITelemetryItem that is sent to channel\r\n */\r\n TelemetryItemCreator.create = createTelemetryItem;\r\n return TelemetryItemCreator;\r\n}());\r\nexport { TelemetryItemCreator };\r\n//# sourceMappingURL=TelemetryItemCreator.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { getDocument, isFunction } from \"@microsoft/applicationinsights-core-js\";\r\nexport function createDomEvent(eventName) {\r\n var event = null;\r\n if (isFunction(Event)) { // Use Event constructor when available\r\n event = new Event(eventName);\r\n }\r\n else { // Event has no constructor in IE\r\n var doc = getDocument();\r\n if (doc && doc.createEvent) {\r\n event = doc.createEvent(\"Event\");\r\n event.initEvent(eventName, true, true);\r\n }\r\n }\r\n return event;\r\n}\r\n//# sourceMappingURL=DomHelperFuncs.js.map","/*\n * Application Insights JavaScript SDK - Common, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n// Licensed under the\r\nexport { correlationIdSetPrefix, correlationIdGetPrefix, correlationIdCanIncludeCorrelationHeader, correlationIdGetCorrelationContext, correlationIdGetCorrelationContextValue, dateTimeUtilsNow, dateTimeUtilsDuration, isInternalApplicationInsightsEndpoint, createDistributedTraceContextFromTrace } from \"./Util\";\r\nexport { ThrottleMgr } from \"./ThrottleMgr\";\r\nexport { parseConnectionString, ConnectionStringParser } from \"./ConnectionStringParser\";\r\nexport { RequestHeaders } from \"./RequestResponseHeaders\";\r\nexport { DisabledPropertyName, ProcessLegacy, SampleRate, HttpMethod, DEFAULT_BREEZE_ENDPOINT, DEFAULT_BREEZE_PATH, strNotSpecified } from \"./Constants\";\r\nexport { Envelope } from \"./Telemetry/Common/Envelope\";\r\nexport { Event } from \"./Telemetry/Event\";\r\nexport { Exception } from \"./Telemetry/Exception\";\r\nexport { Metric } from \"./Telemetry/Metric\";\r\nexport { PageView } from \"./Telemetry/PageView\";\r\nexport { RemoteDependencyData } from \"./Telemetry/RemoteDependencyData\";\r\nexport { Trace } from \"./Telemetry/Trace\";\r\nexport { PageViewPerformance } from \"./Telemetry/PageViewPerformance\";\r\nexport { Data } from \"./Telemetry/Common/Data\";\r\nexport { SeverityLevel } from \"./Interfaces/Contracts/SeverityLevel\";\r\nexport { ConfigurationManager } from \"./Interfaces/IConfig\";\r\nexport { ContextTagKeys } from \"./Interfaces/Contracts/ContextTagKeys\";\r\nexport { dataSanitizeKeyAndAddUniqueness, dataSanitizeKey, dataSanitizeString, dataSanitizeUrl, dataSanitizeMessage, dataSanitizeException, dataSanitizeProperties, dataSanitizeMeasurements, dataSanitizeId, dataSanitizeInput, dsPadNumber } from \"./Telemetry/Common/DataSanitizer\";\r\nexport { TelemetryItemCreator, createTelemetryItem } from \"./TelemetryItemCreator\";\r\nexport { CtxTagKeys, Extensions } from \"./Interfaces/PartAExtensions\";\r\nexport { DistributedTracingModes } from \"./Enums\";\r\nexport { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from \"./HelperFuncs\";\r\nexport { isBeaconsSupported as isBeaconApiSupported, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from \"@microsoft/applicationinsights-core-js\";\r\nexport { createDomEvent } from \"./DomHelperFuncs\";\r\nexport { utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage, utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage, utlSetStoragePrefix } from \"./StorageHelperFuncs\";\r\nexport { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from \"./UrlHelperFuncs\";\r\nexport var PropertiesPluginIdentifier = \"AppInsightsPropertiesPlugin\";\r\nexport var BreezeChannelIdentifier = \"AppInsightsChannelPlugin\";\r\nexport var AnalyticsPluginIdentifier = \"ApplicationInsightsAnalytics\";\r\n//# sourceMappingURL=applicationinsights-common.js.map","/*\n * Application Insights JavaScript SDK - Web Analytics, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_TO_STRING = \"toString\"; // Count: 4\r\nexport var _DYN_IS_STORAGE_USE_DISAB0 = \"isStorageUseDisabled\"; // Count: 3\r\nexport var _DYN__ADD_HOOK = \"_addHook\"; // Count: 6\r\nexport var _DYN_CORE = \"core\"; // Count: 7\r\nexport var _DYN_DATA_TYPE = \"dataType\"; // Count: 8\r\nexport var _DYN_ENVELOPE_TYPE = \"envelopeType\"; // Count: 7\r\nexport var _DYN_DIAG_LOG = \"diagLog\"; // Count: 13\r\nexport var _DYN_TRACK = \"track\"; // Count: 7\r\nexport var _DYN_TRACK_PAGE_VIEW = \"trackPageView\"; // Count: 4\r\nexport var _DYN_TRACK_PREVIOUS_PAGE_1 = \"trackPreviousPageVisit\"; // Count: 3\r\nexport var _DYN_SEND_PAGE_VIEW_INTER2 = \"sendPageViewInternal\"; // Count: 7\r\nexport var _DYN_GET_ENTRIES_BY_TYPE = \"getEntriesByType\"; // Count: 5\r\nexport var _DYN_START_TIME = \"startTime\"; // Count: 4\r\nexport var _DYN_DURATION = \"duration\"; // Count: 11\r\nexport var _DYN_SEND_PAGE_VIEW_PERFO3 = \"sendPageViewPerformanceInternal\"; // Count: 3\r\nexport var _DYN_POPULATE_PAGE_VIEW_P4 = \"populatePageViewPerformanceEvent\"; // Count: 3\r\nexport var _DYN_HREF = \"href\"; // Count: 6\r\nexport var _DYN_SEND_EXCEPTION_INTER5 = \"sendExceptionInternal\"; // Count: 2\r\nexport var _DYN_EXCEPTION = \"exception\"; // Count: 3\r\nexport var _DYN_ERROR = \"error\"; // Count: 5\r\nexport var _DYN__ONERROR = \"_onerror\"; // Count: 3\r\nexport var _DYN_ERROR_SRC = \"errorSrc\"; // Count: 3\r\nexport var _DYN_LINE_NUMBER = \"lineNumber\"; // Count: 5\r\nexport var _DYN_COLUMN_NUMBER = \"columnNumber\"; // Count: 5\r\nexport var _DYN_MESSAGE = \"message\"; // Count: 4\r\nexport var _DYN__CREATE_AUTO_EXCEPTI6 = \"CreateAutoException\"; // Count: 3\r\nexport var _DYN_ADD_TELEMETRY_INITIA7 = \"addTelemetryInitializer\"; // Count: 4\r\nexport var _DYN_OVERRIDE_PAGE_VIEW_D8 = \"overridePageViewDuration\"; // Count: 2\r\nexport var _DYN_AUTO_TRACK_PAGE_VISI9 = \"autoTrackPageVisitTime\"; // Count: 2\r\nexport var _DYN_IS_BROWSER_LINK_TRAC10 = \"isBrowserLinkTrackingEnabled\"; // Count: 2\r\nexport var _DYN_LENGTH = \"length\"; // Count: 5\r\nexport var _DYN_ENABLE_AUTO_ROUTE_TR11 = \"enableAutoRouteTracking\"; // Count: 2\r\nexport var _DYN_ENABLE_UNHANDLED_PRO12 = \"enableUnhandledPromiseRejectionTracking\"; // Count: 2\r\nexport var _DYN_AUTO_UNHANDLED_PROMI13 = \"autoUnhandledPromiseInstrumented\"; // Count: 3\r\nexport var _DYN_IS_PERFORMANCE_TIMIN14 = \"isPerformanceTimingSupported\"; // Count: 2\r\nexport var _DYN_GET_PERFORMANCE_TIMI15 = \"getPerformanceTiming\"; // Count: 2\r\nexport var _DYN_NAVIGATION_START = \"navigationStart\"; // Count: 4\r\nexport var _DYN_SHOULD_COLLECT_DURAT16 = \"shouldCollectDuration\"; // Count: 3\r\nexport var _DYN_IS_PERFORMANCE_TIMIN17 = \"isPerformanceTimingDataReady\"; // Count: 2\r\nexport var _DYN_RESPONSE_START = \"responseStart\"; // Count: 5\r\nexport var _DYN_REQUEST_START = \"requestStart\"; // Count: 3\r\nexport var _DYN_LOAD_EVENT_END = \"loadEventEnd\"; // Count: 4\r\nexport var _DYN_RESPONSE_END = \"responseEnd\"; // Count: 5\r\nexport var _DYN_CONNECT_END = \"connectEnd\"; // Count: 4\r\nexport var _DYN_PAGE_VISIT_START_TIM18 = \"pageVisitStartTime\"; // Count: 2\r\n//# sourceMappingURL=__DynamicConstants.js.map","/*\n * Application Insights JavaScript SDK - Web Analytics, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { dateTimeUtilsDuration } from \"@microsoft/applicationinsights-common\";\r\nimport { _throwInternal, arrForEach, dumpObj, getDocument, getExceptionName, getLocation, isNullOrUndefined } from \"@microsoft/applicationinsights-core-js\";\r\nimport { isWebWorker, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { _DYN_DURATION, _DYN_GET_PERFORMANCE_TIMI15, _DYN_HREF, _DYN_IS_PERFORMANCE_TIMIN14, _DYN_IS_PERFORMANCE_TIMIN17, _DYN_LENGTH, _DYN_NAVIGATION_START, _DYN_POPULATE_PAGE_VIEW_P4, _DYN_SEND_PAGE_VIEW_INTER2, _DYN_SEND_PAGE_VIEW_PERFO3, _DYN_SHOULD_COLLECT_DURAT16, _DYN_TRACK_PAGE_VIEW } from \"../../__DynamicConstants\";\r\n/**\r\n * Class encapsulates sending page views and page view performance telemetry.\r\n */\r\nvar PageViewManager = /** @class */ (function () {\r\n function PageViewManager(appInsights, overridePageViewDuration, core, pageViewPerformanceManager) {\r\n dynamicProto(PageViewManager, this, function (_self) {\r\n var queueTimer = null;\r\n var itemQueue = [];\r\n var pageViewPerformanceSent = false;\r\n var _logger;\r\n if (core) {\r\n _logger = core.logger;\r\n }\r\n function _flushChannels(isAsync) {\r\n if (core) {\r\n core.flush(isAsync, function () {\r\n // Event flushed, callback added to prevent promise creation\r\n });\r\n }\r\n }\r\n function _startTimer() {\r\n if (!queueTimer) {\r\n queueTimer = scheduleTimeout((function () {\r\n queueTimer = null;\r\n var allItems = itemQueue.slice(0);\r\n var doFlush = false;\r\n itemQueue = [];\r\n arrForEach(allItems, function (item) {\r\n if (!item()) {\r\n // Not processed so rescheduled\r\n itemQueue.push(item);\r\n }\r\n else {\r\n doFlush = true;\r\n }\r\n });\r\n if (itemQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _startTimer();\r\n }\r\n if (doFlush) {\r\n // We process at least one item so flush the queue\r\n _flushChannels(true);\r\n }\r\n }), 100);\r\n }\r\n }\r\n function _addQueue(cb) {\r\n itemQueue.push(cb);\r\n _startTimer();\r\n }\r\n _self[_DYN_TRACK_PAGE_VIEW /* @min:%2etrackPageView */] = function (pageView, customProperties) {\r\n var name = pageView.name;\r\n if (isNullOrUndefined(name) || typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = pageView.name = doc && doc.title || \"\";\r\n }\r\n var uri = pageView.uri;\r\n if (isNullOrUndefined(uri) || typeof uri !== \"string\") {\r\n var location_1 = getLocation();\r\n uri = pageView.uri = location_1 && location_1[_DYN_HREF /* @min:%2ehref */] || \"\";\r\n }\r\n // case 1a. if performance timing is not supported by the browser, send the page view telemetry with the duration provided by the user. If the user\r\n // do not provide the duration, set duration to undefined\r\n // Also this is case 4\r\n if (!pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN14 /* @min:%2eisPerformanceTimingSupported */]()) {\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n _flushChannels(true);\r\n if (!isWebWorker()) {\r\n // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 25 /* _eInternalMessageId.NavigationTimingNotSupported */, \"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.\");\r\n }\r\n return;\r\n }\r\n var pageViewSent = false;\r\n var customDuration;\r\n // if the performance timing is supported by the browser, calculate the custom duration\r\n var start = pageViewPerformanceManager[_DYN_GET_PERFORMANCE_TIMI15 /* @min:%2egetPerformanceTiming */]()[_DYN_NAVIGATION_START /* @min:%2enavigationStart */];\r\n if (start > 0) {\r\n customDuration = dateTimeUtilsDuration(start, +new Date);\r\n if (!pageViewPerformanceManager[_DYN_SHOULD_COLLECT_DURAT16 /* @min:%2eshouldCollectDuration */](customDuration)) {\r\n customDuration = undefined;\r\n }\r\n }\r\n // if the user has provided duration, send a page view telemetry with the provided duration. Otherwise, if\r\n // overridePageViewDuration is set to true, send a page view telemetry with the custom duration calculated earlier\r\n var duration;\r\n if (!isNullOrUndefined(customProperties) &&\r\n !isNullOrUndefined(customProperties[_DYN_DURATION /* @min:%2eduration */])) {\r\n duration = customProperties[_DYN_DURATION /* @min:%2eduration */];\r\n }\r\n if (overridePageViewDuration || !isNaN(duration)) {\r\n if (isNaN(duration)) {\r\n // case 3\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;\r\n }\r\n // case 2\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n _flushChannels(true);\r\n pageViewSent = true;\r\n }\r\n // now try to send the page view performance telemetry\r\n var maxDurationLimit = 60000;\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n // Queue the event for processing\r\n _addQueue(function () {\r\n var processed = false;\r\n try {\r\n if (pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN17 /* @min:%2eisPerformanceTimingDataReady */]()) {\r\n processed = true;\r\n var pageViewPerformance = {\r\n name: name,\r\n uri: uri\r\n };\r\n pageViewPerformanceManager[_DYN_POPULATE_PAGE_VIEW_P4 /* @min:%2epopulatePageViewPerformanceEvent */](pageViewPerformance);\r\n if (!pageViewPerformance.isValid && !pageViewSent) {\r\n // If navigation timing gives invalid numbers, then go back to \"override page view duration\" mode.\r\n // That's the best value we can get that makes sense.\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n else {\r\n if (!pageViewSent) {\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = pageViewPerformance.durationMs;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n if (!pageViewPerformanceSent) {\r\n appInsights[_DYN_SEND_PAGE_VIEW_PERFO3 /* @min:%2esendPageViewPerformanceInternal */](pageViewPerformance, customProperties);\r\n pageViewPerformanceSent = true;\r\n }\r\n }\r\n }\r\n else if (start > 0 && dateTimeUtilsDuration(start, +new Date) > maxDurationLimit) {\r\n // if performance timings are not ready but we exceeded the maximum duration limit, just log a page view telemetry\r\n // with the maximum duration limit. Otherwise, keep waiting until performance timings are ready\r\n processed = true;\r\n if (!pageViewSent) {\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = maxDurationLimit;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 38 /* _eInternalMessageId.TrackPVFailedCalc */, \"trackPageView failed on page load calculation: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n return processed;\r\n });\r\n };\r\n _self.teardown = function (unloadCtx, unloadState) {\r\n if (queueTimer) {\r\n queueTimer.cancel();\r\n queueTimer = null;\r\n var allItems = itemQueue.slice(0);\r\n var doFlush_1 = false;\r\n itemQueue = [];\r\n arrForEach(allItems, function (item) {\r\n if (item()) {\r\n doFlush_1 = true;\r\n }\r\n });\r\n }\r\n };\r\n });\r\n }\r\n// Removed Stub for PageViewManager.prototype.trackPageView.\r\n// Removed Stub for PageViewManager.prototype.teardown.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n PageViewManager.__ieDyn=1;\n\n return PageViewManager;\r\n}());\r\nexport { PageViewManager };\r\n//# sourceMappingURL=PageViewManager.js.map","/*\n * Application Insights JavaScript SDK - Web Analytics, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { dateTimeUtilsDuration, msToTimeSpan } from \"@microsoft/applicationinsights-common\";\r\nimport { _throwInternal, getNavigator, getPerformance, safeGetLogger } from \"@microsoft/applicationinsights-core-js\";\r\nimport { strIndexOf } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CONNECT_END, _DYN_DURATION, _DYN_GET_ENTRIES_BY_TYPE, _DYN_GET_PERFORMANCE_TIMI15, _DYN_IS_PERFORMANCE_TIMIN14, _DYN_IS_PERFORMANCE_TIMIN17, _DYN_LENGTH, _DYN_LOAD_EVENT_END, _DYN_NAVIGATION_START, _DYN_POPULATE_PAGE_VIEW_P4, _DYN_REQUEST_START, _DYN_RESPONSE_END, _DYN_RESPONSE_START, _DYN_SHOULD_COLLECT_DURAT16, _DYN_START_TIME } from \"../../__DynamicConstants\";\r\nvar MAX_DURATION_ALLOWED = 3600000; // 1h\r\nvar botAgentNames = [\"googlebot\", \"adsbot-google\", \"apis-google\", \"mediapartners-google\"];\r\nfunction _isPerformanceTimingSupported() {\r\n var perf = getPerformance();\r\n return perf && !!perf.timing;\r\n}\r\nfunction _isPerformanceNavigationTimingSupported() {\r\n var perf = getPerformance();\r\n return perf && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */] && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */](\"navigation\")[_DYN_LENGTH /* @min:%2elength */] > 0;\r\n}\r\nfunction _isPerformanceTimingDataReady() {\r\n var perf = getPerformance();\r\n var timing = perf ? perf.timing : 0;\r\n return timing\r\n && timing.domainLookupStart > 0\r\n && timing[_DYN_NAVIGATION_START /* @min:%2enavigationStart */] > 0\r\n && timing[_DYN_RESPONSE_START /* @min:%2eresponseStart */] > 0\r\n && timing[_DYN_REQUEST_START /* @min:%2erequestStart */] > 0\r\n && timing[_DYN_LOAD_EVENT_END /* @min:%2eloadEventEnd */] > 0\r\n && timing[_DYN_RESPONSE_END /* @min:%2eresponseEnd */] > 0\r\n && timing[_DYN_CONNECT_END /* @min:%2econnectEnd */] > 0\r\n && timing.domLoading > 0;\r\n}\r\nfunction _getPerformanceTiming() {\r\n if (_isPerformanceTimingSupported()) {\r\n return getPerformance().timing;\r\n }\r\n return null;\r\n}\r\nfunction _getPerformanceNavigationTiming() {\r\n if (_isPerformanceNavigationTimingSupported()) {\r\n return getPerformance()[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */](\"navigation\")[0];\r\n }\r\n return null;\r\n}\r\n/**\r\n* This method tells if given durations should be excluded from collection.\r\n*/\r\nfunction _shouldCollectDuration() {\r\n var durations = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n durations[_i] = arguments[_i];\r\n }\r\n var _navigator = getNavigator() || {};\r\n // a full list of Google crawlers user agent strings - https://support.google.com/webmasters/answer/1061943?hl=en\r\n var userAgent = _navigator.userAgent;\r\n var isGoogleBot = false;\r\n if (userAgent) {\r\n for (var i = 0; i < botAgentNames[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n isGoogleBot = isGoogleBot || strIndexOf(userAgent.toLowerCase(), botAgentNames[i]) !== -1;\r\n }\r\n }\r\n if (isGoogleBot) {\r\n // Don't report durations for GoogleBot, it is returning invalid values in performance.timing API.\r\n return false;\r\n }\r\n else {\r\n // for other page views, don't report if it's outside of a reasonable range\r\n for (var i = 0; i < durations[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n if (durations[i] < 0 || durations[i] >= MAX_DURATION_ALLOWED) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n}\r\n/**\r\n * Class encapsulates sending page view performance telemetry.\r\n */\r\nvar PageViewPerformanceManager = /** @class */ (function () {\r\n function PageViewPerformanceManager(core) {\r\n var _logger = safeGetLogger(core);\r\n dynamicProto(PageViewPerformanceManager, this, function (_self) {\r\n _self[_DYN_POPULATE_PAGE_VIEW_P4 /* @min:%2epopulatePageViewPerformanceEvent */] = function (pageViewPerformance) {\r\n pageViewPerformance.isValid = false;\r\n /*\r\n * http://www.w3.org/TR/navigation-timing/#processing-model\r\n * |-navigationStart\r\n * | |-connectEnd\r\n * | ||-requestStart\r\n * | || |-responseStart\r\n * | || | |-responseEnd\r\n * | || | |\r\n * | || | | |-loadEventEnd\r\n * |---network---||---request---|---response---|---dom---|\r\n * |--------------------------total----------------------|\r\n *\r\n * total = The difference between the load event of the current document is completed and the first recorded timestamp of the performance entry : https://developer.mozilla.org/en-US/docs/Web/Performance/Navigation_and_resource_timings#duration\r\n * network = Redirect time + App Cache + DNS lookup time + TCP connection time\r\n * request = Request time : https://developer.mozilla.org/en-US/docs/Web/Performance/Navigation_and_resource_timings#request_time\r\n * response = Response time\r\n * dom = Document load time : https://html.spec.whatwg.org/multipage/dom.html#document-load-timing-info\r\n * = Document processing time : https://developers.google.com/web/fundamentals/performance/navigation-and-resource-timing/#document_processing\r\n * + Loading time : https://developers.google.com/web/fundamentals/performance/navigation-and-resource-timing/#loading\r\n */\r\n var navigationTiming = _getPerformanceNavigationTiming();\r\n var timing = _getPerformanceTiming();\r\n var total = 0;\r\n var network = 0;\r\n var request = 0;\r\n var response = 0;\r\n var dom = 0;\r\n if (navigationTiming || timing) {\r\n if (navigationTiming) {\r\n total = navigationTiming[_DYN_DURATION /* @min:%2eduration */];\r\n /**\r\n * support both cases:\r\n * - startTime is always zero: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming\r\n * - for older browsers where the startTime is not zero\r\n */\r\n network = navigationTiming[_DYN_START_TIME /* @min:%2estartTime */] === 0 ? navigationTiming[_DYN_CONNECT_END /* @min:%2econnectEnd */] : dateTimeUtilsDuration(navigationTiming[_DYN_START_TIME /* @min:%2estartTime */], navigationTiming[_DYN_CONNECT_END /* @min:%2econnectEnd */]);\r\n request = dateTimeUtilsDuration(navigationTiming.requestStart, navigationTiming[_DYN_RESPONSE_START /* @min:%2eresponseStart */]);\r\n response = dateTimeUtilsDuration(navigationTiming[_DYN_RESPONSE_START /* @min:%2eresponseStart */], navigationTiming[_DYN_RESPONSE_END /* @min:%2eresponseEnd */]);\r\n dom = dateTimeUtilsDuration(navigationTiming.responseEnd, navigationTiming[_DYN_LOAD_EVENT_END /* @min:%2eloadEventEnd */]);\r\n }\r\n else {\r\n total = dateTimeUtilsDuration(timing[_DYN_NAVIGATION_START /* @min:%2enavigationStart */], timing[_DYN_LOAD_EVENT_END /* @min:%2eloadEventEnd */]);\r\n network = dateTimeUtilsDuration(timing[_DYN_NAVIGATION_START /* @min:%2enavigationStart */], timing[_DYN_CONNECT_END /* @min:%2econnectEnd */]);\r\n request = dateTimeUtilsDuration(timing.requestStart, timing[_DYN_RESPONSE_START /* @min:%2eresponseStart */]);\r\n response = dateTimeUtilsDuration(timing[_DYN_RESPONSE_START /* @min:%2eresponseStart */], timing[_DYN_RESPONSE_END /* @min:%2eresponseEnd */]);\r\n dom = dateTimeUtilsDuration(timing.responseEnd, timing[_DYN_LOAD_EVENT_END /* @min:%2eloadEventEnd */]);\r\n }\r\n if (total === 0) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 10 /* _eInternalMessageId.ErrorPVCalc */, \"error calculating page view performance.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else if (!_self[_DYN_SHOULD_COLLECT_DURAT16 /* @min:%2eshouldCollectDuration */](total, network, request, response, dom)) {\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 45 /* _eInternalMessageId.InvalidDurationValue */, \"Invalid page load duration value. Browser perf data won't be sent.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {\r\n // some browsers may report individual components incorrectly so that the sum of the parts will be bigger than total PLT\r\n // in this case, don't report client performance from this page\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 8 /* _eInternalMessageId.ClientPerformanceMathError */, \"client performance math error.\", { total: total, network: network, request: request, response: response, dom: dom });\r\n }\r\n else {\r\n pageViewPerformance.durationMs = total;\r\n // // convert to timespans\r\n pageViewPerformance.perfTotal = pageViewPerformance[_DYN_DURATION /* @min:%2eduration */] = msToTimeSpan(total);\r\n pageViewPerformance.networkConnect = msToTimeSpan(network);\r\n pageViewPerformance.sentRequest = msToTimeSpan(request);\r\n pageViewPerformance.receivedResponse = msToTimeSpan(response);\r\n pageViewPerformance.domProcessing = msToTimeSpan(dom);\r\n pageViewPerformance.isValid = true;\r\n }\r\n }\r\n };\r\n _self[_DYN_GET_PERFORMANCE_TIMI15 /* @min:%2egetPerformanceTiming */] = _getPerformanceTiming;\r\n _self[_DYN_IS_PERFORMANCE_TIMIN14 /* @min:%2eisPerformanceTimingSupported */] = _isPerformanceTimingSupported;\r\n _self[_DYN_IS_PERFORMANCE_TIMIN17 /* @min:%2eisPerformanceTimingDataReady */] = _isPerformanceTimingDataReady;\r\n _self[_DYN_SHOULD_COLLECT_DURAT16 /* @min:%2eshouldCollectDuration */] = _shouldCollectDuration;\r\n });\r\n }\r\n// Removed Stub for PageViewPerformanceManager.prototype.populatePageViewPerformanceEvent.\r\n// Removed Stub for PageViewPerformanceManager.prototype.getPerformanceTiming.\r\n// Removed Stub for PageViewPerformanceManager.prototype.isPerformanceTimingSupported.\r\n// Removed Stub for PageViewPerformanceManager.prototype.isPerformanceTimingDataReady.\r\n// Removed Stub for PageViewPerformanceManager.prototype.shouldCollectDuration.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n PageViewPerformanceManager.__ieDyn=1;\n\n return PageViewPerformanceManager;\r\n}());\r\nexport { PageViewPerformanceManager };\r\n//# sourceMappingURL=PageViewPerformanceManager.js.map","/*\n * Application Insights JavaScript SDK - Web Analytics, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { _warnToConsole, dateNow, dumpObj, getJSON, hasJSON, throwError } from \"@microsoft/applicationinsights-core-js\";\r\nimport { objDefine } from \"@nevware21/ts-utils\";\r\nimport { _DYN_PAGE_VISIT_START_TIM18, _DYN_TRACK_PREVIOUS_PAGE_1 } from \"../../__DynamicConstants\";\r\n/**\r\n * Used to track page visit durations\r\n */\r\nvar PageVisitTimeManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of PageVisitTimeManager\r\n * @param pageVisitTimeTrackingHandler - Delegate that will be called to send telemetry data to AI (when trackPreviousPageVisit is called)\r\n * @returns {}\r\n */\r\n function PageVisitTimeManager(logger, pageVisitTimeTrackingHandler) {\r\n var prevPageVisitDataKeyName = \"prevPageVisitData\";\r\n dynamicProto(PageVisitTimeManager, this, function (_self) {\r\n _self[_DYN_TRACK_PREVIOUS_PAGE_1 /* @min:%2etrackPreviousPageVisit */] = function (currentPageName, currentPageUrl) {\r\n try {\r\n // Restart timer for new page view\r\n var prevPageVisitTimeData = restartPageVisitTimer(currentPageName, currentPageUrl);\r\n // If there was a page already being timed, track the visit time for it now.\r\n if (prevPageVisitTimeData) {\r\n pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime);\r\n }\r\n }\r\n catch (e) {\r\n _warnToConsole(logger, \"Auto track page visit time failed, metric will not be collected: \" + dumpObj(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page (if exists) and starts timing for duration of visit to pageName\r\n * @param pageName - Name of page to begin timing visit duration\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from last call to start or restart, if exists. Null if not.\r\n */\r\n function restartPageVisitTimer(pageName, pageUrl) {\r\n var prevPageVisitData = null;\r\n try {\r\n prevPageVisitData = stopPageVisitTimer();\r\n if (utlCanUseSessionStorage()) {\r\n if (utlGetSessionStorage(logger, prevPageVisitDataKeyName) != null) {\r\n throwError(\"Cannot call startPageVisit consecutively without first calling stopPageVisit\");\r\n }\r\n var currPageVisitDataStr = getJSON().stringify(new PageVisitData(pageName, pageUrl));\r\n utlSetSessionStorage(logger, prevPageVisitDataKeyName, currPageVisitDataStr);\r\n }\r\n }\r\n catch (e) {\r\n _warnToConsole(logger, \"Call to restart failed: \" + dumpObj(e));\r\n prevPageVisitData = null;\r\n }\r\n return prevPageVisitData;\r\n }\r\n /**\r\n * Stops timing of current page, if exists.\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from call to start, if exists. Null if not.\r\n */\r\n function stopPageVisitTimer() {\r\n var prevPageVisitData = null;\r\n try {\r\n if (utlCanUseSessionStorage()) {\r\n // Define end time of page's visit\r\n var pageVisitEndTime = dateNow();\r\n // Try to retrieve page name and start time from session storage\r\n var pageVisitDataJsonStr = utlGetSessionStorage(logger, prevPageVisitDataKeyName);\r\n if (pageVisitDataJsonStr && hasJSON()) {\r\n // if previous page data exists, set end time of visit\r\n prevPageVisitData = getJSON().parse(pageVisitDataJsonStr);\r\n prevPageVisitData.pageVisitTime = pageVisitEndTime - prevPageVisitData[_DYN_PAGE_VISIT_START_TIM18 /* @min:%2epageVisitStartTime */];\r\n // Remove data from storage since we already used it\r\n utlRemoveSessionStorage(logger, prevPageVisitDataKeyName);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _warnToConsole(logger, \"Stop page visit timer failed: \" + dumpObj(e));\r\n prevPageVisitData = null;\r\n }\r\n return prevPageVisitData;\r\n }\r\n // For backward compatibility\r\n objDefine(_self, \"_logger\", { g: function () { return logger; } });\r\n objDefine(_self, \"pageVisitTimeTrackingHandler\", { g: function () { return pageVisitTimeTrackingHandler; } });\r\n });\r\n }\r\n// Removed Stub for PageVisitTimeManager.prototype.trackPreviousPageVisit.\r\n // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any\n // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.\n PageVisitTimeManager.__ieDyn=1;\n\n return PageVisitTimeManager;\r\n}());\r\nexport { PageVisitTimeManager };\r\nvar PageVisitData = /** @class */ (function () {\r\n function PageVisitData(pageName, pageUrl) {\r\n this[_DYN_PAGE_VISIT_START_TIM18 /* @min:%2epageVisitStartTime */] = dateNow();\r\n this.pageName = pageName;\r\n this.pageUrl = pageUrl;\r\n }\r\n return PageVisitData;\r\n}());\r\nexport { PageVisitData };\r\n//# sourceMappingURL=PageVisitTimeManager.js.map","/*\n * Application Insights JavaScript SDK - Web Analytics, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n\r\n\r\nimport { dateTimeUtilsDuration } from \"@microsoft/applicationinsights-common\";\r\nimport { _throwInternal } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * Used to record timed events and page views.\r\n */\r\nvar Timing = /** @class */ (function () {\r\n function Timing(logger, name) {\r\n var _self = this;\r\n var _events = {};\r\n _self.start = function (name) {\r\n if (typeof _events[name] !== \"undefined\") {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 62 /* _eInternalMessageId.StartCalledMoreThanOnce */, \"start was called more than once for this event without calling stop.\", { name: name, key: name }, true);\r\n }\r\n _events[name] = +new Date;\r\n };\r\n _self.stop = function (name, url, properties, measurements) {\r\n var start = _events[name];\r\n if (isNaN(start)) {\r\n _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 63 /* _eInternalMessageId.StopCalledWithoutStart */, \"stop was called without a corresponding start.\", { name: name, key: name }, true);\r\n }\r\n else {\r\n var end = +new Date;\r\n var duration = dateTimeUtilsDuration(start, end);\r\n _self.action(name, url, duration, properties, measurements);\r\n }\r\n delete _events[name];\r\n _events[name] = undefined;\r\n };\r\n }\r\n return Timing;\r\n}());\r\nexport { Timing };\r\n//# sourceMappingURL=Timing.js.map","/*\n * Application Insights JavaScript SDK - Web Analytics, 3.0.3\n * Copyright (c) Microsoft and contributors. All rights reserved.\n */\n/**\r\n* ApplicationInsights.ts\r\n* @copyright Microsoft 2018\r\n*/\r\nvar _a;\r\nimport { __assignFn as __assign, __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { AnalyticsPluginIdentifier, Event as EventTelemetry, Exception, Metric, PageView, PageViewPerformance, PropertiesPluginIdentifier, RemoteDependencyData, Trace, createDistributedTraceContextFromTrace, createDomEvent, createTelemetryItem, dataSanitizeString, isCrossOriginError, strNotSpecified, utlDisableStorage, utlEnableStorage, utlSetStoragePrefix } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, InstrumentEvent, arrForEach, cfgDfBoolean, cfgDfSet, cfgDfString, cfgDfValidate, createProcessTelemetryContext, createUniqueNamespace, dumpObj, eventOff, eventOn, generateW3CId, getDocument, getExceptionName, getHistory, getLocation, getWindow, hasHistory, hasWindow, isFunction, isNullOrUndefined, isString, isUndefined, mergeEvtNamespace, onConfigChange, safeGetCookieMgr, strUndefined, throwError } from \"@microsoft/applicationinsights-core-js\";\r\nimport { getPerformance, isError, objDeepFreeze, objDefine, scheduleTimeout, strIndexOf } from \"@nevware21/ts-utils\";\r\nimport { _DYN_ADD_TELEMETRY_INITIA7, _DYN_AUTO_TRACK_PAGE_VISI9, _DYN_AUTO_UNHANDLED_PROMI13, _DYN_COLUMN_NUMBER, _DYN_CORE, _DYN_DATA_TYPE, _DYN_DIAG_LOG, _DYN_DURATION, _DYN_ENABLE_AUTO_ROUTE_TR11, _DYN_ENABLE_UNHANDLED_PRO12, _DYN_ENVELOPE_TYPE, _DYN_ERROR, _DYN_ERROR_SRC, _DYN_EXCEPTION, _DYN_GET_ENTRIES_BY_TYPE, _DYN_HREF, _DYN_IS_BROWSER_LINK_TRAC10, _DYN_IS_STORAGE_USE_DISAB0, _DYN_LENGTH, _DYN_LINE_NUMBER, _DYN_MESSAGE, _DYN_OVERRIDE_PAGE_VIEW_D8, _DYN_POPULATE_PAGE_VIEW_P4, _DYN_SEND_EXCEPTION_INTER5, _DYN_SEND_PAGE_VIEW_INTER2, _DYN_SEND_PAGE_VIEW_PERFO3, _DYN_START_TIME, _DYN_TO_STRING, _DYN_TRACK, _DYN_TRACK_PAGE_VIEW, _DYN_TRACK_PREVIOUS_PAGE_1, _DYN__ADD_HOOK, _DYN__CREATE_AUTO_EXCEPTI6, _DYN__ONERROR } from \"../__DynamicConstants\";\r\nimport { PageViewManager } from \"./Telemetry/PageViewManager\";\r\nimport { PageViewPerformanceManager } from \"./Telemetry/PageViewPerformanceManager\";\r\nimport { PageVisitTimeManager } from \"./Telemetry/PageVisitTimeManager\";\r\nimport { Timing } from \"./Timing\";\r\nvar strEvent = \"event\";\r\nfunction _dispatchEvent(target, evnt) {\r\n if (target && target.dispatchEvent && evnt) {\r\n target.dispatchEvent(evnt);\r\n }\r\n}\r\nfunction _getReason(error) {\r\n if (error && error.reason) {\r\n var reason = error.reason;\r\n if (!isString(reason) && isFunction(reason[_DYN_TO_STRING /* @min:%2etoString */])) {\r\n return reason[_DYN_TO_STRING /* @min:%2etoString */]();\r\n }\r\n return dumpObj(reason);\r\n }\r\n // Pass the original object down which will eventually get evaluated for any message or description\r\n return error || \"\";\r\n}\r\nvar MinMilliSeconds = 60000;\r\nvar defaultValues = objDeepFreeze((_a = {\r\n sessionRenewalMs: cfgDfSet(_chkConfigMilliseconds, 30 * 60 * 1000),\r\n sessionExpirationMs: cfgDfSet(_chkConfigMilliseconds, 24 * 60 * 60 * 1000),\r\n disableExceptionTracking: cfgDfBoolean()\r\n },\r\n _a[_DYN_AUTO_TRACK_PAGE_VISI9 /* @min:autoTrackPageVisitTime */] = cfgDfBoolean(),\r\n _a[_DYN_OVERRIDE_PAGE_VIEW_D8 /* @min:overridePageViewDuration */] = cfgDfBoolean(),\r\n _a[_DYN_ENABLE_UNHANDLED_PRO12 /* @min:enableUnhandledPromiseRejectionTracking */] = cfgDfBoolean(),\r\n _a[_DYN_AUTO_UNHANDLED_PROMI13 /* @min:autoUnhandledPromiseInstrumented */] = false,\r\n _a.samplingPercentage = cfgDfValidate(_chkSampling, 100),\r\n _a[_DYN_IS_STORAGE_USE_DISAB0 /* @min:isStorageUseDisabled */] = cfgDfBoolean(),\r\n _a[_DYN_IS_BROWSER_LINK_TRAC10 /* @min:isBrowserLinkTrackingEnabled */] = cfgDfBoolean(),\r\n _a[_DYN_ENABLE_AUTO_ROUTE_TR11 /* @min:enableAutoRouteTracking */] = cfgDfBoolean(),\r\n _a.namePrefix = cfgDfString(),\r\n _a.enableDebug = cfgDfBoolean(),\r\n _a.disableFlushOnBeforeUnload = cfgDfBoolean(),\r\n _a.disableFlushOnUnload = cfgDfBoolean(false, \"disableFlushOnBeforeUnload\"),\r\n _a));\r\nfunction _chkConfigMilliseconds(value, defValue) {\r\n value = value || defValue;\r\n if (value < MinMilliSeconds) {\r\n value = MinMilliSeconds;\r\n }\r\n return +value;\r\n}\r\nfunction _chkSampling(value) {\r\n return !isNaN(value) && value > 0 && value <= 100;\r\n}\r\nfunction _updateStorageUsage(extConfig) {\r\n // Not resetting the storage usage as someone may have manually called utlDisableStorage, so this will only\r\n // reset based if the configuration option is provided\r\n if (!isUndefined(extConfig[_DYN_IS_STORAGE_USE_DISAB0 /* @min:%2eisStorageUseDisabled */])) {\r\n if (extConfig[_DYN_IS_STORAGE_USE_DISAB0 /* @min:%2eisStorageUseDisabled */]) {\r\n utlDisableStorage();\r\n }\r\n else {\r\n utlEnableStorage();\r\n }\r\n }\r\n}\r\nvar AnalyticsPlugin = /** @class */ (function (_super) {\r\n __extends(AnalyticsPlugin, _super);\r\n function AnalyticsPlugin() {\r\n var _this = _super.call(this) || this;\r\n _this.identifier = AnalyticsPluginIdentifier; // do not change name or priority\r\n _this.priority = 180; // take from reserved priority range 100- 200\r\n _this.autoRoutePVDelay = 500; // ms; Time to wait after a route change before triggering a pageview to allow DOM changes to take place\r\n var _eventTracking;\r\n var _pageTracking;\r\n var _pageViewManager;\r\n var _pageViewPerformanceManager;\r\n var _pageVisitTimeManager;\r\n var _preInitTelemetryInitializers;\r\n var _isBrowserLinkTrackingEnabled;\r\n var _browserLinkInitializerAdded;\r\n var _enableAutoRouteTracking;\r\n var _historyListenerAdded;\r\n var _disableExceptionTracking;\r\n var _autoExceptionInstrumented;\r\n var _enableUnhandledPromiseRejectionTracking;\r\n var _autoUnhandledPromiseInstrumented;\r\n var _extConfig;\r\n var _autoTrackPageVisitTime;\r\n // Counts number of trackAjax invocations.\r\n // By default we only monitor X ajax call per view to avoid too much load.\r\n // Default value is set in config.\r\n // This counter keeps increasing even after the limit is reached.\r\n var _trackAjaxAttempts = 0;\r\n // array with max length of 2 that store current url and previous url for SPA page route change trackPageview use.\r\n var _prevUri; // Assigned in the constructor\r\n var _currUri;\r\n var _evtNamespace;\r\n dynamicProto(AnalyticsPlugin, _this, function (_self, _base) {\r\n var _addHook = _base[_DYN__ADD_HOOK /* @min:%2e_addHook */];\r\n _initDefaults();\r\n _self.getCookieMgr = function () {\r\n return safeGetCookieMgr(_self[_DYN_CORE /* @min:%2ecore */]);\r\n };\r\n _self.processTelemetry = function (env, itemCtx) {\r\n _self.processNext(env, itemCtx);\r\n };\r\n _self.trackEvent = function (event, customProperties) {\r\n try {\r\n var telemetryItem = createTelemetryItem(event, EventTelemetry[_DYN_DATA_TYPE /* @min:%2edataType */], EventTelemetry[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], _self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), customProperties);\r\n _self[_DYN_CORE /* @min:%2ecore */][_DYN_TRACK /* @min:%2etrack */](telemetryItem);\r\n }\r\n catch (e) {\r\n _throwInternal(2 /* eLoggingSeverity.WARNING */, 39 /* _eInternalMessageId.TrackTraceFailed */, \"trackTrace failed, trace will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.\r\n * @param name A string that identifies this event uniquely within the document.\r\n */\r\n _self.startTrackEvent = function (name) {\r\n try {\r\n _eventTracking.start(name);\r\n }\r\n catch (e) {\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 29 /* _eInternalMessageId.StartTrackEventFailed */, \"startTrackEvent failed, event will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Log an extended event that you started timing with `startTrackEvent`.\r\n * @param name The string you used to identify this event in `startTrackEvent`.\r\n * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n _self.stopTrackEvent = function (name, properties, measurements) {\r\n try {\r\n _eventTracking.stop(name, undefined, properties, measurements);\r\n }\r\n catch (e) {\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 30 /* _eInternalMessageId.StopTrackEventFailed */, \"stopTrackEvent failed, event will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * @description Log a diagnostic message\r\n * @param trace\r\n * @param ICustomProperties.\r\n * @memberof ApplicationInsights\r\n */\r\n _self.trackTrace = function (trace, customProperties) {\r\n try {\r\n var telemetryItem = createTelemetryItem(trace, Trace[_DYN_DATA_TYPE /* @min:%2edataType */], Trace[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], _self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), customProperties);\r\n _self[_DYN_CORE /* @min:%2ecore */][_DYN_TRACK /* @min:%2etrack */](telemetryItem);\r\n }\r\n catch (e) {\r\n _throwInternal(2 /* eLoggingSeverity.WARNING */, 39 /* _eInternalMessageId.TrackTraceFailed */, \"trackTrace failed, trace will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * @description Log a numeric value that is not associated with a specific event. Typically\r\n * used to send regular reports of performance indicators. To send single measurement, just\r\n * use the name and average fields of {@link IMetricTelemetry}. If you take measurements\r\n * frequently, you can reduce the telemetry bandwidth by aggregating multiple measurements\r\n * and sending the resulting average at intervals\r\n * @param metric - input object argument. Only name and average are mandatory.\r\n * @param } customProperties additional data used to filter metrics in the\r\n * portal. Defaults to empty.\r\n * @memberof ApplicationInsights\r\n */\r\n _self.trackMetric = function (metric, customProperties) {\r\n try {\r\n var telemetryItem = createTelemetryItem(metric, Metric[_DYN_DATA_TYPE /* @min:%2edataType */], Metric[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], _self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), customProperties);\r\n _self[_DYN_CORE /* @min:%2ecore */][_DYN_TRACK /* @min:%2etrack */](telemetryItem);\r\n }\r\n catch (e) {\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 36 /* _eInternalMessageId.TrackMetricFailed */, \"trackMetric failed, metric will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Logs that a page or other item was viewed.\r\n * @param IPageViewTelemetry - The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param customProperties - Additional data used to filter events and metrics. Defaults to empty.\r\n * If a user wants to provide duration for pageLoad, it'll have to be in pageView.properties.duration\r\n */\r\n _self[_DYN_TRACK_PAGE_VIEW /* @min:%2etrackPageView */] = function (pageView, customProperties) {\r\n try {\r\n var inPv = pageView || {};\r\n _pageViewManager[_DYN_TRACK_PAGE_VIEW /* @min:%2etrackPageView */](inPv, __assign(__assign(__assign({}, inPv.properties), inPv.measurements), customProperties));\r\n if (_autoTrackPageVisitTime) {\r\n _pageVisitTimeManager[_DYN_TRACK_PREVIOUS_PAGE_1 /* @min:%2etrackPreviousPageVisit */](inPv.name, inPv.uri);\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 37 /* _eInternalMessageId.TrackPVFailed */, \"trackPageView failed, page view will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Create a page view telemetry item and send it to the SDK pipeline through the core.track API\r\n * @param pageView - Page view item to be sent\r\n * @param properties - Custom properties (Part C) that a user can add to the telemetry item\r\n * @param systemProperties - System level properties (Part A) that a user can add to the telemetry item\r\n */\r\n _self[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */] = function (pageView, properties, systemProperties) {\r\n var doc = getDocument();\r\n if (doc) {\r\n pageView.refUri = pageView.refUri === undefined ? doc.referrer : pageView.refUri;\r\n }\r\n var perf = getPerformance();\r\n // Access the performance timing object\r\n var navigationEntries = (perf && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */] && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */](\"navigation\"));\r\n // Edge Case the navigation Entries may return an empty array and the timeOrigin is not supported on IE\r\n if (navigationEntries && navigationEntries[0] && !isUndefined(perf.timeOrigin)) {\r\n // Get the value of loadEventStart\r\n var loadEventStart = navigationEntries[0].loadEventStart;\r\n pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(perf.timeOrigin + loadEventStart);\r\n }\r\n else {\r\n // calculate the start time manually\r\n var duration = ((properties || pageView.properties || {})[_DYN_DURATION /* @min:%2eduration */] || 0);\r\n pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(new Date().getTime() - duration);\r\n }\r\n var telemetryItem = createTelemetryItem(pageView, PageView[_DYN_DATA_TYPE /* @min:%2edataType */], PageView[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], _self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), properties, systemProperties);\r\n _self[_DYN_CORE /* @min:%2ecore */][_DYN_TRACK /* @min:%2etrack */](telemetryItem);\r\n // reset ajaxes counter\r\n _trackAjaxAttempts = 0;\r\n };\r\n /**\r\n * @ignore INTERNAL ONLY\r\n * @param pageViewPerformance\r\n * @param properties\r\n */\r\n _self[_DYN_SEND_PAGE_VIEW_PERFO3 /* @min:%2esendPageViewPerformanceInternal */] = function (pageViewPerformance, properties, systemProperties) {\r\n var telemetryItem = createTelemetryItem(pageViewPerformance, PageViewPerformance[_DYN_DATA_TYPE /* @min:%2edataType */], PageViewPerformance[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], _self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), properties, systemProperties);\r\n _self[_DYN_CORE /* @min:%2ecore */][_DYN_TRACK /* @min:%2etrack */](telemetryItem);\r\n };\r\n /**\r\n * Send browser performance metrics.\r\n * @param pageViewPerformance\r\n * @param customProperties\r\n */\r\n _self.trackPageViewPerformance = function (pageViewPerformance, customProperties) {\r\n var inPvp = pageViewPerformance || {};\r\n try {\r\n _pageViewPerformanceManager[_DYN_POPULATE_PAGE_VIEW_P4 /* @min:%2epopulatePageViewPerformanceEvent */](inPvp);\r\n _self[_DYN_SEND_PAGE_VIEW_PERFO3 /* @min:%2esendPageViewPerformanceInternal */](inPvp, customProperties);\r\n }\r\n catch (e) {\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 37 /* _eInternalMessageId.TrackPVFailed */, \"trackPageViewPerformance failed, page view will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,\r\n * but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view\r\n * and send the event.\r\n * @param name - A string that idenfities this item, unique within this HTML document. Defaults to the document title.\r\n */\r\n _self.startTrackPage = function (name) {\r\n try {\r\n if (typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = doc && doc.title || \"\";\r\n }\r\n _pageTracking.start(name);\r\n }\r\n catch (e) {\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 31 /* _eInternalMessageId.StartTrackFailed */, \"startTrackPage failed, page view may not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.\r\n * The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.\r\n * @param name The string you used as the name in startTrackPage. Defaults to the document title.\r\n * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.\r\n * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.\r\n */\r\n _self.stopTrackPage = function (name, url, properties, measurement) {\r\n try {\r\n if (typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = doc && doc.title || \"\";\r\n }\r\n if (typeof url !== \"string\") {\r\n var loc = getLocation();\r\n url = loc && loc[_DYN_HREF /* @min:%2ehref */] || \"\";\r\n }\r\n _pageTracking.stop(name, url, properties, measurement);\r\n if (_autoTrackPageVisitTime) {\r\n _pageVisitTimeManager[_DYN_TRACK_PREVIOUS_PAGE_1 /* @min:%2etrackPreviousPageVisit */](name, url);\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 32 /* _eInternalMessageId.StopTrackFailed */, \"stopTrackPage failed, page view will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * @ignore INTERNAL ONLY\r\n * @param exception\r\n * @param properties\r\n * @param systemProperties\r\n */\r\n _self[_DYN_SEND_EXCEPTION_INTER5 /* @min:%2esendExceptionInternal */] = function (exception, customProperties, systemProperties) {\r\n // Adding additional edge cases to handle\r\n // - Not passing anything (null / undefined)\r\n var theError = (exception && (exception[_DYN_EXCEPTION /* @min:%2eexception */] || exception[_DYN_ERROR /* @min:%2eerror */])) ||\r\n // - Handle someone calling trackException based of v1 API where the exception was the Error\r\n isError(exception) && exception ||\r\n // - Handles no error being defined and instead of creating a new Error() instance attempt to map so any stacktrace\r\n // is preserved and does not list ApplicationInsights code as the source\r\n { name: (exception && typeof exception), message: exception || strNotSpecified };\r\n // If no exception object was passed assign to an empty object to avoid internal exceptions\r\n exception = exception || {};\r\n var exceptionPartB = new Exception(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), theError, exception.properties || customProperties, exception.measurements, exception.severityLevel, exception.id).toInterface();\r\n var telemetryItem = createTelemetryItem(exceptionPartB, Exception[_DYN_DATA_TYPE /* @min:%2edataType */], Exception[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], _self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), customProperties, systemProperties);\r\n _self[_DYN_CORE /* @min:%2ecore */][_DYN_TRACK /* @min:%2etrack */](telemetryItem);\r\n };\r\n /**\r\n * Log an exception you have caught.\r\n *\r\n * @param exception - Object which contains exception to be sent\r\n * @param } customProperties Additional data used to filter pages and metrics in the portal. Defaults to empty.\r\n *\r\n * Any property of type double will be considered a measurement, and will be treated by Application Insights as a metric.\r\n * @memberof ApplicationInsights\r\n */\r\n _self.trackException = function (exception, customProperties) {\r\n if (exception && !exception[_DYN_EXCEPTION /* @min:%2eexception */] && exception[_DYN_ERROR /* @min:%2eerror */]) {\r\n exception[_DYN_EXCEPTION /* @min:%2eexception */] = exception[_DYN_ERROR /* @min:%2eerror */];\r\n }\r\n try {\r\n _self[_DYN_SEND_EXCEPTION_INTER5 /* @min:%2esendExceptionInternal */](exception, customProperties);\r\n }\r\n catch (e) {\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 35 /* _eInternalMessageId.TrackExceptionFailed */, \"trackException failed, exception will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n /**\r\n * @description Custom error handler for Application Insights Analytics\r\n * @param exception\r\n * @memberof ApplicationInsights\r\n */\r\n _self[_DYN__ONERROR /* @min:%2e_onerror */] = function (exception) {\r\n var error = exception && exception[_DYN_ERROR /* @min:%2eerror */];\r\n var evt = exception && exception.evt;\r\n try {\r\n if (!evt) {\r\n var _window = getWindow();\r\n if (_window) {\r\n evt = _window[strEvent];\r\n }\r\n }\r\n var url = (exception && exception.url) || (getDocument() || {}).URL;\r\n // If no error source is provided assume the default window.onerror handler\r\n var errorSrc = exception[_DYN_ERROR_SRC /* @min:%2eerrorSrc */] || \"window.onerror@\" + url + \":\" + (exception[_DYN_LINE_NUMBER /* @min:%2elineNumber */] || 0) + \":\" + (exception[_DYN_COLUMN_NUMBER /* @min:%2ecolumnNumber */] || 0);\r\n var properties = {\r\n errorSrc: errorSrc,\r\n url: url,\r\n lineNumber: exception[_DYN_LINE_NUMBER /* @min:%2elineNumber */] || 0,\r\n columnNumber: exception[_DYN_COLUMN_NUMBER /* @min:%2ecolumnNumber */] || 0,\r\n message: exception[_DYN_MESSAGE /* @min:%2emessage */]\r\n };\r\n if (isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception[_DYN_ERROR /* @min:%2eerror */])) {\r\n _sendCORSException(Exception[_DYN__CREATE_AUTO_EXCEPTI6 /* @min:%2eCreateAutoException */](\"Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.\", url, exception[_DYN_LINE_NUMBER /* @min:%2elineNumber */] || 0, exception[_DYN_COLUMN_NUMBER /* @min:%2ecolumnNumber */] || 0, error, evt, null, errorSrc), properties);\r\n }\r\n else {\r\n if (!exception[_DYN_ERROR_SRC /* @min:%2eerrorSrc */]) {\r\n exception[_DYN_ERROR_SRC /* @min:%2eerrorSrc */] = errorSrc;\r\n }\r\n _self.trackException({ exception: exception, severityLevel: 3 /* eSeverityLevel.Error */ }, properties);\r\n }\r\n }\r\n catch (e) {\r\n var errorString = error ? (error.name + \", \" + error[_DYN_MESSAGE /* @min:%2emessage */]) : \"null\";\r\n _throwInternal(1 /* eLoggingSeverity.CRITICAL */, 11 /* _eInternalMessageId.ExceptionWhileLoggingError */, \"_onError threw exception while logging error, error will not be collected: \"\r\n + getExceptionName(e), { exception: dumpObj(e), errorString: errorString });\r\n }\r\n };\r\n _self[_DYN_ADD_TELEMETRY_INITIA7 /* @min:%2eaddTelemetryInitializer */] = function (telemetryInitializer) {\r\n if (_self[_DYN_CORE /* @min:%2ecore */]) {\r\n // Just add to the core\r\n return _self[_DYN_CORE /* @min:%2ecore */][_DYN_ADD_TELEMETRY_INITIA7 /* @min:%2eaddTelemetryInitializer */](telemetryInitializer);\r\n }\r\n // Handle \"pre-initialization\" telemetry initializers (for backward compatibility)\r\n if (!_preInitTelemetryInitializers) {\r\n _preInitTelemetryInitializers = [];\r\n }\r\n _preInitTelemetryInitializers.push(telemetryInitializer);\r\n };\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n if (_self.isInitialized()) {\r\n return;\r\n }\r\n if (isNullOrUndefined(core)) {\r\n throwError(\"Error initializing\");\r\n }\r\n _base.initialize(config, core, extensions, pluginChain);\r\n try {\r\n _evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self.identifier), core.evtNamespace && core.evtNamespace());\r\n if (_preInitTelemetryInitializers) {\r\n arrForEach(_preInitTelemetryInitializers, function (initializer) {\r\n core[_DYN_ADD_TELEMETRY_INITIA7 /* @min:%2eaddTelemetryInitializer */](initializer);\r\n });\r\n _preInitTelemetryInitializers = null;\r\n }\r\n _populateDefaults(config);\r\n _pageViewPerformanceManager = new PageViewPerformanceManager(_self[_DYN_CORE /* @min:%2ecore */]);\r\n _pageViewManager = new PageViewManager(_self, _extConfig.overridePageViewDuration, _self[_DYN_CORE /* @min:%2ecore */], _pageViewPerformanceManager);\r\n _pageVisitTimeManager = new PageVisitTimeManager(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), function (pageName, pageUrl, pageVisitTime) { return trackPageVisitTime(pageName, pageUrl, pageVisitTime); });\r\n _eventTracking = new Timing(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), \"trackEvent\");\r\n _eventTracking.action =\r\n function (name, url, duration, properties, measurements) {\r\n if (!properties) {\r\n properties = {};\r\n }\r\n if (!measurements) {\r\n measurements = {};\r\n }\r\n properties.duration = duration[_DYN_TO_STRING /* @min:%2etoString */]();\r\n _self.trackEvent({ name: name, properties: properties, measurements: measurements });\r\n };\r\n // initialize page view timing\r\n _pageTracking = new Timing(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), \"trackPageView\");\r\n _pageTracking.action = function (name, url, duration, properties, measurements) {\r\n // duration must be a custom property in order for the collector to extract it\r\n if (isNullOrUndefined(properties)) {\r\n properties = {};\r\n }\r\n properties.duration = duration[_DYN_TO_STRING /* @min:%2etoString */]();\r\n var pageViewItem = {\r\n name: name,\r\n uri: url,\r\n properties: properties,\r\n measurements: measurements\r\n };\r\n _self[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageViewItem, properties);\r\n };\r\n if (hasWindow()) {\r\n _updateExceptionTracking();\r\n _updateLocationChange();\r\n }\r\n }\r\n catch (e) {\r\n // resetting the initialized state because of failure\r\n _self.setInitialized(false);\r\n throw e;\r\n }\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _pageViewManager && _pageViewManager.teardown(unloadCtx, unloadState);\r\n // Just register to remove all events associated with this namespace\r\n eventOff(window, null, null, _evtNamespace);\r\n _initDefaults();\r\n };\r\n function _populateDefaults(config) {\r\n var identifier = _self.identifier;\r\n var core = _self[_DYN_CORE /* @min:%2ecore */];\r\n _self[_DYN__ADD_HOOK /* @min:%2e_addHook */](onConfigChange(config, function () {\r\n var ctx = createProcessTelemetryContext(null, config, core);\r\n _extConfig = ctx.getExtCfg(identifier, defaultValues);\r\n _autoTrackPageVisitTime = _extConfig[_DYN_AUTO_TRACK_PAGE_VISI9 /* @min:%2eautoTrackPageVisitTime */];\r\n if (config.storagePrefix) {\r\n utlSetStoragePrefix(config.storagePrefix);\r\n }\r\n _updateStorageUsage(_extConfig);\r\n // _updateBrowserLinkTracking\r\n _isBrowserLinkTrackingEnabled = _extConfig[_DYN_IS_BROWSER_LINK_TRAC10 /* @min:%2eisBrowserLinkTrackingEnabled */];\r\n _addDefaultTelemetryInitializers();\r\n }));\r\n }\r\n /**\r\n * Log a page visit time\r\n * @param pageName Name of page\r\n * @param pageVisitDuration Duration of visit to the page in milliseconds\r\n */\r\n function trackPageVisitTime(pageName, pageUrl, pageVisitTime) {\r\n var properties = { PageName: pageName, PageUrl: pageUrl };\r\n _self.trackMetric({\r\n name: \"PageVisitTime\",\r\n average: pageVisitTime,\r\n max: pageVisitTime,\r\n min: pageVisitTime,\r\n sampleCount: 1\r\n }, properties);\r\n }\r\n function _addDefaultTelemetryInitializers() {\r\n if (!_browserLinkInitializerAdded && _isBrowserLinkTrackingEnabled) {\r\n var browserLinkPaths_1 = [\"/browserLinkSignalR/\", \"/__browserLink/\"];\r\n var dropBrowserLinkRequests = function (envelope) {\r\n if (_isBrowserLinkTrackingEnabled && envelope.baseType === RemoteDependencyData[_DYN_DATA_TYPE /* @min:%2edataType */]) {\r\n var remoteData = envelope.baseData;\r\n if (remoteData) {\r\n for (var i = 0; i < browserLinkPaths_1[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n if (remoteData.target && strIndexOf(remoteData.target, browserLinkPaths_1[i]) >= 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n }\r\n return true;\r\n };\r\n _self[_DYN__ADD_HOOK /* @min:%2e_addHook */](_self[_DYN_ADD_TELEMETRY_INITIA7 /* @min:%2eaddTelemetryInitializer */](dropBrowserLinkRequests));\r\n _browserLinkInitializerAdded = true;\r\n }\r\n }\r\n function _sendCORSException(exception, properties) {\r\n var telemetryItem = createTelemetryItem(exception, Exception[_DYN_DATA_TYPE /* @min:%2edataType */], Exception[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], _self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), properties);\r\n _self[_DYN_CORE /* @min:%2ecore */][_DYN_TRACK /* @min:%2etrack */](telemetryItem);\r\n }\r\n function _updateExceptionTracking() {\r\n var _window = getWindow();\r\n var locn = getLocation(true);\r\n _self[_DYN__ADD_HOOK /* @min:%2e_addHook */](onConfigChange(_extConfig, function () {\r\n _disableExceptionTracking = _extConfig.disableExceptionTracking;\r\n if (!_disableExceptionTracking && !_autoExceptionInstrumented && !_extConfig.autoExceptionInstrumented) {\r\n // We want to enable exception auto collection and it has not been done so yet\r\n _addHook(InstrumentEvent(_window, \"onerror\", {\r\n ns: _evtNamespace,\r\n rsp: function (callDetails, message, url, lineNumber, columnNumber, error) {\r\n if (!_disableExceptionTracking && callDetails.rslt !== true) {\r\n _self[_DYN__ONERROR /* @min:%2e_onerror */](Exception[_DYN__CREATE_AUTO_EXCEPTI6 /* @min:%2eCreateAutoException */](message, url, lineNumber, columnNumber, error, callDetails.evt));\r\n }\r\n }\r\n }, false));\r\n _autoExceptionInstrumented = true;\r\n }\r\n }));\r\n _addUnhandledPromiseRejectionTracking(_window, locn);\r\n }\r\n function _updateLocationChange() {\r\n var win = getWindow();\r\n var locn = getLocation(true);\r\n _self[_DYN__ADD_HOOK /* @min:%2e_addHook */](onConfigChange(_extConfig, function () {\r\n _enableAutoRouteTracking = _extConfig[_DYN_ENABLE_AUTO_ROUTE_TR11 /* @min:%2eenableAutoRouteTracking */] === true;\r\n /**\r\n * Create a custom \"locationchange\" event which is triggered each time the history object is changed\r\n */\r\n if (win && _enableAutoRouteTracking && !_historyListenerAdded && hasHistory()) {\r\n var _history = getHistory();\r\n if (isFunction(_history.pushState) && isFunction(_history.replaceState) && typeof Event !== strUndefined) {\r\n _addHistoryListener(win, _history, locn);\r\n }\r\n }\r\n }));\r\n }\r\n function _getDistributedTraceCtx() {\r\n var distributedTraceCtx = null;\r\n if (_self[_DYN_CORE /* @min:%2ecore */] && _self[_DYN_CORE /* @min:%2ecore */].getTraceCtx) {\r\n distributedTraceCtx = _self[_DYN_CORE /* @min:%2ecore */].getTraceCtx(false);\r\n }\r\n if (!distributedTraceCtx) {\r\n // Fallback when using an older Core and PropertiesPlugin\r\n var properties = _self[_DYN_CORE /* @min:%2ecore */].getPlugin(PropertiesPluginIdentifier);\r\n if (properties) {\r\n var context = properties.plugin.context;\r\n if (context) {\r\n distributedTraceCtx = createDistributedTraceContextFromTrace(context.telemetryTrace);\r\n }\r\n }\r\n }\r\n return distributedTraceCtx;\r\n }\r\n /**\r\n * Create a custom \"locationchange\" event which is triggered each time the history object is changed\r\n */\r\n function _addHistoryListener(win, history, locn) {\r\n if (_historyListenerAdded) {\r\n return;\r\n }\r\n // Name Prefix is only referenced during the initial initialization and cannot be changed afterwards\r\n var namePrefix = _extConfig.namePrefix || \"\";\r\n function _popstateHandler() {\r\n if (_enableAutoRouteTracking) {\r\n _dispatchEvent(win, createDomEvent(namePrefix + \"locationchange\"));\r\n }\r\n }\r\n function _locationChangeHandler() {\r\n // We always track the changes (if the handler is installed) to handle the feature being disabled between location changes\r\n if (_currUri) {\r\n _prevUri = _currUri;\r\n _currUri = locn && locn[_DYN_HREF /* @min:%2ehref */] || \"\";\r\n }\r\n else {\r\n _currUri = locn && locn[_DYN_HREF /* @min:%2ehref */] || \"\";\r\n }\r\n if (_enableAutoRouteTracking) {\r\n var distributedTraceCtx = _getDistributedTraceCtx();\r\n if (distributedTraceCtx) {\r\n distributedTraceCtx.setTraceId(generateW3CId());\r\n var traceLocationName = \"_unknown_\";\r\n if (locn && locn.pathname) {\r\n traceLocationName = locn.pathname + (locn.hash || \"\");\r\n }\r\n // This populates the ai.operation.name which has a maximum size of 1024 so we need to sanitize it\r\n distributedTraceCtx.setName(dataSanitizeString(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), traceLocationName));\r\n }\r\n scheduleTimeout((function (uri) {\r\n // todo: override start time so that it is not affected by autoRoutePVDelay\r\n _self[_DYN_TRACK_PAGE_VIEW /* @min:%2etrackPageView */]({ refUri: uri, properties: { duration: 0 } }); // SPA route change loading durations are undefined, so send 0\r\n }).bind(_self, _prevUri), _self.autoRoutePVDelay);\r\n }\r\n }\r\n _addHook(InstrumentEvent(history, \"pushState\", {\r\n ns: _evtNamespace,\r\n rsp: function () {\r\n if (_enableAutoRouteTracking) {\r\n _dispatchEvent(win, createDomEvent(namePrefix + \"pushState\"));\r\n _dispatchEvent(win, createDomEvent(namePrefix + \"locationchange\"));\r\n }\r\n }\r\n }, true));\r\n _addHook(InstrumentEvent(history, \"replaceState\", {\r\n ns: _evtNamespace,\r\n rsp: function () {\r\n if (_enableAutoRouteTracking) {\r\n _dispatchEvent(win, createDomEvent(namePrefix + \"replaceState\"));\r\n _dispatchEvent(win, createDomEvent(namePrefix + \"locationchange\"));\r\n }\r\n }\r\n }, true));\r\n eventOn(win, namePrefix + \"popstate\", _popstateHandler, _evtNamespace);\r\n eventOn(win, namePrefix + \"locationchange\", _locationChangeHandler, _evtNamespace);\r\n _historyListenerAdded = true;\r\n }\r\n function _addUnhandledPromiseRejectionTracking(_window, _location) {\r\n _self[_DYN__ADD_HOOK /* @min:%2e_addHook */](onConfigChange(_extConfig, function () {\r\n _enableUnhandledPromiseRejectionTracking = _extConfig[_DYN_ENABLE_UNHANDLED_PRO12 /* @min:%2eenableUnhandledPromiseRejectionTracking */] === true;\r\n _autoExceptionInstrumented = _autoExceptionInstrumented || _extConfig[_DYN_AUTO_UNHANDLED_PROMI13 /* @min:%2eautoUnhandledPromiseInstrumented */];\r\n if (_enableUnhandledPromiseRejectionTracking && !_autoUnhandledPromiseInstrumented) {\r\n // We want to enable exception auto collection and it has not been done so yet\r\n _addHook(InstrumentEvent(_window, \"onunhandledrejection\", {\r\n ns: _evtNamespace,\r\n rsp: function (callDetails, error) {\r\n if (_enableUnhandledPromiseRejectionTracking && callDetails.rslt !== true) { // handled could be typeof function\r\n _self[_DYN__ONERROR /* @min:%2e_onerror */](Exception[_DYN__CREATE_AUTO_EXCEPTI6 /* @min:%2eCreateAutoException */](_getReason(error), _location ? _location[_DYN_HREF /* @min:%2ehref */] : \"\", 0, 0, error, callDetails.evt));\r\n }\r\n }\r\n }, false));\r\n _extConfig[_DYN_AUTO_UNHANDLED_PROMI13 /* @min:%2eautoUnhandledPromiseInstrumented */] = _autoUnhandledPromiseInstrumented = true;\r\n }\r\n }));\r\n }\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 - {eLoggingSeverity} - The severity of the log message\r\n * @param msgId - {_eInternalLogMessage} - The log message.\r\n */\r\n function _throwInternal(severity, msgId, msg, properties, isUserAct) {\r\n _self[_DYN_DIAG_LOG /* @min:%2ediagLog */]().throwInternal(severity, msgId, msg, properties, isUserAct);\r\n }\r\n function _initDefaults() {\r\n _eventTracking = null;\r\n _pageTracking = null;\r\n _pageViewManager = null;\r\n _pageViewPerformanceManager = null;\r\n _pageVisitTimeManager = null;\r\n _preInitTelemetryInitializers = null;\r\n _isBrowserLinkTrackingEnabled = false;\r\n _browserLinkInitializerAdded = false;\r\n _enableAutoRouteTracking = false;\r\n _historyListenerAdded = false;\r\n _disableExceptionTracking = false;\r\n _autoExceptionInstrumented = false;\r\n _enableUnhandledPromiseRejectionTracking = false;\r\n _autoUnhandledPromiseInstrumented = false;\r\n _autoTrackPageVisitTime = false;\r\n // Counts number of trackAjax invocations.\r\n // By default we only monitor X ajax call per view to avoid too much load.\r\n // Default value is set in config.\r\n // This counter keeps increasing even after the limit is reached.\r\n _trackAjaxAttempts = 0;\r\n // array with max length of 2 that store current url and previous url for SPA page route change trackPageview use.\r\n var location = getLocation(true);\r\n _prevUri = location && location[_DYN_HREF /* @min:%2ehref */] || \"\";\r\n _currUri = null;\r\n _evtNamespace = null;\r\n _extConfig = null;\r\n // Define _self.config\r\n objDefine(_self, \"config\", {\r\n g: function () { return _extConfig; }\r\n });\r\n }\r\n // For backward compatibility\r\n objDefine(_self, \"_pageViewManager\", { g: function () { return _pageViewManager; } });\r\n objDefine(_self, \"_pageViewPerformanceManager\", { g: function () { return _pageViewPerformanceManager; } });\r\n objDefine(_self, \"_pageVisitTimeManager\", { g: function () { return _pageVisitTimeManager; } });\r\n objDefine(_self, \"_evtNamespace\", { g: function () { return \".\" + _evtNamespace; } });\r\n });\r\n return _this;\r\n }\r\n// Removed Stub for AnalyticsPlugin.prototype.getCookieMgr.\r\n// Removed Stub for AnalyticsPlugin.prototype.processTelemetry.\r\n// Removed Stub for AnalyticsPlugin.prototype.trackEvent.\r\n// Removed Stub for AnalyticsPlugin.prototype.startTrackEvent.\r\n// Removed Stub for AnalyticsPlugin.prototype.stopTrackEvent.\r\n// Removed Stub for AnalyticsPlugin.prototype.trackTrace.\r\n// Removed Stub for AnalyticsPlugin.prototype.trackMetric.\r\n// Removed Stub for AnalyticsPlugin.prototype.trackPageView.\r\n// Removed Stub for AnalyticsPlugin.prototype.sendPageViewInternal.\r\n// Removed Stub for AnalyticsPlugin.prototype.sendPageViewPerformanceInternal.\r\n// Removed Stub for AnalyticsPlugin.prototype.trackPageViewPerformance.\r\n// Removed Stub for AnalyticsPlugin.prototype.startTrackPage.\r\n// Removed Stub for AnalyticsPlugin.prototype.stopTrackPage.\r\n// Removed Stub for AnalyticsPlugin.prototype.sendExceptionInternal.\r\n// Removed Stub for AnalyticsPlugin.prototype.trackException.\r\n// Removed Stub for AnalyticsPlugin.prototype._onerror.\r\n// Removed Stub for AnalyticsPlugin.prototype.addTelemetryInitializer.\r\n// Removed Stub for AnalyticsPlugin.prototype.initialize.\r\n AnalyticsPlugin.Version = '3.0.3'; // Not currently used anywhere\r\n return AnalyticsPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { AnalyticsPlugin };\r\n//# sourceMappingURL=AnalyticsPlugin.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Utils.ts\r\n* @author Ram Thiru (ramthi) Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n* File containing utility functions.\r\n*/\r\nimport { arrForEach, getDocument, getPerformance, getWindow, isObject, isValueAssigned, isWindowObjectAvailable, objForEachKey } from \"@microsoft/1ds-core-js\";\r\nimport { APPID_PREFIX } from \"./Constants\";\r\nvar doNotTrackFieldName = \"data-bi-dnt\";\r\nvar manualTrackOnlyFieldName = \"data-bi-mto\";\r\n/**\r\n* Check if appId has a colon as the third character. If it does\r\n* do nothing otherwise prefix it with 'JS:'.A colon is valid in an appId\r\n* @param appId - appId\r\n* @returns An appId with js:prefix\r\n*/\r\nexport function _getAppIdWithPrefix(appId) {\r\n var result;\r\n if (appId) {\r\n var appIdArray = appId.split(\":\");\r\n result = appIdArray.length > 1 && appIdArray[0].toLowerCase() === \"js\" ? appId : APPID_PREFIX + appId;\r\n }\r\n return result;\r\n}\r\n/**\r\n* Finds attributes in overrideConfig which are invalid or should be objects\r\n* and deletes them. useful in override config\r\n* @param overrideConfig - override config object\r\n* @param attributeNamesExpectedObjects - attributes that should be objects in override config object\r\n*/\r\nexport function _removeNonObjectsAndInvalidElements(overrideConfig, attributeNamesExpectedObjects) {\r\n _removeInvalidElements(overrideConfig);\r\n arrForEach(attributeNamesExpectedObjects, function (objectName, i) {\r\n if (isObject(overrideConfig[objectName])) {\r\n _removeInvalidElements(overrideConfig[objectName]);\r\n }\r\n else {\r\n delete overrideConfig[objectName];\r\n }\r\n });\r\n}\r\n/**\r\n* Finds attributes in object which are invalid\r\n* and deletes them. useful in override config\r\n* @param object Input object\r\n*/\r\nexport function _removeInvalidElements(object) {\r\n /// Because the config object 'callback' contains only functions,\r\n /// when it is stringified it returns the empty object. This explains\r\n /// the workaround regarding 'callback'\r\n objForEachKey(object, function (property, value) {\r\n if (!isValueAssigned(value) ||\r\n (JSON.stringify(value) === \"{}\" && (property !== \"callback\"))) {\r\n delete object[property];\r\n }\r\n });\r\n}\r\n/**\r\n* Gets intersection area of two rectangles\r\n* and deletes them. useful in override config\r\n* @param rect1 - object containing top, left, right, and bottom numbers\r\n* @param rect2 - object containing top, left, right, and bottom numbers\r\n* @returns Intersection area in px^2\r\n*/\r\nexport function _getIntersectionArea(rect1, rect2) {\r\n var x11 = rect1.left;\r\n var y11 = rect1.top;\r\n var x12 = rect1.right;\r\n var y12 = rect1.bottom;\r\n var x21 = rect2.left;\r\n var y21 = rect2.top;\r\n var x22 = rect2.right;\r\n var y22 = rect2.bottom;\r\n var xOverlap = Math.max(0, Math.min(x12, x22) - Math.max(x11, x21));\r\n var yOverlap = Math.max(0, Math.min(y12, y22) - Math.max(y11, y21));\r\n return xOverlap * yOverlap;\r\n}\r\n/**\r\n* Walks up DOM tree to find anchor element\r\n* @param element - DOM element\r\n* @returns Dom element which is an anchor\r\n*/\r\nexport function _findClosestAnchor(element) {\r\n /// Walks up DOM tree to find anchor element \r\n /// DOM element \r\n /// Dom element which is an anchor\r\n return _walkUpDomChainWithElementValidation(element, _isElementAnAnchor);\r\n}\r\n/**\r\n* Stringify object\r\n* @param fieldName - Field name\r\n* @param value - Value\r\n* @returns Stringified value\r\n*/\r\nexport function _stringifyField(fieldName, value) {\r\n if (value) {\r\n try {\r\n var stringified = JSON.stringify(value);\r\n if (stringified === \"{}\") {\r\n if (fieldName === \"timing\") {\r\n return _stringifyWindowPerformanceTiming();\r\n }\r\n }\r\n return stringified;\r\n }\r\n catch (e) {\r\n // JSON.Strigify has issues with circular references.\r\n // http://stackoverflow.com/questions/4816099/chrome-sendrequest-error-typeerror-converting-circular-structure-to-json\r\n var message = \"{'error': 'ERROR: could not stringify {0} {1}'}\";\r\n var token = (typeof value === \"string\") ? value : \"\";\r\n return message.replace(\"{0}\", fieldName).replace(\"{1}\", token);\r\n }\r\n }\r\n return \"\";\r\n}\r\n/**\r\n* Stringify window timing object\r\n* Safari does not serialize window.performance.timing, therefore this shim is necessary.\r\n* @returns stringified window.performance.timing\r\n*/\r\nfunction _stringifyWindowPerformanceTiming() {\r\n var performanceString = \"{\";\r\n if (isWindowObjectAvailable) {\r\n var WPTfields = [\"navigationStart\",\r\n \"unloadEventStart\",\r\n \"unloadEventEnd\",\r\n \"redirectStart\",\r\n \"redirectEnd\",\r\n \"fetchStart\",\r\n \"domainLookupStart\",\r\n \"domainLookupEnd\",\r\n \"connectStart\",\r\n \"connectEnd\",\r\n \"secureConnectionStart\",\r\n \"requestStart\",\r\n \"responseStart\",\r\n \"responseEnd\",\r\n \"domLoading\",\r\n \"domInteractive\",\r\n \"domContentLoadedEventStart\",\r\n \"domContentLoadedEventEnd\",\r\n \"domComplete\",\r\n \"loadEventStart\",\r\n \"loadEventEnd\"];\r\n var perf = getPerformance();\r\n var windowPerformanceTiming = perf ? perf.timing : {};\r\n for (var i = 0; i < WPTfields.length; i++) {\r\n var WindowPerformanceTimingTempValue = windowPerformanceTiming[WPTfields[i]];\r\n if (isValueAssigned(WindowPerformanceTimingTempValue)) {\r\n performanceString += \"'\" + WPTfields[i] + \"':\" + WindowPerformanceTimingTempValue;\r\n if (i < WPTfields.length - 1) {\r\n performanceString += \",\";\r\n }\r\n }\r\n }\r\n }\r\n performanceString += \"}\";\r\n return performanceString;\r\n}\r\n/**\r\n* Walks up DOM tree to find element which matches validationMethod\r\n* @param el - DOM element\r\n* @param validationMethod - DOM element validation method\r\n* @param validationMethodParam - DOM element validation method parameters\r\n* @returns Dom element which is an anchor\r\n*/\r\nexport function _walkUpDomChainWithElementValidation(el, validationMethod, validationMethodParam) {\r\n var element = el;\r\n if (element) {\r\n element = _returnDomObjectIfjQuery(element);\r\n while (!validationMethod(element, validationMethodParam)) {\r\n element = element.parentNode;\r\n element = _returnDomObjectIfjQuery(element);\r\n if (!element || !(element.getAttribute)) {\r\n return null;\r\n }\r\n }\r\n return element;\r\n }\r\n}\r\n/**\r\n* Determine if DOM element is an anchor\r\n* @param element - DOM element\r\n* @returns Is element an anchor\r\n*/\r\nexport function _isElementAnAnchor(element) {\r\n return element.nodeName === \"A\";\r\n}\r\n/**\r\n* Some elements might be jQuery, do not have method getAttribute\r\n* @param element - DOM or jQuery element\r\n* @returns DOM element\r\n*/\r\nexport function _returnDomObjectIfjQuery(element) {\r\n // TODO: Fix Jquery reference.\r\n // if (typeof jQuery === 'function' && element instanceof jQuery) {\r\n // return element[0];\r\n // }\r\n return element;\r\n}\r\n/**\r\n* Determines if an element is currently visible to the user\r\n* @param element - element to check for visibility\r\n* @param viewportBoundingRect - Viewport bounding rectangle\r\n* @returns true if element is truly visible\r\n*/\r\nexport function _isElementTrulyVisible(element, viewportBoundingRect) {\r\n element = _returnDomObjectIfjQuery(element);\r\n var rect = element.getBoundingClientRect();\r\n var intersectionArea = _getIntersectionArea(rect, viewportBoundingRect);\r\n if (intersectionArea > 0) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n}\r\n/**\r\n* Returns the specified field and also removes the property from the object if exists.\r\n* @param obj - Input object\r\n* @param fieldName - >Name of the field/property to be extracted\r\n* @returns Value of the specified tag\r\n*/\r\nexport function _extractFieldFromObject(obj, fieldName) {\r\n var fieldValue;\r\n if (obj && obj[fieldName]) {\r\n fieldValue = obj[fieldName];\r\n delete obj[fieldName];\r\n }\r\n return fieldValue;\r\n}\r\n/**\r\n* Determines whether an event is a right click or not\r\n* @param evt - Mouse event\r\n* @returns true if the event is a right click\r\n*/\r\nexport function _isRightClick(evt) {\r\n if (\"which\" in evt) { // Chrome, FF, ...\r\n return (evt.which === 3);\r\n }\r\n else if (\"button\" in evt) { // IE, ...\r\n return (evt.button === 2);\r\n }\r\n}\r\n/**\r\n* Determines whether an event is a left click or not\r\n* @param evt - Mouse event\r\n* @returns true if the event is a left click\r\n*/\r\nexport function _isLeftClick(evt) {\r\n if (\"which\" in evt) { // Chrome, FF, ...\r\n return (evt.which === 1);\r\n }\r\n else if (\"button\" in evt) { // IE, ...\r\n return (evt.button === 1);\r\n }\r\n}\r\n/**\r\n* Determines whether an event is a middle click or not\r\n* @param evt - Mouse event\r\n* @returns true if the event is a middle click\r\n*/\r\nexport function _isMiddleClick(evt) {\r\n if (\"which\" in evt) { // Chrome, FF, ...\r\n return (evt.which === 2);\r\n }\r\n else if (\"button\" in evt) { // IE, ...\r\n return (evt.button === 4);\r\n }\r\n}\r\n/**\r\n* Determines whether an event is a keyboard enter or not\r\n* @param evt - Keyboard event\r\n* @returns true if the event is a keyboard enter\r\n*/\r\nexport function _isKeyboardEnter(evt) {\r\n if (\"keyCode\" in evt) { // Chrome, FF, ...\r\n return (evt.keyCode === 13);\r\n }\r\n}\r\n/**\r\n* Determines whether an event is a keyboard space or not\r\n* @param evt - Keyboard event\r\n* @returns true if the event is a space enter\r\n*/\r\nexport function _isKeyboardSpace(evt) {\r\n if (\"keyCode\" in evt) { // Chrome, FF, ...\r\n return (evt.keyCode === 32);\r\n }\r\n}\r\n/**\r\n* Determines whether the element have a DNT(Do Not Track) tag\r\n* @param element - DOM element\r\n* @param doNotTrackFieldName - Deprecated\r\n* @returns true if the element must not be tracked\r\n*/\r\nexport function _isElementDnt(element, deprecated) {\r\n var dntElement = _findClosestByAttribute(element, doNotTrackFieldName);\r\n if (!isValueAssigned(dntElement)) {\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n* Determines whether the element can generate pageAction telemetry using data-bi attributes mto and dnt\r\n* @param element - DOM element\r\n* @param overrides - Override to determine if auto or manual call\r\n* @returns true if the element is can be tracked\r\n*/\r\nexport function _isClickTelemetryAllowed(element, overrideValues) {\r\n // MTO do not send auto telemetry for this element\r\n if (overrideValues &&\r\n overrideValues.isAuto &&\r\n isValueAssigned(_findClosestByAttribute(element, manualTrackOnlyFieldName))) {\r\n return false;\r\n }\r\n // Do not track element\r\n if (_isElementDnt(element)) {\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n* Walks up DOM tree to find element with attribute\r\n* @param el - DOM element\r\n* @param attribute - Attribute name\r\n* @returns Dom element which contains attribute\r\n*/\r\nexport function _findClosestByAttribute(el, attribute) {\r\n return _walkUpDomChainWithElementValidation(el, _isAttributeInElement, attribute);\r\n}\r\n/**\r\n* checks if attribute is in element.\r\n* method checks for empty string, in case the attribute is set but no value is assigned to it\r\n* @param element - DOM element\r\n* @param attributeToLookFor - Attribute name\r\n* @returns true if attribute is in element, even if empty string\r\n*/\r\nexport function _isAttributeInElement(element, attributeToLookFor) {\r\n var value = element.getAttribute(attributeToLookFor);\r\n return isValueAssigned(value) || value === \"\";\r\n}\r\n/**\r\n* Adds surrounding square brackets to the passed in text\r\n* @param str - Input string\r\n* @returns String with surrounding brackets\r\n*/\r\nexport function _bracketIt(str) {\r\n /// \r\n /// Adds surrounding square brackets to the passed in text\r\n /// \r\n return \"[\" + str + \"]\";\r\n}\r\n/**\r\n * When constantly called, debounce returns two functions, where:\r\n * - function 1 will trigger at first call,\r\n * - function 2 will be called at last call, after it stops being called for\r\n * 'wait' milliseconds\r\n * @param firstCallFunction - The function that will trigger at first call\r\n * @param secondCallFunction - The function that will trigger at last call after 'wait' milliseconds\r\n * @params wait - The debounce time interval\r\n */\r\nexport function _debounce(firstCallFunction, secondCallFunction, wait, context) {\r\n var timeout;\r\n return function () {\r\n var args = arguments;\r\n var later = function () {\r\n timeout = 0;\r\n if (secondCallFunction) {\r\n secondCallFunction.apply(context, args);\r\n }\r\n };\r\n var callNow = !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if (callNow) {\r\n if (firstCallFunction) {\r\n firstCallFunction.apply(context, args);\r\n }\r\n }\r\n };\r\n}\r\n/**\r\n * Get scroll offset\r\n * @returns Returns the scroll offset\r\n */\r\nexport function _getScrollOffset() {\r\n var scrollOffset = { h: 0, v: 0 };\r\n var win = getWindow();\r\n var doc = getDocument();\r\n if (doc && win) {\r\n scrollOffset = {\r\n h: parseInt(doc.body.scrollLeft || doc.documentElement.scrollLeft || win.pageXOffset, 10),\r\n v: parseInt(doc.body.scrollTop || doc.documentElement.scrollTop || win.pageYOffset, 10)\r\n };\r\n }\r\n return scrollOffset;\r\n}\r\n/**\r\n* Use window dimensions if available before reaching into DOM.\r\n* Accessing DOM frequently causes layout to reflow and impacts perf.\r\n* @returns Returns a Viewport object that contains dimensions of the current viewport\r\n* @description When this is executed from within an iFrame, the dimensions would be that of the iFrame and not the browser window.\r\n*/\r\nexport function _getViewportDimensions() {\r\n var viewport = { h: 0, w: 0 };\r\n var win = getWindow();\r\n var doc = getDocument();\r\n if (win && doc && win.screen) {\r\n var body = doc.body || {};\r\n var docElem = doc.documentElement || {};\r\n viewport.h = win.innerHeight || body.clientHeight || docElem.clientHeight;\r\n viewport.w = win.innerWidth || body.clientWidth || docElem.clientWidth;\r\n }\r\n return viewport;\r\n}\r\n/**\r\n * Get viewport bounding dimensions\r\n * @param viewportDimensions Dimensions of the viewport\r\n * @returns Returns viewport bounding rect\r\n */\r\nexport function _getViewportBoundingRect(viewportDimensions) {\r\n var viewportBoundingRect = {\r\n top: 0,\r\n bottom: viewportDimensions.h,\r\n left: 0,\r\n right: viewportDimensions.w\r\n };\r\n return viewportBoundingRect;\r\n}\r\n//# sourceMappingURL=Utils.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* DataCollector.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport { _throwInternal, arrForEach, createUniqueNamespace, eventOff, eventOn, getDocument, getLocation, getWindow, isDocumentObjectAvailable, isValueAssigned, isWindowObjectAvailable, mergeEvtNamespace } from \"@microsoft/1ds-core-js\";\r\nimport { _findClosestAnchor } from \"./common/Utils\";\r\nvar clickCaptureInputTypes = { BUTTON: true, CHECKBOX: true, RADIO: true, RESET: true, SUBMIT: true };\r\n/**\r\n* Get Image href of a given HTMLImageElement\r\n* @param element - An html image element\r\n* @returns Href value.\r\n*/\r\nexport function _getImageHref(element) {\r\n var temp = element;\r\n if (temp) {\r\n var parent = _findClosestAnchor(temp);\r\n if (parent && parent.length === 1) {\r\n if (parent[0].href) {\r\n return parent[0].href;\r\n }\r\n else if (parent[0].src) {\r\n return (parent[0].src);\r\n }\r\n }\r\n }\r\n return \"\";\r\n}\r\n/**\r\n* Check if a given element has an element has data-dc attribute defined with a value 'pii'\r\n* @param element - An html element\r\n* @returns Flag indicating if an element is market PII.\r\n*/\r\nexport function _isPii(element) {\r\n if (!element || !element.attributes) {\r\n return false;\r\n }\r\n try {\r\n var pii = element.getAttribute(\"data-dc\");\r\n if (isValueAssigned(pii)) {\r\n if (pii.toLowerCase() === \"pii\") {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n}\r\n/**\r\n* Get URI, sanitize the value if configured on\r\n* @param config - Configuration\r\n* @param location - window.location or document.location\r\n* @returns Flag indicating if an element is market PII.\r\n*/\r\nexport function _getUri(config, location) {\r\n if (config.coreData && config.coreData.requestUri && config.coreData.requestUri !== \"\") {\r\n return config.coreData.requestUri;\r\n }\r\n return _sanitizeUrl(config, location);\r\n}\r\n/**\r\n* Sanitize URL values\r\n* @param config - Configuration\r\n* @param location - window.location or document.location\r\n* @returns Flag indicating if an element is market PII.\r\n*/\r\nexport function _sanitizeUrl(config, location) {\r\n if (!location) {\r\n return null;\r\n }\r\n var url = location.protocol + \"//\" + (location.hostname || location.host) + // location.hostname is not supported on Opera and Opera for Android\r\n (isValueAssigned(location.port) ? \":\" + location.port : \"\") +\r\n location.pathname;\r\n if (config.urlCollectQuery) { // false by default\r\n var query = location.search;\r\n if (!query) {\r\n // in older browsers the query parameters can be contained in the hash\r\n var hash = location.hash || \"\";\r\n var queryIndex = hash.indexOf(\"?\");\r\n if (queryIndex !== -1) {\r\n query = hash.slice(queryIndex);\r\n }\r\n }\r\n url += query;\r\n }\r\n if (config.urlCollectHash) { // false by default\r\n url += (location.hash || \"\");\r\n }\r\n return url;\r\n}\r\n/**\r\n* Gets the pageName from the DOM or by calling a override if set.\r\n* @param config - configuration object\r\n* @returns Page name.\r\n*/\r\nexport function _getPageName(config, overrideValues) {\r\n /// \r\n /// Gets the pageName from the DOM or by calling a override if set.\r\n /// \r\n if (overrideValues && overrideValues.pageName) {\r\n return overrideValues.pageName;\r\n }\r\n else if (config.callback && typeof (config.callback.pageName) === \"function\") {\r\n return config.callback.pageName();\r\n }\r\n else if (config.coreData && config.coreData.pageName) {\r\n return config.coreData.pageName;\r\n }\r\n else {\r\n var loc = getLocation() || {};\r\n var pagename = loc.pathname || \"\";\r\n var fragments = pagename.replace(/(^\\/+|\\/+$)/g, \"\").split(\"/\");\r\n if (fragments && fragments[fragments.length - 1]) {\r\n pagename = fragments[fragments.length - 1];\r\n }\r\n else {\r\n pagename = \"Home\";\r\n }\r\n return pagename;\r\n }\r\n}\r\n/**\r\n* Gets the document's title. Title returned is trimmed to 150 characters\r\n* @returns Document title.\r\n*/\r\nexport function _getTitle() {\r\n return isDocumentObjectAvailable ? document.title.substring(0, 150) : \"\";\r\n}\r\nexport function _getSignedInStatus(config) {\r\n var isLoggedIn = config.callback && typeof (config.callback.signedinStatus) === \"function\" ?\r\n config.callback.signedinStatus() : config.isLoggedIn;\r\n return isLoggedIn;\r\n}\r\n/**\r\n* Gets client cookies\r\n* @returns Cookies.\r\n*/\r\nexport function _getClientCookies(config, traceLogger) {\r\n var cookies = \"\";\r\n var uniqueCookies = {};\r\n var mergedCookies = [];\r\n var cookiesConfig = config.cookiesToCollect;\r\n if (config.shareAuthStatus === false) {\r\n // collect ANON if it is in cookiesConfig\r\n mergedCookies = cookiesConfig;\r\n }\r\n else {\r\n // do not collect ANON even if it is in cookiesConfig\r\n arrForEach(cookiesConfig, function (value) {\r\n if (value !== \"ANON\") {\r\n mergedCookies.push(value);\r\n }\r\n });\r\n }\r\n var key;\r\n var cookieValue;\r\n try {\r\n try {\r\n // adding a try catch block to ensure any mis-handling\r\n // of the varCustomerCookies variable by adopters is not impacting the rest.\r\n if (isWindowObjectAvailable && window.varCustomerCookies && window.varCustomerCookies.length > 0) {\r\n mergedCookies = mergedCookies.concat(window.varCustomerCookies);\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(traceLogger, 1 /* eLoggingSeverity.CRITICAL */, 512 /* _eExtendedInternalMessageId.FailedToGetCookies */, \"Failed to get cookies \");\r\n }\r\n arrForEach(mergedCookies, function (value) {\r\n // de-dupe the list, no value is necessary hence ''\r\n if (!uniqueCookies.hasOwnProperty(value)) {\r\n uniqueCookies[value] = \"\";\r\n if (isDocumentObjectAvailable) {\r\n cookieValue = decodeURIComponent(document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + encodeURIComponent(value).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") +\r\n \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\"));\r\n if (cookieValue !== \"\") {\r\n cookies += value + \"=\" + cookieValue + \";\";\r\n }\r\n }\r\n }\r\n });\r\n }\r\n catch (e) {\r\n _throwInternal(traceLogger, 1 /* eLoggingSeverity.CRITICAL */, 512 /* _eExtendedInternalMessageId.FailedToGetCookies */, \"Failed to get cookies \");\r\n }\r\n return cookies;\r\n}\r\n/**\r\n *\r\n* Get click target\r\n* @returns Click target URI\r\n*/\r\nexport function _getClickTarget(element) {\r\n var clickTarget = \"\";\r\n switch (element.tagName) {\r\n case \"A\":\r\n case \"AREA\":\r\n clickTarget = element.href || \"\";\r\n break;\r\n case \"IMG\":\r\n clickTarget = _getImageHref(element);\r\n break;\r\n case \"INPUT\":\r\n var type = element.type;\r\n if (type && (clickCaptureInputTypes[type.toUpperCase()])) {\r\n var loc = getLocation() || {};\r\n if (element.form) {\r\n clickTarget = element.form.action || (loc.pathname || \"\");\r\n }\r\n else {\r\n clickTarget = loc.pathname || \"\";\r\n }\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n return clickTarget;\r\n}\r\n/**\r\n *\r\n * Execute callback when DOM finish loading\r\n */\r\nexport function onDomLoaded(callback, parentEvtNamespace) {\r\n var evtNamespace = mergeEvtNamespace(createUniqueNamespace(\"onDomLoaded\"), parentEvtNamespace);\r\n onDomReadyDo(function () {\r\n if (isDocumentObjectAvailable && document.readyState === \"complete\") {\r\n callback();\r\n }\r\n else {\r\n var win_1 = getWindow();\r\n if (win_1) {\r\n eventOn(win_1, \"load\", function () {\r\n callback && callback();\r\n callback = null;\r\n // Auto remove the event handler\r\n eventOff(win_1, null, null, evtNamespace);\r\n }, evtNamespace);\r\n }\r\n }\r\n });\r\n}\r\n// use smallest domready ever for IE8. When IE8 is deprecated, use addEventListener('DomContentLoaded')\r\nfunction onDomReadyDo(f) {\r\n /// fires function f on domRead \r\n /// function to call on domRead\r\n var doc = getDocument() || {};\r\n /in/.test(doc.readyState) ? setTimeout(function () { onDomReadyDo(f); }, 100) : f.call();\r\n}\r\n//# sourceMappingURL=DataCollector.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* id.ts\r\n* @author Ram Thiru (ramthi)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { createGuid, generateW3CId, getCookieValue, getDocument, getLocation, safeGetCookieMgr } from \"@microsoft/1ds-core-js\";\r\n// Limit support to i, w, and c; make logging accidental PII data more difficult.\r\nvar userIdPrefixes = [\r\n \"c:\",\r\n \"i:\",\r\n \"w:\" // domain user id as hash\r\n];\r\nvar supportedMuidHosts = {\r\n \"microsoft.com\": \"c1.microsoft.com\",\r\n \"xbox.com\": \"c.xbox.com\",\r\n \"live.com\": \"c.live.com\",\r\n \"microsoftstore.com\": \"c.microsoftstore.com\",\r\n \"msn.com\": \"c.msn.com\",\r\n \"windows.com\": \"c.windows.com\",\r\n \"office.com\": \"c.office.com\"\r\n};\r\nvar Id = /** @class */ (function () {\r\n function Id(core) {\r\n this.core = core;\r\n var lastPageViewId = createGuid();\r\n var internalTraceId = generateW3CId();\r\n var appUserId = null;\r\n var firstPageView = false;\r\n var deviceClass;\r\n var _cookieMgr = safeGetCookieMgr(core);\r\n dynamicProto(Id, this, function (_self) {\r\n _self.getTraceId = function () {\r\n if (core && core.getTraceCtx) {\r\n return core.getTraceCtx().getTraceId() || internalTraceId;\r\n }\r\n return internalTraceId;\r\n };\r\n _self.getLastPageViewId = function () {\r\n return lastPageViewId;\r\n };\r\n _self.initializeIds = function () {\r\n if (!firstPageView) {\r\n firstPageView = true;\r\n }\r\n else {\r\n // this.traceId = this.createTraceId();\r\n lastPageViewId = createGuid();\r\n }\r\n };\r\n _self.getMuidUserId = function () {\r\n var muidValue = getCookieValue(_cookieMgr, \"MUID\");\r\n return muidValue && muidValue.length ? \"t:\" + muidValue : muidValue;\r\n };\r\n /// Set app user id.\r\n _self.setAppUserId = function (uid) {\r\n appUserId = null; // Make sure to reset the last user id.\r\n if (!uid) {\r\n return; // No need to log null or empty user ids which can be used to reset app user ids.\r\n }\r\n for (var i = 0; i < userIdPrefixes.length; i++) {\r\n if (userIdPrefixes[i] === uid.substring(0, 2)) {\r\n appUserId = uid;\r\n break;\r\n }\r\n }\r\n if (!appUserId) {\r\n // this._traceLogger.w('Unsupported app user id: ' + uid + '. Supported app user ids are: c:, i:, and w:');\r\n }\r\n };\r\n _self.setDeviceClass = function (newDeviceClass) {\r\n if (newDeviceClass) {\r\n deviceClass = newDeviceClass;\r\n }\r\n };\r\n _self.getDeviceClass = function () {\r\n return deviceClass;\r\n };\r\n _self.getAppUserId = function () {\r\n return appUserId;\r\n };\r\n _self.syncMuid = function (muidHost) {\r\n var location = getLocation();\r\n if (location && muidHost) {\r\n var muidsrc = (location.protocol || \"http:\") + \"//\" + muidHost + \"/c.gif?DI=4050&did=1&t=\";\r\n var document_1 = getDocument();\r\n if (document_1) {\r\n var img = document_1.createElement(\"IMG\");\r\n img.style.display = \"none\";\r\n img.src = muidsrc;\r\n img.hidden = \"\";\r\n img[\"aria-hidden\"] = \"true\";\r\n img.role = \"presentation\";\r\n }\r\n return true;\r\n }\r\n return false;\r\n };\r\n _self.getMuidHost = function (rootDomain) {\r\n return supportedMuidHosts[rootDomain];\r\n };\r\n });\r\n }\r\n Id.visitorId = function () {\r\n var userId = getCookieValue(safeGetCookieMgr(null), \"MUID\");\r\n return userId;\r\n };\r\n// Removed Stub for Id.prototype.getTraceId.\r\n// Removed Stub for Id.prototype.getLastPageViewId.\r\n// Removed Stub for Id.prototype.initializeIds.\r\n// Removed Stub for Id.prototype.getMuidUserId.\r\n /// Set app user id.\r\n// Removed Stub for Id.prototype.setAppUserId.\r\n// Removed Stub for Id.prototype.setDeviceClass.\r\n// Removed Stub for Id.prototype.getDeviceClass.\r\n// Removed Stub for Id.prototype.getAppUserId.\r\n// Removed Stub for Id.prototype.syncMuid.\r\n// Removed Stub for Id.prototype.getMuidHost.\r\n return Id;\r\n}());\r\nexport { Id };\r\n//# sourceMappingURL=Id.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* timespan.ts\r\n* @author Ram Thiru (ramthi)\r\n* @copyright Microsoft 2018\r\n*/\r\nvar Timespan = /** @class */ (function () {\r\n function Timespan() {\r\n this._timers = [];\r\n }\r\n /**\r\n * Records the current time on a timer object identified by the counterName passed in\r\n * Returns a number > 0 that denotes the milliseconds elapsed between start and current time, if isComplete param is set to true.\r\n * @param counterName - Unique name for the counter instance that needs to be operated on.\r\n * @param isComplete - Indicates if the call is to complete a timer or start a new one.\r\n */\r\n Timespan.prototype._recordTimeSpan = function (counterName, isComplete) {\r\n var timestamp = new Date().getTime();\r\n if (!isComplete) {\r\n this._timers[counterName] = timestamp;\r\n }\r\n else {\r\n return timestamp - this._timers[counterName];\r\n }\r\n };\r\n return Timespan;\r\n}());\r\nexport { Timespan };\r\n//# sourceMappingURL=Timespan.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* webEvents.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport * as DataCollector from \"../DataCollector\";\r\nimport { cookieAvailable, extend, getLocation, isArray, isValueAssigned, isWindowObjectAvailable, objForEachKey } from \"@microsoft/1ds-core-js\";\r\nimport { Behavior } from \"../Behaviors\";\r\nimport { MSCONTENT_PARTB_VERSION } from \"../common/Constants\";\r\nimport { _bracketIt } from \"../common/Utils\";\r\n/**\r\n* Get the specified metadata value from the collection\r\n* If overrideValue is specified in the config that takes precedence.\r\n* @param metaTags - Meta data.\r\n* @param awaTags - Coredata values from configuration.\r\n* @param metaTagName - Name of the metaTag to get.\r\n* @returns Meta data value\r\n*/\r\nfunction _getMetaData(metaTags, coreData, metaTagName) {\r\n var value = \"\";\r\n if (coreData && coreData[metaTagName]) {\r\n value = coreData[metaTagName];\r\n }\r\n else if (metaTags) {\r\n value = metaTags[metaTagName];\r\n }\r\n return value;\r\n}\r\nvar WebEvent = /** @class */ (function () {\r\n /**\r\n * @param webAnalyticsPlugin - Web Analytics plugin instance\r\n * @param config - WebAnalytics configuration object\r\n * @param contentHandler - Content handler\r\n * @param id - Id object\r\n * @param pageTagsCallback - callback methods to get pageTags value\r\n * @param metaTags - Meta tags\r\n * @param traceLogger - Trace logger to log to console.\r\n */\r\n function WebEvent(_webAnalyticsPlugin, _config, _contentHandler, _id, _pageTagsCallback, metaTags, _traceLogger) {\r\n this._webAnalyticsPlugin = _webAnalyticsPlugin;\r\n this._config = _config;\r\n this._contentHandler = _contentHandler;\r\n this._id = _id;\r\n this._pageTagsCallback = _pageTagsCallback;\r\n this.metaTags = metaTags;\r\n this._traceLogger = _traceLogger;\r\n this._pageTags = {};\r\n }\r\n WebEvent.prototype._setBasicProperties = function (event, overrideValues) {\r\n // Fill common PartB fields\r\n event.ver = MSCONTENT_PARTB_VERSION;\r\n event.id = this._id.getLastPageViewId();\r\n if (!isValueAssigned(event.name)) {\r\n event.name = DataCollector._getPageName(this._config, overrideValues);\r\n }\r\n if (!isValueAssigned(event.uri) && isWindowObjectAvailable) {\r\n event.uri = DataCollector._getUri(this._config, getLocation());\r\n }\r\n };\r\n /**\r\n * Sets common properties for events that are based on the WebEvent schema.\r\n * @param event - The event\r\n */\r\n WebEvent.prototype._setCommonProperties = function (event, eventProperties, overrideValues) {\r\n var _self = this;\r\n _self._setBasicProperties(event, overrideValues);\r\n _self._setPageTags(event, overrideValues);\r\n // extract specific meta tags out of the pageTags.metaTags collection. These will go into assigned first class fields in the event.\r\n // the rest will go into pageTags.metaTags collection as is.\r\n _self._pageTypeMetaTag = _getMetaData(_self.metaTags, _self._config.coreData, \"pageType\");\r\n _self._marketMetaTag = _getMetaData(_self.metaTags, _self._config.coreData, \"market\");\r\n _self._behaviorMetaTag = _getMetaData(_self.metaTags, _self._config.coreData, \"behavior\");\r\n if (isValueAssigned(overrideValues.pageType)) {\r\n event.pageType = overrideValues.pageType;\r\n }\r\n // Only assign if not overriden and meta data is available\r\n if (isValueAssigned(_self._pageTypeMetaTag) && !isValueAssigned(event.pageType)) {\r\n event.pageType = _self._pageTypeMetaTag;\r\n }\r\n if (isValueAssigned(_self._marketMetaTag)) {\r\n event.market = _self._marketMetaTag;\r\n }\r\n event.isLoggedIn = DataCollector._getSignedInStatus(_self._config);\r\n // Fill common PartC fields\r\n eventProperties.cookieEnabled = cookieAvailable();\r\n };\r\n /**\r\n * Sets pageTags.\r\n * @param event - The event\r\n */\r\n WebEvent.prototype._setPageTags = function (event, overrideValues) {\r\n var _self = this;\r\n _self._pageTags = {};\r\n // Use DOM meta data first and then apply overrides\r\n if (_self.metaTags) {\r\n _self._pageTags.metaTags = _self._pageTags.metaTags || {};\r\n // Remove not supported meta data in pageTags.metaTags\r\n objForEachKey(_self.metaTags, function (metaTag, value) {\r\n if (metaTag !== \"behavior\" && metaTag !== \"market\" && metaTag !== \"pageType\") {\r\n _self._pageTags.metaTags[metaTag] = value;\r\n }\r\n });\r\n }\r\n // Prepare the pageTags object that is mostly the same for all events. Event specific pageTags will be added inside event constructors.\r\n if (_self._config.coreData && _self._config.coreData.pageTags) {\r\n _self._pageTags = extend(true, _self._pageTags, _self._config.coreData.pageTags);\r\n }\r\n if (_self._pageTagsCallback) {\r\n _self._pageTags = extend(true, _self._pageTags, _self._pageTagsCallback());\r\n }\r\n if (isValueAssigned(overrideValues.pageTags)) {\r\n _self._pageTags = extend(true, _self._pageTags, overrideValues.pageTags);\r\n }\r\n // All metadata tags that must be saved as properties have been extracted at this point. Assign pageTags as is.\r\n event.properties = event.properties || {};\r\n event.properties[\"pageTags\"] = _self._pageTags;\r\n };\r\n WebEvent.prototype._getBehavior = function (overrideValues) {\r\n var behavior;\r\n // If override specified\r\n if (overrideValues && isValueAssigned(overrideValues.behavior)) {\r\n behavior = overrideValues.behavior;\r\n }\r\n else if (isValueAssigned(this._behaviorMetaTag)) {\r\n behavior = this._behaviorMetaTag;\r\n }\r\n return this._getValidBehavior(behavior);\r\n };\r\n WebEvent.prototype._getValidBehavior = function (behavior) {\r\n if (isValueAssigned(behavior)) {\r\n var result = void 0;\r\n var value = parseInt(behavior);\r\n if (!isNaN(value)) {\r\n result = value;\r\n }\r\n else {\r\n result = Behavior[behavior];\r\n }\r\n if (result in Behavior) {\r\n return result;\r\n }\r\n }\r\n return 0; /*UNDEFINED*/\r\n };\r\n WebEvent.prototype._getContentFormatted = function (content) {\r\n if (isValueAssigned(content)) {\r\n if (isArray(content)) {\r\n return JSON.stringify(content);\r\n }\r\n else {\r\n return _bracketIt(JSON.stringify(content));\r\n }\r\n }\r\n return undefined;\r\n };\r\n return WebEvent;\r\n}());\r\nexport { WebEvent };\r\n//# sourceMappingURL=WebEvent.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Enums.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* Copyright (c) Microsoft and contributors. All rights reserved.\r\n*/\r\n// Behavior enum values\r\nexport var Behavior;\r\n(function (Behavior) {\r\n Behavior[Behavior[\"UNDEFINED\"] = 0] = \"UNDEFINED\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Page Experience [1-19]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"NAVIGATIONBACK\"] = 1] = \"NAVIGATIONBACK\";\r\n Behavior[Behavior[\"NAVIGATION\"] = 2] = \"NAVIGATION\";\r\n Behavior[Behavior[\"NAVIGATIONFORWARD\"] = 3] = \"NAVIGATIONFORWARD\";\r\n Behavior[Behavior[\"APPLY\"] = 4] = \"APPLY\";\r\n Behavior[Behavior[\"REMOVE\"] = 5] = \"REMOVE\";\r\n Behavior[Behavior[\"SORT\"] = 6] = \"SORT\";\r\n Behavior[Behavior[\"EXPAND\"] = 7] = \"EXPAND\";\r\n Behavior[Behavior[\"REDUCE\"] = 8] = \"REDUCE\";\r\n Behavior[Behavior[\"CONTEXTMENU\"] = 9] = \"CONTEXTMENU\";\r\n Behavior[Behavior[\"TAB\"] = 10] = \"TAB\";\r\n Behavior[Behavior[\"COPY\"] = 11] = \"COPY\";\r\n Behavior[Behavior[\"EXPERIMENTATION\"] = 12] = \"EXPERIMENTATION\";\r\n Behavior[Behavior[\"PRINT\"] = 13] = \"PRINT\";\r\n Behavior[Behavior[\"SHOW\"] = 14] = \"SHOW\";\r\n Behavior[Behavior[\"HIDE\"] = 15] = \"HIDE\";\r\n Behavior[Behavior[\"MAXIMIZE\"] = 16] = \"MAXIMIZE\";\r\n Behavior[Behavior[\"MINIMIZE\"] = 17] = \"MINIMIZE\";\r\n Behavior[Behavior[\"BACKBUTTON\"] = 18] = \"BACKBUTTON\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Scenario Process [20-39]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"STARTPROCESS\"] = 20] = \"STARTPROCESS\";\r\n Behavior[Behavior[\"PROCESSCHECKPOINT\"] = 21] = \"PROCESSCHECKPOINT\";\r\n Behavior[Behavior[\"COMPLETEPROCESS\"] = 22] = \"COMPLETEPROCESS\";\r\n Behavior[Behavior[\"SCENARIOCANCEL\"] = 23] = \"SCENARIOCANCEL\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Download [40-59]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"DOWNLOADCOMMIT\"] = 40] = \"DOWNLOADCOMMIT\";\r\n Behavior[Behavior[\"DOWNLOAD\"] = 41] = \"DOWNLOAD\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Search [60-79]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"SEARCHAUTOCOMPLETE\"] = 60] = \"SEARCHAUTOCOMPLETE\";\r\n Behavior[Behavior[\"SEARCH\"] = 61] = \"SEARCH\";\r\n Behavior[Behavior[\"SEARCHINITIATE\"] = 62] = \"SEARCHINITIATE\";\r\n Behavior[Behavior[\"TEXTBOXINPUT\"] = 63] = \"TEXTBOXINPUT\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Commerce [80-99]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"PURCHASE\"] = 80] = \"PURCHASE\";\r\n Behavior[Behavior[\"ADDTOCART\"] = 81] = \"ADDTOCART\";\r\n Behavior[Behavior[\"VIEWCART\"] = 82] = \"VIEWCART\";\r\n Behavior[Behavior[\"ADDWISHLIST\"] = 83] = \"ADDWISHLIST\";\r\n Behavior[Behavior[\"FINDSTORE\"] = 84] = \"FINDSTORE\";\r\n Behavior[Behavior[\"CHECKOUT\"] = 85] = \"CHECKOUT\";\r\n Behavior[Behavior[\"REMOVEFROMCART\"] = 86] = \"REMOVEFROMCART\";\r\n Behavior[Behavior[\"PURCHASECOMPLETE\"] = 87] = \"PURCHASECOMPLETE\";\r\n Behavior[Behavior[\"VIEWCHECKOUTPAGE\"] = 88] = \"VIEWCHECKOUTPAGE\";\r\n Behavior[Behavior[\"VIEWCARTPAGE\"] = 89] = \"VIEWCARTPAGE\";\r\n Behavior[Behavior[\"VIEWPDP\"] = 90] = \"VIEWPDP\";\r\n Behavior[Behavior[\"UPDATEITEMQUANTITY\"] = 91] = \"UPDATEITEMQUANTITY\";\r\n Behavior[Behavior[\"INTENTTOBUY\"] = 92] = \"INTENTTOBUY\";\r\n Behavior[Behavior[\"PUSHTOINSTALL\"] = 93] = \"PUSHTOINSTALL\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Authentication [100-119]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"SIGNIN\"] = 100] = \"SIGNIN\";\r\n Behavior[Behavior[\"SIGNOUT\"] = 101] = \"SIGNOUT\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Social [120-139]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"SOCIALSHARE\"] = 120] = \"SOCIALSHARE\";\r\n Behavior[Behavior[\"SOCIALLIKE\"] = 121] = \"SOCIALLIKE\";\r\n Behavior[Behavior[\"SOCIALREPLY\"] = 122] = \"SOCIALREPLY\";\r\n Behavior[Behavior[\"CALL\"] = 123] = \"CALL\";\r\n Behavior[Behavior[\"EMAIL\"] = 124] = \"EMAIL\";\r\n Behavior[Behavior[\"COMMUNITY\"] = 125] = \"COMMUNITY\";\r\n Behavior[Behavior[\"SOCIALFOLLOW\"] = 126] = \"SOCIALFOLLOW\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Feedback [140-159]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"VOTE\"] = 140] = \"VOTE\";\r\n Behavior[Behavior[\"SURVEYINITIATE\"] = 141] = \"SURVEYINITIATE\";\r\n Behavior[Behavior[\"SURVEYCOMPLETE\"] = 142] = \"SURVEYCOMPLETE\";\r\n Behavior[Behavior[\"REPORTAPPLICATION\"] = 143] = \"REPORTAPPLICATION\";\r\n Behavior[Behavior[\"REPORTREVIEW\"] = 144] = \"REPORTREVIEW\";\r\n Behavior[Behavior[\"SURVEYCHECKPOINT\"] = 145] = \"SURVEYCHECKPOINT\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Registration, Contact [160-179]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"CONTACT\"] = 160] = \"CONTACT\";\r\n Behavior[Behavior[\"REGISTRATIONINITIATE\"] = 161] = \"REGISTRATIONINITIATE\";\r\n Behavior[Behavior[\"REGISTRATIONCOMPLETE\"] = 162] = \"REGISTRATIONCOMPLETE\";\r\n Behavior[Behavior[\"CANCELSUBSCRIPTION\"] = 163] = \"CANCELSUBSCRIPTION\";\r\n Behavior[Behavior[\"RENEWSUBSCRIPTION\"] = 164] = \"RENEWSUBSCRIPTION\";\r\n Behavior[Behavior[\"CHANGESUBSCRIPTION\"] = 165] = \"CHANGESUBSCRIPTION\";\r\n Behavior[Behavior[\"REGISTRATIONCHECKPOINT\"] = 166] = \"REGISTRATIONCHECKPOINT\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Chat [180-199]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"CHATINITIATE\"] = 180] = \"CHATINITIATE\";\r\n Behavior[Behavior[\"CHATEND\"] = 181] = \"CHATEND\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Trial [200-209]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"TRIALSIGNUP\"] = 200] = \"TRIALSIGNUP\";\r\n Behavior[Behavior[\"TRIALINITIATE\"] = 201] = \"TRIALINITIATE\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Signup [210-219]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"SIGNUP\"] = 210] = \"SIGNUP\";\r\n Behavior[Behavior[\"FREESIGNUP\"] = 211] = \"FREESIGNUP\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Referals [220-229]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"PARTNERREFERRAL\"] = 220] = \"PARTNERREFERRAL\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Intents [230-239]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"LEARNLOWFUNNEL\"] = 230] = \"LEARNLOWFUNNEL\";\r\n Behavior[Behavior[\"LEARNHIGHFUNNEL\"] = 231] = \"LEARNHIGHFUNNEL\";\r\n Behavior[Behavior[\"SHOPPINGINTENT\"] = 232] = \"SHOPPINGINTENT\";\r\n Behavior[Behavior[\"TRIALINTENT\"] = 234] = \"TRIALINTENT\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Video [240-259]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"VIDEOSTART\"] = 240] = \"VIDEOSTART\";\r\n Behavior[Behavior[\"VIDEOPAUSE\"] = 241] = \"VIDEOPAUSE\";\r\n Behavior[Behavior[\"VIDEOCONTINUE\"] = 242] = \"VIDEOCONTINUE\";\r\n Behavior[Behavior[\"VIDEOCHECKPOINT\"] = 243] = \"VIDEOCHECKPOINT\";\r\n Behavior[Behavior[\"VIDEOJUMP\"] = 244] = \"VIDEOJUMP\";\r\n Behavior[Behavior[\"VIDEOCOMPLETE\"] = 245] = \"VIDEOCOMPLETE\";\r\n Behavior[Behavior[\"VIDEOBUFFERING\"] = 246] = \"VIDEOBUFFERING\";\r\n Behavior[Behavior[\"VIDEOERROR\"] = 247] = \"VIDEOERROR\";\r\n Behavior[Behavior[\"VIDEOMUTE\"] = 248] = \"VIDEOMUTE\";\r\n Behavior[Behavior[\"VIDEOUNMUTE\"] = 249] = \"VIDEOUNMUTE\";\r\n Behavior[Behavior[\"VIDEOFULLSCREEN\"] = 250] = \"VIDEOFULLSCREEN\";\r\n Behavior[Behavior[\"VIDEOUNFULLSCREEN\"] = 251] = \"VIDEOUNFULLSCREEN\";\r\n Behavior[Behavior[\"VIDEOREPLAY\"] = 252] = \"VIDEOREPLAY\";\r\n Behavior[Behavior[\"VIDEOPLAYERLOAD\"] = 253] = \"VIDEOPLAYERLOAD\";\r\n Behavior[Behavior[\"VIDEOPLAYERCLICK\"] = 254] = \"VIDEOPLAYERCLICK\";\r\n Behavior[Behavior[\"VIDEOVOLUMECONTROL\"] = 255] = \"VIDEOVOLUMECONTROL\";\r\n Behavior[Behavior[\"VIDEOAUDIOTRACKCONTROL\"] = 256] = \"VIDEOAUDIOTRACKCONTROL\";\r\n Behavior[Behavior[\"VIDEOCLOSEDCAPTIONCONTROL\"] = 257] = \"VIDEOCLOSEDCAPTIONCONTROL\";\r\n Behavior[Behavior[\"VIDEOCLOSEDCAPTIONSTYLE\"] = 258] = \"VIDEOCLOSEDCAPTIONSTYLE\";\r\n Behavior[Behavior[\"VIDEORESOLUTIONCONTROL\"] = 259] = \"VIDEORESOLUTIONCONTROL\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // Virtual Event [260-279]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"VIRTUALEVENTJOIN\"] = 260] = \"VIRTUALEVENTJOIN\";\r\n Behavior[Behavior[\"VIRTUALEVENTEND\"] = 261] = \"VIRTUALEVENTEND\";\r\n Behavior[Behavior[\"JOINTEAMSMEETINGEVENT\"] = 262] = \"JOINTEAMSMEETINGEVENT\";\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n // \tAdvertisement Engagement [280-299]\r\n ///////////////////////////////////////////////////////////////////////////////////////////////////\r\n Behavior[Behavior[\"IMPRESSION\"] = 280] = \"IMPRESSION\";\r\n Behavior[Behavior[\"CLICK\"] = 281] = \"CLICK\";\r\n Behavior[Behavior[\"RICHMEDIACOMPLETE\"] = 282] = \"RICHMEDIACOMPLETE\";\r\n Behavior[Behavior[\"ADBUFFERING\"] = 283] = \"ADBUFFERING\";\r\n Behavior[Behavior[\"ADERROR\"] = 284] = \"ADERROR\";\r\n Behavior[Behavior[\"ADSTART\"] = 285] = \"ADSTART\";\r\n Behavior[Behavior[\"ADCOMPLETE\"] = 286] = \"ADCOMPLETE\";\r\n Behavior[Behavior[\"ADSKIP\"] = 287] = \"ADSKIP\";\r\n Behavior[Behavior[\"ADTIMEOUT\"] = 288] = \"ADTIMEOUT\";\r\n Behavior[Behavior[\"OTHER\"] = 300] = \"OTHER\"; // Other\r\n})(Behavior || (Behavior = {}));\r\n//# sourceMappingURL=Behaviors.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Constants.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez(hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nexport var COMMON_SCHEMA_VER = \"2.1\";\r\nexport var MSCONTENT_PARTB_VERSION = \"1.0\";\r\nexport var CONTENT_VERSION = \"2.0\";\r\nexport var MAX_CONTENTNAME_LENGTH = 200;\r\nexport var IS_SENSITIVE_FLAG = 0x080000;\r\nexport var APPID_PREFIX = \"JS:\";\r\n//# sourceMappingURL=Constants.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* ContentUpdate.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\nimport { arrForEach, isDocumentObjectAvailable, isValueAssigned, objForEachKey } from \"@microsoft/1ds-core-js\";\r\nimport { CONTENT_VERSION } from \"../common/Constants\";\r\nimport { _getScrollOffset, _getViewportDimensions } from \"../common/Utils\";\r\nimport { WebEvent } from \"./WebEvent\";\r\nvar ContentUpdate = /** @class */ (function (_super) {\r\n __extends(ContentUpdate, _super);\r\n function ContentUpdate() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * API to send ContentUpdate event\r\n * @param contentUpdateEvent - ContentUpdate event\r\n * @param properties - ContentUpdate properties(Part C)\r\n */\r\n ContentUpdate.prototype.trackContentUpdate = function (contentUpdateEvent, properties) {\r\n // Get part A properties\r\n var ext = {};\r\n ext[\"web\"] = {};\r\n ext[\"web\"][\"isManual\"] = contentUpdateEvent.isManual;\r\n var event = {\r\n name: \"Ms.Web.ContentUpdate\",\r\n baseType: \"ContentUpdateData\",\r\n ext: ext,\r\n data: {},\r\n baseData: {},\r\n latency: 3 /* EventLatencyValue.RealTime */\r\n };\r\n arrForEach([\r\n \"name\",\r\n \"uri\",\r\n \"market\",\r\n \"pageType\",\r\n \"isLoggedIn\",\r\n \"id\",\r\n \"properties\",\r\n \"ver\",\r\n \"actionType\",\r\n \"behavior\",\r\n \"pageHeight\",\r\n \"content\",\r\n \"contentVer\",\r\n \"vpHeight\",\r\n \"vpWidth\",\r\n \"vScrollOffset\",\r\n \"hScrollOffset\"\r\n ], function (key) {\r\n event.baseData[key] = contentUpdateEvent[key];\r\n });\r\n objForEachKey(properties, function (property, value) {\r\n if (!event.data[property]) {\r\n event.data[property] = value;\r\n }\r\n });\r\n this._webAnalyticsPlugin.core.track(event);\r\n };\r\n /**\r\n * API to create and send a populated ContentUpdate event\r\n * @param overrideValues - ContentUpdate overrides\r\n * @param customProperties - Custom properties(Part C)\r\n */\r\n ContentUpdate.prototype.captureContentUpdate = function (overrideValues, customProperties) {\r\n overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;\r\n var event = {};\r\n var properties = isValueAssigned(customProperties) ? customProperties : {};\r\n this._setCommonProperties(event, properties, overrideValues);\r\n event.behavior = this._getBehavior(overrideValues);\r\n if (isValueAssigned(overrideValues.actionType)) {\r\n event.actionType = overrideValues.actionType;\r\n }\r\n var viewportDim = _getViewportDimensions();\r\n var scrollOffset = _getScrollOffset();\r\n event.pageHeight = isDocumentObjectAvailable ? document.body.scrollHeight : null;\r\n event.vpHeight = viewportDim.h;\r\n event.vpWidth = viewportDim.w;\r\n event.vScrollOffset = scrollOffset.v;\r\n event.hScrollOffset = scrollOffset.h;\r\n event.contentVer = CONTENT_VERSION;\r\n event.isManual = !overrideValues.isAuto;\r\n var content = this._getContentFormatted(overrideValues.content) || JSON.stringify(this._contentHandler.getVisibleContent());\r\n if (content) {\r\n event.content = content;\r\n }\r\n // Set PartC values\r\n if (isValueAssigned(overrideValues.isDomComplete)) {\r\n properties.isDomComplete = overrideValues.isDomComplete;\r\n }\r\n else {\r\n properties.isDomComplete = false;\r\n }\r\n this.trackContentUpdate(event, properties);\r\n };\r\n return ContentUpdate;\r\n}(WebEvent));\r\nexport { ContentUpdate };\r\n//# sourceMappingURL=ContentUpdate.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* Enums.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nexport var ActionType = {\r\n CLICKLEFT: \"CL\",\r\n CLICKRIGHT: \"CR\",\r\n CLICKMIDDLE: \"CM\",\r\n SCROLL: \"S\",\r\n ZOOM: \"Z\",\r\n RESIZE: \"R\",\r\n KEYBOARDENTER: \"KE\",\r\n KEYBOARDSPACE: \"KS\",\r\n OTHER: \"O\"\r\n};\r\nexport var EventType;\r\n(function (EventType) {\r\n EventType[EventType[\"PAGE_ACTION\"] = 0] = \"PAGE_ACTION\";\r\n EventType[EventType[\"CONTENT_UPDATE\"] = 1] = \"CONTENT_UPDATE\";\r\n})(EventType || (EventType = {}));\r\n//# sourceMappingURL=Enums.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* pageAction.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\nimport * as DataCollector from \"../DataCollector\";\r\nimport { extend, getPerformance, isArray, isUndefined, isValueAssigned, objForEachKey, strStartsWith } from \"@microsoft/1ds-core-js\";\r\nimport { ActionType, EventType } from \"../Enums\";\r\nimport { CONTENT_VERSION } from \"../common/Constants\";\r\nimport { _extractFieldFromObject, _returnDomObjectIfjQuery } from \"../common/Utils\";\r\nimport { WebEvent } from \"./WebEvent\";\r\nvar PageAction = /** @class */ (function (_super) {\r\n __extends(PageAction, _super);\r\n function PageAction() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * API to send pageAction event\r\n * @param pageActionEvent - PageAction event\r\n * @param properties - PageAction properties(Part C)\r\n */\r\n PageAction.prototype.trackPageAction = function (pageActionEvent, properties) {\r\n // Get part A properties\r\n var ext = {};\r\n ext[\"web\"] = {};\r\n ext[\"web\"][\"isManual\"] = pageActionEvent.isManual;\r\n var event = {\r\n name: \"Ms.Web.PageAction\",\r\n baseType: \"PageActionData\",\r\n ext: ext,\r\n data: {},\r\n baseData: {},\r\n latency: 1 /* EventLatencyValue.Normal */\r\n };\r\n if (!isUndefined(pageActionEvent.sync)) {\r\n event.sync = pageActionEvent.sync;\r\n }\r\n event.baseData[\"name\"] = pageActionEvent.name;\r\n event.baseData[\"uri\"] = pageActionEvent.uri;\r\n event.baseData[\"market\"] = pageActionEvent.market;\r\n event.baseData[\"pageType\"] = pageActionEvent.pageType;\r\n event.baseData[\"isLoggedIn\"] = pageActionEvent.isLoggedIn;\r\n event.baseData[\"id\"] = pageActionEvent.id;\r\n event.baseData[\"properties\"] = pageActionEvent.properties;\r\n event.baseData[\"ver\"] = pageActionEvent.ver;\r\n event.baseData[\"actionType\"] = pageActionEvent.actionType;\r\n event.baseData[\"behavior\"] = pageActionEvent.behavior;\r\n event.baseData[\"clickCoordinates\"] = pageActionEvent.clickCoordinates;\r\n event.baseData[\"content\"] = pageActionEvent.content;\r\n event.baseData[\"contentVer\"] = pageActionEvent.contentVer;\r\n event.baseData[\"targetUri\"] = pageActionEvent.targetUri;\r\n objForEachKey(properties, function (property, value) {\r\n if (!event.data[property]) {\r\n event.data[property] = value;\r\n }\r\n });\r\n this._webAnalyticsPlugin.core.track(event);\r\n };\r\n /**\r\n * API to create and send a populated PageAction event\r\n * @param element - DOM element\r\n * @param overrideValues - PageAction overrides\r\n * @param customProperties - Custom properties(Part C)\r\n * @param isRightClick - Flag for mouse right clicks\r\n */\r\n PageAction.prototype.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {\r\n overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;\r\n var pageActionEvent = {};\r\n var pageActionProperties = isValueAssigned(customProperties) ? customProperties : {};\r\n this._setCommonProperties(pageActionEvent, pageActionProperties, overrideValues);\r\n pageActionEvent.isManual = !overrideValues.isAuto;\r\n pageActionEvent.behavior = this._getBehavior(overrideValues);\r\n // element in scope is needed for below properties. We cannot pass element into the plugin call chain.\r\n // process them here.\r\n var elementContent = {};\r\n element = _returnDomObjectIfjQuery(element);\r\n if (isRightClick) {\r\n // Default behavior for righ click\r\n pageActionEvent.behavior = 9 /*CONTEXTMENU*/;\r\n }\r\n else {\r\n var config = this._config || {};\r\n if (element && config.syncPageActionNavClick) {\r\n if (overrideValues.actionType === ActionType.CLICKLEFT || overrideValues.actionType === ActionType.KEYBOARDENTER) {\r\n if (element.tagName.toLowerCase() === \"a\") {\r\n var href = (element.getAttribute(\"href\") || \"\").toLowerCase();\r\n // Simple check for a URI that would typically cause a navigation\r\n if (href && (strStartsWith(href, \"https:\") || strStartsWith(href, \"http:\") || strStartsWith(href, \".\") || strStartsWith(href, \"/\"))) {\r\n // Special case that looks like this page action is going to cause a page navigation which will result\r\n // in a race condition with the sending of the batched event and XHR cancellation\r\n pageActionEvent.sync = 3 /* EventSendType.SyncFetch */; // Attempt to send the event immediately without blocking the JS execution\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Fill PartB\r\n if (element) {\r\n pageActionEvent.targetUri = DataCollector._getClickTarget(element);\r\n elementContent = this._contentHandler.getElementContent(element, EventType.PAGE_ACTION); // collect data-bi tags\r\n elementContent = extend(elementContent, this._getCustomTags(element)); // collect ms.* tags\r\n // if the element has a data-bi-bhvr attrib defined, use it.\r\n if (elementContent && elementContent.bhvr && !isValueAssigned(overrideValues.behavior)) {\r\n var currentBehavior = _extractFieldFromObject(elementContent, \"bhvr\");\r\n pageActionEvent.behavior = this._getValidBehavior(currentBehavior);\r\n }\r\n }\r\n if (isValueAssigned(overrideValues.actionType)) {\r\n pageActionEvent.actionType = overrideValues.actionType;\r\n }\r\n if (isValueAssigned(overrideValues.clickCoordinateX) && isValueAssigned(overrideValues.clickCoordinateY)) {\r\n pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX + \"X\" + overrideValues.clickCoordinateY;\r\n }\r\n if (isValueAssigned(overrideValues.targetUri)) {\r\n pageActionEvent.targetUri = overrideValues.targetUri;\r\n }\r\n pageActionEvent.contentVer = CONTENT_VERSION;\r\n var currentContent = overrideValues.content || elementContent;\r\n // Array cannot be merged with kvp objects\r\n if (!isArray(currentContent)) {\r\n var pageActionContentTags = this._config.callback.pageActionContentTags;\r\n currentContent = extend(currentContent, typeof pageActionContentTags === \"function\" ? pageActionContentTags(element) : {}, overrideValues && overrideValues.contentTags ? overrideValues.contentTags : {});\r\n }\r\n pageActionEvent.content = this._getContentFormatted(currentContent);\r\n // set PartC values\r\n pageActionProperties.timeToAction = this._getTimeToClick();\r\n pageActionProperties.refUri = isValueAssigned(overrideValues.refUri) ? overrideValues.refUri : this._config.coreData.referrerUri;\r\n var cookiesValue = DataCollector._getClientCookies(this._config, this._traceLogger);\r\n if (cookiesValue) {\r\n pageActionProperties.cookies = cookiesValue;\r\n }\r\n this.trackPageAction(pageActionEvent, pageActionProperties);\r\n };\r\n PageAction.prototype._getCustomTags = function (obj) {\r\n /// Collect data from attributes that have a ms. prefix.\r\n /// This functionality is there to provide compatibility with WEDCS.\r\n /// TODO: When all adopters have moved to the new tagging taxanomy we can remove this functionality.\r\n /// \r\n /// The element from which attributes need to be collected.\r\n /// Tags collection/property bag\r\n var customParameters = {};\r\n while (obj) {\r\n if (!DataCollector._isPii(obj)) {\r\n for (var attr in obj.attributes) {\r\n if (attr) {\r\n if (obj.attributes[attr]) {\r\n var nn = obj.attributes[attr].name;\r\n if (nn) {\r\n if (nn.toLowerCase().indexOf(\"ms.\") === 0) {\r\n customParameters[nn] = obj.attributes[attr].value;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n obj = (obj.parentElement || obj.parentNode);\r\n }\r\n return customParameters;\r\n };\r\n PageAction.prototype._getTimeToClick = function () {\r\n // capture performance data into PageTags\r\n var perf = getPerformance();\r\n if (perf && perf.timing) {\r\n var isNavigationStart = perf.timing.navigationStart;\r\n if (isNavigationStart && isNavigationStart !== 0) {\r\n return new Date().getTime() - isNavigationStart;\r\n }\r\n }\r\n return -1;\r\n };\r\n return PageAction;\r\n}(WebEvent));\r\nexport { PageAction };\r\n//# sourceMappingURL=PageAction.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* PageUnload.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\nimport { getPerformance, isDocumentObjectAvailable, isUndefined, isValueAssigned, isWindowObjectAvailable, objForEachKey } from \"@microsoft/1ds-core-js\";\r\nimport { _getViewportDimensions } from \"../common/Utils\";\r\nimport { WebEvent } from \"./WebEvent\";\r\nvar PageUnload = /** @class */ (function (_super) {\r\n __extends(PageUnload, _super);\r\n /**\r\n * @param _webAnalyticsPlugin - Web Analytics plugin instance\r\n * @param _config - WebAnalytics configuration object\r\n * @param _id - Id\r\n * @param _traceLogger - Trace logger to log to console.\r\n * @param timestamp - Timespan instance.\r\n * @param maxScroll - max scroll value\r\n */\r\n function PageUnload(_webAnalyticsPlugin, _config, _id, _traceLogger, timestamp, maxScroll) {\r\n var _this = _super.call(this, _webAnalyticsPlugin, _config, null, _id, {}, {}, _traceLogger) || this;\r\n _this._webAnalyticsPlugin = _webAnalyticsPlugin;\r\n _this._config = _config;\r\n _this._id = _id;\r\n _this._traceLogger = _traceLogger;\r\n _this._timestamp = timestamp;\r\n _this._maxScroll = maxScroll;\r\n return _this;\r\n }\r\n /**\r\n * API to send PageUnload event\r\n * @param pageUnloadEvent - PageUnload event\r\n * @param properties - PageUnload properties(Part C)\r\n */\r\n PageUnload.prototype.trackPageUnload = function (pageUnloadEvent, properties) {\r\n // Get part A properties\r\n var ext = {};\r\n ext[\"web\"] = {};\r\n ext[\"web\"][\"isManual\"] = pageUnloadEvent.isManual;\r\n var event = {\r\n name: \"Ms.Web.PageUnload\",\r\n baseType: \"PageUnloadData\",\r\n ext: ext,\r\n data: {},\r\n baseData: {},\r\n latency: 3 /* EventLatencyValue.RealTime */\r\n };\r\n var config = this._config || {};\r\n if (isUndefined(config.syncUnloadAction) || config.syncUnloadAction) {\r\n // Attempt to send the event immediately without blocking the JS execution\r\n event.sync = 3 /* EventSendType.SyncFetch */;\r\n }\r\n event.baseData[\"name\"] = pageUnloadEvent.name;\r\n event.baseData[\"uri\"] = pageUnloadEvent.uri;\r\n event.baseData[\"id\"] = pageUnloadEvent.id;\r\n event.baseData[\"properties\"] = pageUnloadEvent.properties;\r\n event.baseData[\"ver\"] = pageUnloadEvent.ver;\r\n event.baseData[\"market\"] = pageUnloadEvent.market;\r\n event.baseData[\"pageType\"] = pageUnloadEvent.pageType;\r\n event.baseData[\"isLoggedIn\"] = pageUnloadEvent.isLoggedIn;\r\n objForEachKey(properties, function (property, value) {\r\n if (!event.data[property]) {\r\n event.data[property] = value;\r\n }\r\n });\r\n this._webAnalyticsPlugin.core.track(event);\r\n };\r\n /**\r\n * API to create and send a populated PageUnload event\r\n * @param overrideValues - PageUnload overrides\r\n * @param customProperties - Custom properties(Part C)\r\n */\r\n PageUnload.prototype.capturePageUnload = function (overrideValues, customProperties) {\r\n overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;\r\n var event = {};\r\n var properties = isValueAssigned(customProperties) ? customProperties : {};\r\n var scrollHeight = isDocumentObjectAvailable ? document.body.scrollHeight : 0;\r\n this._setBasicProperties(event, overrideValues);\r\n event.isManual = !overrideValues.isAuto;\r\n // Set PartC values\r\n properties.dwellTime = this._timestamp._recordTimeSpan(\"dwellTime\", true);\r\n properties.scrollDepth = overrideValues.scrollDepth || this._maxScroll.v.toString() + \"/\" + scrollHeight.toString();\r\n properties.vpHeight = _getViewportDimensions().h;\r\n properties.vScrollOffset = overrideValues.vScrollOffset || this._maxScroll.v;\r\n if (isWindowObjectAvailable) {\r\n var perf = getPerformance();\r\n var windowPerformanceTiming = perf ? perf.timing : null;\r\n if (windowPerformanceTiming && windowPerformanceTiming.loadEventStart && windowPerformanceTiming.navigationStart) {\r\n if (windowPerformanceTiming.loadEventStart > 0) {\r\n properties.pageLoadTime = windowPerformanceTiming.loadEventStart - windowPerformanceTiming.navigationStart;\r\n }\r\n }\r\n }\r\n this.trackPageUnload(event, properties);\r\n };\r\n return PageUnload;\r\n}(WebEvent));\r\nexport { PageUnload };\r\n//# sourceMappingURL=PageUnload.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* pageView.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\nimport * as DataCollector from \"../DataCollector\";\r\nimport { isValueAssigned } from \"@microsoft/1ds-core-js\";\r\nimport { WebEvent } from \"./WebEvent\";\r\nvar PageView = /** @class */ (function (_super) {\r\n __extends(PageView, _super);\r\n function PageView() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * API to populate and send a PageView event\r\n * @param overrideValues - PageView overrides\r\n * @param customProperties - Custom properties(Part C)\r\n */\r\n PageView.prototype.capturePageView = function (overrideValues, customProperties) {\r\n overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;\r\n var pageViewEvent = {};\r\n var properties = isValueAssigned(customProperties) ? customProperties : {};\r\n this._setCommonProperties(pageViewEvent, properties, overrideValues);\r\n // Add pageView fields\r\n pageViewEvent.refUri = isValueAssigned(overrideValues.referrerUri) ? overrideValues.referrerUri : this._config.coreData.referrerUri;\r\n pageViewEvent.isManual = !overrideValues.isAuto;\r\n var cookiesValue = DataCollector._getClientCookies(this._config, this._traceLogger);\r\n if (cookiesValue) {\r\n properties.cookies = cookiesValue;\r\n }\r\n properties.behavior = this._getBehavior(overrideValues);\r\n this._webAnalyticsPlugin.trackPageView(pageViewEvent, properties);\r\n };\r\n return PageView;\r\n}(WebEvent));\r\nexport { PageView };\r\n//# sourceMappingURL=PageView.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\nimport { __extendsFn as __extends } from \"@microsoft/applicationinsights-shims\";\r\n/**\r\n* PageViewPerformance.ts\r\n* @author Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2019\r\n*/\r\nimport { isValueAssigned } from \"@microsoft/1ds-core-js\";\r\nimport { WebEvent } from \"./WebEvent\";\r\nvar PageViewPerformance = /** @class */ (function (_super) {\r\n __extends(PageViewPerformance, _super);\r\n function PageViewPerformance() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * API to populate and send a PageViewPerformance event\r\n * @param overrideValues - PageView overrides\r\n * @param customProperties - Custom properties(Part C)\r\n */\r\n PageViewPerformance.prototype.capturePageViewPerformance = function (overrideValues, customProperties) {\r\n overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;\r\n var event = {};\r\n var properties = isValueAssigned(customProperties) ? customProperties : {};\r\n this._setBasicProperties(event, overrideValues);\r\n this._setPageTags(event, overrideValues);\r\n event.isManual = !overrideValues.isAuto;\r\n properties.behavior = this._getBehavior(overrideValues);\r\n properties.vpHeight = overrideValues.vpHeight;\r\n properties.vpWidth = overrideValues.vpWidth;\r\n properties.framework = overrideValues.framework;\r\n properties.systemTiming = overrideValues.systemTiming;\r\n properties.customTiming = overrideValues.customTiming;\r\n this._webAnalyticsPlugin._populatePageViewPerformance(event);\r\n this._webAnalyticsPlugin.trackPageViewPerformance(event, properties);\r\n };\r\n return PageViewPerformance;\r\n}(WebEvent));\r\nexport { PageViewPerformance };\r\n//# sourceMappingURL=PageViewPerformance.js.map","/*\n * 1DS JS SDK Web Analytics plugin, 4.0.2\n * Copyright (c) Microsoft and contributors. All rights reserved.\n * (Microsoft Internal Only)\n */\n/**\r\n* AutoCaptureHandler.ts\r\n* @author Ram Thiru (ramthi) and Hector Hernandez (hectorh)\r\n* @copyright Microsoft 2018\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { addPageHideEventListener, addPageUnloadEventListener, createUniqueNamespace, eventOff, eventOn, getDocument, getWindow, mergeEvtNamespace, removePageHideEventListener, removePageUnloadEventListener } from \"@microsoft/1ds-core-js\";\r\nimport { onDomLoaded } from \"../DataCollector\";\r\nimport { ActionType } from \"../Enums\";\r\nimport { _debounce, _getScrollOffset, _isKeyboardEnter, _isKeyboardSpace, _isLeftClick, _isMiddleClick, _isRightClick } from \"../common/Utils\";\r\nvar clickCaptureInputTypes = { BUTTON: true, CHECKBOX: true, RADIO: true, RESET: true, SUBMIT: true };\r\nvar AutoCaptureHandler = /** @class */ (function () {\r\n /**\r\n * @param _plugin - WebAnalytics plugin\r\n * @param _logger - Trace logger to log to console.\r\n */\r\n function AutoCaptureHandler(webAnalytics, diagLog) {\r\n var _this = this;\r\n var _plugin;\r\n var _logger;\r\n var _evtNamespace;\r\n var _clickAdded;\r\n var _scrollAdded;\r\n var _maxScrollAdded;\r\n var _resizeAdded;\r\n var _unloadAdded;\r\n var _domLoadedAdded;\r\n dynamicProto(AutoCaptureHandler, this, function (_self) {\r\n // Clears out all local values this is also used during teardown\r\n _initDefaults();\r\n // Assign the values that we want to use\r\n _plugin = webAnalytics;\r\n _logger = diagLog;\r\n _evtNamespace = mergeEvtNamespace(createUniqueNamespace(\"AutoCaptureHandler\"), _plugin._evtNamespace);\r\n // Re-Exposing as protected properties\r\n _self._analyticsPlugin = _plugin;\r\n _self._traceLogger = _logger;\r\n _self.pageView = function () {\r\n _plugin && _plugin.capturePageView({ isAuto: true });\r\n };\r\n _self.onLoad = function () {\r\n if (_plugin && !_domLoadedAdded) {\r\n onDomLoaded(function () {\r\n _plugin && _plugin.capturePageViewPerformance({ isAuto: true });\r\n _plugin && _plugin.captureContentUpdate({ isAuto: true, isDomComplete: true });\r\n }, _evtNamespace);\r\n _domLoadedAdded = true;\r\n }\r\n };\r\n // handle automatic event firing on user click\r\n _self.click = function () {\r\n if (!_clickAdded) {\r\n var win = getWindow();\r\n var doc = getDocument();\r\n if (win && win.addEventListener) {\r\n // IE9 onwards addEventListener is available, 'click' event captures mouse click. mousedown works on other browsers\r\n var event = (navigator.appVersion.indexOf(\"MSIE\") !== -1) ? \"click\" : \"mousedown\";\r\n eventOn(win, event, _processClick, _evtNamespace);\r\n eventOn(win, \"keyup\", _processClick, _evtNamespace);\r\n }\r\n else if (doc && doc.attachEvent) {\r\n // IE8 and below doesn't have addEventListener so it will use attachEvent\r\n // attaching to window does not work in IE8\r\n eventOn(doc, \"click\", _processClick, _evtNamespace);\r\n eventOn(doc, \"keyup\", _processClick, _evtNamespace);\r\n }\r\n _clickAdded = true;\r\n }\r\n };\r\n // handle automatic event firing on user scroll\r\n _self.scroll = function (debounceConfig) {\r\n if (!_scrollAdded) {\r\n var processScroll = _debounce(\r\n // on first call do nothing\r\n null, \r\n // after debounce, send contentView with viewportOffset\r\n function () {\r\n _plugin && _plugin.captureContentUpdate({ isAuto: true, actionType: ActionType.SCROLL });\r\n }, debounceConfig.scroll, _this);\r\n eventOn(getWindow(), \"scroll\", processScroll, _evtNamespace);\r\n _scrollAdded = true;\r\n }\r\n };\r\n // handle automatic event firing on user scroll\r\n _self.maxScroll = function (maxScroll) {\r\n if (!_maxScrollAdded) {\r\n var getMaxScrollDepth = function () {\r\n var currentScroll = _getScrollOffset();\r\n maxScroll.v = maxScroll.v > currentScroll.v ? maxScroll.v : currentScroll.v;\r\n };\r\n eventOn(getWindow(), \"scroll\", getMaxScrollDepth, _evtNamespace);\r\n _maxScrollAdded = true;\r\n }\r\n };\r\n // handle automatic event firing on user resize\r\n _self.resize = function (debounceConfig) {\r\n /// I wasn't able to repro the bug\r\n /// (https://microsoft.visualstudio.com/DefaultCollection/OSGS/_workitems/edit/7958464)\r\n /// until new content was loaded on the page and the resize\r\n /// rendering became slow. When resize happens, the page rendering\r\n /// time is longer than the resize debounce, and resize render\r\n /// happens in time > debounce, and so resize is acting like\r\n /// it's being done twice: once at the beginning of user resize,\r\n /// one at the end of browser render resize.\r\n if (!_resizeAdded) {\r\n var processResize = _debounce(\r\n // on first call, send resize contentUpdate\r\n function () {\r\n _plugin && _plugin.captureContentUpdate({ isAuto: true, actionType: ActionType.RESIZE });\r\n }, \r\n // after debounce, do nothing\r\n null, debounceConfig.resize, _this);\r\n eventOn(getWindow(), \"resize\", processResize, _evtNamespace);\r\n _resizeAdded = true;\r\n }\r\n };\r\n _self.onUnload = function () {\r\n function _doUnload() {\r\n _plugin && _plugin.capturePageUnload({ isAuto: true });\r\n }\r\n if (!_unloadAdded) {\r\n var coreConfig = ((_plugin || {}).core || {}).config;\r\n var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents;\r\n addPageUnloadEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);\r\n addPageHideEventListener(_doUnload, excludePageUnloadEvents, _evtNamespace);\r\n _unloadAdded = true;\r\n }\r\n };\r\n _self.teardown = function (unloadCtx, unloadState) {\r\n eventOff(getWindow(), null, null, _evtNamespace);\r\n eventOff(getDocument(), null, null, _evtNamespace);\r\n removePageUnloadEventListener(null, _evtNamespace);\r\n removePageHideEventListener(null, _evtNamespace);\r\n _initDefaults();\r\n };\r\n _self._processClick = _processClick;\r\n function _processClick(clickEvent) {\r\n var clickCaptureElements = { A: true, BUTTON: true, AREA: true, INPUT: true };\r\n var win = getWindow();\r\n clickEvent = clickEvent || win.event; // IE 8 does not pass the event\r\n var element = clickEvent.srcElement || clickEvent.target;\r\n // populate overrideValues\r\n var overrideValues = {\r\n isAuto: true,\r\n clickCoordinateX: clickEvent.pageX,\r\n clickCoordinateY: clickEvent.pageY\r\n };\r\n var isRightClick = _isRightClick(clickEvent);\r\n if (isRightClick) {\r\n overrideValues.actionType = ActionType.CLICKRIGHT;\r\n }\r\n else if (_isLeftClick(clickEvent)) {\r\n overrideValues.actionType = ActionType.CLICKLEFT;\r\n }\r\n else if (_isKeyboardEnter(clickEvent)) {\r\n overrideValues.actionType = ActionType.KEYBOARDENTER;\r\n }\r\n else if (_isKeyboardSpace(clickEvent)) {\r\n overrideValues.actionType = ActionType.KEYBOARDSPACE;\r\n }\r\n else if (_isMiddleClick(clickEvent)) {\r\n overrideValues.actionType = ActionType.CLICKMIDDLE;\r\n }\r\n else {\r\n return;\r\n }\r\n while (element && element.tagName) {\r\n // control property will be available for