@microsoft/applicationinsights-debugplugin-js 2.7.5-nightly.2203-02 → 2.7.5-nightly.2203-03

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 (58) hide show
  1. package/browser/{ai.dbg.2.7.5-nightly.2203-02.cjs.js → ai.dbg.2.7.5-nightly.2203-03.cjs.js} +1022 -460
  2. package/browser/ai.dbg.2.7.5-nightly.2203-03.cjs.js.map +1 -0
  3. package/browser/ai.dbg.2.7.5-nightly.2203-03.cjs.min.js +6 -0
  4. package/browser/ai.dbg.2.7.5-nightly.2203-03.cjs.min.js.map +1 -0
  5. package/browser/{ai.dbg.2.7.5-nightly.2203-02.gbl.js → ai.dbg.2.7.5-nightly.2203-03.gbl.js} +1022 -460
  6. package/browser/ai.dbg.2.7.5-nightly.2203-03.gbl.js.map +1 -0
  7. package/browser/ai.dbg.2.7.5-nightly.2203-03.gbl.min.js +6 -0
  8. package/browser/ai.dbg.2.7.5-nightly.2203-03.gbl.min.js.map +1 -0
  9. package/browser/ai.dbg.2.7.5-nightly.2203-03.integrity.json +66 -0
  10. package/browser/{ai.dbg.2.7.5-nightly.2203-02.js → ai.dbg.2.7.5-nightly.2203-03.js} +1022 -460
  11. package/browser/ai.dbg.2.7.5-nightly.2203-03.js.map +1 -0
  12. package/browser/ai.dbg.2.7.5-nightly.2203-03.min.js +6 -0
  13. package/browser/ai.dbg.2.7.5-nightly.2203-03.min.js.map +1 -0
  14. package/browser/ai.dbg.2.cjs.js +1021 -459
  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 +1021 -459
  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 +1021 -459
  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.api.json +1 -1
  27. package/dist/applicationinsights-debugplugin-js.d.ts +1 -1
  28. package/dist/applicationinsights-debugplugin-js.js +1021 -459
  29. package/dist/applicationinsights-debugplugin-js.js.map +1 -1
  30. package/dist/applicationinsights-debugplugin-js.min.js +2 -2
  31. package/dist/applicationinsights-debugplugin-js.min.js.map +1 -1
  32. package/dist/applicationinsights-debugplugin-js.rollup.d.ts +1 -1
  33. package/dist-esm/DebugPlugin.js +1 -1
  34. package/dist-esm/applicationinsights-debugplugin-js.js +1 -1
  35. package/dist-esm/components/Dashboard.js +1 -1
  36. package/dist-esm/components/LogEntry.js +3 -3
  37. package/dist-esm/components/LogEntry.js.map +1 -1
  38. package/dist-esm/components/debugBins.js +1 -1
  39. package/dist-esm/components/filterList.js +1 -1
  40. package/dist-esm/components/helpers.js +1 -1
  41. package/dist-esm/components/styleNodeSrc.js +1 -1
  42. package/dist-esm/interfaces/IDebugPluginConfig.js +1 -1
  43. package/package.json +4 -4
  44. package/src/components/LogEntry.ts +2 -2
  45. package/src/components/debugBins.ts +7 -6
  46. package/src/components/helpers.ts +55 -45
  47. package/src/components/styleNodeSrc.ts +33 -33
  48. package/types/tsdoc-metadata.json +1 -1
  49. package/browser/ai.dbg.2.7.5-nightly.2203-02.cjs.js.map +0 -1
  50. package/browser/ai.dbg.2.7.5-nightly.2203-02.cjs.min.js +0 -6
  51. package/browser/ai.dbg.2.7.5-nightly.2203-02.cjs.min.js.map +0 -1
  52. package/browser/ai.dbg.2.7.5-nightly.2203-02.gbl.js.map +0 -1
  53. package/browser/ai.dbg.2.7.5-nightly.2203-02.gbl.min.js +0 -6
  54. package/browser/ai.dbg.2.7.5-nightly.2203-02.gbl.min.js.map +0 -1
  55. package/browser/ai.dbg.2.7.5-nightly.2203-02.integrity.json +0 -66
  56. package/browser/ai.dbg.2.7.5-nightly.2203-02.js.map +0 -1
  57. package/browser/ai.dbg.2.7.5-nightly.2203-02.min.js +0 -6
  58. package/browser/ai.dbg.2.7.5-nightly.2203-02.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Debug Plugin, 2.7.5-nightly.2203-02
2
+ * Application Insights JavaScript SDK - Debug Plugin, 2.7.5-nightly.2203-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  'use strict';
@@ -60,7 +60,9 @@ function objCreateFn(obj) {
60
60
  (getGlobal() || {})["Reflect"];
61
61
  var extendStaticsFn = function (d, b) {
62
62
  extendStaticsFn = ObjClass["setPrototypeOf"] ||
63
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
63
+ ({ __proto__: [] } instanceof Array && function (d, b) {
64
+ d.__proto__ = b;
65
+ }) ||
64
66
  function (d, b) {
65
67
  for (var p in b) {
66
68
  if (b[strShimHasOwnProperty](p)) {
@@ -75,7 +77,9 @@ function __extendsFn(d, b) {
75
77
  throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
76
78
  }
77
79
  extendStaticsFn(d, b);
78
- function __() { this.constructor = d; }
80
+ function __() {
81
+ this.constructor = d;
82
+ }
79
83
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
80
84
  }
81
85
 
@@ -320,99 +324,15 @@ var perfDefaults = {
320
324
  };
321
325
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
322
326
 
323
- var LoggingSeverity;
324
- (function (LoggingSeverity) {
325
- LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
326
- LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
327
- })(LoggingSeverity || (LoggingSeverity = {}));
328
- var _InternalMessageId = {
329
- BrowserDoesNotSupportLocalStorage: 0,
330
- BrowserCannotReadLocalStorage: 1,
331
- BrowserCannotReadSessionStorage: 2,
332
- BrowserCannotWriteLocalStorage: 3,
333
- BrowserCannotWriteSessionStorage: 4,
334
- BrowserFailedRemovalFromLocalStorage: 5,
335
- BrowserFailedRemovalFromSessionStorage: 6,
336
- CannotSendEmptyTelemetry: 7,
337
- ClientPerformanceMathError: 8,
338
- ErrorParsingAISessionCookie: 9,
339
- ErrorPVCalc: 10,
340
- ExceptionWhileLoggingError: 11,
341
- FailedAddingTelemetryToBuffer: 12,
342
- FailedMonitorAjaxAbort: 13,
343
- FailedMonitorAjaxDur: 14,
344
- FailedMonitorAjaxOpen: 15,
345
- FailedMonitorAjaxRSC: 16,
346
- FailedMonitorAjaxSend: 17,
347
- FailedMonitorAjaxGetCorrelationHeader: 18,
348
- FailedToAddHandlerForOnBeforeUnload: 19,
349
- FailedToSendQueuedTelemetry: 20,
350
- FailedToReportDataLoss: 21,
351
- FlushFailed: 22,
352
- MessageLimitPerPVExceeded: 23,
353
- MissingRequiredFieldSpecification: 24,
354
- NavigationTimingNotSupported: 25,
355
- OnError: 26,
356
- SessionRenewalDateIsZero: 27,
357
- SenderNotInitialized: 28,
358
- StartTrackEventFailed: 29,
359
- StopTrackEventFailed: 30,
360
- StartTrackFailed: 31,
361
- StopTrackFailed: 32,
362
- TelemetrySampledAndNotSent: 33,
363
- TrackEventFailed: 34,
364
- TrackExceptionFailed: 35,
365
- TrackMetricFailed: 36,
366
- TrackPVFailed: 37,
367
- TrackPVFailedCalc: 38,
368
- TrackTraceFailed: 39,
369
- TransmissionFailed: 40,
370
- FailedToSetStorageBuffer: 41,
371
- FailedToRestoreStorageBuffer: 42,
372
- InvalidBackendResponse: 43,
373
- FailedToFixDepricatedValues: 44,
374
- InvalidDurationValue: 45,
375
- TelemetryEnvelopeInvalid: 46,
376
- CreateEnvelopeError: 47,
377
- CannotSerializeObject: 48,
378
- CannotSerializeObjectNonSerializable: 49,
379
- CircularReferenceDetected: 50,
380
- ClearAuthContextFailed: 51,
381
- ExceptionTruncated: 52,
382
- IllegalCharsInName: 53,
383
- ItemNotInArray: 54,
384
- MaxAjaxPerPVExceeded: 55,
385
- MessageTruncated: 56,
386
- NameTooLong: 57,
387
- SampleRateOutOfRange: 58,
388
- SetAuthContextFailed: 59,
389
- SetAuthContextFailedAccountName: 60,
390
- StringValueTooLong: 61,
391
- StartCalledMoreThanOnce: 62,
392
- StopCalledWithoutStart: 63,
393
- TelemetryInitializerFailed: 64,
394
- TrackArgumentsNotSpecified: 65,
395
- UrlTooLong: 66,
396
- SessionStorageBufferFull: 67,
397
- CannotAccessCookie: 68,
398
- IdTooLong: 69,
399
- InvalidEvent: 70,
400
- FailedMonitorAjaxSetRequestHeader: 71,
401
- SendBrowserInfoOnUserInit: 72,
402
- PluginException: 73,
403
- NotificationException: 74,
404
- SnippetScriptLoadFailure: 99,
405
- InvalidInstrumentationKey: 100,
406
- CannotParseAiBlobValue: 101,
407
- InvalidContentBlob: 102,
408
- TrackPageActionEventFailed: 103,
409
- FailedAddingCustomDefinedRequestContext: 104,
410
- InMemoryStorageBufferFull: 105
411
- };
327
+ var strEmpty$1 = "";
328
+ var strSetNextPlugin = "setNextPlugin";
329
+ var strIsInitialized = "isInitialized";
330
+ var strTeardown = "teardown";
331
+ var strCore = "core";
332
+ var strUpdate = "update";
333
+ var strDisabled = "disabled";
334
+ var strDoTeardown = "_doTeardown";
412
335
 
413
- var strOnPrefix = "on";
414
- var strAttachEvent = "attachEvent";
415
- var strAddEventHelper = "addEventListener";
416
336
  var strToISOString = "toISOString";
417
337
  var cStrEndsWith = "endsWith";
418
338
  var strIndexOf = "indexOf";
@@ -422,7 +342,8 @@ var cStrTrim = "trim";
422
342
  var strToString = "toString";
423
343
  var str__Proto = "__proto__";
424
344
  var strConstructor$1 = "constructor";
425
- var _objDefineProperty = ObjDefineProperty;
345
+ var _objDefineProperty$1 = ObjDefineProperty;
346
+ var _objFreeze = ObjClass.freeze;
426
347
  var _objKeys = ObjClass.keys;
427
348
  var StringProto = String[strShimPrototype];
428
349
  var _strTrim = StringProto[cStrTrim];
@@ -432,7 +353,10 @@ var _dataToISOString = DateProto[strToISOString];
432
353
  var _isArray = Array.isArray;
433
354
  var _objToString = ObjProto[strToString];
434
355
  var _fnToString = ObjHasOwnProperty[strToString];
435
- _fnToString.call(ObjClass);
356
+ var _objFunctionString = _fnToString.call(ObjClass);
357
+ var rCamelCase = /-([a-z])/g;
358
+ var rNormalizeInvalid = /([^\w\d_$])/g;
359
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
436
360
  var _objGetPrototypeOf = Object["getPrototypeOf"];
437
361
  function _getObjProto(target) {
438
362
  if (target) {
@@ -446,6 +370,9 @@ function _getObjProto(target) {
446
370
  }
447
371
  return null;
448
372
  }
373
+ function objToString(obj) {
374
+ return _objToString.call(obj);
375
+ }
449
376
  function isTypeof(value, theType) {
450
377
  return typeof value === theType;
451
378
  }
@@ -467,24 +394,18 @@ function isObject(value) {
467
394
  function isFunction(value) {
468
395
  return !!(value && typeof value === strShimFunction);
469
396
  }
470
- function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
471
- if (useCapture === void 0) { useCapture = false; }
472
- var result = false;
473
- if (!isNullOrUndefined(obj)) {
474
- try {
475
- if (!isNullOrUndefined(obj[strAddEventHelper])) {
476
- obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
477
- result = true;
478
- }
479
- else if (!isNullOrUndefined(obj[strAttachEvent])) {
480
- obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
481
- result = true;
482
- }
483
- }
484
- catch (e) {
485
- }
397
+ function normalizeJsName(name) {
398
+ var value = name;
399
+ if (value && isString(value)) {
400
+ value = value.replace(rCamelCase, function (_all, letter) {
401
+ return letter.toUpperCase();
402
+ });
403
+ value = value.replace(rNormalizeInvalid, "_");
404
+ value = value.replace(rLeadingNumeric, function (_all, match) {
405
+ return "_" + match;
406
+ });
486
407
  }
487
- return result;
408
+ return value;
488
409
  }
489
410
  function objForEachKey(target, callbackfn) {
490
411
  if (target) {
@@ -546,6 +467,22 @@ function isBoolean(value) {
546
467
  function isSymbol(value) {
547
468
  return typeof value === "symbol";
548
469
  }
470
+ function isPlainObject(value) {
471
+ var result = false;
472
+ if (value && typeof value === "object") {
473
+ var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
474
+ if (!proto) {
475
+ result = true;
476
+ }
477
+ else {
478
+ if (proto[strConstructor$1] && ObjHasOwnProperty.call(proto, strConstructor$1)) {
479
+ proto = proto[strConstructor$1];
480
+ }
481
+ result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
482
+ }
483
+ }
484
+ return result;
485
+ }
549
486
  function toISOString(date) {
550
487
  if (date) {
551
488
  return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
@@ -691,7 +628,7 @@ function objKeys(obj) {
691
628
  return result;
692
629
  }
693
630
  function objDefineAccessors(target, prop, getProp, setProp) {
694
- if (_objDefineProperty) {
631
+ if (_objDefineProperty$1) {
695
632
  try {
696
633
  var descriptor = {
697
634
  enumerable: true,
@@ -703,7 +640,7 @@ function objDefineAccessors(target, prop, getProp, setProp) {
703
640
  if (setProp) {
704
641
  descriptor.set = setProp;
705
642
  }
706
- _objDefineProperty(target, prop, descriptor);
643
+ _objDefineProperty$1(target, prop, descriptor);
707
644
  return true;
708
645
  }
709
646
  catch (e) {
@@ -711,6 +648,10 @@ function objDefineAccessors(target, prop, getProp, setProp) {
711
648
  }
712
649
  return false;
713
650
  }
651
+ function _doNothing(value) {
652
+ return value;
653
+ }
654
+ var objFreeze = _objFreeze || _doNothing;
714
655
  function dateNow() {
715
656
  var dt = Date;
716
657
  return dt.now ? dt.now() : new dt().getTime();
@@ -719,7 +660,7 @@ function getExceptionName(object) {
719
660
  if (isError(object)) {
720
661
  return object.name;
721
662
  }
722
- return "";
663
+ return strEmpty$1;
723
664
  }
724
665
  function setValue(target, field, value, valChk, srcChk) {
725
666
  var theValue = value;
@@ -735,6 +676,91 @@ function setValue(target, field, value, valChk, srcChk) {
735
676
  function isTruthy(value) {
736
677
  return !!value;
737
678
  }
679
+ function throwError(message) {
680
+ throw new Error(message);
681
+ }
682
+ function _createProxyFunction(source, funcName) {
683
+ var srcFunc = null;
684
+ var src = null;
685
+ if (isFunction(source)) {
686
+ srcFunc = source;
687
+ }
688
+ else {
689
+ src = source;
690
+ }
691
+ return function () {
692
+ var originalArguments = arguments;
693
+ if (srcFunc) {
694
+ src = srcFunc();
695
+ }
696
+ if (src) {
697
+ return src[funcName].apply(src, originalArguments);
698
+ }
699
+ };
700
+ }
701
+ function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
702
+ if (overwriteTarget === void 0) { overwriteTarget = true; }
703
+ if (target && name && source) {
704
+ if (overwriteTarget || isUndefined(target[name])) {
705
+ target[name] = _createProxyFunction(source, theFunc);
706
+ }
707
+ }
708
+ }
709
+ function createEnumStyle(values) {
710
+ var enumClass = {};
711
+ objForEachKey(values, function (field, value) {
712
+ enumClass[field] = value;
713
+ if (!isUndefined(enumClass[value])) {
714
+ throwError("[" + value + "] exists for " + field);
715
+ }
716
+ enumClass[value] = field;
717
+ });
718
+ return objFreeze(enumClass);
719
+ }
720
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
721
+ var theArgs = arguments;
722
+ var extended = theArgs[0] || {};
723
+ var argLen = theArgs.length;
724
+ var deep = false;
725
+ var idx = 1;
726
+ if (argLen > 0 && isBoolean(extended)) {
727
+ deep = extended;
728
+ extended = theArgs[idx] || {};
729
+ idx++;
730
+ }
731
+ if (!isObject(extended)) {
732
+ extended = {};
733
+ }
734
+ for (; idx < argLen; idx++) {
735
+ var arg = theArgs[idx];
736
+ var isArgArray = isArray(arg);
737
+ var isArgObj = isObject(arg);
738
+ for (var prop in arg) {
739
+ var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
740
+ if (!propOk) {
741
+ continue;
742
+ }
743
+ var newValue = arg[prop];
744
+ var isNewArray = void 0;
745
+ if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
746
+ var clone = extended[prop];
747
+ if (isNewArray) {
748
+ if (!isArray(clone)) {
749
+ clone = [];
750
+ }
751
+ }
752
+ else if (!isPlainObject(clone)) {
753
+ clone = {};
754
+ }
755
+ newValue = objExtend(deep, clone, newValue);
756
+ }
757
+ if (newValue !== undefined) {
758
+ extended[prop] = newValue;
759
+ }
760
+ }
761
+ }
762
+ return extended;
763
+ }
738
764
 
739
765
  var strWindow = "window";
740
766
  var strDocument = "document";
@@ -829,7 +855,7 @@ function isIE() {
829
855
  var nav = getNavigator();
830
856
  if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
831
857
  _navUserAgentCheck = nav.userAgent;
832
- var userAgent = (_navUserAgentCheck || "").toLowerCase();
858
+ var userAgent = (_navUserAgentCheck || strEmpty$1).toLowerCase();
833
859
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
834
860
  }
835
861
  return _isTrident;
@@ -838,9 +864,9 @@ function getIEVersion(userAgentStr) {
838
864
  if (userAgentStr === void 0) { userAgentStr = null; }
839
865
  if (!userAgentStr) {
840
866
  var navigator_1 = getNavigator() || {};
841
- userAgentStr = navigator_1 ? (navigator_1.userAgent || "").toLowerCase() : "";
867
+ userAgentStr = navigator_1 ? (navigator_1.userAgent || strEmpty$1).toLowerCase() : strEmpty$1;
842
868
  }
843
- var ua = (userAgentStr || "").toLowerCase();
869
+ var ua = (userAgentStr || strEmpty$1).toLowerCase();
844
870
  if (strContains(ua, strMsie)) {
845
871
  var doc = getDocument() || {};
846
872
  return Math.max(parseInt(ua.split(strMsie)[1]), (doc[strDocumentMode] || 0));
@@ -855,7 +881,7 @@ function getIEVersion(userAgentStr) {
855
881
  }
856
882
  function dumpObj(object) {
857
883
  var objectTypeDump = Object[strShimPrototype].toString.call(object);
858
- var propertyValueDump = "";
884
+ var propertyValueDump = strEmpty$1;
859
885
  if (objectTypeDump === "[object Error]") {
860
886
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
861
887
  }
@@ -894,9 +920,9 @@ var strErrorToConsole = "errorToConsole";
894
920
  var strWarnToConsole = "warnToConsole";
895
921
  function _sanitizeDiagnosticText(text) {
896
922
  if (text) {
897
- return "\"" + text.replace(/\"/g, "") + "\"";
923
+ return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
898
924
  }
899
- return "";
925
+ return strEmpty$1;
900
926
  }
901
927
  function _logToConsole(func, message) {
902
928
  var theConsole = getConsole();
@@ -918,12 +944,12 @@ var _InternalLogMessage = /** @class */ (function () {
918
944
  _self.message =
919
945
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
920
946
  msgId;
921
- var strProps = "";
947
+ var strProps = strEmpty$1;
922
948
  if (hasJSON()) {
923
949
  strProps = getJSON().stringify(properties);
924
950
  }
925
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
926
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
951
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
952
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
927
953
  _self.message += diagnosticText;
928
954
  }
929
955
  _InternalLogMessage.dataType = "MessageData";
@@ -953,7 +979,7 @@ var DiagnosticLogger = /** @class */ (function () {
953
979
  throw message;
954
980
  }
955
981
  else {
956
- var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
982
+ var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
957
983
  if (!isUndefined(message.message)) {
958
984
  var logLevel = _self.consoleLoggingLevel();
959
985
  if (isUserAct) {
@@ -971,7 +997,7 @@ var DiagnosticLogger = /** @class */ (function () {
971
997
  _self.logInternalMessage(severity, message);
972
998
  }
973
999
  else {
974
- _debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
1000
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
975
1001
  }
976
1002
  }
977
1003
  };
@@ -1003,13 +1029,13 @@ var DiagnosticLogger = /** @class */ (function () {
1003
1029
  if (severity <= _self.telemetryLoggingLevel()) {
1004
1030
  _self.queue.push(message);
1005
1031
  _messageCount++;
1006
- _debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
1032
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
1007
1033
  }
1008
1034
  if (_messageCount === _self.maxInternalMessageLimit()) {
1009
1035
  var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
1010
- var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
1036
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
1011
1037
  _self.queue.push(throttleMessage);
1012
- if (severity === LoggingSeverity.CRITICAL) {
1038
+ if (severity === 1 ) {
1013
1039
  _self.errorToConsole(throttleLimitMessage);
1014
1040
  }
1015
1041
  else {
@@ -1038,6 +1064,10 @@ var DiagnosticLogger = /** @class */ (function () {
1038
1064
  }
1039
1065
  return DiagnosticLogger;
1040
1066
  }());
1067
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1068
+ if (isUserAct === void 0) { isUserAct = false; }
1069
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
1070
+ }
1041
1071
 
1042
1072
  var strExecutionContextKey = "ctx";
1043
1073
  var PerfEvent = /** @class */ (function () {
@@ -1151,252 +1181,509 @@ function doPerf(mgrSource, getSource, func, details, isAsync) {
1151
1181
  return func();
1152
1182
  }
1153
1183
 
1154
- var TelemetryPluginChain = /** @class */ (function () {
1155
- function TelemetryPluginChain(plugin, defItemCtx) {
1156
- var _self = this;
1157
- var _nextProxy = null;
1158
- var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
1159
- var _hasSetNext = isFunction(plugin.setNextPlugin);
1160
- _self._hasRun = false;
1161
- _self.getPlugin = function () {
1162
- return plugin;
1163
- };
1164
- _self.getNext = function () {
1165
- return _nextProxy;
1166
- };
1167
- _self.setNext = function (nextPlugin) {
1168
- _nextProxy = nextPlugin;
1169
- };
1170
- _self.processTelemetry = function (env, itemCtx) {
1171
- if (!itemCtx) {
1172
- itemCtx = defItemCtx;
1184
+ var UInt32Mask = 0x100000000;
1185
+ var MaxUInt32 = 0xffffffff;
1186
+ var _mwcSeeded = false;
1187
+ var _mwcW = 123456789;
1188
+ var _mwcZ = 987654321;
1189
+ function _mwcSeed(seedValue) {
1190
+ if (seedValue < 0) {
1191
+ seedValue >>>= 0;
1192
+ }
1193
+ _mwcW = (123456789 + seedValue) & MaxUInt32;
1194
+ _mwcZ = (987654321 - seedValue) & MaxUInt32;
1195
+ _mwcSeeded = true;
1196
+ }
1197
+ function _autoSeedMwc() {
1198
+ try {
1199
+ var now = dateNow() & 0x7fffffff;
1200
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1201
+ }
1202
+ catch (e) {
1203
+ }
1204
+ }
1205
+ function randomValue(maxValue) {
1206
+ if (maxValue > 0) {
1207
+ return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
1208
+ }
1209
+ return 0;
1210
+ }
1211
+ function random32(signed) {
1212
+ var value = 0;
1213
+ var c = getCrypto() || getMsCrypto();
1214
+ if (c && c.getRandomValues) {
1215
+ value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1216
+ }
1217
+ if (value === 0 && isIE()) {
1218
+ if (!_mwcSeeded) {
1219
+ _autoSeedMwc();
1220
+ }
1221
+ value = mwcRandom32() & MaxUInt32;
1222
+ }
1223
+ if (value === 0) {
1224
+ value = Math.floor((UInt32Mask * Math.random()) | 0);
1225
+ }
1226
+ if (!signed) {
1227
+ value >>>= 0;
1228
+ }
1229
+ return value;
1230
+ }
1231
+ function mwcRandomSeed(value) {
1232
+ if (!value) {
1233
+ _autoSeedMwc();
1234
+ }
1235
+ else {
1236
+ _mwcSeed(value);
1237
+ }
1238
+ }
1239
+ function mwcRandom32(signed) {
1240
+ _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1241
+ _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1242
+ var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1243
+ if (!signed) {
1244
+ value >>>= 0;
1245
+ }
1246
+ return value;
1247
+ }
1248
+ function newId(maxLength) {
1249
+ if (maxLength === void 0) { maxLength = 22; }
1250
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1251
+ var number = random32() >>> 0;
1252
+ var chars = 0;
1253
+ var result = strEmpty$1;
1254
+ while (result.length < maxLength) {
1255
+ chars++;
1256
+ result += base64chars.charAt(number & 0x3F);
1257
+ number >>>= 6;
1258
+ if (chars === 5) {
1259
+ number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1260
+ chars = 0;
1261
+ }
1262
+ }
1263
+ return result;
1264
+ }
1265
+
1266
+ var _objDefineProperty = ObjDefineProperty;
1267
+ var version = "2.7.5-nightly.2203-03";
1268
+ var instanceName = "." + newId(6);
1269
+ var _dataUid = 0;
1270
+ function _createAccessor(target, prop, value) {
1271
+ if (_objDefineProperty) {
1272
+ try {
1273
+ _objDefineProperty(target, prop, {
1274
+ value: value,
1275
+ enumerable: false,
1276
+ configurable: true
1277
+ });
1278
+ return true;
1279
+ }
1280
+ catch (e) {
1281
+ }
1282
+ }
1283
+ return false;
1284
+ }
1285
+ function _canAcceptData(target) {
1286
+ return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
1287
+ }
1288
+ function _getCache(data, target) {
1289
+ var theCache = target[data.id];
1290
+ if (!theCache) {
1291
+ theCache = {};
1292
+ try {
1293
+ if (_canAcceptData(target)) {
1294
+ if (!_createAccessor(target, data.id, theCache)) {
1295
+ target[data.id] = theCache;
1296
+ }
1173
1297
  }
1174
- var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
1175
- doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
1176
- if (plugin && _hasProcessTelemetry) {
1177
- _self._hasRun = true;
1298
+ }
1299
+ catch (e) {
1300
+ }
1301
+ }
1302
+ return theCache;
1303
+ }
1304
+ function createUniqueNamespace(name, includeVersion) {
1305
+ if (includeVersion === void 0) { includeVersion = false; }
1306
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
1307
+ }
1308
+ function createElmNodeData(name) {
1309
+ var data = {
1310
+ id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
1311
+ accept: function (target) {
1312
+ return _canAcceptData(target);
1313
+ },
1314
+ get: function (target, name, defValue, addDefault) {
1315
+ var theCache = target[data.id];
1316
+ if (!theCache) {
1317
+ if (addDefault) {
1318
+ theCache = _getCache(data, target);
1319
+ theCache[normalizeJsName(name)] = defValue;
1320
+ }
1321
+ return defValue;
1322
+ }
1323
+ return theCache[normalizeJsName(name)];
1324
+ },
1325
+ kill: function (target, name) {
1326
+ if (target && target[name]) {
1327
+ try {
1328
+ delete target[name];
1329
+ }
1330
+ catch (e) {
1331
+ }
1332
+ }
1333
+ }
1334
+ };
1335
+ return data;
1336
+ }
1337
+
1338
+ var pluginStateData = createElmNodeData("plugin");
1339
+ function _getPluginState(plugin) {
1340
+ return pluginStateData.get(plugin, "state", {}, true);
1341
+ }
1342
+
1343
+ var strTelemetryPluginChain = "TelemetryPluginChain";
1344
+ var strHasRunFlags = "_hasRun";
1345
+ var strGetTelCtx = "_getTelCtx";
1346
+ var _chainId = 0;
1347
+ function _getNextProxyStart(proxy, config, core, startAt) {
1348
+ while (proxy) {
1349
+ if (proxy.getPlugin() === startAt) {
1350
+ return proxy;
1351
+ }
1352
+ proxy = proxy.getNext();
1353
+ }
1354
+ return createTelemetryProxyChain([startAt], config, core);
1355
+ }
1356
+ function _createInternalContext(telemetryChain, config, core, startAt) {
1357
+ var _nextProxy = null;
1358
+ var _onComplete = [];
1359
+ if (startAt !== null) {
1360
+ _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1361
+ }
1362
+ var context = {
1363
+ _next: _moveNext,
1364
+ ctx: {
1365
+ core: function () {
1366
+ return core;
1367
+ },
1368
+ diagLog: function () {
1369
+ return safeGetLogger(core, config);
1370
+ },
1371
+ getCfg: function () {
1372
+ return config;
1373
+ },
1374
+ getExtCfg: _getExtCfg,
1375
+ getConfig: _getConfig,
1376
+ hasNext: function () {
1377
+ return !!_nextProxy;
1378
+ },
1379
+ getNext: function () {
1380
+ return _nextProxy;
1381
+ },
1382
+ setNext: function (nextPlugin) {
1383
+ _nextProxy = nextPlugin;
1384
+ },
1385
+ iterate: _iterateChain,
1386
+ onComplete: _addOnComplete
1387
+ }
1388
+ };
1389
+ function _addOnComplete(onComplete, that) {
1390
+ var args = [];
1391
+ for (var _i = 2; _i < arguments.length; _i++) {
1392
+ args[_i - 2] = arguments[_i];
1393
+ }
1394
+ if (onComplete) {
1395
+ _onComplete.push({
1396
+ func: onComplete,
1397
+ self: !isUndefined(that) ? that : context.ctx,
1398
+ args: args
1399
+ });
1400
+ }
1401
+ }
1402
+ function _moveNext() {
1403
+ var nextProxy = _nextProxy;
1404
+ _nextProxy = nextProxy ? nextProxy.getNext() : null;
1405
+ if (!nextProxy) {
1406
+ var onComplete = _onComplete;
1407
+ if (onComplete && onComplete.length > 0) {
1408
+ arrForEach(onComplete, function (completeDetails) {
1178
1409
  try {
1179
- itemCtx.setNext(_nextProxy);
1180
- if (_hasSetNext) {
1181
- plugin.setNextPlugin(_nextProxy);
1182
- }
1183
- _nextProxy && (_nextProxy._hasRun = false);
1184
- plugin.processTelemetry(env, itemCtx);
1410
+ completeDetails.func.call(completeDetails.self, completeDetails.args);
1185
1411
  }
1186
- catch (error) {
1187
- var hasRun = _nextProxy && _nextProxy._hasRun;
1188
- if (!_nextProxy || !hasRun) {
1189
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
1190
- }
1191
- if (_nextProxy && !hasRun) {
1192
- _nextProxy.processTelemetry(env, itemCtx);
1193
- }
1412
+ catch (e) {
1413
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1194
1414
  }
1195
- }
1196
- else if (_nextProxy) {
1197
- _self._hasRun = true;
1198
- _nextProxy.processTelemetry(env, itemCtx);
1199
- }
1200
- }, function () { return ({ item: env }); }, !(env.sync));
1201
- };
1415
+ });
1416
+ _onComplete = [];
1417
+ }
1418
+ }
1419
+ return nextProxy;
1202
1420
  }
1203
- return TelemetryPluginChain;
1204
- }());
1205
-
1206
- function _createProxyChain(plugins, itemCtx) {
1207
- var proxies = [];
1208
- if (plugins && plugins.length > 0) {
1209
- var lastProxy = null;
1210
- for (var idx = 0; idx < plugins.length; idx++) {
1211
- var thePlugin = plugins[idx];
1212
- if (thePlugin && isFunction(thePlugin.processTelemetry)) {
1213
- var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
1214
- proxies.push(newProxy);
1215
- if (lastProxy) {
1216
- lastProxy.setNext(newProxy);
1421
+ function _getExtCfg(identifier, defaultValue, mergeDefault) {
1422
+ if (defaultValue === void 0) { defaultValue = {}; }
1423
+ if (mergeDefault === void 0) { mergeDefault = 0 ; }
1424
+ var theConfig;
1425
+ if (config) {
1426
+ var extConfig = config.extensionConfig;
1427
+ if (extConfig && identifier) {
1428
+ theConfig = extConfig[identifier];
1429
+ }
1430
+ }
1431
+ if (!theConfig) {
1432
+ theConfig = defaultValue;
1433
+ }
1434
+ else if (isObject(defaultValue)) {
1435
+ if (mergeDefault !== 0 ) {
1436
+ var newConfig_1 = objExtend(true, defaultValue, theConfig);
1437
+ if (config && mergeDefault === 2 ) {
1438
+ objForEachKey(defaultValue, function (field) {
1439
+ if (isNullOrUndefined(newConfig_1[field])) {
1440
+ var cfgValue = config[field];
1441
+ if (!isNullOrUndefined(cfgValue)) {
1442
+ newConfig_1[field] = cfgValue;
1443
+ }
1444
+ }
1445
+ });
1217
1446
  }
1218
- lastProxy = newProxy;
1219
1447
  }
1220
1448
  }
1449
+ return theConfig;
1221
1450
  }
1222
- return proxies.length > 0 ? proxies[0] : null;
1223
- }
1224
- function _copyProxyChain(proxy, itemCtx, startAt) {
1225
- var plugins = [];
1226
- var add = startAt ? false : true;
1227
- if (proxy) {
1228
- while (proxy) {
1229
- var thePlugin = proxy.getPlugin();
1230
- if (add || thePlugin === startAt) {
1231
- add = true;
1232
- plugins.push(thePlugin);
1451
+ function _getConfig(identifier, field, defaultValue) {
1452
+ if (defaultValue === void 0) { defaultValue = false; }
1453
+ var theValue;
1454
+ var extConfig = _getExtCfg(identifier, null);
1455
+ if (extConfig && !isNullOrUndefined(extConfig[field])) {
1456
+ theValue = extConfig[field];
1457
+ }
1458
+ else if (config && !isNullOrUndefined(config[field])) {
1459
+ theValue = config[field];
1460
+ }
1461
+ return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1462
+ }
1463
+ function _iterateChain(cb) {
1464
+ var nextPlugin;
1465
+ while (!!(nextPlugin = context._next())) {
1466
+ var plugin = nextPlugin.getPlugin();
1467
+ if (plugin) {
1468
+ cb(plugin);
1233
1469
  }
1234
- proxy = proxy.getNext();
1235
1470
  }
1236
1471
  }
1237
- if (!add) {
1238
- plugins.push(startAt);
1472
+ return context;
1473
+ }
1474
+ function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
1475
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1476
+ var context = internalContext.ctx;
1477
+ function _processNext(env) {
1478
+ var nextPlugin = internalContext._next();
1479
+ nextPlugin && nextPlugin.processTelemetry(env, context);
1480
+ return !nextPlugin;
1481
+ }
1482
+ function _createNew(plugins, startAt) {
1483
+ if (plugins === void 0) { plugins = null; }
1484
+ if (isArray(plugins)) {
1485
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1486
+ }
1487
+ return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
1239
1488
  }
1240
- return _createProxyChain(plugins, itemCtx);
1489
+ context.processNext = _processNext;
1490
+ context.createNew = _createNew;
1491
+ return context;
1241
1492
  }
1242
- function _copyPluginChain(srcPlugins, itemCtx, startAt) {
1243
- var plugins = srcPlugins;
1244
- var add = false;
1245
- if (startAt && srcPlugins) {
1246
- plugins = [];
1247
- arrForEach(srcPlugins, function (thePlugin) {
1248
- if (add || thePlugin === startAt) {
1249
- add = true;
1250
- plugins.push(thePlugin);
1493
+ function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
1494
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1495
+ var context = internalContext.ctx;
1496
+ function _processNext(unloadState) {
1497
+ var nextPlugin = internalContext._next();
1498
+ nextPlugin && nextPlugin.unload(context, unloadState);
1499
+ return !nextPlugin;
1500
+ }
1501
+ function _createNew(plugins, startAt) {
1502
+ if (plugins === void 0) { plugins = null; }
1503
+ if (isArray(plugins)) {
1504
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1505
+ }
1506
+ return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
1507
+ }
1508
+ context.processNext = _processNext;
1509
+ context.createNew = _createNew;
1510
+ return context;
1511
+ }
1512
+ function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1513
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1514
+ var context = internalContext.ctx;
1515
+ function _processNext(updateState) {
1516
+ return context.iterate(function (plugin) {
1517
+ if (isFunction(plugin[strUpdate])) {
1518
+ plugin[strUpdate](context, updateState);
1251
1519
  }
1252
1520
  });
1253
1521
  }
1254
- if (startAt && !add) {
1255
- if (!plugins) {
1256
- plugins = [];
1522
+ function _createNew(plugins, startAt) {
1523
+ if (plugins === void 0) { plugins = null; }
1524
+ if (isArray(plugins)) {
1525
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1257
1526
  }
1258
- plugins.push(startAt);
1527
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1259
1528
  }
1260
- return _createProxyChain(plugins, itemCtx);
1529
+ context.processNext = _processNext;
1530
+ context.createNew = _createNew;
1531
+ return context;
1261
1532
  }
1262
- var ProcessTelemetryContext = /** @class */ (function () {
1263
- function ProcessTelemetryContext(plugins, config, core, startAt) {
1264
- var _self = this;
1265
- var _nextProxy = null;
1266
- if (startAt !== null) {
1267
- if (plugins && isFunction(plugins.getPlugin)) {
1268
- _nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
1533
+ function createTelemetryProxyChain(plugins, config, core, startAt) {
1534
+ var firstProxy = null;
1535
+ var add = startAt ? false : true;
1536
+ if (isArray(plugins) && plugins.length > 0) {
1537
+ var lastProxy_1 = null;
1538
+ arrForEach(plugins, function (thePlugin) {
1539
+ if (!add && startAt === thePlugin) {
1540
+ add = true;
1269
1541
  }
1270
- else {
1271
- if (startAt) {
1272
- _nextProxy = _copyPluginChain(plugins, _self, startAt);
1542
+ if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
1543
+ var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
1544
+ if (!firstProxy) {
1545
+ firstProxy = newProxy;
1273
1546
  }
1274
- else if (isUndefined(startAt)) {
1275
- _nextProxy = _createProxyChain(plugins, _self);
1547
+ if (lastProxy_1) {
1548
+ lastProxy_1._setNext(newProxy);
1276
1549
  }
1550
+ lastProxy_1 = newProxy;
1277
1551
  }
1552
+ });
1553
+ }
1554
+ if (startAt && !firstProxy) {
1555
+ return createTelemetryProxyChain([startAt], config, core);
1556
+ }
1557
+ return firstProxy;
1558
+ }
1559
+ function createTelemetryPluginProxy(plugin, config, core) {
1560
+ var nextProxy = null;
1561
+ var hasProcessTelemetry = isFunction(plugin.processTelemetry);
1562
+ var hasSetNext = isFunction(plugin.setNextPlugin);
1563
+ var chainId;
1564
+ if (plugin) {
1565
+ chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
1566
+ }
1567
+ else {
1568
+ chainId = "Unknown-0-" + _chainId++;
1569
+ }
1570
+ var proxyChain = {
1571
+ getPlugin: function () {
1572
+ return plugin;
1573
+ },
1574
+ getNext: function () {
1575
+ return nextProxy;
1576
+ },
1577
+ processTelemetry: _processTelemetry,
1578
+ unload: _unloadPlugin,
1579
+ update: _updatePlugin,
1580
+ _id: chainId,
1581
+ _setNext: function (nextPlugin) {
1582
+ nextProxy = nextPlugin;
1278
1583
  }
1279
- _self.core = function () {
1280
- return core;
1281
- };
1282
- _self.diagLog = function () {
1283
- return safeGetLogger(core, config);
1284
- };
1285
- _self.getCfg = function () {
1286
- return config;
1287
- };
1288
- _self.getExtCfg = function (identifier, defaultValue) {
1289
- if (defaultValue === void 0) { defaultValue = {}; }
1290
- var theConfig;
1291
- if (config) {
1292
- var extConfig = config.extensionConfig;
1293
- if (extConfig && identifier) {
1294
- theConfig = extConfig[identifier];
1584
+ };
1585
+ function _getTelCtx() {
1586
+ var itemCtx;
1587
+ if (plugin && isFunction(plugin[strGetTelCtx])) {
1588
+ itemCtx = plugin[strGetTelCtx]();
1589
+ }
1590
+ if (!itemCtx) {
1591
+ itemCtx = createProcessTelemetryContext(proxyChain, config, core);
1592
+ }
1593
+ return itemCtx;
1594
+ }
1595
+ function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
1596
+ var hasRun = false;
1597
+ var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
1598
+ var hasRunContext = itemCtx[strHasRunFlags];
1599
+ if (!hasRunContext) {
1600
+ hasRunContext = itemCtx[strHasRunFlags] = {};
1601
+ }
1602
+ itemCtx.setNext(nextProxy);
1603
+ if (plugin) {
1604
+ doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
1605
+ hasRunContext[chainId] = true;
1606
+ try {
1607
+ var nextId = nextProxy ? nextProxy._id : strEmpty$1;
1608
+ if (nextId) {
1609
+ hasRunContext[nextId] = false;
1610
+ }
1611
+ hasRun = processPluginFn(itemCtx);
1295
1612
  }
1613
+ catch (error) {
1614
+ var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
1615
+ if (hasNextRun) {
1616
+ hasRun = true;
1617
+ }
1618
+ if (!nextProxy || !hasNextRun) {
1619
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1620
+ }
1621
+ }
1622
+ }, details, isAsync);
1623
+ }
1624
+ return hasRun;
1625
+ }
1626
+ function _processTelemetry(env, itemCtx) {
1627
+ itemCtx = itemCtx || _getTelCtx();
1628
+ function _callProcessTelemetry(itemCtx) {
1629
+ if (!plugin || !hasProcessTelemetry) {
1630
+ return false;
1296
1631
  }
1297
- return (theConfig ? theConfig : defaultValue);
1298
- };
1299
- _self.getConfig = function (identifier, field, defaultValue) {
1300
- if (defaultValue === void 0) { defaultValue = false; }
1301
- var theValue;
1302
- var extConfig = _self.getExtCfg(identifier, null);
1303
- if (extConfig && !isNullOrUndefined(extConfig[field])) {
1304
- theValue = extConfig[field];
1632
+ var pluginState = _getPluginState(plugin);
1633
+ if (pluginState[strTeardown] || pluginState[strDisabled]) {
1634
+ return false;
1305
1635
  }
1306
- else if (config && !isNullOrUndefined(config[field])) {
1307
- theValue = config[field];
1636
+ if (hasSetNext) {
1637
+ plugin.setNextPlugin(nextProxy);
1308
1638
  }
1309
- return !isNullOrUndefined(theValue) ? theValue : defaultValue;
1310
- };
1311
- _self.hasNext = function () {
1312
- return _nextProxy != null;
1313
- };
1314
- _self.getNext = function () {
1315
- return _nextProxy;
1316
- };
1317
- _self.setNext = function (nextPlugin) {
1318
- _nextProxy = nextPlugin;
1319
- };
1320
- _self.processNext = function (env) {
1321
- var nextPlugin = _nextProxy;
1322
- if (nextPlugin) {
1323
- _nextProxy = nextPlugin.getNext();
1324
- nextPlugin.processTelemetry(env, _self);
1639
+ plugin.processTelemetry(env, itemCtx);
1640
+ return true;
1641
+ }
1642
+ if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
1643
+ itemCtx.processNext(env);
1644
+ }
1645
+ }
1646
+ function _unloadPlugin(unloadCtx, unloadState) {
1647
+ function _callTeardown() {
1648
+ var hasRun = false;
1649
+ if (plugin) {
1650
+ var pluginState = _getPluginState(plugin);
1651
+ var pluginCore = plugin[strCore] || pluginState.core;
1652
+ if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
1653
+ pluginState[strCore] = null;
1654
+ pluginState[strTeardown] = true;
1655
+ pluginState[strIsInitialized] = false;
1656
+ if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
1657
+ hasRun = true;
1658
+ }
1659
+ }
1325
1660
  }
1326
- };
1327
- _self.createNew = function (plugins, startAt) {
1328
- if (plugins === void 0) { plugins = null; }
1329
- return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
1330
- };
1661
+ return hasRun;
1662
+ }
1663
+ if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
1664
+ unloadCtx.processNext(unloadState);
1665
+ }
1331
1666
  }
1332
- return ProcessTelemetryContext;
1333
- }());
1334
-
1335
- var strExtensionConfig = "extensionConfig";
1336
-
1337
- var strGetPlugin = "getPlugin";
1338
- var BaseTelemetryPlugin = /** @class */ (function () {
1339
- function BaseTelemetryPlugin() {
1340
- var _self = this;
1341
- var _isinitialized = false;
1342
- var _rootCtx = null;
1343
- var _nextPlugin = null;
1344
- _self.core = null;
1345
- _self.diagLog = function (itemCtx) {
1346
- return _self._getTelCtx(itemCtx).diagLog();
1347
- };
1348
- _self.isInitialized = function () {
1349
- return _isinitialized;
1350
- };
1351
- _self.setInitialized = function (isInitialized) {
1352
- _isinitialized = isInitialized;
1353
- };
1354
- _self.setNextPlugin = function (next) {
1355
- _nextPlugin = next;
1356
- };
1357
- _self.processNext = function (env, itemCtx) {
1358
- if (itemCtx) {
1359
- itemCtx.processNext(env);
1360
- }
1361
- else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
1362
- _nextPlugin.processTelemetry(env, null);
1363
- }
1364
- };
1365
- _self._getTelCtx = function (currentCtx) {
1366
- if (currentCtx === void 0) { currentCtx = null; }
1367
- var itemCtx = currentCtx;
1368
- if (!itemCtx) {
1369
- var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
1370
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1371
- itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
1372
- }
1373
- else {
1374
- itemCtx = rootCtx.createNew(null, _nextPlugin);
1667
+ function _updatePlugin(updateCtx, updateState) {
1668
+ function _callUpdate() {
1669
+ var hasRun = false;
1670
+ if (plugin) {
1671
+ var pluginState = _getPluginState(plugin);
1672
+ var pluginCore = plugin[strCore] || pluginState.core;
1673
+ if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1674
+ if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1675
+ hasRun = true;
1676
+ }
1375
1677
  }
1376
1678
  }
1377
- return itemCtx;
1378
- };
1379
- _self._baseTelInit = function (config, core, extensions, pluginChain) {
1380
- if (config) {
1381
- setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
1382
- }
1383
- if (!pluginChain && core) {
1384
- pluginChain = core.getProcessTelContext().getNext();
1385
- }
1386
- var nextPlugin = _nextPlugin;
1387
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
1388
- nextPlugin = _nextPlugin[strGetPlugin]();
1389
- }
1390
- _self.core = core;
1391
- _rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
1392
- _isinitialized = true;
1393
- };
1679
+ return hasRun;
1680
+ }
1681
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1682
+ updateCtx.processNext(updateState);
1683
+ }
1394
1684
  }
1395
- BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
1396
- this._baseTelInit(config, core, extensions, pluginChain);
1397
- };
1398
- return BaseTelemetryPlugin;
1399
- }());
1685
+ return objFreeze(proxyChain);
1686
+ }
1400
1687
 
1401
1688
  var strToGMTString = "toGMTString";
1402
1689
  var strToUTCString = "toUTCString";
@@ -1406,7 +1693,6 @@ var strEnabled = "enabled";
1406
1693
  var strIsCookieUseDisabled = "isCookieUseDisabled";
1407
1694
  var strDisableCookiesUsage = "disableCookiesUsage";
1408
1695
  var strConfigCookieMgr = "_ckMgr";
1409
- var strEmpty = "";
1410
1696
  var _supportsCookies = null;
1411
1697
  var _allowUaSameSite = null;
1412
1698
  var _parsedCookieValue = null;
@@ -1464,7 +1750,7 @@ function createCookieMgr(rootConfig, logger) {
1464
1750
  var result = false;
1465
1751
  if (_isMgrEnabled(cookieMgr)) {
1466
1752
  var values = {};
1467
- var theValue = strTrim(value || strEmpty);
1753
+ var theValue = strTrim(value || strEmpty$1);
1468
1754
  var idx = theValue.indexOf(";");
1469
1755
  if (idx !== -1) {
1470
1756
  theValue = strTrim(value.substring(0, idx));
@@ -1479,11 +1765,11 @@ function createCookieMgr(rootConfig, logger) {
1479
1765
  if (expireMs > 0) {
1480
1766
  var expiry = new Date();
1481
1767
  expiry.setTime(expireMs);
1482
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty, isTruthy);
1768
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || strEmpty$1, isTruthy);
1483
1769
  }
1484
1770
  }
1485
1771
  if (!_isIE) {
1486
- setValue(values, "max-age", strEmpty + maxAgeSec, null, isUndefined);
1772
+ setValue(values, "max-age", strEmpty$1 + maxAgeSec, null, isUndefined);
1487
1773
  }
1488
1774
  }
1489
1775
  var location_1 = getLocation();
@@ -1504,7 +1790,7 @@ function createCookieMgr(rootConfig, logger) {
1504
1790
  return result;
1505
1791
  },
1506
1792
  get: function (name) {
1507
- var value = strEmpty;
1793
+ var value = strEmpty$1;
1508
1794
  if (_isMgrEnabled(cookieMgr)) {
1509
1795
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1510
1796
  }
@@ -1529,7 +1815,7 @@ function createCookieMgr(rootConfig, logger) {
1529
1815
  values["max-age"] = "0";
1530
1816
  }
1531
1817
  var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1532
- delCookie(name, _formatCookieValue(strEmpty, values));
1818
+ delCookie(name, _formatCookieValue(strEmpty$1, values));
1533
1819
  result = true;
1534
1820
  }
1535
1821
  return result;
@@ -1546,7 +1832,7 @@ function areCookiesSupported(logger) {
1546
1832
  _supportsCookies = doc[strCookie] !== undefined;
1547
1833
  }
1548
1834
  catch (e) {
1549
- logger && logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1835
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1550
1836
  }
1551
1837
  }
1552
1838
  return _supportsCookies;
@@ -1556,7 +1842,7 @@ function _extractParts(theValue) {
1556
1842
  if (theValue && theValue.length) {
1557
1843
  var parts = strTrim(theValue).split(";");
1558
1844
  arrForEach(parts, function (thePart) {
1559
- thePart = strTrim(thePart || strEmpty);
1845
+ thePart = strTrim(thePart || strEmpty$1);
1560
1846
  if (thePart) {
1561
1847
  var idx = thePart.indexOf("=");
1562
1848
  if (idx === -1) {
@@ -1577,21 +1863,21 @@ function _formatDate(theDate, func) {
1577
1863
  return null;
1578
1864
  }
1579
1865
  function _formatCookieValue(value, values) {
1580
- var cookieValue = value || strEmpty;
1866
+ var cookieValue = value || strEmpty$1;
1581
1867
  objForEachKey(values, function (name, theValue) {
1582
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty);
1868
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : strEmpty$1);
1583
1869
  });
1584
1870
  return cookieValue;
1585
1871
  }
1586
1872
  function _getCookieValue(name) {
1587
- var cookieValue = strEmpty;
1873
+ var cookieValue = strEmpty$1;
1588
1874
  if (_doc) {
1589
- var theCookie = _doc[strCookie] || strEmpty;
1875
+ var theCookie = _doc[strCookie] || strEmpty$1;
1590
1876
  if (_parsedCookieValue !== theCookie) {
1591
1877
  _cookieCache = _extractParts(theCookie);
1592
1878
  _parsedCookieValue = theCookie;
1593
1879
  }
1594
- cookieValue = strTrim(_cookieCache[name] || strEmpty);
1880
+ cookieValue = strTrim(_cookieCache[name] || strEmpty$1);
1595
1881
  }
1596
1882
  return cookieValue;
1597
1883
  }
@@ -1625,86 +1911,290 @@ function uaDisallowsSameSiteNone(userAgent) {
1625
1911
  return false;
1626
1912
  }
1627
1913
 
1628
- var UInt32Mask = 0x100000000;
1629
- var MaxUInt32 = 0xffffffff;
1630
- var _mwcSeeded = false;
1631
- var _mwcW = 123456789;
1632
- var _mwcZ = 987654321;
1633
- function _mwcSeed(seedValue) {
1634
- if (seedValue < 0) {
1635
- seedValue >>>= 0;
1914
+ var strExtensionConfig = "extensionConfig";
1915
+
1916
+ function createUnloadHandlerContainer() {
1917
+ var handlers = [];
1918
+ function _addHandler(handler) {
1919
+ if (handler) {
1920
+ handlers.push(handler);
1921
+ }
1636
1922
  }
1637
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1638
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1639
- _mwcSeeded = true;
1923
+ function _runHandlers(unloadCtx, unloadState) {
1924
+ arrForEach(handlers, function (handler) {
1925
+ try {
1926
+ handler(unloadCtx, unloadState);
1927
+ }
1928
+ catch (e) {
1929
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1930
+ }
1931
+ });
1932
+ handlers = [];
1933
+ }
1934
+ return {
1935
+ add: _addHandler,
1936
+ run: _runHandlers
1937
+ };
1640
1938
  }
1641
- function _autoSeedMwc() {
1642
- try {
1643
- var now = dateNow() & 0x7fffffff;
1644
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
1939
+
1940
+ var strGetPlugin = "getPlugin";
1941
+ var BaseTelemetryPlugin = /** @class */ (function () {
1942
+ function BaseTelemetryPlugin() {
1943
+ var _self = this;
1944
+ var _isinitialized;
1945
+ var _rootCtx;
1946
+ var _nextPlugin;
1947
+ var _unloadHandlerContainer;
1948
+ var _hooks;
1949
+ _initDefaults();
1950
+ dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
1951
+ _self.initialize = function (config, core, extensions, pluginChain) {
1952
+ _setDefaults(config, core, pluginChain);
1953
+ _isinitialized = true;
1954
+ };
1955
+ _self.teardown = function (unloadCtx, unloadState) {
1956
+ if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
1957
+ return;
1958
+ }
1959
+ var result;
1960
+ var unloadDone = false;
1961
+ var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1962
+ var theUnloadState = unloadState || {
1963
+ reason: 0 ,
1964
+ isAsync: false
1965
+ };
1966
+ function _unloadCallback() {
1967
+ if (!unloadDone) {
1968
+ unloadDone = true;
1969
+ _unloadHandlerContainer.run(theUnloadCtx, unloadState);
1970
+ arrForEach(_hooks, function (fn) {
1971
+ fn.rm();
1972
+ });
1973
+ _hooks = [];
1974
+ if (result === true) {
1975
+ theUnloadCtx.processNext(theUnloadState);
1976
+ }
1977
+ _initDefaults();
1978
+ }
1979
+ }
1980
+ if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
1981
+ _unloadCallback();
1982
+ }
1983
+ else {
1984
+ result = true;
1985
+ }
1986
+ return result;
1987
+ };
1988
+ _self.update = function (updateCtx, updateState) {
1989
+ if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
1990
+ return;
1991
+ }
1992
+ var result;
1993
+ var updateDone = false;
1994
+ var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1995
+ var theUpdateState = updateState || {
1996
+ reason: 0
1997
+ };
1998
+ function _updateCallback() {
1999
+ if (!updateDone) {
2000
+ updateDone = true;
2001
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
2002
+ }
2003
+ }
2004
+ if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
2005
+ _updateCallback();
2006
+ }
2007
+ else {
2008
+ result = true;
2009
+ }
2010
+ return result;
2011
+ };
2012
+ _self._addHook = function (hooks) {
2013
+ if (hooks) {
2014
+ if (isArray(hooks)) {
2015
+ _hooks = _hooks.concat(hooks);
2016
+ }
2017
+ else {
2018
+ _hooks.push(hooks);
2019
+ }
2020
+ }
2021
+ };
2022
+ proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
2023
+ });
2024
+ _self.diagLog = function (itemCtx) {
2025
+ return _getTelCtx(itemCtx).diagLog();
2026
+ };
2027
+ _self[strIsInitialized] = function () {
2028
+ return _isinitialized;
2029
+ };
2030
+ _self.setInitialized = function (isInitialized) {
2031
+ _isinitialized = isInitialized;
2032
+ };
2033
+ _self[strSetNextPlugin] = function (next) {
2034
+ _nextPlugin = next;
2035
+ };
2036
+ _self.processNext = function (env, itemCtx) {
2037
+ if (itemCtx) {
2038
+ itemCtx.processNext(env);
2039
+ }
2040
+ else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
2041
+ _nextPlugin.processTelemetry(env, null);
2042
+ }
2043
+ };
2044
+ _self._getTelCtx = _getTelCtx;
2045
+ function _getTelCtx(currentCtx) {
2046
+ if (currentCtx === void 0) { currentCtx = null; }
2047
+ var itemCtx = currentCtx;
2048
+ if (!itemCtx) {
2049
+ var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
2050
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
2051
+ itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
2052
+ }
2053
+ else {
2054
+ itemCtx = rootCtx.createNew(null, _nextPlugin);
2055
+ }
2056
+ }
2057
+ return itemCtx;
2058
+ }
2059
+ function _setDefaults(config, core, pluginChain) {
2060
+ if (config) {
2061
+ setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
2062
+ }
2063
+ if (!pluginChain && core) {
2064
+ pluginChain = core.getProcessTelContext().getNext();
2065
+ }
2066
+ var nextPlugin = _nextPlugin;
2067
+ if (_nextPlugin && _nextPlugin[strGetPlugin]) {
2068
+ nextPlugin = _nextPlugin[strGetPlugin]();
2069
+ }
2070
+ _self.core = core;
2071
+ _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
2072
+ }
2073
+ function _initDefaults() {
2074
+ _isinitialized = false;
2075
+ _self.core = null;
2076
+ _rootCtx = null;
2077
+ _nextPlugin = null;
2078
+ _hooks = [];
2079
+ _unloadHandlerContainer = createUnloadHandlerContainer();
2080
+ }
1645
2081
  }
1646
- catch (e) {
2082
+ return BaseTelemetryPlugin;
2083
+ }());
2084
+
2085
+ var strOnPrefix = "on";
2086
+ var strAttachEvent = "attachEvent";
2087
+ var strAddEventHelper = "addEventListener";
2088
+ var strEvents = "events";
2089
+ createUniqueNamespace("aiEvtPageHide");
2090
+ createUniqueNamespace("aiEvtPageShow");
2091
+ var rRemoveEmptyNs = /\.[\.]+/g;
2092
+ var rRemoveTrailingEmptyNs = /[\.]+$/;
2093
+ var _guid = 1;
2094
+ var elmNodeData = createElmNodeData("events");
2095
+ var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
2096
+ function _normalizeNamespace(name) {
2097
+ if (name && name.replace) {
2098
+ return name.replace(/^\s*\.*|\.*\s*$/g, "");
2099
+ }
2100
+ return name;
2101
+ }
2102
+ function _getEvtNamespace(eventName, evtNamespace) {
2103
+ if (evtNamespace) {
2104
+ var theNamespace_1 = "";
2105
+ if (isArray(evtNamespace)) {
2106
+ theNamespace_1 = "";
2107
+ arrForEach(evtNamespace, function (name) {
2108
+ name = _normalizeNamespace(name);
2109
+ if (name) {
2110
+ if (name[0] !== ".") {
2111
+ name = "." + name;
2112
+ }
2113
+ theNamespace_1 += name;
2114
+ }
2115
+ });
2116
+ }
2117
+ else {
2118
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
2119
+ }
2120
+ if (theNamespace_1) {
2121
+ if (theNamespace_1[0] !== ".") {
2122
+ theNamespace_1 = "." + theNamespace_1;
2123
+ }
2124
+ eventName = (eventName || "") + theNamespace_1;
2125
+ }
1647
2126
  }
2127
+ var parsedEvent = (eventNamespace.exec(eventName || "") || []);
2128
+ return {
2129
+ type: parsedEvent[1],
2130
+ ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
2131
+ };
1648
2132
  }
1649
- function randomValue(maxValue) {
1650
- if (maxValue > 0) {
1651
- return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
2133
+ function _getRegisteredEvents(target, evtName, addDefault) {
2134
+ if (addDefault === void 0) { addDefault = true; }
2135
+ var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
2136
+ var registeredEvents = aiEvts[evtName];
2137
+ if (!registeredEvents) {
2138
+ registeredEvents = aiEvts[evtName] = [];
1652
2139
  }
1653
- return 0;
2140
+ return registeredEvents;
1654
2141
  }
1655
- function random32(signed) {
1656
- var value;
1657
- var c = getCrypto() || getMsCrypto();
1658
- if (c && c.getRandomValues) {
1659
- value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
1660
- }
1661
- else if (isIE()) {
1662
- if (!_mwcSeeded) {
1663
- _autoSeedMwc();
2142
+ function _doAttach(obj, evtName, handlerRef, useCapture) {
2143
+ var result = false;
2144
+ if (obj && evtName && evtName.type && handlerRef) {
2145
+ if (obj[strAddEventHelper]) {
2146
+ obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
2147
+ result = true;
2148
+ }
2149
+ else if (obj[strAttachEvent]) {
2150
+ obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
2151
+ result = true;
1664
2152
  }
1665
- value = mwcRandom32() & MaxUInt32;
1666
- }
1667
- else {
1668
- value = Math.floor((UInt32Mask * Math.random()) | 0);
1669
- }
1670
- if (!signed) {
1671
- value >>>= 0;
1672
2153
  }
1673
- return value;
2154
+ return result;
1674
2155
  }
1675
- function mwcRandomSeed(value) {
1676
- if (!value) {
1677
- _autoSeedMwc();
1678
- }
1679
- else {
1680
- _mwcSeed(value);
2156
+ function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
2157
+ if (useCapture === void 0) { useCapture = false; }
2158
+ var result = false;
2159
+ if (target) {
2160
+ try {
2161
+ var evtName = _getEvtNamespace(eventName, evtNamespace);
2162
+ result = _doAttach(target, evtName, handlerRef, useCapture);
2163
+ if (result && elmNodeData.accept(target)) {
2164
+ var registeredEvent = {
2165
+ guid: _guid++,
2166
+ evtName: evtName,
2167
+ handler: handlerRef,
2168
+ capture: useCapture
2169
+ };
2170
+ _getRegisteredEvents(target, evtName.type).push(registeredEvent);
2171
+ }
2172
+ }
2173
+ catch (e) {
2174
+ }
1681
2175
  }
2176
+ return result;
1682
2177
  }
1683
- function mwcRandom32(signed) {
1684
- _mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
1685
- _mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
1686
- var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
1687
- if (!signed) {
1688
- value >>>= 0;
1689
- }
1690
- return value;
2178
+ function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
2179
+ if (useCapture === void 0) { useCapture = false; }
2180
+ return eventOn(obj, eventNameWithoutOn, handlerRef, null, useCapture);
1691
2181
  }
1692
-
1693
- var _cookieMgrs = null;
1694
- var _canUseCookies;
1695
- function addEventHandler(eventName, callback) {
2182
+ function addEventHandler(eventName, callback, evtNamespace) {
1696
2183
  var result = false;
1697
2184
  var w = getWindow();
1698
2185
  if (w) {
1699
- result = attachEvent(w, eventName, callback);
1700
- result = attachEvent(w["body"], eventName, callback) || result;
2186
+ result = eventOn(w, eventName, callback, evtNamespace);
2187
+ result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
1701
2188
  }
1702
2189
  var doc = getDocument();
1703
2190
  if (doc) {
1704
- result = attachEvent(doc, eventName, callback) || result;
2191
+ result = eventOn(doc, eventName, callback, evtNamespace) || result;
1705
2192
  }
1706
2193
  return result;
1707
2194
  }
2195
+
2196
+ var _cookieMgrs = null;
2197
+ var _canUseCookies;
1708
2198
  function newGuid() {
1709
2199
  function randomHexDigit() {
1710
2200
  return randomValue(15);
@@ -1721,26 +2211,9 @@ function perfNow() {
1721
2211
  }
1722
2212
  return dateNow();
1723
2213
  }
1724
- function newId(maxLength) {
1725
- if (maxLength === void 0) { maxLength = 22; }
1726
- var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1727
- var number = random32() >>> 0;
1728
- var chars = 0;
1729
- var result = "";
1730
- while (result.length < maxLength) {
1731
- chars++;
1732
- result += base64chars.charAt(number & 0x3F);
1733
- number >>>= 6;
1734
- if (chars === 5) {
1735
- number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
1736
- chars = 0;
1737
- }
1738
- }
1739
- return result;
1740
- }
1741
2214
  function generateW3CId() {
1742
2215
  var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1743
- var oct = "", tmp;
2216
+ var oct = strEmpty$1, tmp;
1744
2217
  for (var a = 0; a < 4; a++) {
1745
2218
  tmp = random32();
1746
2219
  oct +=
@@ -1835,6 +2308,95 @@ function deleteCookie(logger, name) {
1835
2308
  return _legacyCookieMgr(null, logger).del(name);
1836
2309
  }
1837
2310
 
2311
+ createEnumStyle({
2312
+ CRITICAL: 1 ,
2313
+ WARNING: 2
2314
+ });
2315
+ var _InternalMessageId = createEnumStyle({
2316
+ BrowserDoesNotSupportLocalStorage: 0 ,
2317
+ BrowserCannotReadLocalStorage: 1 ,
2318
+ BrowserCannotReadSessionStorage: 2 ,
2319
+ BrowserCannotWriteLocalStorage: 3 ,
2320
+ BrowserCannotWriteSessionStorage: 4 ,
2321
+ BrowserFailedRemovalFromLocalStorage: 5 ,
2322
+ BrowserFailedRemovalFromSessionStorage: 6 ,
2323
+ CannotSendEmptyTelemetry: 7 ,
2324
+ ClientPerformanceMathError: 8 ,
2325
+ ErrorParsingAISessionCookie: 9 ,
2326
+ ErrorPVCalc: 10 ,
2327
+ ExceptionWhileLoggingError: 11 ,
2328
+ FailedAddingTelemetryToBuffer: 12 ,
2329
+ FailedMonitorAjaxAbort: 13 ,
2330
+ FailedMonitorAjaxDur: 14 ,
2331
+ FailedMonitorAjaxOpen: 15 ,
2332
+ FailedMonitorAjaxRSC: 16 ,
2333
+ FailedMonitorAjaxSend: 17 ,
2334
+ FailedMonitorAjaxGetCorrelationHeader: 18 ,
2335
+ FailedToAddHandlerForOnBeforeUnload: 19 ,
2336
+ FailedToSendQueuedTelemetry: 20 ,
2337
+ FailedToReportDataLoss: 21 ,
2338
+ FlushFailed: 22 ,
2339
+ MessageLimitPerPVExceeded: 23 ,
2340
+ MissingRequiredFieldSpecification: 24 ,
2341
+ NavigationTimingNotSupported: 25 ,
2342
+ OnError: 26 ,
2343
+ SessionRenewalDateIsZero: 27 ,
2344
+ SenderNotInitialized: 28 ,
2345
+ StartTrackEventFailed: 29 ,
2346
+ StopTrackEventFailed: 30 ,
2347
+ StartTrackFailed: 31 ,
2348
+ StopTrackFailed: 32 ,
2349
+ TelemetrySampledAndNotSent: 33 ,
2350
+ TrackEventFailed: 34 ,
2351
+ TrackExceptionFailed: 35 ,
2352
+ TrackMetricFailed: 36 ,
2353
+ TrackPVFailed: 37 ,
2354
+ TrackPVFailedCalc: 38 ,
2355
+ TrackTraceFailed: 39 ,
2356
+ TransmissionFailed: 40 ,
2357
+ FailedToSetStorageBuffer: 41 ,
2358
+ FailedToRestoreStorageBuffer: 42 ,
2359
+ InvalidBackendResponse: 43 ,
2360
+ FailedToFixDepricatedValues: 44 ,
2361
+ InvalidDurationValue: 45 ,
2362
+ TelemetryEnvelopeInvalid: 46 ,
2363
+ CreateEnvelopeError: 47 ,
2364
+ CannotSerializeObject: 48 ,
2365
+ CannotSerializeObjectNonSerializable: 49 ,
2366
+ CircularReferenceDetected: 50 ,
2367
+ ClearAuthContextFailed: 51 ,
2368
+ ExceptionTruncated: 52 ,
2369
+ IllegalCharsInName: 53 ,
2370
+ ItemNotInArray: 54 ,
2371
+ MaxAjaxPerPVExceeded: 55 ,
2372
+ MessageTruncated: 56 ,
2373
+ NameTooLong: 57 ,
2374
+ SampleRateOutOfRange: 58 ,
2375
+ SetAuthContextFailed: 59 ,
2376
+ SetAuthContextFailedAccountName: 60 ,
2377
+ StringValueTooLong: 61 ,
2378
+ StartCalledMoreThanOnce: 62 ,
2379
+ StopCalledWithoutStart: 63 ,
2380
+ TelemetryInitializerFailed: 64 ,
2381
+ TrackArgumentsNotSpecified: 65 ,
2382
+ UrlTooLong: 66 ,
2383
+ SessionStorageBufferFull: 67 ,
2384
+ CannotAccessCookie: 68 ,
2385
+ IdTooLong: 69 ,
2386
+ InvalidEvent: 70 ,
2387
+ FailedMonitorAjaxSetRequestHeader: 71 ,
2388
+ SendBrowserInfoOnUserInit: 72 ,
2389
+ PluginException: 73 ,
2390
+ NotificationException: 74 ,
2391
+ SnippetScriptLoadFailure: 99 ,
2392
+ InvalidInstrumentationKey: 100 ,
2393
+ CannotParseAiBlobValue: 101 ,
2394
+ InvalidContentBlob: 102 ,
2395
+ TrackPageActionEventFailed: 103 ,
2396
+ FailedAddingCustomDefinedRequestContext: 104 ,
2397
+ InMemoryStorageBufferFull: 105
2398
+ });
2399
+
1838
2400
  var aiInstrumentHooks = "_aiHooks";
1839
2401
  var cbNames = [
1840
2402
  "req", "rsp", "hkErr", "fnErr"
@@ -1893,6 +2455,7 @@ function _createFunctionHook(aiHook) {
1893
2455
  };
1894
2456
  var hookCtx = [];
1895
2457
  var cbArgs = _createArgs([funcArgs], orgArgs);
2458
+ funcArgs.evt = getGlobalInst("event");
1896
2459
  function _createArgs(target, theArgs) {
1897
2460
  _arrLoop(theArgs, function (arg) {
1898
2461
  target.push(arg);
@@ -1986,6 +2549,7 @@ function createDomEvent(eventName) {
1986
2549
  return event;
1987
2550
  }
1988
2551
 
2552
+ var strEmpty = "";
1989
2553
  function stringToBoolOrDefault(str, defaultValue) {
1990
2554
  if (defaultValue === void 0) { defaultValue = false; }
1991
2555
  if (str === undefined || str === null) {
@@ -1998,16 +2562,16 @@ function msToTimeSpan(totalms) {
1998
2562
  totalms = 0;
1999
2563
  }
2000
2564
  totalms = Math.round(totalms);
2001
- var ms = "" + totalms % 1000;
2002
- var sec = "" + Math.floor(totalms / 1000) % 60;
2003
- var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
2004
- var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2565
+ var ms = strEmpty + totalms % 1000;
2566
+ var sec = strEmpty + Math.floor(totalms / 1000) % 60;
2567
+ var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
2568
+ var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2005
2569
  var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
2006
2570
  ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
2007
2571
  sec = sec.length < 2 ? "0" + sec : sec;
2008
2572
  min = min.length < 2 ? "0" + min : min;
2009
2573
  hour = hour.length < 2 ? "0" + hour : hour;
2010
- return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
2574
+ return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
2011
2575
  }
2012
2576
  function getExtensionByName(extensions, identifier) {
2013
2577
  var extension = null;
@@ -2025,17 +2589,15 @@ function isCrossOriginError(message, url, lineNumber, columnNumber, error) {
2025
2589
 
2026
2590
  var strNotSpecified = "not_specified";
2027
2591
 
2028
- var StorageType;
2029
- (function (StorageType) {
2030
- StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
2031
- StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
2032
- })(StorageType || (StorageType = {}));
2033
- var DistributedTracingModes;
2034
- (function (DistributedTracingModes) {
2035
- DistributedTracingModes[DistributedTracingModes["AI"] = 0] = "AI";
2036
- DistributedTracingModes[DistributedTracingModes["AI_AND_W3C"] = 1] = "AI_AND_W3C";
2037
- DistributedTracingModes[DistributedTracingModes["W3C"] = 2] = "W3C";
2038
- })(DistributedTracingModes || (DistributedTracingModes = {}));
2592
+ var StorageType = createEnumStyle({
2593
+ LocalStorage: 0 ,
2594
+ SessionStorage: 1
2595
+ });
2596
+ createEnumStyle({
2597
+ AI: 0 ,
2598
+ AI_AND_W3C: 1 ,
2599
+ W3C: 2
2600
+ });
2039
2601
 
2040
2602
  var _canUseLocalStorage = undefined;
2041
2603
  var _canUseSessionStorage = undefined;
@@ -2073,8 +2635,8 @@ function utlDisableStorage() {
2073
2635
  _canUseLocalStorage = false;
2074
2636
  _canUseSessionStorage = false;
2075
2637
  }
2076
- function utlCanUseLocalStorage() {
2077
- if (_canUseLocalStorage === undefined) {
2638
+ function utlCanUseLocalStorage(reset) {
2639
+ if (reset || _canUseLocalStorage === undefined) {
2078
2640
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2079
2641
  }
2080
2642
  return _canUseLocalStorage;
@@ -2087,7 +2649,7 @@ function utlGetLocalStorage(logger, name) {
2087
2649
  }
2088
2650
  catch (e) {
2089
2651
  _canUseLocalStorage = false;
2090
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2652
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2091
2653
  }
2092
2654
  }
2093
2655
  return null;
@@ -2101,7 +2663,7 @@ function utlSetLocalStorage(logger, name, data) {
2101
2663
  }
2102
2664
  catch (e) {
2103
2665
  _canUseLocalStorage = false;
2104
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2666
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2105
2667
  }
2106
2668
  }
2107
2669
  return false;
@@ -2115,13 +2677,13 @@ function utlRemoveStorage(logger, name) {
2115
2677
  }
2116
2678
  catch (e) {
2117
2679
  _canUseLocalStorage = false;
2118
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2680
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2119
2681
  }
2120
2682
  }
2121
2683
  return false;
2122
2684
  }
2123
- function utlCanUseSessionStorage() {
2124
- if (_canUseSessionStorage === undefined) {
2685
+ function utlCanUseSessionStorage(reset) {
2686
+ if (reset || _canUseSessionStorage === undefined) {
2125
2687
  _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
2126
2688
  }
2127
2689
  return _canUseSessionStorage;
@@ -2143,7 +2705,7 @@ function utlGetSessionStorage(logger, name) {
2143
2705
  }
2144
2706
  catch (e) {
2145
2707
  _canUseSessionStorage = false;
2146
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2708
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2147
2709
  }
2148
2710
  }
2149
2711
  return null;
@@ -2157,7 +2719,7 @@ function utlSetSessionStorage(logger, name, data) {
2157
2719
  }
2158
2720
  catch (e) {
2159
2721
  _canUseSessionStorage = false;
2160
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2722
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2161
2723
  }
2162
2724
  }
2163
2725
  return false;
@@ -2171,7 +2733,7 @@ function utlRemoveSessionStorage(logger, name) {
2171
2733
  }
2172
2734
  catch (e) {
2173
2735
  _canUseSessionStorage = false;
2174
- logger.throwInternal(LoggingSeverity.WARNING, _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2736
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2175
2737
  }
2176
2738
  }
2177
2739
  return false;
@@ -2800,7 +3362,7 @@ var LogEntry = /** @class */ (function () {
2800
3362
  }
2801
3363
  }
2802
3364
  else if (isString(value) || isNumber(value) || isBoolean(value)) {
2803
- return _testValue(rg, value.toString());
3365
+ return _testValue(rg, objToString(value));
2804
3366
  }
2805
3367
  }
2806
3368
  return false;
@@ -3406,4 +3968,4 @@ var DebugPlugin = /** @class */ (function (_super) {
3406
3968
  var DebugPlugin$1 = DebugPlugin;
3407
3969
 
3408
3970
  exports.DebugPlugin = DebugPlugin$1;
3409
- //# sourceMappingURL=ai.dbg.2.7.5-nightly.2203-02.cjs.js.map
3971
+ //# sourceMappingURL=ai.dbg.2.7.5-nightly.2203-03.cjs.js.map