@microsoft/1ds-core-js 4.1.2-nightly3.2403-07 → 4.1.2

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 (43) hide show
  1. package/bundle/es5/{ms.core-4.1.2-nightly3.2403-07.gbl.js → ms.core-4.1.2.gbl.js} +1056 -1038
  2. package/bundle/es5/ms.core-4.1.2.gbl.js.map +1 -0
  3. package/bundle/es5/ms.core-4.1.2.gbl.min.js +7 -0
  4. package/bundle/es5/ms.core-4.1.2.gbl.min.js.map +1 -0
  5. package/bundle/es5/ms.core-4.1.2.integrity.json +46 -0
  6. package/bundle/es5/{ms.core-4.1.2-nightly3.2403-07.js → ms.core-4.1.2.js} +1056 -1038
  7. package/bundle/es5/ms.core-4.1.2.js.map +1 -0
  8. package/bundle/es5/ms.core-4.1.2.min.js +7 -0
  9. package/bundle/es5/ms.core-4.1.2.min.js.map +1 -0
  10. package/bundle/es5/ms.core.gbl.js +1055 -1037
  11. package/bundle/es5/ms.core.gbl.js.map +1 -1
  12. package/bundle/es5/ms.core.gbl.min.js +2 -2
  13. package/bundle/es5/ms.core.gbl.min.js.map +1 -1
  14. package/bundle/es5/ms.core.integrity.json +17 -17
  15. package/bundle/es5/ms.core.js +1055 -1037
  16. package/bundle/es5/ms.core.js.map +1 -1
  17. package/bundle/es5/ms.core.min.js +2 -2
  18. package/bundle/es5/ms.core.min.js.map +1 -1
  19. package/dist/es5/ms.core.js +1054 -1036
  20. package/dist/es5/ms.core.js.map +1 -1
  21. package/dist/es5/ms.core.min.js +2 -2
  22. package/dist/es5/ms.core.min.js.map +1 -1
  23. package/dist-es5/AppInsightsCore.js +1 -1
  24. package/dist-es5/BaseCore.js +1 -1
  25. package/dist-es5/DataModels.js +1 -1
  26. package/dist-es5/Enums.js +1 -1
  27. package/dist-es5/Index.js +4 -2
  28. package/dist-es5/Index.js.map +1 -1
  29. package/dist-es5/InternalConstants.js +1 -1
  30. package/dist-es5/Utils.js +2 -2
  31. package/dist-es5/Utils.js.map +1 -1
  32. package/dist-es5/ValueSanitizer.js +1 -1
  33. package/dist-es5/__DynamicConstants.js +1 -1
  34. package/package.json +69 -72
  35. package/types/1ds-core-js.d.ts +5 -2
  36. package/types/1ds-core-js.namespaced.d.ts +15 -6
  37. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.gbl.js.map +0 -1
  38. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.gbl.min.js +0 -7
  39. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.gbl.min.js.map +0 -1
  40. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.integrity.json +0 -46
  41. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.js.map +0 -1
  42. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.min.js +0 -7
  43. package/bundle/es5/ms.core-4.1.2-nightly3.2403-07.min.js.map +0 -1
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 4.1.2-nightly3.2403-07
2
+ * 1DS JS SDK Core, 4.1.2
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
6
6
  (function (global, factory) {
7
7
  var undef = "undefined";
8
- var nsKey, key, nm, theExports = {}, modName = "es5_ms_core_4_1_2_nightly3_2403_07", msMod="__ms$mod__";
9
- var mods={}, modDetail=mods[modName]={}, ver="4.1.2-nightly3.2403-07";
8
+ var nsKey, key, nm, theExports = {}, modName = "es5_ms_core_4_1_2", msMod="__ms$mod__";
9
+ var mods={}, modDetail=mods[modName]={}, ver="4.1.2";
10
10
  // Versioned namespace "oneDS4"
11
11
  var exportNs=global, nsKey="oneDS4", exportNs=exportNs[nsKey]=(exportNs[nsKey]||{});
12
12
  // Global namespace "oneDS"
@@ -36,23 +36,16 @@ var ObjProto$1 = ObjClass$1[strShimPrototype];
36
36
  var UNDEF_VALUE = undefined;
37
37
  var NULL_VALUE = null;
38
38
  var EMPTY = "";
39
- var BOOLEAN = "boolean";
40
39
  var FUNCTION = "function";
41
- var NUMBER = "number";
42
40
  var OBJECT = "object";
43
41
  var PROTOTYPE = "prototype";
44
42
  var __PROTO__ = "__proto__";
45
- var STRING = "string";
46
43
  var UNDEFINED = "undefined";
47
44
  var CONSTRUCTOR = "constructor";
48
45
  var SYMBOL = "Symbol";
49
46
  var POLYFILL_TAG = "_polyfill";
50
- var INDEX_OF = "indexOf";
51
47
  var LENGTH = "length";
52
- var DONE = "done";
53
- var VALUE = "value";
54
48
  var NAME = "name";
55
- var SLICE = "slice";
56
49
  var CALL = "call";
57
50
  var TO_STRING = "toString";
58
51
  var ObjClass = Object;
@@ -62,6 +55,7 @@ var StrProto = StrCls[PROTOTYPE];
62
55
  var MathCls = Math;
63
56
  var ArrCls = Array;
64
57
  var ArrProto = ArrCls[PROTOTYPE];
58
+ var ArrSlice = ArrProto["slice"];
65
59
 
66
60
  function safe(func, argArray) {
67
61
  try {
@@ -74,12 +68,13 @@ function safe(func, argArray) {
74
68
  }
75
69
  }
76
70
 
71
+ /*#__NO_SIDE_EFFECTS__*/
77
72
  function safeGet(cb, defValue) {
78
73
  var result = safe(cb);
79
74
  return result.e ? defValue : result.v;
80
75
  }
81
76
 
82
- var PRIMITIVE_TYPES = [STRING, NUMBER, BOOLEAN, UNDEFINED, "symbol", "bigint"];
77
+ var _primitiveTypes;
83
78
  /*#__NO_SIDE_EFFECTS__*/
84
79
  function _createIs(theType) {
85
80
  return function (value) {
@@ -119,9 +114,10 @@ function isDefined(arg) {
119
114
  }
120
115
  /*#__NO_SIDE_EFFECTS__*/
121
116
  function isPrimitiveType(theType) {
122
- return theType !== OBJECT && PRIMITIVE_TYPES.indexOf(theType) !== -1;
117
+ !_primitiveTypes && (_primitiveTypes = ["string", "number", "boolean", UNDEFINED, "symbol", "bigint"]);
118
+ return theType !== OBJECT && _primitiveTypes.indexOf(theType) !== -1;
123
119
  }
124
- var isString = ( /*#__PURE__*/_createIs(STRING));
120
+ var isString = ( /*#__PURE__*/_createIs("string"));
125
121
  var isFunction = ( /*#__PURE__*/_createIs(FUNCTION));
126
122
  /*#__NO_SIDE_EFFECTS__*/
127
123
  function isObject(value) {
@@ -132,8 +128,8 @@ function isObject(value) {
132
128
  }
133
129
  var isArray = ArrCls.isArray;
134
130
  var isDate = ( /*#__PURE__*/_createObjIs("Date"));
135
- var isNumber = ( /*#__PURE__*/_createIs(NUMBER));
136
- var isBoolean = ( /*#__PURE__*/_createIs(BOOLEAN));
131
+ var isNumber = ( /*#__PURE__*/_createIs("number"));
132
+ var isBoolean = ( /*#__PURE__*/_createIs("boolean"));
137
133
  var isError = ( /*#__PURE__*/_createObjIs("Error"));
138
134
  /*#__NO_SIDE_EFFECTS__*/
139
135
  function isPromiseLike(value) {
@@ -243,6 +239,7 @@ var asString = StrCls;
243
239
 
244
240
  var GLOBAL_CONFIG_KEY = "__tsUtils$gblCfg";
245
241
  var _globalCfg;
242
+ /*#__NO_SIDE_EFFECTS__*/
246
243
  function _getGlobalValue() {
247
244
  var result;
248
245
  if (typeof globalThis !== UNDEFINED) {
@@ -277,7 +274,7 @@ function dumpObj(object, format) {
277
274
  object = { stack: asString(object.stack), message: asString(object.message), name: asString(object.name) };
278
275
  }
279
276
  try {
280
- propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === NUMBER) ? format : 4) : UNDEF_VALUE);
277
+ propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === "number") ? format : 4) : UNDEF_VALUE);
281
278
  propertyValueDump = (propertyValueDump && propertyValueDump.replace(/"(\w+)"\s*:\s{0,1}/g, "$1: ")) || asString(object);
282
279
  }
283
280
  catch (e) {
@@ -286,18 +283,15 @@ function dumpObj(object, format) {
286
283
  return objType + ": " + propertyValueDump;
287
284
  }
288
285
 
289
- var _slice;
290
- var _unwrapInstFunction = _unwrapFunctionWithPoly;
291
286
  var _unwrapFunction = _unwrapFunctionWithPoly;
292
287
  /*#__NO_SIDE_EFFECTS__*/
293
288
  function _unwrapFunctionWithPoly(funcName, clsProto, polyFunc) {
294
- _slice = _slice || ArrProto[SLICE];
295
289
  var clsFn = clsProto && clsProto[funcName];
296
290
  return function (thisArg) {
297
291
  var theFunc = (thisArg && thisArg[funcName]) || clsFn;
298
292
  if (theFunc || polyFunc) {
299
293
  var theArgs = arguments;
300
- return (theFunc || polyFunc).apply(thisArg, theFunc ? _slice[CALL](theArgs, 1) : theArgs);
294
+ return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrSlice[CALL](theArgs, 1) : theArgs);
301
295
  }
302
296
  throwTypeError("\"" + asString(funcName) + "\" not defined for " + dumpObj(thisArg));
303
297
  };
@@ -311,7 +305,7 @@ function _unwrapProp(propName) {
311
305
 
312
306
  var mathMax = MathCls.max;
313
307
 
314
- var strSlice = ( /*#__PURE__*/_unwrapFunction(SLICE, StrProto));
308
+ var strSlice = ( /*#__PURE__*/_unwrapFunction("slice", StrProto));
315
309
 
316
310
  var strSubstring = ( /*#__PURE__*/_unwrapFunction("substring", StrProto));
317
311
  var strSubstr = ( /*#__PURE__*/_unwrapFunctionWithPoly("substr", StrProto, polyStrSubstr));
@@ -383,7 +377,7 @@ function polyGetKnownSymbol(name) {
383
377
  var propMap = {
384
378
  e: "enumerable",
385
379
  c: "configurable",
386
- v: VALUE,
380
+ v: "value",
387
381
  w: "writable",
388
382
  g: "get",
389
383
  s: "set"
@@ -429,6 +423,7 @@ var _globalLazyTestHooks;
429
423
  function _initTestHooks() {
430
424
  _globalLazyTestHooks = _getGlobalConfig();
431
425
  }
426
+ /*#__NO_SIDE_EFFECTS__*/
432
427
  function getLazy(cb) {
433
428
  var lazyValue = {};
434
429
  !_globalLazyTestHooks && _initTestHooks();
@@ -466,11 +461,14 @@ function createCachedValue(value) {
466
461
 
467
462
  var WINDOW = "window";
468
463
  var _cachedGlobal;
469
- var _cachedWindow;
470
- var _cachedDocument;
471
- var _cachedNavigator;
472
- var _cachedHistory;
473
- var _isNode;
464
+ function _getGlobalInstFn(getFn, theArgs) {
465
+ var cachedValue;
466
+ return function () {
467
+ !_globalLazyTestHooks && _initTestHooks();
468
+ (!cachedValue || _globalLazyTestHooks.lzy) && (cachedValue = createCachedValue(safe(getFn, theArgs).v));
469
+ return cachedValue.v;
470
+ };
471
+ }
474
472
  /*#__NO_SIDE_EFFECTS__*/
475
473
  function lazySafeGetInst(name) {
476
474
  return getLazy(function () { return safe((getInst), [name]).v || UNDEF_VALUE; });
@@ -487,8 +485,8 @@ function getInst(name, useCached) {
487
485
  if (gbl && gbl[name]) {
488
486
  return gbl[name];
489
487
  }
490
- if (name === WINDOW && _cachedWindow) {
491
- return _cachedWindow.v;
488
+ if (name === WINDOW) {
489
+ return getWindow();
492
490
  }
493
491
  return NULL_VALUE;
494
492
  }
@@ -496,46 +494,25 @@ function getInst(name, useCached) {
496
494
  function hasDocument() {
497
495
  return !!getDocument();
498
496
  }
499
- /*#__NO_SIDE_EFFECTS__*/
500
- function getDocument() {
501
- !_globalLazyTestHooks && _initTestHooks();
502
- (!_cachedDocument || _globalLazyTestHooks.lzy) && (_cachedDocument = createCachedValue(safe((getInst), ["document"]).v));
503
- return _cachedDocument.v;
504
- }
497
+ var getDocument = ( /*#__PURE__*/_getGlobalInstFn(getInst, ["document"]));
505
498
  /*#__NO_SIDE_EFFECTS__*/
506
499
  function hasWindow() {
507
500
  return !!getWindow();
508
501
  }
509
- /*#__NO_SIDE_EFFECTS__*/
510
- function getWindow() {
511
- !_globalLazyTestHooks && _initTestHooks();
512
- (!_cachedWindow || _globalLazyTestHooks.lzy) && (_cachedWindow = createCachedValue(safe((getInst), [WINDOW]).v));
513
- return _cachedWindow.v;
514
- }
502
+ var getWindow = ( /*#__PURE__*/_getGlobalInstFn(getInst, [WINDOW]));
515
503
  /*#__NO_SIDE_EFFECTS__*/
516
504
  function hasNavigator() {
517
505
  return !!getNavigator();
518
506
  }
519
- /*#__NO_SIDE_EFFECTS__*/
520
- function getNavigator() {
521
- !_globalLazyTestHooks && _initTestHooks();
522
- (!_cachedNavigator || _globalLazyTestHooks.lzy) && (_cachedNavigator = createCachedValue(safe((getInst), ["navigator"]).v));
523
- return _cachedNavigator.v;
524
- }
507
+ var getNavigator = ( /*#__PURE__*/_getGlobalInstFn(getInst, ["navigator"]));
525
508
  /*#__NO_SIDE_EFFECTS__*/
526
509
  function hasHistory() {
527
510
  return !!getHistory();
528
511
  }
529
- /*#__NO_SIDE_EFFECTS__*/
530
- function getHistory() {
531
- !_globalLazyTestHooks && _initTestHooks();
532
- (!_cachedHistory || _globalLazyTestHooks.lzy) && (_cachedHistory = createCachedValue(safe((getInst), ["history"]).v));
533
- return _cachedHistory.v;
534
- }
535
- function isNode() {
536
- !_isNode && (_isNode = createCachedValue(!!safe(function () { return (process && (process.versions || {}).node); }).v));
537
- return _isNode.v;
538
- }
512
+ var getHistory = ( /*#__PURE__*/_getGlobalInstFn(getInst, ["history"]));
513
+ var isNode = ( /*#__PURE__*/_getGlobalInstFn(function () {
514
+ return !!safe(function () { return (process && (process.versions || {}).node); }).v;
515
+ }));
539
516
 
540
517
  var _symbol;
541
518
  var _symbolFor;
@@ -596,8 +573,8 @@ function iterForOf(iter, callbackfn, thisArg) {
596
573
  var iterResult = void 0;
597
574
  try {
598
575
  var count = 0;
599
- while (!(iterResult = iter.next())[DONE]) {
600
- if (callbackfn[CALL](thisArg || iter, iterResult[VALUE], count, iter) === -1) {
576
+ while (!(iterResult = iter.next()).done) {
577
+ if (callbackfn[CALL](thisArg || iter, iterResult.value, count, iter) === -1) {
601
578
  break;
602
579
  }
603
580
  count++;
@@ -612,7 +589,7 @@ function iterForOf(iter, callbackfn, thisArg) {
612
589
  }
613
590
  finally {
614
591
  try {
615
- if (iterResult && !iterResult[DONE]) {
592
+ if (iterResult && !iterResult.done) {
616
593
  iter.return && iter.return(iterResult);
617
594
  }
618
595
  }
@@ -626,7 +603,9 @@ function iterForOf(iter, callbackfn, thisArg) {
626
603
  }
627
604
  }
628
605
 
629
- var fnApply = ( /*#__PURE__*/_unwrapInstFunction("apply"));
606
+ function fnApply(fn, thisArg, argArray) {
607
+ return fn.apply(thisArg, argArray);
608
+ }
630
609
 
631
610
  function arrAppend(target, elms) {
632
611
  if (!isUndefined(elms) && target) {
@@ -658,11 +637,13 @@ function arrForEach(theArray, callbackfn, thisArg) {
658
637
  }
659
638
  }
660
639
 
661
- var arrIndexOf = ( /*#__PURE__*/_unwrapFunction(INDEX_OF, ArrProto));
640
+ var arrIndexOf = ( /*#__PURE__*/_unwrapFunction("indexOf", ArrProto));
662
641
 
663
642
  var arrMap = ( /*#__PURE__*/_unwrapFunction("map", ArrProto));
664
643
 
665
- var arrSlice = ( /*#__PURE__*/_unwrapFunction(SLICE, ArrProto));
644
+ function arrSlice(theArray, start, end) {
645
+ return ((theArray && theArray["slice"]) || ArrSlice).apply(theArray, ArrSlice[CALL](arguments, 1));
646
+ }
666
647
 
667
648
  /*#__NO_SIDE_EFFECTS__*/
668
649
  function polyArrIncludes(theArray, searchElement, fromIndex) {
@@ -701,6 +682,7 @@ function objSetPrototypeOf(obj, proto) {
701
682
  return fn(obj, proto);
702
683
  }
703
684
 
685
+ /*#__NO_SIDE_EFFECTS__*/
704
686
  function _createCustomError(name, d, b) {
705
687
  safe(objDefine, [d, NAME, { v: name, c: true, e: false }]);
706
688
  d = objSetPrototypeOf(d, b);
@@ -724,7 +706,7 @@ function createCustomError(name, constructCb, errorBase) {
724
706
  var theArgs = arguments;
725
707
  try {
726
708
  safe(_setName, [theBaseClass, name]);
727
- var _self = fnApply(theBaseClass, _this, ArrProto[SLICE][CALL](theArgs)) || _this;
709
+ var _self = fnApply(theBaseClass, _this, ArrSlice[CALL](theArgs)) || _this;
728
710
  if (_self !== _this) {
729
711
  var orgProto = objGetPrototypeOf(_this);
730
712
  if (orgProto !== objGetPrototypeOf(_self)) {
@@ -799,16 +781,18 @@ function isPlainObject(value) {
799
781
  return result;
800
782
  }
801
783
 
802
- var _defaultDeepCopyHandler = function (details) {
784
+ /*#__NO_SIDE_EFFECTS__*/
785
+ function _defaultDeepCopyHandler(details) {
803
786
  details.value && plainObjDeepCopyHandler(details);
804
787
  return true;
805
- };
788
+ }
806
789
  var defaultDeepCopyHandlers = [
807
790
  arrayDeepCopyHandler,
808
791
  plainObjDeepCopyHandler,
809
792
  functionDeepCopyHandler,
810
793
  dateDeepCopyHandler
811
794
  ];
795
+ /*#__NO_SIDE_EFFECTS__*/
812
796
  function _getSetVisited(visitMap, source, newPath, cb) {
813
797
  var theEntry;
814
798
  arrForEach(visitMap, function (entry) {
@@ -943,7 +927,7 @@ function _doExtend(target, theArgs) {
943
927
  return target;
944
928
  }
945
929
  function deepExtend(target, obj1, obj2, obj3, obj4, obj5, obj6) {
946
- return _doExtend(objDeepCopy(target) || {}, ArrProto[SLICE][CALL](arguments));
930
+ return _doExtend(objDeepCopy(target) || {}, ArrSlice[CALL](arguments));
947
931
  }
948
932
 
949
933
  var getLength = ( /*#__PURE__*/_unwrapProp(LENGTH));
@@ -975,7 +959,7 @@ function polyStrEndsWith(value, searchString, length) {
975
959
  return strSubstring(value, end - searchValue[LENGTH], end) === searchValue;
976
960
  }
977
961
 
978
- var strIndexOf = ( /*#__PURE__*/_unwrapFunction(INDEX_OF, StrProto));
962
+ var strIndexOf = ( /*#__PURE__*/_unwrapFunction("indexOf", StrProto));
979
963
 
980
964
  var strStartsWith = ( /*#__PURE__*/_unwrapFunctionWithPoly("startsWith", StrProto, polyStrStartsWith));
981
965
  /*#__NO_SIDE_EFFECTS__*/
@@ -989,55 +973,51 @@ function polyStrStartsWith(value, searchString, position) {
989
973
  }
990
974
 
991
975
  var REF = "ref";
992
- var UNREF = "un" + REF;
976
+ var UNREF = "unref";
993
977
  var HAS_REF = "hasRef";
994
978
  var ENABLED = "enabled";
979
+ /*#__NO_SIDE_EFFECTS__*/
995
980
  function _createTimerHandler(startTimer, refreshFn, cancelFn) {
996
- var _a;
997
981
  var ref = true;
998
982
  var timerId = startTimer ? refreshFn(NULL_VALUE) : NULL_VALUE;
999
983
  var theTimerHandler;
1000
- var _unref = function () {
984
+ function _unref() {
1001
985
  ref = false;
1002
986
  timerId && timerId[UNREF] && timerId[UNREF]();
1003
987
  return theTimerHandler;
1004
- };
1005
- var _ref = function () {
1006
- ref = true;
1007
- timerId && timerId[REF] && timerId[REF]();
988
+ }
989
+ function _cancel() {
990
+ timerId && cancelFn(timerId);
991
+ timerId = NULL_VALUE;
992
+ }
993
+ function _refresh() {
994
+ timerId = refreshFn(timerId);
995
+ if (!ref) {
996
+ _unref();
997
+ }
1008
998
  return theTimerHandler;
999
+ }
1000
+ function _setEnabled(value) {
1001
+ !value && timerId && _cancel();
1002
+ value && !timerId && _refresh();
1003
+ }
1004
+ theTimerHandler = {
1005
+ cancel: _cancel,
1006
+ refresh: _refresh
1009
1007
  };
1010
- var _hasRef = function () {
1008
+ theTimerHandler[HAS_REF] = function () {
1011
1009
  if (timerId && timerId[HAS_REF]) {
1012
1010
  return timerId[HAS_REF]();
1013
1011
  }
1014
1012
  return ref;
1015
1013
  };
1016
- var _refresh = function () {
1017
- timerId = refreshFn(timerId);
1018
- if (!ref) {
1019
- _unref();
1020
- }
1014
+ theTimerHandler[REF] = function () {
1015
+ ref = true;
1016
+ timerId && timerId[REF] && timerId[REF]();
1021
1017
  return theTimerHandler;
1022
1018
  };
1023
- var _cancel = function () {
1024
- timerId && cancelFn(timerId);
1025
- timerId = NULL_VALUE;
1026
- };
1027
- var _setEnabled = function (value) {
1028
- !value && timerId && _cancel();
1029
- value && !timerId && _refresh();
1030
- };
1031
- theTimerHandler = (_a = {
1032
- cancel: _cancel,
1033
- refresh: _refresh
1034
- },
1035
- _a[HAS_REF] = _hasRef,
1036
- _a[REF] = _ref,
1037
- _a[UNREF] = _unref,
1038
- _a[ENABLED] = false,
1039
- _a);
1040
- objDefineProp(theTimerHandler, ENABLED, {
1019
+ theTimerHandler[UNREF] = _unref;
1020
+ theTimerHandler = objDefineProp(theTimerHandler, ENABLED, {
1041
1021
  get: function () { return !!timerId; },
1042
1022
  set: _setEnabled
1043
1023
  });
@@ -1049,7 +1029,7 @@ function _createTimerHandler(startTimer, refreshFn, cancelFn) {
1049
1029
  };
1050
1030
  }
1051
1031
 
1052
- function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
1032
+ function _createTimeoutWith(startTimer, overrideFn, theArgs) {
1053
1033
  var isArr = isArray(overrideFn);
1054
1034
  var len = isArr ? overrideFn.length : 0;
1055
1035
  var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
@@ -1057,7 +1037,7 @@ function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
1057
1037
  var timerFn = theArgs[0];
1058
1038
  theArgs[0] = function () {
1059
1039
  handler.dn();
1060
- fnApply(timerFn, self, ArrProto[SLICE][CALL](arguments));
1040
+ fnApply(timerFn, UNDEF_VALUE, ArrSlice[CALL](arguments));
1061
1041
  };
1062
1042
  var handler = _createTimerHandler(startTimer, function (timerId) {
1063
1043
  if (timerId) {
@@ -1065,19 +1045,19 @@ function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
1065
1045
  timerId.refresh();
1066
1046
  return timerId;
1067
1047
  }
1068
- fnApply(clearFn, self, [timerId]);
1048
+ fnApply(clearFn, UNDEF_VALUE, [timerId]);
1069
1049
  }
1070
- return fnApply(setFn, self, theArgs);
1050
+ return fnApply(setFn, UNDEF_VALUE, theArgs);
1071
1051
  }, function (timerId) {
1072
- fnApply(clearFn, self, [timerId]);
1052
+ fnApply(clearFn, UNDEF_VALUE, [timerId]);
1073
1053
  });
1074
1054
  return handler.h;
1075
1055
  }
1076
1056
  function scheduleTimeout(callback, timeout) {
1077
- return _createTimeoutWith(this, true, UNDEF_VALUE, ArrProto[SLICE][CALL](arguments));
1057
+ return _createTimeoutWith(true, UNDEF_VALUE, ArrSlice[CALL](arguments));
1078
1058
  }
1079
1059
  function createTimeout(callback, timeout) {
1080
- return _createTimeoutWith(this, false, UNDEF_VALUE, ArrProto[SLICE][CALL](arguments));
1060
+ return _createTimeoutWith(false, UNDEF_VALUE, ArrSlice[CALL](arguments));
1081
1061
  }
1082
1062
 
1083
1063
  var strHasOwnProperty = "hasOwnProperty";
@@ -1392,16 +1372,16 @@ var _DYN_HDLR = "hdlr";
1392
1372
  var _DYN_CANCEL = "cancel";
1393
1373
  var _DYN_INITIALIZE$1 = "initialize";
1394
1374
  var _DYN_IDENTIFIER = "identifier";
1375
+ var _DYN_REMOVE_NOTIFICATION_0 = "removeNotificationListener";
1376
+ var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener";
1395
1377
  var _DYN_IS_INITIALIZED = "isInitialized";
1378
+ var _DYN_GET_NOTIFY_MGR = "getNotifyMgr";
1396
1379
  var _DYN_GET_PLUGIN = "getPlugin";
1397
1380
  var _DYN_POLL_INTERNAL_LOGS$1 = "pollInternalLogs";
1398
1381
  var _DYN_NAME = "name";
1399
1382
  var _DYN_TIME = "time";
1400
1383
  var _DYN_PROCESS_NEXT = "processNext";
1401
- var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
1402
- var _DYN_GET_NOTIFY_MGR = "getNotifyMgr";
1403
- var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener";
1404
- var _DYN_REMOVE_NOTIFICATION_2 = "removeNotificationListener";
1384
+ var _DYN_GET_PROCESS_TEL_CONT2 = "getProcessTelContext";
1405
1385
  var _DYN_ENABLED = "enabled";
1406
1386
  var _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs";
1407
1387
  var _DYN_UNLOAD = "unload";
@@ -1427,7 +1407,6 @@ var _DYN_LOG_INTERNAL_MESSAGE = "logInternalMessage";
1427
1407
  var _DYN_TYPE = "type";
1428
1408
  var _DYN_HANDLER = "handler";
1429
1409
  var _DYN_STATUS = "status";
1430
- var _DYN_ITEMS_RECEIVED = "itemsReceived";
1431
1410
  var _DYN_GET_RESPONSE_HEADER = "getResponseHeader";
1432
1411
  var _DYN_GET_ALL_RESPONSE_HEA5 = "getAllResponseHeaders";
1433
1412
  var _DYN_IS_CHILD_EVT = "isChildEvt";
@@ -1435,6 +1414,7 @@ var _DYN_DATA = "data";
1435
1414
  var _DYN_GET_CTX = "getCtx";
1436
1415
  var _DYN_SET_CTX = "setCtx";
1437
1416
  var _DYN_COMPLETE = "complete";
1417
+ var _DYN_ITEMS_RECEIVED = "itemsReceived";
1438
1418
  var _DYN_URL_STRING = "urlString";
1439
1419
  var _DYN_SEND_POST = "sendPOST";
1440
1420
  var _DYN_HEADERS = "headers";
@@ -1812,105 +1792,305 @@ var STR_DOMAIN = "domain";
1812
1792
  var STR_PATH = "path";
1813
1793
  var STR_NOT_DYNAMIC_ERROR = "Not dynamic - ";
1814
1794
 
1815
- var listenerFuncs = [STR_EVENTS_SENT, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_PERF_EVENT];
1816
- var _aiNamespace = null;
1817
- var _debugListener;
1818
- function _listenerProxyFunc(name, config) {
1819
- return function () {
1820
- var args = arguments;
1821
- var dbgExt = getDebugExt(config);
1822
- if (dbgExt) {
1823
- var listener = dbgExt.listener;
1824
- if (listener && listener[name]) {
1825
- listener[name][_DYN_APPLY ](listener, args);
1826
- }
1827
- }
1828
- };
1795
+ var rCamelCase = /-([a-z])/g;
1796
+ var rNormalizeInvalid = /([^\w\d_$])/g;
1797
+ var rLeadingNumeric = /^(\d+[\w\d_$])/;
1798
+ function isNotNullOrUndefined(value) {
1799
+ return !isNullOrUndefined(value);
1829
1800
  }
1830
- function _getExtensionNamespace() {
1831
- var target = getInst("Microsoft");
1832
- if (target) {
1833
- _aiNamespace = target["ApplicationInsights"];
1801
+ function normalizeJsName(name) {
1802
+ var value = name;
1803
+ if (value && isString(value)) {
1804
+ value = value[_DYN_REPLACE ](rCamelCase, function (_all, letter) {
1805
+ return letter.toUpperCase();
1806
+ });
1807
+ value = value[_DYN_REPLACE ](rNormalizeInvalid, "_");
1808
+ value = value[_DYN_REPLACE ](rLeadingNumeric, function (_all, match) {
1809
+ return "_" + match;
1810
+ });
1834
1811
  }
1835
- return _aiNamespace;
1812
+ return value;
1836
1813
  }
1837
- function getDebugExt(config) {
1838
- var ns = _aiNamespace;
1839
- if (!ns && config.disableDbgExt !== true) {
1840
- ns = _aiNamespace || _getExtensionNamespace();
1814
+ function strContains(value, search) {
1815
+ if (value && search) {
1816
+ return strIndexOf(value, search) !== -1;
1841
1817
  }
1842
- return ns ? ns["ChromeDbgExt"] : null;
1818
+ return false;
1843
1819
  }
1844
- function getDebugListener(config) {
1845
- if (!_debugListener) {
1846
- _debugListener = {};
1847
- for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH$1 ]; lp++) {
1848
- _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);
1820
+ function toISOString(date) {
1821
+ return date && date.toISOString() || "";
1822
+ }
1823
+ function getExceptionName(object) {
1824
+ if (isError(object)) {
1825
+ return object[_DYN_NAME ];
1826
+ }
1827
+ return STR_EMPTY$2;
1828
+ }
1829
+ function setValue(target, field, value, valChk, srcChk) {
1830
+ var theValue = value;
1831
+ if (target) {
1832
+ theValue = target[field];
1833
+ if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
1834
+ theValue = value;
1835
+ target[field] = theValue;
1849
1836
  }
1850
1837
  }
1851
- return _debugListener;
1838
+ return theValue;
1852
1839
  }
1853
-
1854
- var strDocumentMode = "documentMode";
1855
- var strLocation = "location";
1856
- var strConsole = "console";
1857
- var strJSON = "JSON";
1858
- var strCrypto = "crypto";
1859
- var strMsCrypto = "msCrypto";
1860
- var strReactNative = "ReactNative";
1861
- var strMsie = "msie";
1862
- var strTrident = "trident/";
1863
- var strXMLHttpRequest = "XMLHttpRequest";
1864
- var _isTrident = null;
1865
- var _navUserAgentCheck = null;
1866
- var _enableMocks = false;
1867
- var _useXDomainRequest = null;
1868
- var _beaconsSupported = null;
1869
- function _hasProperty(theClass, property) {
1870
- var supported = false;
1871
- if (theClass) {
1872
- try {
1873
- supported = property in theClass;
1874
- if (!supported) {
1875
- var proto = theClass[strShimPrototype];
1876
- if (proto) {
1877
- supported = property in proto;
1878
- }
1879
- }
1840
+ function getSetValue(target, field, defValue) {
1841
+ var theValue;
1842
+ if (target) {
1843
+ theValue = target[field];
1844
+ if (!theValue && isNullOrUndefined(theValue)) {
1845
+ theValue = !isUndefined(defValue) ? defValue : {};
1846
+ target[field] = theValue;
1880
1847
  }
1881
- catch (e) {
1848
+ }
1849
+ else {
1850
+ theValue = !isUndefined(defValue) ? defValue : {};
1851
+ }
1852
+ return theValue;
1853
+ }
1854
+ function _createProxyFunction(source, funcName) {
1855
+ var srcFunc = null;
1856
+ var src = null;
1857
+ if (isFunction(source)) {
1858
+ srcFunc = source;
1859
+ }
1860
+ else {
1861
+ src = source;
1862
+ }
1863
+ return function () {
1864
+ var originalArguments = arguments;
1865
+ if (srcFunc) {
1866
+ src = srcFunc();
1882
1867
  }
1883
- if (!supported) {
1884
- try {
1885
- var tmp = new theClass();
1886
- supported = !isUndefined(tmp[property]);
1887
- }
1888
- catch (e) {
1868
+ if (src) {
1869
+ return src[funcName][_DYN_APPLY ](src, originalArguments);
1870
+ }
1871
+ };
1872
+ }
1873
+ function proxyAssign(target, source, chkSet) {
1874
+ if (target && source && isObject(target) && isObject(source)) {
1875
+ var _loop_1 = function (field) {
1876
+ if (isString(field)) {
1877
+ var value = source[field];
1878
+ if (isFunction(value)) {
1879
+ if (!chkSet || chkSet(field, true, source, target)) {
1880
+ target[field] = _createProxyFunction(source, field);
1881
+ }
1882
+ }
1883
+ else if (!chkSet || chkSet(field, false, source, target)) {
1884
+ if (objHasOwn(target, field)) {
1885
+ delete target[field];
1886
+ }
1887
+ objDefine(target, field, {
1888
+ g: function () {
1889
+ return source[field];
1890
+ },
1891
+ s: function (theValue) {
1892
+ source[field] = theValue;
1893
+ }
1894
+ });
1895
+ }
1889
1896
  }
1897
+ };
1898
+ for (var field in source) {
1899
+ _loop_1(field);
1890
1900
  }
1891
1901
  }
1892
- return supported;
1893
- }
1894
- function setEnableEnvMocks(enabled) {
1895
- _enableMocks = enabled;
1902
+ return target;
1896
1903
  }
1897
- function getLocation(checkForMock) {
1898
- if (checkForMock && _enableMocks) {
1899
- var mockLocation = getInst("__mockLocation");
1900
- if (mockLocation) {
1901
- return mockLocation;
1904
+ function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
1905
+ if (target && name && source) {
1906
+ if (overwriteTarget !== false || isUndefined(target[name])) {
1907
+ target[name] = _createProxyFunction(source, theFunc);
1902
1908
  }
1903
1909
  }
1904
- if (typeof location === strShimObject && location) {
1905
- return location;
1910
+ }
1911
+ function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
1912
+ if (target && source && isObject(target) && isArray(functionsToProxy)) {
1913
+ arrForEach(functionsToProxy, function (theFuncName) {
1914
+ if (isString(theFuncName)) {
1915
+ proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
1916
+ }
1917
+ });
1906
1918
  }
1907
- return getInst(strLocation);
1919
+ return target;
1908
1920
  }
1909
- function getConsole() {
1910
- if (typeof console !== strShimUndefined) {
1911
- return console;
1921
+ function optimizeObject(theObject) {
1922
+ if (theObject && objAssign) {
1923
+ theObject = ObjClass$1(objAssign({}, theObject));
1912
1924
  }
1913
- return getInst(strConsole);
1925
+ return theObject;
1926
+ }
1927
+ function getResponseText(xhr) {
1928
+ try {
1929
+ return xhr.responseText;
1930
+ }
1931
+ catch (e) {
1932
+ }
1933
+ return null;
1934
+ }
1935
+ function formatErrorMessageXdr(xdr, message) {
1936
+ if (xdr) {
1937
+ return "XDomainRequest,Response:" + getResponseText(xdr) || "";
1938
+ }
1939
+ return message;
1940
+ }
1941
+ function formatErrorMessageXhr(xhr, message) {
1942
+ if (xhr) {
1943
+ return "XMLHttpRequest,Status:" + xhr[_DYN_STATUS ] + ",Response:" + getResponseText(xhr) || xhr.response || "";
1944
+ }
1945
+ return message;
1946
+ }
1947
+ function prependTransports(theTransports, newTransports) {
1948
+ if (newTransports) {
1949
+ if (isNumber(newTransports)) {
1950
+ theTransports = [newTransports].concat(theTransports);
1951
+ }
1952
+ else if (isArray(newTransports)) {
1953
+ theTransports = newTransports.concat(theTransports);
1954
+ }
1955
+ }
1956
+ return theTransports;
1957
+ }
1958
+ var strDisabledPropertyName$1 = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
1959
+ var strWithCredentials$1 = "withCredentials";
1960
+ var strTimeout$1 = "timeout";
1961
+ function openXhr$1(method, urlString, withCredentials, disabled, isSync, timeout) {
1962
+ if (disabled === void 0) { disabled = false; }
1963
+ if (isSync === void 0) { isSync = false; }
1964
+ function _wrapSetXhrProp(xhr, prop, value) {
1965
+ try {
1966
+ xhr[prop] = value;
1967
+ }
1968
+ catch (e) {
1969
+ }
1970
+ }
1971
+ var xhr = new XMLHttpRequest();
1972
+ if (disabled) {
1973
+ _wrapSetXhrProp(xhr, strDisabledPropertyName$1, disabled);
1974
+ }
1975
+ if (withCredentials) {
1976
+ _wrapSetXhrProp(xhr, strWithCredentials$1, withCredentials);
1977
+ }
1978
+ xhr.open(method, urlString, !isSync);
1979
+ if (withCredentials) {
1980
+ _wrapSetXhrProp(xhr, strWithCredentials$1, withCredentials);
1981
+ }
1982
+ if (!isSync && timeout) {
1983
+ _wrapSetXhrProp(xhr, strTimeout$1, timeout);
1984
+ }
1985
+ return xhr;
1986
+ }
1987
+ function convertAllHeadersToMap(headersString) {
1988
+ var headers = {};
1989
+ if (isString(headersString)) {
1990
+ var headersArray = strTrim(headersString)[_DYN_SPLIT ](/[\r\n]+/);
1991
+ arrForEach(headersArray, function (headerEntry) {
1992
+ if (headerEntry) {
1993
+ var idx = headerEntry.indexOf(": ");
1994
+ if (idx !== -1) {
1995
+ var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE ]();
1996
+ var value = strTrim(headerEntry.substring(idx + 1));
1997
+ headers[header] = value;
1998
+ }
1999
+ else {
2000
+ headers[strTrim(headerEntry)] = 1;
2001
+ }
2002
+ }
2003
+ });
2004
+ }
2005
+ return headers;
2006
+ }
2007
+ function _appendHeader(theHeaders, xhr, name) {
2008
+ if (!theHeaders[name] && xhr && xhr[_DYN_GET_RESPONSE_HEADER ]) {
2009
+ var value = xhr[_DYN_GET_RESPONSE_HEADER ](name);
2010
+ if (value) {
2011
+ theHeaders[name] = strTrim(value);
2012
+ }
2013
+ }
2014
+ return theHeaders;
2015
+ }
2016
+ var STR_KILL_DURATION_HEADER = "kill-duration";
2017
+ var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
2018
+ var STR_TIME_DELTA_HEADER = "time-delta-millis";
2019
+ function _getAllResponseHeaders(xhr, isOneDs) {
2020
+ var theHeaders = {};
2021
+ if (!xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]) {
2022
+ if (!!isOneDs) {
2023
+ theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);
2024
+ theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);
2025
+ theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);
2026
+ }
2027
+ }
2028
+ else {
2029
+ theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]());
2030
+ }
2031
+ return theHeaders;
2032
+ }
2033
+
2034
+ var strDocumentMode = "documentMode";
2035
+ var strLocation = "location";
2036
+ var strConsole = "console";
2037
+ var strJSON = "JSON";
2038
+ var strCrypto = "crypto";
2039
+ var strMsCrypto = "msCrypto";
2040
+ var strReactNative = "ReactNative";
2041
+ var strMsie = "msie";
2042
+ var strTrident = "trident/";
2043
+ var strXMLHttpRequest = "XMLHttpRequest";
2044
+ var _isTrident = null;
2045
+ var _navUserAgentCheck = null;
2046
+ var _enableMocks = false;
2047
+ var _useXDomainRequest = null;
2048
+ var _beaconsSupported = null;
2049
+ function _hasProperty(theClass, property) {
2050
+ var supported = false;
2051
+ if (theClass) {
2052
+ try {
2053
+ supported = property in theClass;
2054
+ if (!supported) {
2055
+ var proto = theClass[strShimPrototype];
2056
+ if (proto) {
2057
+ supported = property in proto;
2058
+ }
2059
+ }
2060
+ }
2061
+ catch (e) {
2062
+ }
2063
+ if (!supported) {
2064
+ try {
2065
+ var tmp = new theClass();
2066
+ supported = !isUndefined(tmp[property]);
2067
+ }
2068
+ catch (e) {
2069
+ }
2070
+ }
2071
+ }
2072
+ return supported;
2073
+ }
2074
+ function setEnableEnvMocks(enabled) {
2075
+ _enableMocks = enabled;
2076
+ }
2077
+ function getLocation(checkForMock) {
2078
+ if (checkForMock && _enableMocks) {
2079
+ var mockLocation = getInst("__mockLocation");
2080
+ if (mockLocation) {
2081
+ return mockLocation;
2082
+ }
2083
+ }
2084
+ if (typeof location === strShimObject && location) {
2085
+ return location;
2086
+ }
2087
+ return getInst(strLocation);
2088
+ }
2089
+ function getConsole() {
2090
+ if (typeof console !== strShimUndefined) {
2091
+ return console;
2092
+ }
2093
+ return getInst(strConsole);
1914
2094
  }
1915
2095
  function hasJSON() {
1916
2096
  return Boolean((typeof JSON === strShimObject && JSON) || getInst(strJSON) !== null);
@@ -2030,478 +2210,34 @@ function findNamedServerTiming(name) {
2030
2210
  return value;
2031
2211
  }
2032
2212
 
2033
- var _a$4;
2034
- var STR_WARN_TO_CONSOLE = "warnToConsole";
2035
- var AiNonUserActionablePrefix = "AI (Internal): ";
2036
- var AiUserActionablePrefix = "AI: ";
2037
- var AIInternalMessagePrefix = "AITR_";
2038
- var defaultValues$2 = {
2039
- loggingLevelConsole: 0,
2040
- loggingLevelTelemetry: 1,
2041
- maxMessageLimit: 25,
2042
- enableDebug: false
2043
- };
2044
- var _logFuncs = (_a$4 = {},
2045
- _a$4[0 ] = null,
2046
- _a$4[1 ] = "errorToConsole",
2047
- _a$4[2 ] = STR_WARN_TO_CONSOLE,
2048
- _a$4[3 ] = "debugToConsole",
2049
- _a$4);
2050
- function _sanitizeDiagnosticText(text) {
2051
- if (text) {
2052
- return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$2) + "\"";
2213
+ var UInt32Mask = 0x100000000;
2214
+ var MaxUInt32 = 0xffffffff;
2215
+ var SEED1 = 123456789;
2216
+ var SEED2 = 987654321;
2217
+ var _mwcSeeded = false;
2218
+ var _mwcW = SEED1;
2219
+ var _mwcZ = SEED2;
2220
+ function _mwcSeed(seedValue) {
2221
+ if (seedValue < 0) {
2222
+ seedValue >>>= 0;
2053
2223
  }
2054
- return STR_EMPTY$2;
2224
+ _mwcW = (SEED1 + seedValue) & MaxUInt32;
2225
+ _mwcZ = (SEED2 - seedValue) & MaxUInt32;
2226
+ _mwcSeeded = true;
2055
2227
  }
2056
- function _logToConsole(func, message) {
2057
- var theConsole = getConsole();
2058
- if (!!theConsole) {
2059
- var logFunc = "log";
2060
- if (theConsole[func]) {
2061
- logFunc = func;
2062
- }
2063
- if (isFunction(theConsole[logFunc])) {
2064
- theConsole[logFunc](message);
2065
- }
2228
+ function _autoSeedMwc() {
2229
+ try {
2230
+ var now = utcNow() & 0x7fffffff;
2231
+ _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
2232
+ }
2233
+ catch (e) {
2066
2234
  }
2067
2235
  }
2068
- var _InternalLogMessage = /** @class */ (function () {
2069
- function _InternalLogMessage(msgId, msg, isUserAct, properties) {
2070
- if (isUserAct === void 0) { isUserAct = false; }
2071
- var _self = this;
2072
- _self[_DYN_MESSAGE_ID ] = msgId;
2073
- _self[_DYN_MESSAGE ] =
2074
- (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
2075
- msgId;
2076
- var strProps = STR_EMPTY$2;
2077
- if (hasJSON()) {
2078
- strProps = getJSON().stringify(properties);
2079
- }
2080
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$2) +
2081
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$2);
2082
- _self[_DYN_MESSAGE ] += diagnosticText;
2236
+ function randomValue(maxValue) {
2237
+ if (maxValue > 0) {
2238
+ return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
2083
2239
  }
2084
- _InternalLogMessage.dataType = "MessageData";
2085
- return _InternalLogMessage;
2086
- }());
2087
- function safeGetLogger(core, config) {
2088
- return (core || {})[_DYN_LOGGER$1 ] || new DiagnosticLogger(config);
2089
- }
2090
- var DiagnosticLogger = /** @class */ (function () {
2091
- function DiagnosticLogger(config) {
2092
- this.identifier = "DiagnosticLogger";
2093
- this.queue = [];
2094
- var _messageCount = 0;
2095
- var _messageLogged = {};
2096
- var _loggingLevelConsole;
2097
- var _loggingLevelTelemetry;
2098
- var _maxInternalMessageLimit;
2099
- var _enableDebug;
2100
- var _unloadHandler;
2101
- dynamicProto(DiagnosticLogger, this, function (_self) {
2102
- _unloadHandler = _setDefaultsFromConfig(config || {});
2103
- _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
2104
- _self[_DYN_THROW_INTERNAL ] = function (severity, msgId, msg, properties, isUserAct) {
2105
- if (isUserAct === void 0) { isUserAct = false; }
2106
- var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
2107
- if (_enableDebug) {
2108
- throw dumpObj(message);
2109
- }
2110
- else {
2111
- var logFunc = _logFuncs[severity] || STR_WARN_TO_CONSOLE;
2112
- if (!isUndefined(message[_DYN_MESSAGE ])) {
2113
- if (isUserAct) {
2114
- var messageKey = +message[_DYN_MESSAGE_ID ];
2115
- if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {
2116
- _self[logFunc](message[_DYN_MESSAGE ]);
2117
- _messageLogged[messageKey] = true;
2118
- }
2119
- }
2120
- else {
2121
- if (_loggingLevelConsole >= severity) {
2122
- _self[logFunc](message[_DYN_MESSAGE ]);
2123
- }
2124
- }
2125
- _logInternalMessage(severity, message);
2126
- }
2127
- else {
2128
- _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
2129
- }
2130
- }
2131
- };
2132
- _self.debugToConsole = function (message) {
2133
- _logToConsole("debug", message);
2134
- _debugExtMsg("warning", message);
2135
- };
2136
- _self[_DYN_WARN_TO_CONSOLE ] = function (message) {
2137
- _logToConsole("warn", message);
2138
- _debugExtMsg("warning", message);
2139
- };
2140
- _self.errorToConsole = function (message) {
2141
- _logToConsole("error", message);
2142
- _debugExtMsg("error", message);
2143
- };
2144
- _self.resetInternalMessageCount = function () {
2145
- _messageCount = 0;
2146
- _messageLogged = {};
2147
- };
2148
- _self[_DYN_LOG_INTERNAL_MESSAGE ] = _logInternalMessage;
2149
- _self[_DYN_UNLOAD ] = function (isAsync) {
2150
- _unloadHandler && _unloadHandler.rm();
2151
- _unloadHandler = null;
2152
- };
2153
- function _logInternalMessage(severity, message) {
2154
- if (_areInternalMessagesThrottled()) {
2155
- return;
2156
- }
2157
- var logMessage = true;
2158
- var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID ];
2159
- if (_messageLogged[messageKey]) {
2160
- logMessage = false;
2161
- }
2162
- else {
2163
- _messageLogged[messageKey] = true;
2164
- }
2165
- if (logMessage) {
2166
- if (severity <= _loggingLevelTelemetry) {
2167
- _self.queue[_DYN_PUSH ](message);
2168
- _messageCount++;
2169
- _debugExtMsg((severity === 1 ? "error" : "warn"), message);
2170
- }
2171
- if (_messageCount === _maxInternalMessageLimit) {
2172
- var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
2173
- var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
2174
- _self.queue[_DYN_PUSH ](throttleMessage);
2175
- if (severity === 1 ) {
2176
- _self.errorToConsole(throttleLimitMessage);
2177
- }
2178
- else {
2179
- _self[_DYN_WARN_TO_CONSOLE ](throttleLimitMessage);
2180
- }
2181
- }
2182
- }
2183
- }
2184
- function _setDefaultsFromConfig(config) {
2185
- return onConfigChange(createDynamicConfig(config, defaultValues$2, _self).cfg, function (details) {
2186
- var config = details.cfg;
2187
- _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 ];
2188
- _loggingLevelTelemetry = config.loggingLevelTelemetry;
2189
- _maxInternalMessageLimit = config.maxMessageLimit;
2190
- _enableDebug = config.enableDebug;
2191
- });
2192
- }
2193
- function _areInternalMessagesThrottled() {
2194
- return _messageCount >= _maxInternalMessageLimit;
2195
- }
2196
- function _debugExtMsg(name, data) {
2197
- var dbgExt = getDebugExt(config || {});
2198
- if (dbgExt && dbgExt[_DYN_DIAG_LOG ]) {
2199
- dbgExt[_DYN_DIAG_LOG ](name, data);
2200
- }
2201
- }
2202
- });
2203
- }
2204
- DiagnosticLogger.__ieDyn=1;
2205
- return DiagnosticLogger;
2206
- }());
2207
- function _getLogger(logger) {
2208
- return (logger || new DiagnosticLogger());
2209
- }
2210
- function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
2211
- if (isUserAct === void 0) { isUserAct = false; }
2212
- _getLogger(logger)[_DYN_THROW_INTERNAL ](severity, msgId, msg, properties, isUserAct);
2213
- }
2214
- function _warnToConsole(logger, message) {
2215
- _getLogger(logger)[_DYN_WARN_TO_CONSOLE ](message);
2216
- }
2217
- function _logInternalMessage(logger, severity, message) {
2218
- _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE ](severity, message);
2219
- }
2220
-
2221
- var rCamelCase = /-([a-z])/g;
2222
- var rNormalizeInvalid = /([^\w\d_$])/g;
2223
- var rLeadingNumeric = /^(\d+[\w\d_$])/;
2224
- function isNotNullOrUndefined(value) {
2225
- return !isNullOrUndefined(value);
2226
- }
2227
- function normalizeJsName(name) {
2228
- var value = name;
2229
- if (value && isString(value)) {
2230
- value = value[_DYN_REPLACE ](rCamelCase, function (_all, letter) {
2231
- return letter.toUpperCase();
2232
- });
2233
- value = value[_DYN_REPLACE ](rNormalizeInvalid, "_");
2234
- value = value[_DYN_REPLACE ](rLeadingNumeric, function (_all, match) {
2235
- return "_" + match;
2236
- });
2237
- }
2238
- return value;
2239
- }
2240
- function strContains(value, search) {
2241
- if (value && search) {
2242
- return strIndexOf(value, search) !== -1;
2243
- }
2244
- return false;
2245
- }
2246
- function toISOString(date) {
2247
- return date && date.toISOString() || "";
2248
- }
2249
- function getExceptionName(object) {
2250
- if (isError(object)) {
2251
- return object[_DYN_NAME ];
2252
- }
2253
- return STR_EMPTY$2;
2254
- }
2255
- function setValue(target, field, value, valChk, srcChk) {
2256
- var theValue = value;
2257
- if (target) {
2258
- theValue = target[field];
2259
- if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
2260
- theValue = value;
2261
- target[field] = theValue;
2262
- }
2263
- }
2264
- return theValue;
2265
- }
2266
- function getSetValue(target, field, defValue) {
2267
- var theValue;
2268
- if (target) {
2269
- theValue = target[field];
2270
- if (!theValue && isNullOrUndefined(theValue)) {
2271
- theValue = !isUndefined(defValue) ? defValue : {};
2272
- target[field] = theValue;
2273
- }
2274
- }
2275
- else {
2276
- theValue = !isUndefined(defValue) ? defValue : {};
2277
- }
2278
- return theValue;
2279
- }
2280
- function _createProxyFunction(source, funcName) {
2281
- var srcFunc = null;
2282
- var src = null;
2283
- if (isFunction(source)) {
2284
- srcFunc = source;
2285
- }
2286
- else {
2287
- src = source;
2288
- }
2289
- return function () {
2290
- var originalArguments = arguments;
2291
- if (srcFunc) {
2292
- src = srcFunc();
2293
- }
2294
- if (src) {
2295
- return src[funcName][_DYN_APPLY ](src, originalArguments);
2296
- }
2297
- };
2298
- }
2299
- function proxyAssign(target, source, chkSet) {
2300
- if (target && source && isObject(target) && isObject(source)) {
2301
- var _loop_1 = function (field) {
2302
- if (isString(field)) {
2303
- var value = source[field];
2304
- if (isFunction(value)) {
2305
- if (!chkSet || chkSet(field, true, source, target)) {
2306
- target[field] = _createProxyFunction(source, field);
2307
- }
2308
- }
2309
- else if (!chkSet || chkSet(field, false, source, target)) {
2310
- if (objHasOwn(target, field)) {
2311
- delete target[field];
2312
- }
2313
- objDefine(target, field, {
2314
- g: function () {
2315
- return source[field];
2316
- },
2317
- s: function (theValue) {
2318
- source[field] = theValue;
2319
- }
2320
- });
2321
- }
2322
- }
2323
- };
2324
- for (var field in source) {
2325
- _loop_1(field);
2326
- }
2327
- }
2328
- return target;
2329
- }
2330
- function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
2331
- if (target && name && source) {
2332
- if (overwriteTarget !== false || isUndefined(target[name])) {
2333
- target[name] = _createProxyFunction(source, theFunc);
2334
- }
2335
- }
2336
- }
2337
- function proxyFunctions(target, source, functionsToProxy, overwriteTarget) {
2338
- if (target && source && isObject(target) && isArray(functionsToProxy)) {
2339
- arrForEach(functionsToProxy, function (theFuncName) {
2340
- if (isString(theFuncName)) {
2341
- proxyFunctionAs(target, theFuncName, source, theFuncName, overwriteTarget);
2342
- }
2343
- });
2344
- }
2345
- return target;
2346
- }
2347
- function optimizeObject(theObject) {
2348
- if (theObject && objAssign) {
2349
- theObject = ObjClass$1(objAssign({}, theObject));
2350
- }
2351
- return theObject;
2352
- }
2353
- function getResponseText(xhr) {
2354
- try {
2355
- return xhr.responseText;
2356
- }
2357
- catch (e) {
2358
- }
2359
- return null;
2360
- }
2361
- function formatErrorMessageXdr(xdr, message) {
2362
- if (xdr) {
2363
- return "XDomainRequest,Response:" + getResponseText(xdr) || "";
2364
- }
2365
- return message;
2366
- }
2367
- function formatErrorMessageXhr(xhr, message) {
2368
- if (xhr) {
2369
- return "XMLHttpRequest,Status:" + xhr[_DYN_STATUS ] + ",Response:" + getResponseText(xhr) || xhr.response || "";
2370
- }
2371
- return message;
2372
- }
2373
- function prependTransports(theTransports, newTransports) {
2374
- if (newTransports) {
2375
- if (isNumber(newTransports)) {
2376
- theTransports = [newTransports].concat(theTransports);
2377
- }
2378
- else if (isArray(newTransports)) {
2379
- theTransports = newTransports.concat(theTransports);
2380
- }
2381
- }
2382
- return theTransports;
2383
- }
2384
- function parseResponse(response, diagLog) {
2385
- try {
2386
- if (response && response !== "") {
2387
- var result = getJSON().parse(response);
2388
- if (result && result[_DYN_ITEMS_RECEIVED ] && result[_DYN_ITEMS_RECEIVED ] >= result.itemsAccepted &&
2389
- result.itemsReceived - result.itemsAccepted === result.errors[_DYN_LENGTH$1 ]) {
2390
- return result;
2391
- }
2392
- }
2393
- }
2394
- catch (e) {
2395
- _throwInternal(diagLog, 1 , 43 , "Cannot parse the response. " + getExceptionName(e), {
2396
- response: response
2397
- });
2398
- }
2399
- return null;
2400
- }
2401
- var strDisabledPropertyName$1 = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2402
- var strWithCredentials$1 = "withCredentials";
2403
- var strTimeout$1 = "timeout";
2404
- function openXhr$1(method, urlString, withCredentials, disabled, isSync, timeout) {
2405
- if (disabled === void 0) { disabled = false; }
2406
- if (isSync === void 0) { isSync = false; }
2407
- function _wrapSetXhrProp(xhr, prop, value) {
2408
- try {
2409
- xhr[prop] = value;
2410
- }
2411
- catch (e) {
2412
- }
2413
- }
2414
- var xhr = new XMLHttpRequest();
2415
- if (disabled) {
2416
- _wrapSetXhrProp(xhr, strDisabledPropertyName$1, disabled);
2417
- }
2418
- if (withCredentials) {
2419
- _wrapSetXhrProp(xhr, strWithCredentials$1, withCredentials);
2420
- }
2421
- xhr.open(method, urlString, !isSync);
2422
- if (withCredentials) {
2423
- _wrapSetXhrProp(xhr, strWithCredentials$1, withCredentials);
2424
- }
2425
- if (!isSync && timeout) {
2426
- _wrapSetXhrProp(xhr, strTimeout$1, timeout);
2427
- }
2428
- return xhr;
2429
- }
2430
- function convertAllHeadersToMap(headersString) {
2431
- var headers = {};
2432
- if (isString(headersString)) {
2433
- var headersArray = strTrim(headersString)[_DYN_SPLIT ](/[\r\n]+/);
2434
- arrForEach(headersArray, function (headerEntry) {
2435
- if (headerEntry) {
2436
- var idx = headerEntry.indexOf(": ");
2437
- if (idx !== -1) {
2438
- var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE ]();
2439
- var value = strTrim(headerEntry.substring(idx + 1));
2440
- headers[header] = value;
2441
- }
2442
- else {
2443
- headers[strTrim(headerEntry)] = 1;
2444
- }
2445
- }
2446
- });
2447
- }
2448
- return headers;
2449
- }
2450
- function _appendHeader(theHeaders, xhr, name) {
2451
- if (!theHeaders[name] && xhr && xhr[_DYN_GET_RESPONSE_HEADER ]) {
2452
- var value = xhr[_DYN_GET_RESPONSE_HEADER ](name);
2453
- if (value) {
2454
- theHeaders[name] = strTrim(value);
2455
- }
2456
- }
2457
- return theHeaders;
2458
- }
2459
- var STR_KILL_DURATION_HEADER = "kill-duration";
2460
- var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds";
2461
- var STR_TIME_DELTA_HEADER = "time-delta-millis";
2462
- function _getAllResponseHeaders(xhr, isOneDs) {
2463
- var theHeaders = {};
2464
- if (!xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]) {
2465
- if (!!isOneDs) {
2466
- theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER);
2467
- theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER);
2468
- theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);
2469
- }
2470
- }
2471
- else {
2472
- theHeaders = convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA5 ]());
2473
- }
2474
- return theHeaders;
2475
- }
2476
-
2477
- var UInt32Mask = 0x100000000;
2478
- var MaxUInt32 = 0xffffffff;
2479
- var SEED1 = 123456789;
2480
- var SEED2 = 987654321;
2481
- var _mwcSeeded = false;
2482
- var _mwcW = SEED1;
2483
- var _mwcZ = SEED2;
2484
- function _mwcSeed(seedValue) {
2485
- if (seedValue < 0) {
2486
- seedValue >>>= 0;
2487
- }
2488
- _mwcW = (SEED1 + seedValue) & MaxUInt32;
2489
- _mwcZ = (SEED2 - seedValue) & MaxUInt32;
2490
- _mwcSeeded = true;
2491
- }
2492
- function _autoSeedMwc() {
2493
- try {
2494
- var now = utcNow() & 0x7fffffff;
2495
- _mwcSeed(((Math.random() * UInt32Mask) ^ now) + now);
2496
- }
2497
- catch (e) {
2498
- }
2499
- }
2500
- function randomValue(maxValue) {
2501
- if (maxValue > 0) {
2502
- return Math.floor((random32() / MaxUInt32) * (maxValue + 1)) >>> 0;
2503
- }
2504
- return 0;
2240
+ return 0;
2505
2241
  }
2506
2242
  function random32(signed) {
2507
2243
  var value = 0;
@@ -2897,369 +2633,597 @@ function _createDynamicProperty(state, theConfig, name, value) {
2897
2633
  isObjectOrArray = false;
2898
2634
  }
2899
2635
  }
2900
- else if (value && value[CFG_HANDLER_LINK]) {
2901
- objForEachKey(value, function (key) {
2902
- var getter = _getOwnPropGetter(value, key);
2903
- if (getter) {
2904
- var valueState = getter[state.prop];
2905
- valueState && valueState.chng();
2906
- }
2907
- });
2636
+ else if (value && value[CFG_HANDLER_LINK]) {
2637
+ objForEachKey(value, function (key) {
2638
+ var getter = _getOwnPropGetter(value, key);
2639
+ if (getter) {
2640
+ var valueState = getter[state.prop];
2641
+ valueState && valueState.chng();
2642
+ }
2643
+ });
2644
+ }
2645
+ }
2646
+ if (newValue !== value) {
2647
+ var newIsObjectOrArray = newValue && _canMakeDynamic(_getProperty, state, newValue);
2648
+ if (!isReferenced && newIsObjectOrArray) {
2649
+ newValue = _makeDynamicObject(state, newValue, name, "Converting");
2650
+ }
2651
+ value = newValue;
2652
+ isObjectOrArray = newIsObjectOrArray;
2653
+ }
2654
+ state.add(detail);
2655
+ }
2656
+ }
2657
+ objDefine(theConfig, detail.n, { g: _getProperty, s: _setProperty });
2658
+ }
2659
+ function _setDynamicProperty(state, target, name, value) {
2660
+ if (target) {
2661
+ var getter = _getOwnPropGetter(target, name);
2662
+ var isDynamic = getter && !!getter[state.prop];
2663
+ if (!isDynamic) {
2664
+ _createDynamicProperty(state, target, name, value);
2665
+ }
2666
+ else {
2667
+ target[name] = value;
2668
+ }
2669
+ }
2670
+ return target;
2671
+ }
2672
+ function _setDynamicPropertyState(state, target, name, flags) {
2673
+ if (target) {
2674
+ var getter = _getOwnPropGetter(target, name);
2675
+ var isDynamic = getter && !!getter[state.prop];
2676
+ var inPlace = flags && flags[0 ];
2677
+ var rdOnly = flags && flags[1 ];
2678
+ var blkProp = flags && flags[2 ];
2679
+ if (!isDynamic) {
2680
+ if (blkProp) {
2681
+ try {
2682
+ blockDynamicConversion(target);
2683
+ }
2684
+ catch (e) {
2685
+ _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, "Blocking", e);
2686
+ }
2687
+ }
2688
+ try {
2689
+ _setDynamicProperty(state, target, name, target[name]);
2690
+ getter = _getOwnPropGetter(target, name);
2691
+ }
2692
+ catch (e) {
2693
+ _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, "State", e);
2694
+ }
2695
+ }
2696
+ if (inPlace) {
2697
+ getter[state.rf] = inPlace;
2698
+ }
2699
+ if (rdOnly) {
2700
+ getter[state.ro] = rdOnly;
2701
+ }
2702
+ if (blkProp) {
2703
+ getter[state.blkVal] = true;
2704
+ }
2705
+ }
2706
+ return target;
2707
+ }
2708
+ function _makeDynamicObject(state, target, name, desc) {
2709
+ try {
2710
+ objForEachKey(target, function (key, value) {
2711
+ _setDynamicProperty(state, target, key, value);
2712
+ });
2713
+ if (!target[CFG_HANDLER_LINK]) {
2714
+ objDefineProp(target, CFG_HANDLER_LINK, {
2715
+ get: function () {
2716
+ return state[_DYN_HDLR ];
2717
+ }
2718
+ });
2719
+ _patchArray(state, target, name);
2720
+ }
2721
+ }
2722
+ catch (e) {
2723
+ _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, desc, e);
2724
+ }
2725
+ return target;
2726
+ }
2727
+
2728
+ var symPrefix = "[[ai_";
2729
+ var symPostfix = "]]";
2730
+ function _createState(cfgHandler) {
2731
+ var _a;
2732
+ var dynamicPropertySymbol = newSymbol(symPrefix + "get" + cfgHandler.uid + symPostfix);
2733
+ var dynamicPropertyReadOnly = newSymbol(symPrefix + "ro" + cfgHandler.uid + symPostfix);
2734
+ var dynamicPropertyReferenced = newSymbol(symPrefix + "rf" + cfgHandler.uid + symPostfix);
2735
+ var dynamicPropertyBlockValue = newSymbol(symPrefix + "blkVal" + cfgHandler.uid + symPostfix);
2736
+ var dynamicPropertyDetail = newSymbol(symPrefix + "dtl" + cfgHandler.uid + symPostfix);
2737
+ var _waitingHandlers = null;
2738
+ var _watcherTimer = null;
2739
+ var theState;
2740
+ function _useHandler(activeHandler, callback) {
2741
+ var prevWatcher = theState.act;
2742
+ try {
2743
+ theState.act = activeHandler;
2744
+ if (activeHandler && activeHandler[dynamicPropertyDetail]) {
2745
+ arrForEach(activeHandler[dynamicPropertyDetail], function (detail) {
2746
+ detail.clr(activeHandler);
2747
+ });
2748
+ activeHandler[dynamicPropertyDetail] = [];
2749
+ }
2750
+ callback({
2751
+ cfg: cfgHandler.cfg,
2752
+ set: cfgHandler.set.bind(cfgHandler),
2753
+ setDf: cfgHandler[_DYN_SET_DF ].bind(cfgHandler),
2754
+ ref: cfgHandler.ref.bind(cfgHandler),
2755
+ rdOnly: cfgHandler[_DYN_RD_ONLY ].bind(cfgHandler)
2756
+ });
2757
+ }
2758
+ catch (e) {
2759
+ var logger = cfgHandler[_DYN_LOGGER$1 ];
2760
+ if (logger) {
2761
+ logger[_DYN_THROW_INTERNAL ](1 , 107 , dumpObj(e));
2762
+ }
2763
+ throw e;
2764
+ }
2765
+ finally {
2766
+ theState.act = prevWatcher || null;
2767
+ }
2768
+ }
2769
+ function _notifyWatchers() {
2770
+ if (_waitingHandlers) {
2771
+ var notifyHandlers = _waitingHandlers;
2772
+ _waitingHandlers = null;
2773
+ _watcherTimer && _watcherTimer[_DYN_CANCEL ]();
2774
+ _watcherTimer = null;
2775
+ var watcherFailures_1 = [];
2776
+ arrForEach(notifyHandlers, function (handler) {
2777
+ if (handler) {
2778
+ if (handler[dynamicPropertyDetail]) {
2779
+ arrForEach(handler[dynamicPropertyDetail], function (detail) {
2780
+ detail.clr(handler);
2781
+ });
2782
+ handler[dynamicPropertyDetail] = null;
2783
+ }
2784
+ if (handler.fn) {
2785
+ try {
2786
+ _useHandler(handler, handler.fn);
2787
+ }
2788
+ catch (e) {
2789
+ watcherFailures_1[_DYN_PUSH ](e);
2790
+ }
2791
+ }
2792
+ }
2793
+ });
2794
+ if (_waitingHandlers) {
2795
+ try {
2796
+ _notifyWatchers();
2797
+ }
2798
+ catch (e) {
2799
+ watcherFailures_1[_DYN_PUSH ](e);
2908
2800
  }
2909
2801
  }
2910
- if (newValue !== value) {
2911
- var newIsObjectOrArray = newValue && _canMakeDynamic(_getProperty, state, newValue);
2912
- if (!isReferenced && newIsObjectOrArray) {
2913
- newValue = _makeDynamicObject(state, newValue, name, "Converting");
2802
+ if (watcherFailures_1[_DYN_LENGTH$1 ] > 0) {
2803
+ throwAggregationError("Watcher error(s): ", watcherFailures_1);
2804
+ }
2805
+ }
2806
+ }
2807
+ function _addWatcher(detail) {
2808
+ if (detail && detail.h[_DYN_LENGTH$1 ] > 0) {
2809
+ if (!_waitingHandlers) {
2810
+ _waitingHandlers = [];
2811
+ }
2812
+ if (!_watcherTimer) {
2813
+ _watcherTimer = scheduleTimeout(function () {
2814
+ _watcherTimer = null;
2815
+ _notifyWatchers();
2816
+ }, 0);
2817
+ }
2818
+ for (var idx = 0; idx < detail.h[_DYN_LENGTH$1 ]; idx++) {
2819
+ var handler = detail.h[idx];
2820
+ if (handler && arrIndexOf(_waitingHandlers, handler) === -1) {
2821
+ _waitingHandlers[_DYN_PUSH ](handler);
2914
2822
  }
2915
- value = newValue;
2916
- isObjectOrArray = newIsObjectOrArray;
2917
2823
  }
2918
- state.add(detail);
2919
2824
  }
2920
2825
  }
2921
- objDefine(theConfig, detail.n, { g: _getProperty, s: _setProperty });
2826
+ function _trackHandler(handler, detail) {
2827
+ if (handler) {
2828
+ var details = handler[dynamicPropertyDetail] = handler[dynamicPropertyDetail] || [];
2829
+ if (arrIndexOf(details, detail) === -1) {
2830
+ details[_DYN_PUSH ](detail);
2831
+ }
2832
+ }
2833
+ }
2834
+ theState = (_a = {
2835
+ prop: dynamicPropertySymbol,
2836
+ ro: dynamicPropertyReadOnly,
2837
+ rf: dynamicPropertyReferenced
2838
+ },
2839
+ _a[_DYN_BLK_VAL ] = dynamicPropertyBlockValue,
2840
+ _a[_DYN_HDLR ] = cfgHandler,
2841
+ _a.add = _addWatcher,
2842
+ _a[_DYN_NOTIFY ] = _notifyWatchers,
2843
+ _a.use = _useHandler,
2844
+ _a.trk = _trackHandler,
2845
+ _a);
2846
+ return theState;
2922
2847
  }
2923
- function _setDynamicProperty(state, target, name, value) {
2924
- if (target) {
2925
- var getter = _getOwnPropGetter(target, name);
2926
- var isDynamic = getter && !!getter[state.prop];
2927
- if (!isDynamic) {
2928
- _createDynamicProperty(state, target, name, value);
2848
+
2849
+ function _createAndUseHandler(state, configHandler) {
2850
+ var handler = {
2851
+ fn: configHandler,
2852
+ rm: function () {
2853
+ handler.fn = null;
2854
+ state = null;
2855
+ configHandler = null;
2929
2856
  }
2930
- else {
2931
- target[name] = value;
2857
+ };
2858
+ objDefine(handler, "toJSON", { v: function () { return "WatcherHandler" + (handler.fn ? "" : "[X]"); } });
2859
+ state.use(handler, configHandler);
2860
+ return handler;
2861
+ }
2862
+ function _createDynamicHandler(logger, target, inPlace) {
2863
+ var _a;
2864
+ var dynamicHandler = getDynamicConfigHandler(target);
2865
+ if (dynamicHandler) {
2866
+ return dynamicHandler;
2867
+ }
2868
+ var uid = createUniqueNamespace("dyncfg", true);
2869
+ var newTarget = (target && inPlace !== false) ? target : _cfgDeepCopy(target);
2870
+ var theState;
2871
+ function _notifyWatchers() {
2872
+ theState[_DYN_NOTIFY ]();
2873
+ }
2874
+ function _setValue(target, name, value) {
2875
+ try {
2876
+ target = _setDynamicProperty(theState, target, name, value);
2877
+ }
2878
+ catch (e) {
2879
+ _throwDynamicError(logger, name, "Setting value", e);
2932
2880
  }
2881
+ return target[name];
2933
2882
  }
2934
- return target;
2935
- }
2936
- function _setDynamicPropertyState(state, target, name, flags) {
2937
- if (target) {
2938
- var getter = _getOwnPropGetter(target, name);
2939
- var isDynamic = getter && !!getter[state.prop];
2940
- var inPlace = flags && flags[0 ];
2941
- var rdOnly = flags && flags[1 ];
2942
- var blkProp = flags && flags[2 ];
2943
- if (!isDynamic) {
2944
- if (blkProp) {
2945
- try {
2946
- blockDynamicConversion(target);
2947
- }
2948
- catch (e) {
2949
- _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, "Blocking", e);
2950
- }
2951
- }
2883
+ function _watch(configHandler) {
2884
+ return _createAndUseHandler(theState, configHandler);
2885
+ }
2886
+ function _block(configHandler, allowUpdate) {
2887
+ theState.use(null, function (details) {
2888
+ var prevUpd = theState.upd;
2952
2889
  try {
2953
- _setDynamicProperty(state, target, name, target[name]);
2954
- getter = _getOwnPropGetter(target, name);
2890
+ if (!isUndefined(allowUpdate)) {
2891
+ theState.upd = allowUpdate;
2892
+ }
2893
+ configHandler(details);
2955
2894
  }
2956
- catch (e) {
2957
- _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, "State", e);
2895
+ finally {
2896
+ theState.upd = prevUpd;
2958
2897
  }
2898
+ });
2899
+ }
2900
+ function _ref(target, name) {
2901
+ var _a;
2902
+ return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[0 ] = true, _a))[name];
2903
+ }
2904
+ function _rdOnly(target, name) {
2905
+ var _a;
2906
+ return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[1 ] = true, _a))[name];
2907
+ }
2908
+ function _blkPropValue(target, name) {
2909
+ var _a;
2910
+ return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[2 ] = true, _a))[name];
2911
+ }
2912
+ function _applyDefaults(theConfig, defaultValues) {
2913
+ if (defaultValues) {
2914
+ objForEachKey(defaultValues, function (name, value) {
2915
+ _applyDefaultValue(cfgHandler, theConfig, name, value);
2916
+ });
2959
2917
  }
2960
- if (inPlace) {
2961
- getter[state.rf] = inPlace;
2962
- }
2963
- if (rdOnly) {
2964
- getter[state.ro] = rdOnly;
2965
- }
2966
- if (blkProp) {
2967
- getter[state.blkVal] = true;
2918
+ return theConfig;
2919
+ }
2920
+ var cfgHandler = (_a = {
2921
+ uid: null,
2922
+ cfg: newTarget
2923
+ },
2924
+ _a[_DYN_LOGGER$1 ] = logger,
2925
+ _a[_DYN_NOTIFY ] = _notifyWatchers,
2926
+ _a.set = _setValue,
2927
+ _a[_DYN_SET_DF ] = _applyDefaults,
2928
+ _a[_DYN_WATCH ] = _watch,
2929
+ _a.ref = _ref,
2930
+ _a[_DYN_RD_ONLY ] = _rdOnly,
2931
+ _a[_DYN_BLK_VAL ] = _blkPropValue,
2932
+ _a._block = _block,
2933
+ _a);
2934
+ objDefine(cfgHandler, "uid", {
2935
+ c: false,
2936
+ e: false,
2937
+ w: false,
2938
+ v: uid
2939
+ });
2940
+ theState = _createState(cfgHandler);
2941
+ _makeDynamicObject(theState, newTarget, "config", "Creating");
2942
+ return cfgHandler;
2943
+ }
2944
+ function _logInvalidAccess(logger, message) {
2945
+ if (logger) {
2946
+ logger[_DYN_WARN_TO_CONSOLE ](message);
2947
+ logger[_DYN_THROW_INTERNAL ](2 , 108 , message);
2948
+ }
2949
+ else {
2950
+ throwInvalidAccess(message);
2951
+ }
2952
+ }
2953
+ function createDynamicConfig(config, defaultConfig, logger, inPlace) {
2954
+ var dynamicHandler = _createDynamicHandler(logger, config || {}, inPlace);
2955
+ if (defaultConfig) {
2956
+ dynamicHandler[_DYN_SET_DF ](dynamicHandler.cfg, defaultConfig);
2957
+ }
2958
+ return dynamicHandler;
2959
+ }
2960
+ function onConfigChange(config, configHandler, logger) {
2961
+ var handler = config[CFG_HANDLER_LINK] || config;
2962
+ if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) {
2963
+ return handler[_DYN_WATCH ](configHandler);
2964
+ }
2965
+ _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));
2966
+ return createDynamicConfig(config, null, logger)[_DYN_WATCH ](configHandler);
2967
+ }
2968
+
2969
+ function runTargetUnload(target, isAsync) {
2970
+ if (target && target[_DYN_UNLOAD ]) {
2971
+ return target[_DYN_UNLOAD ](isAsync);
2972
+ }
2973
+ }
2974
+ function doUnloadAll(targets, isAsync, done) {
2975
+ var result;
2976
+ if (!done) {
2977
+ result = createPromise(function (resolved) {
2978
+ done = resolved;
2979
+ });
2980
+ }
2981
+ if (targets && getLength(targets) > 0) {
2982
+ doAwaitResponse(runTargetUnload(targets[0], isAsync), function () {
2983
+ doUnloadAll(arrSlice(targets, 1), isAsync, done);
2984
+ });
2985
+ }
2986
+ else {
2987
+ done();
2988
+ }
2989
+ return result;
2990
+ }
2991
+
2992
+ var ChannelControllerPriority = 500;
2993
+ var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2994
+
2995
+ function cfgDfMerge(defaultValue) {
2996
+ return {
2997
+ mrg: true,
2998
+ v: defaultValue
2999
+ };
3000
+ }
3001
+
3002
+ var listenerFuncs = [STR_EVENTS_SENT, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_PERF_EVENT];
3003
+ var _aiNamespace = null;
3004
+ var _debugListener;
3005
+ function _listenerProxyFunc(name, config) {
3006
+ return function () {
3007
+ var args = arguments;
3008
+ var dbgExt = getDebugExt(config);
3009
+ if (dbgExt) {
3010
+ var listener = dbgExt.listener;
3011
+ if (listener && listener[name]) {
3012
+ listener[name][_DYN_APPLY ](listener, args);
3013
+ }
2968
3014
  }
3015
+ };
3016
+ }
3017
+ function _getExtensionNamespace() {
3018
+ var target = getInst("Microsoft");
3019
+ if (target) {
3020
+ _aiNamespace = target["ApplicationInsights"];
2969
3021
  }
2970
- return target;
3022
+ return _aiNamespace;
2971
3023
  }
2972
- function _makeDynamicObject(state, target, name, desc) {
2973
- try {
2974
- objForEachKey(target, function (key, value) {
2975
- _setDynamicProperty(state, target, key, value);
2976
- });
2977
- if (!target[CFG_HANDLER_LINK]) {
2978
- objDefineProp(target, CFG_HANDLER_LINK, {
2979
- get: function () {
2980
- return state[_DYN_HDLR ];
2981
- }
2982
- });
2983
- _patchArray(state, target, name);
2984
- }
3024
+ function getDebugExt(config) {
3025
+ var ns = _aiNamespace;
3026
+ if (!ns && config.disableDbgExt !== true) {
3027
+ ns = _aiNamespace || _getExtensionNamespace();
2985
3028
  }
2986
- catch (e) {
2987
- _throwDynamicError((state.hdlr || {})[_DYN_LOGGER$1 ], name, desc, e);
3029
+ return ns ? ns["ChromeDbgExt"] : null;
3030
+ }
3031
+ function getDebugListener(config) {
3032
+ if (!_debugListener) {
3033
+ _debugListener = {};
3034
+ for (var lp = 0; lp < listenerFuncs[_DYN_LENGTH$1 ]; lp++) {
3035
+ _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config);
3036
+ }
2988
3037
  }
2989
- return target;
3038
+ return _debugListener;
2990
3039
  }
2991
3040
 
2992
- var symPrefix = "[[ai_";
2993
- var symPostfix = "]]";
2994
- function _createState(cfgHandler) {
2995
- var _a;
2996
- var dynamicPropertySymbol = newSymbol(symPrefix + "get" + cfgHandler.uid + symPostfix);
2997
- var dynamicPropertyReadOnly = newSymbol(symPrefix + "ro" + cfgHandler.uid + symPostfix);
2998
- var dynamicPropertyReferenced = newSymbol(symPrefix + "rf" + cfgHandler.uid + symPostfix);
2999
- var dynamicPropertyBlockValue = newSymbol(symPrefix + "blkVal" + cfgHandler.uid + symPostfix);
3000
- var dynamicPropertyDetail = newSymbol(symPrefix + "dtl" + cfgHandler.uid + symPostfix);
3001
- var _waitingHandlers = null;
3002
- var _watcherTimer = null;
3003
- var theState;
3004
- function _useHandler(activeHandler, callback) {
3005
- var prevWatcher = theState.act;
3006
- try {
3007
- theState.act = activeHandler;
3008
- if (activeHandler && activeHandler[dynamicPropertyDetail]) {
3009
- arrForEach(activeHandler[dynamicPropertyDetail], function (detail) {
3010
- detail.clr(activeHandler);
3011
- });
3012
- activeHandler[dynamicPropertyDetail] = [];
3013
- }
3014
- callback({
3015
- cfg: cfgHandler.cfg,
3016
- set: cfgHandler.set.bind(cfgHandler),
3017
- setDf: cfgHandler[_DYN_SET_DF ].bind(cfgHandler),
3018
- ref: cfgHandler.ref.bind(cfgHandler),
3019
- rdOnly: cfgHandler[_DYN_RD_ONLY ].bind(cfgHandler)
3020
- });
3041
+ var _a$4;
3042
+ var STR_WARN_TO_CONSOLE = "warnToConsole";
3043
+ var AiNonUserActionablePrefix = "AI (Internal): ";
3044
+ var AiUserActionablePrefix = "AI: ";
3045
+ var AIInternalMessagePrefix = "AITR_";
3046
+ var defaultValues$2 = {
3047
+ loggingLevelConsole: 0,
3048
+ loggingLevelTelemetry: 1,
3049
+ maxMessageLimit: 25,
3050
+ enableDebug: false
3051
+ };
3052
+ var _logFuncs = (_a$4 = {},
3053
+ _a$4[0 ] = null,
3054
+ _a$4[1 ] = "errorToConsole",
3055
+ _a$4[2 ] = STR_WARN_TO_CONSOLE,
3056
+ _a$4[3 ] = "debugToConsole",
3057
+ _a$4);
3058
+ function _sanitizeDiagnosticText(text) {
3059
+ if (text) {
3060
+ return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$2) + "\"";
3061
+ }
3062
+ return STR_EMPTY$2;
3063
+ }
3064
+ function _logToConsole(func, message) {
3065
+ var theConsole = getConsole();
3066
+ if (!!theConsole) {
3067
+ var logFunc = "log";
3068
+ if (theConsole[func]) {
3069
+ logFunc = func;
3021
3070
  }
3022
- catch (e) {
3023
- var logger = cfgHandler[_DYN_LOGGER$1 ];
3024
- if (logger) {
3025
- logger[_DYN_THROW_INTERNAL ](1 , 107 , dumpObj(e));
3026
- }
3027
- throw e;
3071
+ if (isFunction(theConsole[logFunc])) {
3072
+ theConsole[logFunc](message);
3028
3073
  }
3029
- finally {
3030
- theState.act = prevWatcher || null;
3074
+ }
3075
+ }
3076
+ var _InternalLogMessage = /** @class */ (function () {
3077
+ function _InternalLogMessage(msgId, msg, isUserAct, properties) {
3078
+ if (isUserAct === void 0) { isUserAct = false; }
3079
+ var _self = this;
3080
+ _self[_DYN_MESSAGE_ID ] = msgId;
3081
+ _self[_DYN_MESSAGE ] =
3082
+ (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
3083
+ msgId;
3084
+ var strProps = STR_EMPTY$2;
3085
+ if (hasJSON()) {
3086
+ strProps = getJSON().stringify(properties);
3031
3087
  }
3088
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$2) +
3089
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$2);
3090
+ _self[_DYN_MESSAGE ] += diagnosticText;
3032
3091
  }
3033
- function _notifyWatchers() {
3034
- if (_waitingHandlers) {
3035
- var notifyHandlers = _waitingHandlers;
3036
- _waitingHandlers = null;
3037
- _watcherTimer && _watcherTimer[_DYN_CANCEL ]();
3038
- _watcherTimer = null;
3039
- var watcherFailures_1 = [];
3040
- arrForEach(notifyHandlers, function (handler) {
3041
- if (handler) {
3042
- if (handler[dynamicPropertyDetail]) {
3043
- arrForEach(handler[dynamicPropertyDetail], function (detail) {
3044
- detail.clr(handler);
3045
- });
3046
- handler[dynamicPropertyDetail] = null;
3047
- }
3048
- if (handler.fn) {
3049
- try {
3050
- _useHandler(handler, handler.fn);
3092
+ _InternalLogMessage.dataType = "MessageData";
3093
+ return _InternalLogMessage;
3094
+ }());
3095
+ function safeGetLogger(core, config) {
3096
+ return (core || {})[_DYN_LOGGER$1 ] || new DiagnosticLogger(config);
3097
+ }
3098
+ var DiagnosticLogger = /** @class */ (function () {
3099
+ function DiagnosticLogger(config) {
3100
+ this.identifier = "DiagnosticLogger";
3101
+ this.queue = [];
3102
+ var _messageCount = 0;
3103
+ var _messageLogged = {};
3104
+ var _loggingLevelConsole;
3105
+ var _loggingLevelTelemetry;
3106
+ var _maxInternalMessageLimit;
3107
+ var _enableDebug;
3108
+ var _unloadHandler;
3109
+ dynamicProto(DiagnosticLogger, this, function (_self) {
3110
+ _unloadHandler = _setDefaultsFromConfig(config || {});
3111
+ _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
3112
+ _self[_DYN_THROW_INTERNAL ] = function (severity, msgId, msg, properties, isUserAct) {
3113
+ if (isUserAct === void 0) { isUserAct = false; }
3114
+ var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
3115
+ if (_enableDebug) {
3116
+ throw dumpObj(message);
3117
+ }
3118
+ else {
3119
+ var logFunc = _logFuncs[severity] || STR_WARN_TO_CONSOLE;
3120
+ if (!isUndefined(message[_DYN_MESSAGE ])) {
3121
+ if (isUserAct) {
3122
+ var messageKey = +message[_DYN_MESSAGE_ID ];
3123
+ if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) {
3124
+ _self[logFunc](message[_DYN_MESSAGE ]);
3125
+ _messageLogged[messageKey] = true;
3126
+ }
3051
3127
  }
3052
- catch (e) {
3053
- watcherFailures_1[_DYN_PUSH ](e);
3128
+ else {
3129
+ if (_loggingLevelConsole >= severity) {
3130
+ _self[logFunc](message[_DYN_MESSAGE ]);
3131
+ }
3054
3132
  }
3133
+ _logInternalMessage(severity, message);
3134
+ }
3135
+ else {
3136
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
3055
3137
  }
3056
3138
  }
3057
- });
3058
- if (_waitingHandlers) {
3059
- try {
3060
- _notifyWatchers();
3139
+ };
3140
+ _self.debugToConsole = function (message) {
3141
+ _logToConsole("debug", message);
3142
+ _debugExtMsg("warning", message);
3143
+ };
3144
+ _self[_DYN_WARN_TO_CONSOLE ] = function (message) {
3145
+ _logToConsole("warn", message);
3146
+ _debugExtMsg("warning", message);
3147
+ };
3148
+ _self.errorToConsole = function (message) {
3149
+ _logToConsole("error", message);
3150
+ _debugExtMsg("error", message);
3151
+ };
3152
+ _self.resetInternalMessageCount = function () {
3153
+ _messageCount = 0;
3154
+ _messageLogged = {};
3155
+ };
3156
+ _self[_DYN_LOG_INTERNAL_MESSAGE ] = _logInternalMessage;
3157
+ _self[_DYN_UNLOAD ] = function (isAsync) {
3158
+ _unloadHandler && _unloadHandler.rm();
3159
+ _unloadHandler = null;
3160
+ };
3161
+ function _logInternalMessage(severity, message) {
3162
+ if (_areInternalMessagesThrottled()) {
3163
+ return;
3061
3164
  }
3062
- catch (e) {
3063
- watcherFailures_1[_DYN_PUSH ](e);
3165
+ var logMessage = true;
3166
+ var messageKey = AIInternalMessagePrefix + message[_DYN_MESSAGE_ID ];
3167
+ if (_messageLogged[messageKey]) {
3168
+ logMessage = false;
3064
3169
  }
3065
- }
3066
- if (watcherFailures_1[_DYN_LENGTH$1 ] > 0) {
3067
- throwAggregationError("Watcher error(s): ", watcherFailures_1);
3068
- }
3069
- }
3070
- }
3071
- function _addWatcher(detail) {
3072
- if (detail && detail.h[_DYN_LENGTH$1 ] > 0) {
3073
- if (!_waitingHandlers) {
3074
- _waitingHandlers = [];
3075
- }
3076
- if (!_watcherTimer) {
3077
- _watcherTimer = scheduleTimeout(function () {
3078
- _watcherTimer = null;
3079
- _notifyWatchers();
3080
- }, 0);
3081
- }
3082
- for (var idx = 0; idx < detail.h[_DYN_LENGTH$1 ]; idx++) {
3083
- var handler = detail.h[idx];
3084
- if (handler && arrIndexOf(_waitingHandlers, handler) === -1) {
3085
- _waitingHandlers[_DYN_PUSH ](handler);
3170
+ else {
3171
+ _messageLogged[messageKey] = true;
3172
+ }
3173
+ if (logMessage) {
3174
+ if (severity <= _loggingLevelTelemetry) {
3175
+ _self.queue[_DYN_PUSH ](message);
3176
+ _messageCount++;
3177
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
3178
+ }
3179
+ if (_messageCount === _maxInternalMessageLimit) {
3180
+ var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
3181
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
3182
+ _self.queue[_DYN_PUSH ](throttleMessage);
3183
+ if (severity === 1 ) {
3184
+ _self.errorToConsole(throttleLimitMessage);
3185
+ }
3186
+ else {
3187
+ _self[_DYN_WARN_TO_CONSOLE ](throttleLimitMessage);
3188
+ }
3189
+ }
3086
3190
  }
3087
3191
  }
3088
- }
3089
- }
3090
- function _trackHandler(handler, detail) {
3091
- if (handler) {
3092
- var details = handler[dynamicPropertyDetail] = handler[dynamicPropertyDetail] || [];
3093
- if (arrIndexOf(details, detail) === -1) {
3094
- details[_DYN_PUSH ](detail);
3192
+ function _setDefaultsFromConfig(config) {
3193
+ return onConfigChange(createDynamicConfig(config, defaultValues$2, _self).cfg, function (details) {
3194
+ var config = details.cfg;
3195
+ _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 ];
3196
+ _loggingLevelTelemetry = config.loggingLevelTelemetry;
3197
+ _maxInternalMessageLimit = config.maxMessageLimit;
3198
+ _enableDebug = config.enableDebug;
3199
+ });
3095
3200
  }
3096
- }
3097
- }
3098
- theState = (_a = {
3099
- prop: dynamicPropertySymbol,
3100
- ro: dynamicPropertyReadOnly,
3101
- rf: dynamicPropertyReferenced
3102
- },
3103
- _a[_DYN_BLK_VAL ] = dynamicPropertyBlockValue,
3104
- _a[_DYN_HDLR ] = cfgHandler,
3105
- _a.add = _addWatcher,
3106
- _a[_DYN_NOTIFY ] = _notifyWatchers,
3107
- _a.use = _useHandler,
3108
- _a.trk = _trackHandler,
3109
- _a);
3110
- return theState;
3111
- }
3112
-
3113
- function _createAndUseHandler(state, configHandler) {
3114
- var handler = {
3115
- fn: configHandler,
3116
- rm: function () {
3117
- handler.fn = null;
3118
- state = null;
3119
- configHandler = null;
3120
- }
3121
- };
3122
- state.use(handler, configHandler);
3123
- return handler;
3124
- }
3125
- function _createDynamicHandler(logger, target, inPlace) {
3126
- var _a;
3127
- var dynamicHandler = getDynamicConfigHandler(target);
3128
- if (dynamicHandler) {
3129
- return dynamicHandler;
3130
- }
3131
- var uid = createUniqueNamespace("dyncfg", true);
3132
- var newTarget = (target && inPlace !== false) ? target : _cfgDeepCopy(target);
3133
- var theState;
3134
- function _notifyWatchers() {
3135
- theState[_DYN_NOTIFY ]();
3136
- }
3137
- function _setValue(target, name, value) {
3138
- try {
3139
- target = _setDynamicProperty(theState, target, name, value);
3140
- }
3141
- catch (e) {
3142
- _throwDynamicError(logger, name, "Setting value", e);
3143
- }
3144
- return target[name];
3145
- }
3146
- function _watch(configHandler) {
3147
- return _createAndUseHandler(theState, configHandler);
3148
- }
3149
- function _block(configHandler, allowUpdate) {
3150
- theState.use(null, function (details) {
3151
- var prevUpd = theState.upd;
3152
- try {
3153
- if (!isUndefined(allowUpdate)) {
3154
- theState.upd = allowUpdate;
3155
- }
3156
- configHandler(details);
3201
+ function _areInternalMessagesThrottled() {
3202
+ return _messageCount >= _maxInternalMessageLimit;
3157
3203
  }
3158
- finally {
3159
- theState.upd = prevUpd;
3204
+ function _debugExtMsg(name, data) {
3205
+ var dbgExt = getDebugExt(config || {});
3206
+ if (dbgExt && dbgExt[_DYN_DIAG_LOG ]) {
3207
+ dbgExt[_DYN_DIAG_LOG ](name, data);
3208
+ }
3160
3209
  }
3161
3210
  });
3162
3211
  }
3163
- function _ref(target, name) {
3164
- var _a;
3165
- return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[0 ] = true, _a))[name];
3166
- }
3167
- function _rdOnly(target, name) {
3168
- var _a;
3169
- return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[1 ] = true, _a))[name];
3170
- }
3171
- function _blkPropValue(target, name) {
3172
- var _a;
3173
- return _setDynamicPropertyState(theState, target, name, (_a = {}, _a[2 ] = true, _a))[name];
3174
- }
3175
- function _applyDefaults(theConfig, defaultValues) {
3176
- if (defaultValues) {
3177
- objForEachKey(defaultValues, function (name, value) {
3178
- _applyDefaultValue(cfgHandler, theConfig, name, value);
3179
- });
3180
- }
3181
- return theConfig;
3182
- }
3183
- var cfgHandler = (_a = {
3184
- uid: null,
3185
- cfg: newTarget
3186
- },
3187
- _a[_DYN_LOGGER$1 ] = logger,
3188
- _a[_DYN_NOTIFY ] = _notifyWatchers,
3189
- _a.set = _setValue,
3190
- _a[_DYN_SET_DF ] = _applyDefaults,
3191
- _a[_DYN_WATCH ] = _watch,
3192
- _a.ref = _ref,
3193
- _a[_DYN_RD_ONLY ] = _rdOnly,
3194
- _a[_DYN_BLK_VAL ] = _blkPropValue,
3195
- _a._block = _block,
3196
- _a);
3197
- objDefine(cfgHandler, "uid", {
3198
- c: false,
3199
- e: false,
3200
- w: false,
3201
- v: uid
3202
- });
3203
- theState = _createState(cfgHandler);
3204
- _makeDynamicObject(theState, newTarget, "config", "Creating");
3205
- return cfgHandler;
3206
- }
3207
- function _logInvalidAccess(logger, message) {
3208
- if (logger) {
3209
- logger[_DYN_WARN_TO_CONSOLE ](message);
3210
- logger[_DYN_THROW_INTERNAL ](2 , 108 , message);
3211
- }
3212
- else {
3213
- throwInvalidAccess(message);
3214
- }
3215
- }
3216
- function createDynamicConfig(config, defaultConfig, logger, inPlace) {
3217
- var dynamicHandler = _createDynamicHandler(logger, config || {}, inPlace);
3218
- if (defaultConfig) {
3219
- dynamicHandler[_DYN_SET_DF ](dynamicHandler.cfg, defaultConfig);
3220
- }
3221
- return dynamicHandler;
3222
- }
3223
- function onConfigChange(config, configHandler, logger) {
3224
- var handler = config[CFG_HANDLER_LINK] || config;
3225
- if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) {
3226
- return handler[_DYN_WATCH ](configHandler);
3227
- }
3228
- _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));
3229
- return createDynamicConfig(config, null, logger)[_DYN_WATCH ](configHandler);
3212
+ DiagnosticLogger.__ieDyn=1;
3213
+ return DiagnosticLogger;
3214
+ }());
3215
+ function _getLogger(logger) {
3216
+ return (logger || new DiagnosticLogger());
3230
3217
  }
3231
-
3232
- function runTargetUnload(target, isAsync) {
3233
- if (target && target[_DYN_UNLOAD ]) {
3234
- return target[_DYN_UNLOAD ](isAsync);
3235
- }
3218
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
3219
+ if (isUserAct === void 0) { isUserAct = false; }
3220
+ _getLogger(logger)[_DYN_THROW_INTERNAL ](severity, msgId, msg, properties, isUserAct);
3236
3221
  }
3237
- function doUnloadAll(targets, isAsync, done) {
3238
- var result;
3239
- if (!done) {
3240
- result = createPromise(function (resolved) {
3241
- done = resolved;
3242
- });
3243
- }
3244
- if (targets && getLength(targets) > 0) {
3245
- doAwaitResponse(runTargetUnload(targets[0], isAsync), function () {
3246
- doUnloadAll(arrSlice(targets, 1), isAsync, done);
3247
- });
3248
- }
3249
- else {
3250
- done();
3251
- }
3252
- return result;
3222
+ function _warnToConsole(logger, message) {
3223
+ _getLogger(logger)[_DYN_WARN_TO_CONSOLE ](message);
3253
3224
  }
3254
-
3255
- var ChannelControllerPriority = 500;
3256
- var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
3257
-
3258
- function cfgDfMerge(defaultValue) {
3259
- return {
3260
- mrg: true,
3261
- v: defaultValue
3262
- };
3225
+ function _logInternalMessage(logger, severity, message) {
3226
+ _getLogger(logger)[_DYN_LOG_INTERNAL_MESSAGE ](severity, message);
3263
3227
  }
3264
3228
 
3265
3229
  var _a$3, _b;
@@ -3561,18 +3525,26 @@ function uaDisallowsSameSiteNone(userAgent) {
3561
3525
  var defaultValues$1 = {
3562
3526
  perfEvtsSendAll: false
3563
3527
  };
3564
- function _runListeners(listeners, name, isAsync, callback) {
3528
+ function _runScheduledListeners(asyncNotifications) {
3529
+ asyncNotifications.h = null;
3530
+ var callbacks = asyncNotifications.cb;
3531
+ asyncNotifications.cb = [];
3532
+ arrForEach(callbacks, function (cb) {
3533
+ safe(cb.fn, [cb.arg]);
3534
+ });
3535
+ }
3536
+ function _runListeners(listeners, name, asyncNotifications, callback) {
3565
3537
  arrForEach(listeners, function (listener) {
3566
3538
  if (listener && listener[name]) {
3567
- if (isAsync) {
3568
- scheduleTimeout(function () { return callback(listener); }, 0);
3539
+ if (asyncNotifications) {
3540
+ asyncNotifications.cb[_DYN_PUSH ]({
3541
+ fn: callback,
3542
+ arg: listener
3543
+ });
3544
+ asyncNotifications.h = asyncNotifications.h || scheduleTimeout(_runScheduledListeners, 0, asyncNotifications);
3569
3545
  }
3570
3546
  else {
3571
- try {
3572
- callback(listener);
3573
- }
3574
- catch (e) {
3575
- }
3547
+ safe(callback, [listener]);
3576
3548
  }
3577
3549
  }
3578
3550
  });
@@ -3583,6 +3555,10 @@ var NotificationManager = /** @class */ (function () {
3583
3555
  var perfEvtsSendAll;
3584
3556
  var unloadHandler;
3585
3557
  var _listeners = [];
3558
+ var _asyncNotifications = {
3559
+ h: null,
3560
+ cb: []
3561
+ };
3586
3562
  var cfgHandler = createDynamicConfig(config, defaultValues$1);
3587
3563
  unloadHandler = cfgHandler[_DYN_WATCH ](function (details) {
3588
3564
  perfEvtsSendAll = !!details.cfg.perfEvtsSendAll;
@@ -3594,7 +3570,7 @@ var NotificationManager = /** @class */ (function () {
3594
3570
  _self[_DYN_ADD_NOTIFICATION_LIS1 ] = function (listener) {
3595
3571
  _listeners[_DYN_PUSH ](listener);
3596
3572
  };
3597
- _self[_DYN_REMOVE_NOTIFICATION_2 ] = function (listener) {
3573
+ _self[_DYN_REMOVE_NOTIFICATION_0 ] = function (listener) {
3598
3574
  var index = arrIndexOf(_listeners, listener);
3599
3575
  while (index > -1) {
3600
3576
  _listeners[_DYN_SPLICE ](index, 1);
@@ -3602,24 +3578,24 @@ var NotificationManager = /** @class */ (function () {
3602
3578
  }
3603
3579
  };
3604
3580
  _self[STR_EVENTS_SENT ] = function (events) {
3605
- _runListeners(_listeners, STR_EVENTS_SENT, true, function (listener) {
3581
+ _runListeners(_listeners, STR_EVENTS_SENT, _asyncNotifications, function (listener) {
3606
3582
  listener[STR_EVENTS_SENT ](events);
3607
3583
  });
3608
3584
  };
3609
3585
  _self[STR_EVENTS_DISCARDED ] = function (events, reason) {
3610
- _runListeners(_listeners, STR_EVENTS_DISCARDED, true, function (listener) {
3586
+ _runListeners(_listeners, STR_EVENTS_DISCARDED, _asyncNotifications, function (listener) {
3611
3587
  listener[STR_EVENTS_DISCARDED ](events, reason);
3612
3588
  });
3613
3589
  };
3614
3590
  _self[STR_EVENTS_SEND_REQUEST ] = function (sendReason, isAsync) {
3615
- _runListeners(_listeners, STR_EVENTS_SEND_REQUEST, isAsync, function (listener) {
3591
+ _runListeners(_listeners, STR_EVENTS_SEND_REQUEST, isAsync ? _asyncNotifications : null, function (listener) {
3616
3592
  listener[STR_EVENTS_SEND_REQUEST ](sendReason, isAsync);
3617
3593
  });
3618
3594
  };
3619
3595
  _self[STR_PERF_EVENT ] = function (perfEvent) {
3620
3596
  if (perfEvent) {
3621
3597
  if (perfEvtsSendAll || !perfEvent[_DYN_IS_CHILD_EVT ]()) {
3622
- _runListeners(_listeners, STR_PERF_EVENT, false, function (listener) {
3598
+ _runListeners(_listeners, STR_PERF_EVENT, null, function (listener) {
3623
3599
  if (perfEvent[_DYN_IS_ASYNC ]) {
3624
3600
  scheduleTimeout(function () { return listener[STR_PERF_EVENT ](perfEvent); }, 0);
3625
3601
  }
@@ -3632,14 +3608,14 @@ var NotificationManager = /** @class */ (function () {
3632
3608
  };
3633
3609
  _self[STR_OFFLINE_STORE ] = function (events) {
3634
3610
  if (events && events[_DYN_LENGTH$1 ]) {
3635
- _runListeners(_listeners, STR_OFFLINE_STORE, true, function (listener) {
3611
+ _runListeners(_listeners, STR_OFFLINE_STORE, _asyncNotifications, function (listener) {
3636
3612
  listener[STR_OFFLINE_STORE ](events);
3637
3613
  });
3638
3614
  }
3639
3615
  };
3640
3616
  _self[STR_OFFLINE_SENT ] = function (batch) {
3641
3617
  if (batch && batch[_DYN_DATA ]) {
3642
- _runListeners(_listeners, STR_OFFLINE_SENT, true, function (listener) {
3618
+ _runListeners(_listeners, STR_OFFLINE_SENT, _asyncNotifications, function (listener) {
3643
3619
  listener[STR_OFFLINE_SENT ](batch);
3644
3620
  });
3645
3621
  }
@@ -3647,7 +3623,7 @@ var NotificationManager = /** @class */ (function () {
3647
3623
  _self[STR_OFFLINE_DROP ] = function (cnt, reason) {
3648
3624
  if (cnt > 0) {
3649
3625
  var rn_1 = reason || 0;
3650
- _runListeners(_listeners, STR_OFFLINE_DROP, true, function (listener) {
3626
+ _runListeners(_listeners, STR_OFFLINE_DROP, _asyncNotifications, function (listener) {
3651
3627
  listener[STR_OFFLINE_DROP ](cnt, rn_1);
3652
3628
  });
3653
3629
  }
@@ -3657,9 +3633,12 @@ var NotificationManager = /** @class */ (function () {
3657
3633
  unloadHandler && unloadHandler.rm();
3658
3634
  unloadHandler = null;
3659
3635
  _listeners = [];
3636
+ _asyncNotifications.h && _asyncNotifications.h[_DYN_CANCEL ]();
3637
+ _asyncNotifications.h = null;
3638
+ _asyncNotifications.cb = [];
3660
3639
  };
3661
3640
  var waiting;
3662
- _runListeners(_listeners, "unload", false, function (listener) {
3641
+ _runListeners(_listeners, "unload", null, function (listener) {
3663
3642
  var asyncUnload = listener[_DYN_UNLOAD ](isAsync);
3664
3643
  if (asyncUnload) {
3665
3644
  if (!waiting) {
@@ -4452,6 +4431,12 @@ function createUnloadHandlerContainer() {
4452
4431
  };
4453
4432
  }
4454
4433
 
4434
+ var _maxHooks;
4435
+ var _hookAddMonitor;
4436
+ function _testHookMaxUnloadHooksCb(maxHooks, addMonitor) {
4437
+ _maxHooks = maxHooks;
4438
+ _hookAddMonitor = addMonitor;
4439
+ }
4455
4440
  function createUnloadHookContainer() {
4456
4441
  var _hooks = [];
4457
4442
  function _doUnload(logger) {
@@ -4465,10 +4450,16 @@ function createUnloadHookContainer() {
4465
4450
  _throwInternal(logger, 2 , 73 , "Unloading:" + dumpObj(e));
4466
4451
  }
4467
4452
  });
4453
+ if (_maxHooks && oldHooks[_DYN_LENGTH$1 ] > _maxHooks) {
4454
+ _hookAddMonitor ? _hookAddMonitor("doUnload", oldHooks) : _throwInternal(null, 1 , 48 , "Max unload hooks exceeded. An excessive number of unload hooks has been detected.");
4455
+ }
4468
4456
  }
4469
4457
  function _addHook(hooks) {
4470
4458
  if (hooks) {
4471
4459
  arrAppend(_hooks, hooks);
4460
+ if (_maxHooks && _hooks[_DYN_LENGTH$1 ] > _maxHooks) {
4461
+ _hookAddMonitor ? _hookAddMonitor("Add", _hooks) : _throwInternal(null, 1 , 48 , "Max unload hooks exceeded. An excessive number of unload hooks has been detected.");
4462
+ }
4472
4463
  }
4473
4464
  }
4474
4465
  return {
@@ -4596,7 +4587,7 @@ var BaseTelemetryPlugin = /** @class */ (function () {
4596
4587
  function _setDefaults(config, core, pluginChain) {
4597
4588
  createDynamicConfig(config, defaultValues, safeGetLogger(core));
4598
4589
  if (!pluginChain && core) {
4599
- pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 ]()[_DYN_GET_NEXT ]();
4590
+ pluginChain = core[_DYN_GET_PROCESS_TEL_CONT2 ]()[_DYN_GET_NEXT ]();
4600
4591
  }
4601
4592
  var nextPlugin = _nextPlugin;
4602
4593
  if (_nextPlugin && _nextPlugin[strGetPlugin]) {
@@ -4800,6 +4791,27 @@ function _registerDelayedCfgListener(config, listeners, logger) {
4800
4791
  };
4801
4792
  });
4802
4793
  }
4794
+ function _initDebugListener(configHandler, unloadContainer, notificationManager, debugListener) {
4795
+ unloadContainer.add(configHandler[_DYN_WATCH ](function (details) {
4796
+ var disableDbgExt = details.cfg.disableDbgExt;
4797
+ if (disableDbgExt === true && debugListener) {
4798
+ notificationManager[_DYN_REMOVE_NOTIFICATION_0 ](debugListener);
4799
+ debugListener = null;
4800
+ }
4801
+ if (notificationManager && !debugListener && disableDbgExt !== true) {
4802
+ debugListener = getDebugListener(details.cfg);
4803
+ notificationManager[_DYN_ADD_NOTIFICATION_LIS1 ](debugListener);
4804
+ }
4805
+ }));
4806
+ return debugListener;
4807
+ }
4808
+ function _createUnloadHook(unloadHook) {
4809
+ return objDefine({
4810
+ rm: function () {
4811
+ unloadHook.rm();
4812
+ }
4813
+ }, "toJSON", { v: function () { return "aicore::onCfgChange<" + JSON.stringify(unloadHook) + ">"; } });
4814
+ }
4803
4815
  var AppInsightsCore$1 = /** @class */ (function () {
4804
4816
  function AppInsightsCore() {
4805
4817
  var _configHandler;
@@ -4856,7 +4868,7 @@ var AppInsightsCore$1 = /** @class */ (function () {
4856
4868
  }
4857
4869
  }));
4858
4870
  _notificationManager = notificationManager;
4859
- _initDebugListener();
4871
+ _debugListener = _initDebugListener(_configHandler, _hookContainer, _notificationManager && _self[_DYN_GET_NOTIFY_MGR ](), _debugListener);
4860
4872
  _initPerfManager();
4861
4873
  _self[_DYN_LOGGER$1 ] = logger;
4862
4874
  var cfgExtensions = config[STR_EXTENSIONS ];
@@ -4909,7 +4921,7 @@ var AppInsightsCore$1 = /** @class */ (function () {
4909
4921
  }
4910
4922
  }, function () { return ({ item: telemetryItem }); }, !(telemetryItem.sync));
4911
4923
  };
4912
- _self[_DYN_GET_PROCESS_TEL_CONT0 ] = _createTelCtx;
4924
+ _self[_DYN_GET_PROCESS_TEL_CONT2 ] = _createTelCtx;
4913
4925
  _self[_DYN_GET_NOTIFY_MGR ] = function () {
4914
4926
  if (!_notificationManager) {
4915
4927
  _notificationManager = new NotificationManager(_configHandler.cfg);
@@ -4918,11 +4930,11 @@ var AppInsightsCore$1 = /** @class */ (function () {
4918
4930
  return _notificationManager;
4919
4931
  };
4920
4932
  _self[_DYN_ADD_NOTIFICATION_LIS1 ] = function (listener) {
4921
- _self[_DYN_GET_NOTIFY_MGR ]()[_DYN_ADD_NOTIFICATION_LIS1 ](listener);
4933
+ _self.getNotifyMgr()[_DYN_ADD_NOTIFICATION_LIS1 ](listener);
4922
4934
  };
4923
- _self[_DYN_REMOVE_NOTIFICATION_2 ] = function (listener) {
4935
+ _self[_DYN_REMOVE_NOTIFICATION_0 ] = function (listener) {
4924
4936
  if (_notificationManager) {
4925
- _notificationManager[_DYN_REMOVE_NOTIFICATION_2 ](listener);
4937
+ _notificationManager[_DYN_REMOVE_NOTIFICATION_0 ](listener);
4926
4938
  }
4927
4939
  };
4928
4940
  _self.getCookieMgr = function () {
@@ -4938,16 +4950,6 @@ var AppInsightsCore$1 = /** @class */ (function () {
4938
4950
  }
4939
4951
  };
4940
4952
  _self[STR_GET_PERF_MGR ] = function () {
4941
- if (!_perfManager && !_cfgPerfManager) {
4942
- _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
4943
- if (details.cfg.enablePerfMgr) {
4944
- var createPerfMgr = details.cfg[STR_CREATE_PERF_MGR ];
4945
- if (isFunction(createPerfMgr)) {
4946
- _cfgPerfManager = createPerfMgr(_self, _self[_DYN_GET_NOTIFY_MGR ]());
4947
- }
4948
- }
4949
- }));
4950
- }
4951
4953
  return _perfManager || _cfgPerfManager || getGblPerfMgr();
4952
4954
  };
4953
4955
  _self.setPerfMgr = function (perfMgr) {
@@ -5142,11 +5144,7 @@ var AppInsightsCore$1 = /** @class */ (function () {
5142
5144
  else {
5143
5145
  unloadHook = onConfigChange(_configHandler.cfg, handler, _self[_DYN_LOGGER$1 ]);
5144
5146
  }
5145
- return {
5146
- rm: function () {
5147
- unloadHook.rm();
5148
- }
5149
- };
5147
+ return _createUnloadHook(unloadHook);
5150
5148
  };
5151
5149
  _self.getWParam = function () {
5152
5150
  return (hasDocument() || !!_configHandler.cfg.enableWParam) ? 0 : -1;
@@ -5246,6 +5244,8 @@ var AppInsightsCore$1 = /** @class */ (function () {
5246
5244
  _pluginVersionString = null;
5247
5245
  _pluginVersionStringArr = null;
5248
5246
  _forceStopInternalLogPoller = false;
5247
+ _internalLogPoller = null;
5248
+ _internalLogPollerListening = false;
5249
5249
  }
5250
5250
  function _createTelCtx() {
5251
5251
  var theCtx = createProcessTelemetryContext(_getPluginChain(), _configHandler.cfg, _self);
@@ -5440,28 +5440,27 @@ var AppInsightsCore$1 = /** @class */ (function () {
5440
5440
  doCallback();
5441
5441
  return true;
5442
5442
  }
5443
- function _initDebugListener() {
5444
- !_notificationManager && _self[_DYN_GET_NOTIFY_MGR ]();
5445
- _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
5446
- var disableDbgExt = details.cfg.disableDbgExt;
5447
- if (disableDbgExt === true && _debugListener) {
5448
- _notificationManager[_DYN_REMOVE_NOTIFICATION_2 ](_debugListener);
5449
- _debugListener = null;
5450
- }
5451
- if (_notificationManager && !_debugListener && disableDbgExt !== true) {
5452
- _debugListener = getDebugListener(details.cfg);
5453
- _notificationManager[_DYN_ADD_NOTIFICATION_LIS1 ](_debugListener);
5454
- }
5455
- }));
5456
- }
5457
5443
  function _initPerfManager() {
5444
+ var prevCfgPerfMgr;
5458
5445
  _addUnloadHook(_configHandler[_DYN_WATCH ](function (details) {
5459
5446
  var enablePerfMgr = details.cfg.enablePerfMgr;
5460
- if (!enablePerfMgr && _cfgPerfManager) {
5461
- _cfgPerfManager = null;
5462
- }
5463
5447
  if (enablePerfMgr) {
5464
- getSetValue(details.cfg, STR_CREATE_PERF_MGR, _createPerfManager);
5448
+ var createPerfMgr = details.cfg[STR_CREATE_PERF_MGR ];
5449
+ if (prevCfgPerfMgr !== createPerfMgr) {
5450
+ if (!createPerfMgr) {
5451
+ createPerfMgr = _createPerfManager;
5452
+ }
5453
+ getSetValue(details.cfg, STR_CREATE_PERF_MGR, createPerfMgr);
5454
+ prevCfgPerfMgr = createPerfMgr;
5455
+ _cfgPerfManager = null;
5456
+ }
5457
+ if (!_perfManager && !_cfgPerfManager && isFunction(createPerfMgr)) {
5458
+ _cfgPerfManager = createPerfMgr(_self, _self[_DYN_GET_NOTIFY_MGR ]());
5459
+ }
5460
+ }
5461
+ else {
5462
+ _cfgPerfManager = null;
5463
+ prevCfgPerfMgr = null;
5465
5464
  }
5466
5465
  }));
5467
5466
  }
@@ -5497,6 +5496,24 @@ var AppInsightsCore$1 = /** @class */ (function () {
5497
5496
  return AppInsightsCore;
5498
5497
  }());
5499
5498
 
5499
+ function parseResponse(response, diagLog) {
5500
+ try {
5501
+ if (response && response !== "") {
5502
+ var result = getJSON().parse(response);
5503
+ if (result && result[_DYN_ITEMS_RECEIVED ] && result[_DYN_ITEMS_RECEIVED ] >= result.itemsAccepted &&
5504
+ result.itemsReceived - result.itemsAccepted === result.errors[_DYN_LENGTH$1 ]) {
5505
+ return result;
5506
+ }
5507
+ }
5508
+ }
5509
+ catch (e) {
5510
+ _throwInternal(diagLog, 1 , 43 , "Cannot parse the response. " + (e[_DYN_NAME ] || dumpObj(e)), {
5511
+ response: response
5512
+ });
5513
+ }
5514
+ return null;
5515
+ }
5516
+
5500
5517
  var STR_EMPTY$1 = "";
5501
5518
  var STR_NO_RESPONSE_BODY = "NoResponseBody";
5502
5519
  var _noResponseQs = "&" + STR_NO_RESPONSE_BODY + "=true";
@@ -6265,7 +6282,7 @@ var _DYN_RM_FIELD_SANITIZER = "rmFieldSanitizer";
6265
6282
  var _DYN_CAN_HANDLE = "canHandle";
6266
6283
 
6267
6284
  var _a;
6268
- var Version = '4.1.2-nightly3.2403-07';
6285
+ var Version = '4.1.2';
6269
6286
  var FullVersionString = "1DS-Web-JS-" + Version;
6270
6287
  var ObjHasOwnProperty = ObjProto$1.hasOwnProperty;
6271
6288
  var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
@@ -6867,6 +6884,7 @@ exports.__getRegisteredEvents = __getRegisteredEvents;
6867
6884
  exports._appendHeader = _appendHeader;
6868
6885
  exports._getAllResponseHeaders = _getAllResponseHeaders;
6869
6886
  exports._logInternalMessage = _logInternalMessage;
6887
+ exports._testHookMaxUnloadHooksCb = _testHookMaxUnloadHooksCb;
6870
6888
  exports._throwInternal = _throwInternal;
6871
6889
  exports._warnToConsole = _warnToConsole;
6872
6890
  exports.addEventHandler = addEventHandler;