@microsoft/applicationinsights-channel-js 3.0.0-beta.2303-11 → 3.0.0-nightly3.2304-28

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 (97) hide show
  1. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.cjs.js +5768 -0
  2. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.cjs.js.map +1 -0
  3. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.cjs.min.js +6 -0
  4. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.cjs.min.js.map +1 -0
  5. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.gbl.js +5772 -0
  6. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.gbl.js.map +1 -0
  7. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.gbl.min.js +6 -0
  8. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.gbl.min.js.map +1 -0
  9. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.integrity.json +66 -0
  10. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.js +5774 -0
  11. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.js.map +1 -0
  12. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.min.js +6 -0
  13. package/browser/es5/applicationinsights-channel-js.3.0.0-nightly3.2304-28.min.js.map +1 -0
  14. package/browser/es5/applicationinsights-channel-js.3.cjs.js +5768 -0
  15. package/browser/es5/applicationinsights-channel-js.3.cjs.js.map +1 -0
  16. package/browser/es5/applicationinsights-channel-js.3.cjs.min.js +6 -0
  17. package/browser/es5/applicationinsights-channel-js.3.cjs.min.js.map +1 -0
  18. package/browser/es5/applicationinsights-channel-js.3.gbl.js +5772 -0
  19. package/browser/es5/applicationinsights-channel-js.3.gbl.js.map +1 -0
  20. package/browser/es5/applicationinsights-channel-js.3.gbl.min.js +6 -0
  21. package/browser/es5/applicationinsights-channel-js.3.gbl.min.js.map +1 -0
  22. package/{dist/applicationinsights-channel-js.js → browser/es5/applicationinsights-channel-js.3.js} +875 -829
  23. package/browser/es5/applicationinsights-channel-js.3.js.map +1 -0
  24. package/browser/es5/applicationinsights-channel-js.3.min.js +6 -0
  25. package/browser/es5/applicationinsights-channel-js.3.min.js.map +1 -0
  26. package/{browser → dist/es5}/applicationinsights-channel-js.js +874 -828
  27. package/dist/es5/applicationinsights-channel-js.js.map +1 -0
  28. package/dist/es5/applicationinsights-channel-js.min.js +6 -0
  29. package/dist/es5/applicationinsights-channel-js.min.js.map +1 -0
  30. package/{dist-esm → dist-es5}/EnvelopeCreator.js +2 -2
  31. package/dist-es5/EnvelopeCreator.js.map +1 -0
  32. package/dist-es5/Interfaces.js +6 -0
  33. package/{dist-esm → dist-es5}/InternalConstants.js +1 -1
  34. package/{dist-esm → dist-es5}/Offline.js +8 -7
  35. package/dist-es5/Offline.js.map +1 -0
  36. package/{dist-esm → dist-es5}/SendBuffer.js +1 -1
  37. package/{dist-esm → dist-es5}/Sender.js +6 -4
  38. package/dist-es5/Sender.js.map +1 -0
  39. package/{dist-esm → dist-es5}/Serializer.js +1 -1
  40. package/{dist-esm → dist-es5}/TelemetryProcessors/Sample.js +1 -1
  41. package/{dist-esm → dist-es5}/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js +1 -1
  42. package/{dist-esm → dist-es5}/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js +1 -1
  43. package/{dist-esm → dist-es5}/__DynamicConstants.js +2 -1
  44. package/dist-es5/__DynamicConstants.js.map +1 -0
  45. package/dist-es5/applicationinsights-channel-js.js +6 -0
  46. package/package.json +18 -17
  47. package/tsconfig.json +5 -4
  48. package/types/applicationinsights-channel-js.d.ts +284 -1
  49. package/{dist/applicationinsights-channel-js.d.ts → types/applicationinsights-channel-js.namespaced.d.ts} +1 -1
  50. package/browser/applicationinsights-channel-js.integrity.json +0 -26
  51. package/browser/applicationinsights-channel-js.js.map +0 -1
  52. package/browser/applicationinsights-channel-js.min.js +0 -6
  53. package/browser/applicationinsights-channel-js.min.js.map +0 -1
  54. package/dist/applicationinsights-channel-js.api.json +0 -1357
  55. package/dist/applicationinsights-channel-js.api.md +0 -60
  56. package/dist/applicationinsights-channel-js.js.map +0 -1
  57. package/dist/applicationinsights-channel-js.min.js +0 -6
  58. package/dist/applicationinsights-channel-js.min.js.map +0 -1
  59. package/dist/applicationinsights-channel-js.rollup.d.ts +0 -285
  60. package/dist-esm/EnvelopeCreator.js.map +0 -1
  61. package/dist-esm/Interfaces.js +0 -6
  62. package/dist-esm/Offline.js.map +0 -1
  63. package/dist-esm/Sender.js.map +0 -1
  64. package/dist-esm/__DynamicConstants.js.map +0 -1
  65. package/dist-esm/applicationinsights-channel-js.js +0 -6
  66. package/src/EnvelopeCreator.ts +0 -351
  67. package/src/Interfaces.ts +0 -114
  68. package/src/InternalConstants.ts +0 -11
  69. package/src/Offline.ts +0 -106
  70. package/src/SendBuffer.ts +0 -396
  71. package/src/Sender.ts +0 -1256
  72. package/src/Serializer.ts +0 -177
  73. package/src/TelemetryProcessors/Sample.ts +0 -49
  74. package/src/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.ts +0 -37
  75. package/src/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.ts +0 -35
  76. package/src/__DynamicConstants.ts +0 -64
  77. package/src/applicationinsights-channel-js.ts +0 -1
  78. package/types/EnvelopeCreator.d.ts +0 -12
  79. package/types/Interfaces.d.ts +0 -95
  80. package/types/InternalConstants.d.ts +0 -1
  81. package/types/Offline.d.ts +0 -10
  82. package/types/SendBuffer.d.ts +0 -73
  83. package/types/Sender.d.ts +0 -84
  84. package/types/Serializer.d.ts +0 -9
  85. package/types/TelemetryProcessors/Sample.d.ts +0 -12
  86. package/types/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.d.ts +0 -5
  87. package/types/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.d.ts +0 -5
  88. package/types/__DynamicConstants.d.ts +0 -52
  89. package/types/tsdoc-metadata.json +0 -11
  90. /package/{dist-esm → dist-es5}/Interfaces.js.map +0 -0
  91. /package/{dist-esm → dist-es5}/InternalConstants.js.map +0 -0
  92. /package/{dist-esm → dist-es5}/SendBuffer.js.map +0 -0
  93. /package/{dist-esm → dist-es5}/Serializer.js.map +0 -0
  94. /package/{dist-esm → dist-es5}/TelemetryProcessors/Sample.js.map +0 -0
  95. /package/{dist-esm → dist-es5}/TelemetryProcessors/SamplingScoreGenerators/HashCodeScoreGenerator.js.map +0 -0
  96. /package/{dist-esm → dist-es5}/TelemetryProcessors/SamplingScoreGenerators/SamplingScoreGenerator.js.map +0 -0
  97. /package/{dist-esm → dist-es5}/applicationinsights-channel-js.js.map +0 -0
@@ -1,952 +1,998 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Channel, 3.0.0-beta.2303-11
2
+ * Application Insights JavaScript SDK - Channel, 3.0.0-nightly3.2304-28
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
6
6
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
7
7
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
8
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.Microsoft = global.Microsoft || {}, global.Microsoft.ApplicationInsights = global.Microsoft.ApplicationInsights || {})));
8
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.Microsoft = global.Microsoft || {}, global.Microsoft.ApplicationInsights3 = global.Microsoft.ApplicationInsights3 || {})));
9
9
  })(this, (function (exports) { 'use strict';
10
10
 
11
11
  var strShimFunction = "function";
12
12
  var strShimObject = "object";
13
13
  var strShimUndefined = "undefined";
14
14
  var strShimPrototype = "prototype";
15
- var strShimHasOwnProperty = "hasOwnProperty";
16
15
  var ObjClass$1 = Object;
17
16
  var ObjProto$1 = ObjClass$1[strShimPrototype];
18
- var ObjAssign = ObjClass$1["assign"];
19
- var ObjCreate = ObjClass$1["create"];
20
17
 
21
- var _cachedGlobal$1 = null;
22
- function getGlobal$1(useCached) {
23
- if (useCached === void 0) { useCached = true; }
24
- var result = useCached === false ? null : _cachedGlobal$1;
25
- if (!result) {
26
- if (typeof globalThis !== strShimUndefined) {
27
- result = globalThis;
28
- }
29
- if (!result && typeof self !== strShimUndefined) {
30
- result = self;
31
- }
32
- if (!result && typeof window !== strShimUndefined) {
33
- result = window;
34
- }
35
- if (!result && typeof global !== strShimUndefined) {
36
- result = global;
37
- }
38
- _cachedGlobal$1 = result;
18
+ var UNDEF_VALUE = undefined;
19
+ var EMPTY = "";
20
+ var BOOLEAN = "boolean";
21
+ var FUNCTION = "function";
22
+ var NUMBER = "number";
23
+ var OBJECT = "object";
24
+ var PROTOTYPE = "prototype";
25
+ var STRING = "string";
26
+ var UNDEFINED = "undefined";
27
+ var CONSTRUCTOR = "constructor";
28
+ var SYMBOL = "Symbol";
29
+ var POLYFILL_TAG = "_polyfill";
30
+ var INDEX_OF = "indexOf";
31
+ var LENGTH = "length";
32
+ var DONE = "done";
33
+ var VALUE = "value";
34
+ var NAME = "name";
35
+ var SLICE = "slice";
36
+ var ObjClass = Object;
37
+ var ObjProto = ObjClass[PROTOTYPE];
38
+ var StrCls = String;
39
+ var StrProto = StrCls[PROTOTYPE];
40
+ var MathCls = Math;
41
+ var ArrCls = Array;
42
+ var ArrProto = ArrCls[PROTOTYPE];
43
+
44
+ function _safeGet(cb, defValue) {
45
+ var result = defValue;
46
+ try {
47
+ result = cb();
48
+ }
49
+ catch (e) {
39
50
  }
40
51
  return result;
41
52
  }
42
- function throwTypeError$1(message) {
43
- throw new TypeError(message);
53
+
54
+ function _createIs(theType) {
55
+ return function (value) {
56
+ return typeof value === theType;
57
+ };
44
58
  }
45
- function objCreateFn(obj) {
46
- var func = ObjCreate;
47
- if (func) {
48
- return func(obj);
49
- }
50
- if (obj == null) {
51
- return {};
52
- }
53
- var type = typeof obj;
54
- if (type !== strShimObject && type !== strShimFunction) {
55
- throwTypeError$1("Object prototype may only be an Object:" + obj);
59
+ function _createObjIs(theName) {
60
+ var theType = "[object " + theName + "]";
61
+ return function (value) {
62
+ return !!(value && objToString(value) === theType);
63
+ };
64
+ }
65
+ function objToString(value) {
66
+ return ObjProto.toString.call(value);
67
+ }
68
+ function isUndefined(value) {
69
+ return typeof value === UNDEFINED || value === UNDEFINED;
70
+ }
71
+ function isNullOrUndefined(value) {
72
+ return value === null || isUndefined(value);
73
+ }
74
+ function isStrictNullOrUndefined(value) {
75
+ return value === null || !isDefined(value);
76
+ }
77
+ function isDefined(arg) {
78
+ return !!arg || arg !== UNDEF_VALUE;
79
+ }
80
+ var isString = _createIs(STRING);
81
+ var isFunction = _createIs(FUNCTION);
82
+ function isObject(value) {
83
+ if (!value && isNullOrUndefined(value)) {
84
+ return false;
56
85
  }
57
- function tmpFunc() { }
58
- tmpFunc[strShimPrototype] = obj;
59
- return new tmpFunc();
86
+ return !!value && typeof value === OBJECT;
87
+ }
88
+ var isArray = ArrCls.isArray;
89
+ var isNumber = _createIs(NUMBER);
90
+ var isBoolean = _createIs(BOOLEAN);
91
+ var isError = _createObjIs("Error");
92
+ function isTruthy(value) {
93
+ return !(!value || _safeGet(function () { return !(value && (0 + value)); }, !value));
60
94
  }
61
95
 
62
- (getGlobal$1() || {})["Symbol"];
63
- (getGlobal$1() || {})["Reflect"];
64
- var __objAssignFnImpl = function (t) {
65
- for (var s, i = 1, n = arguments.length; i < n; i++) {
66
- s = arguments[i];
67
- for (var p in s) {
68
- if (ObjProto$1[strShimHasOwnProperty].call(s, p)) {
69
- t[p] = s[p];
96
+ var objGetOwnPropertyDescriptor = ObjClass.getOwnPropertyDescriptor;
97
+
98
+ function objHasOwnProperty(obj, prop) {
99
+ return obj && ObjProto.hasOwnProperty.call(obj, prop);
100
+ }
101
+
102
+ var objHasOwn = ObjClass["hasOwn"] || polyObjHasOwn;
103
+ function polyObjHasOwn(obj, prop) {
104
+ return objHasOwnProperty(obj, prop) || !!objGetOwnPropertyDescriptor(obj, prop);
105
+ }
106
+
107
+ function objForEachKey(theObject, callbackfn, thisArg) {
108
+ if (theObject && isObject(theObject)) {
109
+ for (var prop in theObject) {
110
+ if (objHasOwn(theObject, prop)) {
111
+ if (callbackfn.call(thisArg || theObject, prop, theObject[prop]) === -1) {
112
+ break;
113
+ }
70
114
  }
71
115
  }
72
116
  }
73
- return t;
74
- };
75
- var __assignFn = ObjAssign || __objAssignFnImpl;
76
- var extendStaticsFn = function (d, b) {
77
- extendStaticsFn = ObjClass$1["setPrototypeOf"] ||
78
- ({ __proto__: [] } instanceof Array && function (d, b) {
79
- d.__proto__ = b;
80
- }) ||
81
- function (d, b) {
82
- for (var p in b) {
83
- if (b[strShimHasOwnProperty](p)) {
84
- d[p] = b[p];
85
- }
86
- }
87
- };
88
- return extendStaticsFn(d, b);
89
- };
90
- function __extendsFn(d, b) {
91
- if (typeof b !== strShimFunction && b !== null) {
92
- throwTypeError$1("Class extends value " + String(b) + " is not a constructor or null");
117
+ }
118
+
119
+ function _createKeyValueMap(values, keyType, valueType, completeFn) {
120
+ var theMap = {};
121
+ objForEachKey(values, function (key, value) {
122
+ theMap[key] = keyType ? value : key;
123
+ theMap[value] = valueType ? value : key;
124
+ });
125
+ return completeFn(theMap);
126
+ }
127
+
128
+ function throwTypeError(message) {
129
+ throw new TypeError(message);
130
+ }
131
+
132
+ var _objFreeze = ObjClass["freeze"];
133
+ var _doNothing = function (value) { return value; };
134
+ var objAssign = ObjClass["assign"];
135
+ function objKeys(value) {
136
+ if (!isObject(value) || value === null) {
137
+ throwTypeError("objKeys called on non-object");
93
138
  }
94
- extendStaticsFn(d, b);
95
- function __() {
96
- this.constructor = d;
139
+ return ObjClass.keys(value);
140
+ }
141
+ function objDeepFreeze(value) {
142
+ if (_objFreeze) {
143
+ objForEachKey(value, function (key, value) {
144
+ if (isArray(value) || isObject(value)) {
145
+ _objFreeze(value);
146
+ }
147
+ });
97
148
  }
98
- d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
149
+ return objFreeze(value);
99
150
  }
151
+ var objFreeze = _objFreeze || _doNothing;
152
+ var objGetPrototypeOf = ObjClass["getPrototypeOf"] || _doNothing;
100
153
 
101
- /*!
102
- * Microsoft Dynamic Proto Utility, 1.1.8
103
- * Copyright (c) Microsoft and contributors. All rights reserved.
104
- */
105
- var _a$2;
106
- var UNDEFINED$1 = "undefined";
107
- var Constructor = 'constructor';
108
- var Prototype = 'prototype';
109
- var strFunction = 'function';
110
- var DynInstFuncTable = '_dynInstFuncs';
111
- var DynProxyTag = '_isDynProxy';
112
- var DynClassName = '_dynClass';
113
- var DynClassNamePrefix = '_dynCls$';
114
- var DynInstChkTag = '_dynInstChk';
115
- var DynAllowInstChkTag = DynInstChkTag;
116
- var DynProtoDefaultOptions = '_dfOpts';
117
- var UnknownValue = '_unknown_';
118
- var str__Proto = "__proto__";
119
- var DynProtoBaseProto = "_dyn" + str__Proto;
120
- var DynProtoGlobalSettings = "__dynProto$Gbl";
121
- var DynProtoCurrent = "_dynInstProto";
122
- var strUseBaseInst = 'useBaseInst';
123
- var strSetInstFuncs = 'setInstFuncs';
124
- var Obj = Object;
125
- var _objGetPrototypeOf = Obj["getPrototypeOf"];
126
- var _objGetOwnProps = Obj["getOwnPropertyNames"];
127
- function _getGlobal() {
154
+ function createEnum(values) {
155
+ return _createKeyValueMap(values, 1 , 0 , objDeepFreeze);
156
+ }
157
+ function createEnumKeyMap(values) {
158
+ return _createKeyValueMap(values, 0 , 0 , objDeepFreeze);
159
+ }
160
+ function createSimpleMap(values) {
161
+ var mapClass = {};
162
+ objForEachKey(values, function (key, value) {
163
+ mapClass[key] = value[1];
164
+ mapClass[value[0]] = value[1];
165
+ });
166
+ return objDeepFreeze(mapClass);
167
+ }
168
+ function createTypeMap(values) {
169
+ return createSimpleMap(values);
170
+ }
171
+
172
+ var _wellKnownSymbolMap = createEnumKeyMap({
173
+ asyncIterator: 0 ,
174
+ hasInstance: 1 ,
175
+ isConcatSpreadable: 2 ,
176
+ iterator: 3 ,
177
+ match: 4 ,
178
+ matchAll: 5 ,
179
+ replace: 6 ,
180
+ search: 7 ,
181
+ species: 8 ,
182
+ split: 9 ,
183
+ toPrimitive: 10 ,
184
+ toStringTag: 11 ,
185
+ unscopables: 12
186
+ });
187
+
188
+ var asString = StrCls;
189
+
190
+ var GLOBAL_CONFIG_KEY = "__tsUtils$gblCfg";
191
+ var _globalCfg;
192
+ function _getGlobalValue() {
128
193
  var result;
129
- if (typeof globalThis !== UNDEFINED$1) {
194
+ if (typeof globalThis !== UNDEFINED) {
130
195
  result = globalThis;
131
196
  }
132
- if (!result && typeof self !== UNDEFINED$1) {
197
+ if (!result && typeof self !== UNDEFINED) {
133
198
  result = self;
134
199
  }
135
- if (!result && typeof window !== UNDEFINED$1) {
200
+ if (!result && typeof window !== UNDEFINED) {
136
201
  result = window;
137
202
  }
138
- if (!result && typeof global !== UNDEFINED$1) {
203
+ if (!result && typeof global !== UNDEFINED) {
139
204
  result = global;
140
205
  }
141
- return result || {};
142
- }
143
- var _gbl = _getGlobal();
144
- var _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = {
145
- o: (_a$2 = {},
146
- _a$2[strSetInstFuncs] = true,
147
- _a$2[strUseBaseInst] = true,
148
- _a$2),
149
- n: 1000
150
- });
151
- function _hasOwnProperty(obj, prop) {
152
- return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
153
- }
154
- function _isObjectOrArrayPrototype(target) {
155
- return target && (target === Obj[Prototype] || target === Array[Prototype]);
206
+ return result;
156
207
  }
157
- function _isObjectArrayOrFunctionPrototype(target) {
158
- return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
208
+ function _getGlobalConfig() {
209
+ if (!_globalCfg) {
210
+ var gbl = _getGlobalValue() || {};
211
+ _globalCfg = gbl[GLOBAL_CONFIG_KEY] = gbl[GLOBAL_CONFIG_KEY] || {};
212
+ }
213
+ return _globalCfg;
159
214
  }
160
- function _getObjProto(target) {
161
- var newProto;
162
- if (target) {
163
- if (_objGetPrototypeOf) {
164
- return _objGetPrototypeOf(target);
215
+
216
+ function dumpObj(object, format) {
217
+ var propertyValueDump = EMPTY;
218
+ if (isError(object)) {
219
+ propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
220
+ }
221
+ else {
222
+ try {
223
+ propertyValueDump = JSON.stringify(object, null, format ? (isNumber(format) ? format : 4) : UNDEF_VALUE);
165
224
  }
166
- var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
167
- newProto = target[DynProtoBaseProto] || curProto;
168
- if (!_hasOwnProperty(target, DynProtoBaseProto)) {
169
- delete target[DynProtoCurrent];
170
- newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];
171
- target[DynProtoCurrent] = curProto;
225
+ catch (e) {
226
+ propertyValueDump = " - " + dumpObj(e, format);
172
227
  }
173
228
  }
174
- return newProto;
229
+ return objToString(object) + ": " + propertyValueDump;
175
230
  }
176
- function _forEachProp(target, func) {
177
- var props = [];
178
- if (_objGetOwnProps) {
179
- props = _objGetOwnProps(target);
180
- }
181
- else {
182
- for (var name_1 in target) {
183
- if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
184
- props.push(name_1);
185
- }
231
+
232
+ function _unwrapFunction(funcName, target, polyFunc) {
233
+ return function (thisArg) {
234
+ var theFunc = (thisArg && thisArg[funcName]) || (target && target[funcName]);
235
+ if (theFunc || polyFunc) {
236
+ var theArgs = arguments;
237
+ return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrProto[SLICE].call(theArgs, 1) : theArgs);
186
238
  }
239
+ throwTypeError("'" + asString(funcName) + "' not defined for " + dumpObj(thisArg));
240
+ };
241
+ }
242
+
243
+ var mathMax = MathCls.max;
244
+
245
+ var strSlice = _unwrapFunction(SLICE, StrProto);
246
+
247
+ var strSubstr = _unwrapFunction("substr", StrProto, polyStrSubstr);
248
+ function polyStrSubstr(value, start, length) {
249
+ if (isNullOrUndefined(value)) {
250
+ throwTypeError("'polyStrSubstr called with invalid " + dumpObj(value));
187
251
  }
188
- if (props && props.length > 0) {
189
- for (var lp = 0; lp < props.length; lp++) {
190
- func(props[lp]);
191
- }
252
+ if (length < 0) {
253
+ return EMPTY;
192
254
  }
255
+ start = start || 0;
256
+ if (start < 0) {
257
+ start = mathMax(start + value[LENGTH], 0);
258
+ }
259
+ if (isUndefined(length)) {
260
+ return strSlice(value, start);
261
+ }
262
+ return strSlice(value, start, start + length);
193
263
  }
194
- function _isDynamicCandidate(target, funcName, skipOwn) {
195
- return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
264
+
265
+ var _polySymbols;
266
+ function _globalSymbolRegistry() {
267
+ if (!_polySymbols) {
268
+ var gblCfg = _getGlobalConfig();
269
+ _polySymbols = gblCfg.gblSym = gblCfg.gblSym || { k: {}, s: {} };
270
+ }
271
+ return _polySymbols;
196
272
  }
197
- function _throwTypeError(message) {
198
- throw new TypeError("DynamicProto: " + message);
273
+ var _wellKnownSymbolCache = {};
274
+ function polyNewSymbol(description) {
275
+ var theSymbol = {
276
+ description: asString(description),
277
+ toString: function () { return SYMBOL + "(" + description + ")"; }
278
+ };
279
+ theSymbol[POLYFILL_TAG] = true;
280
+ return theSymbol;
199
281
  }
200
- function _getInstanceFuncs(thisTarget) {
201
- var instFuncs = {};
202
- _forEachProp(thisTarget, function (name) {
203
- if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
204
- instFuncs[name] = thisTarget[name];
205
- }
206
- });
207
- return instFuncs;
282
+ function polySymbolFor(key) {
283
+ var registry = _globalSymbolRegistry();
284
+ if (!objHasOwn(registry, key)) {
285
+ var newSymbol = polyNewSymbol(key);
286
+ registry.k[key] = newSymbol;
287
+ registry.s[newSymbol] = asString(key);
288
+ }
289
+ return registry.k[key];
208
290
  }
209
- function _hasVisited(values, value) {
210
- for (var lp = values.length - 1; lp >= 0; lp--) {
211
- if (values[lp] === value) {
212
- return true;
213
- }
291
+ function polyGetKnownSymbol(name) {
292
+ var result;
293
+ var knownName = _wellKnownSymbolMap[name];
294
+ if (knownName) {
295
+ result = _wellKnownSymbolCache[knownName] = _wellKnownSymbolCache[knownName] || polyNewSymbol(SYMBOL + "." + knownName);
214
296
  }
215
- return false;
297
+ return result;
216
298
  }
217
- function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
218
- function _instFuncProxy(target, funcHost, funcName) {
219
- var theFunc = funcHost[funcName];
220
- if (theFunc[DynProxyTag] && useBaseInst) {
221
- var instFuncTable = target[DynInstFuncTable] || {};
222
- if (instFuncTable[DynAllowInstChkTag] !== false) {
223
- theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
224
- }
299
+
300
+ var propMap = {
301
+ e: "enumerable",
302
+ c: "configurable",
303
+ v: VALUE,
304
+ w: "writable",
305
+ g: "get",
306
+ s: "set"
307
+ };
308
+ function _createProp(value) {
309
+ var prop = {};
310
+ prop[propMap["c"]] = true;
311
+ prop[propMap["e"]] = true;
312
+ if (value.l) {
313
+ prop.get = function () { return value.l.v; };
314
+ var desc = objGetOwnPropertyDescriptor(value.l, "v");
315
+ if (desc && desc.set) {
316
+ prop.set = function (newValue) {
317
+ value.l.v = newValue;
318
+ };
225
319
  }
226
- return function () {
227
- return theFunc.apply(target, arguments);
228
- };
229
320
  }
230
- var baseFuncs = {};
231
- _forEachProp(instFuncs, function (name) {
232
- baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
321
+ objForEachKey(value, function (key, value) {
322
+ prop[propMap[key]] = isUndefined(value) ? prop[propMap[key]] : value;
233
323
  });
234
- var baseProto = _getObjProto(classProto);
235
- var visited = [];
236
- while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
237
- _forEachProp(baseProto, function (name) {
238
- if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
239
- baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
324
+ return prop;
325
+ }
326
+ var objDefineProp = ObjClass["defineProperty"];
327
+ function objDefine(target, key, propDesc) {
328
+ return objDefineProp(target, key, _createProp(propDesc));
329
+ }
330
+
331
+ var _globalLazyTestHooks;
332
+ var _fetchLazyTestHooks = function () {
333
+ _globalLazyTestHooks = _getGlobalConfig();
334
+ _fetchLazyTestHooks = null;
335
+ };
336
+ function getLazy(cb) {
337
+ var lazyValue = {};
338
+ _fetchLazyTestHooks && _fetchLazyTestHooks();
339
+ lazyValue.b = _globalLazyTestHooks.lzy;
340
+ objDefineProp(lazyValue, "v", {
341
+ configurable: true,
342
+ get: function () {
343
+ var result = cb();
344
+ if (!_globalLazyTestHooks.lzy) {
345
+ objDefineProp(lazyValue, "v", {
346
+ value: result
347
+ });
348
+ if (lazyValue.b) {
349
+ delete lazyValue.b;
350
+ }
240
351
  }
241
- });
242
- visited.push(baseProto);
243
- baseProto = _getObjProto(baseProto);
352
+ if (_globalLazyTestHooks.lzy && lazyValue.b !== _globalLazyTestHooks.lzy) {
353
+ lazyValue.b = _globalLazyTestHooks.lzy;
354
+ }
355
+ return result;
356
+ }
357
+ });
358
+ return lazyValue;
359
+ }
360
+
361
+ function _lazySafeGet(cb, defValue) {
362
+ return getLazy(function () { return _safeGet(cb, defValue); });
363
+ }
364
+
365
+ var WINDOW = "window";
366
+ var _cachedGlobal;
367
+ var _cachedWindow;
368
+ var _cachedDocument;
369
+ var _cachedNavigator;
370
+ function _lazySafeGetInst(name) {
371
+ return _lazySafeGet(function () { return getInst(name) || UNDEF_VALUE; }, UNDEF_VALUE);
372
+ }
373
+ function getGlobal(useCached) {
374
+ (!_cachedGlobal || useCached === false || (_globalLazyTestHooks.lzy && !_cachedGlobal.b)) && (_cachedGlobal = _lazySafeGet(_getGlobalValue, null));
375
+ return _cachedGlobal.v;
376
+ }
377
+ function getInst(name, useCached) {
378
+ var gbl = getGlobal(useCached);
379
+ if (gbl && gbl[name]) {
380
+ return gbl[name];
244
381
  }
245
- return baseFuncs;
382
+ if (name === WINDOW && _cachedWindow) {
383
+ return _cachedWindow.v;
384
+ }
385
+ return null;
246
386
  }
247
- function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
248
- var instFunc = null;
249
- if (target && _hasOwnProperty(proto, DynClassName)) {
250
- var instFuncTable = target[DynInstFuncTable] || {};
251
- instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
252
- if (!instFunc) {
253
- _throwTypeError("Missing [" + funcName + "] " + strFunction);
387
+ function getDocument() {
388
+ (!_cachedDocument || (_globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = _lazySafeGetInst("document"));
389
+ return _cachedDocument.v;
390
+ }
391
+ function hasWindow() {
392
+ return !!getWindow();
393
+ }
394
+ function getWindow() {
395
+ (!_cachedWindow || (_globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = _lazySafeGetInst(WINDOW));
396
+ return _cachedWindow.v;
397
+ }
398
+ function hasNavigator() {
399
+ return !!getNavigator();
400
+ }
401
+ function getNavigator() {
402
+ (!_cachedNavigator || (_globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = _lazySafeGetInst("navigator"));
403
+ return _cachedNavigator.v;
404
+ }
405
+
406
+ var _symbol;
407
+ var _symbolFor;
408
+ var _symbolKeyFor;
409
+ function _getSymbolValue(name) {
410
+ return _lazySafeGet(function () {
411
+ return (_symbol.v ? _symbol[name] : UNDEF_VALUE);
412
+ }, UNDEF_VALUE);
413
+ }
414
+ function getSymbol() {
415
+ var resetCache = !_symbol || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_symbol.b);
416
+ resetCache && (_symbol = _lazySafeGetInst(SYMBOL));
417
+ (!_symbolFor || resetCache) && (_symbolFor = _getSymbolValue("for"));
418
+ (!_symbolKeyFor || resetCache) && (_symbolKeyFor = _getSymbolValue("keyFor"));
419
+ return _symbol.v;
420
+ }
421
+ function getKnownSymbol(name, noPoly) {
422
+ var knownName = _wellKnownSymbolMap[name];
423
+ (!_symbol || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();
424
+ return _symbol.v ? _symbol.v[knownName || name] : (!noPoly ? polyGetKnownSymbol(name) : UNDEF_VALUE);
425
+ }
426
+ function newSymbol(description, noPoly) {
427
+ (!_symbol || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();
428
+ return _symbol.v ? _symbol.v(description) : (!noPoly ? polyNewSymbol(description) : null);
429
+ }
430
+ function symbolFor(key) {
431
+ (!_symbolFor || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();
432
+ return (_symbolFor.v || polySymbolFor)(key);
433
+ }
434
+
435
+ function isIterator(value) {
436
+ return !!value && isFunction(value.next);
437
+ }
438
+ function isIterable(value) {
439
+ return !isStrictNullOrUndefined(value) && isFunction(value[getKnownSymbol(3 )]);
440
+ }
441
+
442
+ function iterForOf(iter, callbackfn, thisArg) {
443
+ if (iter) {
444
+ if (!isIterator(iter)) {
445
+ var itSymbol = getKnownSymbol(3 );
446
+ iter = iter[itSymbol] ? iter[itSymbol]() : null;
254
447
  }
255
- if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
256
- var canAddInst = !_hasOwnProperty(target, funcName);
257
- var objProto = _getObjProto(target);
258
- var visited = [];
259
- while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
260
- var protoFunc = objProto[funcName];
261
- if (protoFunc) {
262
- canAddInst = (protoFunc === currentDynProtoProxy);
263
- break;
264
- }
265
- visited.push(objProto);
266
- objProto = _getObjProto(objProto);
267
- }
448
+ if (isIterator(iter)) {
268
449
  try {
269
- if (canAddInst) {
270
- target[funcName] = instFunc;
450
+ var count = 0;
451
+ var value = iter.next();
452
+ while (!value[DONE]) {
453
+ if (callbackfn.call(thisArg || iter, value[VALUE], count, iter) === -1) {
454
+ break;
455
+ }
456
+ count++;
457
+ value = iter.next();
271
458
  }
272
- instFunc[DynInstChkTag] = 1;
459
+ iter.return && iter.return(value);
273
460
  }
274
461
  catch (e) {
275
- instFuncTable[DynAllowInstChkTag] = false;
462
+ iter.throw && iter.throw(e);
276
463
  }
277
464
  }
278
465
  }
279
- return instFunc;
280
466
  }
281
- function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
282
- var protoFunc = proto[funcName];
283
- if (protoFunc === currentDynProtoProxy) {
284
- protoFunc = _getObjProto(proto)[funcName];
285
- }
286
- if (typeof protoFunc !== strFunction) {
287
- _throwTypeError("[" + funcName + "] is not a " + strFunction);
467
+
468
+ function arrAppend(target, elms) {
469
+ if (!isUndefined(elms) && target) {
470
+ if (isArray(elms)) {
471
+ target.push.apply(target, elms);
472
+ }
473
+ else if (isIterator(elms) || isIterable(elms)) {
474
+ iterForOf(elms, function (elm) {
475
+ target.push(elm);
476
+ });
477
+ }
478
+ else {
479
+ target.push(elms);
480
+ }
288
481
  }
289
- return protoFunc;
482
+ return target;
290
483
  }
291
- function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
292
- function _createDynamicPrototype(proto, funcName) {
293
- var dynProtoProxy = function () {
294
- var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
295
- return instFunc.apply(this, arguments);
296
- };
297
- dynProtoProxy[DynProxyTag] = 1;
298
- return dynProtoProxy;
299
- }
300
- if (!_isObjectOrArrayPrototype(proto)) {
301
- var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
302
- var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
303
- if (instFuncTable[DynAllowInstChkTag] !== false) {
304
- instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
305
- }
306
- _forEachProp(target, function (name) {
307
- if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
308
- instFuncs_1[name] = target[name];
309
- delete target[name];
310
- if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
311
- proto[name] = _createDynamicPrototype(proto, name);
484
+
485
+ function arrForEach(theArray, callbackfn, thisArg) {
486
+ if (theArray) {
487
+ var len = theArray[LENGTH] >>> 0;
488
+ for (var idx = 0; idx < len; idx++) {
489
+ if (idx in theArray) {
490
+ if (callbackfn.call(thisArg || theArray, theArray[idx], idx, theArray) === -1) {
491
+ break;
312
492
  }
313
493
  }
314
- });
315
- }
316
- }
317
- function _checkPrototype(classProto, thisTarget) {
318
- if (_objGetPrototypeOf) {
319
- var visited = [];
320
- var thisProto = _getObjProto(thisTarget);
321
- while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
322
- if (thisProto === classProto) {
323
- return true;
324
- }
325
- visited.push(thisProto);
326
- thisProto = _getObjProto(thisProto);
327
494
  }
328
- return false;
329
495
  }
330
- return true;
331
496
  }
332
- function _getObjName(target, unknownValue) {
333
- if (_hasOwnProperty(target, Prototype)) {
334
- return target.name || unknownValue || UnknownValue;
335
- }
336
- return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
497
+
498
+ var arrIndexOf = _unwrapFunction(INDEX_OF, ArrProto);
499
+
500
+ var arrMap = _unwrapFunction("map", ArrProto);
501
+
502
+ var arrSlice = _unwrapFunction(SLICE, ArrProto);
503
+
504
+ function objSetPrototypeOf(obj, proto) {
505
+ var fn = ObjClass["setPrototypeOf"] ||
506
+ ({ __proto__: [] } instanceof Array && function (d, b) {
507
+ d.__proto__ = b;
508
+ }) ||
509
+ function (d, b) {
510
+ objForEachKey(b, function (key, value) { return d[key] = value; });
511
+ };
512
+ return fn(obj, proto);
337
513
  }
338
- function dynamicProto(theClass, target, delegateFunc, options) {
339
- if (!_hasOwnProperty(theClass, Prototype)) {
340
- _throwTypeError("theClass is an invalid class definition.");
341
- }
342
- var classProto = theClass[Prototype];
343
- if (!_checkPrototype(classProto, target)) {
344
- _throwTypeError("[" + _getObjName(theClass) + "] not in hierarchy of [" + _getObjName(target) + "]");
345
- }
346
- var className = null;
347
- if (_hasOwnProperty(classProto, DynClassName)) {
348
- className = classProto[DynClassName];
349
- }
350
- else {
351
- className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _gblInst.n;
352
- _gblInst.n++;
353
- classProto[DynClassName] = className;
354
- }
355
- var perfOptions = dynamicProto[DynProtoDefaultOptions];
356
- var useBaseInst = !!perfOptions[strUseBaseInst];
357
- if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
358
- useBaseInst = !!options[strUseBaseInst];
359
- }
360
- var instFuncs = _getInstanceFuncs(target);
361
- var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
362
- delegateFunc(target, baseFuncs);
363
- var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
364
- if (setInstanceFunc && options) {
365
- setInstanceFunc = !!options[strSetInstFuncs];
514
+
515
+ function _createCustomError(name, d, baseClass) {
516
+ objSetPrototypeOf(d, baseClass);
517
+ function __() {
518
+ this.constructor = d;
519
+ this[NAME] = name;
366
520
  }
367
- _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
521
+ __[PROTOTYPE] = baseClass[PROTOTYPE];
522
+ d[PROTOTYPE] = new __();
523
+ return d;
368
524
  }
369
- dynamicProto[DynProtoDefaultOptions] = _gblInst.o;
370
-
371
- /*!
372
- * NevWare21 - ts-utils, 0.8.1
373
- * https://github.com/nevware21/ts-utils
374
- * Copyright (c) NevWare21 and contributors. All rights reserved.
375
- * Licensed under the MIT license.
376
- */
377
- var UNDEF_VALUE = undefined;
378
- var EMPTY = "";
379
- var BOOLEAN = "boolean";
380
- var FUNCTION = "function";
381
- var NUMBER = "number";
382
- var OBJECT = "object";
383
- var PROTOTYPE = "prototype";
384
- var STRING = "string";
385
- var UNDEFINED = "undefined";
386
- var CONSTRUCTOR = "constructor";
387
- var HAS_OWN_PROPERTY = "hasOwnProperty";
388
- var SYMBOL = "Symbol";
389
- var POLYFILL_TAG = "_polyfill";
390
- var INDEX_OF = "indexOf";
391
- var LENGTH = "length";
392
- var DONE = "done";
393
- var VALUE = "value";
394
- var NAME = "name";
395
- var ObjClass = Object;
396
- var ObjProto = ObjClass[PROTOTYPE];
397
- var StrCls = String;
398
- var ArrCls = Array;
399
- var ArrProto = ArrCls[PROTOTYPE];
400
- function _safeGet(cb, defValue) {
401
- var result = defValue;
525
+ var _safeSetName = function (baseClass, name) {
402
526
  try {
403
- result = cb();
527
+ baseClass[PROTOTYPE][NAME] = name;
404
528
  }
405
529
  catch (e) {
406
530
  }
407
- return result;
408
- }
409
- function _createIs(theType) {
410
- return function (value) {
411
- return typeof value === theType;
412
- };
413
- }
414
- function _createObjIs(theName) {
415
- var theType = "[object " + theName + "]";
416
- return function (value) {
417
- return !!(value && objToString(value) === theType);
418
- };
419
- }
420
- function objToString(value) {
421
- return ObjProto.toString.call(value);
531
+ };
532
+ function createCustomError(name, constructCb) {
533
+ var baseClass = Error;
534
+ var orgName = baseClass[PROTOTYPE][NAME];
535
+ var customError = _createCustomError(name, function () {
536
+ var _this = this;
537
+ try {
538
+ _safeSetName(baseClass, name);
539
+ _this = baseClass.apply(_this, arguments) || _this;
540
+ _this[NAME] = name;
541
+ constructCb && constructCb(_this, arguments);
542
+ }
543
+ finally {
544
+ _safeSetName(baseClass, orgName);
545
+ }
546
+ return _this;
547
+ }, baseClass);
548
+ return customError;
422
549
  }
423
- function isUndefined(value) {
424
- return typeof value === UNDEFINED || value === UNDEFINED;
550
+
551
+ function utcNow() {
552
+ return (Date.now || polyUtcNow)();
425
553
  }
426
- function isNullOrUndefined(value) {
427
- return value === null || isUndefined(value);
554
+ function polyUtcNow() {
555
+ return new Date().getTime();
428
556
  }
429
- function isDefined(arg) {
430
- return !!arg || arg !== UNDEF_VALUE;
557
+
558
+ function _createTrimFn(exp) {
559
+ return function _doTrim(value) {
560
+ if (isNullOrUndefined(value)) {
561
+ throwTypeError("strTrim called [" + dumpObj(value) + "]");
562
+ }
563
+ if (value && value.replace) {
564
+ value = value.replace(exp, EMPTY);
565
+ }
566
+ return value;
567
+ };
431
568
  }
432
- var isString = _createIs(STRING);
433
- var isFunction = _createIs(FUNCTION);
434
- function isObject(value) {
435
- if (!value && isNullOrUndefined(value)) {
569
+ var polyStrTrim = _createTrimFn(/^\s+|(?=\s)\s+$/g);
570
+
571
+ var strTrim = _unwrapFunction("trim", StrProto, polyStrTrim);
572
+
573
+ var _fnToString;
574
+ var _objCtrFnString;
575
+ var _gblWindow;
576
+ function isPlainObject(value) {
577
+ if (!value || typeof value !== OBJECT) {
436
578
  return false;
437
579
  }
438
- return !!value && typeof value === OBJECT;
439
- }
440
- var isArray = ArrCls.isArray;
441
- var isNumber = _createIs(NUMBER);
442
- var isBoolean = _createIs(BOOLEAN);
443
- var isError = _createObjIs("Error");
444
- function isTruthy(value) {
445
- return !(!value || _safeGet(function () { return !(value && (0 + value)); }, !value));
446
- }
447
- var objGetOwnPropertyDescriptor = ObjClass.getOwnPropertyDescriptor;
448
- function objHasOwnProperty(obj, prop) {
449
- return obj && ObjProto[HAS_OWN_PROPERTY].call(obj, prop);
450
- }
451
- var objHasOwn = ObjClass["hasOwn"] || polyObjHasOwn;
452
- function polyObjHasOwn(obj, prop) {
453
- return objHasOwnProperty(obj, prop) || !!objGetOwnPropertyDescriptor(obj, prop);
454
- }
455
- function objForEachKey(theObject, callbackfn, thisArg) {
456
- if (theObject && isObject(theObject)) {
457
- for (var prop in theObject) {
458
- if (objHasOwn(theObject, prop)) {
459
- if (callbackfn.call(thisArg || theObject, prop, theObject[prop]) === -1) {
460
- break;
580
+ if (!_gblWindow) {
581
+ _gblWindow = hasWindow() ? getWindow() : true;
582
+ }
583
+ var result = false;
584
+ if (value !== _gblWindow) {
585
+ if (!_objCtrFnString) {
586
+ _fnToString = Function[PROTOTYPE].toString;
587
+ _objCtrFnString = _fnToString.call(ObjClass);
588
+ }
589
+ try {
590
+ var proto = objGetPrototypeOf(value);
591
+ result = !proto;
592
+ if (!result) {
593
+ if (objHasOwnProperty(proto, CONSTRUCTOR)) {
594
+ proto = proto[CONSTRUCTOR];
461
595
  }
596
+ result = proto && typeof proto === FUNCTION && _fnToString.call(proto) === _objCtrFnString;
462
597
  }
463
598
  }
599
+ catch (ex) {
600
+ }
464
601
  }
602
+ return result;
465
603
  }
466
- function _createKeyValueMap(values, keyType, valueType, completeFn) {
467
- var theMap = {};
468
- objForEachKey(values, function (key, value) {
469
- theMap[key] = keyType ? value : key;
470
- theMap[value] = valueType ? value : key;
471
- });
472
- return completeFn(theMap);
473
- }
474
- function throwTypeError(message) {
475
- throw new TypeError(message);
476
- }
477
- var _objFreeze = ObjClass["freeze"];
478
- var _doNothing = function (value) { return value; };
479
- function objKeys(value) {
480
- if (!isObject(value) || value === null) {
481
- throwTypeError("objKeys called on non-object");
604
+
605
+ var _objCreate = ObjClass["create"];
606
+ var objCreate = _objCreate || polyObjCreate;
607
+ function polyObjCreate(obj) {
608
+ if (!obj) {
609
+ return {};
482
610
  }
483
- return ObjClass.keys(value);
484
- }
485
- function objDeepFreeze(value) {
486
- if (_objFreeze) {
487
- objForEachKey(value, function (key, value) {
488
- if (isArray(value) || isObject(value)) {
489
- _objFreeze(value);
490
- }
491
- });
611
+ var type = typeof obj;
612
+ if (type !== OBJECT && type !== FUNCTION) {
613
+ throw new TypeError("Prototype must be an Object or function: " + dumpObj(obj));
492
614
  }
493
- return objFreeze(value);
615
+ function tempFunc() { }
616
+ tempFunc[PROTOTYPE] = obj;
617
+ return new tempFunc();
494
618
  }
495
- var objFreeze = _objFreeze || _doNothing;
496
- var objGetPrototypeOf = ObjClass["getPrototypeOf"] || _doNothing;
497
- function createEnum(values) {
498
- return _createKeyValueMap(values, 1 , 0 , objDeepFreeze);
499
- }
500
- function createEnumKeyMap(values) {
501
- return _createKeyValueMap(values, 0 , 0 , objDeepFreeze);
619
+
620
+ var strIndexOf = _unwrapFunction(INDEX_OF, StrProto);
621
+
622
+ var REF = "ref";
623
+ var UNREF = "un" + REF;
624
+ var HAS_REF = "hasRef";
625
+ var ENABLED = "enabled";
626
+ function _createTimerHandler(startTimer, refreshFn, cancelFn) {
627
+ var _a;
628
+ var ref = true;
629
+ var timerId = startTimer ? refreshFn(null) : null;
630
+ var theTimerHandler;
631
+ var _unref = function () {
632
+ ref = false;
633
+ timerId && timerId[UNREF] && timerId[UNREF]();
634
+ return theTimerHandler;
635
+ };
636
+ var _ref = function () {
637
+ ref = true;
638
+ timerId && timerId[REF] && timerId[REF]();
639
+ return theTimerHandler;
640
+ };
641
+ var _hasRef = function () {
642
+ if (timerId && timerId[HAS_REF]) {
643
+ return timerId[HAS_REF]();
644
+ }
645
+ return ref;
646
+ };
647
+ var _refresh = function () {
648
+ timerId = refreshFn(timerId);
649
+ if (!ref) {
650
+ _unref();
651
+ }
652
+ return theTimerHandler;
653
+ };
654
+ var _cancel = function () {
655
+ timerId && cancelFn(timerId);
656
+ timerId = null;
657
+ };
658
+ var _setEnabled = function (value) {
659
+ !value && timerId && _cancel();
660
+ value && !timerId && _refresh();
661
+ };
662
+ theTimerHandler = (_a = {
663
+ cancel: _cancel,
664
+ refresh: _refresh
665
+ },
666
+ _a[HAS_REF] = _hasRef,
667
+ _a[REF] = _ref,
668
+ _a[UNREF] = _unref,
669
+ _a[ENABLED] = false,
670
+ _a);
671
+ objDefineProp(theTimerHandler, ENABLED, {
672
+ get: function () { return !!timerId; },
673
+ set: _setEnabled
674
+ });
675
+ return {
676
+ h: theTimerHandler,
677
+ dn: function () {
678
+ timerId = null;
679
+ }
680
+ };
502
681
  }
503
- function createSimpleMap(values) {
504
- var mapClass = {};
505
- objForEachKey(values, function (key, value) {
506
- mapClass[key] = value[1];
507
- mapClass[value[0]] = value[1];
682
+
683
+ function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
684
+ var isArr = isArray(overrideFn);
685
+ var len = isArr ? overrideFn.length : 0;
686
+ var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
687
+ var clearFn = (len > 1 ? overrideFn[1] : UNDEF_VALUE) || clearTimeout;
688
+ var timerFn = theArgs[0];
689
+ theArgs[0] = function () {
690
+ handler.dn();
691
+ timerFn.apply(self, arguments);
692
+ };
693
+ var handler = _createTimerHandler(startTimer, function (timerId) {
694
+ if (timerId) {
695
+ if (timerId.refresh) {
696
+ timerId.refresh();
697
+ return timerId;
698
+ }
699
+ clearFn.call(self, timerId);
700
+ }
701
+ return setFn.apply(self, theArgs);
702
+ }, function (timerId) {
703
+ clearFn.call(self, timerId);
508
704
  });
509
- return objDeepFreeze(mapClass);
705
+ return handler.h;
510
706
  }
511
- function createTypeMap(values) {
512
- return createSimpleMap(values);
707
+ function scheduleTimeout(callback, timeout) {
708
+ return _createTimeoutWith(this, true, UNDEF_VALUE, arrSlice(arguments));
513
709
  }
514
- createEnumKeyMap({
515
- asyncIterator: 0 ,
516
- hasInstance: 1 ,
517
- isConcatSpreadable: 2 ,
518
- iterator: 3 ,
519
- match: 4 ,
520
- matchAll: 5 ,
521
- replace: 6 ,
522
- search: 7 ,
523
- species: 8 ,
524
- split: 9 ,
525
- toPrimitive: 10 ,
526
- toStringTag: 11 ,
527
- unscopables: 12
528
- });
529
- var asString = StrCls;
530
- var GLOBAL_CONFIG_KEY = "__tsUtils$gblCfg";
531
- var _globalCfg;
532
- function _getGlobalValue() {
533
- var result;
534
- if (typeof globalThis !== UNDEFINED) {
535
- result = globalThis;
536
- }
537
- if (!result && typeof self !== UNDEFINED) {
538
- result = self;
710
+
711
+ (getGlobal() || {})["Symbol"];
712
+ (getGlobal() || {})["Reflect"];
713
+ var strHasOwnProperty = "hasOwnProperty";
714
+ var __objAssignFnImpl = function (t) {
715
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
716
+ s = arguments[i];
717
+ for (var p in s) {
718
+ if (ObjProto$1[strHasOwnProperty].call(s, p)) {
719
+ t[p] = s[p];
720
+ }
721
+ }
539
722
  }
540
- if (!result && typeof window !== UNDEFINED) {
541
- result = window;
723
+ return t;
724
+ };
725
+ var __assignFn = objAssign || __objAssignFnImpl;
726
+ var extendStaticsFn = function (d, b) {
727
+ extendStaticsFn = ObjClass$1["setPrototypeOf"] ||
728
+ ({ __proto__: [] } instanceof Array && function (d, b) {
729
+ d.__proto__ = b;
730
+ }) ||
731
+ function (d, b) {
732
+ for (var p in b) {
733
+ if (b[strHasOwnProperty](p)) {
734
+ d[p] = b[p];
735
+ }
736
+ }
737
+ };
738
+ return extendStaticsFn(d, b);
739
+ };
740
+ function __extendsFn(d, b) {
741
+ if (typeof b !== strShimFunction && b !== null) {
742
+ throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
542
743
  }
543
- if (!result && typeof global !== UNDEFINED) {
544
- result = global;
744
+ extendStaticsFn(d, b);
745
+ function __() {
746
+ this.constructor = d;
545
747
  }
546
- return result;
748
+ d[strShimPrototype] = b === null ? objCreate(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
547
749
  }
548
- function _getGlobalConfig() {
549
- if (!_globalCfg) {
550
- var gbl = _getGlobalValue() || {};
551
- _globalCfg = gbl[GLOBAL_CONFIG_KEY] = gbl[GLOBAL_CONFIG_KEY] || {};
552
- }
553
- return _globalCfg;
750
+
751
+ var _a$2;
752
+ var Constructor = 'constructor';
753
+ var Prototype = 'prototype';
754
+ var strFunction = 'function';
755
+ var DynInstFuncTable = '_dynInstFuncs';
756
+ var DynProxyTag = '_isDynProxy';
757
+ var DynClassName = '_dynClass';
758
+ var DynClassNamePrefix = '_dynCls$';
759
+ var DynInstChkTag = '_dynInstChk';
760
+ var DynAllowInstChkTag = DynInstChkTag;
761
+ var DynProtoDefaultOptions = '_dfOpts';
762
+ var UnknownValue = '_unknown_';
763
+ var str__Proto = "__proto__";
764
+ var DynProtoBaseProto = "_dyn" + str__Proto;
765
+ var DynProtoGlobalSettings = "__dynProto$Gbl";
766
+ var DynProtoCurrent = "_dynInstProto";
767
+ var strUseBaseInst = 'useBaseInst';
768
+ var strSetInstFuncs = 'setInstFuncs';
769
+ var Obj = Object;
770
+ var _objGetPrototypeOf = Obj["getPrototypeOf"];
771
+ var _objGetOwnProps = Obj["getOwnPropertyNames"];
772
+ var _gbl = getGlobal();
773
+ var _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = {
774
+ o: (_a$2 = {},
775
+ _a$2[strSetInstFuncs] = true,
776
+ _a$2[strUseBaseInst] = true,
777
+ _a$2),
778
+ n: 1000
779
+ });
780
+ function _isObjectOrArrayPrototype(target) {
781
+ return target && (target === Obj[Prototype] || target === Array[Prototype]);
554
782
  }
555
- function dumpObj(object, format) {
556
- var propertyValueDump = "";
557
- if (isError(object)) {
558
- propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
559
- }
560
- else {
561
- try {
562
- propertyValueDump = JSON.stringify(object, null, format ? (isNumber(format) ? format : 4) : UNDEF_VALUE);
783
+ function _isObjectArrayOrFunctionPrototype(target) {
784
+ return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
785
+ }
786
+ function _getObjProto(target) {
787
+ var newProto;
788
+ if (target) {
789
+ if (_objGetPrototypeOf) {
790
+ return _objGetPrototypeOf(target);
563
791
  }
564
- catch (e) {
565
- propertyValueDump = " - " + dumpObj(e, format);
792
+ var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
793
+ newProto = target[DynProtoBaseProto] || curProto;
794
+ if (!objHasOwnProperty(target, DynProtoBaseProto)) {
795
+ delete target[DynProtoCurrent];
796
+ newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];
797
+ target[DynProtoCurrent] = curProto;
566
798
  }
567
799
  }
568
- return objToString(object) + ": " + propertyValueDump;
800
+ return newProto;
569
801
  }
570
- function _extractArgs(args, startAt) {
571
- var theArgs = [];
572
- for (var lp = startAt; lp < args[LENGTH]; lp++) {
573
- theArgs[lp - startAt] = args[lp];
802
+ function _forEachProp(target, func) {
803
+ var props = [];
804
+ if (_objGetOwnProps) {
805
+ props = _objGetOwnProps(target);
574
806
  }
575
- return theArgs;
576
- }
577
- function _unwrapFunction(funcName, target, polyFunc) {
578
- return function (thisArg) {
579
- if ((thisArg || thisArg === EMPTY)) {
580
- var theFunc = thisArg[funcName] || (target && target[funcName]);
581
- if (theFunc) {
582
- return theFunc.apply(thisArg, _extractArgs(arguments, 1));
583
- }
584
- if (polyFunc) {
585
- return polyFunc.apply(thisArg, arguments);
807
+ else {
808
+ for (var name_1 in target) {
809
+ if (typeof name_1 === "string" && objHasOwnProperty(target, name_1)) {
810
+ props.push(name_1);
586
811
  }
587
812
  }
588
- throwTypeError("'" + asString(funcName) + "' not defined for " + dumpObj(thisArg));
589
- };
590
- }
591
- var _polySymbols;
592
- function _globalSymbolRegistry() {
593
- if (!_polySymbols) {
594
- var gblCfg = _getGlobalConfig();
595
- _polySymbols = gblCfg.gblSym = gblCfg.gblSym || { k: {}, s: {} };
596
813
  }
597
- return _polySymbols;
598
- }
599
- function polyNewSymbol(description) {
600
- var theSymbol = {
601
- description: asString(description),
602
- toString: function () { return SYMBOL + "(" + description + ")"; }
603
- };
604
- theSymbol[POLYFILL_TAG] = true;
605
- return theSymbol;
606
- }
607
- function polySymbolFor(key) {
608
- var registry = _globalSymbolRegistry();
609
- if (!objHasOwn(registry, key)) {
610
- var newSymbol = polyNewSymbol(key);
611
- registry.k[key] = newSymbol;
612
- registry.s[newSymbol] = asString(key);
814
+ if (props && props.length > 0) {
815
+ for (var lp = 0; lp < props.length; lp++) {
816
+ func(props[lp]);
817
+ }
613
818
  }
614
- return registry.k[key];
615
819
  }
616
- var propMap = {
617
- e: "enumerable",
618
- c: "configurable",
619
- v: VALUE,
620
- w: "writable",
621
- g: "get",
622
- s: "set"
623
- };
624
- function _createProp(value) {
625
- var prop = {};
626
- prop[propMap["c"]] = true;
627
- prop[propMap["e"]] = true;
628
- objForEachKey(value, function (key, value) {
629
- prop[propMap[key]] = isUndefined(value) ? prop[propMap[key]] : value;
630
- });
631
- return prop;
820
+ function _isDynamicCandidate(target, funcName, skipOwn) {
821
+ return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || objHasOwnProperty(target, funcName)));
632
822
  }
633
- var objDefineProp = ObjClass["defineProperty"];
634
- function objDefine(target, key, propDesc) {
635
- return objDefineProp(target, key, _createProp(propDesc));
823
+ function _throwTypeError(message) {
824
+ throwTypeError("DynamicProto: " + message);
636
825
  }
637
- var _globalLazyTestHooks;
638
- var _fetchLazyTestHooks = function () {
639
- _globalLazyTestHooks = _getGlobalConfig();
640
- _fetchLazyTestHooks = null;
641
- };
642
- function getLazy(cb) {
643
- var lazyValue = {};
644
- _fetchLazyTestHooks && _fetchLazyTestHooks();
645
- lazyValue.b = _globalLazyTestHooks.lzy;
646
- objDefine(lazyValue, "v", {
647
- g: function () {
648
- var result = cb();
649
- if (!_globalLazyTestHooks.lzy) {
650
- objDefine(lazyValue, "v", { v: result });
651
- if (lazyValue.b) {
652
- delete lazyValue.b;
653
- }
654
- }
655
- if (_globalLazyTestHooks.lzy && lazyValue.b !== _globalLazyTestHooks.lzy) {
656
- lazyValue.b = _globalLazyTestHooks.lzy;
657
- }
658
- return result;
826
+ function _getInstanceFuncs(thisTarget) {
827
+ var instFuncs = {};
828
+ _forEachProp(thisTarget, function (name) {
829
+ if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
830
+ instFuncs[name] = thisTarget[name];
659
831
  }
660
832
  });
661
- return lazyValue;
662
- }
663
- function _lazySafeGet(cb, defValue) {
664
- return getLazy(function () { return _safeGet(cb, defValue); });
665
- }
666
- var DOCUMENT = "document";
667
- var NAVIGATOR = "navigator";
668
- var WINDOW = "window";
669
- var _cachedGlobal;
670
- var _cachedWindow;
671
- var _cachedDocument;
672
- var _cachedNavigator;
673
- function _lazySafeGetInst(name) {
674
- return _lazySafeGet(function () { return getInst(name) || UNDEF_VALUE; }, UNDEF_VALUE);
675
- }
676
- function getGlobal(useCached) {
677
- (!_cachedGlobal || useCached === false || (_globalLazyTestHooks.lzy && !_cachedGlobal.b)) && (_cachedGlobal = _lazySafeGet(_getGlobalValue, null));
678
- return _cachedGlobal.v;
833
+ return instFuncs;
679
834
  }
680
- function getInst(name, useCached) {
681
- var gbl = getGlobal(useCached);
682
- if (gbl && gbl[name]) {
683
- return gbl[name];
684
- }
685
- if (name === WINDOW && _cachedWindow) {
686
- return _cachedWindow.v;
835
+ function _hasVisited(values, value) {
836
+ for (var lp = values.length - 1; lp >= 0; lp--) {
837
+ if (values[lp] === value) {
838
+ return true;
839
+ }
687
840
  }
688
- return null;
689
- }
690
- function getDocument() {
691
- (!_cachedDocument || (_globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = _lazySafeGetInst(DOCUMENT));
692
- return _cachedDocument.v;
693
- }
694
- function hasWindow() {
695
- return !!getWindow();
696
- }
697
- function getWindow() {
698
- (!_cachedWindow || (_globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = _lazySafeGetInst(WINDOW));
699
- return _cachedWindow.v;
700
- }
701
- function hasNavigator() {
702
- return !!getNavigator();
703
- }
704
- function getNavigator() {
705
- (!_cachedNavigator || (_globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = _lazySafeGetInst(NAVIGATOR));
706
- return _cachedNavigator.v;
707
- }
708
- var _symbol;
709
- var _symbolFor;
710
- var _symbolKeyFor;
711
- function _getSymbolValue(name) {
712
- return _lazySafeGet(function () {
713
- return (_symbol.v ? _symbol[name] : UNDEF_VALUE);
714
- }, UNDEF_VALUE);
715
- }
716
- function getSymbol() {
717
- var resetCache = !_symbol || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_symbol.b);
718
- resetCache && (_symbol = _lazySafeGetInst(SYMBOL));
719
- (!_symbolFor || resetCache) && (_symbolFor = _getSymbolValue("for"));
720
- (!_symbolKeyFor || resetCache) && (_symbolKeyFor = _getSymbolValue("keyFor"));
721
- return _symbol.v;
722
- }
723
- function newSymbol(description, noPoly) {
724
- (!_symbol || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();
725
- return _symbol.v ? _symbol.v(description) : (!noPoly ? polyNewSymbol(description) : null);
726
- }
727
- function symbolFor(key) {
728
- (!_symbolFor || (_globalLazyTestHooks.lzy && !_symbol.b)) && getSymbol();
729
- return (_symbolFor.v || polySymbolFor)(key);
730
- }
731
- function isIterator(value) {
732
- return !!value && isFunction(value.next);
841
+ return false;
733
842
  }
734
- function arrAppend(target, elms) {
735
- if (!isUndefined(elms) && target) {
736
- if (isArray(elms)) {
737
- target.push.apply(target, elms);
738
- }
739
- else if (isIterator(elms)) {
740
- var value = elms.next();
741
- while (!value[DONE]) {
742
- target.push(value[VALUE]);
743
- value = elms.next();
843
+ function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
844
+ function _instFuncProxy(target, funcHost, funcName) {
845
+ var theFunc = funcHost[funcName];
846
+ if (theFunc[DynProxyTag] && useBaseInst) {
847
+ var instFuncTable = target[DynInstFuncTable] || {};
848
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
849
+ theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
744
850
  }
745
851
  }
746
- else {
747
- target.push(elms);
748
- }
852
+ return function () {
853
+ return theFunc.apply(target, arguments);
854
+ };
749
855
  }
750
- return target;
856
+ var baseFuncs = {};
857
+ _forEachProp(instFuncs, function (name) {
858
+ baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
859
+ });
860
+ var baseProto = _getObjProto(classProto);
861
+ var visited = [];
862
+ while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
863
+ _forEachProp(baseProto, function (name) {
864
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
865
+ baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
866
+ }
867
+ });
868
+ visited.push(baseProto);
869
+ baseProto = _getObjProto(baseProto);
870
+ }
871
+ return baseFuncs;
751
872
  }
752
- function arrForEach(theArray, callbackfn, thisArg) {
753
- if (theArray) {
754
- var len = theArray[LENGTH] >>> 0;
755
- for (var idx = 0; idx < len; idx++) {
756
- if (idx in theArray) {
757
- if (callbackfn.call(thisArg || theArray, theArray[idx], idx, theArray) === -1) {
873
+ function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
874
+ var instFunc = null;
875
+ if (target && objHasOwnProperty(proto, DynClassName)) {
876
+ var instFuncTable = target[DynInstFuncTable] || {};
877
+ instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
878
+ if (!instFunc) {
879
+ _throwTypeError("Missing [" + funcName + "] " + strFunction);
880
+ }
881
+ if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
882
+ var canAddInst = !objHasOwnProperty(target, funcName);
883
+ var objProto = _getObjProto(target);
884
+ var visited = [];
885
+ while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
886
+ var protoFunc = objProto[funcName];
887
+ if (protoFunc) {
888
+ canAddInst = (protoFunc === currentDynProtoProxy);
758
889
  break;
759
890
  }
891
+ visited.push(objProto);
892
+ objProto = _getObjProto(objProto);
893
+ }
894
+ try {
895
+ if (canAddInst) {
896
+ target[funcName] = instFunc;
897
+ }
898
+ instFunc[DynInstChkTag] = 1;
899
+ }
900
+ catch (e) {
901
+ instFuncTable[DynAllowInstChkTag] = false;
760
902
  }
761
903
  }
762
904
  }
905
+ return instFunc;
763
906
  }
764
- var arrIndexOf = _unwrapFunction(INDEX_OF, ArrProto);
765
- var arrMap = _unwrapFunction("map", ArrProto);
766
- function objSetPrototypeOf(obj, proto) {
767
- var fn = ObjClass["setPrototypeOf"] ||
768
- ({ __proto__: [] } instanceof Array && function (d, b) {
769
- d.__proto__ = b;
770
- }) ||
771
- function (d, b) {
772
- objForEachKey(b, function (key, value) { return d[key] = value; });
773
- };
774
- return fn(obj, proto);
775
- }
776
- function _createCustomError(name, d, baseClass) {
777
- objSetPrototypeOf(d, baseClass);
778
- function __() {
779
- this.constructor = d;
780
- this[NAME] = name;
781
- }
782
- __[PROTOTYPE] = baseClass[PROTOTYPE];
783
- d[PROTOTYPE] = new __();
784
- return d;
785
- }
786
- var _safeSetName = function (baseClass, name) {
787
- try {
788
- baseClass[PROTOTYPE][NAME] = name;
907
+ function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
908
+ var protoFunc = proto[funcName];
909
+ if (protoFunc === currentDynProtoProxy) {
910
+ protoFunc = _getObjProto(proto)[funcName];
789
911
  }
790
- catch (e) {
912
+ if (typeof protoFunc !== strFunction) {
913
+ _throwTypeError("[" + funcName + "] is not a " + strFunction);
791
914
  }
792
- };
793
- function createCustomError(name, constructCb) {
794
- var baseClass = Error;
795
- var orgName = baseClass[PROTOTYPE][NAME];
796
- var customError = _createCustomError(name, function () {
797
- var _this = this;
798
- try {
799
- _safeSetName(baseClass, name);
800
- _this = baseClass.apply(_this, arguments) || _this;
801
- _this[NAME] = name;
802
- constructCb && constructCb(_this, arguments);
803
- }
804
- finally {
805
- _safeSetName(baseClass, orgName);
806
- }
807
- return _this;
808
- }, baseClass);
809
- return customError;
810
- }
811
- function utcNow() {
812
- return (Date.now || polyUtcNow)();
813
- }
814
- function polyUtcNow() {
815
- return new Date().getTime();
915
+ return protoFunc;
816
916
  }
817
- var _fnToString;
818
- var _objCtrFnString;
819
- var _gblWindow;
820
- function isPlainObject(value) {
821
- if (!value || typeof value !== OBJECT) {
822
- return false;
823
- }
824
- if (!_gblWindow) {
825
- _gblWindow = hasWindow() ? getWindow() : true;
917
+ function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
918
+ function _createDynamicPrototype(proto, funcName) {
919
+ var dynProtoProxy = function () {
920
+ var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
921
+ return instFunc.apply(this, arguments);
922
+ };
923
+ dynProtoProxy[DynProxyTag] = 1;
924
+ return dynProtoProxy;
826
925
  }
827
- var result = false;
828
- if (value !== _gblWindow) {
829
- if (!_objCtrFnString) {
830
- _fnToString = Function[PROTOTYPE].toString;
831
- _objCtrFnString = _fnToString.call(ObjClass);
926
+ if (!_isObjectOrArrayPrototype(proto)) {
927
+ var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
928
+ var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
929
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
930
+ instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
832
931
  }
833
- try {
834
- var proto = objGetPrototypeOf(value);
835
- result = !proto;
836
- if (!result) {
837
- if (objHasOwnProperty(proto, CONSTRUCTOR)) {
838
- proto = proto[CONSTRUCTOR];
932
+ _forEachProp(target, function (name) {
933
+ if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
934
+ instFuncs_1[name] = target[name];
935
+ delete target[name];
936
+ if (!objHasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
937
+ proto[name] = _createDynamicPrototype(proto, name);
839
938
  }
840
- result = proto && typeof proto === FUNCTION && _fnToString.call(proto) === _objCtrFnString;
841
939
  }
842
- }
843
- catch (ex) {
844
- }
940
+ });
845
941
  }
846
- return result;
847
- }
848
- var strIndexOf = _unwrapFunction(INDEX_OF);
849
- function _createTrimFn(exp) {
850
- return function _doTrim(value) {
851
- if (isNullOrUndefined(value)) {
852
- throwTypeError("strTrim called [" + dumpObj(value) + "]");
853
- }
854
- if (value && value.replace) {
855
- value = value.replace(exp, "");
856
- }
857
- return value;
858
- };
859
- }
860
- var polyStrTrim = _createTrimFn(/^\s+|(?=\s)\s+$/g);
861
- var TRIM = "trim";
862
- var strTrim = _unwrapFunction(TRIM, UNDEF_VALUE, polyStrTrim);
863
- var REF = "ref";
864
- var UNREF = "un" + REF;
865
- var HAS_REF = "hasRef";
866
- var ENABLED = "enabled";
867
- function _createTimerHandler(startTimer, refreshFn, cancelFn) {
868
- var _a;
869
- var ref = true;
870
- var timerId = startTimer ? refreshFn(null) : null;
871
- var theTimerHandler;
872
- var _unref = function () {
873
- ref = false;
874
- timerId && timerId[UNREF] && timerId[UNREF]();
875
- return theTimerHandler;
876
- };
877
- var _ref = function () {
878
- ref = true;
879
- timerId && timerId[REF] && timerId[REF]();
880
- return theTimerHandler;
881
- };
882
- var _hasRef = function () {
883
- if (timerId && timerId[HAS_REF]) {
884
- return timerId[HAS_REF]();
885
- }
886
- return ref;
887
- };
888
- var _refresh = function () {
889
- timerId = refreshFn(timerId);
890
- if (!ref) {
891
- _unref();
892
- }
893
- return theTimerHandler;
894
- };
895
- var _cancel = function () {
896
- timerId && cancelFn(timerId);
897
- timerId = null;
898
- };
899
- var _setEnabled = function (value) {
900
- !value && timerId && _cancel();
901
- value && !timerId && _refresh();
902
- };
903
- theTimerHandler = (_a = {
904
- cancel: _cancel,
905
- refresh: _refresh
906
- },
907
- _a[HAS_REF] = _hasRef,
908
- _a[REF] = _ref,
909
- _a[UNREF] = _unref,
910
- _a[ENABLED] = false,
911
- _a);
912
- objDefineProp(theTimerHandler, ENABLED, {
913
- get: function () { return !!timerId; },
914
- set: _setEnabled
915
- });
916
- return {
917
- h: theTimerHandler,
918
- dn: function () {
919
- timerId = null;
920
- }
921
- };
922
942
  }
923
- function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
924
- var isArr = isArray(overrideFn);
925
- var len = isArr ? overrideFn.length : 0;
926
- var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
927
- var clearFn = (len > 1 ? overrideFn[1] : UNDEF_VALUE) || clearTimeout;
928
- var timerFn = theArgs[0];
929
- theArgs[0] = function () {
930
- handler.dn();
931
- timerFn.apply(self, arguments);
932
- };
933
- var handler = _createTimerHandler(startTimer, function (timerId) {
934
- if (timerId) {
935
- if (timerId.refresh) {
936
- timerId.refresh();
937
- return timerId;
943
+ function _checkPrototype(classProto, thisTarget) {
944
+ if (_objGetPrototypeOf) {
945
+ var visited = [];
946
+ var thisProto = _getObjProto(thisTarget);
947
+ while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
948
+ if (thisProto === classProto) {
949
+ return true;
938
950
  }
939
- clearFn.call(self, timerId);
951
+ visited.push(thisProto);
952
+ thisProto = _getObjProto(thisProto);
940
953
  }
941
- return setFn.apply(self, theArgs);
942
- }, function (timerId) {
943
- clearFn.call(self, timerId);
944
- });
945
- return handler.h;
954
+ return false;
955
+ }
956
+ return true;
946
957
  }
947
- function scheduleTimeout(callback, timeout) {
948
- return _createTimeoutWith(this, true, UNDEF_VALUE, _extractArgs(arguments, 0));
958
+ function _getObjName(target, unknownValue) {
959
+ if (objHasOwnProperty(target, Prototype)) {
960
+ return target.name || unknownValue || UnknownValue;
961
+ }
962
+ return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
963
+ }
964
+ function dynamicProto(theClass, target, delegateFunc, options) {
965
+ if (!objHasOwnProperty(theClass, Prototype)) {
966
+ _throwTypeError("theClass is an invalid class definition.");
967
+ }
968
+ var classProto = theClass[Prototype];
969
+ if (!_checkPrototype(classProto, target)) {
970
+ _throwTypeError("[" + _getObjName(theClass) + "] not in hierarchy of [" + _getObjName(target) + "]");
971
+ }
972
+ var className = null;
973
+ if (objHasOwnProperty(classProto, DynClassName)) {
974
+ className = classProto[DynClassName];
975
+ }
976
+ else {
977
+ className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _gblInst.n;
978
+ _gblInst.n++;
979
+ classProto[DynClassName] = className;
980
+ }
981
+ var perfOptions = dynamicProto[DynProtoDefaultOptions];
982
+ var useBaseInst = !!perfOptions[strUseBaseInst];
983
+ if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
984
+ useBaseInst = !!options[strUseBaseInst];
985
+ }
986
+ var instFuncs = _getInstanceFuncs(target);
987
+ var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
988
+ delegateFunc(target, baseFuncs);
989
+ var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
990
+ if (setInstanceFunc && options) {
991
+ setInstanceFunc = !!options[strSetInstFuncs];
992
+ }
993
+ _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
949
994
  }
995
+ dynamicProto[DynProtoDefaultOptions] = _gblInst.o;
950
996
 
951
997
  var createEnumStyle = createEnum;
952
998
  var createValueMap = createTypeMap;
@@ -1007,7 +1053,7 @@
1007
1053
  arrForEach(sourceErrors, function (srcError, idx) {
1008
1054
  theMessage += "\n".concat(idx, " > ").concat(dumpObj(srcError));
1009
1055
  });
1010
- throw new aggregationErrorType(message, sourceErrors || []);
1056
+ throw new aggregationErrorType(theMessage, sourceErrors || []);
1011
1057
  }
1012
1058
 
1013
1059
  var UNDEFINED_VALUE$1 = undefined;
@@ -1107,8 +1153,8 @@
1107
1153
  }());
1108
1154
  }
1109
1155
  function optimizeObject(theObject) {
1110
- if (theObject && ObjAssign) {
1111
- theObject = ObjClass$1(ObjAssign({}, theObject));
1156
+ if (theObject && objAssign) {
1157
+ theObject = ObjClass$1(objAssign({}, theObject));
1112
1158
  }
1113
1159
  return theObject;
1114
1160
  }
@@ -1284,15 +1330,17 @@
1284
1330
 
1285
1331
  var UInt32Mask = 0x100000000;
1286
1332
  var MaxUInt32 = 0xffffffff;
1333
+ var SEED1 = 123456789;
1334
+ var SEED2 = 987654321;
1287
1335
  var _mwcSeeded = false;
1288
- var _mwcW = 123456789;
1289
- var _mwcZ = 987654321;
1336
+ var _mwcW = SEED1;
1337
+ var _mwcZ = SEED2;
1290
1338
  function _mwcSeed(seedValue) {
1291
1339
  if (seedValue < 0) {
1292
1340
  seedValue >>>= 0;
1293
1341
  }
1294
- _mwcW = (123456789 + seedValue) & MaxUInt32;
1295
- _mwcZ = (987654321 - seedValue) & MaxUInt32;
1342
+ _mwcW = (SEED1 + seedValue) & MaxUInt32;
1343
+ _mwcZ = (SEED2 - seedValue) & MaxUInt32;
1296
1344
  _mwcSeeded = true;
1297
1345
  }
1298
1346
  function _autoSeedMwc() {
@@ -1350,7 +1398,7 @@
1350
1398
  return result;
1351
1399
  }
1352
1400
 
1353
- var version = "3.0.0-beta.2303-11";
1401
+ var version = "3.0.0-nightly3.2304-28";
1354
1402
  var instanceName = "." + newId(6);
1355
1403
  var _dataUid = 0;
1356
1404
  function _canAcceptData(target) {
@@ -3157,7 +3205,7 @@
3157
3205
  }
3158
3206
  function dsPadNumber(num) {
3159
3207
  var s = "00" + num;
3160
- return s.substr(s[_DYN_LENGTH$1 ] - 3);
3208
+ return strSubstr(s, s[_DYN_LENGTH$1 ] - 3);
3161
3209
  }
3162
3210
 
3163
3211
  var _document = getDocument() || {};
@@ -3264,7 +3312,7 @@
3264
3312
  var _canUseSessionStorage = undefined;
3265
3313
  function _getVerifiedStorageObject(storageType) {
3266
3314
  try {
3267
- if (isNullOrUndefined(getGlobal$1())) {
3315
+ if (isNullOrUndefined(getGlobal())) {
3268
3316
  return null;
3269
3317
  }
3270
3318
  var uid = (new Date)[_DYN_TO_STRING$1 ]();
@@ -4132,6 +4180,7 @@
4132
4180
  var _DYN_ENVELOPE_TYPE = "envelopeType";
4133
4181
  var _DYN_TO_STRING = "toString";
4134
4182
  var _DYN_ON_LINE = "onLine";
4183
+ var _DYN_IS_ONLINE = "isOnline";
4135
4184
  var _DYN__GET = "_get";
4136
4185
  var _DYN_ENQUEUE = "enqueue";
4137
4186
  var _DYN_COUNT = "count";
@@ -4282,7 +4331,7 @@
4282
4331
  }
4283
4332
  }
4284
4333
  var EnvelopeCreator = {
4285
- Version: "3.0.0-beta.2303-11"
4334
+ Version: "3.0.0-nightly3.2304-28"
4286
4335
  };
4287
4336
  function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
4288
4337
  EnvelopeCreatorInit(logger, telemetryItem);
@@ -4435,6 +4484,7 @@
4435
4484
  eventOff(target, null, null, evtNamespace);
4436
4485
  }
4437
4486
  function createOfflineListener(parentEvtNamespace) {
4487
+ var _a;
4438
4488
  var _document = getDocument();
4439
4489
  var _navigator = getNavigator();
4440
4490
  var _isListening = false;
@@ -4500,11 +4550,11 @@
4500
4550
  _isListening = false;
4501
4551
  }
4502
4552
  }
4503
- return {
4504
- isOnline: _isOnline,
4505
- isListening: function () { return _isListening; },
4506
- unload: _unload
4507
- };
4553
+ return _a = {},
4554
+ _a[_DYN_IS_ONLINE ] = _isOnline,
4555
+ _a.isListening = function () { return _isListening; },
4556
+ _a.unload = _unload,
4557
+ _a;
4508
4558
  }
4509
4559
 
4510
4560
  var BaseSendBuffer = /** @class */ (function () {
@@ -4981,7 +5031,6 @@
4981
5031
  _this.identifier = BreezeChannelIdentifier;
4982
5032
  var _consecutiveErrors;
4983
5033
  var _retryAt;
4984
- var _lastSend;
4985
5034
  var _paused;
4986
5035
  var _timeoutHandle;
4987
5036
  var _serializer;
@@ -5057,7 +5106,6 @@
5057
5106
  _serializer = new Serializer(core.logger);
5058
5107
  _consecutiveErrors = 0;
5059
5108
  _retryAt = null;
5060
- _lastSend = 0;
5061
5109
  _self[_DYN__SENDER ] = null;
5062
5110
  _stamp_specific_redirects = 0;
5063
5111
  var diagLog = _self[_DYN_DIAG_LOG ]();
@@ -5238,7 +5286,6 @@
5238
5286
  _self[_DYN__SENDER ](payload, async);
5239
5287
  }
5240
5288
  }
5241
- _lastSend = +new Date;
5242
5289
  }
5243
5290
  else {
5244
5291
  buffer[_DYN_CLEAR ]();
@@ -5315,7 +5362,9 @@
5315
5362
  function _checkMaxSize(incomingPayload) {
5316
5363
  var incomingSize = incomingPayload ? incomingPayload[_DYN_LENGTH ] : 0;
5317
5364
  if ((_self[_DYN__BUFFER ].size() + incomingSize) > _maxBatchSizeInBytes) {
5318
- _self[_DYN_TRIGGER_SEND ](true, null, 10 );
5365
+ if (!_offlineListener || _offlineListener[_DYN_IS_ONLINE ]()) {
5366
+ _self[_DYN_TRIGGER_SEND ](true, null, 10 );
5367
+ }
5319
5368
  return true;
5320
5369
  }
5321
5370
  return false;
@@ -5344,7 +5393,7 @@
5344
5393
  _self[_DYN__ON_ERROR ](payload, errorMessage);
5345
5394
  }
5346
5395
  }
5347
- else if (_offlineListener && !_offlineListener.isOnline()) {
5396
+ else if (_offlineListener && !_offlineListener[_DYN_IS_ONLINE ]()) {
5348
5397
  if (!_isRetryDisabled) {
5349
5398
  var offlineBackOffMultiplier = 10;
5350
5399
  _resendPayload(payload, offlineBackOffMultiplier);
@@ -5677,7 +5726,6 @@
5677
5726
  _offlineListener = null;
5678
5727
  _consecutiveErrors = 0;
5679
5728
  _retryAt = null;
5680
- _lastSend = null;
5681
5729
  _paused = false;
5682
5730
  _timeoutHandle = null;
5683
5731
  _serializer = null;
@@ -5722,7 +5770,5 @@
5722
5770
 
5723
5771
  exports.Sender = Sender;
5724
5772
 
5725
- Object.defineProperty(exports, '__esModule', { value: true });
5726
-
5727
5773
  }));
5728
- //# sourceMappingURL=applicationinsights-channel-js.js.map
5774
+ //# sourceMappingURL=applicationinsights-channel-js.3.js.map