@microsoft/applicationinsights-debugplugin-js 2.8.0-beta.2203-01 → 2.8.0-beta.2203-02

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/browser/{ai.dbg.2.8.0-beta.2203-01.cjs.js → ai.dbg.2.8.0-beta.2203-02.cjs.js} +612 -329
  2. package/browser/ai.dbg.2.8.0-beta.2203-02.cjs.js.map +1 -0
  3. package/browser/ai.dbg.2.8.0-beta.2203-02.cjs.min.js +6 -0
  4. package/browser/ai.dbg.2.8.0-beta.2203-02.cjs.min.js.map +1 -0
  5. package/browser/{ai.dbg.2.8.0-beta.2203-01.gbl.js → ai.dbg.2.8.0-beta.2203-02.gbl.js} +612 -329
  6. package/browser/ai.dbg.2.8.0-beta.2203-02.gbl.js.map +1 -0
  7. package/browser/ai.dbg.2.8.0-beta.2203-02.gbl.min.js +6 -0
  8. package/browser/ai.dbg.2.8.0-beta.2203-02.gbl.min.js.map +1 -0
  9. package/browser/ai.dbg.2.8.0-beta.2203-02.integrity.json +66 -0
  10. package/browser/{ai.dbg.2.8.0-beta.2203-01.js → ai.dbg.2.8.0-beta.2203-02.js} +612 -329
  11. package/browser/ai.dbg.2.8.0-beta.2203-02.js.map +1 -0
  12. package/browser/ai.dbg.2.8.0-beta.2203-02.min.js +6 -0
  13. package/browser/ai.dbg.2.8.0-beta.2203-02.min.js.map +1 -0
  14. package/browser/ai.dbg.2.cjs.js +611 -328
  15. package/browser/ai.dbg.2.cjs.js.map +1 -1
  16. package/browser/ai.dbg.2.cjs.min.js +2 -2
  17. package/browser/ai.dbg.2.cjs.min.js.map +1 -1
  18. package/browser/ai.dbg.2.gbl.js +611 -328
  19. package/browser/ai.dbg.2.gbl.js.map +1 -1
  20. package/browser/ai.dbg.2.gbl.min.js +2 -2
  21. package/browser/ai.dbg.2.gbl.min.js.map +1 -1
  22. package/browser/ai.dbg.2.js +611 -328
  23. package/browser/ai.dbg.2.js.map +1 -1
  24. package/browser/ai.dbg.2.min.js +2 -2
  25. package/browser/ai.dbg.2.min.js.map +1 -1
  26. package/dist/applicationinsights-debugplugin-js.d.ts +1 -1
  27. package/dist/applicationinsights-debugplugin-js.js +611 -328
  28. package/dist/applicationinsights-debugplugin-js.js.map +1 -1
  29. package/dist/applicationinsights-debugplugin-js.min.js +2 -2
  30. package/dist/applicationinsights-debugplugin-js.min.js.map +1 -1
  31. package/dist/applicationinsights-debugplugin-js.rollup.d.ts +1 -1
  32. package/dist-esm/DebugPlugin.js +1 -1
  33. package/dist-esm/applicationinsights-debugplugin-js.js +1 -1
  34. package/dist-esm/components/Dashboard.js +1 -1
  35. package/dist-esm/components/LogEntry.js +1 -1
  36. package/dist-esm/components/debugBins.js +1 -1
  37. package/dist-esm/components/filterList.js +1 -1
  38. package/dist-esm/components/helpers.js +1 -1
  39. package/dist-esm/components/styleNodeSrc.js +1 -1
  40. package/dist-esm/interfaces/IDebugPluginConfig.js +1 -1
  41. package/package.json +3 -3
  42. package/browser/ai.dbg.2.8.0-beta.2203-01.cjs.js.map +0 -1
  43. package/browser/ai.dbg.2.8.0-beta.2203-01.cjs.min.js +0 -6
  44. package/browser/ai.dbg.2.8.0-beta.2203-01.cjs.min.js.map +0 -1
  45. package/browser/ai.dbg.2.8.0-beta.2203-01.gbl.js.map +0 -1
  46. package/browser/ai.dbg.2.8.0-beta.2203-01.gbl.min.js +0 -6
  47. package/browser/ai.dbg.2.8.0-beta.2203-01.gbl.min.js.map +0 -1
  48. package/browser/ai.dbg.2.8.0-beta.2203-01.integrity.json +0 -66
  49. package/browser/ai.dbg.2.8.0-beta.2203-01.js.map +0 -1
  50. package/browser/ai.dbg.2.8.0-beta.2203-01.min.js +0 -6
  51. package/browser/ai.dbg.2.8.0-beta.2203-01.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Debug Plugin, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Debug Plugin, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -322,99 +322,14 @@
322
322
  };
323
323
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
324
324
 
325
- var LoggingSeverity;
326
- (function (LoggingSeverity) {
327
- LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
328
- LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
329
- })(LoggingSeverity || (LoggingSeverity = {}));
330
- var _InternalMessageId = {
331
- BrowserDoesNotSupportLocalStorage: 0,
332
- BrowserCannotReadLocalStorage: 1,
333
- BrowserCannotReadSessionStorage: 2,
334
- BrowserCannotWriteLocalStorage: 3,
335
- BrowserCannotWriteSessionStorage: 4,
336
- BrowserFailedRemovalFromLocalStorage: 5,
337
- BrowserFailedRemovalFromSessionStorage: 6,
338
- CannotSendEmptyTelemetry: 7,
339
- ClientPerformanceMathError: 8,
340
- ErrorParsingAISessionCookie: 9,
341
- ErrorPVCalc: 10,
342
- ExceptionWhileLoggingError: 11,
343
- FailedAddingTelemetryToBuffer: 12,
344
- FailedMonitorAjaxAbort: 13,
345
- FailedMonitorAjaxDur: 14,
346
- FailedMonitorAjaxOpen: 15,
347
- FailedMonitorAjaxRSC: 16,
348
- FailedMonitorAjaxSend: 17,
349
- FailedMonitorAjaxGetCorrelationHeader: 18,
350
- FailedToAddHandlerForOnBeforeUnload: 19,
351
- FailedToSendQueuedTelemetry: 20,
352
- FailedToReportDataLoss: 21,
353
- FlushFailed: 22,
354
- MessageLimitPerPVExceeded: 23,
355
- MissingRequiredFieldSpecification: 24,
356
- NavigationTimingNotSupported: 25,
357
- OnError: 26,
358
- SessionRenewalDateIsZero: 27,
359
- SenderNotInitialized: 28,
360
- StartTrackEventFailed: 29,
361
- StopTrackEventFailed: 30,
362
- StartTrackFailed: 31,
363
- StopTrackFailed: 32,
364
- TelemetrySampledAndNotSent: 33,
365
- TrackEventFailed: 34,
366
- TrackExceptionFailed: 35,
367
- TrackMetricFailed: 36,
368
- TrackPVFailed: 37,
369
- TrackPVFailedCalc: 38,
370
- TrackTraceFailed: 39,
371
- TransmissionFailed: 40,
372
- FailedToSetStorageBuffer: 41,
373
- FailedToRestoreStorageBuffer: 42,
374
- InvalidBackendResponse: 43,
375
- FailedToFixDepricatedValues: 44,
376
- InvalidDurationValue: 45,
377
- TelemetryEnvelopeInvalid: 46,
378
- CreateEnvelopeError: 47,
379
- CannotSerializeObject: 48,
380
- CannotSerializeObjectNonSerializable: 49,
381
- CircularReferenceDetected: 50,
382
- ClearAuthContextFailed: 51,
383
- ExceptionTruncated: 52,
384
- IllegalCharsInName: 53,
385
- ItemNotInArray: 54,
386
- MaxAjaxPerPVExceeded: 55,
387
- MessageTruncated: 56,
388
- NameTooLong: 57,
389
- SampleRateOutOfRange: 58,
390
- SetAuthContextFailed: 59,
391
- SetAuthContextFailedAccountName: 60,
392
- StringValueTooLong: 61,
393
- StartCalledMoreThanOnce: 62,
394
- StopCalledWithoutStart: 63,
395
- TelemetryInitializerFailed: 64,
396
- TrackArgumentsNotSpecified: 65,
397
- UrlTooLong: 66,
398
- SessionStorageBufferFull: 67,
399
- CannotAccessCookie: 68,
400
- IdTooLong: 69,
401
- InvalidEvent: 70,
402
- FailedMonitorAjaxSetRequestHeader: 71,
403
- SendBrowserInfoOnUserInit: 72,
404
- PluginException: 73,
405
- NotificationException: 74,
406
- SnippetScriptLoadFailure: 99,
407
- InvalidInstrumentationKey: 100,
408
- CannotParseAiBlobValue: 101,
409
- InvalidContentBlob: 102,
410
- TrackPageActionEventFailed: 103,
411
- FailedAddingCustomDefinedRequestContext: 104,
412
- InMemoryStorageBufferFull: 105
413
- };
325
+ var strEmpty$1 = "";
326
+ var strSetNextPlugin = "setNextPlugin";
327
+ var strIsInitialized = "isInitialized";
328
+ var strTeardown = "teardown";
329
+ var strCore = "core";
330
+ var strDisabled = "disabled";
331
+ var strDoTeardown = "_doTeardown";
414
332
 
415
- var strOnPrefix = "on";
416
- var strAttachEvent = "attachEvent";
417
- var strAddEventHelper = "addEventListener";
418
333
  var strToISOString = "toISOString";
419
334
  var cStrEndsWith = "endsWith";
420
335
  var strIndexOf = "indexOf";
@@ -424,7 +339,7 @@
424
339
  var strToString = "toString";
425
340
  var str__Proto = "__proto__";
426
341
  var strConstructor$1 = "constructor";
427
- var _objDefineProperty = ObjDefineProperty;
342
+ var _objDefineProperty$1 = ObjDefineProperty;
428
343
  var _objFreeze = ObjClass.freeze;
429
344
  var _objKeys = ObjClass.keys;
430
345
  var StringProto = String[strShimPrototype];
@@ -436,6 +351,9 @@
436
351
  var _objToString = ObjProto[strToString];
437
352
  var _fnToString = ObjHasOwnProperty[strToString];
438
353
  var _objFunctionString = _fnToString.call(ObjClass);
354
+ var rCamelCase = /-([a-z])/g;
355
+ var rNormalizeInvalid = /([^\w\d_$])/g;
356
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
439
357
  var _objGetPrototypeOf = Object["getPrototypeOf"];
440
358
  function _getObjProto(target) {
441
359
  if (target) {
@@ -470,24 +388,18 @@
470
388
  function isFunction(value) {
471
389
  return !!(value && typeof value === strShimFunction);
472
390
  }
473
- function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
474
- if (useCapture === void 0) { useCapture = false; }
475
- var result = false;
476
- if (!isNullOrUndefined(obj)) {
477
- try {
478
- if (!isNullOrUndefined(obj[strAddEventHelper])) {
479
- obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
480
- result = true;
481
- }
482
- else if (!isNullOrUndefined(obj[strAttachEvent])) {
483
- obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
484
- result = true;
485
- }
486
- }
487
- catch (e) {
488
- }
391
+ function normalizeJsName(name) {
392
+ var value = name;
393
+ if (value && isString(value)) {
394
+ value = value.replace(rCamelCase, function (_all, letter) {
395
+ return letter.toUpperCase();
396
+ });
397
+ value = value.replace(rNormalizeInvalid, "_");
398
+ value = value.replace(rLeadingNumeric, function (_all, match) {
399
+ return "_" + match;
400
+ });
489
401
  }
490
- return result;
402
+ return value;
491
403
  }
492
404
  function objForEachKey(target, callbackfn) {
493
405
  if (target) {
@@ -710,7 +622,7 @@
710
622
  return result;
711
623
  }
712
624
  function objDefineAccessors(target, prop, getProp, setProp) {
713
- if (_objDefineProperty) {
625
+ if (_objDefineProperty$1) {
714
626
  try {
715
627
  var descriptor = {
716
628
  enumerable: true,
@@ -722,7 +634,7 @@
722
634
  if (setProp) {
723
635
  descriptor.set = setProp;
724
636
  }
725
- _objDefineProperty(target, prop, descriptor);
637
+ _objDefineProperty$1(target, prop, descriptor);
726
638
  return true;
727
639
  }
728
640
  catch (e) {
@@ -742,7 +654,7 @@
742
654
  if (isError(object)) {
743
655
  return object.name;
744
656
  }
745
- return "";
657
+ return strEmpty$1;
746
658
  }
747
659
  function setValue(target, field, value, valChk, srcChk) {
748
660
  var theValue = value;
@@ -758,6 +670,20 @@
758
670
  function isTruthy(value) {
759
671
  return !!value;
760
672
  }
673
+ function throwError(message) {
674
+ throw new Error(message);
675
+ }
676
+ function createEnumStyle(values) {
677
+ var enumClass = {};
678
+ objForEachKey(values, function (field, value) {
679
+ enumClass[field] = value;
680
+ if (!isUndefined(enumClass[value])) {
681
+ throwError("Value: [" + value + "] already exists for " + field);
682
+ }
683
+ enumClass[value] = field;
684
+ });
685
+ return objFreeze(enumClass);
686
+ }
761
687
  function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
762
688
  var theArgs = arguments;
763
689
  var extended = theArgs[0] || {};
@@ -896,7 +822,7 @@
896
822
  var nav = getNavigator();
897
823
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
898
824
  _navUserAgentCheck = nav.userAgent;
899
- var userAgent = (_navUserAgentCheck || "").toLowerCase();
825
+ var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
900
826
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
901
827
  }
902
828
  return _isTrident;
@@ -905,9 +831,9 @@
905
831
  if (userAgentStr === void 0) { userAgentStr = null; }
906
832
  if (!userAgentStr) {
907
833
  var navigator_1 = getNavigator() || {};
908
- userAgentStr = navigator_1 ? (navigator_1.userAgent || "").toLowerCase() : "";
834
+ userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
909
835
  }
910
- var ua = (userAgentStr || "").toLowerCase();
836
+ var ua = (userAgentStr || strEmpty$1).toLowerCase();
911
837
  if (strContains(ua, strMsie)) {
912
838
  var doc = getDocument() || {};
913
839
  return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
@@ -922,7 +848,7 @@
922
848
  }
923
849
  function dumpObj(object) {
924
850
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
925
- var propertyValueDump = "";
851
+ var propertyValueDump = strEmpty$1;
926
852
  if (objectTypeDump === "[object Error]") {
927
853
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
928
854
  }
@@ -961,9 +887,9 @@
961
887
  var strWarnToConsole = "warnToConsole";
962
888
  function _sanitizeDiagnosticText(text) {
963
889
  if (text) {
964
- return "\"" + text.replace(/\"/g, "") + "\"";
890
+ return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
965
891
  }
966
- return "";
892
+ return strEmpty$1;
967
893
  }
968
894
  function _logToConsole(func, message) {
969
895
  var theConsole = getConsole();
@@ -985,12 +911,12 @@
985
911
  _self.message =
986
912
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
987
913
  msgId;
988
- var strProps = "";
914
+ var strProps = strEmpty$1;
989
915
  if (hasJSON()) {
990
916
  strProps = getJSON().stringify(properties);
991
917
  }
992
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
993
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
918
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
919
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
994
920
  _self.message += diagnosticText;
995
921
  }
996
922
  _InternalLogMessage.dataType = "MessageData";
@@ -1020,7 +946,7 @@
1020
946
  throw message;
1021
947
  }
1022
948
  else {
1023
- var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
949
+ var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
1024
950
  if (!isUndefined(message.message)) {
1025
951
  var logLevel = _self.consoleLoggingLevel();
1026
952
  if (isUserAct) {
@@ -1038,7 +964,7 @@
1038
964
  _self.logInternalMessage(severity, message);
1039
965
  }
1040
966
  else {
1041
- _debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
967
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
1042
968
  }
1043
969
  }
1044
970
  };
@@ -1070,13 +996,13 @@
1070
996
  if (severity <= _self.telemetryLoggingLevel()) {
1071
997
  _self.queue.push(message);
1072
998
  _messageCount++;
1073
- _debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
999
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
1074
1000
  }
1075
1001
  if (_messageCount === _self.maxInternalMessageLimit()) {
1076
1002
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
1077
- var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
1003
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
1078
1004
  _self.queue.push(throttleMessage);
1079
- if (severity === LoggingSeverity.CRITICAL) {
1005
+ if (severity === 1 ) {
1080
1006
  _self.errorToConsole(throttleLimitMessage);
1081
1007
  }
1082
1008
  else {
@@ -1218,6 +1144,165 @@
1218
1144
  return func();
1219
1145
  }
1220
1146
 
1147
+ var UInt32Mask = 0x100000000;
1148
+ var MaxUInt32 = 0xffffffff;
1149
+ var _mwcSeeded = false;
1150
+ var _mwcW = 123456789;
1151
+ var _mwcZ = 987654321;
1152
+ function _mwcSeed(seedValue) {
1153
+ if (seedValue < 0) {
1154
+ seedValue >>>= 0;
1155
+ }
1156
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1157
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1158
+ _mwcSeeded = true;
1159
+ }
1160
+ function _autoSeedMwc() {
1161
+ try {
1162
+ var now = dateNow() & 0x7fffffff;
1163
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1164
+ }
1165
+ catch (e) {
1166
+ }
1167
+ }
1168
+ function randomValue(maxValue) {
1169
+ if (maxValue > 0) {
1170
+ return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
1171
+ }
1172
+ return 0;
1173
+ }
1174
+ function random32(signed) {
1175
+ var value = 0;
1176
+ var c = getCrypto() || getMsCrypto();
1177
+ if (c && c.getRandomValues) {
1178
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1179
+ }
1180
+ if (value === 0 && isIE()) {
1181
+ if (!_mwcSeeded) {
1182
+ _autoSeedMwc();
1183
+ }
1184
+ value = mwcRandom32() & MaxUInt32;
1185
+ }
1186
+ if (value === 0) {
1187
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1188
+ }
1189
+ if (!signed) {
1190
+ value >>>= 0;
1191
+ }
1192
+ return value;
1193
+ }
1194
+ function mwcRandomSeed(value) {
1195
+ if (!value) {
1196
+ _autoSeedMwc();
1197
+ }
1198
+ else {
1199
+ _mwcSeed(value);
1200
+ }
1201
+ }
1202
+ function mwcRandom32(signed) {
1203
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1204
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1205
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1206
+ if (!signed) {
1207
+ value >>>= 0;
1208
+ }
1209
+ return value;
1210
+ }
1211
+ function newId(maxLength) {
1212
+ if (maxLength === void 0) { maxLength = 22; }
1213
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1214
+ var number = random32() >>> 0;
1215
+ var chars = 0;
1216
+ var result = strEmpty$1;
1217
+ while (result.length < maxLength) {
1218
+ chars++;
1219
+ result += base64chars.charAt(number & 0x3F);
1220
+ number >>>= 6;
1221
+ if (chars === 5) {
1222
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1223
+ chars = 0;
1224
+ }
1225
+ }
1226
+ return result;
1227
+ }
1228
+
1229
+ var _objDefineProperty = ObjDefineProperty;
1230
+ var version = "2.7.3";
1231
+ var instanceName = "." + newId(6);
1232
+ var _dataUid = 0;
1233
+ function _createAccessor(target, prop, value) {
1234
+ if (_objDefineProperty) {
1235
+ try {
1236
+ _objDefineProperty(target, prop, {
1237
+ value: value,
1238
+ enumerable: false,
1239
+ configurable: true
1240
+ });
1241
+ return true;
1242
+ }
1243
+ catch (e) {
1244
+ }
1245
+ }
1246
+ return false;
1247
+ }
1248
+ function _canAcceptData(target) {
1249
+ return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1250
+ }
1251
+ function _getCache(data, target) {
1252
+ var theCache = target[data.id];
1253
+ if (!theCache) {
1254
+ theCache = {};
1255
+ try {
1256
+ if (_canAcceptData(target)) {
1257
+ if (!_createAccessor(target, data.id, theCache)) {
1258
+ target[data.id] = theCache;
1259
+ }
1260
+ }
1261
+ }
1262
+ catch (e) {
1263
+ }
1264
+ }
1265
+ return theCache;
1266
+ }
1267
+ function createUniqueNamespace(name, includeVersion) {
1268
+ if (includeVersion === void 0) { includeVersion = false; }
1269
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1270
+ }
1271
+ function createElmNodeData(name) {
1272
+ var data = {
1273
+ id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1274
+ accept: function (target) {
1275
+ return _canAcceptData(target);
1276
+ },
1277
+ get: function (target, name, defValue, addDefault) {
1278
+ var theCache = target[data.id];
1279
+ if (!theCache) {
1280
+ if (addDefault) {
1281
+ theCache = _getCache(data, target);
1282
+ theCache[normalizeJsName(name)] = defValue;
1283
+ }
1284
+ return defValue;
1285
+ }
1286
+ return theCache[normalizeJsName(name)];
1287
+ },
1288
+ kill: function (target, name) {
1289
+ if (target && target[name]) {
1290
+ try {
1291
+ delete target[name];
1292
+ }
1293
+ catch (e) {
1294
+ }
1295
+ }
1296
+ }
1297
+ };
1298
+ return data;
1299
+ }
1300
+
1301
+ var pluginStateData = createElmNodeData("plugin");
1302
+ function _getPluginState(plugin) {
1303
+ return pluginStateData.get(plugin, "state", {}, true);
1304
+ }
1305
+
1221
1306
  var strTelemetryPluginChain = "TelemetryPluginChain";
1222
1307
  var strHasRunFlags = "_hasRun";
1223
1308
  var strGetTelCtx = "_getTelCtx";
@@ -1231,53 +1316,66 @@
1231
1316
  }
1232
1317
  return createTelemetryProxyChain([startAt], config, core);
1233
1318
  }
1234
- function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1235
- var _nextProxy = null;
1236
- var _onComplete = null;
1237
- if (startAt) {
1238
- _nextProxy = _getNextProxyStart(telemetryChain, config, core, startAt);
1239
- }
1240
- else {
1241
- _nextProxy = telemetryChain;
1242
- }
1319
+ function _createInternalContext(telemetryChain, config, core, startAt) {
1320
+ var _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1321
+ var _onComplete = [];
1243
1322
  var context = {
1244
- core: function () {
1245
- return core;
1246
- },
1247
- diagLog: function () {
1248
- return safeGetLogger(core, config);
1249
- },
1250
- getCfg: function () {
1251
- return config;
1252
- },
1253
- getExtCfg: _getExtCfg,
1254
- getConfig: _getConfig,
1255
- hasNext: function () {
1256
- return _nextProxy != null;
1257
- },
1258
- getNext: function () {
1259
- return _nextProxy;
1260
- },
1261
- setNext: function (nextPlugin) {
1262
- _nextProxy = nextPlugin;
1263
- },
1264
- processNext: function (env) {
1265
- _processChain(function (nextPlugin) {
1266
- nextPlugin.processTelemetry(env, context);
1323
+ _next: _moveNext,
1324
+ ctx: {
1325
+ core: function () { return core; },
1326
+ diagLog: function () {
1327
+ return safeGetLogger(core, config);
1328
+ },
1329
+ getCfg: function () {
1330
+ return config;
1331
+ },
1332
+ getExtCfg: _getExtCfg,
1333
+ getConfig: _getConfig,
1334
+ hasNext: function () {
1335
+ return !!_nextProxy;
1336
+ },
1337
+ getNext: function () {
1338
+ return _nextProxy;
1339
+ },
1340
+ setNext: function (nextPlugin) {
1341
+ _nextProxy = nextPlugin;
1342
+ },
1343
+ iterate: _iterateChain,
1344
+ onComplete: _addOnComplete
1345
+ }
1346
+ };
1347
+ function _addOnComplete(onComplete, that) {
1348
+ var args = [];
1349
+ for (var _i = 2; _i < arguments.length; _i++) {
1350
+ args[_i - 2] = arguments[_i];
1351
+ }
1352
+ if (onComplete) {
1353
+ _onComplete.push({
1354
+ func: onComplete,
1355
+ self: !isUndefined(that) ? that : context.ctx,
1356
+ args: args
1267
1357
  });
1268
- },
1269
- iterate: _iterateChain,
1270
- createNew: function (plugins, startAt) {
1271
- if (plugins === void 0) { plugins = null; }
1272
- if (isArray(plugins)) {
1273
- plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1358
+ }
1359
+ }
1360
+ function _moveNext() {
1361
+ var nextProxy = _nextProxy;
1362
+ _nextProxy = nextProxy ? nextProxy.getNext() : null;
1363
+ if (!nextProxy) {
1364
+ var onComplete = _onComplete;
1365
+ if (onComplete && onComplete.length > 0) {
1366
+ arrForEach(onComplete, function (completeDetails) {
1367
+ try {
1368
+ completeDetails.func.call(completeDetails.self, completeDetails.args);
1369
+ }
1370
+ catch (e) {
1371
+ core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1372
+ }
1373
+ });
1374
+ _onComplete = [];
1274
1375
  }
1275
- return createProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1276
- },
1277
- onComplete: function (onComplete) {
1278
- _onComplete = onComplete;
1279
1376
  }
1280
- };
1377
+ return nextProxy;
1378
+ }
1281
1379
  function _getExtCfg(identifier, defaultValue, mergeDefault) {
1282
1380
  if (defaultValue === void 0) { defaultValue = {}; }
1283
1381
  if (mergeDefault === void 0) { mergeDefault = 0 ; }
@@ -1320,29 +1418,53 @@
1320
1418
  }
1321
1419
  return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1322
1420
  }
1323
- function _processChain(cb) {
1324
- var nextPlugin = _nextProxy;
1325
- if (nextPlugin) {
1326
- _nextProxy = nextPlugin.getNext();
1327
- cb(nextPlugin);
1328
- }
1329
- else {
1330
- if (_onComplete) {
1331
- _onComplete();
1332
- _onComplete = null;
1421
+ function _iterateChain(cb) {
1422
+ var nextPlugin;
1423
+ while (!!(nextPlugin = context._next())) {
1424
+ var plugin = nextPlugin.getPlugin();
1425
+ if (plugin) {
1426
+ cb(plugin);
1333
1427
  }
1334
1428
  }
1335
1429
  }
1336
- function _iterateChain(cb) {
1337
- while (_nextProxy) {
1338
- _processChain(function (nextPlugin) {
1339
- var plugin = nextPlugin.getPlugin();
1340
- if (plugin) {
1341
- cb(plugin);
1342
- }
1343
- });
1430
+ return context;
1431
+ }
1432
+ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1433
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1434
+ var context = internalContext.ctx;
1435
+ function _processNext(env) {
1436
+ var nextPlugin = internalContext._next();
1437
+ nextPlugin && nextPlugin.processTelemetry(env, context);
1438
+ return !nextPlugin;
1439
+ }
1440
+ function _createNew(plugins, startAt) {
1441
+ if (plugins === void 0) { plugins = null; }
1442
+ if (isArray(plugins)) {
1443
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1444
+ }
1445
+ return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
1446
+ }
1447
+ context.processNext = _processNext;
1448
+ context.createNew = _createNew;
1449
+ return context;
1450
+ }
1451
+ function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
1452
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1453
+ var context = internalContext.ctx;
1454
+ function _processNext(unloadState) {
1455
+ var nextPlugin = internalContext._next();
1456
+ nextPlugin && nextPlugin.unload(context, unloadState);
1457
+ return !nextPlugin;
1458
+ }
1459
+ function _createNew(plugins, startAt) {
1460
+ if (plugins === void 0) { plugins = null; }
1461
+ if (isArray(plugins)) {
1462
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1344
1463
  }
1464
+ return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
1345
1465
  }
1466
+ context.processNext = _processNext;
1467
+ context.createNew = _createNew;
1346
1468
  return context;
1347
1469
  }
1348
1470
  function createTelemetryProxyChain(plugins, config, core, startAt) {
@@ -1390,32 +1512,35 @@
1390
1512
  return nextProxy;
1391
1513
  },
1392
1514
  processTelemetry: _processTelemetry,
1515
+ unload: _unloadPlugin,
1393
1516
  _id: chainId,
1394
1517
  _setNext: function (nextPlugin) {
1395
1518
  nextProxy = nextPlugin;
1396
1519
  }
1397
1520
  };
1398
- function _processChain(itemCtx, processPluginFn, processProxyFn, name, details, isAsync) {
1521
+ function _getTelCtx() {
1522
+ var itemCtx;
1523
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
1524
+ itemCtx = plugin[strGetTelCtx]();
1525
+ }
1399
1526
  if (!itemCtx) {
1400
- if (plugin && isFunction(plugin[strGetTelCtx])) {
1401
- itemCtx = plugin[strGetTelCtx]();
1402
- }
1403
- if (!itemCtx) {
1404
- itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1405
- }
1527
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1406
1528
  }
1529
+ return itemCtx;
1530
+ }
1531
+ function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1532
+ var hasRun = false;
1407
1533
  var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1408
1534
  var hasRunContext = itemCtx[strHasRunFlags];
1409
1535
  if (!hasRunContext) {
1410
1536
  hasRunContext = itemCtx[strHasRunFlags] = {};
1411
1537
  }
1412
- doPerf(itemCtx.core(), function () { return identifier + ":" + name; }, function () {
1413
- hasRunContext[chainId] = true;
1414
- var hasRun = false;
1415
- itemCtx.setNext(nextProxy);
1416
- if (plugin) {
1538
+ itemCtx.setNext(nextProxy);
1539
+ if (plugin) {
1540
+ doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
1541
+ hasRunContext[chainId] = true;
1417
1542
  try {
1418
- var nextId = nextProxy ? nextProxy._id : "";
1543
+ var nextId = nextProxy ? nextProxy._id : strEmpty$1;
1419
1544
  if (nextId) {
1420
1545
  hasRunContext[nextId] = false;
1421
1546
  }
@@ -1427,18 +1552,21 @@
1427
1552
  hasRun = true;
1428
1553
  }
1429
1554
  if (!nextProxy || !hasNextRun) {
1430
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1555
+ itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1431
1556
  }
1432
1557
  }
1433
- }
1434
- if (nextProxy && !hasRun) {
1435
- processProxyFn(itemCtx);
1436
- }
1437
- }, details, isAsync);
1558
+ }, details, isAsync);
1559
+ }
1560
+ return hasRun;
1438
1561
  }
1439
1562
  function _processTelemetry(env, itemCtx) {
1440
- _processChain(itemCtx, function (itemCtx) {
1441
- if (!hasProcessTelemetry) {
1563
+ itemCtx = itemCtx || _getTelCtx();
1564
+ function _callProcessTelemetry(itemCtx) {
1565
+ if (!plugin || !hasProcessTelemetry) {
1566
+ return false;
1567
+ }
1568
+ var pluginState = _getPluginState(plugin);
1569
+ if (pluginState[strTeardown] || pluginState[strDisabled]) {
1442
1570
  return false;
1443
1571
  }
1444
1572
  if (hasSetNext) {
@@ -1446,9 +1574,31 @@
1446
1574
  }
1447
1575
  plugin.processTelemetry(env, itemCtx);
1448
1576
  return true;
1449
- }, function (itemCtx) {
1450
- nextProxy.processTelemetry(env, itemCtx);
1451
- }, "processTelemetry", function () { return ({ item: env }); }, !(env.sync));
1577
+ }
1578
+ if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1579
+ itemCtx.processNext(env);
1580
+ }
1581
+ }
1582
+ function _unloadPlugin(unloadCtx, unloadState) {
1583
+ function _callTeardown() {
1584
+ var hasRun = false;
1585
+ if (plugin) {
1586
+ var pluginState = _getPluginState(plugin);
1587
+ var pluginCore = plugin[strCore] || pluginState.core;
1588
+ if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1589
+ pluginState[strCore] = null;
1590
+ pluginState[strTeardown] = true;
1591
+ pluginState[strIsInitialized] = false;
1592
+ if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
1593
+ hasRun = true;
1594
+ }
1595
+ }
1596
+ }
1597
+ return hasRun;
1598
+ }
1599
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1600
+ unloadCtx.processNext(unloadState);
1601
+ }
1452
1602
  }
1453
1603
  return objFreeze(proxyChain);
1454
1604
  }
@@ -1461,7 +1611,6 @@
1461
1611
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1462
1612
  var strDisableCookiesUsage = "disableCookiesUsage";
1463
1613
  var strConfigCookieMgr = "_ckMgr";
1464
- var strEmpty = "";
1465
1614
  var _supportsCookies = null;
1466
1615
  var _allowUaSameSite = null;
1467
1616
  var _parsedCookieValue = null;
@@ -1519,7 +1668,7 @@
1519
1668
  var result = false;
1520
1669
  if (_isMgrEnabled(cookieMgr)) {
1521
1670
  var values = {};
1522
- var theValue = strTrim(value || strEmpty);
1671
+ var theValue = strTrim(value || strEmpty$1);
1523
1672
  var idx = theValue.indexOf(";");
1524
1673
  if (idx !== -1) {
1525
1674
  theValue = strTrim(value.substring(0, idx));
@@ -1534,11 +1683,11 @@
1534
1683
  if (expireMs > 0) {
1535
1684
  var expiry = new Date();
1536
1685
  expiry.setTime(expireMs);
1537
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1686
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
1538
1687
  }
1539
1688
  }
1540
1689
  if (!_isIE) {
1541
- setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1690
+ setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
1542
1691
  }
1543
1692
  }
1544
1693
  var location_1 = getLocation();
@@ -1559,7 +1708,7 @@
1559
1708
  return result;
1560
1709
  },
1561
1710
  get: function (name) {
1562
- var value = strEmpty;
1711
+ var value = strEmpty$1;
1563
1712
  if (_isMgrEnabled(cookieMgr)) {
1564
1713
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1565
1714
  }
@@ -1584,7 +1733,7 @@
1584
1733
  values["max-age"] = "0";
1585
1734
  }
1586
1735
  var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1587
- delCookie(name, _formatCookieValue(strEmpty, values));
1736
+ delCookie(name, _formatCookieValue(strEmpty$1, values));
1588
1737
  result = true;
1589
1738
  }
1590
1739
  return result;
@@ -1601,7 +1750,7 @@
1601
1750
  _supportsCookies = doc[strCookie] !== undefined;
1602
1751
  }
1603
1752
  catch (e) {
1604
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1753
+ logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1605
1754
  }
1606
1755
  }
1607
1756
  return _supportsCookies;
@@ -1611,7 +1760,7 @@
1611
1760
  if (theValue && theValue.length) {
1612
1761
  var parts = strTrim(theValue).split(";");
1613
1762
  arrForEach(parts, function (thePart) {
1614
- thePart = strTrim(thePart || strEmpty);
1763
+ thePart = strTrim(thePart || strEmpty$1);
1615
1764
  if (thePart) {
1616
1765
  var idx = thePart.indexOf("=");
1617
1766
  if (idx === -1) {
@@ -1632,21 +1781,21 @@
1632
1781
  return null;
1633
1782
  }
1634
1783
  function _formatCookieValue(value, values) {
1635
- var cookieValue = value || strEmpty;
1784
+ var cookieValue = value || strEmpty$1;
1636
1785
  objForEachKey(values, function (name, theValue) {
1637
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1786
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
1638
1787
  });
1639
1788
  return cookieValue;
1640
1789
  }
1641
1790
  function _getCookieValue(name) {
1642
- var cookieValue = strEmpty;
1791
+ var cookieValue = strEmpty$1;
1643
1792
  if (_doc) {
1644
- var theCookie = _doc[strCookie] || strEmpty;
1793
+ var theCookie = _doc[strCookie] || strEmpty$1;
1645
1794
  if (_parsedCookieValue !== theCookie) {
1646
1795
  _cookieCache = _extractParts(theCookie);
1647
1796
  _parsedCookieValue = theCookie;
1648
1797
  }
1649
- cookieValue = strTrim(_cookieCache[name] || strEmpty);
1798
+ cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
1650
1799
  }
1651
1800
  return cookieValue;
1652
1801
  }
@@ -1696,6 +1845,38 @@
1696
1845
  _setDefaults(config, core, pluginChain);
1697
1846
  _isinitialized = true;
1698
1847
  };
1848
+ _self.teardown = function (unloadCtx, unloadState) {
1849
+ if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
1850
+ return;
1851
+ }
1852
+ var result;
1853
+ var unloadDone = false;
1854
+ var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1855
+ var theUnloadState = unloadState || {
1856
+ reason: 0 ,
1857
+ isAsync: false
1858
+ };
1859
+ function _unloadCallback() {
1860
+ if (!unloadDone) {
1861
+ unloadDone = true;
1862
+ arrForEach(_hooks, function (fn) {
1863
+ fn.rm();
1864
+ });
1865
+ _hooks = [];
1866
+ if (result === true) {
1867
+ theUnloadCtx.processNext(theUnloadState);
1868
+ }
1869
+ _initDefaults();
1870
+ }
1871
+ }
1872
+ if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
1873
+ _unloadCallback();
1874
+ }
1875
+ else {
1876
+ result = true;
1877
+ }
1878
+ return result;
1879
+ };
1699
1880
  _self._addHook = function (hooks) {
1700
1881
  if (hooks) {
1701
1882
  if (isArray(hooks)) {
@@ -1710,13 +1891,13 @@
1710
1891
  _self.diagLog = function (itemCtx) {
1711
1892
  return _getTelCtx(itemCtx).diagLog();
1712
1893
  };
1713
- _self.isInitialized = function () {
1894
+ _self[strIsInitialized] = function () {
1714
1895
  return _isinitialized;
1715
1896
  };
1716
1897
  _self.setInitialized = function (isInitialized) {
1717
1898
  _isinitialized = isInitialized;
1718
1899
  };
1719
- _self.setNextPlugin = function (next) {
1900
+ _self[strSetNextPlugin] = function (next) {
1720
1901
  _nextPlugin = next;
1721
1902
  };
1722
1903
  _self.processNext = function (env, itemCtx) {
@@ -1767,103 +1948,117 @@
1767
1948
  return BaseTelemetryPlugin;
1768
1949
  }());
1769
1950
 
1770
- var UInt32Mask = 0x100000000;
1771
- var MaxUInt32 = 0xffffffff;
1772
- var _mwcSeeded = false;
1773
- var _mwcW = 123456789;
1774
- var _mwcZ = 987654321;
1775
- function _mwcSeed(seedValue) {
1776
- if (seedValue < 0) {
1777
- seedValue >>>= 0;
1778
- }
1779
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1780
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1781
- _mwcSeeded = true;
1782
- }
1783
- function _autoSeedMwc() {
1784
- try {
1785
- var now = dateNow() & 0x7fffffff;
1786
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1787
- }
1788
- catch (e) {
1789
- }
1790
- }
1791
- function randomValue(maxValue) {
1792
- if (maxValue > 0) {
1793
- return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
1794
- }
1795
- return 0;
1796
- }
1797
- function random32(signed) {
1798
- var value = 0;
1799
- var c = getCrypto() || getMsCrypto();
1800
- if (c && c.getRandomValues) {
1801
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1802
- }
1803
- if (value === 0 && isIE()) {
1804
- if (!_mwcSeeded) {
1805
- _autoSeedMwc();
1951
+ var strOnPrefix = "on";
1952
+ var strAttachEvent = "attachEvent";
1953
+ var strAddEventHelper = "addEventListener";
1954
+ var strEvents = "events";
1955
+ createUniqueNamespace("aiEvtPageHide");
1956
+ createUniqueNamespace("aiEvtPageShow");
1957
+ var _guid = 1;
1958
+ var elmNodeData = createElmNodeData("events");
1959
+ var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
1960
+ function _normalizeNamespace(name) {
1961
+ if (name && name.replace) {
1962
+ return name.replace(/^\s*\.*|\.*\s*$/g, "");
1963
+ }
1964
+ return name;
1965
+ }
1966
+ function _getEvtNamespace(eventName, namespaces) {
1967
+ if (namespaces) {
1968
+ var theNamespace_1 = "";
1969
+ if (isArray(namespaces)) {
1970
+ theNamespace_1 = "";
1971
+ arrForEach(namespaces, function (name) {
1972
+ name = _normalizeNamespace(name);
1973
+ if (name) {
1974
+ if (name[0] !== ".") {
1975
+ name = "." + name;
1976
+ }
1977
+ theNamespace_1 += name;
1978
+ }
1979
+ });
1980
+ }
1981
+ else {
1982
+ theNamespace_1 = _normalizeNamespace(namespaces);
1983
+ }
1984
+ if (theNamespace_1) {
1985
+ if (theNamespace_1[0] !== ".") {
1986
+ theNamespace_1 = "." + theNamespace_1;
1987
+ }
1988
+ eventName = (eventName || "") + theNamespace_1;
1806
1989
  }
1807
- value = mwcRandom32() & MaxUInt32;
1808
- }
1809
- if (value === 0) {
1810
- value = Math.floor((UInt32Mask * Math.random()) | 0);
1811
- }
1812
- if (!signed) {
1813
- value >>>= 0;
1814
1990
  }
1815
- return value;
1991
+ var parsedEvent = (eventNamespace.exec(eventName) || []);
1992
+ return {
1993
+ type: parsedEvent[1],
1994
+ ns: ((parsedEvent[2] || "").split(".").sort()).join(".")
1995
+ };
1816
1996
  }
1817
- function mwcRandomSeed(value) {
1818
- if (!value) {
1819
- _autoSeedMwc();
1820
- }
1821
- else {
1822
- _mwcSeed(value);
1997
+ function _getRegisteredEvents(target, evtName, addDefault) {
1998
+ if (addDefault === void 0) { addDefault = true; }
1999
+ var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
2000
+ var registeredEvents = aiEvts[evtName];
2001
+ if (!registeredEvents) {
2002
+ registeredEvents = aiEvts[evtName] = [];
1823
2003
  }
2004
+ return registeredEvents;
1824
2005
  }
1825
- function mwcRandom32(signed) {
1826
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1827
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1828
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1829
- if (!signed) {
1830
- value >>>= 0;
2006
+ function _doAttach(obj, evtName, handlerRef, useCapture) {
2007
+ var result = false;
2008
+ if (obj && evtName && evtName.type && handlerRef) {
2009
+ if (obj[strAddEventHelper]) {
2010
+ obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
2011
+ result = true;
2012
+ }
2013
+ else if (obj[strAttachEvent]) {
2014
+ obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
2015
+ result = true;
2016
+ }
1831
2017
  }
1832
- return value;
2018
+ return result;
1833
2019
  }
1834
- function newId(maxLength) {
1835
- if (maxLength === void 0) { maxLength = 22; }
1836
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1837
- var number = random32() >>> 0;
1838
- var chars = 0;
1839
- var result = "";
1840
- while (result.length < maxLength) {
1841
- chars++;
1842
- result += base64chars.charAt(number & 0x3F);
1843
- number >>>= 6;
1844
- if (chars === 5) {
1845
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1846
- chars = 0;
2020
+ function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
2021
+ if (useCapture === void 0) { useCapture = false; }
2022
+ var result = false;
2023
+ if (target) {
2024
+ try {
2025
+ var evtName = _getEvtNamespace(eventName, evtNamespace);
2026
+ result = _doAttach(target, evtName, handlerRef, useCapture);
2027
+ if (result && elmNodeData.accept(target)) {
2028
+ var registeredEvent = {
2029
+ guid: _guid++,
2030
+ evtName: evtName,
2031
+ handler: handlerRef,
2032
+ capture: useCapture
2033
+ };
2034
+ _getRegisteredEvents(target, evtName.type).push(registeredEvent);
2035
+ }
2036
+ }
2037
+ catch (e) {
1847
2038
  }
1848
2039
  }
1849
2040
  return result;
1850
2041
  }
1851
-
1852
- var _cookieMgrs = null;
1853
- var _canUseCookies;
1854
- function addEventHandler(eventName, callback) {
2042
+ function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
2043
+ if (useCapture === void 0) { useCapture = false; }
2044
+ return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
2045
+ }
2046
+ function addEventHandler(eventName, callback, evtNamespace) {
1855
2047
  var result = false;
1856
2048
  var w = getWindow();
1857
2049
  if (w) {
1858
- result = attachEvent(w, eventName, callback);
1859
- result = attachEvent(w["body"], eventName, callback) || result;
2050
+ result = eventOn(w, eventName, callback, evtNamespace);
2051
+ result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
1860
2052
  }
1861
2053
  var doc = getDocument();
1862
2054
  if (doc) {
1863
- result = attachEvent(doc, eventName, callback) || result;
2055
+ result = eventOn(doc, eventName, callback, evtNamespace) || result;
1864
2056
  }
1865
2057
  return result;
1866
2058
  }
2059
+
2060
+ var _cookieMgrs = null;
2061
+ var _canUseCookies;
1867
2062
  function newGuid() {
1868
2063
  function randomHexDigit() {
1869
2064
  return randomValue(15);
@@ -1882,7 +2077,7 @@
1882
2077
  }
1883
2078
  function generateW3CId() {
1884
2079
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1885
- var oct = "", tmp;
2080
+ var oct = strEmpty$1, tmp;
1886
2081
  for (var a = 0; a < 4; a++) {
1887
2082
  tmp = random32();
1888
2083
  oct +=
@@ -1977,6 +2172,95 @@
1977
2172
  return _legacyCookieMgr(null, logger).del(name);
1978
2173
  }
1979
2174
 
2175
+ createEnumStyle({
2176
+ CRITICAL: 1 ,
2177
+ WARNING: 2
2178
+ });
2179
+ var _InternalMessageId = createEnumStyle({
2180
+ BrowserDoesNotSupportLocalStorage: 0 ,
2181
+ BrowserCannotReadLocalStorage: 1 ,
2182
+ BrowserCannotReadSessionStorage: 2 ,
2183
+ BrowserCannotWriteLocalStorage: 3 ,
2184
+ BrowserCannotWriteSessionStorage: 4 ,
2185
+ BrowserFailedRemovalFromLocalStorage: 5 ,
2186
+ BrowserFailedRemovalFromSessionStorage: 6 ,
2187
+ CannotSendEmptyTelemetry: 7 ,
2188
+ ClientPerformanceMathError: 8 ,
2189
+ ErrorParsingAISessionCookie: 9 ,
2190
+ ErrorPVCalc: 10 ,
2191
+ ExceptionWhileLoggingError: 11 ,
2192
+ FailedAddingTelemetryToBuffer: 12 ,
2193
+ FailedMonitorAjaxAbort: 13 ,
2194
+ FailedMonitorAjaxDur: 14 ,
2195
+ FailedMonitorAjaxOpen: 15 ,
2196
+ FailedMonitorAjaxRSC: 16 ,
2197
+ FailedMonitorAjaxSend: 17 ,
2198
+ FailedMonitorAjaxGetCorrelationHeader: 18 ,
2199
+ FailedToAddHandlerForOnBeforeUnload: 19 ,
2200
+ FailedToSendQueuedTelemetry: 20 ,
2201
+ FailedToReportDataLoss: 21 ,
2202
+ FlushFailed: 22 ,
2203
+ MessageLimitPerPVExceeded: 23 ,
2204
+ MissingRequiredFieldSpecification: 24 ,
2205
+ NavigationTimingNotSupported: 25 ,
2206
+ OnError: 26 ,
2207
+ SessionRenewalDateIsZero: 27 ,
2208
+ SenderNotInitialized: 28 ,
2209
+ StartTrackEventFailed: 29 ,
2210
+ StopTrackEventFailed: 30 ,
2211
+ StartTrackFailed: 31 ,
2212
+ StopTrackFailed: 32 ,
2213
+ TelemetrySampledAndNotSent: 33 ,
2214
+ TrackEventFailed: 34 ,
2215
+ TrackExceptionFailed: 35 ,
2216
+ TrackMetricFailed: 36 ,
2217
+ TrackPVFailed: 37 ,
2218
+ TrackPVFailedCalc: 38 ,
2219
+ TrackTraceFailed: 39 ,
2220
+ TransmissionFailed: 40 ,
2221
+ FailedToSetStorageBuffer: 41 ,
2222
+ FailedToRestoreStorageBuffer: 42 ,
2223
+ InvalidBackendResponse: 43 ,
2224
+ FailedToFixDepricatedValues: 44 ,
2225
+ InvalidDurationValue: 45 ,
2226
+ TelemetryEnvelopeInvalid: 46 ,
2227
+ CreateEnvelopeError: 47 ,
2228
+ CannotSerializeObject: 48 ,
2229
+ CannotSerializeObjectNonSerializable: 49 ,
2230
+ CircularReferenceDetected: 50 ,
2231
+ ClearAuthContextFailed: 51 ,
2232
+ ExceptionTruncated: 52 ,
2233
+ IllegalCharsInName: 53 ,
2234
+ ItemNotInArray: 54 ,
2235
+ MaxAjaxPerPVExceeded: 55 ,
2236
+ MessageTruncated: 56 ,
2237
+ NameTooLong: 57 ,
2238
+ SampleRateOutOfRange: 58 ,
2239
+ SetAuthContextFailed: 59 ,
2240
+ SetAuthContextFailedAccountName: 60 ,
2241
+ StringValueTooLong: 61 ,
2242
+ StartCalledMoreThanOnce: 62 ,
2243
+ StopCalledWithoutStart: 63 ,
2244
+ TelemetryInitializerFailed: 64 ,
2245
+ TrackArgumentsNotSpecified: 65 ,
2246
+ UrlTooLong: 66 ,
2247
+ SessionStorageBufferFull: 67 ,
2248
+ CannotAccessCookie: 68 ,
2249
+ IdTooLong: 69 ,
2250
+ InvalidEvent: 70 ,
2251
+ FailedMonitorAjaxSetRequestHeader: 71 ,
2252
+ SendBrowserInfoOnUserInit: 72 ,
2253
+ PluginException: 73 ,
2254
+ NotificationException: 74 ,
2255
+ SnippetScriptLoadFailure: 99 ,
2256
+ InvalidInstrumentationKey: 100 ,
2257
+ CannotParseAiBlobValue: 101 ,
2258
+ InvalidContentBlob: 102 ,
2259
+ TrackPageActionEventFailed: 103 ,
2260
+ FailedAddingCustomDefinedRequestContext: 104 ,
2261
+ InMemoryStorageBufferFull: 105
2262
+ });
2263
+
1980
2264
  var aiInstrumentHooks = "_aiHooks";
1981
2265
  var cbNames = [
1982
2266
  "req", "rsp", "hkErr", "fnErr"
@@ -2129,6 +2413,7 @@
2129
2413
  return event;
2130
2414
  }
2131
2415
 
2416
+ var strEmpty = "";
2132
2417
  function stringToBoolOrDefault(str, defaultValue) {
2133
2418
  if (defaultValue === void 0) { defaultValue = false; }
2134
2419
  if (str === undefined || str === null) {
@@ -2141,16 +2426,16 @@
2141
2426
  totalms = 0;
2142
2427
  }
2143
2428
  totalms = Math.round(totalms);
2144
- var ms = "" + totalms % 1000;
2145
- var sec = "" + Math.floor(totalms / 1000) % 60;
2146
- var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
2147
- var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2429
+ var ms = strEmpty + totalms % 1000;
2430
+ var sec = strEmpty + Math.floor(totalms / 1000) % 60;
2431
+ var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
2432
+ var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2148
2433
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
2149
2434
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
2150
2435
  sec = sec.length < 2 ? "0" + sec : sec;
2151
2436
  min = min.length < 2 ? "0" + min : min;
2152
2437
  hour = hour.length < 2 ? "0" + hour : hour;
2153
- return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
2438
+ return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
2154
2439
  }
2155
2440
  function getExtensionByName(extensions, identifier) {
2156
2441
  var extension = null;
@@ -2168,17 +2453,15 @@
2168
2453
 
2169
2454
  var strNotSpecified = "not_specified";
2170
2455
 
2171
- var StorageType;
2172
- (function (StorageType) {
2173
- StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
2174
- StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
2175
- })(StorageType || (StorageType = {}));
2176
- var DistributedTracingModes;
2177
- (function (DistributedTracingModes) {
2178
- DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
2179
- DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
2180
- DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
2181
- })(DistributedTracingModes || (DistributedTracingModes = {}));
2456
+ var StorageType = createEnumStyle({
2457
+ LocalStorage: 0 ,
2458
+ SessionStorage: 1
2459
+ });
2460
+ createEnumStyle({
2461
+ AI: 0 ,
2462
+ AI_AND_W3C: 1 ,
2463
+ W3C: 2
2464
+ });
2182
2465
 
2183
2466
  var _canUseLocalStorage = undefined;
2184
2467
  var _canUseSessionStorage = undefined;
@@ -2230,7 +2513,7 @@
2230
2513
  }
2231
2514
  catch (e) {
2232
2515
  _canUseLocalStorage = false;
2233
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2516
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2234
2517
  }
2235
2518
  }
2236
2519
  return null;
@@ -2244,7 +2527,7 @@
2244
2527
  }
2245
2528
  catch (e) {
2246
2529
  _canUseLocalStorage = false;
2247
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2530
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2248
2531
  }
2249
2532
  }
2250
2533
  return false;
@@ -2258,7 +2541,7 @@
2258
2541
  }
2259
2542
  catch (e) {
2260
2543
  _canUseLocalStorage = false;
2261
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2544
+ logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2262
2545
  }
2263
2546
  }
2264
2547
  return false;
@@ -2286,7 +2569,7 @@
2286
2569
  }
2287
2570
  catch (e) {
2288
2571
  _canUseSessionStorage = false;
2289
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2572
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2290
2573
  }
2291
2574
  }
2292
2575
  return null;
@@ -2300,7 +2583,7 @@
2300
2583
  }
2301
2584
  catch (e) {
2302
2585
  _canUseSessionStorage = false;
2303
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2586
+ logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2304
2587
  }
2305
2588
  }
2306
2589
  return false;
@@ -2314,7 +2597,7 @@
2314
2597
  }
2315
2598
  catch (e) {
2316
2599
  _canUseSessionStorage = false;
2317
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2600
+ logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2318
2601
  }
2319
2602
  }
2320
2603
  return false;