gun-eth 1.5.3 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/gun-eth.browser.mjs +1 -0
- package/dist/gun-eth.cjs +3467 -0
- package/dist/gun-eth.mjs +3454 -0
- package/dist/index-0399263c.browser.mjs +26599 -0
- package/dist/index-7a06fa4c.browser.mjs +26599 -0
- package/dist/util-9498b6fc.browser.mjs +2258 -0
- package/dist/util-9975059a.browser.mjs +2258 -0
- package/package.json +17 -7
- package/dist/537.gun-eth.esm.js +0 -1
- package/dist/537.gun-eth.min.js +0 -1
- package/dist/gun-eth.esm.js +0 -1
- package/dist/gun-eth.min.js +0 -1
@@ -0,0 +1,2258 @@
|
|
1
|
+
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './index-7a06fa4c.browser.mjs';
|
2
|
+
|
3
|
+
function _mergeNamespaces(n, m) {
|
4
|
+
m.forEach(function (e) {
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
9
|
+
enumerable: true,
|
10
|
+
get: function () { return e[k]; }
|
11
|
+
});
|
12
|
+
}
|
13
|
+
});
|
14
|
+
});
|
15
|
+
return Object.freeze(n);
|
16
|
+
}
|
17
|
+
|
18
|
+
var util$2 = {};
|
19
|
+
|
20
|
+
var types = {};
|
21
|
+
|
22
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
23
|
+
var shams$1 = function hasSymbols() {
|
24
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
25
|
+
if (typeof Symbol.iterator === 'symbol') { return true; }
|
26
|
+
|
27
|
+
var obj = {};
|
28
|
+
var sym = Symbol('test');
|
29
|
+
var symObj = Object(sym);
|
30
|
+
if (typeof sym === 'string') { return false; }
|
31
|
+
|
32
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
33
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
34
|
+
|
35
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
36
|
+
// if (sym instanceof Symbol) { return false; }
|
37
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
38
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
39
|
+
|
40
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
41
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
42
|
+
|
43
|
+
var symVal = 42;
|
44
|
+
obj[sym] = symVal;
|
45
|
+
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
46
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
47
|
+
|
48
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
49
|
+
|
50
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
51
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
52
|
+
|
53
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
54
|
+
|
55
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
56
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
57
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
58
|
+
}
|
59
|
+
|
60
|
+
return true;
|
61
|
+
};
|
62
|
+
|
63
|
+
var hasSymbols$2 = shams$1;
|
64
|
+
|
65
|
+
/** @type {import('.')} */
|
66
|
+
var shams = function hasToStringTagShams() {
|
67
|
+
return hasSymbols$2() && !!Symbol.toStringTag;
|
68
|
+
};
|
69
|
+
|
70
|
+
/** @type {import('.')} */
|
71
|
+
var esErrors = Error;
|
72
|
+
|
73
|
+
/** @type {import('./eval')} */
|
74
|
+
var _eval = EvalError;
|
75
|
+
|
76
|
+
/** @type {import('./range')} */
|
77
|
+
var range = RangeError;
|
78
|
+
|
79
|
+
/** @type {import('./ref')} */
|
80
|
+
var ref = ReferenceError;
|
81
|
+
|
82
|
+
/** @type {import('./syntax')} */
|
83
|
+
var syntax = SyntaxError;
|
84
|
+
|
85
|
+
/** @type {import('./type')} */
|
86
|
+
var type = TypeError;
|
87
|
+
|
88
|
+
/** @type {import('./uri')} */
|
89
|
+
var uri = URIError;
|
90
|
+
|
91
|
+
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
92
|
+
var hasSymbolSham = shams$1;
|
93
|
+
|
94
|
+
var hasSymbols$1 = function hasNativeSymbols() {
|
95
|
+
if (typeof origSymbol !== 'function') { return false; }
|
96
|
+
if (typeof Symbol !== 'function') { return false; }
|
97
|
+
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
98
|
+
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
99
|
+
|
100
|
+
return hasSymbolSham();
|
101
|
+
};
|
102
|
+
|
103
|
+
var test = {
|
104
|
+
__proto__: null,
|
105
|
+
foo: {}
|
106
|
+
};
|
107
|
+
|
108
|
+
var $Object = Object;
|
109
|
+
|
110
|
+
/** @type {import('.')} */
|
111
|
+
var hasProto$1 = function hasProto() {
|
112
|
+
// @ts-expect-error: TS errors on an inherited property for some reason
|
113
|
+
return { __proto__: test }.foo === test.foo
|
114
|
+
&& !(test instanceof $Object);
|
115
|
+
};
|
116
|
+
|
117
|
+
/* eslint no-invalid-this: 1 */
|
118
|
+
|
119
|
+
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
120
|
+
var toStr$3 = Object.prototype.toString;
|
121
|
+
var max = Math.max;
|
122
|
+
var funcType = '[object Function]';
|
123
|
+
|
124
|
+
var concatty = function concatty(a, b) {
|
125
|
+
var arr = [];
|
126
|
+
|
127
|
+
for (var i = 0; i < a.length; i += 1) {
|
128
|
+
arr[i] = a[i];
|
129
|
+
}
|
130
|
+
for (var j = 0; j < b.length; j += 1) {
|
131
|
+
arr[j + a.length] = b[j];
|
132
|
+
}
|
133
|
+
|
134
|
+
return arr;
|
135
|
+
};
|
136
|
+
|
137
|
+
var slicy = function slicy(arrLike, offset) {
|
138
|
+
var arr = [];
|
139
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
140
|
+
arr[j] = arrLike[i];
|
141
|
+
}
|
142
|
+
return arr;
|
143
|
+
};
|
144
|
+
|
145
|
+
var joiny = function (arr, joiner) {
|
146
|
+
var str = '';
|
147
|
+
for (var i = 0; i < arr.length; i += 1) {
|
148
|
+
str += arr[i];
|
149
|
+
if (i + 1 < arr.length) {
|
150
|
+
str += joiner;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
return str;
|
154
|
+
};
|
155
|
+
|
156
|
+
var implementation$1 = function bind(that) {
|
157
|
+
var target = this;
|
158
|
+
if (typeof target !== 'function' || toStr$3.apply(target) !== funcType) {
|
159
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
160
|
+
}
|
161
|
+
var args = slicy(arguments, 1);
|
162
|
+
|
163
|
+
var bound;
|
164
|
+
var binder = function () {
|
165
|
+
if (this instanceof bound) {
|
166
|
+
var result = target.apply(
|
167
|
+
this,
|
168
|
+
concatty(args, arguments)
|
169
|
+
);
|
170
|
+
if (Object(result) === result) {
|
171
|
+
return result;
|
172
|
+
}
|
173
|
+
return this;
|
174
|
+
}
|
175
|
+
return target.apply(
|
176
|
+
that,
|
177
|
+
concatty(args, arguments)
|
178
|
+
);
|
179
|
+
|
180
|
+
};
|
181
|
+
|
182
|
+
var boundLength = max(0, target.length - args.length);
|
183
|
+
var boundArgs = [];
|
184
|
+
for (var i = 0; i < boundLength; i++) {
|
185
|
+
boundArgs[i] = '$' + i;
|
186
|
+
}
|
187
|
+
|
188
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
189
|
+
|
190
|
+
if (target.prototype) {
|
191
|
+
var Empty = function Empty() {};
|
192
|
+
Empty.prototype = target.prototype;
|
193
|
+
bound.prototype = new Empty();
|
194
|
+
Empty.prototype = null;
|
195
|
+
}
|
196
|
+
|
197
|
+
return bound;
|
198
|
+
};
|
199
|
+
|
200
|
+
var implementation = implementation$1;
|
201
|
+
|
202
|
+
var functionBind = Function.prototype.bind || implementation;
|
203
|
+
|
204
|
+
var call = Function.prototype.call;
|
205
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
206
|
+
var bind$1 = functionBind;
|
207
|
+
|
208
|
+
/** @type {import('.')} */
|
209
|
+
var hasown = bind$1.call(call, $hasOwn);
|
210
|
+
|
211
|
+
var undefined$1;
|
212
|
+
|
213
|
+
var $Error = esErrors;
|
214
|
+
var $EvalError = _eval;
|
215
|
+
var $RangeError = range;
|
216
|
+
var $ReferenceError = ref;
|
217
|
+
var $SyntaxError$1 = syntax;
|
218
|
+
var $TypeError$2 = type;
|
219
|
+
var $URIError = uri;
|
220
|
+
|
221
|
+
var $Function = Function;
|
222
|
+
|
223
|
+
// eslint-disable-next-line consistent-return
|
224
|
+
var getEvalledConstructor = function (expressionSyntax) {
|
225
|
+
try {
|
226
|
+
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
227
|
+
} catch (e) {}
|
228
|
+
};
|
229
|
+
|
230
|
+
var $gOPD$1 = Object.getOwnPropertyDescriptor;
|
231
|
+
if ($gOPD$1) {
|
232
|
+
try {
|
233
|
+
$gOPD$1({}, '');
|
234
|
+
} catch (e) {
|
235
|
+
$gOPD$1 = null; // this is IE 8, which has a broken gOPD
|
236
|
+
}
|
237
|
+
}
|
238
|
+
|
239
|
+
var throwTypeError = function () {
|
240
|
+
throw new $TypeError$2();
|
241
|
+
};
|
242
|
+
var ThrowTypeError = $gOPD$1
|
243
|
+
? (function () {
|
244
|
+
try {
|
245
|
+
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
246
|
+
arguments.callee; // IE 8 does not throw here
|
247
|
+
return throwTypeError;
|
248
|
+
} catch (calleeThrows) {
|
249
|
+
try {
|
250
|
+
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
251
|
+
return $gOPD$1(arguments, 'callee').get;
|
252
|
+
} catch (gOPDthrows) {
|
253
|
+
return throwTypeError;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}())
|
257
|
+
: throwTypeError;
|
258
|
+
|
259
|
+
var hasSymbols = hasSymbols$1();
|
260
|
+
var hasProto = hasProto$1();
|
261
|
+
|
262
|
+
var getProto$1 = Object.getPrototypeOf || (
|
263
|
+
hasProto
|
264
|
+
? function (x) { return x.__proto__; } // eslint-disable-line no-proto
|
265
|
+
: null
|
266
|
+
);
|
267
|
+
|
268
|
+
var needsEval = {};
|
269
|
+
|
270
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto$1 ? undefined$1 : getProto$1(Uint8Array);
|
271
|
+
|
272
|
+
var INTRINSICS = {
|
273
|
+
__proto__: null,
|
274
|
+
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
275
|
+
'%Array%': Array,
|
276
|
+
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
277
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto$1 ? getProto$1([][Symbol.iterator]()) : undefined$1,
|
278
|
+
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
279
|
+
'%AsyncFunction%': needsEval,
|
280
|
+
'%AsyncGenerator%': needsEval,
|
281
|
+
'%AsyncGeneratorFunction%': needsEval,
|
282
|
+
'%AsyncIteratorPrototype%': needsEval,
|
283
|
+
'%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
|
284
|
+
'%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
|
285
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
|
286
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
|
287
|
+
'%Boolean%': Boolean,
|
288
|
+
'%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
|
289
|
+
'%Date%': Date,
|
290
|
+
'%decodeURI%': decodeURI,
|
291
|
+
'%decodeURIComponent%': decodeURIComponent,
|
292
|
+
'%encodeURI%': encodeURI,
|
293
|
+
'%encodeURIComponent%': encodeURIComponent,
|
294
|
+
'%Error%': $Error,
|
295
|
+
'%eval%': eval, // eslint-disable-line no-eval
|
296
|
+
'%EvalError%': $EvalError,
|
297
|
+
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
298
|
+
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
299
|
+
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
|
300
|
+
'%Function%': $Function,
|
301
|
+
'%GeneratorFunction%': needsEval,
|
302
|
+
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
|
303
|
+
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
|
304
|
+
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
305
|
+
'%isFinite%': isFinite,
|
306
|
+
'%isNaN%': isNaN,
|
307
|
+
'%IteratorPrototype%': hasSymbols && getProto$1 ? getProto$1(getProto$1([][Symbol.iterator]())) : undefined$1,
|
308
|
+
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
309
|
+
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
310
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto$1 ? undefined$1 : getProto$1(new Map()[Symbol.iterator]()),
|
311
|
+
'%Math%': Math,
|
312
|
+
'%Number%': Number,
|
313
|
+
'%Object%': Object,
|
314
|
+
'%parseFloat%': parseFloat,
|
315
|
+
'%parseInt%': parseInt,
|
316
|
+
'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
|
317
|
+
'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
|
318
|
+
'%RangeError%': $RangeError,
|
319
|
+
'%ReferenceError%': $ReferenceError,
|
320
|
+
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
321
|
+
'%RegExp%': RegExp,
|
322
|
+
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
323
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto$1 ? undefined$1 : getProto$1(new Set()[Symbol.iterator]()),
|
324
|
+
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
325
|
+
'%String%': String,
|
326
|
+
'%StringIteratorPrototype%': hasSymbols && getProto$1 ? getProto$1(''[Symbol.iterator]()) : undefined$1,
|
327
|
+
'%Symbol%': hasSymbols ? Symbol : undefined$1,
|
328
|
+
'%SyntaxError%': $SyntaxError$1,
|
329
|
+
'%ThrowTypeError%': ThrowTypeError,
|
330
|
+
'%TypedArray%': TypedArray,
|
331
|
+
'%TypeError%': $TypeError$2,
|
332
|
+
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
|
333
|
+
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
|
334
|
+
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
|
335
|
+
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
|
336
|
+
'%URIError%': $URIError,
|
337
|
+
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
|
338
|
+
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
|
339
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
|
340
|
+
};
|
341
|
+
|
342
|
+
if (getProto$1) {
|
343
|
+
try {
|
344
|
+
null.error; // eslint-disable-line no-unused-expressions
|
345
|
+
} catch (e) {
|
346
|
+
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
347
|
+
var errorProto = getProto$1(getProto$1(e));
|
348
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
349
|
+
}
|
350
|
+
}
|
351
|
+
|
352
|
+
var doEval = function doEval(name) {
|
353
|
+
var value;
|
354
|
+
if (name === '%AsyncFunction%') {
|
355
|
+
value = getEvalledConstructor('async function () {}');
|
356
|
+
} else if (name === '%GeneratorFunction%') {
|
357
|
+
value = getEvalledConstructor('function* () {}');
|
358
|
+
} else if (name === '%AsyncGeneratorFunction%') {
|
359
|
+
value = getEvalledConstructor('async function* () {}');
|
360
|
+
} else if (name === '%AsyncGenerator%') {
|
361
|
+
var fn = doEval('%AsyncGeneratorFunction%');
|
362
|
+
if (fn) {
|
363
|
+
value = fn.prototype;
|
364
|
+
}
|
365
|
+
} else if (name === '%AsyncIteratorPrototype%') {
|
366
|
+
var gen = doEval('%AsyncGenerator%');
|
367
|
+
if (gen && getProto$1) {
|
368
|
+
value = getProto$1(gen.prototype);
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
INTRINSICS[name] = value;
|
373
|
+
|
374
|
+
return value;
|
375
|
+
};
|
376
|
+
|
377
|
+
var LEGACY_ALIASES = {
|
378
|
+
__proto__: null,
|
379
|
+
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
380
|
+
'%ArrayPrototype%': ['Array', 'prototype'],
|
381
|
+
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
382
|
+
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
383
|
+
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
384
|
+
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
385
|
+
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
386
|
+
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
387
|
+
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
388
|
+
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
389
|
+
'%DataViewPrototype%': ['DataView', 'prototype'],
|
390
|
+
'%DatePrototype%': ['Date', 'prototype'],
|
391
|
+
'%ErrorPrototype%': ['Error', 'prototype'],
|
392
|
+
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
393
|
+
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
394
|
+
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
395
|
+
'%FunctionPrototype%': ['Function', 'prototype'],
|
396
|
+
'%Generator%': ['GeneratorFunction', 'prototype'],
|
397
|
+
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
398
|
+
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
399
|
+
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
400
|
+
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
401
|
+
'%JSONParse%': ['JSON', 'parse'],
|
402
|
+
'%JSONStringify%': ['JSON', 'stringify'],
|
403
|
+
'%MapPrototype%': ['Map', 'prototype'],
|
404
|
+
'%NumberPrototype%': ['Number', 'prototype'],
|
405
|
+
'%ObjectPrototype%': ['Object', 'prototype'],
|
406
|
+
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
407
|
+
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
408
|
+
'%PromisePrototype%': ['Promise', 'prototype'],
|
409
|
+
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
410
|
+
'%Promise_all%': ['Promise', 'all'],
|
411
|
+
'%Promise_reject%': ['Promise', 'reject'],
|
412
|
+
'%Promise_resolve%': ['Promise', 'resolve'],
|
413
|
+
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
414
|
+
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
415
|
+
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
416
|
+
'%SetPrototype%': ['Set', 'prototype'],
|
417
|
+
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
418
|
+
'%StringPrototype%': ['String', 'prototype'],
|
419
|
+
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
420
|
+
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
421
|
+
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
422
|
+
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
423
|
+
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
424
|
+
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
425
|
+
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
426
|
+
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
427
|
+
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
428
|
+
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
429
|
+
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
430
|
+
};
|
431
|
+
|
432
|
+
var bind = functionBind;
|
433
|
+
var hasOwn = hasown;
|
434
|
+
var $concat = bind.call(Function.call, Array.prototype.concat);
|
435
|
+
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
436
|
+
var $replace = bind.call(Function.call, String.prototype.replace);
|
437
|
+
var $strSlice = bind.call(Function.call, String.prototype.slice);
|
438
|
+
var $exec = bind.call(Function.call, RegExp.prototype.exec);
|
439
|
+
|
440
|
+
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
441
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
442
|
+
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
443
|
+
var stringToPath = function stringToPath(string) {
|
444
|
+
var first = $strSlice(string, 0, 1);
|
445
|
+
var last = $strSlice(string, -1);
|
446
|
+
if (first === '%' && last !== '%') {
|
447
|
+
throw new $SyntaxError$1('invalid intrinsic syntax, expected closing `%`');
|
448
|
+
} else if (last === '%' && first !== '%') {
|
449
|
+
throw new $SyntaxError$1('invalid intrinsic syntax, expected opening `%`');
|
450
|
+
}
|
451
|
+
var result = [];
|
452
|
+
$replace(string, rePropName, function (match, number, quote, subString) {
|
453
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
454
|
+
});
|
455
|
+
return result;
|
456
|
+
};
|
457
|
+
/* end adaptation */
|
458
|
+
|
459
|
+
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
460
|
+
var intrinsicName = name;
|
461
|
+
var alias;
|
462
|
+
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
463
|
+
alias = LEGACY_ALIASES[intrinsicName];
|
464
|
+
intrinsicName = '%' + alias[0] + '%';
|
465
|
+
}
|
466
|
+
|
467
|
+
if (hasOwn(INTRINSICS, intrinsicName)) {
|
468
|
+
var value = INTRINSICS[intrinsicName];
|
469
|
+
if (value === needsEval) {
|
470
|
+
value = doEval(intrinsicName);
|
471
|
+
}
|
472
|
+
if (typeof value === 'undefined' && !allowMissing) {
|
473
|
+
throw new $TypeError$2('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
474
|
+
}
|
475
|
+
|
476
|
+
return {
|
477
|
+
alias: alias,
|
478
|
+
name: intrinsicName,
|
479
|
+
value: value
|
480
|
+
};
|
481
|
+
}
|
482
|
+
|
483
|
+
throw new $SyntaxError$1('intrinsic ' + name + ' does not exist!');
|
484
|
+
};
|
485
|
+
|
486
|
+
var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
487
|
+
if (typeof name !== 'string' || name.length === 0) {
|
488
|
+
throw new $TypeError$2('intrinsic name must be a non-empty string');
|
489
|
+
}
|
490
|
+
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
491
|
+
throw new $TypeError$2('"allowMissing" argument must be a boolean');
|
492
|
+
}
|
493
|
+
|
494
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
495
|
+
throw new $SyntaxError$1('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
496
|
+
}
|
497
|
+
var parts = stringToPath(name);
|
498
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
499
|
+
|
500
|
+
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
501
|
+
var intrinsicRealName = intrinsic.name;
|
502
|
+
var value = intrinsic.value;
|
503
|
+
var skipFurtherCaching = false;
|
504
|
+
|
505
|
+
var alias = intrinsic.alias;
|
506
|
+
if (alias) {
|
507
|
+
intrinsicBaseName = alias[0];
|
508
|
+
$spliceApply(parts, $concat([0, 1], alias));
|
509
|
+
}
|
510
|
+
|
511
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
512
|
+
var part = parts[i];
|
513
|
+
var first = $strSlice(part, 0, 1);
|
514
|
+
var last = $strSlice(part, -1);
|
515
|
+
if (
|
516
|
+
(
|
517
|
+
(first === '"' || first === "'" || first === '`')
|
518
|
+
|| (last === '"' || last === "'" || last === '`')
|
519
|
+
)
|
520
|
+
&& first !== last
|
521
|
+
) {
|
522
|
+
throw new $SyntaxError$1('property names with quotes must have matching quotes');
|
523
|
+
}
|
524
|
+
if (part === 'constructor' || !isOwn) {
|
525
|
+
skipFurtherCaching = true;
|
526
|
+
}
|
527
|
+
|
528
|
+
intrinsicBaseName += '.' + part;
|
529
|
+
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
530
|
+
|
531
|
+
if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
532
|
+
value = INTRINSICS[intrinsicRealName];
|
533
|
+
} else if (value != null) {
|
534
|
+
if (!(part in value)) {
|
535
|
+
if (!allowMissing) {
|
536
|
+
throw new $TypeError$2('base intrinsic for ' + name + ' exists, but the property is not available.');
|
537
|
+
}
|
538
|
+
return void undefined$1;
|
539
|
+
}
|
540
|
+
if ($gOPD$1 && (i + 1) >= parts.length) {
|
541
|
+
var desc = $gOPD$1(value, part);
|
542
|
+
isOwn = !!desc;
|
543
|
+
|
544
|
+
// By convention, when a data property is converted to an accessor
|
545
|
+
// property to emulate a data property that does not suffer from
|
546
|
+
// the override mistake, that accessor's getter is marked with
|
547
|
+
// an `originalValue` property. Here, when we detect this, we
|
548
|
+
// uphold the illusion by pretending to see that original data
|
549
|
+
// property, i.e., returning the value rather than the getter
|
550
|
+
// itself.
|
551
|
+
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
552
|
+
value = desc.get;
|
553
|
+
} else {
|
554
|
+
value = value[part];
|
555
|
+
}
|
556
|
+
} else {
|
557
|
+
isOwn = hasOwn(value, part);
|
558
|
+
value = value[part];
|
559
|
+
}
|
560
|
+
|
561
|
+
if (isOwn && !skipFurtherCaching) {
|
562
|
+
INTRINSICS[intrinsicRealName] = value;
|
563
|
+
}
|
564
|
+
}
|
565
|
+
}
|
566
|
+
return value;
|
567
|
+
};
|
568
|
+
|
569
|
+
var callBind$2 = {exports: {}};
|
570
|
+
|
571
|
+
var esDefineProperty;
|
572
|
+
var hasRequiredEsDefineProperty;
|
573
|
+
|
574
|
+
function requireEsDefineProperty () {
|
575
|
+
if (hasRequiredEsDefineProperty) return esDefineProperty;
|
576
|
+
hasRequiredEsDefineProperty = 1;
|
577
|
+
|
578
|
+
var GetIntrinsic = getIntrinsic;
|
579
|
+
|
580
|
+
/** @type {import('.')} */
|
581
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false;
|
582
|
+
if ($defineProperty) {
|
583
|
+
try {
|
584
|
+
$defineProperty({}, 'a', { value: 1 });
|
585
|
+
} catch (e) {
|
586
|
+
// IE 8 has a broken defineProperty
|
587
|
+
$defineProperty = false;
|
588
|
+
}
|
589
|
+
}
|
590
|
+
|
591
|
+
esDefineProperty = $defineProperty;
|
592
|
+
return esDefineProperty;
|
593
|
+
}
|
594
|
+
|
595
|
+
var GetIntrinsic$2 = getIntrinsic;
|
596
|
+
|
597
|
+
var $gOPD = GetIntrinsic$2('%Object.getOwnPropertyDescriptor%', true);
|
598
|
+
|
599
|
+
if ($gOPD) {
|
600
|
+
try {
|
601
|
+
$gOPD([], 'length');
|
602
|
+
} catch (e) {
|
603
|
+
// IE 8 has a broken gOPD
|
604
|
+
$gOPD = null;
|
605
|
+
}
|
606
|
+
}
|
607
|
+
|
608
|
+
var gopd$1 = $gOPD;
|
609
|
+
|
610
|
+
var $defineProperty$1 = requireEsDefineProperty();
|
611
|
+
|
612
|
+
var $SyntaxError = syntax;
|
613
|
+
var $TypeError$1 = type;
|
614
|
+
|
615
|
+
var gopd = gopd$1;
|
616
|
+
|
617
|
+
/** @type {import('.')} */
|
618
|
+
var defineDataProperty = function defineDataProperty(
|
619
|
+
obj,
|
620
|
+
property,
|
621
|
+
value
|
622
|
+
) {
|
623
|
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
624
|
+
throw new $TypeError$1('`obj` must be an object or a function`');
|
625
|
+
}
|
626
|
+
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
627
|
+
throw new $TypeError$1('`property` must be a string or a symbol`');
|
628
|
+
}
|
629
|
+
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
630
|
+
throw new $TypeError$1('`nonEnumerable`, if provided, must be a boolean or null');
|
631
|
+
}
|
632
|
+
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
633
|
+
throw new $TypeError$1('`nonWritable`, if provided, must be a boolean or null');
|
634
|
+
}
|
635
|
+
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
636
|
+
throw new $TypeError$1('`nonConfigurable`, if provided, must be a boolean or null');
|
637
|
+
}
|
638
|
+
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
639
|
+
throw new $TypeError$1('`loose`, if provided, must be a boolean');
|
640
|
+
}
|
641
|
+
|
642
|
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
643
|
+
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
644
|
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
645
|
+
var loose = arguments.length > 6 ? arguments[6] : false;
|
646
|
+
|
647
|
+
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
648
|
+
var desc = !!gopd && gopd(obj, property);
|
649
|
+
|
650
|
+
if ($defineProperty$1) {
|
651
|
+
$defineProperty$1(obj, property, {
|
652
|
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
653
|
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
654
|
+
value: value,
|
655
|
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
656
|
+
});
|
657
|
+
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
658
|
+
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
659
|
+
obj[property] = value; // eslint-disable-line no-param-reassign
|
660
|
+
} else {
|
661
|
+
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
|
662
|
+
}
|
663
|
+
};
|
664
|
+
|
665
|
+
var $defineProperty = requireEsDefineProperty();
|
666
|
+
|
667
|
+
var hasPropertyDescriptors = function hasPropertyDescriptors() {
|
668
|
+
return !!$defineProperty;
|
669
|
+
};
|
670
|
+
|
671
|
+
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
|
672
|
+
// node v0.6 has a bug where array lengths can be Set but not Defined
|
673
|
+
if (!$defineProperty) {
|
674
|
+
return null;
|
675
|
+
}
|
676
|
+
try {
|
677
|
+
return $defineProperty([], 'length', { value: 1 }).length !== 1;
|
678
|
+
} catch (e) {
|
679
|
+
// In Firefox 4-22, defining length on an array throws an exception.
|
680
|
+
return true;
|
681
|
+
}
|
682
|
+
};
|
683
|
+
|
684
|
+
var hasPropertyDescriptors_1 = hasPropertyDescriptors;
|
685
|
+
|
686
|
+
var GetIntrinsic$1 = getIntrinsic;
|
687
|
+
var define = defineDataProperty;
|
688
|
+
var hasDescriptors = hasPropertyDescriptors_1();
|
689
|
+
var gOPD$1 = gopd$1;
|
690
|
+
|
691
|
+
var $TypeError = type;
|
692
|
+
var $floor = GetIntrinsic$1('%Math.floor%');
|
693
|
+
|
694
|
+
/** @type {import('.')} */
|
695
|
+
var setFunctionLength = function setFunctionLength(fn, length) {
|
696
|
+
if (typeof fn !== 'function') {
|
697
|
+
throw new $TypeError('`fn` is not a function');
|
698
|
+
}
|
699
|
+
if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
|
700
|
+
throw new $TypeError('`length` must be a positive 32-bit integer');
|
701
|
+
}
|
702
|
+
|
703
|
+
var loose = arguments.length > 2 && !!arguments[2];
|
704
|
+
|
705
|
+
var functionLengthIsConfigurable = true;
|
706
|
+
var functionLengthIsWritable = true;
|
707
|
+
if ('length' in fn && gOPD$1) {
|
708
|
+
var desc = gOPD$1(fn, 'length');
|
709
|
+
if (desc && !desc.configurable) {
|
710
|
+
functionLengthIsConfigurable = false;
|
711
|
+
}
|
712
|
+
if (desc && !desc.writable) {
|
713
|
+
functionLengthIsWritable = false;
|
714
|
+
}
|
715
|
+
}
|
716
|
+
|
717
|
+
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
|
718
|
+
if (hasDescriptors) {
|
719
|
+
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
|
720
|
+
} else {
|
721
|
+
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
|
722
|
+
}
|
723
|
+
}
|
724
|
+
return fn;
|
725
|
+
};
|
726
|
+
|
727
|
+
(function (module) {
|
728
|
+
|
729
|
+
var bind = functionBind;
|
730
|
+
var GetIntrinsic = getIntrinsic;
|
731
|
+
var setFunctionLength$1 = setFunctionLength;
|
732
|
+
|
733
|
+
var $TypeError = type;
|
734
|
+
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
735
|
+
var $call = GetIntrinsic('%Function.prototype.call%');
|
736
|
+
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
737
|
+
|
738
|
+
var $defineProperty = requireEsDefineProperty();
|
739
|
+
var $max = GetIntrinsic('%Math.max%');
|
740
|
+
|
741
|
+
module.exports = function callBind(originalFunction) {
|
742
|
+
if (typeof originalFunction !== 'function') {
|
743
|
+
throw new $TypeError('a function is required');
|
744
|
+
}
|
745
|
+
var func = $reflectApply(bind, $call, arguments);
|
746
|
+
return setFunctionLength$1(
|
747
|
+
func,
|
748
|
+
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
749
|
+
true
|
750
|
+
);
|
751
|
+
};
|
752
|
+
|
753
|
+
var applyBind = function applyBind() {
|
754
|
+
return $reflectApply(bind, $apply, arguments);
|
755
|
+
};
|
756
|
+
|
757
|
+
if ($defineProperty) {
|
758
|
+
$defineProperty(module.exports, 'apply', { value: applyBind });
|
759
|
+
} else {
|
760
|
+
module.exports.apply = applyBind;
|
761
|
+
}
|
762
|
+
} (callBind$2));
|
763
|
+
|
764
|
+
var callBindExports = callBind$2.exports;
|
765
|
+
|
766
|
+
var GetIntrinsic = getIntrinsic;
|
767
|
+
|
768
|
+
var callBind$1 = callBindExports;
|
769
|
+
|
770
|
+
var $indexOf$1 = callBind$1(GetIntrinsic('String.prototype.indexOf'));
|
771
|
+
|
772
|
+
var callBound$2 = function callBoundIntrinsic(name, allowMissing) {
|
773
|
+
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
774
|
+
if (typeof intrinsic === 'function' && $indexOf$1(name, '.prototype.') > -1) {
|
775
|
+
return callBind$1(intrinsic);
|
776
|
+
}
|
777
|
+
return intrinsic;
|
778
|
+
};
|
779
|
+
|
780
|
+
var hasToStringTag$3 = shams();
|
781
|
+
var callBound$1 = callBound$2;
|
782
|
+
|
783
|
+
var $toString$1 = callBound$1('Object.prototype.toString');
|
784
|
+
|
785
|
+
var isStandardArguments = function isArguments(value) {
|
786
|
+
if (hasToStringTag$3 && value && typeof value === 'object' && Symbol.toStringTag in value) {
|
787
|
+
return false;
|
788
|
+
}
|
789
|
+
return $toString$1(value) === '[object Arguments]';
|
790
|
+
};
|
791
|
+
|
792
|
+
var isLegacyArguments = function isArguments(value) {
|
793
|
+
if (isStandardArguments(value)) {
|
794
|
+
return true;
|
795
|
+
}
|
796
|
+
return value !== null &&
|
797
|
+
typeof value === 'object' &&
|
798
|
+
typeof value.length === 'number' &&
|
799
|
+
value.length >= 0 &&
|
800
|
+
$toString$1(value) !== '[object Array]' &&
|
801
|
+
$toString$1(value.callee) === '[object Function]';
|
802
|
+
};
|
803
|
+
|
804
|
+
var supportsStandardArguments = (function () {
|
805
|
+
return isStandardArguments(arguments);
|
806
|
+
}());
|
807
|
+
|
808
|
+
isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
|
809
|
+
|
810
|
+
var isArguments = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
|
811
|
+
|
812
|
+
var toStr$2 = Object.prototype.toString;
|
813
|
+
var fnToStr$1 = Function.prototype.toString;
|
814
|
+
var isFnRegex = /^\s*(?:function)?\*/;
|
815
|
+
var hasToStringTag$2 = shams();
|
816
|
+
var getProto = Object.getPrototypeOf;
|
817
|
+
var getGeneratorFunc = function () { // eslint-disable-line consistent-return
|
818
|
+
if (!hasToStringTag$2) {
|
819
|
+
return false;
|
820
|
+
}
|
821
|
+
try {
|
822
|
+
return Function('return function*() {}')();
|
823
|
+
} catch (e) {
|
824
|
+
}
|
825
|
+
};
|
826
|
+
var GeneratorFunction;
|
827
|
+
|
828
|
+
var isGeneratorFunction = function isGeneratorFunction(fn) {
|
829
|
+
if (typeof fn !== 'function') {
|
830
|
+
return false;
|
831
|
+
}
|
832
|
+
if (isFnRegex.test(fnToStr$1.call(fn))) {
|
833
|
+
return true;
|
834
|
+
}
|
835
|
+
if (!hasToStringTag$2) {
|
836
|
+
var str = toStr$2.call(fn);
|
837
|
+
return str === '[object GeneratorFunction]';
|
838
|
+
}
|
839
|
+
if (!getProto) {
|
840
|
+
return false;
|
841
|
+
}
|
842
|
+
if (typeof GeneratorFunction === 'undefined') {
|
843
|
+
var generatorFunc = getGeneratorFunc();
|
844
|
+
GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;
|
845
|
+
}
|
846
|
+
return getProto(fn) === GeneratorFunction;
|
847
|
+
};
|
848
|
+
|
849
|
+
var fnToStr = Function.prototype.toString;
|
850
|
+
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
|
851
|
+
var badArrayLike;
|
852
|
+
var isCallableMarker;
|
853
|
+
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
|
854
|
+
try {
|
855
|
+
badArrayLike = Object.defineProperty({}, 'length', {
|
856
|
+
get: function () {
|
857
|
+
throw isCallableMarker;
|
858
|
+
}
|
859
|
+
});
|
860
|
+
isCallableMarker = {};
|
861
|
+
// eslint-disable-next-line no-throw-literal
|
862
|
+
reflectApply(function () { throw 42; }, null, badArrayLike);
|
863
|
+
} catch (_) {
|
864
|
+
if (_ !== isCallableMarker) {
|
865
|
+
reflectApply = null;
|
866
|
+
}
|
867
|
+
}
|
868
|
+
} else {
|
869
|
+
reflectApply = null;
|
870
|
+
}
|
871
|
+
|
872
|
+
var constructorRegex = /^\s*class\b/;
|
873
|
+
var isES6ClassFn = function isES6ClassFunction(value) {
|
874
|
+
try {
|
875
|
+
var fnStr = fnToStr.call(value);
|
876
|
+
return constructorRegex.test(fnStr);
|
877
|
+
} catch (e) {
|
878
|
+
return false; // not a function
|
879
|
+
}
|
880
|
+
};
|
881
|
+
|
882
|
+
var tryFunctionObject = function tryFunctionToStr(value) {
|
883
|
+
try {
|
884
|
+
if (isES6ClassFn(value)) { return false; }
|
885
|
+
fnToStr.call(value);
|
886
|
+
return true;
|
887
|
+
} catch (e) {
|
888
|
+
return false;
|
889
|
+
}
|
890
|
+
};
|
891
|
+
var toStr$1 = Object.prototype.toString;
|
892
|
+
var objectClass = '[object Object]';
|
893
|
+
var fnClass = '[object Function]';
|
894
|
+
var genClass = '[object GeneratorFunction]';
|
895
|
+
var ddaClass = '[object HTMLAllCollection]'; // IE 11
|
896
|
+
var ddaClass2 = '[object HTML document.all class]';
|
897
|
+
var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
|
898
|
+
var hasToStringTag$1 = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
|
899
|
+
|
900
|
+
var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
|
901
|
+
|
902
|
+
var isDDA = function isDocumentDotAll() { return false; };
|
903
|
+
if (typeof document === 'object') {
|
904
|
+
// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
|
905
|
+
var all = document.all;
|
906
|
+
if (toStr$1.call(all) === toStr$1.call(document.all)) {
|
907
|
+
isDDA = function isDocumentDotAll(value) {
|
908
|
+
/* globals document: false */
|
909
|
+
// in IE 6-8, typeof document.all is "object" and it's truthy
|
910
|
+
if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
|
911
|
+
try {
|
912
|
+
var str = toStr$1.call(value);
|
913
|
+
return (
|
914
|
+
str === ddaClass
|
915
|
+
|| str === ddaClass2
|
916
|
+
|| str === ddaClass3 // opera 12.16
|
917
|
+
|| str === objectClass // IE 6-8
|
918
|
+
) && value('') == null; // eslint-disable-line eqeqeq
|
919
|
+
} catch (e) { /**/ }
|
920
|
+
}
|
921
|
+
return false;
|
922
|
+
};
|
923
|
+
}
|
924
|
+
}
|
925
|
+
|
926
|
+
var isCallable$1 = reflectApply
|
927
|
+
? function isCallable(value) {
|
928
|
+
if (isDDA(value)) { return true; }
|
929
|
+
if (!value) { return false; }
|
930
|
+
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
931
|
+
try {
|
932
|
+
reflectApply(value, null, badArrayLike);
|
933
|
+
} catch (e) {
|
934
|
+
if (e !== isCallableMarker) { return false; }
|
935
|
+
}
|
936
|
+
return !isES6ClassFn(value) && tryFunctionObject(value);
|
937
|
+
}
|
938
|
+
: function isCallable(value) {
|
939
|
+
if (isDDA(value)) { return true; }
|
940
|
+
if (!value) { return false; }
|
941
|
+
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
942
|
+
if (hasToStringTag$1) { return tryFunctionObject(value); }
|
943
|
+
if (isES6ClassFn(value)) { return false; }
|
944
|
+
var strClass = toStr$1.call(value);
|
945
|
+
if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; }
|
946
|
+
return tryFunctionObject(value);
|
947
|
+
};
|
948
|
+
|
949
|
+
var isCallable = isCallable$1;
|
950
|
+
|
951
|
+
var toStr = Object.prototype.toString;
|
952
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
953
|
+
|
954
|
+
var forEachArray = function forEachArray(array, iterator, receiver) {
|
955
|
+
for (var i = 0, len = array.length; i < len; i++) {
|
956
|
+
if (hasOwnProperty.call(array, i)) {
|
957
|
+
if (receiver == null) {
|
958
|
+
iterator(array[i], i, array);
|
959
|
+
} else {
|
960
|
+
iterator.call(receiver, array[i], i, array);
|
961
|
+
}
|
962
|
+
}
|
963
|
+
}
|
964
|
+
};
|
965
|
+
|
966
|
+
var forEachString = function forEachString(string, iterator, receiver) {
|
967
|
+
for (var i = 0, len = string.length; i < len; i++) {
|
968
|
+
// no such thing as a sparse string.
|
969
|
+
if (receiver == null) {
|
970
|
+
iterator(string.charAt(i), i, string);
|
971
|
+
} else {
|
972
|
+
iterator.call(receiver, string.charAt(i), i, string);
|
973
|
+
}
|
974
|
+
}
|
975
|
+
};
|
976
|
+
|
977
|
+
var forEachObject = function forEachObject(object, iterator, receiver) {
|
978
|
+
for (var k in object) {
|
979
|
+
if (hasOwnProperty.call(object, k)) {
|
980
|
+
if (receiver == null) {
|
981
|
+
iterator(object[k], k, object);
|
982
|
+
} else {
|
983
|
+
iterator.call(receiver, object[k], k, object);
|
984
|
+
}
|
985
|
+
}
|
986
|
+
}
|
987
|
+
};
|
988
|
+
|
989
|
+
var forEach$1 = function forEach(list, iterator, thisArg) {
|
990
|
+
if (!isCallable(iterator)) {
|
991
|
+
throw new TypeError('iterator must be a function');
|
992
|
+
}
|
993
|
+
|
994
|
+
var receiver;
|
995
|
+
if (arguments.length >= 3) {
|
996
|
+
receiver = thisArg;
|
997
|
+
}
|
998
|
+
|
999
|
+
if (toStr.call(list) === '[object Array]') {
|
1000
|
+
forEachArray(list, iterator, receiver);
|
1001
|
+
} else if (typeof list === 'string') {
|
1002
|
+
forEachString(list, iterator, receiver);
|
1003
|
+
} else {
|
1004
|
+
forEachObject(list, iterator, receiver);
|
1005
|
+
}
|
1006
|
+
};
|
1007
|
+
|
1008
|
+
var forEach_1 = forEach$1;
|
1009
|
+
|
1010
|
+
/** @type {import('.')} */
|
1011
|
+
var possibleTypedArrayNames = [
|
1012
|
+
'Float32Array',
|
1013
|
+
'Float64Array',
|
1014
|
+
'Int8Array',
|
1015
|
+
'Int16Array',
|
1016
|
+
'Int32Array',
|
1017
|
+
'Uint8Array',
|
1018
|
+
'Uint8ClampedArray',
|
1019
|
+
'Uint16Array',
|
1020
|
+
'Uint32Array',
|
1021
|
+
'BigInt64Array',
|
1022
|
+
'BigUint64Array'
|
1023
|
+
];
|
1024
|
+
|
1025
|
+
var possibleNames = possibleTypedArrayNames;
|
1026
|
+
|
1027
|
+
var g$1 = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis;
|
1028
|
+
|
1029
|
+
/** @type {import('.')} */
|
1030
|
+
var availableTypedArrays$1 = function availableTypedArrays() {
|
1031
|
+
var /** @type {ReturnType<typeof availableTypedArrays>} */ out = [];
|
1032
|
+
for (var i = 0; i < possibleNames.length; i++) {
|
1033
|
+
if (typeof g$1[possibleNames[i]] === 'function') {
|
1034
|
+
// @ts-expect-error
|
1035
|
+
out[out.length] = possibleNames[i];
|
1036
|
+
}
|
1037
|
+
}
|
1038
|
+
return out;
|
1039
|
+
};
|
1040
|
+
|
1041
|
+
var forEach = forEach_1;
|
1042
|
+
var availableTypedArrays = availableTypedArrays$1;
|
1043
|
+
var callBind = callBindExports;
|
1044
|
+
var callBound = callBound$2;
|
1045
|
+
var gOPD = gopd$1;
|
1046
|
+
|
1047
|
+
/** @type {(O: object) => string} */
|
1048
|
+
var $toString = callBound('Object.prototype.toString');
|
1049
|
+
var hasToStringTag = shams();
|
1050
|
+
|
1051
|
+
var g = typeof globalThis === 'undefined' ? commonjsGlobal : globalThis;
|
1052
|
+
var typedArrays = availableTypedArrays();
|
1053
|
+
|
1054
|
+
var $slice = callBound('String.prototype.slice');
|
1055
|
+
var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
|
1056
|
+
|
1057
|
+
/** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
|
1058
|
+
var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
|
1059
|
+
for (var i = 0; i < array.length; i += 1) {
|
1060
|
+
if (array[i] === value) {
|
1061
|
+
return i;
|
1062
|
+
}
|
1063
|
+
}
|
1064
|
+
return -1;
|
1065
|
+
};
|
1066
|
+
|
1067
|
+
/** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */
|
1068
|
+
/** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */
|
1069
|
+
var cache = { __proto__: null };
|
1070
|
+
if (hasToStringTag && gOPD && getPrototypeOf) {
|
1071
|
+
forEach(typedArrays, function (typedArray) {
|
1072
|
+
var arr = new g[typedArray]();
|
1073
|
+
if (Symbol.toStringTag in arr) {
|
1074
|
+
var proto = getPrototypeOf(arr);
|
1075
|
+
// @ts-expect-error TS won't narrow inside a closure
|
1076
|
+
var descriptor = gOPD(proto, Symbol.toStringTag);
|
1077
|
+
if (!descriptor) {
|
1078
|
+
var superProto = getPrototypeOf(proto);
|
1079
|
+
// @ts-expect-error TS won't narrow inside a closure
|
1080
|
+
descriptor = gOPD(superProto, Symbol.toStringTag);
|
1081
|
+
}
|
1082
|
+
// @ts-expect-error TODO: fix
|
1083
|
+
cache['$' + typedArray] = callBind(descriptor.get);
|
1084
|
+
}
|
1085
|
+
});
|
1086
|
+
} else {
|
1087
|
+
forEach(typedArrays, function (typedArray) {
|
1088
|
+
var arr = new g[typedArray]();
|
1089
|
+
var fn = arr.slice || arr.set;
|
1090
|
+
if (fn) {
|
1091
|
+
// @ts-expect-error TODO: fix
|
1092
|
+
cache['$' + typedArray] = callBind(fn);
|
1093
|
+
}
|
1094
|
+
});
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
/** @type {(value: object) => false | import('.').TypedArrayName} */
|
1098
|
+
var tryTypedArrays = function tryAllTypedArrays(value) {
|
1099
|
+
/** @type {ReturnType<typeof tryAllTypedArrays>} */ var found = false;
|
1100
|
+
forEach(
|
1101
|
+
// eslint-disable-next-line no-extra-parens
|
1102
|
+
/** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache),
|
1103
|
+
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
|
1104
|
+
function (getter, typedArray) {
|
1105
|
+
if (!found) {
|
1106
|
+
try {
|
1107
|
+
// @ts-expect-error TODO: fix
|
1108
|
+
if ('$' + getter(value) === typedArray) {
|
1109
|
+
found = $slice(typedArray, 1);
|
1110
|
+
}
|
1111
|
+
} catch (e) { /**/ }
|
1112
|
+
}
|
1113
|
+
}
|
1114
|
+
);
|
1115
|
+
return found;
|
1116
|
+
};
|
1117
|
+
|
1118
|
+
/** @type {(value: object) => false | import('.').TypedArrayName} */
|
1119
|
+
var trySlices = function tryAllSlices(value) {
|
1120
|
+
/** @type {ReturnType<typeof tryAllSlices>} */ var found = false;
|
1121
|
+
forEach(
|
1122
|
+
// eslint-disable-next-line no-extra-parens
|
1123
|
+
/** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache),
|
1124
|
+
/** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
|
1125
|
+
if (!found) {
|
1126
|
+
try {
|
1127
|
+
// @ts-expect-error TODO: fix
|
1128
|
+
getter(value);
|
1129
|
+
found = $slice(name, 1);
|
1130
|
+
} catch (e) { /**/ }
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
);
|
1134
|
+
return found;
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
/** @type {import('.')} */
|
1138
|
+
var whichTypedArray$1 = function whichTypedArray(value) {
|
1139
|
+
if (!value || typeof value !== 'object') { return false; }
|
1140
|
+
if (!hasToStringTag) {
|
1141
|
+
/** @type {string} */
|
1142
|
+
var tag = $slice($toString(value), 8, -1);
|
1143
|
+
if ($indexOf(typedArrays, tag) > -1) {
|
1144
|
+
return tag;
|
1145
|
+
}
|
1146
|
+
if (tag !== 'Object') {
|
1147
|
+
return false;
|
1148
|
+
}
|
1149
|
+
// node < 0.6 hits here on real Typed Arrays
|
1150
|
+
return trySlices(value);
|
1151
|
+
}
|
1152
|
+
if (!gOPD) { return null; } // unknown engine
|
1153
|
+
return tryTypedArrays(value);
|
1154
|
+
};
|
1155
|
+
|
1156
|
+
var whichTypedArray = whichTypedArray$1;
|
1157
|
+
|
1158
|
+
/** @type {import('.')} */
|
1159
|
+
var isTypedArray = function isTypedArray(value) {
|
1160
|
+
return !!whichTypedArray(value);
|
1161
|
+
};
|
1162
|
+
|
1163
|
+
(function (exports) {
|
1164
|
+
|
1165
|
+
var isArgumentsObject = isArguments;
|
1166
|
+
var isGeneratorFunction$1 = isGeneratorFunction;
|
1167
|
+
var whichTypedArray = whichTypedArray$1;
|
1168
|
+
var isTypedArray$1 = isTypedArray;
|
1169
|
+
|
1170
|
+
function uncurryThis(f) {
|
1171
|
+
return f.call.bind(f);
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
var BigIntSupported = typeof BigInt !== 'undefined';
|
1175
|
+
var SymbolSupported = typeof Symbol !== 'undefined';
|
1176
|
+
|
1177
|
+
var ObjectToString = uncurryThis(Object.prototype.toString);
|
1178
|
+
|
1179
|
+
var numberValue = uncurryThis(Number.prototype.valueOf);
|
1180
|
+
var stringValue = uncurryThis(String.prototype.valueOf);
|
1181
|
+
var booleanValue = uncurryThis(Boolean.prototype.valueOf);
|
1182
|
+
|
1183
|
+
if (BigIntSupported) {
|
1184
|
+
var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
if (SymbolSupported) {
|
1188
|
+
var symbolValue = uncurryThis(Symbol.prototype.valueOf);
|
1189
|
+
}
|
1190
|
+
|
1191
|
+
function checkBoxedPrimitive(value, prototypeValueOf) {
|
1192
|
+
if (typeof value !== 'object') {
|
1193
|
+
return false;
|
1194
|
+
}
|
1195
|
+
try {
|
1196
|
+
prototypeValueOf(value);
|
1197
|
+
return true;
|
1198
|
+
} catch(e) {
|
1199
|
+
return false;
|
1200
|
+
}
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
exports.isArgumentsObject = isArgumentsObject;
|
1204
|
+
exports.isGeneratorFunction = isGeneratorFunction$1;
|
1205
|
+
exports.isTypedArray = isTypedArray$1;
|
1206
|
+
|
1207
|
+
// Taken from here and modified for better browser support
|
1208
|
+
// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
|
1209
|
+
function isPromise(input) {
|
1210
|
+
return (
|
1211
|
+
(
|
1212
|
+
typeof Promise !== 'undefined' &&
|
1213
|
+
input instanceof Promise
|
1214
|
+
) ||
|
1215
|
+
(
|
1216
|
+
input !== null &&
|
1217
|
+
typeof input === 'object' &&
|
1218
|
+
typeof input.then === 'function' &&
|
1219
|
+
typeof input.catch === 'function'
|
1220
|
+
)
|
1221
|
+
);
|
1222
|
+
}
|
1223
|
+
exports.isPromise = isPromise;
|
1224
|
+
|
1225
|
+
function isArrayBufferView(value) {
|
1226
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
1227
|
+
return ArrayBuffer.isView(value);
|
1228
|
+
}
|
1229
|
+
|
1230
|
+
return (
|
1231
|
+
isTypedArray$1(value) ||
|
1232
|
+
isDataView(value)
|
1233
|
+
);
|
1234
|
+
}
|
1235
|
+
exports.isArrayBufferView = isArrayBufferView;
|
1236
|
+
|
1237
|
+
|
1238
|
+
function isUint8Array(value) {
|
1239
|
+
return whichTypedArray(value) === 'Uint8Array';
|
1240
|
+
}
|
1241
|
+
exports.isUint8Array = isUint8Array;
|
1242
|
+
|
1243
|
+
function isUint8ClampedArray(value) {
|
1244
|
+
return whichTypedArray(value) === 'Uint8ClampedArray';
|
1245
|
+
}
|
1246
|
+
exports.isUint8ClampedArray = isUint8ClampedArray;
|
1247
|
+
|
1248
|
+
function isUint16Array(value) {
|
1249
|
+
return whichTypedArray(value) === 'Uint16Array';
|
1250
|
+
}
|
1251
|
+
exports.isUint16Array = isUint16Array;
|
1252
|
+
|
1253
|
+
function isUint32Array(value) {
|
1254
|
+
return whichTypedArray(value) === 'Uint32Array';
|
1255
|
+
}
|
1256
|
+
exports.isUint32Array = isUint32Array;
|
1257
|
+
|
1258
|
+
function isInt8Array(value) {
|
1259
|
+
return whichTypedArray(value) === 'Int8Array';
|
1260
|
+
}
|
1261
|
+
exports.isInt8Array = isInt8Array;
|
1262
|
+
|
1263
|
+
function isInt16Array(value) {
|
1264
|
+
return whichTypedArray(value) === 'Int16Array';
|
1265
|
+
}
|
1266
|
+
exports.isInt16Array = isInt16Array;
|
1267
|
+
|
1268
|
+
function isInt32Array(value) {
|
1269
|
+
return whichTypedArray(value) === 'Int32Array';
|
1270
|
+
}
|
1271
|
+
exports.isInt32Array = isInt32Array;
|
1272
|
+
|
1273
|
+
function isFloat32Array(value) {
|
1274
|
+
return whichTypedArray(value) === 'Float32Array';
|
1275
|
+
}
|
1276
|
+
exports.isFloat32Array = isFloat32Array;
|
1277
|
+
|
1278
|
+
function isFloat64Array(value) {
|
1279
|
+
return whichTypedArray(value) === 'Float64Array';
|
1280
|
+
}
|
1281
|
+
exports.isFloat64Array = isFloat64Array;
|
1282
|
+
|
1283
|
+
function isBigInt64Array(value) {
|
1284
|
+
return whichTypedArray(value) === 'BigInt64Array';
|
1285
|
+
}
|
1286
|
+
exports.isBigInt64Array = isBigInt64Array;
|
1287
|
+
|
1288
|
+
function isBigUint64Array(value) {
|
1289
|
+
return whichTypedArray(value) === 'BigUint64Array';
|
1290
|
+
}
|
1291
|
+
exports.isBigUint64Array = isBigUint64Array;
|
1292
|
+
|
1293
|
+
function isMapToString(value) {
|
1294
|
+
return ObjectToString(value) === '[object Map]';
|
1295
|
+
}
|
1296
|
+
isMapToString.working = (
|
1297
|
+
typeof Map !== 'undefined' &&
|
1298
|
+
isMapToString(new Map())
|
1299
|
+
);
|
1300
|
+
|
1301
|
+
function isMap(value) {
|
1302
|
+
if (typeof Map === 'undefined') {
|
1303
|
+
return false;
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
return isMapToString.working
|
1307
|
+
? isMapToString(value)
|
1308
|
+
: value instanceof Map;
|
1309
|
+
}
|
1310
|
+
exports.isMap = isMap;
|
1311
|
+
|
1312
|
+
function isSetToString(value) {
|
1313
|
+
return ObjectToString(value) === '[object Set]';
|
1314
|
+
}
|
1315
|
+
isSetToString.working = (
|
1316
|
+
typeof Set !== 'undefined' &&
|
1317
|
+
isSetToString(new Set())
|
1318
|
+
);
|
1319
|
+
function isSet(value) {
|
1320
|
+
if (typeof Set === 'undefined') {
|
1321
|
+
return false;
|
1322
|
+
}
|
1323
|
+
|
1324
|
+
return isSetToString.working
|
1325
|
+
? isSetToString(value)
|
1326
|
+
: value instanceof Set;
|
1327
|
+
}
|
1328
|
+
exports.isSet = isSet;
|
1329
|
+
|
1330
|
+
function isWeakMapToString(value) {
|
1331
|
+
return ObjectToString(value) === '[object WeakMap]';
|
1332
|
+
}
|
1333
|
+
isWeakMapToString.working = (
|
1334
|
+
typeof WeakMap !== 'undefined' &&
|
1335
|
+
isWeakMapToString(new WeakMap())
|
1336
|
+
);
|
1337
|
+
function isWeakMap(value) {
|
1338
|
+
if (typeof WeakMap === 'undefined') {
|
1339
|
+
return false;
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
return isWeakMapToString.working
|
1343
|
+
? isWeakMapToString(value)
|
1344
|
+
: value instanceof WeakMap;
|
1345
|
+
}
|
1346
|
+
exports.isWeakMap = isWeakMap;
|
1347
|
+
|
1348
|
+
function isWeakSetToString(value) {
|
1349
|
+
return ObjectToString(value) === '[object WeakSet]';
|
1350
|
+
}
|
1351
|
+
isWeakSetToString.working = (
|
1352
|
+
typeof WeakSet !== 'undefined' &&
|
1353
|
+
isWeakSetToString(new WeakSet())
|
1354
|
+
);
|
1355
|
+
function isWeakSet(value) {
|
1356
|
+
return isWeakSetToString(value);
|
1357
|
+
}
|
1358
|
+
exports.isWeakSet = isWeakSet;
|
1359
|
+
|
1360
|
+
function isArrayBufferToString(value) {
|
1361
|
+
return ObjectToString(value) === '[object ArrayBuffer]';
|
1362
|
+
}
|
1363
|
+
isArrayBufferToString.working = (
|
1364
|
+
typeof ArrayBuffer !== 'undefined' &&
|
1365
|
+
isArrayBufferToString(new ArrayBuffer())
|
1366
|
+
);
|
1367
|
+
function isArrayBuffer(value) {
|
1368
|
+
if (typeof ArrayBuffer === 'undefined') {
|
1369
|
+
return false;
|
1370
|
+
}
|
1371
|
+
|
1372
|
+
return isArrayBufferToString.working
|
1373
|
+
? isArrayBufferToString(value)
|
1374
|
+
: value instanceof ArrayBuffer;
|
1375
|
+
}
|
1376
|
+
exports.isArrayBuffer = isArrayBuffer;
|
1377
|
+
|
1378
|
+
function isDataViewToString(value) {
|
1379
|
+
return ObjectToString(value) === '[object DataView]';
|
1380
|
+
}
|
1381
|
+
isDataViewToString.working = (
|
1382
|
+
typeof ArrayBuffer !== 'undefined' &&
|
1383
|
+
typeof DataView !== 'undefined' &&
|
1384
|
+
isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
|
1385
|
+
);
|
1386
|
+
function isDataView(value) {
|
1387
|
+
if (typeof DataView === 'undefined') {
|
1388
|
+
return false;
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
return isDataViewToString.working
|
1392
|
+
? isDataViewToString(value)
|
1393
|
+
: value instanceof DataView;
|
1394
|
+
}
|
1395
|
+
exports.isDataView = isDataView;
|
1396
|
+
|
1397
|
+
// Store a copy of SharedArrayBuffer in case it's deleted elsewhere
|
1398
|
+
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
|
1399
|
+
function isSharedArrayBufferToString(value) {
|
1400
|
+
return ObjectToString(value) === '[object SharedArrayBuffer]';
|
1401
|
+
}
|
1402
|
+
function isSharedArrayBuffer(value) {
|
1403
|
+
if (typeof SharedArrayBufferCopy === 'undefined') {
|
1404
|
+
return false;
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
if (typeof isSharedArrayBufferToString.working === 'undefined') {
|
1408
|
+
isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
return isSharedArrayBufferToString.working
|
1412
|
+
? isSharedArrayBufferToString(value)
|
1413
|
+
: value instanceof SharedArrayBufferCopy;
|
1414
|
+
}
|
1415
|
+
exports.isSharedArrayBuffer = isSharedArrayBuffer;
|
1416
|
+
|
1417
|
+
function isAsyncFunction(value) {
|
1418
|
+
return ObjectToString(value) === '[object AsyncFunction]';
|
1419
|
+
}
|
1420
|
+
exports.isAsyncFunction = isAsyncFunction;
|
1421
|
+
|
1422
|
+
function isMapIterator(value) {
|
1423
|
+
return ObjectToString(value) === '[object Map Iterator]';
|
1424
|
+
}
|
1425
|
+
exports.isMapIterator = isMapIterator;
|
1426
|
+
|
1427
|
+
function isSetIterator(value) {
|
1428
|
+
return ObjectToString(value) === '[object Set Iterator]';
|
1429
|
+
}
|
1430
|
+
exports.isSetIterator = isSetIterator;
|
1431
|
+
|
1432
|
+
function isGeneratorObject(value) {
|
1433
|
+
return ObjectToString(value) === '[object Generator]';
|
1434
|
+
}
|
1435
|
+
exports.isGeneratorObject = isGeneratorObject;
|
1436
|
+
|
1437
|
+
function isWebAssemblyCompiledModule(value) {
|
1438
|
+
return ObjectToString(value) === '[object WebAssembly.Module]';
|
1439
|
+
}
|
1440
|
+
exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
|
1441
|
+
|
1442
|
+
function isNumberObject(value) {
|
1443
|
+
return checkBoxedPrimitive(value, numberValue);
|
1444
|
+
}
|
1445
|
+
exports.isNumberObject = isNumberObject;
|
1446
|
+
|
1447
|
+
function isStringObject(value) {
|
1448
|
+
return checkBoxedPrimitive(value, stringValue);
|
1449
|
+
}
|
1450
|
+
exports.isStringObject = isStringObject;
|
1451
|
+
|
1452
|
+
function isBooleanObject(value) {
|
1453
|
+
return checkBoxedPrimitive(value, booleanValue);
|
1454
|
+
}
|
1455
|
+
exports.isBooleanObject = isBooleanObject;
|
1456
|
+
|
1457
|
+
function isBigIntObject(value) {
|
1458
|
+
return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
|
1459
|
+
}
|
1460
|
+
exports.isBigIntObject = isBigIntObject;
|
1461
|
+
|
1462
|
+
function isSymbolObject(value) {
|
1463
|
+
return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
|
1464
|
+
}
|
1465
|
+
exports.isSymbolObject = isSymbolObject;
|
1466
|
+
|
1467
|
+
function isBoxedPrimitive(value) {
|
1468
|
+
return (
|
1469
|
+
isNumberObject(value) ||
|
1470
|
+
isStringObject(value) ||
|
1471
|
+
isBooleanObject(value) ||
|
1472
|
+
isBigIntObject(value) ||
|
1473
|
+
isSymbolObject(value)
|
1474
|
+
);
|
1475
|
+
}
|
1476
|
+
exports.isBoxedPrimitive = isBoxedPrimitive;
|
1477
|
+
|
1478
|
+
function isAnyArrayBuffer(value) {
|
1479
|
+
return typeof Uint8Array !== 'undefined' && (
|
1480
|
+
isArrayBuffer(value) ||
|
1481
|
+
isSharedArrayBuffer(value)
|
1482
|
+
);
|
1483
|
+
}
|
1484
|
+
exports.isAnyArrayBuffer = isAnyArrayBuffer;
|
1485
|
+
|
1486
|
+
['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
|
1487
|
+
Object.defineProperty(exports, method, {
|
1488
|
+
enumerable: false,
|
1489
|
+
value: function() {
|
1490
|
+
throw new Error(method + ' is not supported in userland');
|
1491
|
+
}
|
1492
|
+
});
|
1493
|
+
});
|
1494
|
+
} (types));
|
1495
|
+
|
1496
|
+
var isBufferBrowser = function isBuffer(arg) {
|
1497
|
+
return arg && typeof arg === 'object'
|
1498
|
+
&& typeof arg.copy === 'function'
|
1499
|
+
&& typeof arg.fill === 'function'
|
1500
|
+
&& typeof arg.readUInt8 === 'function';
|
1501
|
+
};
|
1502
|
+
|
1503
|
+
var inherits_browser = {exports: {}};
|
1504
|
+
|
1505
|
+
if (typeof Object.create === 'function') {
|
1506
|
+
// implementation from standard node.js 'util' module
|
1507
|
+
inherits_browser.exports = function inherits(ctor, superCtor) {
|
1508
|
+
if (superCtor) {
|
1509
|
+
ctor.super_ = superCtor;
|
1510
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
1511
|
+
constructor: {
|
1512
|
+
value: ctor,
|
1513
|
+
enumerable: false,
|
1514
|
+
writable: true,
|
1515
|
+
configurable: true
|
1516
|
+
}
|
1517
|
+
});
|
1518
|
+
}
|
1519
|
+
};
|
1520
|
+
} else {
|
1521
|
+
// old school shim for old browsers
|
1522
|
+
inherits_browser.exports = function inherits(ctor, superCtor) {
|
1523
|
+
if (superCtor) {
|
1524
|
+
ctor.super_ = superCtor;
|
1525
|
+
var TempCtor = function () {};
|
1526
|
+
TempCtor.prototype = superCtor.prototype;
|
1527
|
+
ctor.prototype = new TempCtor();
|
1528
|
+
ctor.prototype.constructor = ctor;
|
1529
|
+
}
|
1530
|
+
};
|
1531
|
+
}
|
1532
|
+
|
1533
|
+
var inherits_browserExports = inherits_browser.exports;
|
1534
|
+
|
1535
|
+
(function (exports) {
|
1536
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
1537
|
+
//
|
1538
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
1539
|
+
// copy of this software and associated documentation files (the
|
1540
|
+
// "Software"), to deal in the Software without restriction, including
|
1541
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
1542
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
1543
|
+
// persons to whom the Software is furnished to do so, subject to the
|
1544
|
+
// following conditions:
|
1545
|
+
//
|
1546
|
+
// The above copyright notice and this permission notice shall be included
|
1547
|
+
// in all copies or substantial portions of the Software.
|
1548
|
+
//
|
1549
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
1550
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
1551
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
1552
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
1553
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
1554
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
1555
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1556
|
+
|
1557
|
+
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
|
1558
|
+
function getOwnPropertyDescriptors(obj) {
|
1559
|
+
var keys = Object.keys(obj);
|
1560
|
+
var descriptors = {};
|
1561
|
+
for (var i = 0; i < keys.length; i++) {
|
1562
|
+
descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
|
1563
|
+
}
|
1564
|
+
return descriptors;
|
1565
|
+
};
|
1566
|
+
|
1567
|
+
var formatRegExp = /%[sdj%]/g;
|
1568
|
+
exports.format = function(f) {
|
1569
|
+
if (!isString(f)) {
|
1570
|
+
var objects = [];
|
1571
|
+
for (var i = 0; i < arguments.length; i++) {
|
1572
|
+
objects.push(inspect(arguments[i]));
|
1573
|
+
}
|
1574
|
+
return objects.join(' ');
|
1575
|
+
}
|
1576
|
+
|
1577
|
+
var i = 1;
|
1578
|
+
var args = arguments;
|
1579
|
+
var len = args.length;
|
1580
|
+
var str = String(f).replace(formatRegExp, function(x) {
|
1581
|
+
if (x === '%%') return '%';
|
1582
|
+
if (i >= len) return x;
|
1583
|
+
switch (x) {
|
1584
|
+
case '%s': return String(args[i++]);
|
1585
|
+
case '%d': return Number(args[i++]);
|
1586
|
+
case '%j':
|
1587
|
+
try {
|
1588
|
+
return JSON.stringify(args[i++]);
|
1589
|
+
} catch (_) {
|
1590
|
+
return '[Circular]';
|
1591
|
+
}
|
1592
|
+
default:
|
1593
|
+
return x;
|
1594
|
+
}
|
1595
|
+
});
|
1596
|
+
for (var x = args[i]; i < len; x = args[++i]) {
|
1597
|
+
if (isNull(x) || !isObject(x)) {
|
1598
|
+
str += ' ' + x;
|
1599
|
+
} else {
|
1600
|
+
str += ' ' + inspect(x);
|
1601
|
+
}
|
1602
|
+
}
|
1603
|
+
return str;
|
1604
|
+
};
|
1605
|
+
|
1606
|
+
|
1607
|
+
// Mark that a method should not be used.
|
1608
|
+
// Returns a modified function which warns once by default.
|
1609
|
+
// If --no-deprecation is set, then it is a no-op.
|
1610
|
+
exports.deprecate = function(fn, msg) {
|
1611
|
+
if (typeof process !== 'undefined' && process.noDeprecation === true) {
|
1612
|
+
return fn;
|
1613
|
+
}
|
1614
|
+
|
1615
|
+
// Allow for deprecating things in the process of starting up.
|
1616
|
+
if (typeof process === 'undefined') {
|
1617
|
+
return function() {
|
1618
|
+
return exports.deprecate(fn, msg).apply(this, arguments);
|
1619
|
+
};
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
var warned = false;
|
1623
|
+
function deprecated() {
|
1624
|
+
if (!warned) {
|
1625
|
+
if (process.throwDeprecation) {
|
1626
|
+
throw new Error(msg);
|
1627
|
+
} else if (process.traceDeprecation) {
|
1628
|
+
console.trace(msg);
|
1629
|
+
} else {
|
1630
|
+
console.error(msg);
|
1631
|
+
}
|
1632
|
+
warned = true;
|
1633
|
+
}
|
1634
|
+
return fn.apply(this, arguments);
|
1635
|
+
}
|
1636
|
+
|
1637
|
+
return deprecated;
|
1638
|
+
};
|
1639
|
+
|
1640
|
+
|
1641
|
+
var debugs = {};
|
1642
|
+
var debugEnvRegex = /^$/;
|
1643
|
+
|
1644
|
+
if (process.env.NODE_DEBUG) {
|
1645
|
+
var debugEnv = process.env.NODE_DEBUG;
|
1646
|
+
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
|
1647
|
+
.replace(/\*/g, '.*')
|
1648
|
+
.replace(/,/g, '$|^')
|
1649
|
+
.toUpperCase();
|
1650
|
+
debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
|
1651
|
+
}
|
1652
|
+
exports.debuglog = function(set) {
|
1653
|
+
set = set.toUpperCase();
|
1654
|
+
if (!debugs[set]) {
|
1655
|
+
if (debugEnvRegex.test(set)) {
|
1656
|
+
var pid = process.pid;
|
1657
|
+
debugs[set] = function() {
|
1658
|
+
var msg = exports.format.apply(exports, arguments);
|
1659
|
+
console.error('%s %d: %s', set, pid, msg);
|
1660
|
+
};
|
1661
|
+
} else {
|
1662
|
+
debugs[set] = function() {};
|
1663
|
+
}
|
1664
|
+
}
|
1665
|
+
return debugs[set];
|
1666
|
+
};
|
1667
|
+
|
1668
|
+
|
1669
|
+
/**
|
1670
|
+
* Echos the value of a value. Trys to print the value out
|
1671
|
+
* in the best way possible given the different types.
|
1672
|
+
*
|
1673
|
+
* @param {Object} obj The object to print out.
|
1674
|
+
* @param {Object} opts Optional options object that alters the output.
|
1675
|
+
*/
|
1676
|
+
/* legacy: obj, showHidden, depth, colors*/
|
1677
|
+
function inspect(obj, opts) {
|
1678
|
+
// default options
|
1679
|
+
var ctx = {
|
1680
|
+
seen: [],
|
1681
|
+
stylize: stylizeNoColor
|
1682
|
+
};
|
1683
|
+
// legacy...
|
1684
|
+
if (arguments.length >= 3) ctx.depth = arguments[2];
|
1685
|
+
if (arguments.length >= 4) ctx.colors = arguments[3];
|
1686
|
+
if (isBoolean(opts)) {
|
1687
|
+
// legacy...
|
1688
|
+
ctx.showHidden = opts;
|
1689
|
+
} else if (opts) {
|
1690
|
+
// got an "options" object
|
1691
|
+
exports._extend(ctx, opts);
|
1692
|
+
}
|
1693
|
+
// set default options
|
1694
|
+
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
1695
|
+
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
1696
|
+
if (isUndefined(ctx.colors)) ctx.colors = false;
|
1697
|
+
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
1698
|
+
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
1699
|
+
return formatValue(ctx, obj, ctx.depth);
|
1700
|
+
}
|
1701
|
+
exports.inspect = inspect;
|
1702
|
+
|
1703
|
+
|
1704
|
+
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
1705
|
+
inspect.colors = {
|
1706
|
+
'bold' : [1, 22],
|
1707
|
+
'italic' : [3, 23],
|
1708
|
+
'underline' : [4, 24],
|
1709
|
+
'inverse' : [7, 27],
|
1710
|
+
'white' : [37, 39],
|
1711
|
+
'grey' : [90, 39],
|
1712
|
+
'black' : [30, 39],
|
1713
|
+
'blue' : [34, 39],
|
1714
|
+
'cyan' : [36, 39],
|
1715
|
+
'green' : [32, 39],
|
1716
|
+
'magenta' : [35, 39],
|
1717
|
+
'red' : [31, 39],
|
1718
|
+
'yellow' : [33, 39]
|
1719
|
+
};
|
1720
|
+
|
1721
|
+
// Don't use 'blue' not visible on cmd.exe
|
1722
|
+
inspect.styles = {
|
1723
|
+
'special': 'cyan',
|
1724
|
+
'number': 'yellow',
|
1725
|
+
'boolean': 'yellow',
|
1726
|
+
'undefined': 'grey',
|
1727
|
+
'null': 'bold',
|
1728
|
+
'string': 'green',
|
1729
|
+
'date': 'magenta',
|
1730
|
+
// "name": intentionally not styling
|
1731
|
+
'regexp': 'red'
|
1732
|
+
};
|
1733
|
+
|
1734
|
+
|
1735
|
+
function stylizeWithColor(str, styleType) {
|
1736
|
+
var style = inspect.styles[styleType];
|
1737
|
+
|
1738
|
+
if (style) {
|
1739
|
+
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
1740
|
+
'\u001b[' + inspect.colors[style][1] + 'm';
|
1741
|
+
} else {
|
1742
|
+
return str;
|
1743
|
+
}
|
1744
|
+
}
|
1745
|
+
|
1746
|
+
|
1747
|
+
function stylizeNoColor(str, styleType) {
|
1748
|
+
return str;
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
|
1752
|
+
function arrayToHash(array) {
|
1753
|
+
var hash = {};
|
1754
|
+
|
1755
|
+
array.forEach(function(val, idx) {
|
1756
|
+
hash[val] = true;
|
1757
|
+
});
|
1758
|
+
|
1759
|
+
return hash;
|
1760
|
+
}
|
1761
|
+
|
1762
|
+
|
1763
|
+
function formatValue(ctx, value, recurseTimes) {
|
1764
|
+
// Provide a hook for user-specified inspect functions.
|
1765
|
+
// Check that value is an object with an inspect function on it
|
1766
|
+
if (ctx.customInspect &&
|
1767
|
+
value &&
|
1768
|
+
isFunction(value.inspect) &&
|
1769
|
+
// Filter out the util module, it's inspect function is special
|
1770
|
+
value.inspect !== exports.inspect &&
|
1771
|
+
// Also filter out any prototype objects using the circular check.
|
1772
|
+
!(value.constructor && value.constructor.prototype === value)) {
|
1773
|
+
var ret = value.inspect(recurseTimes, ctx);
|
1774
|
+
if (!isString(ret)) {
|
1775
|
+
ret = formatValue(ctx, ret, recurseTimes);
|
1776
|
+
}
|
1777
|
+
return ret;
|
1778
|
+
}
|
1779
|
+
|
1780
|
+
// Primitive types cannot have properties
|
1781
|
+
var primitive = formatPrimitive(ctx, value);
|
1782
|
+
if (primitive) {
|
1783
|
+
return primitive;
|
1784
|
+
}
|
1785
|
+
|
1786
|
+
// Look up the keys of the object.
|
1787
|
+
var keys = Object.keys(value);
|
1788
|
+
var visibleKeys = arrayToHash(keys);
|
1789
|
+
|
1790
|
+
if (ctx.showHidden) {
|
1791
|
+
keys = Object.getOwnPropertyNames(value);
|
1792
|
+
}
|
1793
|
+
|
1794
|
+
// IE doesn't make error fields non-enumerable
|
1795
|
+
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
1796
|
+
if (isError(value)
|
1797
|
+
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
1798
|
+
return formatError(value);
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
// Some type of object without properties can be shortcutted.
|
1802
|
+
if (keys.length === 0) {
|
1803
|
+
if (isFunction(value)) {
|
1804
|
+
var name = value.name ? ': ' + value.name : '';
|
1805
|
+
return ctx.stylize('[Function' + name + ']', 'special');
|
1806
|
+
}
|
1807
|
+
if (isRegExp(value)) {
|
1808
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
1809
|
+
}
|
1810
|
+
if (isDate(value)) {
|
1811
|
+
return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
1812
|
+
}
|
1813
|
+
if (isError(value)) {
|
1814
|
+
return formatError(value);
|
1815
|
+
}
|
1816
|
+
}
|
1817
|
+
|
1818
|
+
var base = '', array = false, braces = ['{', '}'];
|
1819
|
+
|
1820
|
+
// Make Array say that they are Array
|
1821
|
+
if (isArray(value)) {
|
1822
|
+
array = true;
|
1823
|
+
braces = ['[', ']'];
|
1824
|
+
}
|
1825
|
+
|
1826
|
+
// Make functions say that they are functions
|
1827
|
+
if (isFunction(value)) {
|
1828
|
+
var n = value.name ? ': ' + value.name : '';
|
1829
|
+
base = ' [Function' + n + ']';
|
1830
|
+
}
|
1831
|
+
|
1832
|
+
// Make RegExps say that they are RegExps
|
1833
|
+
if (isRegExp(value)) {
|
1834
|
+
base = ' ' + RegExp.prototype.toString.call(value);
|
1835
|
+
}
|
1836
|
+
|
1837
|
+
// Make dates with properties first say the date
|
1838
|
+
if (isDate(value)) {
|
1839
|
+
base = ' ' + Date.prototype.toUTCString.call(value);
|
1840
|
+
}
|
1841
|
+
|
1842
|
+
// Make error with message first say the error
|
1843
|
+
if (isError(value)) {
|
1844
|
+
base = ' ' + formatError(value);
|
1845
|
+
}
|
1846
|
+
|
1847
|
+
if (keys.length === 0 && (!array || value.length == 0)) {
|
1848
|
+
return braces[0] + base + braces[1];
|
1849
|
+
}
|
1850
|
+
|
1851
|
+
if (recurseTimes < 0) {
|
1852
|
+
if (isRegExp(value)) {
|
1853
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
1854
|
+
} else {
|
1855
|
+
return ctx.stylize('[Object]', 'special');
|
1856
|
+
}
|
1857
|
+
}
|
1858
|
+
|
1859
|
+
ctx.seen.push(value);
|
1860
|
+
|
1861
|
+
var output;
|
1862
|
+
if (array) {
|
1863
|
+
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
1864
|
+
} else {
|
1865
|
+
output = keys.map(function(key) {
|
1866
|
+
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
1867
|
+
});
|
1868
|
+
}
|
1869
|
+
|
1870
|
+
ctx.seen.pop();
|
1871
|
+
|
1872
|
+
return reduceToSingleString(output, base, braces);
|
1873
|
+
}
|
1874
|
+
|
1875
|
+
|
1876
|
+
function formatPrimitive(ctx, value) {
|
1877
|
+
if (isUndefined(value))
|
1878
|
+
return ctx.stylize('undefined', 'undefined');
|
1879
|
+
if (isString(value)) {
|
1880
|
+
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
1881
|
+
.replace(/'/g, "\\'")
|
1882
|
+
.replace(/\\"/g, '"') + '\'';
|
1883
|
+
return ctx.stylize(simple, 'string');
|
1884
|
+
}
|
1885
|
+
if (isNumber(value))
|
1886
|
+
return ctx.stylize('' + value, 'number');
|
1887
|
+
if (isBoolean(value))
|
1888
|
+
return ctx.stylize('' + value, 'boolean');
|
1889
|
+
// For some reason typeof null is "object", so special case here.
|
1890
|
+
if (isNull(value))
|
1891
|
+
return ctx.stylize('null', 'null');
|
1892
|
+
}
|
1893
|
+
|
1894
|
+
|
1895
|
+
function formatError(value) {
|
1896
|
+
return '[' + Error.prototype.toString.call(value) + ']';
|
1897
|
+
}
|
1898
|
+
|
1899
|
+
|
1900
|
+
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
1901
|
+
var output = [];
|
1902
|
+
for (var i = 0, l = value.length; i < l; ++i) {
|
1903
|
+
if (hasOwnProperty(value, String(i))) {
|
1904
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
1905
|
+
String(i), true));
|
1906
|
+
} else {
|
1907
|
+
output.push('');
|
1908
|
+
}
|
1909
|
+
}
|
1910
|
+
keys.forEach(function(key) {
|
1911
|
+
if (!key.match(/^\d+$/)) {
|
1912
|
+
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
1913
|
+
key, true));
|
1914
|
+
}
|
1915
|
+
});
|
1916
|
+
return output;
|
1917
|
+
}
|
1918
|
+
|
1919
|
+
|
1920
|
+
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
1921
|
+
var name, str, desc;
|
1922
|
+
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
1923
|
+
if (desc.get) {
|
1924
|
+
if (desc.set) {
|
1925
|
+
str = ctx.stylize('[Getter/Setter]', 'special');
|
1926
|
+
} else {
|
1927
|
+
str = ctx.stylize('[Getter]', 'special');
|
1928
|
+
}
|
1929
|
+
} else {
|
1930
|
+
if (desc.set) {
|
1931
|
+
str = ctx.stylize('[Setter]', 'special');
|
1932
|
+
}
|
1933
|
+
}
|
1934
|
+
if (!hasOwnProperty(visibleKeys, key)) {
|
1935
|
+
name = '[' + key + ']';
|
1936
|
+
}
|
1937
|
+
if (!str) {
|
1938
|
+
if (ctx.seen.indexOf(desc.value) < 0) {
|
1939
|
+
if (isNull(recurseTimes)) {
|
1940
|
+
str = formatValue(ctx, desc.value, null);
|
1941
|
+
} else {
|
1942
|
+
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
1943
|
+
}
|
1944
|
+
if (str.indexOf('\n') > -1) {
|
1945
|
+
if (array) {
|
1946
|
+
str = str.split('\n').map(function(line) {
|
1947
|
+
return ' ' + line;
|
1948
|
+
}).join('\n').slice(2);
|
1949
|
+
} else {
|
1950
|
+
str = '\n' + str.split('\n').map(function(line) {
|
1951
|
+
return ' ' + line;
|
1952
|
+
}).join('\n');
|
1953
|
+
}
|
1954
|
+
}
|
1955
|
+
} else {
|
1956
|
+
str = ctx.stylize('[Circular]', 'special');
|
1957
|
+
}
|
1958
|
+
}
|
1959
|
+
if (isUndefined(name)) {
|
1960
|
+
if (array && key.match(/^\d+$/)) {
|
1961
|
+
return str;
|
1962
|
+
}
|
1963
|
+
name = JSON.stringify('' + key);
|
1964
|
+
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
1965
|
+
name = name.slice(1, -1);
|
1966
|
+
name = ctx.stylize(name, 'name');
|
1967
|
+
} else {
|
1968
|
+
name = name.replace(/'/g, "\\'")
|
1969
|
+
.replace(/\\"/g, '"')
|
1970
|
+
.replace(/(^"|"$)/g, "'");
|
1971
|
+
name = ctx.stylize(name, 'string');
|
1972
|
+
}
|
1973
|
+
}
|
1974
|
+
|
1975
|
+
return name + ': ' + str;
|
1976
|
+
}
|
1977
|
+
|
1978
|
+
|
1979
|
+
function reduceToSingleString(output, base, braces) {
|
1980
|
+
var length = output.reduce(function(prev, cur) {
|
1981
|
+
if (cur.indexOf('\n') >= 0) ;
|
1982
|
+
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
1983
|
+
}, 0);
|
1984
|
+
|
1985
|
+
if (length > 60) {
|
1986
|
+
return braces[0] +
|
1987
|
+
(base === '' ? '' : base + '\n ') +
|
1988
|
+
' ' +
|
1989
|
+
output.join(',\n ') +
|
1990
|
+
' ' +
|
1991
|
+
braces[1];
|
1992
|
+
}
|
1993
|
+
|
1994
|
+
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
1995
|
+
}
|
1996
|
+
|
1997
|
+
|
1998
|
+
// NOTE: These type checking functions intentionally don't use `instanceof`
|
1999
|
+
// because it is fragile and can be easily faked with `Object.create()`.
|
2000
|
+
exports.types = types;
|
2001
|
+
|
2002
|
+
function isArray(ar) {
|
2003
|
+
return Array.isArray(ar);
|
2004
|
+
}
|
2005
|
+
exports.isArray = isArray;
|
2006
|
+
|
2007
|
+
function isBoolean(arg) {
|
2008
|
+
return typeof arg === 'boolean';
|
2009
|
+
}
|
2010
|
+
exports.isBoolean = isBoolean;
|
2011
|
+
|
2012
|
+
function isNull(arg) {
|
2013
|
+
return arg === null;
|
2014
|
+
}
|
2015
|
+
exports.isNull = isNull;
|
2016
|
+
|
2017
|
+
function isNullOrUndefined(arg) {
|
2018
|
+
return arg == null;
|
2019
|
+
}
|
2020
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
2021
|
+
|
2022
|
+
function isNumber(arg) {
|
2023
|
+
return typeof arg === 'number';
|
2024
|
+
}
|
2025
|
+
exports.isNumber = isNumber;
|
2026
|
+
|
2027
|
+
function isString(arg) {
|
2028
|
+
return typeof arg === 'string';
|
2029
|
+
}
|
2030
|
+
exports.isString = isString;
|
2031
|
+
|
2032
|
+
function isSymbol(arg) {
|
2033
|
+
return typeof arg === 'symbol';
|
2034
|
+
}
|
2035
|
+
exports.isSymbol = isSymbol;
|
2036
|
+
|
2037
|
+
function isUndefined(arg) {
|
2038
|
+
return arg === void 0;
|
2039
|
+
}
|
2040
|
+
exports.isUndefined = isUndefined;
|
2041
|
+
|
2042
|
+
function isRegExp(re) {
|
2043
|
+
return isObject(re) && objectToString(re) === '[object RegExp]';
|
2044
|
+
}
|
2045
|
+
exports.isRegExp = isRegExp;
|
2046
|
+
exports.types.isRegExp = isRegExp;
|
2047
|
+
|
2048
|
+
function isObject(arg) {
|
2049
|
+
return typeof arg === 'object' && arg !== null;
|
2050
|
+
}
|
2051
|
+
exports.isObject = isObject;
|
2052
|
+
|
2053
|
+
function isDate(d) {
|
2054
|
+
return isObject(d) && objectToString(d) === '[object Date]';
|
2055
|
+
}
|
2056
|
+
exports.isDate = isDate;
|
2057
|
+
exports.types.isDate = isDate;
|
2058
|
+
|
2059
|
+
function isError(e) {
|
2060
|
+
return isObject(e) &&
|
2061
|
+
(objectToString(e) === '[object Error]' || e instanceof Error);
|
2062
|
+
}
|
2063
|
+
exports.isError = isError;
|
2064
|
+
exports.types.isNativeError = isError;
|
2065
|
+
|
2066
|
+
function isFunction(arg) {
|
2067
|
+
return typeof arg === 'function';
|
2068
|
+
}
|
2069
|
+
exports.isFunction = isFunction;
|
2070
|
+
|
2071
|
+
function isPrimitive(arg) {
|
2072
|
+
return arg === null ||
|
2073
|
+
typeof arg === 'boolean' ||
|
2074
|
+
typeof arg === 'number' ||
|
2075
|
+
typeof arg === 'string' ||
|
2076
|
+
typeof arg === 'symbol' || // ES6 symbol
|
2077
|
+
typeof arg === 'undefined';
|
2078
|
+
}
|
2079
|
+
exports.isPrimitive = isPrimitive;
|
2080
|
+
|
2081
|
+
exports.isBuffer = isBufferBrowser;
|
2082
|
+
|
2083
|
+
function objectToString(o) {
|
2084
|
+
return Object.prototype.toString.call(o);
|
2085
|
+
}
|
2086
|
+
|
2087
|
+
|
2088
|
+
function pad(n) {
|
2089
|
+
return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
2090
|
+
}
|
2091
|
+
|
2092
|
+
|
2093
|
+
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
2094
|
+
'Oct', 'Nov', 'Dec'];
|
2095
|
+
|
2096
|
+
// 26 Feb 16:19:34
|
2097
|
+
function timestamp() {
|
2098
|
+
var d = new Date();
|
2099
|
+
var time = [pad(d.getHours()),
|
2100
|
+
pad(d.getMinutes()),
|
2101
|
+
pad(d.getSeconds())].join(':');
|
2102
|
+
return [d.getDate(), months[d.getMonth()], time].join(' ');
|
2103
|
+
}
|
2104
|
+
|
2105
|
+
|
2106
|
+
// log is just a thin wrapper to console.log that prepends a timestamp
|
2107
|
+
exports.log = function() {
|
2108
|
+
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
2109
|
+
};
|
2110
|
+
|
2111
|
+
|
2112
|
+
/**
|
2113
|
+
* Inherit the prototype methods from one constructor into another.
|
2114
|
+
*
|
2115
|
+
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
2116
|
+
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
2117
|
+
* during bootstrapping this function needs to be rewritten using some native
|
2118
|
+
* functions as prototype setup using normal JavaScript does not work as
|
2119
|
+
* expected during bootstrapping (see mirror.js in r114903).
|
2120
|
+
*
|
2121
|
+
* @param {function} ctor Constructor function which needs to inherit the
|
2122
|
+
* prototype.
|
2123
|
+
* @param {function} superCtor Constructor function to inherit prototype from.
|
2124
|
+
*/
|
2125
|
+
exports.inherits = inherits_browserExports;
|
2126
|
+
|
2127
|
+
exports._extend = function(origin, add) {
|
2128
|
+
// Don't do anything if add isn't an object
|
2129
|
+
if (!add || !isObject(add)) return origin;
|
2130
|
+
|
2131
|
+
var keys = Object.keys(add);
|
2132
|
+
var i = keys.length;
|
2133
|
+
while (i--) {
|
2134
|
+
origin[keys[i]] = add[keys[i]];
|
2135
|
+
}
|
2136
|
+
return origin;
|
2137
|
+
};
|
2138
|
+
|
2139
|
+
function hasOwnProperty(obj, prop) {
|
2140
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
|
2144
|
+
|
2145
|
+
exports.promisify = function promisify(original) {
|
2146
|
+
if (typeof original !== 'function')
|
2147
|
+
throw new TypeError('The "original" argument must be of type Function');
|
2148
|
+
|
2149
|
+
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
|
2150
|
+
var fn = original[kCustomPromisifiedSymbol];
|
2151
|
+
if (typeof fn !== 'function') {
|
2152
|
+
throw new TypeError('The "util.promisify.custom" argument must be of type Function');
|
2153
|
+
}
|
2154
|
+
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
2155
|
+
value: fn, enumerable: false, writable: false, configurable: true
|
2156
|
+
});
|
2157
|
+
return fn;
|
2158
|
+
}
|
2159
|
+
|
2160
|
+
function fn() {
|
2161
|
+
var promiseResolve, promiseReject;
|
2162
|
+
var promise = new Promise(function (resolve, reject) {
|
2163
|
+
promiseResolve = resolve;
|
2164
|
+
promiseReject = reject;
|
2165
|
+
});
|
2166
|
+
|
2167
|
+
var args = [];
|
2168
|
+
for (var i = 0; i < arguments.length; i++) {
|
2169
|
+
args.push(arguments[i]);
|
2170
|
+
}
|
2171
|
+
args.push(function (err, value) {
|
2172
|
+
if (err) {
|
2173
|
+
promiseReject(err);
|
2174
|
+
} else {
|
2175
|
+
promiseResolve(value);
|
2176
|
+
}
|
2177
|
+
});
|
2178
|
+
|
2179
|
+
try {
|
2180
|
+
original.apply(this, args);
|
2181
|
+
} catch (err) {
|
2182
|
+
promiseReject(err);
|
2183
|
+
}
|
2184
|
+
|
2185
|
+
return promise;
|
2186
|
+
}
|
2187
|
+
|
2188
|
+
Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
|
2189
|
+
|
2190
|
+
if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
|
2191
|
+
value: fn, enumerable: false, writable: false, configurable: true
|
2192
|
+
});
|
2193
|
+
return Object.defineProperties(
|
2194
|
+
fn,
|
2195
|
+
getOwnPropertyDescriptors(original)
|
2196
|
+
);
|
2197
|
+
};
|
2198
|
+
|
2199
|
+
exports.promisify.custom = kCustomPromisifiedSymbol;
|
2200
|
+
|
2201
|
+
function callbackifyOnRejected(reason, cb) {
|
2202
|
+
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
|
2203
|
+
// Because `null` is a special error value in callbacks which means "no error
|
2204
|
+
// occurred", we error-wrap so the callback consumer can distinguish between
|
2205
|
+
// "the promise rejected with null" or "the promise fulfilled with undefined".
|
2206
|
+
if (!reason) {
|
2207
|
+
var newReason = new Error('Promise was rejected with a falsy value');
|
2208
|
+
newReason.reason = reason;
|
2209
|
+
reason = newReason;
|
2210
|
+
}
|
2211
|
+
return cb(reason);
|
2212
|
+
}
|
2213
|
+
|
2214
|
+
function callbackify(original) {
|
2215
|
+
if (typeof original !== 'function') {
|
2216
|
+
throw new TypeError('The "original" argument must be of type Function');
|
2217
|
+
}
|
2218
|
+
|
2219
|
+
// We DO NOT return the promise as it gives the user a false sense that
|
2220
|
+
// the promise is actually somehow related to the callback's execution
|
2221
|
+
// and that the callback throwing will reject the promise.
|
2222
|
+
function callbackified() {
|
2223
|
+
var args = [];
|
2224
|
+
for (var i = 0; i < arguments.length; i++) {
|
2225
|
+
args.push(arguments[i]);
|
2226
|
+
}
|
2227
|
+
|
2228
|
+
var maybeCb = args.pop();
|
2229
|
+
if (typeof maybeCb !== 'function') {
|
2230
|
+
throw new TypeError('The last argument must be of type Function');
|
2231
|
+
}
|
2232
|
+
var self = this;
|
2233
|
+
var cb = function() {
|
2234
|
+
return maybeCb.apply(self, arguments);
|
2235
|
+
};
|
2236
|
+
// In true node style we process the callback on `nextTick` with all the
|
2237
|
+
// implications (stack, `uncaughtException`, `async_hooks`)
|
2238
|
+
original.apply(this, args)
|
2239
|
+
.then(function(ret) { process.nextTick(cb.bind(null, null, ret)); },
|
2240
|
+
function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); });
|
2241
|
+
}
|
2242
|
+
|
2243
|
+
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
|
2244
|
+
Object.defineProperties(callbackified,
|
2245
|
+
getOwnPropertyDescriptors(original));
|
2246
|
+
return callbackified;
|
2247
|
+
}
|
2248
|
+
exports.callbackify = callbackify;
|
2249
|
+
} (util$2));
|
2250
|
+
|
2251
|
+
var util = /*@__PURE__*/getDefaultExportFromCjs(util$2);
|
2252
|
+
|
2253
|
+
var util$1 = /*#__PURE__*/_mergeNamespaces({
|
2254
|
+
__proto__: null,
|
2255
|
+
default: util
|
2256
|
+
}, [util$2]);
|
2257
|
+
|
2258
|
+
export { util$1 as u };
|