@microsoft/applicationinsights-properties-js 3.0.0-beta.2208-04 → 3.0.0-beta.2208-18

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 (34) hide show
  1. package/browser/applicationinsights-properties-js.integrity.json +9 -9
  2. package/browser/applicationinsights-properties-js.js +916 -860
  3. package/browser/applicationinsights-properties-js.js.map +1 -1
  4. package/browser/applicationinsights-properties-js.min.js +2 -2
  5. package/browser/applicationinsights-properties-js.min.js.map +1 -1
  6. package/dist/applicationinsights-properties-js.api.json +4 -8
  7. package/dist/applicationinsights-properties-js.d.ts +1 -1
  8. package/dist/applicationinsights-properties-js.js +916 -860
  9. package/dist/applicationinsights-properties-js.js.map +1 -1
  10. package/dist/applicationinsights-properties-js.min.js +2 -2
  11. package/dist/applicationinsights-properties-js.min.js.map +1 -1
  12. package/dist/applicationinsights-properties-js.rollup.d.ts +1 -1
  13. package/dist-esm/Context/Application.js +1 -1
  14. package/dist-esm/Context/Device.js +1 -1
  15. package/dist-esm/Context/Internal.js +2 -2
  16. package/dist-esm/Context/Internal.js.map +1 -1
  17. package/dist-esm/Context/Location.js +1 -1
  18. package/dist-esm/Context/Session.js +1 -1
  19. package/dist-esm/Context/TelemetryTrace.js +1 -1
  20. package/dist-esm/Context/User.js +1 -1
  21. package/dist-esm/Interfaces/IPropTelemetryContext.js +1 -1
  22. package/dist-esm/Interfaces/ITelemetryConfig.js +1 -1
  23. package/dist-esm/PropertiesPlugin.js +1 -1
  24. package/dist-esm/TelemetryContext.js +5 -5
  25. package/dist-esm/TelemetryContext.js.map +1 -1
  26. package/dist-esm/__DynamicConstants.js +4 -4
  27. package/dist-esm/__DynamicConstants.js.map +1 -1
  28. package/dist-esm/applicationinsights-properties-js.js +1 -1
  29. package/package.json +5 -4
  30. package/src/Context/Internal.ts +1 -1
  31. package/src/TelemetryContext.ts +4 -4
  32. package/src/__DynamicConstants.ts +3 -3
  33. package/tsconfig.json +1 -1
  34. package/types/tsdoc-metadata.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2208-04
2
+ * Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2208-18
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -13,32 +13,32 @@
13
13
  var strShimUndefined = "undefined";
14
14
  var strShimPrototype = "prototype";
15
15
  var strShimHasOwnProperty = "hasOwnProperty";
16
- var ObjClass = Object;
17
- var ObjProto = ObjClass[strShimPrototype];
18
- var ObjCreate = ObjClass["create"];
19
- var ObjDefineProperty = ObjClass["defineProperty"];
20
- var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];
16
+ var ObjClass$1 = Object;
17
+ var ObjProto$1 = ObjClass$1[strShimPrototype];
18
+ var ObjCreate = ObjClass$1["create"];
19
+ var ObjDefineProperty = ObjClass$1["defineProperty"];
20
+ var ObjHasOwnProperty = ObjProto$1[strShimHasOwnProperty];
21
21
 
22
- var _cachedGlobal = null;
23
- function getGlobal(useCached) {
22
+ var _cachedGlobal$1 = null;
23
+ function getGlobal$1(useCached) {
24
24
  if (useCached === void 0) { useCached = true; }
25
- if (!_cachedGlobal || !useCached) {
25
+ if (!_cachedGlobal$1 || !useCached) {
26
26
  if (typeof globalThis !== strShimUndefined && globalThis) {
27
- _cachedGlobal = globalThis;
27
+ _cachedGlobal$1 = globalThis;
28
28
  }
29
29
  if (typeof self !== strShimUndefined && self) {
30
- _cachedGlobal = self;
30
+ _cachedGlobal$1 = self;
31
31
  }
32
32
  if (typeof window !== strShimUndefined && window) {
33
- _cachedGlobal = window;
33
+ _cachedGlobal$1 = window;
34
34
  }
35
35
  if (typeof global !== strShimUndefined && global) {
36
- _cachedGlobal = global;
36
+ _cachedGlobal$1 = global;
37
37
  }
38
38
  }
39
- return _cachedGlobal;
39
+ return _cachedGlobal$1;
40
40
  }
41
- function throwTypeError(message) {
41
+ function throwTypeError$1(message) {
42
42
  throw new TypeError(message);
43
43
  }
44
44
  function objCreateFn(obj) {
@@ -51,17 +51,17 @@
51
51
  }
52
52
  var type = typeof obj;
53
53
  if (type !== strShimObject && type !== strShimFunction) {
54
- throwTypeError("Object prototype may only be an Object:" + obj);
54
+ throwTypeError$1("Object prototype may only be an Object:" + obj);
55
55
  }
56
56
  function tmpFunc() { }
57
57
  tmpFunc[strShimPrototype] = obj;
58
58
  return new tmpFunc();
59
59
  }
60
60
 
61
- (getGlobal() || {})["Symbol"];
62
- (getGlobal() || {})["Reflect"];
61
+ (getGlobal$1() || {})["Symbol"];
62
+ (getGlobal$1() || {})["Reflect"];
63
63
  var extendStaticsFn = function (d, b) {
64
- extendStaticsFn = ObjClass["setPrototypeOf"] ||
64
+ extendStaticsFn = ObjClass$1["setPrototypeOf"] ||
65
65
  ({ __proto__: [] } instanceof Array && function (d, b) {
66
66
  d.__proto__ = b;
67
67
  }) ||
@@ -76,7 +76,7 @@
76
76
  };
77
77
  function __extendsFn(d, b) {
78
78
  if (typeof b !== strShimFunction && b !== null) {
79
- throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
79
+ throwTypeError$1("Class extends value " + String(b) + " is not a constructor or null");
80
80
  }
81
81
  extendStaticsFn(d, b);
82
82
  function __() {
@@ -100,13 +100,13 @@
100
100
  var DynAllowInstChkTag = DynInstChkTag;
101
101
  var DynProtoDefaultOptions = '_dfOpts';
102
102
  var UnknownValue = '_unknown_';
103
- var str__Proto$1 = "__proto__";
104
- var DynProtoBaseProto = "_dyn" + str__Proto$1;
103
+ var str__Proto = "__proto__";
104
+ var DynProtoBaseProto = "_dyn" + str__Proto;
105
105
  var DynProtoCurrent = "_dynInstProto";
106
106
  var strUseBaseInst = 'useBaseInst';
107
107
  var strSetInstFuncs = 'setInstFuncs';
108
108
  var Obj = Object;
109
- var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
109
+ var _objGetPrototypeOf = Obj["getPrototypeOf"];
110
110
  var _objGetOwnProps = Obj["getOwnPropertyNames"];
111
111
  var _dynamicNames = 0;
112
112
  function _hasOwnProperty(obj, prop) {
@@ -121,10 +121,10 @@
121
121
  function _getObjProto$1(target) {
122
122
  var newProto;
123
123
  if (target) {
124
- if (_objGetPrototypeOf$1) {
125
- return _objGetPrototypeOf$1(target);
124
+ if (_objGetPrototypeOf) {
125
+ return _objGetPrototypeOf(target);
126
126
  }
127
- var curProto = target[str__Proto$1] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
127
+ var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
128
128
  newProto = target[DynProtoBaseProto] || curProto;
129
129
  if (!_hasOwnProperty(target, DynProtoBaseProto)) {
130
130
  delete target[DynProtoCurrent];
@@ -196,7 +196,7 @@
196
196
  var visited = [];
197
197
  while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
198
198
  _forEachProp(baseProto, function (name) {
199
- if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf$1)) {
199
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
200
200
  baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
201
201
  }
202
202
  });
@@ -276,7 +276,7 @@
276
276
  }
277
277
  }
278
278
  function _checkPrototype(classProto, thisTarget) {
279
- if (_objGetPrototypeOf$1) {
279
+ if (_objGetPrototypeOf) {
280
280
  var visited = [];
281
281
  var thisProto = _getObjProto$1(thisTarget);
282
282
  while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
@@ -321,7 +321,7 @@
321
321
  var instFuncs = _getInstanceFuncs(target);
322
322
  var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
323
323
  delegateFunc(target, baseFuncs);
324
- var setInstanceFunc = !!_objGetPrototypeOf$1 && !!perfOptions[strSetInstFuncs];
324
+ var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
325
325
  if (setInstanceFunc && options) {
326
326
  setInstanceFunc = !!options[strSetInstFuncs];
327
327
  }
@@ -333,6 +333,357 @@
333
333
  };
334
334
  dynamicProto[DynProtoDefaultOptions] = perfDefaults;
335
335
 
336
+ var UNDEF_VALUE = undefined;
337
+ var EMPTY = "";
338
+ var BOOLEAN = "boolean";
339
+ var FUNCTION = "function";
340
+ var NUMBER = "number";
341
+ var OBJECT = "object";
342
+ var PROTOTYPE = "prototype";
343
+ var STRING = "string";
344
+ var UNDEFINED = "undefined";
345
+ var HAS_OWN_PROPERTY = "hasOwnProperty";
346
+ var INDEX_OF = "indexOf";
347
+ var LENGTH = "length";
348
+ var ObjClass = Object;
349
+ var ObjProto = ObjClass[PROTOTYPE];
350
+ var StrCls = String;
351
+ var StrProto = StrCls[PROTOTYPE];
352
+ var MathCls = Math;
353
+ var ArrCls = Array;
354
+
355
+ function _safeCheck(cb, defValue) {
356
+ var result = defValue;
357
+ try {
358
+ result = cb();
359
+ }
360
+ catch (e) {
361
+ }
362
+ return result;
363
+ }
364
+
365
+ function _createIs(theType) {
366
+ return function (value) {
367
+ return typeof value === theType;
368
+ };
369
+ }
370
+ function _createObjIs(theType) {
371
+ return function (value) {
372
+ return !!(value && objToString(value) === theType);
373
+ };
374
+ }
375
+ function objToString(value) {
376
+ return ObjProto.toString.call(value);
377
+ }
378
+ function isUndefined(value) {
379
+ return typeof value === UNDEFINED || value === UNDEFINED;
380
+ }
381
+ function isNullOrUndefined(value) {
382
+ return value === null || isUndefined(value);
383
+ }
384
+ function isDefined(arg) {
385
+ return !!arg || arg !== UNDEF_VALUE;
386
+ }
387
+ var isString = _createIs(STRING);
388
+ var isFunction = _createIs(FUNCTION);
389
+ function isObject(value) {
390
+ if (isNullOrUndefined(value)) {
391
+ return false;
392
+ }
393
+ return !!value && typeof value === OBJECT;
394
+ }
395
+ var isArray = ArrCls.isArray;
396
+ var isNumber = _createIs(NUMBER);
397
+ var isBoolean = _createIs(BOOLEAN);
398
+ var isError = _createObjIs("[object Error]");
399
+ function isTruthy(value) {
400
+ return !(!value || _safeCheck(function () { return !(value && (0 + value)); }, !value));
401
+ }
402
+
403
+ var DOCUMENT = "document";
404
+ var NAVIGATOR = "navigator";
405
+ var WINDOW = "window";
406
+ var _cachedGlobal = null;
407
+ var _hasWindow = _safeCheck(function () { return isDefined(window); }, false);
408
+ var _hasDocument = _safeCheck(function () { return isDefined(document); }, false);
409
+ var _hasNavigator = _safeCheck(function () { return isDefined(navigator); }, false);
410
+ _safeCheck(function () { return isDefined(history); }, false);
411
+ _safeCheck(function () { return !!(self && self instanceof WorkerGlobalScope); }, false);
412
+ _safeCheck(function () { return !!(process && (process.versions || {}).node); }, false);
413
+ function getGlobal(useCached) {
414
+ var result = useCached === false ? null : _cachedGlobal;
415
+ if (!result) {
416
+ if (!result && typeof globalThis !== UNDEFINED) {
417
+ result = globalThis;
418
+ }
419
+ if (!result && typeof self !== UNDEFINED) {
420
+ result = self;
421
+ }
422
+ if (!result && typeof window !== UNDEFINED) {
423
+ result = window;
424
+ }
425
+ if (!result && typeof global !== UNDEFINED) {
426
+ result = global;
427
+ }
428
+ _cachedGlobal = result;
429
+ }
430
+ return result;
431
+ }
432
+ function getInst(name, useCached) {
433
+ var gbl = getGlobal(useCached);
434
+ if (gbl && gbl[name]) {
435
+ return gbl[name];
436
+ }
437
+ if (name === WINDOW && _hasWindow) {
438
+ return window;
439
+ }
440
+ return null;
441
+ }
442
+ function getDocument() {
443
+ return _hasDocument ? document : getInst(DOCUMENT);
444
+ }
445
+ function hasWindow() {
446
+ return !!getWindow();
447
+ }
448
+ function getWindow() {
449
+ return _hasWindow ? window : getInst(WINDOW);
450
+ }
451
+ function getNavigator() {
452
+ return _hasNavigator ? navigator : getInst(NAVIGATOR);
453
+ }
454
+
455
+ function objHasOwnProperty(obj, prop) {
456
+ return obj && ObjProto[HAS_OWN_PROPERTY].call(obj, prop);
457
+ }
458
+
459
+ function objForEachKey(theObject, callbackfn, thisArg) {
460
+ if (theObject && isObject(theObject)) {
461
+ for (var prop in theObject) {
462
+ if (objHasOwnProperty(theObject, prop)) {
463
+ if (callbackfn.call(thisArg || theObject, prop, theObject[prop]) === -1) {
464
+ break;
465
+ }
466
+ }
467
+ }
468
+ }
469
+ }
470
+
471
+ function arrForEach(arr, callbackfn, thisArg) {
472
+ if (arr) {
473
+ var len = arr[LENGTH];
474
+ for (var idx = 0; idx < len; idx++) {
475
+ if (idx in arr) {
476
+ if (callbackfn.call(thisArg || arr, arr[idx], idx, arr) === -1) {
477
+ break;
478
+ }
479
+ }
480
+ }
481
+ }
482
+ }
483
+
484
+ function throwTypeError(message) {
485
+ throw new TypeError(message);
486
+ }
487
+
488
+ var _objFreeze = ObjClass["freeze"];
489
+ function _doNothing(value) {
490
+ return value;
491
+ }
492
+ function objKeys(value) {
493
+ if (!isObject(value) || value === null) {
494
+ throwTypeError("objKeys called on non-object");
495
+ }
496
+ return ObjClass.keys(value);
497
+ }
498
+ function objDeepFreeze(value) {
499
+ if (_objFreeze) {
500
+ objForEachKey(value, function (key, value) {
501
+ if (isArray(value) || isObject(value)) {
502
+ _objFreeze(value);
503
+ }
504
+ });
505
+ }
506
+ return objFreeze(value);
507
+ }
508
+ var objFreeze = _objFreeze || _doNothing;
509
+
510
+ function createEnum(values) {
511
+ var theEnum = {};
512
+ objForEachKey(values, function (field, value) {
513
+ theEnum[field] = value;
514
+ theEnum[value] = field;
515
+ });
516
+ return objDeepFreeze(theEnum);
517
+ }
518
+
519
+ function dumpObj(object, format) {
520
+ var objectTypeDump = objToString(object);
521
+ var propertyValueDump = "";
522
+ if (objectTypeDump === "[object Error]") {
523
+ propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
524
+ }
525
+ else {
526
+ if (format) {
527
+ if (isNumber(format)) {
528
+ propertyValueDump = JSON.stringify(object, null, format);
529
+ }
530
+ else {
531
+ propertyValueDump = JSON.stringify(object, null, format ? 4 : 0);
532
+ }
533
+ }
534
+ else {
535
+ propertyValueDump = JSON.stringify(object);
536
+ }
537
+ }
538
+ return objectTypeDump + ": " + propertyValueDump;
539
+ }
540
+
541
+ function _unwrapFunction(funcName) {
542
+ return function (thisArg) {
543
+ var args = [];
544
+ for (var _i = 1; _i < arguments.length; _i++) {
545
+ args[_i - 1] = arguments[_i];
546
+ }
547
+ if ((thisArg || thisArg === EMPTY) && thisArg[funcName]) {
548
+ return thisArg[funcName].apply(thisArg, args);
549
+ }
550
+ throwTypeError("'" + funcName + "' not defined for " + dumpObj(thisArg));
551
+ };
552
+ }
553
+
554
+ function objSetPrototypeOf(obj, proto) {
555
+ var fn = ObjClass["setPrototypeOf"] ||
556
+ ({ __proto__: [] } instanceof Array && function (d, b) {
557
+ d.__proto__ = b;
558
+ }) ||
559
+ function (d, b) {
560
+ objForEachKey(b, function (key, value) {
561
+ d[key] = value;
562
+ });
563
+ };
564
+ return fn(obj, proto);
565
+ }
566
+
567
+ function _createCustomError(name, d, b) {
568
+ objSetPrototypeOf(d, b);
569
+ function __() {
570
+ this.constructor = d;
571
+ }
572
+ __[PROTOTYPE] = b[PROTOTYPE];
573
+ __[PROTOTYPE].name = name;
574
+ d[PROTOTYPE] = new __();
575
+ return d;
576
+ }
577
+ function createCustomError(name, constructCb) {
578
+ var baseClass = Error;
579
+ var customError = _createCustomError(name, function () {
580
+ var _this = this;
581
+ _this = baseClass.apply(_this, arguments) || _this;
582
+ constructCb && constructCb(_this, arguments);
583
+ return _this;
584
+ }, baseClass);
585
+ return customError;
586
+ }
587
+ var _unsupportedError;
588
+ function throwUnsupported(message) {
589
+ if (!_unsupportedError) {
590
+ _unsupportedError = createCustomError("UnsupportedError");
591
+ }
592
+ throw new _unsupportedError(message);
593
+ }
594
+
595
+ var _objDefineProperty$1 = ObjClass["defineProperty"];
596
+ function objDefineProp(target, key, descriptor) {
597
+ if (_objDefineProperty$1) {
598
+ _objDefineProperty$1(target, key, descriptor);
599
+ return target;
600
+ }
601
+ throwUnsupported("Unable to define property [" + objToString(key) + "] on " + dumpObj(target));
602
+ }
603
+ function objDefineAccessors(target, prop, getProp, setProp, configurable) {
604
+ if (_objDefineProperty$1) {
605
+ try {
606
+ var descriptor = {
607
+ enumerable: true,
608
+ configurable: isUndefined(configurable) ? true : configurable
609
+ };
610
+ if (getProp) {
611
+ descriptor.get = getProp;
612
+ }
613
+ if (setProp) {
614
+ descriptor.set = setProp;
615
+ }
616
+ return objDefineProp(target, prop, descriptor);
617
+ }
618
+ catch (e) {
619
+ throwUnsupported("Unable to define accessors for [" + objToString(prop) + "] on " + dumpObj(target));
620
+ }
621
+ }
622
+ }
623
+
624
+ var mathMax = MathCls.max;
625
+
626
+ var strSlice = _unwrapFunction("slice");
627
+
628
+ var SUB_STR = "substr";
629
+ var strSubstring = _unwrapFunction("substring");
630
+ StrProto[SUB_STR] ? _unwrapFunction(SUB_STR) : polyStrSubstr;
631
+ function polyStrSubstr(value, start, length) {
632
+ if (isNullOrUndefined(value)) {
633
+ throwTypeError("'polyStrSubstr called with invalid " + dumpObj(value));
634
+ }
635
+ if (length < 0) {
636
+ return EMPTY;
637
+ }
638
+ start = start || 0;
639
+ if (start < 0) {
640
+ start = mathMax(start + value[LENGTH], 0);
641
+ }
642
+ if (isUndefined(length)) {
643
+ return strSlice(value, start);
644
+ }
645
+ return strSlice(value, start, start + length);
646
+ }
647
+
648
+ var ENDS_WITH = "endsWith";
649
+ var strEndsWith = StrProto[ENDS_WITH] ? _unwrapFunction(ENDS_WITH) : polyStrEndsWith;
650
+ function polyStrEndsWith(value, searchString, length) {
651
+ if (!isString(value)) {
652
+ throwTypeError("'" + dumpObj(value) + "' is not a string");
653
+ }
654
+ var searchValue = isString(searchString) ? searchString : "" + searchString;
655
+ var chkLen = searchValue[LENGTH];
656
+ var len = value[LENGTH];
657
+ var end = !isUndefined(length) && length < len ? length : len;
658
+ return strSubstring(value, end - chkLen, end) === searchValue;
659
+ }
660
+
661
+ var strIndexOf = _unwrapFunction(INDEX_OF);
662
+
663
+ function _createTrimFn(exp) {
664
+ return function _doTrim(value) {
665
+ if (isNullOrUndefined(value)) {
666
+ throwTypeError("strTrim called [" + dumpObj(value) + "]");
667
+ }
668
+ if (value && value.replace) {
669
+ value = value.replace(exp, "");
670
+ }
671
+ return value;
672
+ };
673
+ }
674
+ var polyStrTrim = _createTrimFn(/^\s+|(?=\s)\s+$/g);
675
+ var polyStrTrimStart = _createTrimFn(/^\s+/g);
676
+ var polyStrTrimEnd = _createTrimFn(/(?=\s)\s+$/g);
677
+
678
+ var TRIM = "trim";
679
+ var TRIM_START = "trimStart";
680
+ var TRIM_END = "trimEnd";
681
+ var strTrim = StrProto[TRIM] ? _unwrapFunction(TRIM) : polyStrTrim;
682
+ StrProto[TRIM_START] ? _unwrapFunction(TRIM_START) : polyStrTrimStart;
683
+ StrProto[TRIM_END] ? _unwrapFunction(TRIM_END) : polyStrTrimEnd;
684
+
685
+ var createEnumStyle = createEnum;
686
+
336
687
  var _DYN_INITIALIZE = "initialize";
337
688
  var _DYN_NAME$1 = "name";
338
689
  var _DYN_IDENTIFIER = "identifier";
@@ -356,15 +707,13 @@
356
707
  var _DYN_SET_NEXT_PLUGIN = "setNextPlugin";
357
708
  var _DYN_CREATE_NEW = "createNew";
358
709
  var _DYN_COOKIE_CFG = "cookieCfg";
359
- var _DYN_INDEX_OF = "indexOf";
360
710
  var _DYN_SUBSTRING$1 = "substring";
361
711
  var _DYN_USER_AGENT = "userAgent";
362
712
  var _DYN_SPLIT = "split";
363
- var _DYN_SET_ENABLED = "setEnabled";
364
- var _DYN_REPLACE = "replace";
365
713
  var _DYN_SUBSTR = "substr";
366
714
  var _DYN_NODE_TYPE = "nodeType";
367
715
  var _DYN_APPLY = "apply";
716
+ var _DYN_REPLACE = "replace";
368
717
  var _DYN_ENABLE_DEBUG_EXCEPTI4 = "enableDebugExceptions";
369
718
  var _DYN_LOG_INTERNAL_MESSAGE = "logInternalMessage";
370
719
  var _DYN_TO_LOWER_CASE = "toLowerCase";
@@ -384,55 +733,44 @@
384
733
  var STR_WARN_TO_CONSOLE = "warnToConsole";
385
734
  var STR_GET_PERF_MGR = "getPerfMgr";
386
735
 
736
+ var _aiNamespace = null;
737
+ function _getExtensionNamespace() {
738
+ var target = getInst("Microsoft");
739
+ if (target) {
740
+ _aiNamespace = target["ApplicationInsights"];
741
+ }
742
+ return _aiNamespace;
743
+ }
744
+ function getDebugExt(config) {
745
+ var ns = _aiNamespace;
746
+ if (!ns && config.disableDbgExt !== true) {
747
+ ns = _aiNamespace || _getExtensionNamespace();
748
+ }
749
+ return ns ? ns["ChromeDbgExt"] : null;
750
+ }
751
+
752
+ var cString = "String";
753
+ var cObject = "Object";
387
754
  var strToISOString = "toISOString";
388
- var cStrEndsWith = "endsWith";
389
- var cStrTrim = "trim";
390
755
  var strToString = "toString";
391
- var str__Proto = "__proto__";
756
+ var strGetPrototypeOf = "getPrototypeOf";
392
757
  var strConstructor = "constructor";
393
- var _objDefineProperty$1 = ObjDefineProperty;
394
- var _objFreeze = ObjClass.freeze;
395
- var _objKeys = ObjClass.keys;
396
- var StringProto = String[strShimPrototype];
397
- var _strTrim = StringProto[cStrTrim];
398
- var _strEndsWith = StringProto[cStrEndsWith];
399
758
  var DateProto = Date[strShimPrototype];
400
- var _dataToISOString = DateProto[strToISOString];
401
- var _isArray = Array.isArray;
402
- var _objToString = ObjProto[strToString];
403
- var _fnToString = ObjHasOwnProperty[strToString];
404
- var _objFunctionString = _fnToString[_DYN_CALL ](ObjClass);
759
+ var _dateToISOString = DateProto[strToISOString] || _polyfillRequired("Date", strToISOString);
760
+ var _fnToString = ObjHasOwnProperty[strToString] || _polyfillRequired(cString, strToString);
761
+ var _objFunctionString = _fnToString[_DYN_CALL ](ObjClass$1);
405
762
  var rCamelCase = /-([a-z])/g;
406
763
  var rNormalizeInvalid = /([^\w\d_$])/g;
407
764
  var rLeadingNumeric = /^(\d+[\w\d_$])/;
408
- var _objGetPrototypeOf = Object["getPrototypeOf"];
409
- function _getObjProto(target) {
410
- if (target) {
411
- if (_objGetPrototypeOf) {
412
- return _objGetPrototypeOf(target);
413
- }
414
- var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
415
- if (newProto) {
416
- return newProto;
417
- }
418
- }
419
- return null;
420
- }
421
- function isUndefined(value) {
422
- return value === undefined || typeof value === strShimUndefined;
423
- }
424
- function isNullOrUndefined(value) {
425
- return (value === null || isUndefined(value));
765
+ function _polyfillRequired(object, name) {
766
+ return function () {
767
+ throwUnsupported("Polyfill required for [" + name + "]");
768
+ };
426
769
  }
770
+ var _getObjProto = Object[strGetPrototypeOf] || _polyfillRequired(cObject, strGetPrototypeOf);
427
771
  function isNotNullOrUndefined(value) {
428
772
  return !isNullOrUndefined(value);
429
773
  }
430
- function isObject(value) {
431
- return !!(value && typeof value === strShimObject);
432
- }
433
- function isFunction(value) {
434
- return !!(value && typeof value === strShimFunction);
435
- }
436
774
  function normalizeJsName(name) {
437
775
  var value = name;
438
776
  if (value && isString(value)) {
@@ -446,61 +784,16 @@
446
784
  }
447
785
  return value;
448
786
  }
449
- function objForEachKey(target, callbackfn) {
450
- if (target) {
451
- for (var prop in target) {
452
- if (ObjHasOwnProperty[_DYN_CALL ](target, prop)) {
453
- callbackfn[_DYN_CALL ](target, prop, target[prop]);
454
- }
455
- }
456
- }
457
- }
458
- function strEndsWith(value, search) {
459
- var result = false;
460
- if (value && search && !(result = value === search)) {
461
- result = _strEndsWith ? value[cStrEndsWith](search) : _strEndsWithPoly(value, search);
462
- }
463
- return result;
464
- }
465
- function _strEndsWithPoly(value, search) {
466
- var result = false;
467
- var searchLen = search ? search[_DYN_LENGTH$2 ] : 0;
468
- var valLen = value ? value[_DYN_LENGTH$2 ] : 0;
469
- if (searchLen && valLen && valLen >= searchLen && !(result = value === search)) {
470
- var pos = valLen - 1;
471
- for (var lp = searchLen - 1; lp >= 0; lp--) {
472
- if (value[pos] != search[lp]) {
473
- return false;
474
- }
475
- pos--;
476
- }
477
- result = true;
478
- }
479
- return result;
480
- }
481
787
  function strContains(value, search) {
482
788
  if (value && search) {
483
- return value[_DYN_INDEX_OF ](search) !== -1;
789
+ return strIndexOf(value, search) !== -1;
484
790
  }
485
791
  return false;
486
792
  }
487
- var isArray = _isArray || _isArrayPoly;
488
- function _isArrayPoly(obj) {
489
- return !!(obj && _objToString[_DYN_CALL ](obj) === "[object Array]");
490
- }
491
- function isError(obj) {
492
- return !!(obj && _objToString[_DYN_CALL ](obj) === "[object Error]");
493
- }
494
- function isString(value) {
495
- return typeof value === "string";
496
- }
497
- function isBoolean(value) {
498
- return typeof value === "boolean";
499
- }
500
793
  function isPlainObject(value) {
501
794
  var result = false;
502
795
  if (value && typeof value === "object") {
503
- var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
796
+ var proto = _getObjProto(value);
504
797
  if (!proto) {
505
798
  result = true;
506
799
  }
@@ -514,138 +807,28 @@
514
807
  return result;
515
808
  }
516
809
  function toISOString(date) {
517
- if (date) {
518
- return _dataToISOString ? date[strToISOString]() : _toISOStringPoly(date);
519
- }
810
+ return _dateToISOString[_DYN_CALL ](date);
520
811
  }
521
- function _toISOStringPoly(date) {
522
- if (date && date.getUTCFullYear) {
523
- var pad = function (num) {
524
- var r = String(num);
525
- if (r[_DYN_LENGTH$2 ] === 1) {
526
- r = "0" + r;
527
- }
528
- return r;
529
- };
530
- return date.getUTCFullYear()
531
- + "-" + pad(date.getUTCMonth() + 1)
532
- + "-" + pad(date.getUTCDate())
533
- + "T" + pad(date.getUTCHours())
534
- + ":" + pad(date.getUTCMinutes())
535
- + ":" + pad(date.getUTCSeconds())
536
- + "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
537
- + "Z";
812
+ function dateNow() {
813
+ var dt = Date;
814
+ return dt.now ? dt.now() : new dt().getTime();
815
+ }
816
+ function getExceptionName(object) {
817
+ if (isError(object)) {
818
+ return object[_DYN_NAME$1 ];
538
819
  }
820
+ return STR_EMPTY;
539
821
  }
540
- function arrForEach(arr, callbackfn, thisArg) {
541
- var len = arr[_DYN_LENGTH$2 ];
542
- try {
543
- for (var idx = 0; idx < len; idx++) {
544
- if (idx in arr) {
545
- if (callbackfn[_DYN_CALL ](thisArg || arr, arr[idx], idx, arr) === -1) {
546
- break;
547
- }
548
- }
822
+ function setValue(target, field, value, valChk, srcChk) {
823
+ var theValue = value;
824
+ if (target) {
825
+ theValue = target[field];
826
+ if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
827
+ theValue = value;
828
+ target[field] = theValue;
549
829
  }
550
830
  }
551
- catch (e) {
552
- }
553
- }
554
- function strTrim(str) {
555
- if (str) {
556
- str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE ] ? str[_DYN_REPLACE ](/^\s+|\s+$/g, STR_EMPTY) : str);
557
- }
558
- return str;
559
- }
560
- var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
561
- var _objKeysDontEnums = [
562
- "toString",
563
- "toLocaleString",
564
- "valueOf",
565
- "hasOwnProperty",
566
- "isPrototypeOf",
567
- "propertyIsEnumerable",
568
- "constructor"
569
- ];
570
- function objKeys(obj) {
571
- var objType = typeof obj;
572
- if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
573
- throwTypeError("objKeys called on non-object");
574
- }
575
- if (!_objKeysHasDontEnumBug && _objKeys) {
576
- return _objKeys(obj);
577
- }
578
- var result = [];
579
- for (var prop in obj) {
580
- if (obj && ObjHasOwnProperty[_DYN_CALL ](obj, prop)) {
581
- result[_DYN_PUSH ](prop);
582
- }
583
- }
584
- if (_objKeysHasDontEnumBug) {
585
- var dontEnumsLength = _objKeysDontEnums[_DYN_LENGTH$2 ];
586
- for (var lp = 0; lp < dontEnumsLength; lp++) {
587
- if (obj && ObjHasOwnProperty[_DYN_CALL ](obj, _objKeysDontEnums[lp])) {
588
- result[_DYN_PUSH ](_objKeysDontEnums[lp]);
589
- }
590
- }
591
- }
592
- return result;
593
- }
594
- function objDefineAccessors(target, prop, getProp, setProp) {
595
- if (_objDefineProperty$1) {
596
- try {
597
- var descriptor = {
598
- enumerable: true,
599
- configurable: true
600
- };
601
- if (getProp) {
602
- descriptor.get = getProp;
603
- }
604
- if (setProp) {
605
- descriptor.set = setProp;
606
- }
607
- _objDefineProperty$1(target, prop, descriptor);
608
- return true;
609
- }
610
- catch (e) {
611
- }
612
- }
613
- return false;
614
- }
615
- function _doNothing(value) {
616
- return value;
617
- }
618
- function deepFreeze(obj) {
619
- if (_objFreeze) {
620
- objForEachKey(obj, function (name, value) {
621
- if (isArray(value) || isObject(value)) {
622
- _objFreeze(value);
623
- }
624
- });
625
- }
626
- return objFreeze(obj);
627
- }
628
- var objFreeze = _objFreeze || _doNothing;
629
- function dateNow() {
630
- var dt = Date;
631
- return dt.now ? dt.now() : new dt().getTime();
632
- }
633
- function getExceptionName(object) {
634
- if (isError(object)) {
635
- return object[_DYN_NAME$1 ];
636
- }
637
- return STR_EMPTY;
638
- }
639
- function setValue(target, field, value, valChk, srcChk) {
640
- var theValue = value;
641
- if (target) {
642
- theValue = target[field];
643
- if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) {
644
- theValue = value;
645
- target[field] = theValue;
646
- }
647
- }
648
- return theValue;
831
+ return theValue;
649
832
  }
650
833
  function getSetValue(target, field, defValue) {
651
834
  var theValue;
@@ -664,9 +847,6 @@
664
847
  function getCfgValue(theValue, defaultValue) {
665
848
  return !isNullOrUndefined(theValue) ? theValue : defaultValue;
666
849
  }
667
- function isTruthy(value) {
668
- return !!value;
669
- }
670
850
  function _createProxyFunction(source, funcName) {
671
851
  var srcFunc = null;
672
852
  var src = null;
@@ -696,10 +876,10 @@
696
876
  function createClassFromInterface(defaults) {
697
877
  return /** @class */ (function () {
698
878
  function class_1() {
699
- var _this_1 = this;
879
+ var _this = this;
700
880
  if (defaults) {
701
881
  objForEachKey(defaults, function (field, value) {
702
- _this_1[field] = value;
882
+ _this[field] = value;
703
883
  });
704
884
  }
705
885
  }
@@ -751,18 +931,6 @@
751
931
  return extended;
752
932
  }
753
933
 
754
- function createEnumStyle(values) {
755
- var enumClass = {};
756
- objForEachKey(values, function (field, value) {
757
- enumClass[field] = value;
758
- enumClass[value] = field;
759
- });
760
- return deepFreeze(enumClass);
761
- }
762
-
763
- var strWindow = "window";
764
- var strDocument = "document";
765
- var strNavigator = "navigator";
766
934
  var strLocation = "location";
767
935
  var strConsole = "console";
768
936
  var strJSON = "JSON";
@@ -773,40 +941,9 @@
773
941
  var _isTrident = null;
774
942
  var _navUserAgentCheck = null;
775
943
  var _enableMocks = false;
776
- function getGlobalInst(name) {
777
- var gbl = getGlobal();
778
- if (gbl && gbl[name]) {
779
- return gbl[name];
780
- }
781
- if (name === strWindow && hasWindow()) {
782
- return window;
783
- }
784
- return null;
785
- }
786
- function hasWindow() {
787
- return Boolean(typeof window === strShimObject && window);
788
- }
789
- function hasDocument() {
790
- return Boolean(typeof document === strShimObject && document);
791
- }
792
- function getDocument() {
793
- if (hasDocument()) {
794
- return document;
795
- }
796
- return getGlobalInst(strDocument);
797
- }
798
- function hasNavigator() {
799
- return Boolean(typeof navigator === strShimObject && navigator);
800
- }
801
- function getNavigator() {
802
- if (hasNavigator()) {
803
- return navigator;
804
- }
805
- return getGlobalInst(strNavigator);
806
- }
807
944
  function getLocation(checkForMock) {
808
945
  if (checkForMock && _enableMocks) {
809
- var mockLocation = getGlobalInst("__mockLocation");
946
+ var mockLocation = getInst("__mockLocation");
810
947
  if (mockLocation) {
811
948
  return mockLocation;
812
949
  }
@@ -814,28 +951,28 @@
814
951
  if (typeof location === strShimObject && location) {
815
952
  return location;
816
953
  }
817
- return getGlobalInst(strLocation);
954
+ return getInst(strLocation);
818
955
  }
819
956
  function getConsole() {
820
957
  if (typeof console !== strShimUndefined) {
821
958
  return console;
822
959
  }
823
- return getGlobalInst(strConsole);
960
+ return getInst(strConsole);
824
961
  }
825
962
  function hasJSON() {
826
- return Boolean((typeof JSON === strShimObject && JSON) || getGlobalInst(strJSON) !== null);
963
+ return Boolean((typeof JSON === strShimObject && JSON) || getInst(strJSON) !== null);
827
964
  }
828
965
  function getJSON() {
829
966
  if (hasJSON()) {
830
- return JSON || getGlobalInst(strJSON);
967
+ return JSON || getInst(strJSON);
831
968
  }
832
969
  return null;
833
970
  }
834
971
  function getCrypto() {
835
- return getGlobalInst(strCrypto);
972
+ return getInst(strCrypto);
836
973
  }
837
974
  function getMsCrypto() {
838
- return getGlobalInst(strMsCrypto);
975
+ return getInst(strMsCrypto);
839
976
  }
840
977
  function isIE() {
841
978
  var nav = getNavigator();
@@ -846,33 +983,6 @@
846
983
  }
847
984
  return _isTrident;
848
985
  }
849
- function dumpObj(object) {
850
- var objectTypeDump = Object[strShimPrototype].toString[_DYN_CALL ](object);
851
- var propertyValueDump = STR_EMPTY;
852
- if (objectTypeDump === "[object Error]") {
853
- propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object[_DYN_NAME$1 ] + "'";
854
- }
855
- else if (hasJSON()) {
856
- propertyValueDump = getJSON().stringify(object);
857
- }
858
- return objectTypeDump + propertyValueDump;
859
- }
860
-
861
- var _aiNamespace = null;
862
- function _getExtensionNamespace() {
863
- var target = getGlobalInst("Microsoft");
864
- if (target) {
865
- _aiNamespace = target["ApplicationInsights"];
866
- }
867
- return _aiNamespace;
868
- }
869
- function getDebugExt(config) {
870
- var ns = _aiNamespace;
871
- if (!ns && config.disableDbgExt !== true) {
872
- ns = _aiNamespace || _getExtensionNamespace();
873
- }
874
- return ns ? ns["ChromeDbgExt"] : null;
875
- }
876
986
 
877
987
  var AiNonUserActionablePrefix = "AI (Internal): ";
878
988
  var AiUserActionablePrefix = "AI: ";
@@ -1042,14 +1152,13 @@
1042
1152
  var PerfEvent = /** @class */ (function () {
1043
1153
  function PerfEvent(name, payloadDetails, isAsync) {
1044
1154
  var _self = this;
1045
- var accessorDefined = false;
1046
1155
  _self.start = dateNow();
1047
1156
  _self[_DYN_NAME$1 ] = name;
1048
1157
  _self[_DYN_IS_ASYNC ] = isAsync;
1049
1158
  _self[_DYN_IS_CHILD_EVT ] = function () { return false; };
1050
1159
  if (isFunction(payloadDetails)) {
1051
1160
  var theDetails_1;
1052
- accessorDefined = objDefineAccessors(_self, "payload", function () {
1161
+ objDefineAccessors(_self, "payload", function () {
1053
1162
  if (!theDetails_1 && isFunction(payloadDetails)) {
1054
1163
  theDetails_1 = payloadDetails();
1055
1164
  payloadDetails = null;
@@ -1097,9 +1206,6 @@
1097
1206
  _self[_DYN_TIME ] = dateNow() - _self.start;
1098
1207
  _self.exTime = _self[_DYN_TIME ] - childTime;
1099
1208
  _self[_DYN_COMPLETE ] = function () { };
1100
- if (!accessorDefined && isFunction(payloadDetails)) {
1101
- _self.payload = payloadDetails();
1102
- }
1103
1209
  };
1104
1210
  }
1105
1211
  PerfEvent.ParentContextKey = "parent";
@@ -1219,7 +1325,7 @@
1219
1325
  }
1220
1326
 
1221
1327
  var _objDefineProperty = ObjDefineProperty;
1222
- var version = "3.0.0-beta.2208-04";
1328
+ var version = "3.0.0-beta.2208-18";
1223
1329
  var instanceName = "." + newId(6);
1224
1330
  var _dataUid = 0;
1225
1331
  function _createAccessor(target, prop, value) {
@@ -1290,369 +1396,122 @@
1290
1396
  return data;
1291
1397
  }
1292
1398
 
1293
- var strToGMTString = "toGMTString";
1294
- var strToUTCString = "toUTCString";
1295
- var strCookie = "cookie";
1296
- var strExpires = "expires";
1297
- var strEnabled = "enabled";
1298
- var strIsCookieUseDisabled = "isCookieUseDisabled";
1299
- var strDisableCookiesUsage = "disableCookiesUsage";
1300
- var strConfigCookieMgr = "_ckMgr";
1301
- var _supportsCookies = null;
1302
- var _allowUaSameSite = null;
1303
- var _parsedCookieValue = null;
1304
- var _doc = getDocument();
1305
- var _cookieCache = {};
1306
- var _globalCookieConfig = {};
1307
- function _gblCookieMgr(config, logger) {
1308
- var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
1309
- if (!inst) {
1310
- inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
1311
- _globalCookieConfig[strConfigCookieMgr] = inst;
1399
+ function generateW3CId() {
1400
+ var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1401
+ var oct = STR_EMPTY, tmp;
1402
+ for (var a = 0; a < 4; a++) {
1403
+ tmp = random32();
1404
+ oct +=
1405
+ hexValues[tmp & 0xF] +
1406
+ hexValues[tmp >> 4 & 0xF] +
1407
+ hexValues[tmp >> 8 & 0xF] +
1408
+ hexValues[tmp >> 12 & 0xF] +
1409
+ hexValues[tmp >> 16 & 0xF] +
1410
+ hexValues[tmp >> 20 & 0xF] +
1411
+ hexValues[tmp >> 24 & 0xF] +
1412
+ hexValues[tmp >> 28 & 0xF];
1312
1413
  }
1313
- return inst;
1414
+ var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
1415
+ return oct[_DYN_SUBSTR ](0, 8) + oct[_DYN_SUBSTR ](9, 4) + "4" + oct[_DYN_SUBSTR ](13, 3) + clockSequenceHi + oct[_DYN_SUBSTR ](16, 3) + oct[_DYN_SUBSTR ](19, 12);
1314
1416
  }
1315
- function _isMgrEnabled(cookieMgr) {
1316
- if (cookieMgr) {
1317
- return cookieMgr.isEnabled();
1417
+
1418
+ var INVALID_TRACE_ID = "00000000000000000000000000000000";
1419
+ var INVALID_SPAN_ID = "0000000000000000";
1420
+ function _isValid(value, len, invalidValue) {
1421
+ if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
1422
+ return !!value.match(/^[\da-f]*$/);
1318
1423
  }
1319
- return true;
1424
+ return false;
1320
1425
  }
1321
- function _createCookieMgrConfig(rootConfig) {
1322
- var cookieMgrCfg = rootConfig[_DYN_COOKIE_CFG ] = rootConfig[_DYN_COOKIE_CFG ] || {};
1323
- setValue(cookieMgrCfg, "domain", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);
1324
- setValue(cookieMgrCfg, "path", rootConfig.cookiePath || "/", null, isNullOrUndefined);
1325
- if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {
1326
- var cookieEnabled = void 0;
1327
- if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
1328
- cookieEnabled = !rootConfig[strIsCookieUseDisabled];
1329
- }
1330
- if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
1331
- cookieEnabled = !rootConfig[strDisableCookiesUsage];
1426
+ function isValidTraceId(value) {
1427
+ return _isValid(value, 32, INVALID_TRACE_ID);
1428
+ }
1429
+ function isValidSpanId(value) {
1430
+ return _isValid(value, 16, INVALID_SPAN_ID);
1431
+ }
1432
+
1433
+ var pluginStateData = createElmNodeData("plugin");
1434
+ function _getPluginState(plugin) {
1435
+ return pluginStateData.get(plugin, "state", {}, true);
1436
+ }
1437
+
1438
+ var strTelemetryPluginChain = "TelemetryPluginChain";
1439
+ var strHasRunFlags = "_hasRun";
1440
+ var strGetTelCtx = "_getTelCtx";
1441
+ var _chainId = 0;
1442
+ function _getNextProxyStart(proxy, core, startAt) {
1443
+ while (proxy) {
1444
+ if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
1445
+ return proxy;
1332
1446
  }
1333
- cookieMgrCfg[strEnabled] = cookieEnabled;
1447
+ proxy = proxy[_DYN_GET_NEXT ]();
1334
1448
  }
1335
- return cookieMgrCfg;
1449
+ return createTelemetryProxyChain([startAt], core[_DYN_CONFIG$1 ] || {}, core);
1336
1450
  }
1337
- function safeGetCookieMgr(core, config) {
1338
- var cookieMgr;
1339
- if (core) {
1340
- cookieMgr = core.getCookieMgr();
1451
+ function _createInternalContext(telemetryChain, config, core, startAt) {
1452
+ var _nextProxy = null;
1453
+ var _onComplete = [];
1454
+ if (startAt !== null) {
1455
+ _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
1341
1456
  }
1342
- else if (config) {
1343
- var cookieCfg = config[_DYN_COOKIE_CFG ];
1344
- if (cookieCfg[strConfigCookieMgr]) {
1345
- cookieMgr = cookieCfg[strConfigCookieMgr];
1457
+ var context = {
1458
+ _next: _moveNext,
1459
+ ctx: {
1460
+ core: function () {
1461
+ return core;
1462
+ },
1463
+ diagLog: function () {
1464
+ return safeGetLogger(core, config);
1465
+ },
1466
+ getCfg: function () {
1467
+ return config;
1468
+ },
1469
+ getExtCfg: _getExtCfg,
1470
+ getConfig: _getConfig,
1471
+ hasNext: function () {
1472
+ return !!_nextProxy;
1473
+ },
1474
+ getNext: function () {
1475
+ return _nextProxy;
1476
+ },
1477
+ setNext: function (nextPlugin) {
1478
+ _nextProxy = nextPlugin;
1479
+ },
1480
+ iterate: _iterateChain,
1481
+ onComplete: _addOnComplete
1346
1482
  }
1347
- else {
1348
- cookieMgr = createCookieMgr(config);
1483
+ };
1484
+ function _addOnComplete(onComplete, that) {
1485
+ var args = [];
1486
+ for (var _i = 2; _i < arguments.length; _i++) {
1487
+ args[_i - 2] = arguments[_i];
1488
+ }
1489
+ if (onComplete) {
1490
+ _onComplete[_DYN_PUSH ]({
1491
+ func: onComplete,
1492
+ self: !isUndefined(that) ? that : context.ctx,
1493
+ args: args
1494
+ });
1349
1495
  }
1350
1496
  }
1351
- if (!cookieMgr) {
1352
- cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
1353
- }
1354
- return cookieMgr;
1355
- }
1356
- function createCookieMgr(rootConfig, logger) {
1357
- var _a;
1358
- var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);
1359
- var _path = cookieMgrConfig.path || "/";
1360
- var _domain = cookieMgrConfig.domain;
1361
- var _enabled = cookieMgrConfig[strEnabled] !== false;
1362
- var cookieMgr = (_a = {
1363
- isEnabled: function () {
1364
- var enabled = _enabled && areCookiesSupported(logger);
1365
- var gblManager = _globalCookieConfig[strConfigCookieMgr];
1366
- if (enabled && gblManager && cookieMgr !== gblManager) {
1367
- enabled = _isMgrEnabled(gblManager);
1368
- }
1369
- return enabled;
1370
- }
1371
- },
1372
- _a[_DYN_SET_ENABLED ] = function (value) {
1373
- _enabled = value !== false;
1374
- },
1375
- _a.set = function (name, value, maxAgeSec, domain, path) {
1376
- var result = false;
1377
- if (_isMgrEnabled(cookieMgr)) {
1378
- var values = {};
1379
- var theValue = strTrim(value || STR_EMPTY);
1380
- var idx = theValue[_DYN_INDEX_OF ](";");
1381
- if (idx !== -1) {
1382
- theValue = strTrim(value[_DYN_SUBSTRING$1 ](0, idx));
1383
- values = _extractParts(value[_DYN_SUBSTRING$1 ](idx + 1));
1384
- }
1385
- setValue(values, "domain", domain || _domain, isTruthy, isUndefined);
1386
- if (!isNullOrUndefined(maxAgeSec)) {
1387
- var _isIE = isIE();
1388
- if (isUndefined(values[strExpires])) {
1389
- var nowMs = dateNow();
1390
- var expireMs = nowMs + (maxAgeSec * 1000);
1391
- if (expireMs > 0) {
1392
- var expiry = new Date();
1393
- expiry.setTime(expireMs);
1394
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
1395
- }
1396
- }
1397
- if (!_isIE) {
1398
- setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
1399
- }
1400
- }
1401
- var location_1 = getLocation();
1402
- if (location_1 && location_1.protocol === "https:") {
1403
- setValue(values, "secure", null, null, isUndefined);
1404
- if (_allowUaSameSite === null) {
1405
- _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
1406
- }
1407
- if (_allowUaSameSite) {
1408
- setValue(values, "SameSite", "None", null, isUndefined);
1409
- }
1410
- }
1411
- setValue(values, "path", path || _path, null, isUndefined);
1412
- var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
1413
- setCookieFn(name, _formatCookieValue(theValue, values));
1414
- result = true;
1415
- }
1416
- return result;
1417
- },
1418
- _a.get = function (name) {
1419
- var value = STR_EMPTY;
1420
- if (_isMgrEnabled(cookieMgr)) {
1421
- value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1422
- }
1423
- return value;
1424
- },
1425
- _a.del = function (name, path) {
1426
- var result = false;
1427
- if (_isMgrEnabled(cookieMgr)) {
1428
- result = cookieMgr.purge(name, path);
1429
- }
1430
- return result;
1431
- },
1432
- _a.purge = function (name, path) {
1433
- var _a;
1434
- var result = false;
1435
- if (areCookiesSupported(logger)) {
1436
- var values = (_a = {},
1437
- _a["path"] = path ? path : "/",
1438
- _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
1439
- _a);
1440
- if (!isIE()) {
1441
- values["max-age"] = "0";
1442
- }
1443
- var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1444
- delCookie(name, _formatCookieValue(STR_EMPTY, values));
1445
- result = true;
1446
- }
1447
- return result;
1448
- },
1449
- _a);
1450
- cookieMgr[strConfigCookieMgr] = cookieMgr;
1451
- return cookieMgr;
1452
- }
1453
- function areCookiesSupported(logger) {
1454
- if (_supportsCookies === null) {
1455
- _supportsCookies = false;
1456
- try {
1457
- var doc = _doc || {};
1458
- _supportsCookies = doc[strCookie] !== undefined;
1459
- }
1460
- catch (e) {
1461
- _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1462
- }
1463
- }
1464
- return _supportsCookies;
1465
- }
1466
- function _extractParts(theValue) {
1467
- var values = {};
1468
- if (theValue && theValue[_DYN_LENGTH$2 ]) {
1469
- var parts = strTrim(theValue)[_DYN_SPLIT ](";");
1470
- arrForEach(parts, function (thePart) {
1471
- thePart = strTrim(thePart || STR_EMPTY);
1472
- if (thePart) {
1473
- var idx = thePart[_DYN_INDEX_OF ]("=");
1474
- if (idx === -1) {
1475
- values[thePart] = null;
1476
- }
1477
- else {
1478
- values[strTrim(thePart[_DYN_SUBSTRING$1 ](0, idx))] = strTrim(thePart[_DYN_SUBSTRING$1 ](idx + 1));
1479
- }
1480
- }
1481
- });
1482
- }
1483
- return values;
1484
- }
1485
- function _formatDate(theDate, func) {
1486
- if (isFunction(theDate[func])) {
1487
- return theDate[func]();
1488
- }
1489
- return null;
1490
- }
1491
- function _formatCookieValue(value, values) {
1492
- var cookieValue = value || STR_EMPTY;
1493
- objForEachKey(values, function (name, theValue) {
1494
- cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
1495
- });
1496
- return cookieValue;
1497
- }
1498
- function _getCookieValue(name) {
1499
- var cookieValue = STR_EMPTY;
1500
- if (_doc) {
1501
- var theCookie = _doc[strCookie] || STR_EMPTY;
1502
- if (_parsedCookieValue !== theCookie) {
1503
- _cookieCache = _extractParts(theCookie);
1504
- _parsedCookieValue = theCookie;
1505
- }
1506
- cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);
1507
- }
1508
- return cookieValue;
1509
- }
1510
- function _setCookieValue(name, cookieValue) {
1511
- if (_doc) {
1512
- _doc[strCookie] = name + "=" + cookieValue;
1513
- }
1514
- }
1515
- function uaDisallowsSameSiteNone(userAgent) {
1516
- if (!isString(userAgent)) {
1517
- return false;
1518
- }
1519
- if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
1520
- return true;
1521
- }
1522
- if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
1523
- return true;
1524
- }
1525
- if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
1526
- return true;
1527
- }
1528
- if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
1529
- return true;
1530
- }
1531
- if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
1532
- return true;
1533
- }
1534
- if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
1535
- return true;
1536
- }
1537
- return false;
1538
- }
1539
-
1540
- function generateW3CId() {
1541
- var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
1542
- var oct = STR_EMPTY, tmp;
1543
- for (var a = 0; a < 4; a++) {
1544
- tmp = random32();
1545
- oct +=
1546
- hexValues[tmp & 0xF] +
1547
- hexValues[tmp >> 4 & 0xF] +
1548
- hexValues[tmp >> 8 & 0xF] +
1549
- hexValues[tmp >> 12 & 0xF] +
1550
- hexValues[tmp >> 16 & 0xF] +
1551
- hexValues[tmp >> 20 & 0xF] +
1552
- hexValues[tmp >> 24 & 0xF] +
1553
- hexValues[tmp >> 28 & 0xF];
1554
- }
1555
- var clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
1556
- return oct[_DYN_SUBSTR ](0, 8) + oct[_DYN_SUBSTR ](9, 4) + "4" + oct[_DYN_SUBSTR ](13, 3) + clockSequenceHi + oct[_DYN_SUBSTR ](16, 3) + oct[_DYN_SUBSTR ](19, 12);
1557
- }
1558
-
1559
- var INVALID_TRACE_ID = "00000000000000000000000000000000";
1560
- var INVALID_SPAN_ID = "0000000000000000";
1561
- function _isValid(value, len, invalidValue) {
1562
- if (value && value[_DYN_LENGTH$2 ] === len && value !== invalidValue) {
1563
- return !!value.match(/^[\da-f]*$/);
1564
- }
1565
- return false;
1566
- }
1567
- function isValidTraceId(value) {
1568
- return _isValid(value, 32, INVALID_TRACE_ID);
1569
- }
1570
- function isValidSpanId(value) {
1571
- return _isValid(value, 16, INVALID_SPAN_ID);
1572
- }
1573
-
1574
- var pluginStateData = createElmNodeData("plugin");
1575
- function _getPluginState(plugin) {
1576
- return pluginStateData.get(plugin, "state", {}, true);
1577
- }
1578
-
1579
- var strTelemetryPluginChain = "TelemetryPluginChain";
1580
- var strHasRunFlags = "_hasRun";
1581
- var strGetTelCtx = "_getTelCtx";
1582
- var _chainId = 0;
1583
- function _getNextProxyStart(proxy, core, startAt) {
1584
- while (proxy) {
1585
- if (proxy[_DYN_GET_PLUGIN ]() === startAt) {
1586
- return proxy;
1587
- }
1588
- proxy = proxy[_DYN_GET_NEXT ]();
1589
- }
1590
- return createTelemetryProxyChain([startAt], core[_DYN_CONFIG$1 ] || {}, core);
1591
- }
1592
- function _createInternalContext(telemetryChain, config, core, startAt) {
1593
- var _nextProxy = null;
1594
- var _onComplete = [];
1595
- if (startAt !== null) {
1596
- _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
1597
- }
1598
- var context = {
1599
- _next: _moveNext,
1600
- ctx: {
1601
- core: function () {
1602
- return core;
1603
- },
1604
- diagLog: function () {
1605
- return safeGetLogger(core, config);
1606
- },
1607
- getCfg: function () {
1608
- return config;
1609
- },
1610
- getExtCfg: _getExtCfg,
1611
- getConfig: _getConfig,
1612
- hasNext: function () {
1613
- return !!_nextProxy;
1614
- },
1615
- getNext: function () {
1616
- return _nextProxy;
1617
- },
1618
- setNext: function (nextPlugin) {
1619
- _nextProxy = nextPlugin;
1620
- },
1621
- iterate: _iterateChain,
1622
- onComplete: _addOnComplete
1623
- }
1624
- };
1625
- function _addOnComplete(onComplete, that) {
1626
- var args = [];
1627
- for (var _i = 2; _i < arguments.length; _i++) {
1628
- args[_i - 2] = arguments[_i];
1629
- }
1630
- if (onComplete) {
1631
- _onComplete[_DYN_PUSH ]({
1632
- func: onComplete,
1633
- self: !isUndefined(that) ? that : context.ctx,
1634
- args: args
1635
- });
1636
- }
1637
- }
1638
- function _moveNext() {
1639
- var nextProxy = _nextProxy;
1640
- _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
1641
- if (!nextProxy) {
1642
- var onComplete = _onComplete;
1643
- if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
1644
- arrForEach(onComplete, function (completeDetails) {
1645
- try {
1646
- completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
1647
- }
1648
- catch (e) {
1649
- _throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1650
- }
1651
- });
1652
- _onComplete = [];
1653
- }
1654
- }
1655
- return nextProxy;
1497
+ function _moveNext() {
1498
+ var nextProxy = _nextProxy;
1499
+ _nextProxy = nextProxy ? nextProxy[_DYN_GET_NEXT ]() : null;
1500
+ if (!nextProxy) {
1501
+ var onComplete = _onComplete;
1502
+ if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
1503
+ arrForEach(onComplete, function (completeDetails) {
1504
+ try {
1505
+ completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
1506
+ }
1507
+ catch (e) {
1508
+ _throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1509
+ }
1510
+ });
1511
+ _onComplete = [];
1512
+ }
1513
+ }
1514
+ return nextProxy;
1656
1515
  }
1657
1516
  function _getExtCfg(identifier, defaultValue, mergeDefault) {
1658
1517
  if (defaultValue === void 0) { defaultValue = {}; }
@@ -1903,25 +1762,270 @@
1903
1762
  unloadCtx[_DYN_PROCESS_NEXT ](unloadState);
1904
1763
  }
1905
1764
  }
1906
- function _updatePlugin(updateCtx, updateState) {
1907
- function _callUpdate() {
1908
- var hasRun = false;
1909
- if (plugin) {
1910
- var pluginState = _getPluginState(plugin);
1911
- var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
1912
- if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
1913
- if (plugin[_DYN_UPDATE$1 ] && plugin[_DYN_UPDATE$1 ](updateCtx, updateState) === true) {
1914
- hasRun = true;
1915
- }
1916
- }
1917
- }
1918
- return hasRun;
1919
- }
1920
- if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1921
- updateCtx[_DYN_PROCESS_NEXT ](updateState);
1922
- }
1765
+ function _updatePlugin(updateCtx, updateState) {
1766
+ function _callUpdate() {
1767
+ var hasRun = false;
1768
+ if (plugin) {
1769
+ var pluginState = _getPluginState(plugin);
1770
+ var pluginCore = plugin[STR_CORE] || pluginState[STR_CORE ];
1771
+ if (plugin && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[_DYN_TEARDOWN ]) {
1772
+ if (plugin[_DYN_UPDATE$1 ] && plugin[_DYN_UPDATE$1 ](updateCtx, updateState) === true) {
1773
+ hasRun = true;
1774
+ }
1775
+ }
1776
+ }
1777
+ return hasRun;
1778
+ }
1779
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1780
+ updateCtx[_DYN_PROCESS_NEXT ](updateState);
1781
+ }
1782
+ }
1783
+ return objFreeze(proxyChain);
1784
+ }
1785
+
1786
+ var strToGMTString = "toGMTString";
1787
+ var strToUTCString = "toUTCString";
1788
+ var strCookie = "cookie";
1789
+ var strExpires = "expires";
1790
+ var strEnabled = "enabled";
1791
+ var strIsCookieUseDisabled = "isCookieUseDisabled";
1792
+ var strDisableCookiesUsage = "disableCookiesUsage";
1793
+ var strConfigCookieMgr = "_ckMgr";
1794
+ var _supportsCookies = null;
1795
+ var _allowUaSameSite = null;
1796
+ var _parsedCookieValue = null;
1797
+ var _doc = getDocument();
1798
+ var _cookieCache = {};
1799
+ var _globalCookieConfig = {};
1800
+ function _gblCookieMgr(config, logger) {
1801
+ var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr];
1802
+ if (!inst) {
1803
+ inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger);
1804
+ _globalCookieConfig[strConfigCookieMgr] = inst;
1805
+ }
1806
+ return inst;
1807
+ }
1808
+ function _isMgrEnabled(cookieMgr) {
1809
+ if (cookieMgr) {
1810
+ return cookieMgr.isEnabled();
1811
+ }
1812
+ return true;
1813
+ }
1814
+ function _createCookieMgrConfig(rootConfig) {
1815
+ var cookieMgrCfg = rootConfig[_DYN_COOKIE_CFG ] = rootConfig[_DYN_COOKIE_CFG ] || {};
1816
+ setValue(cookieMgrCfg, "domain", rootConfig.cookieDomain, isNotNullOrUndefined, isNullOrUndefined);
1817
+ setValue(cookieMgrCfg, "path", rootConfig.cookiePath || "/", null, isNullOrUndefined);
1818
+ if (isNullOrUndefined(cookieMgrCfg[strEnabled])) {
1819
+ var cookieEnabled = void 0;
1820
+ if (!isUndefined(rootConfig[strIsCookieUseDisabled])) {
1821
+ cookieEnabled = !rootConfig[strIsCookieUseDisabled];
1822
+ }
1823
+ if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
1824
+ cookieEnabled = !rootConfig[strDisableCookiesUsage];
1825
+ }
1826
+ cookieMgrCfg[strEnabled] = cookieEnabled;
1827
+ }
1828
+ return cookieMgrCfg;
1829
+ }
1830
+ function safeGetCookieMgr(core, config) {
1831
+ var cookieMgr;
1832
+ if (core) {
1833
+ cookieMgr = core.getCookieMgr();
1834
+ }
1835
+ else if (config) {
1836
+ var cookieCfg = config[_DYN_COOKIE_CFG ];
1837
+ if (cookieCfg[strConfigCookieMgr]) {
1838
+ cookieMgr = cookieCfg[strConfigCookieMgr];
1839
+ }
1840
+ else {
1841
+ cookieMgr = createCookieMgr(config);
1842
+ }
1843
+ }
1844
+ if (!cookieMgr) {
1845
+ cookieMgr = _gblCookieMgr(config, (core || {})[_DYN_LOGGER ]);
1846
+ }
1847
+ return cookieMgr;
1848
+ }
1849
+ function createCookieMgr(rootConfig, logger) {
1850
+ var cookieMgrConfig = _createCookieMgrConfig(rootConfig || _globalCookieConfig);
1851
+ var _path = cookieMgrConfig.path || "/";
1852
+ var _domain = cookieMgrConfig.domain;
1853
+ var _enabled = cookieMgrConfig[strEnabled] !== false;
1854
+ var cookieMgr = {
1855
+ isEnabled: function () {
1856
+ var enabled = _enabled && areCookiesSupported(logger);
1857
+ var gblManager = _globalCookieConfig[strConfigCookieMgr];
1858
+ if (enabled && gblManager && cookieMgr !== gblManager) {
1859
+ enabled = _isMgrEnabled(gblManager);
1860
+ }
1861
+ return enabled;
1862
+ },
1863
+ setEnabled: function (value) {
1864
+ _enabled = value !== false;
1865
+ },
1866
+ set: function (name, value, maxAgeSec, domain, path) {
1867
+ var result = false;
1868
+ if (_isMgrEnabled(cookieMgr)) {
1869
+ var values = {};
1870
+ var theValue = strTrim(value || STR_EMPTY);
1871
+ var idx = theValue.indexOf(";");
1872
+ if (idx !== -1) {
1873
+ theValue = strTrim(value[_DYN_SUBSTRING$1 ](0, idx));
1874
+ values = _extractParts(value[_DYN_SUBSTRING$1 ](idx + 1));
1875
+ }
1876
+ setValue(values, "domain", domain || _domain, isTruthy, isUndefined);
1877
+ if (!isNullOrUndefined(maxAgeSec)) {
1878
+ var _isIE = isIE();
1879
+ if (isUndefined(values[strExpires])) {
1880
+ var nowMs = dateNow();
1881
+ var expireMs = nowMs + (maxAgeSec * 1000);
1882
+ if (expireMs > 0) {
1883
+ var expiry = new Date();
1884
+ expiry.setTime(expireMs);
1885
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
1886
+ }
1887
+ }
1888
+ if (!_isIE) {
1889
+ setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
1890
+ }
1891
+ }
1892
+ var location_1 = getLocation();
1893
+ if (location_1 && location_1.protocol === "https:") {
1894
+ setValue(values, "secure", null, null, isUndefined);
1895
+ if (_allowUaSameSite === null) {
1896
+ _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
1897
+ }
1898
+ if (_allowUaSameSite) {
1899
+ setValue(values, "SameSite", "None", null, isUndefined);
1900
+ }
1901
+ }
1902
+ setValue(values, "path", path || _path, null, isUndefined);
1903
+ var setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
1904
+ setCookieFn(name, _formatCookieValue(theValue, values));
1905
+ result = true;
1906
+ }
1907
+ return result;
1908
+ },
1909
+ get: function (name) {
1910
+ var value = STR_EMPTY;
1911
+ if (_isMgrEnabled(cookieMgr)) {
1912
+ value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1913
+ }
1914
+ return value;
1915
+ },
1916
+ del: function (name, path) {
1917
+ var result = false;
1918
+ if (_isMgrEnabled(cookieMgr)) {
1919
+ result = cookieMgr.purge(name, path);
1920
+ }
1921
+ return result;
1922
+ },
1923
+ purge: function (name, path) {
1924
+ var _a;
1925
+ var result = false;
1926
+ if (areCookiesSupported(logger)) {
1927
+ var values = (_a = {},
1928
+ _a["path"] = path ? path : "/",
1929
+ _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
1930
+ _a);
1931
+ if (!isIE()) {
1932
+ values["max-age"] = "0";
1933
+ }
1934
+ var delCookie = cookieMgrConfig.delCookie || _setCookieValue;
1935
+ delCookie(name, _formatCookieValue(STR_EMPTY, values));
1936
+ result = true;
1937
+ }
1938
+ return result;
1939
+ }
1940
+ };
1941
+ cookieMgr[strConfigCookieMgr] = cookieMgr;
1942
+ return cookieMgr;
1943
+ }
1944
+ function areCookiesSupported(logger) {
1945
+ if (_supportsCookies === null) {
1946
+ _supportsCookies = false;
1947
+ try {
1948
+ var doc = _doc || {};
1949
+ _supportsCookies = doc[strCookie] !== undefined;
1950
+ }
1951
+ catch (e) {
1952
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1953
+ }
1954
+ }
1955
+ return _supportsCookies;
1956
+ }
1957
+ function _extractParts(theValue) {
1958
+ var values = {};
1959
+ if (theValue && theValue[_DYN_LENGTH$2 ]) {
1960
+ var parts = strTrim(theValue)[_DYN_SPLIT ](";");
1961
+ arrForEach(parts, function (thePart) {
1962
+ thePart = strTrim(thePart || STR_EMPTY);
1963
+ if (thePart) {
1964
+ var idx = thePart.indexOf("=");
1965
+ if (idx === -1) {
1966
+ values[thePart] = null;
1967
+ }
1968
+ else {
1969
+ values[strTrim(thePart[_DYN_SUBSTRING$1 ](0, idx))] = strTrim(thePart[_DYN_SUBSTRING$1 ](idx + 1));
1970
+ }
1971
+ }
1972
+ });
1973
+ }
1974
+ return values;
1975
+ }
1976
+ function _formatDate(theDate, func) {
1977
+ if (isFunction(theDate[func])) {
1978
+ return theDate[func]();
1979
+ }
1980
+ return null;
1981
+ }
1982
+ function _formatCookieValue(value, values) {
1983
+ var cookieValue = value || STR_EMPTY;
1984
+ objForEachKey(values, function (name, theValue) {
1985
+ cookieValue += "; " + name + (!isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY);
1986
+ });
1987
+ return cookieValue;
1988
+ }
1989
+ function _getCookieValue(name) {
1990
+ var cookieValue = STR_EMPTY;
1991
+ if (_doc) {
1992
+ var theCookie = _doc[strCookie] || STR_EMPTY;
1993
+ if (_parsedCookieValue !== theCookie) {
1994
+ _cookieCache = _extractParts(theCookie);
1995
+ _parsedCookieValue = theCookie;
1996
+ }
1997
+ cookieValue = strTrim(_cookieCache[name] || STR_EMPTY);
1998
+ }
1999
+ return cookieValue;
2000
+ }
2001
+ function _setCookieValue(name, cookieValue) {
2002
+ if (_doc) {
2003
+ _doc[strCookie] = name + "=" + cookieValue;
1923
2004
  }
1924
- return objFreeze(proxyChain);
2005
+ }
2006
+ function uaDisallowsSameSiteNone(userAgent) {
2007
+ if (!isString(userAgent)) {
2008
+ return false;
2009
+ }
2010
+ if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) {
2011
+ return true;
2012
+ }
2013
+ if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) {
2014
+ return true;
2015
+ }
2016
+ if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) {
2017
+ return true;
2018
+ }
2019
+ if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) {
2020
+ return true;
2021
+ }
2022
+ if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) {
2023
+ return true;
2024
+ }
2025
+ if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) {
2026
+ return true;
2027
+ }
2028
+ return false;
1925
2029
  }
1926
2030
 
1927
2031
  function createUnloadHandlerContainer() {
@@ -2110,113 +2214,7 @@
2110
2214
  var _DYN_STRINGIFY = "stringify";
2111
2215
  var _DYN_DURATION = "duration";
2112
2216
  var _DYN_SUBSTRING = "substring";
2113
- var _DYN_SANITIZE_KEY_AND_ADD2 = "sanitizeKeyAndAddUniqueness";
2114
- var _DYN_SANITIZE_EXCEPTION = "sanitizeException";
2115
- var _DYN_SANITIZE_PROPERTIES = "sanitizeProperties";
2116
- var _DYN_SANITIZE_MEASUREMENT3 = "sanitizeMeasurements";
2117
-
2118
- var strEmpty = "";
2119
- function msToTimeSpan(totalms) {
2120
- if (isNaN(totalms) || totalms < 0) {
2121
- totalms = 0;
2122
- }
2123
- totalms = Math.round(totalms);
2124
- var ms = strEmpty + totalms % 1000;
2125
- var sec = strEmpty + Math.floor(totalms / 1000) % 60;
2126
- var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
2127
- var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2128
- var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
2129
- ms = ms[_DYN_LENGTH$1 ] === 1 ? "00" + ms : ms[_DYN_LENGTH$1 ] === 2 ? "0" + ms : ms;
2130
- sec = sec[_DYN_LENGTH$1 ] < 2 ? "0" + sec : sec;
2131
- min = min[_DYN_LENGTH$1 ] < 2 ? "0" + min : min;
2132
- hour = hour[_DYN_LENGTH$1 ] < 2 ? "0" + hour : hour;
2133
- return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
2134
- }
2135
-
2136
- var StorageType = createEnumStyle({
2137
- LocalStorage: 0 ,
2138
- SessionStorage: 1
2139
- });
2140
- createEnumStyle({
2141
- AI: 0 ,
2142
- AI_AND_W3C: 1 ,
2143
- W3C: 2
2144
- });
2145
-
2146
- var _canUseLocalStorage = undefined;
2147
- function _getLocalStorageObject() {
2148
- if (utlCanUseLocalStorage()) {
2149
- return _getVerifiedStorageObject(StorageType.LocalStorage);
2150
- }
2151
- return null;
2152
- }
2153
- function _getVerifiedStorageObject(storageType) {
2154
- try {
2155
- if (isNullOrUndefined(getGlobal())) {
2156
- return null;
2157
- }
2158
- var uid = (new Date)[_DYN_TO_STRING ]();
2159
- var storage = getGlobalInst(storageType === StorageType.LocalStorage ? "localStorage" : "sessionStorage");
2160
- storage.setItem(uid, uid);
2161
- var fail = storage.getItem(uid) !== uid;
2162
- storage[_DYN_REMOVE_ITEM ](uid);
2163
- if (!fail) {
2164
- return storage;
2165
- }
2166
- }
2167
- catch (exception) {
2168
- }
2169
- return null;
2170
- }
2171
- function utlCanUseLocalStorage(reset) {
2172
- if (reset || _canUseLocalStorage === undefined) {
2173
- _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2174
- }
2175
- return _canUseLocalStorage;
2176
- }
2177
- function utlGetLocalStorage(logger, name) {
2178
- var storage = _getLocalStorageObject();
2179
- if (storage !== null) {
2180
- try {
2181
- return storage.getItem(name);
2182
- }
2183
- catch (e) {
2184
- _canUseLocalStorage = false;
2185
- _throwInternal(logger, 2 , 1 , "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2186
- }
2187
- }
2188
- return null;
2189
- }
2190
- function utlSetLocalStorage(logger, name, data) {
2191
- var storage = _getLocalStorageObject();
2192
- if (storage !== null) {
2193
- try {
2194
- storage.setItem(name, data);
2195
- return true;
2196
- }
2197
- catch (e) {
2198
- _canUseLocalStorage = false;
2199
- _throwInternal(logger, 2 , 3 , "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2200
- }
2201
- }
2202
- return false;
2203
- }
2204
- function utlRemoveStorage(logger, name) {
2205
- var storage = _getLocalStorageObject();
2206
- if (storage !== null) {
2207
- try {
2208
- storage[_DYN_REMOVE_ITEM ](name);
2209
- return true;
2210
- }
2211
- catch (e) {
2212
- _canUseLocalStorage = false;
2213
- _throwInternal(logger, 2 , 5 , "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2214
- }
2215
- }
2216
- return false;
2217
- }
2218
2217
 
2219
- var _a;
2220
2218
  function dataSanitizeKeyAndAddUniqueness(logger, key, map) {
2221
2219
  var origLength = key[_DYN_LENGTH$1 ];
2222
2220
  var field = dataSanitizeKey(logger, key);
@@ -2247,9 +2245,9 @@
2247
2245
  var valueTrunc;
2248
2246
  if (value) {
2249
2247
  maxLength = maxLength ? maxLength : 1024 ;
2250
- value = strTrim(value);
2251
- if (value.toString()[_DYN_LENGTH$1 ] > maxLength) {
2252
- valueTrunc = value[_DYN_TO_STRING ]()[_DYN_SUBSTRING ](0, maxLength);
2248
+ value = strTrim(value[_DYN_TO_STRING ]());
2249
+ if (value[_DYN_LENGTH$1 ] > maxLength) {
2250
+ valueTrunc = value[_DYN_SUBSTRING ](0, maxLength);
2253
2251
  _throwInternal(logger, 2 , 61 , "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2254
2252
  }
2255
2253
  }
@@ -2258,27 +2256,6 @@
2258
2256
  function dataSanitizeUrl(logger, url) {
2259
2257
  return dataSanitizeInput(logger, url, 2048 , 66 );
2260
2258
  }
2261
- function dataSanitizeMessage(logger, message) {
2262
- var messageTrunc;
2263
- if (message) {
2264
- if (message[_DYN_LENGTH$1 ] > 32768 ) {
2265
- messageTrunc = message[_DYN_SUBSTRING ](0, 32768 );
2266
- _throwInternal(logger, 2 , 56 , "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
2267
- }
2268
- }
2269
- return messageTrunc || message;
2270
- }
2271
- function dataSanitizeException(logger, exception) {
2272
- var exceptionTrunc;
2273
- if (exception) {
2274
- var value = "" + exception;
2275
- if (value[_DYN_LENGTH$1 ] > 32768 ) {
2276
- exceptionTrunc = value[_DYN_SUBSTRING ](0, 32768 );
2277
- _throwInternal(logger, 2 , 52 , "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
2278
- }
2279
- }
2280
- return exceptionTrunc || exception;
2281
- }
2282
2259
  function dataSanitizeProperties(logger, properties) {
2283
2260
  if (properties) {
2284
2261
  var tempProps_1 = {};
@@ -2316,7 +2293,7 @@
2316
2293
  function dataSanitizeInput(logger, input, maxLength, _msgId) {
2317
2294
  var inputTrunc;
2318
2295
  if (input) {
2319
- input = strTrim(input);
2296
+ input = strTrim(input[_DYN_TO_STRING ]());
2320
2297
  if (input[_DYN_LENGTH$1 ] > maxLength) {
2321
2298
  inputTrunc = input[_DYN_SUBSTRING ](0, maxLength);
2322
2299
  _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
@@ -2328,28 +2305,6 @@
2328
2305
  var s = "00" + num;
2329
2306
  return s.substr(s[_DYN_LENGTH$1 ] - 3);
2330
2307
  }
2331
- (_a = {
2332
- MAX_NAME_LENGTH: 150 ,
2333
- MAX_ID_LENGTH: 128 ,
2334
- MAX_PROPERTY_LENGTH: 8192 ,
2335
- MAX_STRING_LENGTH: 1024 ,
2336
- MAX_URL_LENGTH: 2048 ,
2337
- MAX_MESSAGE_LENGTH: 32768 ,
2338
- MAX_EXCEPTION_LENGTH: 32768
2339
- },
2340
- _a[_DYN_SANITIZE_KEY_AND_ADD2 ] = dataSanitizeKeyAndAddUniqueness,
2341
- _a.sanitizeKey = dataSanitizeKey,
2342
- _a.sanitizeString = dataSanitizeString,
2343
- _a.sanitizeUrl = dataSanitizeUrl,
2344
- _a.sanitizeMessage = dataSanitizeMessage,
2345
- _a[_DYN_SANITIZE_EXCEPTION ] = dataSanitizeException,
2346
- _a[_DYN_SANITIZE_PROPERTIES ] = dataSanitizeProperties,
2347
- _a[_DYN_SANITIZE_MEASUREMENT3 ] = dataSanitizeMeasurements,
2348
- _a.sanitizeId = dataSanitizeId,
2349
- _a.sanitizeInput = dataSanitizeInput,
2350
- _a.padNumber = dsPadNumber,
2351
- _a.trim = strTrim,
2352
- _a);
2353
2308
 
2354
2309
  function createDistributedTraceContextFromTrace(telemetryTrace, parentCtx) {
2355
2310
  var trace = telemetryTrace || {};
@@ -2389,6 +2344,24 @@
2389
2344
  };
2390
2345
  }
2391
2346
 
2347
+ var strEmpty = "";
2348
+ function msToTimeSpan(totalms) {
2349
+ if (isNaN(totalms) || totalms < 0) {
2350
+ totalms = 0;
2351
+ }
2352
+ totalms = Math.round(totalms);
2353
+ var ms = strEmpty + totalms % 1000;
2354
+ var sec = strEmpty + Math.floor(totalms / 1000) % 60;
2355
+ var min = strEmpty + Math.floor(totalms / (1000 * 60)) % 60;
2356
+ var hour = strEmpty + Math.floor(totalms / (1000 * 60 * 60)) % 24;
2357
+ var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
2358
+ ms = ms[_DYN_LENGTH$1 ] === 1 ? "00" + ms : ms[_DYN_LENGTH$1 ] === 2 ? "0" + ms : ms;
2359
+ sec = sec[_DYN_LENGTH$1 ] < 2 ? "0" + sec : sec;
2360
+ min = min[_DYN_LENGTH$1 ] < 2 ? "0" + min : min;
2361
+ hour = hour[_DYN_LENGTH$1 ] < 2 ? "0" + hour : hour;
2362
+ return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms;
2363
+ }
2364
+
2392
2365
  var PageView = /** @class */ (function () {
2393
2366
  function PageView(logger, name, url, durationMs, properties, measurements, id) {
2394
2367
  this.aiDataContract = {
@@ -2508,6 +2481,89 @@
2508
2481
  };
2509
2482
  var CtxTagKeys = new ContextTagKeys();
2510
2483
 
2484
+ var StorageType = createEnumStyle({
2485
+ LocalStorage: 0 ,
2486
+ SessionStorage: 1
2487
+ });
2488
+ createEnumStyle({
2489
+ AI: 0 ,
2490
+ AI_AND_W3C: 1 ,
2491
+ W3C: 2
2492
+ });
2493
+
2494
+ var _canUseLocalStorage = undefined;
2495
+ function _getLocalStorageObject() {
2496
+ if (utlCanUseLocalStorage()) {
2497
+ return _getVerifiedStorageObject(StorageType.LocalStorage);
2498
+ }
2499
+ return null;
2500
+ }
2501
+ function _getVerifiedStorageObject(storageType) {
2502
+ try {
2503
+ if (isNullOrUndefined(getGlobal$1())) {
2504
+ return null;
2505
+ }
2506
+ var uid = (new Date)[_DYN_TO_STRING ]();
2507
+ var storage = getInst(storageType === StorageType.LocalStorage ? "localStorage" : "sessionStorage");
2508
+ storage.setItem(uid, uid);
2509
+ var fail = storage.getItem(uid) !== uid;
2510
+ storage[_DYN_REMOVE_ITEM ](uid);
2511
+ if (!fail) {
2512
+ return storage;
2513
+ }
2514
+ }
2515
+ catch (exception) {
2516
+ }
2517
+ return null;
2518
+ }
2519
+ function utlCanUseLocalStorage(reset) {
2520
+ if (reset || _canUseLocalStorage === undefined) {
2521
+ _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2522
+ }
2523
+ return _canUseLocalStorage;
2524
+ }
2525
+ function utlGetLocalStorage(logger, name) {
2526
+ var storage = _getLocalStorageObject();
2527
+ if (storage !== null) {
2528
+ try {
2529
+ return storage.getItem(name);
2530
+ }
2531
+ catch (e) {
2532
+ _canUseLocalStorage = false;
2533
+ _throwInternal(logger, 2 , 1 , "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2534
+ }
2535
+ }
2536
+ return null;
2537
+ }
2538
+ function utlSetLocalStorage(logger, name, data) {
2539
+ var storage = _getLocalStorageObject();
2540
+ if (storage !== null) {
2541
+ try {
2542
+ storage.setItem(name, data);
2543
+ return true;
2544
+ }
2545
+ catch (e) {
2546
+ _canUseLocalStorage = false;
2547
+ _throwInternal(logger, 2 , 3 , "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2548
+ }
2549
+ }
2550
+ return false;
2551
+ }
2552
+ function utlRemoveStorage(logger, name) {
2553
+ var storage = _getLocalStorageObject();
2554
+ if (storage !== null) {
2555
+ try {
2556
+ storage[_DYN_REMOVE_ITEM ](name);
2557
+ return true;
2558
+ }
2559
+ catch (e) {
2560
+ _canUseLocalStorage = false;
2561
+ _throwInternal(logger, 2 , 5 , "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2562
+ }
2563
+ }
2564
+ return false;
2565
+ }
2566
+
2511
2567
  var PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
2512
2568
  var BreezeChannelIdentifier = "AppInsightsChannelPlugin";
2513
2569
 
@@ -2560,7 +2616,7 @@
2560
2616
  var _DYN_COOKIE_SEPARATOR = "cookieSeparator";
2561
2617
  var _DYN_AUTH_USER_COOKIE_NAM8 = "authUserCookieName";
2562
2618
 
2563
- var Version = "3.0.0-beta.2208-04";
2619
+ var Version = "2.8.5";
2564
2620
  var Internal = /** @class */ (function () {
2565
2621
  function Internal(config) {
2566
2622
  this.sdkVersion = (config[_DYN_SDK_EXTENSION ] && config[_DYN_SDK_EXTENSION ]() ? config[_DYN_SDK_EXTENSION ]() + "_" : "") + "javascript:" + Version;
@@ -2918,9 +2974,9 @@
2918
2974
  var telemetryTrace = _self[_DYN_TELEMETRY_TRACE ];
2919
2975
  if (telemetryTrace) {
2920
2976
  var extTrace = getSetValue(getSetValue(evt, strExt), Extensions.TraceExt, { traceID: undefined, parentID: undefined });
2921
- setValue(extTrace, "traceID", telemetryTrace.traceID, isString);
2922
- setValue(extTrace, "name", telemetryTrace.name, isString);
2923
- setValue(extTrace, "parentID", telemetryTrace.parentID, isString);
2977
+ setValue(extTrace, "traceID", telemetryTrace.traceID, isString, isNullOrUndefined);
2978
+ setValue(extTrace, "name", telemetryTrace.name, isString, isNullOrUndefined);
2979
+ setValue(extTrace, "parentID", telemetryTrace.parentID, isString, isNullOrUndefined);
2924
2980
  }
2925
2981
  };
2926
2982
  _self.applyWebContext = function (evt, itemCtx) {
@@ -3083,7 +3139,7 @@
3083
3139
  exports.TelemetryContext = TelemetryContext;
3084
3140
  exports.TelemetryTrace = TelemetryTrace;
3085
3141
 
3086
- (function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
3142
+ Object.defineProperty(exports, '__esModule', { value: true });
3087
3143
 
3088
3144
  }));
3089
3145
  //# sourceMappingURL=applicationinsights-properties-js.js.map