@izzai/one-js 1.1.2 → 1.1.22
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.
- package/dist/index.cjs +4342 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +838 -7
- package/dist/index.js +4324 -9
- package/dist/index.js.map +1 -0
- package/package.json +13 -4
- package/dist/customTypes/auth.d.ts +0 -4
- package/dist/customTypes/auth.js +0 -2
- package/dist/customTypes/chat.d.ts +0 -4
- package/dist/customTypes/chat.js +0 -2
- package/dist/customTypes/index.d.ts +0 -2
- package/dist/customTypes/index.js +0 -18
- package/dist/services/agent.d.ts +0 -5
- package/dist/services/agent.js +0 -18
- package/dist/services/base.d.ts +0 -14
- package/dist/services/base.js +0 -69
- package/dist/services/chat.d.ts +0 -12
- package/dist/services/chat.js +0 -57
- package/dist/services/datasource.d.ts +0 -5
- package/dist/services/datasource.js +0 -13
- package/dist/services/gpt.d.ts +0 -5
- package/dist/services/gpt.js +0 -17
- package/dist/services/index.d.ts +0 -12
- package/dist/services/index.js +0 -14
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,4342 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var require$$0$1 = require('util');
|
|
4
|
+
var require$$0$2 = require('path');
|
|
5
|
+
|
|
6
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7
|
+
|
|
8
|
+
function getDefaultExportFromCjs (x) {
|
|
9
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
var type;
|
|
13
|
+
var hasRequiredType;
|
|
14
|
+
|
|
15
|
+
function requireType () {
|
|
16
|
+
if (hasRequiredType) return type;
|
|
17
|
+
hasRequiredType = 1;
|
|
18
|
+
|
|
19
|
+
/** @type {import('./type')} */
|
|
20
|
+
type = TypeError;
|
|
21
|
+
return type;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var util_inspect;
|
|
25
|
+
var hasRequiredUtil_inspect;
|
|
26
|
+
|
|
27
|
+
function requireUtil_inspect () {
|
|
28
|
+
if (hasRequiredUtil_inspect) return util_inspect;
|
|
29
|
+
hasRequiredUtil_inspect = 1;
|
|
30
|
+
util_inspect = require$$0$1.inspect;
|
|
31
|
+
return util_inspect;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var objectInspect;
|
|
35
|
+
var hasRequiredObjectInspect;
|
|
36
|
+
|
|
37
|
+
function requireObjectInspect () {
|
|
38
|
+
if (hasRequiredObjectInspect) return objectInspect;
|
|
39
|
+
hasRequiredObjectInspect = 1;
|
|
40
|
+
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
41
|
+
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
42
|
+
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
43
|
+
var mapForEach = hasMap && Map.prototype.forEach;
|
|
44
|
+
var hasSet = typeof Set === 'function' && Set.prototype;
|
|
45
|
+
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
|
46
|
+
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
|
47
|
+
var setForEach = hasSet && Set.prototype.forEach;
|
|
48
|
+
var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
|
|
49
|
+
var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
|
|
50
|
+
var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
|
|
51
|
+
var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
|
|
52
|
+
var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
|
|
53
|
+
var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
|
|
54
|
+
var booleanValueOf = Boolean.prototype.valueOf;
|
|
55
|
+
var objectToString = Object.prototype.toString;
|
|
56
|
+
var functionToString = Function.prototype.toString;
|
|
57
|
+
var $match = String.prototype.match;
|
|
58
|
+
var $slice = String.prototype.slice;
|
|
59
|
+
var $replace = String.prototype.replace;
|
|
60
|
+
var $toUpperCase = String.prototype.toUpperCase;
|
|
61
|
+
var $toLowerCase = String.prototype.toLowerCase;
|
|
62
|
+
var $test = RegExp.prototype.test;
|
|
63
|
+
var $concat = Array.prototype.concat;
|
|
64
|
+
var $join = Array.prototype.join;
|
|
65
|
+
var $arrSlice = Array.prototype.slice;
|
|
66
|
+
var $floor = Math.floor;
|
|
67
|
+
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
|
68
|
+
var gOPS = Object.getOwnPropertySymbols;
|
|
69
|
+
var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
|
|
70
|
+
var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
|
|
71
|
+
// ie, `has-tostringtag/shams
|
|
72
|
+
var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
|
|
73
|
+
? Symbol.toStringTag
|
|
74
|
+
: null;
|
|
75
|
+
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
76
|
+
|
|
77
|
+
var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
|
|
78
|
+
[].__proto__ === Array.prototype // eslint-disable-line no-proto
|
|
79
|
+
? function (O) {
|
|
80
|
+
return O.__proto__; // eslint-disable-line no-proto
|
|
81
|
+
}
|
|
82
|
+
: null
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
function addNumericSeparator(num, str) {
|
|
86
|
+
if (
|
|
87
|
+
num === Infinity
|
|
88
|
+
|| num === -Infinity
|
|
89
|
+
|| num !== num
|
|
90
|
+
|| (num && num > -1e3 && num < 1000)
|
|
91
|
+
|| $test.call(/e/, str)
|
|
92
|
+
) {
|
|
93
|
+
return str;
|
|
94
|
+
}
|
|
95
|
+
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
|
96
|
+
if (typeof num === 'number') {
|
|
97
|
+
var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
|
|
98
|
+
if (int !== num) {
|
|
99
|
+
var intStr = String(int);
|
|
100
|
+
var dec = $slice.call(str, intStr.length + 1);
|
|
101
|
+
return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return $replace.call(str, sepRegex, '$&_');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var utilInspect = /*@__PURE__*/ requireUtil_inspect();
|
|
108
|
+
var inspectCustom = utilInspect.custom;
|
|
109
|
+
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
|
|
110
|
+
|
|
111
|
+
var quotes = {
|
|
112
|
+
__proto__: null,
|
|
113
|
+
'double': '"',
|
|
114
|
+
single: "'"
|
|
115
|
+
};
|
|
116
|
+
var quoteREs = {
|
|
117
|
+
__proto__: null,
|
|
118
|
+
'double': /(["\\])/g,
|
|
119
|
+
single: /(['\\])/g
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
objectInspect = function inspect_(obj, options, depth, seen) {
|
|
123
|
+
var opts = options || {};
|
|
124
|
+
|
|
125
|
+
if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) {
|
|
126
|
+
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
|
127
|
+
}
|
|
128
|
+
if (
|
|
129
|
+
has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
|
|
130
|
+
? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
|
|
131
|
+
: opts.maxStringLength !== null
|
|
132
|
+
)
|
|
133
|
+
) {
|
|
134
|
+
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
|
|
135
|
+
}
|
|
136
|
+
var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
|
|
137
|
+
if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
|
|
138
|
+
throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (
|
|
142
|
+
has(opts, 'indent')
|
|
143
|
+
&& opts.indent !== null
|
|
144
|
+
&& opts.indent !== '\t'
|
|
145
|
+
&& !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
|
|
146
|
+
) {
|
|
147
|
+
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
|
|
148
|
+
}
|
|
149
|
+
if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
|
|
150
|
+
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
|
|
151
|
+
}
|
|
152
|
+
var numericSeparator = opts.numericSeparator;
|
|
153
|
+
|
|
154
|
+
if (typeof obj === 'undefined') {
|
|
155
|
+
return 'undefined';
|
|
156
|
+
}
|
|
157
|
+
if (obj === null) {
|
|
158
|
+
return 'null';
|
|
159
|
+
}
|
|
160
|
+
if (typeof obj === 'boolean') {
|
|
161
|
+
return obj ? 'true' : 'false';
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (typeof obj === 'string') {
|
|
165
|
+
return inspectString(obj, opts);
|
|
166
|
+
}
|
|
167
|
+
if (typeof obj === 'number') {
|
|
168
|
+
if (obj === 0) {
|
|
169
|
+
return Infinity / obj > 0 ? '0' : '-0';
|
|
170
|
+
}
|
|
171
|
+
var str = String(obj);
|
|
172
|
+
return numericSeparator ? addNumericSeparator(obj, str) : str;
|
|
173
|
+
}
|
|
174
|
+
if (typeof obj === 'bigint') {
|
|
175
|
+
var bigIntStr = String(obj) + 'n';
|
|
176
|
+
return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
|
180
|
+
if (typeof depth === 'undefined') { depth = 0; }
|
|
181
|
+
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
|
182
|
+
return isArray(obj) ? '[Array]' : '[Object]';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
var indent = getIndent(opts, depth);
|
|
186
|
+
|
|
187
|
+
if (typeof seen === 'undefined') {
|
|
188
|
+
seen = [];
|
|
189
|
+
} else if (indexOf(seen, obj) >= 0) {
|
|
190
|
+
return '[Circular]';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function inspect(value, from, noIndent) {
|
|
194
|
+
if (from) {
|
|
195
|
+
seen = $arrSlice.call(seen);
|
|
196
|
+
seen.push(from);
|
|
197
|
+
}
|
|
198
|
+
if (noIndent) {
|
|
199
|
+
var newOpts = {
|
|
200
|
+
depth: opts.depth
|
|
201
|
+
};
|
|
202
|
+
if (has(opts, 'quoteStyle')) {
|
|
203
|
+
newOpts.quoteStyle = opts.quoteStyle;
|
|
204
|
+
}
|
|
205
|
+
return inspect_(value, newOpts, depth + 1, seen);
|
|
206
|
+
}
|
|
207
|
+
return inspect_(value, opts, depth + 1, seen);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable
|
|
211
|
+
var name = nameOf(obj);
|
|
212
|
+
var keys = arrObjKeys(obj, inspect);
|
|
213
|
+
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
|
|
214
|
+
}
|
|
215
|
+
if (isSymbol(obj)) {
|
|
216
|
+
var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
|
|
217
|
+
return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
|
|
218
|
+
}
|
|
219
|
+
if (isElement(obj)) {
|
|
220
|
+
var s = '<' + $toLowerCase.call(String(obj.nodeName));
|
|
221
|
+
var attrs = obj.attributes || [];
|
|
222
|
+
for (var i = 0; i < attrs.length; i++) {
|
|
223
|
+
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
|
224
|
+
}
|
|
225
|
+
s += '>';
|
|
226
|
+
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
|
|
227
|
+
s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
|
|
228
|
+
return s;
|
|
229
|
+
}
|
|
230
|
+
if (isArray(obj)) {
|
|
231
|
+
if (obj.length === 0) { return '[]'; }
|
|
232
|
+
var xs = arrObjKeys(obj, inspect);
|
|
233
|
+
if (indent && !singleLineValues(xs)) {
|
|
234
|
+
return '[' + indentedJoin(xs, indent) + ']';
|
|
235
|
+
}
|
|
236
|
+
return '[ ' + $join.call(xs, ', ') + ' ]';
|
|
237
|
+
}
|
|
238
|
+
if (isError(obj)) {
|
|
239
|
+
var parts = arrObjKeys(obj, inspect);
|
|
240
|
+
if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
|
|
241
|
+
return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
|
|
242
|
+
}
|
|
243
|
+
if (parts.length === 0) { return '[' + String(obj) + ']'; }
|
|
244
|
+
return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
|
|
245
|
+
}
|
|
246
|
+
if (typeof obj === 'object' && customInspect) {
|
|
247
|
+
if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
|
|
248
|
+
return utilInspect(obj, { depth: maxDepth - depth });
|
|
249
|
+
} else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
|
|
250
|
+
return obj.inspect();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (isMap(obj)) {
|
|
254
|
+
var mapParts = [];
|
|
255
|
+
if (mapForEach) {
|
|
256
|
+
mapForEach.call(obj, function (value, key) {
|
|
257
|
+
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
|
|
261
|
+
}
|
|
262
|
+
if (isSet(obj)) {
|
|
263
|
+
var setParts = [];
|
|
264
|
+
if (setForEach) {
|
|
265
|
+
setForEach.call(obj, function (value) {
|
|
266
|
+
setParts.push(inspect(value, obj));
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
return collectionOf('Set', setSize.call(obj), setParts, indent);
|
|
270
|
+
}
|
|
271
|
+
if (isWeakMap(obj)) {
|
|
272
|
+
return weakCollectionOf('WeakMap');
|
|
273
|
+
}
|
|
274
|
+
if (isWeakSet(obj)) {
|
|
275
|
+
return weakCollectionOf('WeakSet');
|
|
276
|
+
}
|
|
277
|
+
if (isWeakRef(obj)) {
|
|
278
|
+
return weakCollectionOf('WeakRef');
|
|
279
|
+
}
|
|
280
|
+
if (isNumber(obj)) {
|
|
281
|
+
return markBoxed(inspect(Number(obj)));
|
|
282
|
+
}
|
|
283
|
+
if (isBigInt(obj)) {
|
|
284
|
+
return markBoxed(inspect(bigIntValueOf.call(obj)));
|
|
285
|
+
}
|
|
286
|
+
if (isBoolean(obj)) {
|
|
287
|
+
return markBoxed(booleanValueOf.call(obj));
|
|
288
|
+
}
|
|
289
|
+
if (isString(obj)) {
|
|
290
|
+
return markBoxed(inspect(String(obj)));
|
|
291
|
+
}
|
|
292
|
+
// note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
|
|
293
|
+
/* eslint-env browser */
|
|
294
|
+
if (typeof window !== 'undefined' && obj === window) {
|
|
295
|
+
return '{ [object Window] }';
|
|
296
|
+
}
|
|
297
|
+
if (
|
|
298
|
+
(typeof globalThis !== 'undefined' && obj === globalThis)
|
|
299
|
+
|| (typeof commonjsGlobal !== 'undefined' && obj === commonjsGlobal)
|
|
300
|
+
) {
|
|
301
|
+
return '{ [object globalThis] }';
|
|
302
|
+
}
|
|
303
|
+
if (!isDate(obj) && !isRegExp(obj)) {
|
|
304
|
+
var ys = arrObjKeys(obj, inspect);
|
|
305
|
+
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
306
|
+
var protoTag = obj instanceof Object ? '' : 'null prototype';
|
|
307
|
+
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
|
|
308
|
+
var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
|
|
309
|
+
var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
|
|
310
|
+
if (ys.length === 0) { return tag + '{}'; }
|
|
311
|
+
if (indent) {
|
|
312
|
+
return tag + '{' + indentedJoin(ys, indent) + '}';
|
|
313
|
+
}
|
|
314
|
+
return tag + '{ ' + $join.call(ys, ', ') + ' }';
|
|
315
|
+
}
|
|
316
|
+
return String(obj);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
function wrapQuotes(s, defaultStyle, opts) {
|
|
320
|
+
var style = opts.quoteStyle || defaultStyle;
|
|
321
|
+
var quoteChar = quotes[style];
|
|
322
|
+
return quoteChar + s + quoteChar;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function quote(s) {
|
|
326
|
+
return $replace.call(String(s), /"/g, '"');
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function canTrustToString(obj) {
|
|
330
|
+
return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined'));
|
|
331
|
+
}
|
|
332
|
+
function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); }
|
|
333
|
+
function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); }
|
|
334
|
+
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); }
|
|
335
|
+
function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); }
|
|
336
|
+
function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); }
|
|
337
|
+
function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); }
|
|
338
|
+
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); }
|
|
339
|
+
|
|
340
|
+
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
341
|
+
function isSymbol(obj) {
|
|
342
|
+
if (hasShammedSymbols) {
|
|
343
|
+
return obj && typeof obj === 'object' && obj instanceof Symbol;
|
|
344
|
+
}
|
|
345
|
+
if (typeof obj === 'symbol') {
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
if (!obj || typeof obj !== 'object' || !symToString) {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
try {
|
|
352
|
+
symToString.call(obj);
|
|
353
|
+
return true;
|
|
354
|
+
} catch (e) {}
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function isBigInt(obj) {
|
|
359
|
+
if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
try {
|
|
363
|
+
bigIntValueOf.call(obj);
|
|
364
|
+
return true;
|
|
365
|
+
} catch (e) {}
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
|
370
|
+
function has(obj, key) {
|
|
371
|
+
return hasOwn.call(obj, key);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function toStr(obj) {
|
|
375
|
+
return objectToString.call(obj);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function nameOf(f) {
|
|
379
|
+
if (f.name) { return f.name; }
|
|
380
|
+
var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
|
|
381
|
+
if (m) { return m[1]; }
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function indexOf(xs, x) {
|
|
386
|
+
if (xs.indexOf) { return xs.indexOf(x); }
|
|
387
|
+
for (var i = 0, l = xs.length; i < l; i++) {
|
|
388
|
+
if (xs[i] === x) { return i; }
|
|
389
|
+
}
|
|
390
|
+
return -1;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function isMap(x) {
|
|
394
|
+
if (!mapSize || !x || typeof x !== 'object') {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
try {
|
|
398
|
+
mapSize.call(x);
|
|
399
|
+
try {
|
|
400
|
+
setSize.call(x);
|
|
401
|
+
} catch (s) {
|
|
402
|
+
return true;
|
|
403
|
+
}
|
|
404
|
+
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
|
405
|
+
} catch (e) {}
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function isWeakMap(x) {
|
|
410
|
+
if (!weakMapHas || !x || typeof x !== 'object') {
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
try {
|
|
414
|
+
weakMapHas.call(x, weakMapHas);
|
|
415
|
+
try {
|
|
416
|
+
weakSetHas.call(x, weakSetHas);
|
|
417
|
+
} catch (s) {
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
|
|
421
|
+
} catch (e) {}
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function isWeakRef(x) {
|
|
426
|
+
if (!weakRefDeref || !x || typeof x !== 'object') {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
try {
|
|
430
|
+
weakRefDeref.call(x);
|
|
431
|
+
return true;
|
|
432
|
+
} catch (e) {}
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function isSet(x) {
|
|
437
|
+
if (!setSize || !x || typeof x !== 'object') {
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
440
|
+
try {
|
|
441
|
+
setSize.call(x);
|
|
442
|
+
try {
|
|
443
|
+
mapSize.call(x);
|
|
444
|
+
} catch (m) {
|
|
445
|
+
return true;
|
|
446
|
+
}
|
|
447
|
+
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
|
448
|
+
} catch (e) {}
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function isWeakSet(x) {
|
|
453
|
+
if (!weakSetHas || !x || typeof x !== 'object') {
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
try {
|
|
457
|
+
weakSetHas.call(x, weakSetHas);
|
|
458
|
+
try {
|
|
459
|
+
weakMapHas.call(x, weakMapHas);
|
|
460
|
+
} catch (s) {
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
|
|
464
|
+
} catch (e) {}
|
|
465
|
+
return false;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function isElement(x) {
|
|
469
|
+
if (!x || typeof x !== 'object') { return false; }
|
|
470
|
+
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function inspectString(str, opts) {
|
|
477
|
+
if (str.length > opts.maxStringLength) {
|
|
478
|
+
var remaining = str.length - opts.maxStringLength;
|
|
479
|
+
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
|
480
|
+
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
|
481
|
+
}
|
|
482
|
+
var quoteRE = quoteREs[opts.quoteStyle || 'single'];
|
|
483
|
+
quoteRE.lastIndex = 0;
|
|
484
|
+
// eslint-disable-next-line no-control-regex
|
|
485
|
+
var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
|
486
|
+
return wrapQuotes(s, 'single', opts);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function lowbyte(c) {
|
|
490
|
+
var n = c.charCodeAt(0);
|
|
491
|
+
var x = {
|
|
492
|
+
8: 'b',
|
|
493
|
+
9: 't',
|
|
494
|
+
10: 'n',
|
|
495
|
+
12: 'f',
|
|
496
|
+
13: 'r'
|
|
497
|
+
}[n];
|
|
498
|
+
if (x) { return '\\' + x; }
|
|
499
|
+
return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
function markBoxed(str) {
|
|
503
|
+
return 'Object(' + str + ')';
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function weakCollectionOf(type) {
|
|
507
|
+
return type + ' { ? }';
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function collectionOf(type, size, entries, indent) {
|
|
511
|
+
var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
|
|
512
|
+
return type + ' (' + size + ') {' + joinedEntries + '}';
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function singleLineValues(xs) {
|
|
516
|
+
for (var i = 0; i < xs.length; i++) {
|
|
517
|
+
if (indexOf(xs[i], '\n') >= 0) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function getIndent(opts, depth) {
|
|
525
|
+
var baseIndent;
|
|
526
|
+
if (opts.indent === '\t') {
|
|
527
|
+
baseIndent = '\t';
|
|
528
|
+
} else if (typeof opts.indent === 'number' && opts.indent > 0) {
|
|
529
|
+
baseIndent = $join.call(Array(opts.indent + 1), ' ');
|
|
530
|
+
} else {
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
base: baseIndent,
|
|
535
|
+
prev: $join.call(Array(depth + 1), baseIndent)
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function indentedJoin(xs, indent) {
|
|
540
|
+
if (xs.length === 0) { return ''; }
|
|
541
|
+
var lineJoiner = '\n' + indent.prev + indent.base;
|
|
542
|
+
return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function arrObjKeys(obj, inspect) {
|
|
546
|
+
var isArr = isArray(obj);
|
|
547
|
+
var xs = [];
|
|
548
|
+
if (isArr) {
|
|
549
|
+
xs.length = obj.length;
|
|
550
|
+
for (var i = 0; i < obj.length; i++) {
|
|
551
|
+
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
|
|
555
|
+
var symMap;
|
|
556
|
+
if (hasShammedSymbols) {
|
|
557
|
+
symMap = {};
|
|
558
|
+
for (var k = 0; k < syms.length; k++) {
|
|
559
|
+
symMap['$' + syms[k]] = syms[k];
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
for (var key in obj) { // eslint-disable-line no-restricted-syntax
|
|
564
|
+
if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
565
|
+
if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
566
|
+
if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
|
|
567
|
+
// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
|
568
|
+
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
|
569
|
+
} else if ($test.call(/[^\w$]/, key)) {
|
|
570
|
+
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
|
571
|
+
} else {
|
|
572
|
+
xs.push(key + ': ' + inspect(obj[key], obj));
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (typeof gOPS === 'function') {
|
|
576
|
+
for (var j = 0; j < syms.length; j++) {
|
|
577
|
+
if (isEnumerable.call(obj, syms[j])) {
|
|
578
|
+
xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return xs;
|
|
583
|
+
}
|
|
584
|
+
return objectInspect;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
var sideChannelList;
|
|
588
|
+
var hasRequiredSideChannelList;
|
|
589
|
+
|
|
590
|
+
function requireSideChannelList () {
|
|
591
|
+
if (hasRequiredSideChannelList) return sideChannelList;
|
|
592
|
+
hasRequiredSideChannelList = 1;
|
|
593
|
+
|
|
594
|
+
var inspect = /*@__PURE__*/ requireObjectInspect();
|
|
595
|
+
|
|
596
|
+
var $TypeError = /*@__PURE__*/ requireType();
|
|
597
|
+
|
|
598
|
+
/*
|
|
599
|
+
* This function traverses the list returning the node corresponding to the given key.
|
|
600
|
+
*
|
|
601
|
+
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list.
|
|
602
|
+
* By doing so, all the recently used nodes can be accessed relatively quickly.
|
|
603
|
+
*/
|
|
604
|
+
/** @type {import('./list.d.ts').listGetNode} */
|
|
605
|
+
// eslint-disable-next-line consistent-return
|
|
606
|
+
var listGetNode = function (list, key, isDelete) {
|
|
607
|
+
/** @type {typeof list | NonNullable<(typeof list)['next']>} */
|
|
608
|
+
var prev = list;
|
|
609
|
+
/** @type {(typeof list)['next']} */
|
|
610
|
+
var curr;
|
|
611
|
+
// eslint-disable-next-line eqeqeq
|
|
612
|
+
for (; (curr = prev.next) != null; prev = curr) {
|
|
613
|
+
if (curr.key === key) {
|
|
614
|
+
prev.next = curr.next;
|
|
615
|
+
if (!isDelete) {
|
|
616
|
+
// eslint-disable-next-line no-extra-parens
|
|
617
|
+
curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next);
|
|
618
|
+
list.next = curr; // eslint-disable-line no-param-reassign
|
|
619
|
+
}
|
|
620
|
+
return curr;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
/** @type {import('./list.d.ts').listGet} */
|
|
626
|
+
var listGet = function (objects, key) {
|
|
627
|
+
if (!objects) {
|
|
628
|
+
return void undefined;
|
|
629
|
+
}
|
|
630
|
+
var node = listGetNode(objects, key);
|
|
631
|
+
return node && node.value;
|
|
632
|
+
};
|
|
633
|
+
/** @type {import('./list.d.ts').listSet} */
|
|
634
|
+
var listSet = function (objects, key, value) {
|
|
635
|
+
var node = listGetNode(objects, key);
|
|
636
|
+
if (node) {
|
|
637
|
+
node.value = value;
|
|
638
|
+
} else {
|
|
639
|
+
// Prepend the new node to the beginning of the list
|
|
640
|
+
objects.next = /** @type {import('./list.d.ts').ListNode<typeof value, typeof key>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens
|
|
641
|
+
key: key,
|
|
642
|
+
next: objects.next,
|
|
643
|
+
value: value
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
/** @type {import('./list.d.ts').listHas} */
|
|
648
|
+
var listHas = function (objects, key) {
|
|
649
|
+
if (!objects) {
|
|
650
|
+
return false;
|
|
651
|
+
}
|
|
652
|
+
return !!listGetNode(objects, key);
|
|
653
|
+
};
|
|
654
|
+
/** @type {import('./list.d.ts').listDelete} */
|
|
655
|
+
// eslint-disable-next-line consistent-return
|
|
656
|
+
var listDelete = function (objects, key) {
|
|
657
|
+
if (objects) {
|
|
658
|
+
return listGetNode(objects, key, true);
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
/** @type {import('.')} */
|
|
663
|
+
sideChannelList = function getSideChannelList() {
|
|
664
|
+
/** @typedef {ReturnType<typeof getSideChannelList>} Channel */
|
|
665
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
666
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
667
|
+
|
|
668
|
+
/** @type {import('./list.d.ts').RootNode<V, K> | undefined} */ var $o;
|
|
669
|
+
|
|
670
|
+
/** @type {Channel} */
|
|
671
|
+
var channel = {
|
|
672
|
+
assert: function (key) {
|
|
673
|
+
if (!channel.has(key)) {
|
|
674
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
'delete': function (key) {
|
|
678
|
+
var root = $o && $o.next;
|
|
679
|
+
var deletedNode = listDelete($o, key);
|
|
680
|
+
if (deletedNode && root && root === deletedNode) {
|
|
681
|
+
$o = void undefined;
|
|
682
|
+
}
|
|
683
|
+
return !!deletedNode;
|
|
684
|
+
},
|
|
685
|
+
get: function (key) {
|
|
686
|
+
return listGet($o, key);
|
|
687
|
+
},
|
|
688
|
+
has: function (key) {
|
|
689
|
+
return listHas($o, key);
|
|
690
|
+
},
|
|
691
|
+
set: function (key, value) {
|
|
692
|
+
if (!$o) {
|
|
693
|
+
// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
|
|
694
|
+
$o = {
|
|
695
|
+
next: void undefined
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
// eslint-disable-next-line no-extra-parens
|
|
699
|
+
listSet(/** @type {NonNullable<typeof $o>} */ ($o), key, value);
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
703
|
+
return channel;
|
|
704
|
+
};
|
|
705
|
+
return sideChannelList;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
var esObjectAtoms;
|
|
709
|
+
var hasRequiredEsObjectAtoms;
|
|
710
|
+
|
|
711
|
+
function requireEsObjectAtoms () {
|
|
712
|
+
if (hasRequiredEsObjectAtoms) return esObjectAtoms;
|
|
713
|
+
hasRequiredEsObjectAtoms = 1;
|
|
714
|
+
|
|
715
|
+
/** @type {import('.')} */
|
|
716
|
+
esObjectAtoms = Object;
|
|
717
|
+
return esObjectAtoms;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
var esErrors;
|
|
721
|
+
var hasRequiredEsErrors;
|
|
722
|
+
|
|
723
|
+
function requireEsErrors () {
|
|
724
|
+
if (hasRequiredEsErrors) return esErrors;
|
|
725
|
+
hasRequiredEsErrors = 1;
|
|
726
|
+
|
|
727
|
+
/** @type {import('.')} */
|
|
728
|
+
esErrors = Error;
|
|
729
|
+
return esErrors;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
var _eval;
|
|
733
|
+
var hasRequired_eval;
|
|
734
|
+
|
|
735
|
+
function require_eval () {
|
|
736
|
+
if (hasRequired_eval) return _eval;
|
|
737
|
+
hasRequired_eval = 1;
|
|
738
|
+
|
|
739
|
+
/** @type {import('./eval')} */
|
|
740
|
+
_eval = EvalError;
|
|
741
|
+
return _eval;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
var range;
|
|
745
|
+
var hasRequiredRange;
|
|
746
|
+
|
|
747
|
+
function requireRange () {
|
|
748
|
+
if (hasRequiredRange) return range;
|
|
749
|
+
hasRequiredRange = 1;
|
|
750
|
+
|
|
751
|
+
/** @type {import('./range')} */
|
|
752
|
+
range = RangeError;
|
|
753
|
+
return range;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
var ref;
|
|
757
|
+
var hasRequiredRef;
|
|
758
|
+
|
|
759
|
+
function requireRef () {
|
|
760
|
+
if (hasRequiredRef) return ref;
|
|
761
|
+
hasRequiredRef = 1;
|
|
762
|
+
|
|
763
|
+
/** @type {import('./ref')} */
|
|
764
|
+
ref = ReferenceError;
|
|
765
|
+
return ref;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
var syntax;
|
|
769
|
+
var hasRequiredSyntax;
|
|
770
|
+
|
|
771
|
+
function requireSyntax () {
|
|
772
|
+
if (hasRequiredSyntax) return syntax;
|
|
773
|
+
hasRequiredSyntax = 1;
|
|
774
|
+
|
|
775
|
+
/** @type {import('./syntax')} */
|
|
776
|
+
syntax = SyntaxError;
|
|
777
|
+
return syntax;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
var uri;
|
|
781
|
+
var hasRequiredUri;
|
|
782
|
+
|
|
783
|
+
function requireUri () {
|
|
784
|
+
if (hasRequiredUri) return uri;
|
|
785
|
+
hasRequiredUri = 1;
|
|
786
|
+
|
|
787
|
+
/** @type {import('./uri')} */
|
|
788
|
+
uri = URIError;
|
|
789
|
+
return uri;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
var abs;
|
|
793
|
+
var hasRequiredAbs;
|
|
794
|
+
|
|
795
|
+
function requireAbs () {
|
|
796
|
+
if (hasRequiredAbs) return abs;
|
|
797
|
+
hasRequiredAbs = 1;
|
|
798
|
+
|
|
799
|
+
/** @type {import('./abs')} */
|
|
800
|
+
abs = Math.abs;
|
|
801
|
+
return abs;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
var floor;
|
|
805
|
+
var hasRequiredFloor;
|
|
806
|
+
|
|
807
|
+
function requireFloor () {
|
|
808
|
+
if (hasRequiredFloor) return floor;
|
|
809
|
+
hasRequiredFloor = 1;
|
|
810
|
+
|
|
811
|
+
/** @type {import('./floor')} */
|
|
812
|
+
floor = Math.floor;
|
|
813
|
+
return floor;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
var max;
|
|
817
|
+
var hasRequiredMax;
|
|
818
|
+
|
|
819
|
+
function requireMax () {
|
|
820
|
+
if (hasRequiredMax) return max;
|
|
821
|
+
hasRequiredMax = 1;
|
|
822
|
+
|
|
823
|
+
/** @type {import('./max')} */
|
|
824
|
+
max = Math.max;
|
|
825
|
+
return max;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
var min;
|
|
829
|
+
var hasRequiredMin;
|
|
830
|
+
|
|
831
|
+
function requireMin () {
|
|
832
|
+
if (hasRequiredMin) return min;
|
|
833
|
+
hasRequiredMin = 1;
|
|
834
|
+
|
|
835
|
+
/** @type {import('./min')} */
|
|
836
|
+
min = Math.min;
|
|
837
|
+
return min;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
var pow;
|
|
841
|
+
var hasRequiredPow;
|
|
842
|
+
|
|
843
|
+
function requirePow () {
|
|
844
|
+
if (hasRequiredPow) return pow;
|
|
845
|
+
hasRequiredPow = 1;
|
|
846
|
+
|
|
847
|
+
/** @type {import('./pow')} */
|
|
848
|
+
pow = Math.pow;
|
|
849
|
+
return pow;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
var round;
|
|
853
|
+
var hasRequiredRound;
|
|
854
|
+
|
|
855
|
+
function requireRound () {
|
|
856
|
+
if (hasRequiredRound) return round;
|
|
857
|
+
hasRequiredRound = 1;
|
|
858
|
+
|
|
859
|
+
/** @type {import('./round')} */
|
|
860
|
+
round = Math.round;
|
|
861
|
+
return round;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
var _isNaN;
|
|
865
|
+
var hasRequired_isNaN;
|
|
866
|
+
|
|
867
|
+
function require_isNaN () {
|
|
868
|
+
if (hasRequired_isNaN) return _isNaN;
|
|
869
|
+
hasRequired_isNaN = 1;
|
|
870
|
+
|
|
871
|
+
/** @type {import('./isNaN')} */
|
|
872
|
+
_isNaN = Number.isNaN || function isNaN(a) {
|
|
873
|
+
return a !== a;
|
|
874
|
+
};
|
|
875
|
+
return _isNaN;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
var sign;
|
|
879
|
+
var hasRequiredSign;
|
|
880
|
+
|
|
881
|
+
function requireSign () {
|
|
882
|
+
if (hasRequiredSign) return sign;
|
|
883
|
+
hasRequiredSign = 1;
|
|
884
|
+
|
|
885
|
+
var $isNaN = /*@__PURE__*/ require_isNaN();
|
|
886
|
+
|
|
887
|
+
/** @type {import('./sign')} */
|
|
888
|
+
sign = function sign(number) {
|
|
889
|
+
if ($isNaN(number) || number === 0) {
|
|
890
|
+
return number;
|
|
891
|
+
}
|
|
892
|
+
return number < 0 ? -1 : 1;
|
|
893
|
+
};
|
|
894
|
+
return sign;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
var gOPD;
|
|
898
|
+
var hasRequiredGOPD;
|
|
899
|
+
|
|
900
|
+
function requireGOPD () {
|
|
901
|
+
if (hasRequiredGOPD) return gOPD;
|
|
902
|
+
hasRequiredGOPD = 1;
|
|
903
|
+
|
|
904
|
+
/** @type {import('./gOPD')} */
|
|
905
|
+
gOPD = Object.getOwnPropertyDescriptor;
|
|
906
|
+
return gOPD;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
var gopd;
|
|
910
|
+
var hasRequiredGopd;
|
|
911
|
+
|
|
912
|
+
function requireGopd () {
|
|
913
|
+
if (hasRequiredGopd) return gopd;
|
|
914
|
+
hasRequiredGopd = 1;
|
|
915
|
+
|
|
916
|
+
/** @type {import('.')} */
|
|
917
|
+
var $gOPD = /*@__PURE__*/ requireGOPD();
|
|
918
|
+
|
|
919
|
+
if ($gOPD) {
|
|
920
|
+
try {
|
|
921
|
+
$gOPD([], 'length');
|
|
922
|
+
} catch (e) {
|
|
923
|
+
// IE 8 has a broken gOPD
|
|
924
|
+
$gOPD = null;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
gopd = $gOPD;
|
|
929
|
+
return gopd;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
var esDefineProperty;
|
|
933
|
+
var hasRequiredEsDefineProperty;
|
|
934
|
+
|
|
935
|
+
function requireEsDefineProperty () {
|
|
936
|
+
if (hasRequiredEsDefineProperty) return esDefineProperty;
|
|
937
|
+
hasRequiredEsDefineProperty = 1;
|
|
938
|
+
|
|
939
|
+
/** @type {import('.')} */
|
|
940
|
+
var $defineProperty = Object.defineProperty || false;
|
|
941
|
+
if ($defineProperty) {
|
|
942
|
+
try {
|
|
943
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
944
|
+
} catch (e) {
|
|
945
|
+
// IE 8 has a broken defineProperty
|
|
946
|
+
$defineProperty = false;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
esDefineProperty = $defineProperty;
|
|
951
|
+
return esDefineProperty;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
var shams;
|
|
955
|
+
var hasRequiredShams;
|
|
956
|
+
|
|
957
|
+
function requireShams () {
|
|
958
|
+
if (hasRequiredShams) return shams;
|
|
959
|
+
hasRequiredShams = 1;
|
|
960
|
+
|
|
961
|
+
/** @type {import('./shams')} */
|
|
962
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
963
|
+
shams = function hasSymbols() {
|
|
964
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
965
|
+
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
966
|
+
|
|
967
|
+
/** @type {{ [k in symbol]?: unknown }} */
|
|
968
|
+
var obj = {};
|
|
969
|
+
var sym = Symbol('test');
|
|
970
|
+
var symObj = Object(sym);
|
|
971
|
+
if (typeof sym === 'string') { return false; }
|
|
972
|
+
|
|
973
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
974
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
975
|
+
|
|
976
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
977
|
+
// if (sym instanceof Symbol) { return false; }
|
|
978
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
979
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
|
980
|
+
|
|
981
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
982
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
983
|
+
|
|
984
|
+
var symVal = 42;
|
|
985
|
+
obj[sym] = symVal;
|
|
986
|
+
for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
987
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
988
|
+
|
|
989
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
990
|
+
|
|
991
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
992
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
993
|
+
|
|
994
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
995
|
+
|
|
996
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
997
|
+
// eslint-disable-next-line no-extra-parens
|
|
998
|
+
var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym));
|
|
999
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
return true;
|
|
1003
|
+
};
|
|
1004
|
+
return shams;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
var hasSymbols;
|
|
1008
|
+
var hasRequiredHasSymbols;
|
|
1009
|
+
|
|
1010
|
+
function requireHasSymbols () {
|
|
1011
|
+
if (hasRequiredHasSymbols) return hasSymbols;
|
|
1012
|
+
hasRequiredHasSymbols = 1;
|
|
1013
|
+
|
|
1014
|
+
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
1015
|
+
var hasSymbolSham = requireShams();
|
|
1016
|
+
|
|
1017
|
+
/** @type {import('.')} */
|
|
1018
|
+
hasSymbols = function hasNativeSymbols() {
|
|
1019
|
+
if (typeof origSymbol !== 'function') { return false; }
|
|
1020
|
+
if (typeof Symbol !== 'function') { return false; }
|
|
1021
|
+
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
|
1022
|
+
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
|
1023
|
+
|
|
1024
|
+
return hasSymbolSham();
|
|
1025
|
+
};
|
|
1026
|
+
return hasSymbols;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
var Reflect_getPrototypeOf;
|
|
1030
|
+
var hasRequiredReflect_getPrototypeOf;
|
|
1031
|
+
|
|
1032
|
+
function requireReflect_getPrototypeOf () {
|
|
1033
|
+
if (hasRequiredReflect_getPrototypeOf) return Reflect_getPrototypeOf;
|
|
1034
|
+
hasRequiredReflect_getPrototypeOf = 1;
|
|
1035
|
+
|
|
1036
|
+
/** @type {import('./Reflect.getPrototypeOf')} */
|
|
1037
|
+
Reflect_getPrototypeOf = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null;
|
|
1038
|
+
return Reflect_getPrototypeOf;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
var Object_getPrototypeOf;
|
|
1042
|
+
var hasRequiredObject_getPrototypeOf;
|
|
1043
|
+
|
|
1044
|
+
function requireObject_getPrototypeOf () {
|
|
1045
|
+
if (hasRequiredObject_getPrototypeOf) return Object_getPrototypeOf;
|
|
1046
|
+
hasRequiredObject_getPrototypeOf = 1;
|
|
1047
|
+
|
|
1048
|
+
var $Object = /*@__PURE__*/ requireEsObjectAtoms();
|
|
1049
|
+
|
|
1050
|
+
/** @type {import('./Object.getPrototypeOf')} */
|
|
1051
|
+
Object_getPrototypeOf = $Object.getPrototypeOf || null;
|
|
1052
|
+
return Object_getPrototypeOf;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
var implementation;
|
|
1056
|
+
var hasRequiredImplementation;
|
|
1057
|
+
|
|
1058
|
+
function requireImplementation () {
|
|
1059
|
+
if (hasRequiredImplementation) return implementation;
|
|
1060
|
+
hasRequiredImplementation = 1;
|
|
1061
|
+
|
|
1062
|
+
/* eslint no-invalid-this: 1 */
|
|
1063
|
+
|
|
1064
|
+
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
1065
|
+
var toStr = Object.prototype.toString;
|
|
1066
|
+
var max = Math.max;
|
|
1067
|
+
var funcType = '[object Function]';
|
|
1068
|
+
|
|
1069
|
+
var concatty = function concatty(a, b) {
|
|
1070
|
+
var arr = [];
|
|
1071
|
+
|
|
1072
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
1073
|
+
arr[i] = a[i];
|
|
1074
|
+
}
|
|
1075
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
1076
|
+
arr[j + a.length] = b[j];
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
return arr;
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
var slicy = function slicy(arrLike, offset) {
|
|
1083
|
+
var arr = [];
|
|
1084
|
+
for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
1085
|
+
arr[j] = arrLike[i];
|
|
1086
|
+
}
|
|
1087
|
+
return arr;
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
var joiny = function (arr, joiner) {
|
|
1091
|
+
var str = '';
|
|
1092
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
1093
|
+
str += arr[i];
|
|
1094
|
+
if (i + 1 < arr.length) {
|
|
1095
|
+
str += joiner;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return str;
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
implementation = function bind(that) {
|
|
1102
|
+
var target = this;
|
|
1103
|
+
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
|
|
1104
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
1105
|
+
}
|
|
1106
|
+
var args = slicy(arguments, 1);
|
|
1107
|
+
|
|
1108
|
+
var bound;
|
|
1109
|
+
var binder = function () {
|
|
1110
|
+
if (this instanceof bound) {
|
|
1111
|
+
var result = target.apply(
|
|
1112
|
+
this,
|
|
1113
|
+
concatty(args, arguments)
|
|
1114
|
+
);
|
|
1115
|
+
if (Object(result) === result) {
|
|
1116
|
+
return result;
|
|
1117
|
+
}
|
|
1118
|
+
return this;
|
|
1119
|
+
}
|
|
1120
|
+
return target.apply(
|
|
1121
|
+
that,
|
|
1122
|
+
concatty(args, arguments)
|
|
1123
|
+
);
|
|
1124
|
+
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
var boundLength = max(0, target.length - args.length);
|
|
1128
|
+
var boundArgs = [];
|
|
1129
|
+
for (var i = 0; i < boundLength; i++) {
|
|
1130
|
+
boundArgs[i] = '$' + i;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
1134
|
+
|
|
1135
|
+
if (target.prototype) {
|
|
1136
|
+
var Empty = function Empty() {};
|
|
1137
|
+
Empty.prototype = target.prototype;
|
|
1138
|
+
bound.prototype = new Empty();
|
|
1139
|
+
Empty.prototype = null;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
return bound;
|
|
1143
|
+
};
|
|
1144
|
+
return implementation;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
var functionBind;
|
|
1148
|
+
var hasRequiredFunctionBind;
|
|
1149
|
+
|
|
1150
|
+
function requireFunctionBind () {
|
|
1151
|
+
if (hasRequiredFunctionBind) return functionBind;
|
|
1152
|
+
hasRequiredFunctionBind = 1;
|
|
1153
|
+
|
|
1154
|
+
var implementation = requireImplementation();
|
|
1155
|
+
|
|
1156
|
+
functionBind = Function.prototype.bind || implementation;
|
|
1157
|
+
return functionBind;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
var functionCall;
|
|
1161
|
+
var hasRequiredFunctionCall;
|
|
1162
|
+
|
|
1163
|
+
function requireFunctionCall () {
|
|
1164
|
+
if (hasRequiredFunctionCall) return functionCall;
|
|
1165
|
+
hasRequiredFunctionCall = 1;
|
|
1166
|
+
|
|
1167
|
+
/** @type {import('./functionCall')} */
|
|
1168
|
+
functionCall = Function.prototype.call;
|
|
1169
|
+
return functionCall;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
var functionApply;
|
|
1173
|
+
var hasRequiredFunctionApply;
|
|
1174
|
+
|
|
1175
|
+
function requireFunctionApply () {
|
|
1176
|
+
if (hasRequiredFunctionApply) return functionApply;
|
|
1177
|
+
hasRequiredFunctionApply = 1;
|
|
1178
|
+
|
|
1179
|
+
/** @type {import('./functionApply')} */
|
|
1180
|
+
functionApply = Function.prototype.apply;
|
|
1181
|
+
return functionApply;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
var reflectApply;
|
|
1185
|
+
var hasRequiredReflectApply;
|
|
1186
|
+
|
|
1187
|
+
function requireReflectApply () {
|
|
1188
|
+
if (hasRequiredReflectApply) return reflectApply;
|
|
1189
|
+
hasRequiredReflectApply = 1;
|
|
1190
|
+
|
|
1191
|
+
/** @type {import('./reflectApply')} */
|
|
1192
|
+
reflectApply = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
|
|
1193
|
+
return reflectApply;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
var actualApply;
|
|
1197
|
+
var hasRequiredActualApply;
|
|
1198
|
+
|
|
1199
|
+
function requireActualApply () {
|
|
1200
|
+
if (hasRequiredActualApply) return actualApply;
|
|
1201
|
+
hasRequiredActualApply = 1;
|
|
1202
|
+
|
|
1203
|
+
var bind = requireFunctionBind();
|
|
1204
|
+
|
|
1205
|
+
var $apply = requireFunctionApply();
|
|
1206
|
+
var $call = requireFunctionCall();
|
|
1207
|
+
var $reflectApply = requireReflectApply();
|
|
1208
|
+
|
|
1209
|
+
/** @type {import('./actualApply')} */
|
|
1210
|
+
actualApply = $reflectApply || bind.call($call, $apply);
|
|
1211
|
+
return actualApply;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
var callBindApplyHelpers;
|
|
1215
|
+
var hasRequiredCallBindApplyHelpers;
|
|
1216
|
+
|
|
1217
|
+
function requireCallBindApplyHelpers () {
|
|
1218
|
+
if (hasRequiredCallBindApplyHelpers) return callBindApplyHelpers;
|
|
1219
|
+
hasRequiredCallBindApplyHelpers = 1;
|
|
1220
|
+
|
|
1221
|
+
var bind = requireFunctionBind();
|
|
1222
|
+
var $TypeError = /*@__PURE__*/ requireType();
|
|
1223
|
+
|
|
1224
|
+
var $call = requireFunctionCall();
|
|
1225
|
+
var $actualApply = requireActualApply();
|
|
1226
|
+
|
|
1227
|
+
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
|
|
1228
|
+
callBindApplyHelpers = function callBindBasic(args) {
|
|
1229
|
+
if (args.length < 1 || typeof args[0] !== 'function') {
|
|
1230
|
+
throw new $TypeError('a function is required');
|
|
1231
|
+
}
|
|
1232
|
+
return $actualApply(bind, $call, args);
|
|
1233
|
+
};
|
|
1234
|
+
return callBindApplyHelpers;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
var get;
|
|
1238
|
+
var hasRequiredGet;
|
|
1239
|
+
|
|
1240
|
+
function requireGet () {
|
|
1241
|
+
if (hasRequiredGet) return get;
|
|
1242
|
+
hasRequiredGet = 1;
|
|
1243
|
+
|
|
1244
|
+
var callBind = requireCallBindApplyHelpers();
|
|
1245
|
+
var gOPD = /*@__PURE__*/ requireGopd();
|
|
1246
|
+
|
|
1247
|
+
var hasProtoAccessor;
|
|
1248
|
+
try {
|
|
1249
|
+
// eslint-disable-next-line no-extra-parens, no-proto
|
|
1250
|
+
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
|
|
1251
|
+
} catch (e) {
|
|
1252
|
+
if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
|
|
1253
|
+
throw e;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
// eslint-disable-next-line no-extra-parens
|
|
1258
|
+
var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
|
|
1259
|
+
|
|
1260
|
+
var $Object = Object;
|
|
1261
|
+
var $getPrototypeOf = $Object.getPrototypeOf;
|
|
1262
|
+
|
|
1263
|
+
/** @type {import('./get')} */
|
|
1264
|
+
get = desc && typeof desc.get === 'function'
|
|
1265
|
+
? callBind([desc.get])
|
|
1266
|
+
: typeof $getPrototypeOf === 'function'
|
|
1267
|
+
? /** @type {import('./get')} */ function getDunder(value) {
|
|
1268
|
+
// eslint-disable-next-line eqeqeq
|
|
1269
|
+
return $getPrototypeOf(value == null ? value : $Object(value));
|
|
1270
|
+
}
|
|
1271
|
+
: false;
|
|
1272
|
+
return get;
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
var getProto;
|
|
1276
|
+
var hasRequiredGetProto;
|
|
1277
|
+
|
|
1278
|
+
function requireGetProto () {
|
|
1279
|
+
if (hasRequiredGetProto) return getProto;
|
|
1280
|
+
hasRequiredGetProto = 1;
|
|
1281
|
+
|
|
1282
|
+
var reflectGetProto = requireReflect_getPrototypeOf();
|
|
1283
|
+
var originalGetProto = requireObject_getPrototypeOf();
|
|
1284
|
+
|
|
1285
|
+
var getDunderProto = /*@__PURE__*/ requireGet();
|
|
1286
|
+
|
|
1287
|
+
/** @type {import('.')} */
|
|
1288
|
+
getProto = reflectGetProto
|
|
1289
|
+
? function getProto(O) {
|
|
1290
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1291
|
+
return reflectGetProto(O);
|
|
1292
|
+
}
|
|
1293
|
+
: originalGetProto
|
|
1294
|
+
? function getProto(O) {
|
|
1295
|
+
if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
|
|
1296
|
+
throw new TypeError('getProto: not an object');
|
|
1297
|
+
}
|
|
1298
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1299
|
+
return originalGetProto(O);
|
|
1300
|
+
}
|
|
1301
|
+
: getDunderProto
|
|
1302
|
+
? function getProto(O) {
|
|
1303
|
+
// @ts-expect-error TS can't narrow inside a closure, for some reason
|
|
1304
|
+
return getDunderProto(O);
|
|
1305
|
+
}
|
|
1306
|
+
: null;
|
|
1307
|
+
return getProto;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
var hasown;
|
|
1311
|
+
var hasRequiredHasown;
|
|
1312
|
+
|
|
1313
|
+
function requireHasown () {
|
|
1314
|
+
if (hasRequiredHasown) return hasown;
|
|
1315
|
+
hasRequiredHasown = 1;
|
|
1316
|
+
|
|
1317
|
+
var call = Function.prototype.call;
|
|
1318
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
1319
|
+
var bind = requireFunctionBind();
|
|
1320
|
+
|
|
1321
|
+
/** @type {import('.')} */
|
|
1322
|
+
hasown = bind.call(call, $hasOwn);
|
|
1323
|
+
return hasown;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
var getIntrinsic;
|
|
1327
|
+
var hasRequiredGetIntrinsic;
|
|
1328
|
+
|
|
1329
|
+
function requireGetIntrinsic () {
|
|
1330
|
+
if (hasRequiredGetIntrinsic) return getIntrinsic;
|
|
1331
|
+
hasRequiredGetIntrinsic = 1;
|
|
1332
|
+
|
|
1333
|
+
var undefined$1;
|
|
1334
|
+
|
|
1335
|
+
var $Object = /*@__PURE__*/ requireEsObjectAtoms();
|
|
1336
|
+
|
|
1337
|
+
var $Error = /*@__PURE__*/ requireEsErrors();
|
|
1338
|
+
var $EvalError = /*@__PURE__*/ require_eval();
|
|
1339
|
+
var $RangeError = /*@__PURE__*/ requireRange();
|
|
1340
|
+
var $ReferenceError = /*@__PURE__*/ requireRef();
|
|
1341
|
+
var $SyntaxError = /*@__PURE__*/ requireSyntax();
|
|
1342
|
+
var $TypeError = /*@__PURE__*/ requireType();
|
|
1343
|
+
var $URIError = /*@__PURE__*/ requireUri();
|
|
1344
|
+
|
|
1345
|
+
var abs = /*@__PURE__*/ requireAbs();
|
|
1346
|
+
var floor = /*@__PURE__*/ requireFloor();
|
|
1347
|
+
var max = /*@__PURE__*/ requireMax();
|
|
1348
|
+
var min = /*@__PURE__*/ requireMin();
|
|
1349
|
+
var pow = /*@__PURE__*/ requirePow();
|
|
1350
|
+
var round = /*@__PURE__*/ requireRound();
|
|
1351
|
+
var sign = /*@__PURE__*/ requireSign();
|
|
1352
|
+
|
|
1353
|
+
var $Function = Function;
|
|
1354
|
+
|
|
1355
|
+
// eslint-disable-next-line consistent-return
|
|
1356
|
+
var getEvalledConstructor = function (expressionSyntax) {
|
|
1357
|
+
try {
|
|
1358
|
+
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
|
1359
|
+
} catch (e) {}
|
|
1360
|
+
};
|
|
1361
|
+
|
|
1362
|
+
var $gOPD = /*@__PURE__*/ requireGopd();
|
|
1363
|
+
var $defineProperty = /*@__PURE__*/ requireEsDefineProperty();
|
|
1364
|
+
|
|
1365
|
+
var throwTypeError = function () {
|
|
1366
|
+
throw new $TypeError();
|
|
1367
|
+
};
|
|
1368
|
+
var ThrowTypeError = $gOPD
|
|
1369
|
+
? (function () {
|
|
1370
|
+
try {
|
|
1371
|
+
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
1372
|
+
arguments.callee; // IE 8 does not throw here
|
|
1373
|
+
return throwTypeError;
|
|
1374
|
+
} catch (calleeThrows) {
|
|
1375
|
+
try {
|
|
1376
|
+
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
1377
|
+
return $gOPD(arguments, 'callee').get;
|
|
1378
|
+
} catch (gOPDthrows) {
|
|
1379
|
+
return throwTypeError;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}())
|
|
1383
|
+
: throwTypeError;
|
|
1384
|
+
|
|
1385
|
+
var hasSymbols = requireHasSymbols()();
|
|
1386
|
+
|
|
1387
|
+
var getProto = requireGetProto();
|
|
1388
|
+
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
1389
|
+
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
1390
|
+
|
|
1391
|
+
var $apply = requireFunctionApply();
|
|
1392
|
+
var $call = requireFunctionCall();
|
|
1393
|
+
|
|
1394
|
+
var needsEval = {};
|
|
1395
|
+
|
|
1396
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
1397
|
+
|
|
1398
|
+
var INTRINSICS = {
|
|
1399
|
+
__proto__: null,
|
|
1400
|
+
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
|
1401
|
+
'%Array%': Array,
|
|
1402
|
+
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
|
1403
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
1404
|
+
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
|
1405
|
+
'%AsyncFunction%': needsEval,
|
|
1406
|
+
'%AsyncGenerator%': needsEval,
|
|
1407
|
+
'%AsyncGeneratorFunction%': needsEval,
|
|
1408
|
+
'%AsyncIteratorPrototype%': needsEval,
|
|
1409
|
+
'%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
|
|
1410
|
+
'%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
|
|
1411
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
|
|
1412
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
|
|
1413
|
+
'%Boolean%': Boolean,
|
|
1414
|
+
'%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
|
|
1415
|
+
'%Date%': Date,
|
|
1416
|
+
'%decodeURI%': decodeURI,
|
|
1417
|
+
'%decodeURIComponent%': decodeURIComponent,
|
|
1418
|
+
'%encodeURI%': encodeURI,
|
|
1419
|
+
'%encodeURIComponent%': encodeURIComponent,
|
|
1420
|
+
'%Error%': $Error,
|
|
1421
|
+
'%eval%': eval, // eslint-disable-line no-eval
|
|
1422
|
+
'%EvalError%': $EvalError,
|
|
1423
|
+
'%Float16Array%': typeof Float16Array === 'undefined' ? undefined$1 : Float16Array,
|
|
1424
|
+
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
|
1425
|
+
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
|
1426
|
+
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
|
|
1427
|
+
'%Function%': $Function,
|
|
1428
|
+
'%GeneratorFunction%': needsEval,
|
|
1429
|
+
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
|
|
1430
|
+
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
|
|
1431
|
+
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
|
1432
|
+
'%isFinite%': isFinite,
|
|
1433
|
+
'%isNaN%': isNaN,
|
|
1434
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
1435
|
+
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
|
1436
|
+
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
|
1437
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
1438
|
+
'%Math%': Math,
|
|
1439
|
+
'%Number%': Number,
|
|
1440
|
+
'%Object%': $Object,
|
|
1441
|
+
'%Object.getOwnPropertyDescriptor%': $gOPD,
|
|
1442
|
+
'%parseFloat%': parseFloat,
|
|
1443
|
+
'%parseInt%': parseInt,
|
|
1444
|
+
'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
|
|
1445
|
+
'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
|
|
1446
|
+
'%RangeError%': $RangeError,
|
|
1447
|
+
'%ReferenceError%': $ReferenceError,
|
|
1448
|
+
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
|
1449
|
+
'%RegExp%': RegExp,
|
|
1450
|
+
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
|
1451
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
1452
|
+
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
|
1453
|
+
'%String%': String,
|
|
1454
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
1455
|
+
'%Symbol%': hasSymbols ? Symbol : undefined$1,
|
|
1456
|
+
'%SyntaxError%': $SyntaxError,
|
|
1457
|
+
'%ThrowTypeError%': ThrowTypeError,
|
|
1458
|
+
'%TypedArray%': TypedArray,
|
|
1459
|
+
'%TypeError%': $TypeError,
|
|
1460
|
+
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
|
|
1461
|
+
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
|
|
1462
|
+
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
|
|
1463
|
+
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
|
|
1464
|
+
'%URIError%': $URIError,
|
|
1465
|
+
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
|
|
1466
|
+
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
|
|
1467
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet,
|
|
1468
|
+
|
|
1469
|
+
'%Function.prototype.call%': $call,
|
|
1470
|
+
'%Function.prototype.apply%': $apply,
|
|
1471
|
+
'%Object.defineProperty%': $defineProperty,
|
|
1472
|
+
'%Object.getPrototypeOf%': $ObjectGPO,
|
|
1473
|
+
'%Math.abs%': abs,
|
|
1474
|
+
'%Math.floor%': floor,
|
|
1475
|
+
'%Math.max%': max,
|
|
1476
|
+
'%Math.min%': min,
|
|
1477
|
+
'%Math.pow%': pow,
|
|
1478
|
+
'%Math.round%': round,
|
|
1479
|
+
'%Math.sign%': sign,
|
|
1480
|
+
'%Reflect.getPrototypeOf%': $ReflectGPO
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1483
|
+
if (getProto) {
|
|
1484
|
+
try {
|
|
1485
|
+
null.error; // eslint-disable-line no-unused-expressions
|
|
1486
|
+
} catch (e) {
|
|
1487
|
+
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
|
|
1488
|
+
var errorProto = getProto(getProto(e));
|
|
1489
|
+
INTRINSICS['%Error.prototype%'] = errorProto;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
var doEval = function doEval(name) {
|
|
1494
|
+
var value;
|
|
1495
|
+
if (name === '%AsyncFunction%') {
|
|
1496
|
+
value = getEvalledConstructor('async function () {}');
|
|
1497
|
+
} else if (name === '%GeneratorFunction%') {
|
|
1498
|
+
value = getEvalledConstructor('function* () {}');
|
|
1499
|
+
} else if (name === '%AsyncGeneratorFunction%') {
|
|
1500
|
+
value = getEvalledConstructor('async function* () {}');
|
|
1501
|
+
} else if (name === '%AsyncGenerator%') {
|
|
1502
|
+
var fn = doEval('%AsyncGeneratorFunction%');
|
|
1503
|
+
if (fn) {
|
|
1504
|
+
value = fn.prototype;
|
|
1505
|
+
}
|
|
1506
|
+
} else if (name === '%AsyncIteratorPrototype%') {
|
|
1507
|
+
var gen = doEval('%AsyncGenerator%');
|
|
1508
|
+
if (gen && getProto) {
|
|
1509
|
+
value = getProto(gen.prototype);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
INTRINSICS[name] = value;
|
|
1514
|
+
|
|
1515
|
+
return value;
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
var LEGACY_ALIASES = {
|
|
1519
|
+
__proto__: null,
|
|
1520
|
+
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
1521
|
+
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
1522
|
+
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
1523
|
+
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
|
1524
|
+
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
|
1525
|
+
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
|
1526
|
+
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
|
1527
|
+
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
|
1528
|
+
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
|
1529
|
+
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
|
1530
|
+
'%DataViewPrototype%': ['DataView', 'prototype'],
|
|
1531
|
+
'%DatePrototype%': ['Date', 'prototype'],
|
|
1532
|
+
'%ErrorPrototype%': ['Error', 'prototype'],
|
|
1533
|
+
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
|
1534
|
+
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
|
1535
|
+
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
|
1536
|
+
'%FunctionPrototype%': ['Function', 'prototype'],
|
|
1537
|
+
'%Generator%': ['GeneratorFunction', 'prototype'],
|
|
1538
|
+
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
|
1539
|
+
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
|
1540
|
+
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
|
1541
|
+
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
|
1542
|
+
'%JSONParse%': ['JSON', 'parse'],
|
|
1543
|
+
'%JSONStringify%': ['JSON', 'stringify'],
|
|
1544
|
+
'%MapPrototype%': ['Map', 'prototype'],
|
|
1545
|
+
'%NumberPrototype%': ['Number', 'prototype'],
|
|
1546
|
+
'%ObjectPrototype%': ['Object', 'prototype'],
|
|
1547
|
+
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
|
1548
|
+
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
|
1549
|
+
'%PromisePrototype%': ['Promise', 'prototype'],
|
|
1550
|
+
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
|
1551
|
+
'%Promise_all%': ['Promise', 'all'],
|
|
1552
|
+
'%Promise_reject%': ['Promise', 'reject'],
|
|
1553
|
+
'%Promise_resolve%': ['Promise', 'resolve'],
|
|
1554
|
+
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
|
1555
|
+
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
|
1556
|
+
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
|
1557
|
+
'%SetPrototype%': ['Set', 'prototype'],
|
|
1558
|
+
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
|
1559
|
+
'%StringPrototype%': ['String', 'prototype'],
|
|
1560
|
+
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
|
1561
|
+
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
|
1562
|
+
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
|
1563
|
+
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
|
1564
|
+
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
|
1565
|
+
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
|
1566
|
+
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
|
1567
|
+
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
|
1568
|
+
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
|
1569
|
+
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
|
1570
|
+
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
1571
|
+
};
|
|
1572
|
+
|
|
1573
|
+
var bind = requireFunctionBind();
|
|
1574
|
+
var hasOwn = /*@__PURE__*/ requireHasown();
|
|
1575
|
+
var $concat = bind.call($call, Array.prototype.concat);
|
|
1576
|
+
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
1577
|
+
var $replace = bind.call($call, String.prototype.replace);
|
|
1578
|
+
var $strSlice = bind.call($call, String.prototype.slice);
|
|
1579
|
+
var $exec = bind.call($call, RegExp.prototype.exec);
|
|
1580
|
+
|
|
1581
|
+
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
1582
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
1583
|
+
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
|
1584
|
+
var stringToPath = function stringToPath(string) {
|
|
1585
|
+
var first = $strSlice(string, 0, 1);
|
|
1586
|
+
var last = $strSlice(string, -1);
|
|
1587
|
+
if (first === '%' && last !== '%') {
|
|
1588
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
|
1589
|
+
} else if (last === '%' && first !== '%') {
|
|
1590
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
|
1591
|
+
}
|
|
1592
|
+
var result = [];
|
|
1593
|
+
$replace(string, rePropName, function (match, number, quote, subString) {
|
|
1594
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
|
1595
|
+
});
|
|
1596
|
+
return result;
|
|
1597
|
+
};
|
|
1598
|
+
/* end adaptation */
|
|
1599
|
+
|
|
1600
|
+
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
1601
|
+
var intrinsicName = name;
|
|
1602
|
+
var alias;
|
|
1603
|
+
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
1604
|
+
alias = LEGACY_ALIASES[intrinsicName];
|
|
1605
|
+
intrinsicName = '%' + alias[0] + '%';
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
if (hasOwn(INTRINSICS, intrinsicName)) {
|
|
1609
|
+
var value = INTRINSICS[intrinsicName];
|
|
1610
|
+
if (value === needsEval) {
|
|
1611
|
+
value = doEval(intrinsicName);
|
|
1612
|
+
}
|
|
1613
|
+
if (typeof value === 'undefined' && !allowMissing) {
|
|
1614
|
+
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
return {
|
|
1618
|
+
alias: alias,
|
|
1619
|
+
name: intrinsicName,
|
|
1620
|
+
value: value
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
|
1625
|
+
};
|
|
1626
|
+
|
|
1627
|
+
getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
1628
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
1629
|
+
throw new $TypeError('intrinsic name must be a non-empty string');
|
|
1630
|
+
}
|
|
1631
|
+
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
1632
|
+
throw new $TypeError('"allowMissing" argument must be a boolean');
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
1636
|
+
throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
|
1637
|
+
}
|
|
1638
|
+
var parts = stringToPath(name);
|
|
1639
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
1640
|
+
|
|
1641
|
+
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
|
1642
|
+
var intrinsicRealName = intrinsic.name;
|
|
1643
|
+
var value = intrinsic.value;
|
|
1644
|
+
var skipFurtherCaching = false;
|
|
1645
|
+
|
|
1646
|
+
var alias = intrinsic.alias;
|
|
1647
|
+
if (alias) {
|
|
1648
|
+
intrinsicBaseName = alias[0];
|
|
1649
|
+
$spliceApply(parts, $concat([0, 1], alias));
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
1653
|
+
var part = parts[i];
|
|
1654
|
+
var first = $strSlice(part, 0, 1);
|
|
1655
|
+
var last = $strSlice(part, -1);
|
|
1656
|
+
if (
|
|
1657
|
+
(
|
|
1658
|
+
(first === '"' || first === "'" || first === '`')
|
|
1659
|
+
|| (last === '"' || last === "'" || last === '`')
|
|
1660
|
+
)
|
|
1661
|
+
&& first !== last
|
|
1662
|
+
) {
|
|
1663
|
+
throw new $SyntaxError('property names with quotes must have matching quotes');
|
|
1664
|
+
}
|
|
1665
|
+
if (part === 'constructor' || !isOwn) {
|
|
1666
|
+
skipFurtherCaching = true;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
intrinsicBaseName += '.' + part;
|
|
1670
|
+
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
|
1671
|
+
|
|
1672
|
+
if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
|
1673
|
+
value = INTRINSICS[intrinsicRealName];
|
|
1674
|
+
} else if (value != null) {
|
|
1675
|
+
if (!(part in value)) {
|
|
1676
|
+
if (!allowMissing) {
|
|
1677
|
+
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
1678
|
+
}
|
|
1679
|
+
return void undefined$1;
|
|
1680
|
+
}
|
|
1681
|
+
if ($gOPD && (i + 1) >= parts.length) {
|
|
1682
|
+
var desc = $gOPD(value, part);
|
|
1683
|
+
isOwn = !!desc;
|
|
1684
|
+
|
|
1685
|
+
// By convention, when a data property is converted to an accessor
|
|
1686
|
+
// property to emulate a data property that does not suffer from
|
|
1687
|
+
// the override mistake, that accessor's getter is marked with
|
|
1688
|
+
// an `originalValue` property. Here, when we detect this, we
|
|
1689
|
+
// uphold the illusion by pretending to see that original data
|
|
1690
|
+
// property, i.e., returning the value rather than the getter
|
|
1691
|
+
// itself.
|
|
1692
|
+
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
|
1693
|
+
value = desc.get;
|
|
1694
|
+
} else {
|
|
1695
|
+
value = value[part];
|
|
1696
|
+
}
|
|
1697
|
+
} else {
|
|
1698
|
+
isOwn = hasOwn(value, part);
|
|
1699
|
+
value = value[part];
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
if (isOwn && !skipFurtherCaching) {
|
|
1703
|
+
INTRINSICS[intrinsicRealName] = value;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
return value;
|
|
1708
|
+
};
|
|
1709
|
+
return getIntrinsic;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
var callBound;
|
|
1713
|
+
var hasRequiredCallBound;
|
|
1714
|
+
|
|
1715
|
+
function requireCallBound () {
|
|
1716
|
+
if (hasRequiredCallBound) return callBound;
|
|
1717
|
+
hasRequiredCallBound = 1;
|
|
1718
|
+
|
|
1719
|
+
var GetIntrinsic = /*@__PURE__*/ requireGetIntrinsic();
|
|
1720
|
+
|
|
1721
|
+
var callBindBasic = requireCallBindApplyHelpers();
|
|
1722
|
+
|
|
1723
|
+
/** @type {(thisArg: string, searchString: string, position?: number) => number} */
|
|
1724
|
+
var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
|
|
1725
|
+
|
|
1726
|
+
/** @type {import('.')} */
|
|
1727
|
+
callBound = function callBoundIntrinsic(name, allowMissing) {
|
|
1728
|
+
/* eslint no-extra-parens: 0 */
|
|
1729
|
+
|
|
1730
|
+
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
|
|
1731
|
+
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
1732
|
+
return callBindBasic(/** @type {const} */ ([intrinsic]));
|
|
1733
|
+
}
|
|
1734
|
+
return intrinsic;
|
|
1735
|
+
};
|
|
1736
|
+
return callBound;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
var sideChannelMap;
|
|
1740
|
+
var hasRequiredSideChannelMap;
|
|
1741
|
+
|
|
1742
|
+
function requireSideChannelMap () {
|
|
1743
|
+
if (hasRequiredSideChannelMap) return sideChannelMap;
|
|
1744
|
+
hasRequiredSideChannelMap = 1;
|
|
1745
|
+
|
|
1746
|
+
var GetIntrinsic = /*@__PURE__*/ requireGetIntrinsic();
|
|
1747
|
+
var callBound = /*@__PURE__*/ requireCallBound();
|
|
1748
|
+
var inspect = /*@__PURE__*/ requireObjectInspect();
|
|
1749
|
+
|
|
1750
|
+
var $TypeError = /*@__PURE__*/ requireType();
|
|
1751
|
+
var $Map = GetIntrinsic('%Map%', true);
|
|
1752
|
+
|
|
1753
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => V} */
|
|
1754
|
+
var $mapGet = callBound('Map.prototype.get', true);
|
|
1755
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K, value: V) => void} */
|
|
1756
|
+
var $mapSet = callBound('Map.prototype.set', true);
|
|
1757
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */
|
|
1758
|
+
var $mapHas = callBound('Map.prototype.has', true);
|
|
1759
|
+
/** @type {<K, V>(thisArg: Map<K, V>, key: K) => boolean} */
|
|
1760
|
+
var $mapDelete = callBound('Map.prototype.delete', true);
|
|
1761
|
+
/** @type {<K, V>(thisArg: Map<K, V>) => number} */
|
|
1762
|
+
var $mapSize = callBound('Map.prototype.size', true);
|
|
1763
|
+
|
|
1764
|
+
/** @type {import('.')} */
|
|
1765
|
+
sideChannelMap = !!$Map && /** @type {Exclude<import('.'), false>} */ function getSideChannelMap() {
|
|
1766
|
+
/** @typedef {ReturnType<typeof getSideChannelMap>} Channel */
|
|
1767
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
1768
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
1769
|
+
|
|
1770
|
+
/** @type {Map<K, V> | undefined} */ var $m;
|
|
1771
|
+
|
|
1772
|
+
/** @type {Channel} */
|
|
1773
|
+
var channel = {
|
|
1774
|
+
assert: function (key) {
|
|
1775
|
+
if (!channel.has(key)) {
|
|
1776
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
1777
|
+
}
|
|
1778
|
+
},
|
|
1779
|
+
'delete': function (key) {
|
|
1780
|
+
if ($m) {
|
|
1781
|
+
var result = $mapDelete($m, key);
|
|
1782
|
+
if ($mapSize($m) === 0) {
|
|
1783
|
+
$m = void undefined;
|
|
1784
|
+
}
|
|
1785
|
+
return result;
|
|
1786
|
+
}
|
|
1787
|
+
return false;
|
|
1788
|
+
},
|
|
1789
|
+
get: function (key) { // eslint-disable-line consistent-return
|
|
1790
|
+
if ($m) {
|
|
1791
|
+
return $mapGet($m, key);
|
|
1792
|
+
}
|
|
1793
|
+
},
|
|
1794
|
+
has: function (key) {
|
|
1795
|
+
if ($m) {
|
|
1796
|
+
return $mapHas($m, key);
|
|
1797
|
+
}
|
|
1798
|
+
return false;
|
|
1799
|
+
},
|
|
1800
|
+
set: function (key, value) {
|
|
1801
|
+
if (!$m) {
|
|
1802
|
+
// @ts-expect-error TS can't handle narrowing a variable inside a closure
|
|
1803
|
+
$m = new $Map();
|
|
1804
|
+
}
|
|
1805
|
+
$mapSet($m, key, value);
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1808
|
+
|
|
1809
|
+
// @ts-expect-error TODO: figure out why TS is erroring here
|
|
1810
|
+
return channel;
|
|
1811
|
+
};
|
|
1812
|
+
return sideChannelMap;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
var sideChannelWeakmap;
|
|
1816
|
+
var hasRequiredSideChannelWeakmap;
|
|
1817
|
+
|
|
1818
|
+
function requireSideChannelWeakmap () {
|
|
1819
|
+
if (hasRequiredSideChannelWeakmap) return sideChannelWeakmap;
|
|
1820
|
+
hasRequiredSideChannelWeakmap = 1;
|
|
1821
|
+
|
|
1822
|
+
var GetIntrinsic = /*@__PURE__*/ requireGetIntrinsic();
|
|
1823
|
+
var callBound = /*@__PURE__*/ requireCallBound();
|
|
1824
|
+
var inspect = /*@__PURE__*/ requireObjectInspect();
|
|
1825
|
+
var getSideChannelMap = requireSideChannelMap();
|
|
1826
|
+
|
|
1827
|
+
var $TypeError = /*@__PURE__*/ requireType();
|
|
1828
|
+
var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
|
1829
|
+
|
|
1830
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => V} */
|
|
1831
|
+
var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
|
1832
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K, value: V) => void} */
|
|
1833
|
+
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
|
1834
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
|
|
1835
|
+
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
|
1836
|
+
/** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
|
|
1837
|
+
var $weakMapDelete = callBound('WeakMap.prototype.delete', true);
|
|
1838
|
+
|
|
1839
|
+
/** @type {import('.')} */
|
|
1840
|
+
sideChannelWeakmap = $WeakMap
|
|
1841
|
+
? /** @type {Exclude<import('.'), false>} */ function getSideChannelWeakMap() {
|
|
1842
|
+
/** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel */
|
|
1843
|
+
/** @typedef {Parameters<Channel['get']>[0]} K */
|
|
1844
|
+
/** @typedef {Parameters<Channel['set']>[1]} V */
|
|
1845
|
+
|
|
1846
|
+
/** @type {WeakMap<K & object, V> | undefined} */ var $wm;
|
|
1847
|
+
/** @type {Channel | undefined} */ var $m;
|
|
1848
|
+
|
|
1849
|
+
/** @type {Channel} */
|
|
1850
|
+
var channel = {
|
|
1851
|
+
assert: function (key) {
|
|
1852
|
+
if (!channel.has(key)) {
|
|
1853
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
'delete': function (key) {
|
|
1857
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1858
|
+
if ($wm) {
|
|
1859
|
+
return $weakMapDelete($wm, key);
|
|
1860
|
+
}
|
|
1861
|
+
} else if (getSideChannelMap) {
|
|
1862
|
+
if ($m) {
|
|
1863
|
+
return $m['delete'](key);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
return false;
|
|
1867
|
+
},
|
|
1868
|
+
get: function (key) {
|
|
1869
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1870
|
+
if ($wm) {
|
|
1871
|
+
return $weakMapGet($wm, key);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
return $m && $m.get(key);
|
|
1875
|
+
},
|
|
1876
|
+
has: function (key) {
|
|
1877
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1878
|
+
if ($wm) {
|
|
1879
|
+
return $weakMapHas($wm, key);
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
return !!$m && $m.has(key);
|
|
1883
|
+
},
|
|
1884
|
+
set: function (key, value) {
|
|
1885
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1886
|
+
if (!$wm) {
|
|
1887
|
+
$wm = new $WeakMap();
|
|
1888
|
+
}
|
|
1889
|
+
$weakMapSet($wm, key, value);
|
|
1890
|
+
} else if (getSideChannelMap) {
|
|
1891
|
+
if (!$m) {
|
|
1892
|
+
$m = getSideChannelMap();
|
|
1893
|
+
}
|
|
1894
|
+
// eslint-disable-next-line no-extra-parens
|
|
1895
|
+
/** @type {NonNullable<typeof $m>} */ ($m).set(key, value);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
};
|
|
1899
|
+
|
|
1900
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
1901
|
+
return channel;
|
|
1902
|
+
}
|
|
1903
|
+
: getSideChannelMap;
|
|
1904
|
+
return sideChannelWeakmap;
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
var sideChannel;
|
|
1908
|
+
var hasRequiredSideChannel;
|
|
1909
|
+
|
|
1910
|
+
function requireSideChannel () {
|
|
1911
|
+
if (hasRequiredSideChannel) return sideChannel;
|
|
1912
|
+
hasRequiredSideChannel = 1;
|
|
1913
|
+
|
|
1914
|
+
var $TypeError = /*@__PURE__*/ requireType();
|
|
1915
|
+
var inspect = /*@__PURE__*/ requireObjectInspect();
|
|
1916
|
+
var getSideChannelList = requireSideChannelList();
|
|
1917
|
+
var getSideChannelMap = requireSideChannelMap();
|
|
1918
|
+
var getSideChannelWeakMap = requireSideChannelWeakmap();
|
|
1919
|
+
|
|
1920
|
+
var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList;
|
|
1921
|
+
|
|
1922
|
+
/** @type {import('.')} */
|
|
1923
|
+
sideChannel = function getSideChannel() {
|
|
1924
|
+
/** @typedef {ReturnType<typeof getSideChannel>} Channel */
|
|
1925
|
+
|
|
1926
|
+
/** @type {Channel | undefined} */ var $channelData;
|
|
1927
|
+
|
|
1928
|
+
/** @type {Channel} */
|
|
1929
|
+
var channel = {
|
|
1930
|
+
assert: function (key) {
|
|
1931
|
+
if (!channel.has(key)) {
|
|
1932
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1935
|
+
'delete': function (key) {
|
|
1936
|
+
return !!$channelData && $channelData['delete'](key);
|
|
1937
|
+
},
|
|
1938
|
+
get: function (key) {
|
|
1939
|
+
return $channelData && $channelData.get(key);
|
|
1940
|
+
},
|
|
1941
|
+
has: function (key) {
|
|
1942
|
+
return !!$channelData && $channelData.has(key);
|
|
1943
|
+
},
|
|
1944
|
+
set: function (key, value) {
|
|
1945
|
+
if (!$channelData) {
|
|
1946
|
+
$channelData = makeChannel();
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
$channelData.set(key, value);
|
|
1950
|
+
}
|
|
1951
|
+
};
|
|
1952
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
1953
|
+
return channel;
|
|
1954
|
+
};
|
|
1955
|
+
return sideChannel;
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
var formats;
|
|
1959
|
+
var hasRequiredFormats;
|
|
1960
|
+
|
|
1961
|
+
function requireFormats () {
|
|
1962
|
+
if (hasRequiredFormats) return formats;
|
|
1963
|
+
hasRequiredFormats = 1;
|
|
1964
|
+
|
|
1965
|
+
var replace = String.prototype.replace;
|
|
1966
|
+
var percentTwenties = /%20/g;
|
|
1967
|
+
|
|
1968
|
+
var Format = {
|
|
1969
|
+
RFC1738: 'RFC1738',
|
|
1970
|
+
RFC3986: 'RFC3986'
|
|
1971
|
+
};
|
|
1972
|
+
|
|
1973
|
+
formats = {
|
|
1974
|
+
'default': Format.RFC3986,
|
|
1975
|
+
formatters: {
|
|
1976
|
+
RFC1738: function (value) {
|
|
1977
|
+
return replace.call(value, percentTwenties, '+');
|
|
1978
|
+
},
|
|
1979
|
+
RFC3986: function (value) {
|
|
1980
|
+
return String(value);
|
|
1981
|
+
}
|
|
1982
|
+
},
|
|
1983
|
+
RFC1738: Format.RFC1738,
|
|
1984
|
+
RFC3986: Format.RFC3986
|
|
1985
|
+
};
|
|
1986
|
+
return formats;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
var utils;
|
|
1990
|
+
var hasRequiredUtils;
|
|
1991
|
+
|
|
1992
|
+
function requireUtils () {
|
|
1993
|
+
if (hasRequiredUtils) return utils;
|
|
1994
|
+
hasRequiredUtils = 1;
|
|
1995
|
+
|
|
1996
|
+
var formats = /*@__PURE__*/ requireFormats();
|
|
1997
|
+
|
|
1998
|
+
var has = Object.prototype.hasOwnProperty;
|
|
1999
|
+
var isArray = Array.isArray;
|
|
2000
|
+
|
|
2001
|
+
var hexTable = (function () {
|
|
2002
|
+
var array = [];
|
|
2003
|
+
for (var i = 0; i < 256; ++i) {
|
|
2004
|
+
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
return array;
|
|
2008
|
+
}());
|
|
2009
|
+
|
|
2010
|
+
var compactQueue = function compactQueue(queue) {
|
|
2011
|
+
while (queue.length > 1) {
|
|
2012
|
+
var item = queue.pop();
|
|
2013
|
+
var obj = item.obj[item.prop];
|
|
2014
|
+
|
|
2015
|
+
if (isArray(obj)) {
|
|
2016
|
+
var compacted = [];
|
|
2017
|
+
|
|
2018
|
+
for (var j = 0; j < obj.length; ++j) {
|
|
2019
|
+
if (typeof obj[j] !== 'undefined') {
|
|
2020
|
+
compacted.push(obj[j]);
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
item.obj[item.prop] = compacted;
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
|
|
2029
|
+
var arrayToObject = function arrayToObject(source, options) {
|
|
2030
|
+
var obj = options && options.plainObjects ? { __proto__: null } : {};
|
|
2031
|
+
for (var i = 0; i < source.length; ++i) {
|
|
2032
|
+
if (typeof source[i] !== 'undefined') {
|
|
2033
|
+
obj[i] = source[i];
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
return obj;
|
|
2038
|
+
};
|
|
2039
|
+
|
|
2040
|
+
var merge = function merge(target, source, options) {
|
|
2041
|
+
/* eslint no-param-reassign: 0 */
|
|
2042
|
+
if (!source) {
|
|
2043
|
+
return target;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
if (typeof source !== 'object' && typeof source !== 'function') {
|
|
2047
|
+
if (isArray(target)) {
|
|
2048
|
+
target.push(source);
|
|
2049
|
+
} else if (target && typeof target === 'object') {
|
|
2050
|
+
if (
|
|
2051
|
+
(options && (options.plainObjects || options.allowPrototypes))
|
|
2052
|
+
|| !has.call(Object.prototype, source)
|
|
2053
|
+
) {
|
|
2054
|
+
target[source] = true;
|
|
2055
|
+
}
|
|
2056
|
+
} else {
|
|
2057
|
+
return [target, source];
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
return target;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
if (!target || typeof target !== 'object') {
|
|
2064
|
+
return [target].concat(source);
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
var mergeTarget = target;
|
|
2068
|
+
if (isArray(target) && !isArray(source)) {
|
|
2069
|
+
mergeTarget = arrayToObject(target, options);
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
if (isArray(target) && isArray(source)) {
|
|
2073
|
+
source.forEach(function (item, i) {
|
|
2074
|
+
if (has.call(target, i)) {
|
|
2075
|
+
var targetItem = target[i];
|
|
2076
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
2077
|
+
target[i] = merge(targetItem, item, options);
|
|
2078
|
+
} else {
|
|
2079
|
+
target.push(item);
|
|
2080
|
+
}
|
|
2081
|
+
} else {
|
|
2082
|
+
target[i] = item;
|
|
2083
|
+
}
|
|
2084
|
+
});
|
|
2085
|
+
return target;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
2089
|
+
var value = source[key];
|
|
2090
|
+
|
|
2091
|
+
if (has.call(acc, key)) {
|
|
2092
|
+
acc[key] = merge(acc[key], value, options);
|
|
2093
|
+
} else {
|
|
2094
|
+
acc[key] = value;
|
|
2095
|
+
}
|
|
2096
|
+
return acc;
|
|
2097
|
+
}, mergeTarget);
|
|
2098
|
+
};
|
|
2099
|
+
|
|
2100
|
+
var assign = function assignSingleSource(target, source) {
|
|
2101
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
2102
|
+
acc[key] = source[key];
|
|
2103
|
+
return acc;
|
|
2104
|
+
}, target);
|
|
2105
|
+
};
|
|
2106
|
+
|
|
2107
|
+
var decode = function (str, defaultDecoder, charset) {
|
|
2108
|
+
var strWithoutPlus = str.replace(/\+/g, ' ');
|
|
2109
|
+
if (charset === 'iso-8859-1') {
|
|
2110
|
+
// unescape never throws, no try...catch needed:
|
|
2111
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
2112
|
+
}
|
|
2113
|
+
// utf-8
|
|
2114
|
+
try {
|
|
2115
|
+
return decodeURIComponent(strWithoutPlus);
|
|
2116
|
+
} catch (e) {
|
|
2117
|
+
return strWithoutPlus;
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
|
|
2121
|
+
var limit = 1024;
|
|
2122
|
+
|
|
2123
|
+
/* eslint operator-linebreak: [2, "before"] */
|
|
2124
|
+
|
|
2125
|
+
var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
2126
|
+
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
|
2127
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
|
2128
|
+
if (str.length === 0) {
|
|
2129
|
+
return str;
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
var string = str;
|
|
2133
|
+
if (typeof str === 'symbol') {
|
|
2134
|
+
string = Symbol.prototype.toString.call(str);
|
|
2135
|
+
} else if (typeof str !== 'string') {
|
|
2136
|
+
string = String(str);
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
if (charset === 'iso-8859-1') {
|
|
2140
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
2141
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
2142
|
+
});
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
var out = '';
|
|
2146
|
+
for (var j = 0; j < string.length; j += limit) {
|
|
2147
|
+
var segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
2148
|
+
var arr = [];
|
|
2149
|
+
|
|
2150
|
+
for (var i = 0; i < segment.length; ++i) {
|
|
2151
|
+
var c = segment.charCodeAt(i);
|
|
2152
|
+
if (
|
|
2153
|
+
c === 0x2D // -
|
|
2154
|
+
|| c === 0x2E // .
|
|
2155
|
+
|| c === 0x5F // _
|
|
2156
|
+
|| c === 0x7E // ~
|
|
2157
|
+
|| (c >= 0x30 && c <= 0x39) // 0-9
|
|
2158
|
+
|| (c >= 0x41 && c <= 0x5A) // a-z
|
|
2159
|
+
|| (c >= 0x61 && c <= 0x7A) // A-Z
|
|
2160
|
+
|| (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
2161
|
+
) {
|
|
2162
|
+
arr[arr.length] = segment.charAt(i);
|
|
2163
|
+
continue;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
if (c < 0x80) {
|
|
2167
|
+
arr[arr.length] = hexTable[c];
|
|
2168
|
+
continue;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
if (c < 0x800) {
|
|
2172
|
+
arr[arr.length] = hexTable[0xC0 | (c >> 6)]
|
|
2173
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
2174
|
+
continue;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
if (c < 0xD800 || c >= 0xE000) {
|
|
2178
|
+
arr[arr.length] = hexTable[0xE0 | (c >> 12)]
|
|
2179
|
+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
2180
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
2181
|
+
continue;
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
i += 1;
|
|
2185
|
+
c = 0x10000 + (((c & 0x3FF) << 10) | (segment.charCodeAt(i) & 0x3FF));
|
|
2186
|
+
|
|
2187
|
+
arr[arr.length] = hexTable[0xF0 | (c >> 18)]
|
|
2188
|
+
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
2189
|
+
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
2190
|
+
+ hexTable[0x80 | (c & 0x3F)];
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
out += arr.join('');
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
return out;
|
|
2197
|
+
};
|
|
2198
|
+
|
|
2199
|
+
var compact = function compact(value) {
|
|
2200
|
+
var queue = [{ obj: { o: value }, prop: 'o' }];
|
|
2201
|
+
var refs = [];
|
|
2202
|
+
|
|
2203
|
+
for (var i = 0; i < queue.length; ++i) {
|
|
2204
|
+
var item = queue[i];
|
|
2205
|
+
var obj = item.obj[item.prop];
|
|
2206
|
+
|
|
2207
|
+
var keys = Object.keys(obj);
|
|
2208
|
+
for (var j = 0; j < keys.length; ++j) {
|
|
2209
|
+
var key = keys[j];
|
|
2210
|
+
var val = obj[key];
|
|
2211
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
2212
|
+
queue.push({ obj: obj, prop: key });
|
|
2213
|
+
refs.push(val);
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
compactQueue(queue);
|
|
2219
|
+
|
|
2220
|
+
return value;
|
|
2221
|
+
};
|
|
2222
|
+
|
|
2223
|
+
var isRegExp = function isRegExp(obj) {
|
|
2224
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
2225
|
+
};
|
|
2226
|
+
|
|
2227
|
+
var isBuffer = function isBuffer(obj) {
|
|
2228
|
+
if (!obj || typeof obj !== 'object') {
|
|
2229
|
+
return false;
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
2233
|
+
};
|
|
2234
|
+
|
|
2235
|
+
var combine = function combine(a, b) {
|
|
2236
|
+
return [].concat(a, b);
|
|
2237
|
+
};
|
|
2238
|
+
|
|
2239
|
+
var maybeMap = function maybeMap(val, fn) {
|
|
2240
|
+
if (isArray(val)) {
|
|
2241
|
+
var mapped = [];
|
|
2242
|
+
for (var i = 0; i < val.length; i += 1) {
|
|
2243
|
+
mapped.push(fn(val[i]));
|
|
2244
|
+
}
|
|
2245
|
+
return mapped;
|
|
2246
|
+
}
|
|
2247
|
+
return fn(val);
|
|
2248
|
+
};
|
|
2249
|
+
|
|
2250
|
+
utils = {
|
|
2251
|
+
arrayToObject: arrayToObject,
|
|
2252
|
+
assign: assign,
|
|
2253
|
+
combine: combine,
|
|
2254
|
+
compact: compact,
|
|
2255
|
+
decode: decode,
|
|
2256
|
+
encode: encode,
|
|
2257
|
+
isBuffer: isBuffer,
|
|
2258
|
+
isRegExp: isRegExp,
|
|
2259
|
+
maybeMap: maybeMap,
|
|
2260
|
+
merge: merge
|
|
2261
|
+
};
|
|
2262
|
+
return utils;
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
var stringify_1;
|
|
2266
|
+
var hasRequiredStringify;
|
|
2267
|
+
|
|
2268
|
+
function requireStringify () {
|
|
2269
|
+
if (hasRequiredStringify) return stringify_1;
|
|
2270
|
+
hasRequiredStringify = 1;
|
|
2271
|
+
|
|
2272
|
+
var getSideChannel = requireSideChannel();
|
|
2273
|
+
var utils = /*@__PURE__*/ requireUtils();
|
|
2274
|
+
var formats = /*@__PURE__*/ requireFormats();
|
|
2275
|
+
var has = Object.prototype.hasOwnProperty;
|
|
2276
|
+
|
|
2277
|
+
var arrayPrefixGenerators = {
|
|
2278
|
+
brackets: function brackets(prefix) {
|
|
2279
|
+
return prefix + '[]';
|
|
2280
|
+
},
|
|
2281
|
+
comma: 'comma',
|
|
2282
|
+
indices: function indices(prefix, key) {
|
|
2283
|
+
return prefix + '[' + key + ']';
|
|
2284
|
+
},
|
|
2285
|
+
repeat: function repeat(prefix) {
|
|
2286
|
+
return prefix;
|
|
2287
|
+
}
|
|
2288
|
+
};
|
|
2289
|
+
|
|
2290
|
+
var isArray = Array.isArray;
|
|
2291
|
+
var push = Array.prototype.push;
|
|
2292
|
+
var pushToArray = function (arr, valueOrArray) {
|
|
2293
|
+
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
2294
|
+
};
|
|
2295
|
+
|
|
2296
|
+
var toISO = Date.prototype.toISOString;
|
|
2297
|
+
|
|
2298
|
+
var defaultFormat = formats['default'];
|
|
2299
|
+
var defaults = {
|
|
2300
|
+
addQueryPrefix: false,
|
|
2301
|
+
allowDots: false,
|
|
2302
|
+
allowEmptyArrays: false,
|
|
2303
|
+
arrayFormat: 'indices',
|
|
2304
|
+
charset: 'utf-8',
|
|
2305
|
+
charsetSentinel: false,
|
|
2306
|
+
commaRoundTrip: false,
|
|
2307
|
+
delimiter: '&',
|
|
2308
|
+
encode: true,
|
|
2309
|
+
encodeDotInKeys: false,
|
|
2310
|
+
encoder: utils.encode,
|
|
2311
|
+
encodeValuesOnly: false,
|
|
2312
|
+
filter: void undefined,
|
|
2313
|
+
format: defaultFormat,
|
|
2314
|
+
formatter: formats.formatters[defaultFormat],
|
|
2315
|
+
// deprecated
|
|
2316
|
+
indices: false,
|
|
2317
|
+
serializeDate: function serializeDate(date) {
|
|
2318
|
+
return toISO.call(date);
|
|
2319
|
+
},
|
|
2320
|
+
skipNulls: false,
|
|
2321
|
+
strictNullHandling: false
|
|
2322
|
+
};
|
|
2323
|
+
|
|
2324
|
+
var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
|
2325
|
+
return typeof v === 'string'
|
|
2326
|
+
|| typeof v === 'number'
|
|
2327
|
+
|| typeof v === 'boolean'
|
|
2328
|
+
|| typeof v === 'symbol'
|
|
2329
|
+
|| typeof v === 'bigint';
|
|
2330
|
+
};
|
|
2331
|
+
|
|
2332
|
+
var sentinel = {};
|
|
2333
|
+
|
|
2334
|
+
var stringify = function stringify(
|
|
2335
|
+
object,
|
|
2336
|
+
prefix,
|
|
2337
|
+
generateArrayPrefix,
|
|
2338
|
+
commaRoundTrip,
|
|
2339
|
+
allowEmptyArrays,
|
|
2340
|
+
strictNullHandling,
|
|
2341
|
+
skipNulls,
|
|
2342
|
+
encodeDotInKeys,
|
|
2343
|
+
encoder,
|
|
2344
|
+
filter,
|
|
2345
|
+
sort,
|
|
2346
|
+
allowDots,
|
|
2347
|
+
serializeDate,
|
|
2348
|
+
format,
|
|
2349
|
+
formatter,
|
|
2350
|
+
encodeValuesOnly,
|
|
2351
|
+
charset,
|
|
2352
|
+
sideChannel
|
|
2353
|
+
) {
|
|
2354
|
+
var obj = object;
|
|
2355
|
+
|
|
2356
|
+
var tmpSc = sideChannel;
|
|
2357
|
+
var step = 0;
|
|
2358
|
+
var findFlag = false;
|
|
2359
|
+
while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
|
2360
|
+
// Where object last appeared in the ref tree
|
|
2361
|
+
var pos = tmpSc.get(object);
|
|
2362
|
+
step += 1;
|
|
2363
|
+
if (typeof pos !== 'undefined') {
|
|
2364
|
+
if (pos === step) {
|
|
2365
|
+
throw new RangeError('Cyclic object value');
|
|
2366
|
+
} else {
|
|
2367
|
+
findFlag = true; // Break while
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
|
2371
|
+
step = 0;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
if (typeof filter === 'function') {
|
|
2376
|
+
obj = filter(prefix, obj);
|
|
2377
|
+
} else if (obj instanceof Date) {
|
|
2378
|
+
obj = serializeDate(obj);
|
|
2379
|
+
} else if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
|
2380
|
+
obj = utils.maybeMap(obj, function (value) {
|
|
2381
|
+
if (value instanceof Date) {
|
|
2382
|
+
return serializeDate(value);
|
|
2383
|
+
}
|
|
2384
|
+
return value;
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
if (obj === null) {
|
|
2389
|
+
if (strictNullHandling) {
|
|
2390
|
+
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
obj = '';
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
2397
|
+
if (encoder) {
|
|
2398
|
+
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
|
2399
|
+
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
2400
|
+
}
|
|
2401
|
+
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
var values = [];
|
|
2405
|
+
|
|
2406
|
+
if (typeof obj === 'undefined') {
|
|
2407
|
+
return values;
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
var objKeys;
|
|
2411
|
+
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
|
2412
|
+
// we need to join elements in
|
|
2413
|
+
if (encodeValuesOnly && encoder) {
|
|
2414
|
+
obj = utils.maybeMap(obj, encoder);
|
|
2415
|
+
}
|
|
2416
|
+
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
|
2417
|
+
} else if (isArray(filter)) {
|
|
2418
|
+
objKeys = filter;
|
|
2419
|
+
} else {
|
|
2420
|
+
var keys = Object.keys(obj);
|
|
2421
|
+
objKeys = sort ? keys.sort(sort) : keys;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix);
|
|
2425
|
+
|
|
2426
|
+
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;
|
|
2427
|
+
|
|
2428
|
+
if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
|
|
2429
|
+
return adjustedPrefix + '[]';
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
for (var j = 0; j < objKeys.length; ++j) {
|
|
2433
|
+
var key = objKeys[j];
|
|
2434
|
+
var value = typeof key === 'object' && key && typeof key.value !== 'undefined'
|
|
2435
|
+
? key.value
|
|
2436
|
+
: obj[key];
|
|
2437
|
+
|
|
2438
|
+
if (skipNulls && value === null) {
|
|
2439
|
+
continue;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
var encodedKey = allowDots && encodeDotInKeys ? String(key).replace(/\./g, '%2E') : String(key);
|
|
2443
|
+
var keyPrefix = isArray(obj)
|
|
2444
|
+
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix
|
|
2445
|
+
: adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']');
|
|
2446
|
+
|
|
2447
|
+
sideChannel.set(object, step);
|
|
2448
|
+
var valueSideChannel = getSideChannel();
|
|
2449
|
+
valueSideChannel.set(sentinel, sideChannel);
|
|
2450
|
+
pushToArray(values, stringify(
|
|
2451
|
+
value,
|
|
2452
|
+
keyPrefix,
|
|
2453
|
+
generateArrayPrefix,
|
|
2454
|
+
commaRoundTrip,
|
|
2455
|
+
allowEmptyArrays,
|
|
2456
|
+
strictNullHandling,
|
|
2457
|
+
skipNulls,
|
|
2458
|
+
encodeDotInKeys,
|
|
2459
|
+
generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder,
|
|
2460
|
+
filter,
|
|
2461
|
+
sort,
|
|
2462
|
+
allowDots,
|
|
2463
|
+
serializeDate,
|
|
2464
|
+
format,
|
|
2465
|
+
formatter,
|
|
2466
|
+
encodeValuesOnly,
|
|
2467
|
+
charset,
|
|
2468
|
+
valueSideChannel
|
|
2469
|
+
));
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
return values;
|
|
2473
|
+
};
|
|
2474
|
+
|
|
2475
|
+
var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
|
2476
|
+
if (!opts) {
|
|
2477
|
+
return defaults;
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
2481
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') {
|
|
2485
|
+
throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
2489
|
+
throw new TypeError('Encoder has to be a function.');
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
var charset = opts.charset || defaults.charset;
|
|
2493
|
+
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
2494
|
+
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
var format = formats['default'];
|
|
2498
|
+
if (typeof opts.format !== 'undefined') {
|
|
2499
|
+
if (!has.call(formats.formatters, opts.format)) {
|
|
2500
|
+
throw new TypeError('Unknown format option provided.');
|
|
2501
|
+
}
|
|
2502
|
+
format = opts.format;
|
|
2503
|
+
}
|
|
2504
|
+
var formatter = formats.formatters[format];
|
|
2505
|
+
|
|
2506
|
+
var filter = defaults.filter;
|
|
2507
|
+
if (typeof opts.filter === 'function' || isArray(opts.filter)) {
|
|
2508
|
+
filter = opts.filter;
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
var arrayFormat;
|
|
2512
|
+
if (opts.arrayFormat in arrayPrefixGenerators) {
|
|
2513
|
+
arrayFormat = opts.arrayFormat;
|
|
2514
|
+
} else if ('indices' in opts) {
|
|
2515
|
+
arrayFormat = opts.indices ? 'indices' : 'repeat';
|
|
2516
|
+
} else {
|
|
2517
|
+
arrayFormat = defaults.arrayFormat;
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
2521
|
+
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
var allowDots = typeof opts.allowDots === 'undefined' ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
|
|
2525
|
+
|
|
2526
|
+
return {
|
|
2527
|
+
addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
|
|
2528
|
+
allowDots: allowDots,
|
|
2529
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
2530
|
+
arrayFormat: arrayFormat,
|
|
2531
|
+
charset: charset,
|
|
2532
|
+
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
2533
|
+
commaRoundTrip: !!opts.commaRoundTrip,
|
|
2534
|
+
delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
|
|
2535
|
+
encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
|
|
2536
|
+
encodeDotInKeys: typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
|
|
2537
|
+
encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
|
|
2538
|
+
encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
|
|
2539
|
+
filter: filter,
|
|
2540
|
+
format: format,
|
|
2541
|
+
formatter: formatter,
|
|
2542
|
+
serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
|
|
2543
|
+
skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
|
|
2544
|
+
sort: typeof opts.sort === 'function' ? opts.sort : null,
|
|
2545
|
+
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
|
|
2546
|
+
};
|
|
2547
|
+
};
|
|
2548
|
+
|
|
2549
|
+
stringify_1 = function (object, opts) {
|
|
2550
|
+
var obj = object;
|
|
2551
|
+
var options = normalizeStringifyOptions(opts);
|
|
2552
|
+
|
|
2553
|
+
var objKeys;
|
|
2554
|
+
var filter;
|
|
2555
|
+
|
|
2556
|
+
if (typeof options.filter === 'function') {
|
|
2557
|
+
filter = options.filter;
|
|
2558
|
+
obj = filter('', obj);
|
|
2559
|
+
} else if (isArray(options.filter)) {
|
|
2560
|
+
filter = options.filter;
|
|
2561
|
+
objKeys = filter;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
var keys = [];
|
|
2565
|
+
|
|
2566
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
2567
|
+
return '';
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
|
|
2571
|
+
var commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip;
|
|
2572
|
+
|
|
2573
|
+
if (!objKeys) {
|
|
2574
|
+
objKeys = Object.keys(obj);
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
if (options.sort) {
|
|
2578
|
+
objKeys.sort(options.sort);
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
var sideChannel = getSideChannel();
|
|
2582
|
+
for (var i = 0; i < objKeys.length; ++i) {
|
|
2583
|
+
var key = objKeys[i];
|
|
2584
|
+
var value = obj[key];
|
|
2585
|
+
|
|
2586
|
+
if (options.skipNulls && value === null) {
|
|
2587
|
+
continue;
|
|
2588
|
+
}
|
|
2589
|
+
pushToArray(keys, stringify(
|
|
2590
|
+
value,
|
|
2591
|
+
key,
|
|
2592
|
+
generateArrayPrefix,
|
|
2593
|
+
commaRoundTrip,
|
|
2594
|
+
options.allowEmptyArrays,
|
|
2595
|
+
options.strictNullHandling,
|
|
2596
|
+
options.skipNulls,
|
|
2597
|
+
options.encodeDotInKeys,
|
|
2598
|
+
options.encode ? options.encoder : null,
|
|
2599
|
+
options.filter,
|
|
2600
|
+
options.sort,
|
|
2601
|
+
options.allowDots,
|
|
2602
|
+
options.serializeDate,
|
|
2603
|
+
options.format,
|
|
2604
|
+
options.formatter,
|
|
2605
|
+
options.encodeValuesOnly,
|
|
2606
|
+
options.charset,
|
|
2607
|
+
sideChannel
|
|
2608
|
+
));
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
var joined = keys.join(options.delimiter);
|
|
2612
|
+
var prefix = options.addQueryPrefix === true ? '?' : '';
|
|
2613
|
+
|
|
2614
|
+
if (options.charsetSentinel) {
|
|
2615
|
+
if (options.charset === 'iso-8859-1') {
|
|
2616
|
+
// encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
|
2617
|
+
prefix += 'utf8=%26%2310003%3B&';
|
|
2618
|
+
} else {
|
|
2619
|
+
// encodeURIComponent('✓')
|
|
2620
|
+
prefix += 'utf8=%E2%9C%93&';
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
return joined.length > 0 ? prefix + joined : '';
|
|
2625
|
+
};
|
|
2626
|
+
return stringify_1;
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
var parse;
|
|
2630
|
+
var hasRequiredParse;
|
|
2631
|
+
|
|
2632
|
+
function requireParse () {
|
|
2633
|
+
if (hasRequiredParse) return parse;
|
|
2634
|
+
hasRequiredParse = 1;
|
|
2635
|
+
|
|
2636
|
+
var utils = /*@__PURE__*/ requireUtils();
|
|
2637
|
+
|
|
2638
|
+
var has = Object.prototype.hasOwnProperty;
|
|
2639
|
+
var isArray = Array.isArray;
|
|
2640
|
+
|
|
2641
|
+
var defaults = {
|
|
2642
|
+
allowDots: false,
|
|
2643
|
+
allowEmptyArrays: false,
|
|
2644
|
+
allowPrototypes: false,
|
|
2645
|
+
allowSparse: false,
|
|
2646
|
+
arrayLimit: 20,
|
|
2647
|
+
charset: 'utf-8',
|
|
2648
|
+
charsetSentinel: false,
|
|
2649
|
+
comma: false,
|
|
2650
|
+
decodeDotInKeys: false,
|
|
2651
|
+
decoder: utils.decode,
|
|
2652
|
+
delimiter: '&',
|
|
2653
|
+
depth: 5,
|
|
2654
|
+
duplicates: 'combine',
|
|
2655
|
+
ignoreQueryPrefix: false,
|
|
2656
|
+
interpretNumericEntities: false,
|
|
2657
|
+
parameterLimit: 1000,
|
|
2658
|
+
parseArrays: true,
|
|
2659
|
+
plainObjects: false,
|
|
2660
|
+
strictDepth: false,
|
|
2661
|
+
strictNullHandling: false,
|
|
2662
|
+
throwOnLimitExceeded: false
|
|
2663
|
+
};
|
|
2664
|
+
|
|
2665
|
+
var interpretNumericEntities = function (str) {
|
|
2666
|
+
return str.replace(/&#(\d+);/g, function ($0, numberStr) {
|
|
2667
|
+
return String.fromCharCode(parseInt(numberStr, 10));
|
|
2668
|
+
});
|
|
2669
|
+
};
|
|
2670
|
+
|
|
2671
|
+
var parseArrayValue = function (val, options, currentArrayLength) {
|
|
2672
|
+
if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
|
|
2673
|
+
return val.split(',');
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
if (options.throwOnLimitExceeded && currentArrayLength >= options.arrayLimit) {
|
|
2677
|
+
throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
return val;
|
|
2681
|
+
};
|
|
2682
|
+
|
|
2683
|
+
// This is what browsers will submit when the ✓ character occurs in an
|
|
2684
|
+
// application/x-www-form-urlencoded body and the encoding of the page containing
|
|
2685
|
+
// the form is iso-8859-1, or when the submitted form has an accept-charset
|
|
2686
|
+
// attribute of iso-8859-1. Presumably also with other charsets that do not contain
|
|
2687
|
+
// the ✓ character, such as us-ascii.
|
|
2688
|
+
var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')
|
|
2689
|
+
|
|
2690
|
+
// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
|
|
2691
|
+
var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
|
|
2692
|
+
|
|
2693
|
+
var parseValues = function parseQueryStringValues(str, options) {
|
|
2694
|
+
var obj = { __proto__: null };
|
|
2695
|
+
|
|
2696
|
+
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
2697
|
+
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
2698
|
+
|
|
2699
|
+
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
2700
|
+
var parts = cleanStr.split(
|
|
2701
|
+
options.delimiter,
|
|
2702
|
+
options.throwOnLimitExceeded ? limit + 1 : limit
|
|
2703
|
+
);
|
|
2704
|
+
|
|
2705
|
+
if (options.throwOnLimitExceeded && parts.length > limit) {
|
|
2706
|
+
throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
|
2710
|
+
var i;
|
|
2711
|
+
|
|
2712
|
+
var charset = options.charset;
|
|
2713
|
+
if (options.charsetSentinel) {
|
|
2714
|
+
for (i = 0; i < parts.length; ++i) {
|
|
2715
|
+
if (parts[i].indexOf('utf8=') === 0) {
|
|
2716
|
+
if (parts[i] === charsetSentinel) {
|
|
2717
|
+
charset = 'utf-8';
|
|
2718
|
+
} else if (parts[i] === isoSentinel) {
|
|
2719
|
+
charset = 'iso-8859-1';
|
|
2720
|
+
}
|
|
2721
|
+
skipIndex = i;
|
|
2722
|
+
i = parts.length; // The eslint settings do not allow break;
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2727
|
+
for (i = 0; i < parts.length; ++i) {
|
|
2728
|
+
if (i === skipIndex) {
|
|
2729
|
+
continue;
|
|
2730
|
+
}
|
|
2731
|
+
var part = parts[i];
|
|
2732
|
+
|
|
2733
|
+
var bracketEqualsPos = part.indexOf(']=');
|
|
2734
|
+
var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
|
|
2735
|
+
|
|
2736
|
+
var key;
|
|
2737
|
+
var val;
|
|
2738
|
+
if (pos === -1) {
|
|
2739
|
+
key = options.decoder(part, defaults.decoder, charset, 'key');
|
|
2740
|
+
val = options.strictNullHandling ? null : '';
|
|
2741
|
+
} else {
|
|
2742
|
+
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
|
2743
|
+
|
|
2744
|
+
val = utils.maybeMap(
|
|
2745
|
+
parseArrayValue(
|
|
2746
|
+
part.slice(pos + 1),
|
|
2747
|
+
options,
|
|
2748
|
+
isArray(obj[key]) ? obj[key].length : 0
|
|
2749
|
+
),
|
|
2750
|
+
function (encodedVal) {
|
|
2751
|
+
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
|
2752
|
+
}
|
|
2753
|
+
);
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
|
|
2757
|
+
val = interpretNumericEntities(String(val));
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
if (part.indexOf('[]=') > -1) {
|
|
2761
|
+
val = isArray(val) ? [val] : val;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
var existing = has.call(obj, key);
|
|
2765
|
+
if (existing && options.duplicates === 'combine') {
|
|
2766
|
+
obj[key] = utils.combine(obj[key], val);
|
|
2767
|
+
} else if (!existing || options.duplicates === 'last') {
|
|
2768
|
+
obj[key] = val;
|
|
2769
|
+
}
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
return obj;
|
|
2773
|
+
};
|
|
2774
|
+
|
|
2775
|
+
var parseObject = function (chain, val, options, valuesParsed) {
|
|
2776
|
+
var currentArrayLength = 0;
|
|
2777
|
+
if (chain.length > 0 && chain[chain.length - 1] === '[]') {
|
|
2778
|
+
var parentKey = chain.slice(0, -1).join('');
|
|
2779
|
+
currentArrayLength = Array.isArray(val) && val[parentKey] ? val[parentKey].length : 0;
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
var leaf = valuesParsed ? val : parseArrayValue(val, options, currentArrayLength);
|
|
2783
|
+
|
|
2784
|
+
for (var i = chain.length - 1; i >= 0; --i) {
|
|
2785
|
+
var obj;
|
|
2786
|
+
var root = chain[i];
|
|
2787
|
+
|
|
2788
|
+
if (root === '[]' && options.parseArrays) {
|
|
2789
|
+
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
|
|
2790
|
+
? []
|
|
2791
|
+
: utils.combine([], leaf);
|
|
2792
|
+
} else {
|
|
2793
|
+
obj = options.plainObjects ? { __proto__: null } : {};
|
|
2794
|
+
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
2795
|
+
var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot;
|
|
2796
|
+
var index = parseInt(decodedRoot, 10);
|
|
2797
|
+
if (!options.parseArrays && decodedRoot === '') {
|
|
2798
|
+
obj = { 0: leaf };
|
|
2799
|
+
} else if (
|
|
2800
|
+
!isNaN(index)
|
|
2801
|
+
&& root !== decodedRoot
|
|
2802
|
+
&& String(index) === decodedRoot
|
|
2803
|
+
&& index >= 0
|
|
2804
|
+
&& (options.parseArrays && index <= options.arrayLimit)
|
|
2805
|
+
) {
|
|
2806
|
+
obj = [];
|
|
2807
|
+
obj[index] = leaf;
|
|
2808
|
+
} else if (decodedRoot !== '__proto__') {
|
|
2809
|
+
obj[decodedRoot] = leaf;
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
|
|
2813
|
+
leaf = obj;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
return leaf;
|
|
2817
|
+
};
|
|
2818
|
+
|
|
2819
|
+
var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
|
2820
|
+
if (!givenKey) {
|
|
2821
|
+
return;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
// Transform dot notation to bracket notation
|
|
2825
|
+
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
|
2826
|
+
|
|
2827
|
+
// The regex chunks
|
|
2828
|
+
|
|
2829
|
+
var brackets = /(\[[^[\]]*])/;
|
|
2830
|
+
var child = /(\[[^[\]]*])/g;
|
|
2831
|
+
|
|
2832
|
+
// Get the parent
|
|
2833
|
+
|
|
2834
|
+
var segment = options.depth > 0 && brackets.exec(key);
|
|
2835
|
+
var parent = segment ? key.slice(0, segment.index) : key;
|
|
2836
|
+
|
|
2837
|
+
// Stash the parent if it exists
|
|
2838
|
+
|
|
2839
|
+
var keys = [];
|
|
2840
|
+
if (parent) {
|
|
2841
|
+
// If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
|
|
2842
|
+
if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
|
2843
|
+
if (!options.allowPrototypes) {
|
|
2844
|
+
return;
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
keys.push(parent);
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
// Loop through children appending to the array until we hit depth
|
|
2852
|
+
|
|
2853
|
+
var i = 0;
|
|
2854
|
+
while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
|
|
2855
|
+
i += 1;
|
|
2856
|
+
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
|
|
2857
|
+
if (!options.allowPrototypes) {
|
|
2858
|
+
return;
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
keys.push(segment[1]);
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2864
|
+
// If there's a remainder, check strictDepth option for throw, else just add whatever is left
|
|
2865
|
+
|
|
2866
|
+
if (segment) {
|
|
2867
|
+
if (options.strictDepth === true) {
|
|
2868
|
+
throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
|
2869
|
+
}
|
|
2870
|
+
keys.push('[' + key.slice(segment.index) + ']');
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
return parseObject(keys, val, options, valuesParsed);
|
|
2874
|
+
};
|
|
2875
|
+
|
|
2876
|
+
var normalizeParseOptions = function normalizeParseOptions(opts) {
|
|
2877
|
+
if (!opts) {
|
|
2878
|
+
return defaults;
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') {
|
|
2882
|
+
throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided');
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2885
|
+
if (typeof opts.decodeDotInKeys !== 'undefined' && typeof opts.decodeDotInKeys !== 'boolean') {
|
|
2886
|
+
throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided');
|
|
2887
|
+
}
|
|
2888
|
+
|
|
2889
|
+
if (opts.decoder !== null && typeof opts.decoder !== 'undefined' && typeof opts.decoder !== 'function') {
|
|
2890
|
+
throw new TypeError('Decoder has to be a function.');
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
|
2894
|
+
throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
if (typeof opts.throwOnLimitExceeded !== 'undefined' && typeof opts.throwOnLimitExceeded !== 'boolean') {
|
|
2898
|
+
throw new TypeError('`throwOnLimitExceeded` option must be a boolean');
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
|
|
2902
|
+
|
|
2903
|
+
var duplicates = typeof opts.duplicates === 'undefined' ? defaults.duplicates : opts.duplicates;
|
|
2904
|
+
|
|
2905
|
+
if (duplicates !== 'combine' && duplicates !== 'first' && duplicates !== 'last') {
|
|
2906
|
+
throw new TypeError('The duplicates option must be either combine, first, or last');
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
var allowDots = typeof opts.allowDots === 'undefined' ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
|
|
2910
|
+
|
|
2911
|
+
return {
|
|
2912
|
+
allowDots: allowDots,
|
|
2913
|
+
allowEmptyArrays: typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
|
|
2914
|
+
allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
|
|
2915
|
+
allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
|
|
2916
|
+
arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
|
|
2917
|
+
charset: charset,
|
|
2918
|
+
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
2919
|
+
comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
|
|
2920
|
+
decodeDotInKeys: typeof opts.decodeDotInKeys === 'boolean' ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
|
|
2921
|
+
decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
|
|
2922
|
+
delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
|
|
2923
|
+
// eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
|
2924
|
+
depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
|
|
2925
|
+
duplicates: duplicates,
|
|
2926
|
+
ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
|
|
2927
|
+
interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
|
|
2928
|
+
parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
|
|
2929
|
+
parseArrays: opts.parseArrays !== false,
|
|
2930
|
+
plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
|
|
2931
|
+
strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
|
|
2932
|
+
strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling,
|
|
2933
|
+
throwOnLimitExceeded: typeof opts.throwOnLimitExceeded === 'boolean' ? opts.throwOnLimitExceeded : false
|
|
2934
|
+
};
|
|
2935
|
+
};
|
|
2936
|
+
|
|
2937
|
+
parse = function (str, opts) {
|
|
2938
|
+
var options = normalizeParseOptions(opts);
|
|
2939
|
+
|
|
2940
|
+
if (str === '' || str === null || typeof str === 'undefined') {
|
|
2941
|
+
return options.plainObjects ? { __proto__: null } : {};
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
|
|
2945
|
+
var obj = options.plainObjects ? { __proto__: null } : {};
|
|
2946
|
+
|
|
2947
|
+
// Iterate over the keys and setup the new object
|
|
2948
|
+
|
|
2949
|
+
var keys = Object.keys(tempObj);
|
|
2950
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
2951
|
+
var key = keys[i];
|
|
2952
|
+
var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
|
|
2953
|
+
obj = utils.merge(obj, newObj, options);
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
if (options.allowSparse === true) {
|
|
2957
|
+
return obj;
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
return utils.compact(obj);
|
|
2961
|
+
};
|
|
2962
|
+
return parse;
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
var lib;
|
|
2966
|
+
var hasRequiredLib;
|
|
2967
|
+
|
|
2968
|
+
function requireLib () {
|
|
2969
|
+
if (hasRequiredLib) return lib;
|
|
2970
|
+
hasRequiredLib = 1;
|
|
2971
|
+
|
|
2972
|
+
var stringify = /*@__PURE__*/ requireStringify();
|
|
2973
|
+
var parse = /*@__PURE__*/ requireParse();
|
|
2974
|
+
var formats = /*@__PURE__*/ requireFormats();
|
|
2975
|
+
|
|
2976
|
+
lib = {
|
|
2977
|
+
formats: formats,
|
|
2978
|
+
parse: parse,
|
|
2979
|
+
stringify: stringify
|
|
2980
|
+
};
|
|
2981
|
+
return lib;
|
|
2982
|
+
}
|
|
2983
|
+
|
|
2984
|
+
var libExports = /*@__PURE__*/ requireLib();
|
|
2985
|
+
|
|
2986
|
+
var httpErrors = {exports: {}};
|
|
2987
|
+
|
|
2988
|
+
/*!
|
|
2989
|
+
* depd
|
|
2990
|
+
* Copyright(c) 2014-2018 Douglas Christopher Wilson
|
|
2991
|
+
* MIT Licensed
|
|
2992
|
+
*/
|
|
2993
|
+
|
|
2994
|
+
var depd_1;
|
|
2995
|
+
var hasRequiredDepd;
|
|
2996
|
+
|
|
2997
|
+
function requireDepd () {
|
|
2998
|
+
if (hasRequiredDepd) return depd_1;
|
|
2999
|
+
hasRequiredDepd = 1;
|
|
3000
|
+
/**
|
|
3001
|
+
* Module dependencies.
|
|
3002
|
+
*/
|
|
3003
|
+
|
|
3004
|
+
var relative = require$$0$2.relative;
|
|
3005
|
+
|
|
3006
|
+
/**
|
|
3007
|
+
* Module exports.
|
|
3008
|
+
*/
|
|
3009
|
+
|
|
3010
|
+
depd_1 = depd;
|
|
3011
|
+
|
|
3012
|
+
/**
|
|
3013
|
+
* Get the path to base files on.
|
|
3014
|
+
*/
|
|
3015
|
+
|
|
3016
|
+
var basePath = process.cwd();
|
|
3017
|
+
|
|
3018
|
+
/**
|
|
3019
|
+
* Determine if namespace is contained in the string.
|
|
3020
|
+
*/
|
|
3021
|
+
|
|
3022
|
+
function containsNamespace (str, namespace) {
|
|
3023
|
+
var vals = str.split(/[ ,]+/);
|
|
3024
|
+
var ns = String(namespace).toLowerCase();
|
|
3025
|
+
|
|
3026
|
+
for (var i = 0; i < vals.length; i++) {
|
|
3027
|
+
var val = vals[i];
|
|
3028
|
+
|
|
3029
|
+
// namespace contained
|
|
3030
|
+
if (val && (val === '*' || val.toLowerCase() === ns)) {
|
|
3031
|
+
return true
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
return false
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
/**
|
|
3039
|
+
* Convert a data descriptor to accessor descriptor.
|
|
3040
|
+
*/
|
|
3041
|
+
|
|
3042
|
+
function convertDataDescriptorToAccessor (obj, prop, message) {
|
|
3043
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
3044
|
+
var value = descriptor.value;
|
|
3045
|
+
|
|
3046
|
+
descriptor.get = function getter () { return value };
|
|
3047
|
+
|
|
3048
|
+
if (descriptor.writable) {
|
|
3049
|
+
descriptor.set = function setter (val) { return (value = val) };
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
delete descriptor.value;
|
|
3053
|
+
delete descriptor.writable;
|
|
3054
|
+
|
|
3055
|
+
Object.defineProperty(obj, prop, descriptor);
|
|
3056
|
+
|
|
3057
|
+
return descriptor
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
/**
|
|
3061
|
+
* Create arguments string to keep arity.
|
|
3062
|
+
*/
|
|
3063
|
+
|
|
3064
|
+
function createArgumentsString (arity) {
|
|
3065
|
+
var str = '';
|
|
3066
|
+
|
|
3067
|
+
for (var i = 0; i < arity; i++) {
|
|
3068
|
+
str += ', arg' + i;
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
return str.substr(2)
|
|
3072
|
+
}
|
|
3073
|
+
|
|
3074
|
+
/**
|
|
3075
|
+
* Create stack string from stack.
|
|
3076
|
+
*/
|
|
3077
|
+
|
|
3078
|
+
function createStackString (stack) {
|
|
3079
|
+
var str = this.name + ': ' + this.namespace;
|
|
3080
|
+
|
|
3081
|
+
if (this.message) {
|
|
3082
|
+
str += ' deprecated ' + this.message;
|
|
3083
|
+
}
|
|
3084
|
+
|
|
3085
|
+
for (var i = 0; i < stack.length; i++) {
|
|
3086
|
+
str += '\n at ' + stack[i].toString();
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
return str
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
/**
|
|
3093
|
+
* Create deprecate for namespace in caller.
|
|
3094
|
+
*/
|
|
3095
|
+
|
|
3096
|
+
function depd (namespace) {
|
|
3097
|
+
if (!namespace) {
|
|
3098
|
+
throw new TypeError('argument namespace is required')
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3101
|
+
var stack = getStack();
|
|
3102
|
+
var site = callSiteLocation(stack[1]);
|
|
3103
|
+
var file = site[0];
|
|
3104
|
+
|
|
3105
|
+
function deprecate (message) {
|
|
3106
|
+
// call to self as log
|
|
3107
|
+
log.call(deprecate, message);
|
|
3108
|
+
}
|
|
3109
|
+
|
|
3110
|
+
deprecate._file = file;
|
|
3111
|
+
deprecate._ignored = isignored(namespace);
|
|
3112
|
+
deprecate._namespace = namespace;
|
|
3113
|
+
deprecate._traced = istraced(namespace);
|
|
3114
|
+
deprecate._warned = Object.create(null);
|
|
3115
|
+
|
|
3116
|
+
deprecate.function = wrapfunction;
|
|
3117
|
+
deprecate.property = wrapproperty;
|
|
3118
|
+
|
|
3119
|
+
return deprecate
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
/**
|
|
3123
|
+
* Determine if event emitter has listeners of a given type.
|
|
3124
|
+
*
|
|
3125
|
+
* The way to do this check is done three different ways in Node.js >= 0.8
|
|
3126
|
+
* so this consolidates them into a minimal set using instance methods.
|
|
3127
|
+
*
|
|
3128
|
+
* @param {EventEmitter} emitter
|
|
3129
|
+
* @param {string} type
|
|
3130
|
+
* @returns {boolean}
|
|
3131
|
+
* @private
|
|
3132
|
+
*/
|
|
3133
|
+
|
|
3134
|
+
function eehaslisteners (emitter, type) {
|
|
3135
|
+
var count = typeof emitter.listenerCount !== 'function'
|
|
3136
|
+
? emitter.listeners(type).length
|
|
3137
|
+
: emitter.listenerCount(type);
|
|
3138
|
+
|
|
3139
|
+
return count > 0
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
/**
|
|
3143
|
+
* Determine if namespace is ignored.
|
|
3144
|
+
*/
|
|
3145
|
+
|
|
3146
|
+
function isignored (namespace) {
|
|
3147
|
+
if (process.noDeprecation) {
|
|
3148
|
+
// --no-deprecation support
|
|
3149
|
+
return true
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
var str = process.env.NO_DEPRECATION || '';
|
|
3153
|
+
|
|
3154
|
+
// namespace ignored
|
|
3155
|
+
return containsNamespace(str, namespace)
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
/**
|
|
3159
|
+
* Determine if namespace is traced.
|
|
3160
|
+
*/
|
|
3161
|
+
|
|
3162
|
+
function istraced (namespace) {
|
|
3163
|
+
if (process.traceDeprecation) {
|
|
3164
|
+
// --trace-deprecation support
|
|
3165
|
+
return true
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
var str = process.env.TRACE_DEPRECATION || '';
|
|
3169
|
+
|
|
3170
|
+
// namespace traced
|
|
3171
|
+
return containsNamespace(str, namespace)
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
/**
|
|
3175
|
+
* Display deprecation message.
|
|
3176
|
+
*/
|
|
3177
|
+
|
|
3178
|
+
function log (message, site) {
|
|
3179
|
+
var haslisteners = eehaslisteners(process, 'deprecation');
|
|
3180
|
+
|
|
3181
|
+
// abort early if no destination
|
|
3182
|
+
if (!haslisteners && this._ignored) {
|
|
3183
|
+
return
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
var caller;
|
|
3187
|
+
var callFile;
|
|
3188
|
+
var callSite;
|
|
3189
|
+
var depSite;
|
|
3190
|
+
var i = 0;
|
|
3191
|
+
var seen = false;
|
|
3192
|
+
var stack = getStack();
|
|
3193
|
+
var file = this._file;
|
|
3194
|
+
|
|
3195
|
+
if (site) {
|
|
3196
|
+
// provided site
|
|
3197
|
+
depSite = site;
|
|
3198
|
+
callSite = callSiteLocation(stack[1]);
|
|
3199
|
+
callSite.name = depSite.name;
|
|
3200
|
+
file = callSite[0];
|
|
3201
|
+
} else {
|
|
3202
|
+
// get call site
|
|
3203
|
+
i = 2;
|
|
3204
|
+
depSite = callSiteLocation(stack[i]);
|
|
3205
|
+
callSite = depSite;
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
// get caller of deprecated thing in relation to file
|
|
3209
|
+
for (; i < stack.length; i++) {
|
|
3210
|
+
caller = callSiteLocation(stack[i]);
|
|
3211
|
+
callFile = caller[0];
|
|
3212
|
+
|
|
3213
|
+
if (callFile === file) {
|
|
3214
|
+
seen = true;
|
|
3215
|
+
} else if (callFile === this._file) {
|
|
3216
|
+
file = this._file;
|
|
3217
|
+
} else if (seen) {
|
|
3218
|
+
break
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
var key = caller
|
|
3223
|
+
? depSite.join(':') + '__' + caller.join(':')
|
|
3224
|
+
: undefined;
|
|
3225
|
+
|
|
3226
|
+
if (key !== undefined && key in this._warned) {
|
|
3227
|
+
// already warned
|
|
3228
|
+
return
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
this._warned[key] = true;
|
|
3232
|
+
|
|
3233
|
+
// generate automatic message from call site
|
|
3234
|
+
var msg = message;
|
|
3235
|
+
if (!msg) {
|
|
3236
|
+
msg = callSite === depSite || !callSite.name
|
|
3237
|
+
? defaultMessage(depSite)
|
|
3238
|
+
: defaultMessage(callSite);
|
|
3239
|
+
}
|
|
3240
|
+
|
|
3241
|
+
// emit deprecation if listeners exist
|
|
3242
|
+
if (haslisteners) {
|
|
3243
|
+
var err = DeprecationError(this._namespace, msg, stack.slice(i));
|
|
3244
|
+
process.emit('deprecation', err);
|
|
3245
|
+
return
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
// format and write message
|
|
3249
|
+
var format = process.stderr.isTTY
|
|
3250
|
+
? formatColor
|
|
3251
|
+
: formatPlain;
|
|
3252
|
+
var output = format.call(this, msg, caller, stack.slice(i));
|
|
3253
|
+
process.stderr.write(output + '\n', 'utf8');
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
/**
|
|
3257
|
+
* Get call site location as array.
|
|
3258
|
+
*/
|
|
3259
|
+
|
|
3260
|
+
function callSiteLocation (callSite) {
|
|
3261
|
+
var file = callSite.getFileName() || '<anonymous>';
|
|
3262
|
+
var line = callSite.getLineNumber();
|
|
3263
|
+
var colm = callSite.getColumnNumber();
|
|
3264
|
+
|
|
3265
|
+
if (callSite.isEval()) {
|
|
3266
|
+
file = callSite.getEvalOrigin() + ', ' + file;
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
var site = [file, line, colm];
|
|
3270
|
+
|
|
3271
|
+
site.callSite = callSite;
|
|
3272
|
+
site.name = callSite.getFunctionName();
|
|
3273
|
+
|
|
3274
|
+
return site
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
/**
|
|
3278
|
+
* Generate a default message from the site.
|
|
3279
|
+
*/
|
|
3280
|
+
|
|
3281
|
+
function defaultMessage (site) {
|
|
3282
|
+
var callSite = site.callSite;
|
|
3283
|
+
var funcName = site.name;
|
|
3284
|
+
|
|
3285
|
+
// make useful anonymous name
|
|
3286
|
+
if (!funcName) {
|
|
3287
|
+
funcName = '<anonymous@' + formatLocation(site) + '>';
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3290
|
+
var context = callSite.getThis();
|
|
3291
|
+
var typeName = context && callSite.getTypeName();
|
|
3292
|
+
|
|
3293
|
+
// ignore useless type name
|
|
3294
|
+
if (typeName === 'Object') {
|
|
3295
|
+
typeName = undefined;
|
|
3296
|
+
}
|
|
3297
|
+
|
|
3298
|
+
// make useful type name
|
|
3299
|
+
if (typeName === 'Function') {
|
|
3300
|
+
typeName = context.name || typeName;
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
return typeName && callSite.getMethodName()
|
|
3304
|
+
? typeName + '.' + funcName
|
|
3305
|
+
: funcName
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3308
|
+
/**
|
|
3309
|
+
* Format deprecation message without color.
|
|
3310
|
+
*/
|
|
3311
|
+
|
|
3312
|
+
function formatPlain (msg, caller, stack) {
|
|
3313
|
+
var timestamp = new Date().toUTCString();
|
|
3314
|
+
|
|
3315
|
+
var formatted = timestamp +
|
|
3316
|
+
' ' + this._namespace +
|
|
3317
|
+
' deprecated ' + msg;
|
|
3318
|
+
|
|
3319
|
+
// add stack trace
|
|
3320
|
+
if (this._traced) {
|
|
3321
|
+
for (var i = 0; i < stack.length; i++) {
|
|
3322
|
+
formatted += '\n at ' + stack[i].toString();
|
|
3323
|
+
}
|
|
3324
|
+
|
|
3325
|
+
return formatted
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
if (caller) {
|
|
3329
|
+
formatted += ' at ' + formatLocation(caller);
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
return formatted
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3335
|
+
/**
|
|
3336
|
+
* Format deprecation message with color.
|
|
3337
|
+
*/
|
|
3338
|
+
|
|
3339
|
+
function formatColor (msg, caller, stack) {
|
|
3340
|
+
var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' + // bold cyan
|
|
3341
|
+
' \x1b[33;1mdeprecated\x1b[22;39m' + // bold yellow
|
|
3342
|
+
' \x1b[0m' + msg + '\x1b[39m'; // reset
|
|
3343
|
+
|
|
3344
|
+
// add stack trace
|
|
3345
|
+
if (this._traced) {
|
|
3346
|
+
for (var i = 0; i < stack.length; i++) {
|
|
3347
|
+
formatted += '\n \x1b[36mat ' + stack[i].toString() + '\x1b[39m'; // cyan
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
return formatted
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3353
|
+
if (caller) {
|
|
3354
|
+
formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m'; // cyan
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
return formatted
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
/**
|
|
3361
|
+
* Format call site location.
|
|
3362
|
+
*/
|
|
3363
|
+
|
|
3364
|
+
function formatLocation (callSite) {
|
|
3365
|
+
return relative(basePath, callSite[0]) +
|
|
3366
|
+
':' + callSite[1] +
|
|
3367
|
+
':' + callSite[2]
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
/**
|
|
3371
|
+
* Get the stack as array of call sites.
|
|
3372
|
+
*/
|
|
3373
|
+
|
|
3374
|
+
function getStack () {
|
|
3375
|
+
var limit = Error.stackTraceLimit;
|
|
3376
|
+
var obj = {};
|
|
3377
|
+
var prep = Error.prepareStackTrace;
|
|
3378
|
+
|
|
3379
|
+
Error.prepareStackTrace = prepareObjectStackTrace;
|
|
3380
|
+
Error.stackTraceLimit = Math.max(10, limit);
|
|
3381
|
+
|
|
3382
|
+
// capture the stack
|
|
3383
|
+
Error.captureStackTrace(obj);
|
|
3384
|
+
|
|
3385
|
+
// slice this function off the top
|
|
3386
|
+
var stack = obj.stack.slice(1);
|
|
3387
|
+
|
|
3388
|
+
Error.prepareStackTrace = prep;
|
|
3389
|
+
Error.stackTraceLimit = limit;
|
|
3390
|
+
|
|
3391
|
+
return stack
|
|
3392
|
+
}
|
|
3393
|
+
|
|
3394
|
+
/**
|
|
3395
|
+
* Capture call site stack from v8.
|
|
3396
|
+
*/
|
|
3397
|
+
|
|
3398
|
+
function prepareObjectStackTrace (obj, stack) {
|
|
3399
|
+
return stack
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
/**
|
|
3403
|
+
* Return a wrapped function in a deprecation message.
|
|
3404
|
+
*/
|
|
3405
|
+
|
|
3406
|
+
function wrapfunction (fn, message) {
|
|
3407
|
+
if (typeof fn !== 'function') {
|
|
3408
|
+
throw new TypeError('argument fn must be a function')
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
var args = createArgumentsString(fn.length);
|
|
3412
|
+
var stack = getStack();
|
|
3413
|
+
var site = callSiteLocation(stack[1]);
|
|
3414
|
+
|
|
3415
|
+
site.name = fn.name;
|
|
3416
|
+
|
|
3417
|
+
// eslint-disable-next-line no-new-func
|
|
3418
|
+
var deprecatedfn = new Function('fn', 'log', 'deprecate', 'message', 'site',
|
|
3419
|
+
'"use strict"\n' +
|
|
3420
|
+
'return function (' + args + ') {' +
|
|
3421
|
+
'log.call(deprecate, message, site)\n' +
|
|
3422
|
+
'return fn.apply(this, arguments)\n' +
|
|
3423
|
+
'}')(fn, log, this, message, site);
|
|
3424
|
+
|
|
3425
|
+
return deprecatedfn
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
/**
|
|
3429
|
+
* Wrap property in a deprecation message.
|
|
3430
|
+
*/
|
|
3431
|
+
|
|
3432
|
+
function wrapproperty (obj, prop, message) {
|
|
3433
|
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
3434
|
+
throw new TypeError('argument obj must be object')
|
|
3435
|
+
}
|
|
3436
|
+
|
|
3437
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
3438
|
+
|
|
3439
|
+
if (!descriptor) {
|
|
3440
|
+
throw new TypeError('must call property on owner object')
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
if (!descriptor.configurable) {
|
|
3444
|
+
throw new TypeError('property must be configurable')
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
var deprecate = this;
|
|
3448
|
+
var stack = getStack();
|
|
3449
|
+
var site = callSiteLocation(stack[1]);
|
|
3450
|
+
|
|
3451
|
+
// set site name
|
|
3452
|
+
site.name = prop;
|
|
3453
|
+
|
|
3454
|
+
// convert data descriptor
|
|
3455
|
+
if ('value' in descriptor) {
|
|
3456
|
+
descriptor = convertDataDescriptorToAccessor(obj, prop);
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
var get = descriptor.get;
|
|
3460
|
+
var set = descriptor.set;
|
|
3461
|
+
|
|
3462
|
+
// wrap getter
|
|
3463
|
+
if (typeof get === 'function') {
|
|
3464
|
+
descriptor.get = function getter () {
|
|
3465
|
+
log.call(deprecate, message, site);
|
|
3466
|
+
return get.apply(this, arguments)
|
|
3467
|
+
};
|
|
3468
|
+
}
|
|
3469
|
+
|
|
3470
|
+
// wrap setter
|
|
3471
|
+
if (typeof set === 'function') {
|
|
3472
|
+
descriptor.set = function setter () {
|
|
3473
|
+
log.call(deprecate, message, site);
|
|
3474
|
+
return set.apply(this, arguments)
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
|
|
3478
|
+
Object.defineProperty(obj, prop, descriptor);
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3481
|
+
/**
|
|
3482
|
+
* Create DeprecationError for deprecation
|
|
3483
|
+
*/
|
|
3484
|
+
|
|
3485
|
+
function DeprecationError (namespace, message, stack) {
|
|
3486
|
+
var error = new Error();
|
|
3487
|
+
var stackString;
|
|
3488
|
+
|
|
3489
|
+
Object.defineProperty(error, 'constructor', {
|
|
3490
|
+
value: DeprecationError
|
|
3491
|
+
});
|
|
3492
|
+
|
|
3493
|
+
Object.defineProperty(error, 'message', {
|
|
3494
|
+
configurable: true,
|
|
3495
|
+
enumerable: false,
|
|
3496
|
+
value: message,
|
|
3497
|
+
writable: true
|
|
3498
|
+
});
|
|
3499
|
+
|
|
3500
|
+
Object.defineProperty(error, 'name', {
|
|
3501
|
+
enumerable: false,
|
|
3502
|
+
configurable: true,
|
|
3503
|
+
value: 'DeprecationError',
|
|
3504
|
+
writable: true
|
|
3505
|
+
});
|
|
3506
|
+
|
|
3507
|
+
Object.defineProperty(error, 'namespace', {
|
|
3508
|
+
configurable: true,
|
|
3509
|
+
enumerable: false,
|
|
3510
|
+
value: namespace,
|
|
3511
|
+
writable: true
|
|
3512
|
+
});
|
|
3513
|
+
|
|
3514
|
+
Object.defineProperty(error, 'stack', {
|
|
3515
|
+
configurable: true,
|
|
3516
|
+
enumerable: false,
|
|
3517
|
+
get: function () {
|
|
3518
|
+
if (stackString !== undefined) {
|
|
3519
|
+
return stackString
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
// prepare stack trace
|
|
3523
|
+
return (stackString = createStackString.call(this, stack))
|
|
3524
|
+
},
|
|
3525
|
+
set: function setter (val) {
|
|
3526
|
+
stackString = val;
|
|
3527
|
+
}
|
|
3528
|
+
});
|
|
3529
|
+
|
|
3530
|
+
return error
|
|
3531
|
+
}
|
|
3532
|
+
return depd_1;
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3535
|
+
var setprototypeof;
|
|
3536
|
+
var hasRequiredSetprototypeof;
|
|
3537
|
+
|
|
3538
|
+
function requireSetprototypeof () {
|
|
3539
|
+
if (hasRequiredSetprototypeof) return setprototypeof;
|
|
3540
|
+
hasRequiredSetprototypeof = 1;
|
|
3541
|
+
/* eslint no-proto: 0 */
|
|
3542
|
+
setprototypeof = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties);
|
|
3543
|
+
|
|
3544
|
+
function setProtoOf (obj, proto) {
|
|
3545
|
+
obj.__proto__ = proto;
|
|
3546
|
+
return obj
|
|
3547
|
+
}
|
|
3548
|
+
|
|
3549
|
+
function mixinProperties (obj, proto) {
|
|
3550
|
+
for (var prop in proto) {
|
|
3551
|
+
if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
|
|
3552
|
+
obj[prop] = proto[prop];
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
return obj
|
|
3556
|
+
}
|
|
3557
|
+
return setprototypeof;
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
var require$$0 = {
|
|
3561
|
+
"100": "Continue",
|
|
3562
|
+
"101": "Switching Protocols",
|
|
3563
|
+
"102": "Processing",
|
|
3564
|
+
"103": "Early Hints",
|
|
3565
|
+
"200": "OK",
|
|
3566
|
+
"201": "Created",
|
|
3567
|
+
"202": "Accepted",
|
|
3568
|
+
"203": "Non-Authoritative Information",
|
|
3569
|
+
"204": "No Content",
|
|
3570
|
+
"205": "Reset Content",
|
|
3571
|
+
"206": "Partial Content",
|
|
3572
|
+
"207": "Multi-Status",
|
|
3573
|
+
"208": "Already Reported",
|
|
3574
|
+
"226": "IM Used",
|
|
3575
|
+
"300": "Multiple Choices",
|
|
3576
|
+
"301": "Moved Permanently",
|
|
3577
|
+
"302": "Found",
|
|
3578
|
+
"303": "See Other",
|
|
3579
|
+
"304": "Not Modified",
|
|
3580
|
+
"305": "Use Proxy",
|
|
3581
|
+
"307": "Temporary Redirect",
|
|
3582
|
+
"308": "Permanent Redirect",
|
|
3583
|
+
"400": "Bad Request",
|
|
3584
|
+
"401": "Unauthorized",
|
|
3585
|
+
"402": "Payment Required",
|
|
3586
|
+
"403": "Forbidden",
|
|
3587
|
+
"404": "Not Found",
|
|
3588
|
+
"405": "Method Not Allowed",
|
|
3589
|
+
"406": "Not Acceptable",
|
|
3590
|
+
"407": "Proxy Authentication Required",
|
|
3591
|
+
"408": "Request Timeout",
|
|
3592
|
+
"409": "Conflict",
|
|
3593
|
+
"410": "Gone",
|
|
3594
|
+
"411": "Length Required",
|
|
3595
|
+
"412": "Precondition Failed",
|
|
3596
|
+
"413": "Payload Too Large",
|
|
3597
|
+
"414": "URI Too Long",
|
|
3598
|
+
"415": "Unsupported Media Type",
|
|
3599
|
+
"416": "Range Not Satisfiable",
|
|
3600
|
+
"417": "Expectation Failed",
|
|
3601
|
+
"418": "I'm a Teapot",
|
|
3602
|
+
"421": "Misdirected Request",
|
|
3603
|
+
"422": "Unprocessable Entity",
|
|
3604
|
+
"423": "Locked",
|
|
3605
|
+
"424": "Failed Dependency",
|
|
3606
|
+
"425": "Too Early",
|
|
3607
|
+
"426": "Upgrade Required",
|
|
3608
|
+
"428": "Precondition Required",
|
|
3609
|
+
"429": "Too Many Requests",
|
|
3610
|
+
"431": "Request Header Fields Too Large",
|
|
3611
|
+
"451": "Unavailable For Legal Reasons",
|
|
3612
|
+
"500": "Internal Server Error",
|
|
3613
|
+
"501": "Not Implemented",
|
|
3614
|
+
"502": "Bad Gateway",
|
|
3615
|
+
"503": "Service Unavailable",
|
|
3616
|
+
"504": "Gateway Timeout",
|
|
3617
|
+
"505": "HTTP Version Not Supported",
|
|
3618
|
+
"506": "Variant Also Negotiates",
|
|
3619
|
+
"507": "Insufficient Storage",
|
|
3620
|
+
"508": "Loop Detected",
|
|
3621
|
+
"509": "Bandwidth Limit Exceeded",
|
|
3622
|
+
"510": "Not Extended",
|
|
3623
|
+
"511": "Network Authentication Required"
|
|
3624
|
+
};
|
|
3625
|
+
|
|
3626
|
+
/*!
|
|
3627
|
+
* statuses
|
|
3628
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
3629
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
3630
|
+
* MIT Licensed
|
|
3631
|
+
*/
|
|
3632
|
+
|
|
3633
|
+
var statuses;
|
|
3634
|
+
var hasRequiredStatuses;
|
|
3635
|
+
|
|
3636
|
+
function requireStatuses () {
|
|
3637
|
+
if (hasRequiredStatuses) return statuses;
|
|
3638
|
+
hasRequiredStatuses = 1;
|
|
3639
|
+
|
|
3640
|
+
/**
|
|
3641
|
+
* Module dependencies.
|
|
3642
|
+
* @private
|
|
3643
|
+
*/
|
|
3644
|
+
|
|
3645
|
+
var codes = require$$0;
|
|
3646
|
+
|
|
3647
|
+
/**
|
|
3648
|
+
* Module exports.
|
|
3649
|
+
* @public
|
|
3650
|
+
*/
|
|
3651
|
+
|
|
3652
|
+
statuses = status;
|
|
3653
|
+
|
|
3654
|
+
// status code to message map
|
|
3655
|
+
status.message = codes;
|
|
3656
|
+
|
|
3657
|
+
// status message (lower-case) to code map
|
|
3658
|
+
status.code = createMessageToStatusCodeMap(codes);
|
|
3659
|
+
|
|
3660
|
+
// array of status codes
|
|
3661
|
+
status.codes = createStatusCodeList(codes);
|
|
3662
|
+
|
|
3663
|
+
// status codes for redirects
|
|
3664
|
+
status.redirect = {
|
|
3665
|
+
300: true,
|
|
3666
|
+
301: true,
|
|
3667
|
+
302: true,
|
|
3668
|
+
303: true,
|
|
3669
|
+
305: true,
|
|
3670
|
+
307: true,
|
|
3671
|
+
308: true
|
|
3672
|
+
};
|
|
3673
|
+
|
|
3674
|
+
// status codes for empty bodies
|
|
3675
|
+
status.empty = {
|
|
3676
|
+
204: true,
|
|
3677
|
+
205: true,
|
|
3678
|
+
304: true
|
|
3679
|
+
};
|
|
3680
|
+
|
|
3681
|
+
// status codes for when you should retry the request
|
|
3682
|
+
status.retry = {
|
|
3683
|
+
502: true,
|
|
3684
|
+
503: true,
|
|
3685
|
+
504: true
|
|
3686
|
+
};
|
|
3687
|
+
|
|
3688
|
+
/**
|
|
3689
|
+
* Create a map of message to status code.
|
|
3690
|
+
* @private
|
|
3691
|
+
*/
|
|
3692
|
+
|
|
3693
|
+
function createMessageToStatusCodeMap (codes) {
|
|
3694
|
+
var map = {};
|
|
3695
|
+
|
|
3696
|
+
Object.keys(codes).forEach(function forEachCode (code) {
|
|
3697
|
+
var message = codes[code];
|
|
3698
|
+
var status = Number(code);
|
|
3699
|
+
|
|
3700
|
+
// populate map
|
|
3701
|
+
map[message.toLowerCase()] = status;
|
|
3702
|
+
});
|
|
3703
|
+
|
|
3704
|
+
return map
|
|
3705
|
+
}
|
|
3706
|
+
|
|
3707
|
+
/**
|
|
3708
|
+
* Create a list of all status codes.
|
|
3709
|
+
* @private
|
|
3710
|
+
*/
|
|
3711
|
+
|
|
3712
|
+
function createStatusCodeList (codes) {
|
|
3713
|
+
return Object.keys(codes).map(function mapCode (code) {
|
|
3714
|
+
return Number(code)
|
|
3715
|
+
})
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
/**
|
|
3719
|
+
* Get the status code for given message.
|
|
3720
|
+
* @private
|
|
3721
|
+
*/
|
|
3722
|
+
|
|
3723
|
+
function getStatusCode (message) {
|
|
3724
|
+
var msg = message.toLowerCase();
|
|
3725
|
+
|
|
3726
|
+
if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
|
|
3727
|
+
throw new Error('invalid status message: "' + message + '"')
|
|
3728
|
+
}
|
|
3729
|
+
|
|
3730
|
+
return status.code[msg]
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
/**
|
|
3734
|
+
* Get the status message for given code.
|
|
3735
|
+
* @private
|
|
3736
|
+
*/
|
|
3737
|
+
|
|
3738
|
+
function getStatusMessage (code) {
|
|
3739
|
+
if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
|
|
3740
|
+
throw new Error('invalid status code: ' + code)
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
return status.message[code]
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
/**
|
|
3747
|
+
* Get the status code.
|
|
3748
|
+
*
|
|
3749
|
+
* Given a number, this will throw if it is not a known status
|
|
3750
|
+
* code, otherwise the code will be returned. Given a string,
|
|
3751
|
+
* the string will be parsed for a number and return the code
|
|
3752
|
+
* if valid, otherwise will lookup the code assuming this is
|
|
3753
|
+
* the status message.
|
|
3754
|
+
*
|
|
3755
|
+
* @param {string|number} code
|
|
3756
|
+
* @returns {number}
|
|
3757
|
+
* @public
|
|
3758
|
+
*/
|
|
3759
|
+
|
|
3760
|
+
function status (code) {
|
|
3761
|
+
if (typeof code === 'number') {
|
|
3762
|
+
return getStatusMessage(code)
|
|
3763
|
+
}
|
|
3764
|
+
|
|
3765
|
+
if (typeof code !== 'string') {
|
|
3766
|
+
throw new TypeError('code must be a number or string')
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
// '403'
|
|
3770
|
+
var n = parseInt(code, 10);
|
|
3771
|
+
if (!isNaN(n)) {
|
|
3772
|
+
return getStatusMessage(n)
|
|
3773
|
+
}
|
|
3774
|
+
|
|
3775
|
+
return getStatusCode(code)
|
|
3776
|
+
}
|
|
3777
|
+
return statuses;
|
|
3778
|
+
}
|
|
3779
|
+
|
|
3780
|
+
var inherits = {exports: {}};
|
|
3781
|
+
|
|
3782
|
+
var inherits_browser = {exports: {}};
|
|
3783
|
+
|
|
3784
|
+
var hasRequiredInherits_browser;
|
|
3785
|
+
|
|
3786
|
+
function requireInherits_browser () {
|
|
3787
|
+
if (hasRequiredInherits_browser) return inherits_browser.exports;
|
|
3788
|
+
hasRequiredInherits_browser = 1;
|
|
3789
|
+
if (typeof Object.create === 'function') {
|
|
3790
|
+
// implementation from standard node.js 'util' module
|
|
3791
|
+
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
3792
|
+
if (superCtor) {
|
|
3793
|
+
ctor.super_ = superCtor;
|
|
3794
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
3795
|
+
constructor: {
|
|
3796
|
+
value: ctor,
|
|
3797
|
+
enumerable: false,
|
|
3798
|
+
writable: true,
|
|
3799
|
+
configurable: true
|
|
3800
|
+
}
|
|
3801
|
+
});
|
|
3802
|
+
}
|
|
3803
|
+
};
|
|
3804
|
+
} else {
|
|
3805
|
+
// old school shim for old browsers
|
|
3806
|
+
inherits_browser.exports = function inherits(ctor, superCtor) {
|
|
3807
|
+
if (superCtor) {
|
|
3808
|
+
ctor.super_ = superCtor;
|
|
3809
|
+
var TempCtor = function () {};
|
|
3810
|
+
TempCtor.prototype = superCtor.prototype;
|
|
3811
|
+
ctor.prototype = new TempCtor();
|
|
3812
|
+
ctor.prototype.constructor = ctor;
|
|
3813
|
+
}
|
|
3814
|
+
};
|
|
3815
|
+
}
|
|
3816
|
+
return inherits_browser.exports;
|
|
3817
|
+
}
|
|
3818
|
+
|
|
3819
|
+
var hasRequiredInherits;
|
|
3820
|
+
|
|
3821
|
+
function requireInherits () {
|
|
3822
|
+
if (hasRequiredInherits) return inherits.exports;
|
|
3823
|
+
hasRequiredInherits = 1;
|
|
3824
|
+
try {
|
|
3825
|
+
var util = require('util');
|
|
3826
|
+
/* istanbul ignore next */
|
|
3827
|
+
if (typeof util.inherits !== 'function') throw '';
|
|
3828
|
+
inherits.exports = util.inherits;
|
|
3829
|
+
} catch (e) {
|
|
3830
|
+
/* istanbul ignore next */
|
|
3831
|
+
inherits.exports = requireInherits_browser();
|
|
3832
|
+
}
|
|
3833
|
+
return inherits.exports;
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
/*!
|
|
3837
|
+
* toidentifier
|
|
3838
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
3839
|
+
* MIT Licensed
|
|
3840
|
+
*/
|
|
3841
|
+
|
|
3842
|
+
var toidentifier;
|
|
3843
|
+
var hasRequiredToidentifier;
|
|
3844
|
+
|
|
3845
|
+
function requireToidentifier () {
|
|
3846
|
+
if (hasRequiredToidentifier) return toidentifier;
|
|
3847
|
+
hasRequiredToidentifier = 1;
|
|
3848
|
+
|
|
3849
|
+
/**
|
|
3850
|
+
* Module exports.
|
|
3851
|
+
* @public
|
|
3852
|
+
*/
|
|
3853
|
+
|
|
3854
|
+
toidentifier = toIdentifier;
|
|
3855
|
+
|
|
3856
|
+
/**
|
|
3857
|
+
* Trasform the given string into a JavaScript identifier
|
|
3858
|
+
*
|
|
3859
|
+
* @param {string} str
|
|
3860
|
+
* @returns {string}
|
|
3861
|
+
* @public
|
|
3862
|
+
*/
|
|
3863
|
+
|
|
3864
|
+
function toIdentifier (str) {
|
|
3865
|
+
return str
|
|
3866
|
+
.split(' ')
|
|
3867
|
+
.map(function (token) {
|
|
3868
|
+
return token.slice(0, 1).toUpperCase() + token.slice(1)
|
|
3869
|
+
})
|
|
3870
|
+
.join('')
|
|
3871
|
+
.replace(/[^ _0-9a-z]/gi, '')
|
|
3872
|
+
}
|
|
3873
|
+
return toidentifier;
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
/*!
|
|
3877
|
+
* http-errors
|
|
3878
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
3879
|
+
* Copyright(c) 2016 Douglas Christopher Wilson
|
|
3880
|
+
* MIT Licensed
|
|
3881
|
+
*/
|
|
3882
|
+
|
|
3883
|
+
var hasRequiredHttpErrors;
|
|
3884
|
+
|
|
3885
|
+
function requireHttpErrors () {
|
|
3886
|
+
if (hasRequiredHttpErrors) return httpErrors.exports;
|
|
3887
|
+
hasRequiredHttpErrors = 1;
|
|
3888
|
+
(function (module) {
|
|
3889
|
+
|
|
3890
|
+
/**
|
|
3891
|
+
* Module dependencies.
|
|
3892
|
+
* @private
|
|
3893
|
+
*/
|
|
3894
|
+
|
|
3895
|
+
var deprecate = requireDepd()('http-errors');
|
|
3896
|
+
var setPrototypeOf = requireSetprototypeof();
|
|
3897
|
+
var statuses = requireStatuses();
|
|
3898
|
+
var inherits = requireInherits();
|
|
3899
|
+
var toIdentifier = requireToidentifier();
|
|
3900
|
+
|
|
3901
|
+
/**
|
|
3902
|
+
* Module exports.
|
|
3903
|
+
* @public
|
|
3904
|
+
*/
|
|
3905
|
+
|
|
3906
|
+
module.exports = createError;
|
|
3907
|
+
module.exports.HttpError = createHttpErrorConstructor();
|
|
3908
|
+
module.exports.isHttpError = createIsHttpErrorFunction(module.exports.HttpError);
|
|
3909
|
+
|
|
3910
|
+
// Populate exports for all constructors
|
|
3911
|
+
populateConstructorExports(module.exports, statuses.codes, module.exports.HttpError);
|
|
3912
|
+
|
|
3913
|
+
/**
|
|
3914
|
+
* Get the code class of a status code.
|
|
3915
|
+
* @private
|
|
3916
|
+
*/
|
|
3917
|
+
|
|
3918
|
+
function codeClass (status) {
|
|
3919
|
+
return Number(String(status).charAt(0) + '00')
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
/**
|
|
3923
|
+
* Create a new HTTP Error.
|
|
3924
|
+
*
|
|
3925
|
+
* @returns {Error}
|
|
3926
|
+
* @public
|
|
3927
|
+
*/
|
|
3928
|
+
|
|
3929
|
+
function createError () {
|
|
3930
|
+
// so much arity going on ~_~
|
|
3931
|
+
var err;
|
|
3932
|
+
var msg;
|
|
3933
|
+
var status = 500;
|
|
3934
|
+
var props = {};
|
|
3935
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
3936
|
+
var arg = arguments[i];
|
|
3937
|
+
var type = typeof arg;
|
|
3938
|
+
if (type === 'object' && arg instanceof Error) {
|
|
3939
|
+
err = arg;
|
|
3940
|
+
status = err.status || err.statusCode || status;
|
|
3941
|
+
} else if (type === 'number' && i === 0) {
|
|
3942
|
+
status = arg;
|
|
3943
|
+
} else if (type === 'string') {
|
|
3944
|
+
msg = arg;
|
|
3945
|
+
} else if (type === 'object') {
|
|
3946
|
+
props = arg;
|
|
3947
|
+
} else {
|
|
3948
|
+
throw new TypeError('argument #' + (i + 1) + ' unsupported type ' + type)
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3952
|
+
if (typeof status === 'number' && (status < 400 || status >= 600)) {
|
|
3953
|
+
deprecate('non-error status code; use only 4xx or 5xx status codes');
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3956
|
+
if (typeof status !== 'number' ||
|
|
3957
|
+
(!statuses.message[status] && (status < 400 || status >= 600))) {
|
|
3958
|
+
status = 500;
|
|
3959
|
+
}
|
|
3960
|
+
|
|
3961
|
+
// constructor
|
|
3962
|
+
var HttpError = createError[status] || createError[codeClass(status)];
|
|
3963
|
+
|
|
3964
|
+
if (!err) {
|
|
3965
|
+
// create error
|
|
3966
|
+
err = HttpError
|
|
3967
|
+
? new HttpError(msg)
|
|
3968
|
+
: new Error(msg || statuses.message[status]);
|
|
3969
|
+
Error.captureStackTrace(err, createError);
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3972
|
+
if (!HttpError || !(err instanceof HttpError) || err.status !== status) {
|
|
3973
|
+
// add properties to generic error
|
|
3974
|
+
err.expose = status < 500;
|
|
3975
|
+
err.status = err.statusCode = status;
|
|
3976
|
+
}
|
|
3977
|
+
|
|
3978
|
+
for (var key in props) {
|
|
3979
|
+
if (key !== 'status' && key !== 'statusCode') {
|
|
3980
|
+
err[key] = props[key];
|
|
3981
|
+
}
|
|
3982
|
+
}
|
|
3983
|
+
|
|
3984
|
+
return err
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3987
|
+
/**
|
|
3988
|
+
* Create HTTP error abstract base class.
|
|
3989
|
+
* @private
|
|
3990
|
+
*/
|
|
3991
|
+
|
|
3992
|
+
function createHttpErrorConstructor () {
|
|
3993
|
+
function HttpError () {
|
|
3994
|
+
throw new TypeError('cannot construct abstract class')
|
|
3995
|
+
}
|
|
3996
|
+
|
|
3997
|
+
inherits(HttpError, Error);
|
|
3998
|
+
|
|
3999
|
+
return HttpError
|
|
4000
|
+
}
|
|
4001
|
+
|
|
4002
|
+
/**
|
|
4003
|
+
* Create a constructor for a client error.
|
|
4004
|
+
* @private
|
|
4005
|
+
*/
|
|
4006
|
+
|
|
4007
|
+
function createClientErrorConstructor (HttpError, name, code) {
|
|
4008
|
+
var className = toClassName(name);
|
|
4009
|
+
|
|
4010
|
+
function ClientError (message) {
|
|
4011
|
+
// create the error object
|
|
4012
|
+
var msg = message != null ? message : statuses.message[code];
|
|
4013
|
+
var err = new Error(msg);
|
|
4014
|
+
|
|
4015
|
+
// capture a stack trace to the construction point
|
|
4016
|
+
Error.captureStackTrace(err, ClientError);
|
|
4017
|
+
|
|
4018
|
+
// adjust the [[Prototype]]
|
|
4019
|
+
setPrototypeOf(err, ClientError.prototype);
|
|
4020
|
+
|
|
4021
|
+
// redefine the error message
|
|
4022
|
+
Object.defineProperty(err, 'message', {
|
|
4023
|
+
enumerable: true,
|
|
4024
|
+
configurable: true,
|
|
4025
|
+
value: msg,
|
|
4026
|
+
writable: true
|
|
4027
|
+
});
|
|
4028
|
+
|
|
4029
|
+
// redefine the error name
|
|
4030
|
+
Object.defineProperty(err, 'name', {
|
|
4031
|
+
enumerable: false,
|
|
4032
|
+
configurable: true,
|
|
4033
|
+
value: className,
|
|
4034
|
+
writable: true
|
|
4035
|
+
});
|
|
4036
|
+
|
|
4037
|
+
return err
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
inherits(ClientError, HttpError);
|
|
4041
|
+
nameFunc(ClientError, className);
|
|
4042
|
+
|
|
4043
|
+
ClientError.prototype.status = code;
|
|
4044
|
+
ClientError.prototype.statusCode = code;
|
|
4045
|
+
ClientError.prototype.expose = true;
|
|
4046
|
+
|
|
4047
|
+
return ClientError
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
/**
|
|
4051
|
+
* Create function to test is a value is a HttpError.
|
|
4052
|
+
* @private
|
|
4053
|
+
*/
|
|
4054
|
+
|
|
4055
|
+
function createIsHttpErrorFunction (HttpError) {
|
|
4056
|
+
return function isHttpError (val) {
|
|
4057
|
+
if (!val || typeof val !== 'object') {
|
|
4058
|
+
return false
|
|
4059
|
+
}
|
|
4060
|
+
|
|
4061
|
+
if (val instanceof HttpError) {
|
|
4062
|
+
return true
|
|
4063
|
+
}
|
|
4064
|
+
|
|
4065
|
+
return val instanceof Error &&
|
|
4066
|
+
typeof val.expose === 'boolean' &&
|
|
4067
|
+
typeof val.statusCode === 'number' && val.status === val.statusCode
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
|
|
4071
|
+
/**
|
|
4072
|
+
* Create a constructor for a server error.
|
|
4073
|
+
* @private
|
|
4074
|
+
*/
|
|
4075
|
+
|
|
4076
|
+
function createServerErrorConstructor (HttpError, name, code) {
|
|
4077
|
+
var className = toClassName(name);
|
|
4078
|
+
|
|
4079
|
+
function ServerError (message) {
|
|
4080
|
+
// create the error object
|
|
4081
|
+
var msg = message != null ? message : statuses.message[code];
|
|
4082
|
+
var err = new Error(msg);
|
|
4083
|
+
|
|
4084
|
+
// capture a stack trace to the construction point
|
|
4085
|
+
Error.captureStackTrace(err, ServerError);
|
|
4086
|
+
|
|
4087
|
+
// adjust the [[Prototype]]
|
|
4088
|
+
setPrototypeOf(err, ServerError.prototype);
|
|
4089
|
+
|
|
4090
|
+
// redefine the error message
|
|
4091
|
+
Object.defineProperty(err, 'message', {
|
|
4092
|
+
enumerable: true,
|
|
4093
|
+
configurable: true,
|
|
4094
|
+
value: msg,
|
|
4095
|
+
writable: true
|
|
4096
|
+
});
|
|
4097
|
+
|
|
4098
|
+
// redefine the error name
|
|
4099
|
+
Object.defineProperty(err, 'name', {
|
|
4100
|
+
enumerable: false,
|
|
4101
|
+
configurable: true,
|
|
4102
|
+
value: className,
|
|
4103
|
+
writable: true
|
|
4104
|
+
});
|
|
4105
|
+
|
|
4106
|
+
return err
|
|
4107
|
+
}
|
|
4108
|
+
|
|
4109
|
+
inherits(ServerError, HttpError);
|
|
4110
|
+
nameFunc(ServerError, className);
|
|
4111
|
+
|
|
4112
|
+
ServerError.prototype.status = code;
|
|
4113
|
+
ServerError.prototype.statusCode = code;
|
|
4114
|
+
ServerError.prototype.expose = false;
|
|
4115
|
+
|
|
4116
|
+
return ServerError
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
/**
|
|
4120
|
+
* Set the name of a function, if possible.
|
|
4121
|
+
* @private
|
|
4122
|
+
*/
|
|
4123
|
+
|
|
4124
|
+
function nameFunc (func, name) {
|
|
4125
|
+
var desc = Object.getOwnPropertyDescriptor(func, 'name');
|
|
4126
|
+
|
|
4127
|
+
if (desc && desc.configurable) {
|
|
4128
|
+
desc.value = name;
|
|
4129
|
+
Object.defineProperty(func, 'name', desc);
|
|
4130
|
+
}
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
/**
|
|
4134
|
+
* Populate the exports object with constructors for every error class.
|
|
4135
|
+
* @private
|
|
4136
|
+
*/
|
|
4137
|
+
|
|
4138
|
+
function populateConstructorExports (exports$1, codes, HttpError) {
|
|
4139
|
+
codes.forEach(function forEachCode (code) {
|
|
4140
|
+
var CodeError;
|
|
4141
|
+
var name = toIdentifier(statuses.message[code]);
|
|
4142
|
+
|
|
4143
|
+
switch (codeClass(code)) {
|
|
4144
|
+
case 400:
|
|
4145
|
+
CodeError = createClientErrorConstructor(HttpError, name, code);
|
|
4146
|
+
break
|
|
4147
|
+
case 500:
|
|
4148
|
+
CodeError = createServerErrorConstructor(HttpError, name, code);
|
|
4149
|
+
break
|
|
4150
|
+
}
|
|
4151
|
+
|
|
4152
|
+
if (CodeError) {
|
|
4153
|
+
// export the constructor
|
|
4154
|
+
exports$1[code] = CodeError;
|
|
4155
|
+
exports$1[name] = CodeError;
|
|
4156
|
+
}
|
|
4157
|
+
});
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4160
|
+
/**
|
|
4161
|
+
* Get a class name from a name identifier.
|
|
4162
|
+
* @private
|
|
4163
|
+
*/
|
|
4164
|
+
|
|
4165
|
+
function toClassName (name) {
|
|
4166
|
+
return name.substr(-5) !== 'Error'
|
|
4167
|
+
? name + 'Error'
|
|
4168
|
+
: name
|
|
4169
|
+
}
|
|
4170
|
+
} (httpErrors));
|
|
4171
|
+
return httpErrors.exports;
|
|
4172
|
+
}
|
|
4173
|
+
|
|
4174
|
+
var httpErrorsExports = requireHttpErrors();
|
|
4175
|
+
var HttpErrors = /*@__PURE__*/getDefaultExportFromCjs(httpErrorsExports);
|
|
4176
|
+
|
|
4177
|
+
class BaseService {
|
|
4178
|
+
constructor(instanceId, auth, baseUrl) {
|
|
4179
|
+
this.instanceId = instanceId;
|
|
4180
|
+
this.auth = auth;
|
|
4181
|
+
this.baseUrl = baseUrl;
|
|
4182
|
+
if (!this.instanceId ||
|
|
4183
|
+
(typeof this.auth === 'string' && !this.auth) ||
|
|
4184
|
+
(typeof this.auth === 'object' && (!this.auth.email || !this.auth.apiKey))) {
|
|
4185
|
+
throw new HttpErrors.UnprocessableEntity('izz.ONE service is not properly configured');
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
headers(extra = {}) {
|
|
4189
|
+
return {
|
|
4190
|
+
...extra,
|
|
4191
|
+
'x-environment-id': this.instanceId,
|
|
4192
|
+
...(typeof this.auth === 'string'
|
|
4193
|
+
? {
|
|
4194
|
+
'izz-access-token': this.auth,
|
|
4195
|
+
}
|
|
4196
|
+
: {
|
|
4197
|
+
Authorization: `Basic ${Buffer.from([this.auth.email, this.auth.apiKey].join(':')).toString('base64')}`,
|
|
4198
|
+
}),
|
|
4199
|
+
};
|
|
4200
|
+
}
|
|
4201
|
+
async _request(path, options = {}) {
|
|
4202
|
+
options.headers || (options.headers = this.headers());
|
|
4203
|
+
return await fetch(new URL(path, this.baseUrl), options);
|
|
4204
|
+
}
|
|
4205
|
+
async sendPost(path, body) {
|
|
4206
|
+
return await this._request(path, {
|
|
4207
|
+
method: 'POST',
|
|
4208
|
+
headers: this.headers(body instanceof FormData ? {} : { 'Content-Type': 'application/json' }),
|
|
4209
|
+
body: body instanceof FormData ? body : JSON.stringify(body),
|
|
4210
|
+
});
|
|
4211
|
+
}
|
|
4212
|
+
async sendPatch(path, body) {
|
|
4213
|
+
return await this._request(path, {
|
|
4214
|
+
method: 'PATCH',
|
|
4215
|
+
body: body instanceof FormData ? body : JSON.stringify(body),
|
|
4216
|
+
});
|
|
4217
|
+
}
|
|
4218
|
+
async sendPut(path, body) {
|
|
4219
|
+
return await this._request(path, {
|
|
4220
|
+
method: 'PUT',
|
|
4221
|
+
body: body instanceof FormData ? body : JSON.stringify(body),
|
|
4222
|
+
});
|
|
4223
|
+
}
|
|
4224
|
+
async sendGet(path) {
|
|
4225
|
+
return await this._request(path, {
|
|
4226
|
+
method: 'GET',
|
|
4227
|
+
});
|
|
4228
|
+
}
|
|
4229
|
+
async sendDelete(path) {
|
|
4230
|
+
return await this._request(path, {
|
|
4231
|
+
method: 'DELETE',
|
|
4232
|
+
});
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4236
|
+
class AgentService extends BaseService {
|
|
4237
|
+
async list(search = '', limit = 20, offset = 0) {
|
|
4238
|
+
const query = libExports.stringify({
|
|
4239
|
+
q: search,
|
|
4240
|
+
limit,
|
|
4241
|
+
offset,
|
|
4242
|
+
populate: [{ path: 'steps' }],
|
|
4243
|
+
});
|
|
4244
|
+
const response = await this.sendGet(`/v1/agent?${query}`).then((res) => res.json());
|
|
4245
|
+
return response.data || [];
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
|
|
4249
|
+
class ChatService extends BaseService {
|
|
4250
|
+
async chat(msg, options, messageMode = 'user-message') {
|
|
4251
|
+
const chatOptions = {
|
|
4252
|
+
msg,
|
|
4253
|
+
...(options || {}),
|
|
4254
|
+
};
|
|
4255
|
+
chatOptions.datasources || (chatOptions.datasources = []);
|
|
4256
|
+
chatOptions.tags || (chatOptions.tags = []);
|
|
4257
|
+
chatOptions.tags.push('one-js-sdk');
|
|
4258
|
+
const response = await this.sendPost('/v1/chat', chatOptions).then((res) => res.json());
|
|
4259
|
+
if (!response.messages?.length) {
|
|
4260
|
+
throw new HttpErrors.InternalServerError('No messages found in response');
|
|
4261
|
+
}
|
|
4262
|
+
if (messageMode === 'user-message') {
|
|
4263
|
+
const userMessage = response.messages.find((m) => m.role === 'user');
|
|
4264
|
+
return userMessage;
|
|
4265
|
+
}
|
|
4266
|
+
if (messageMode === 'ai-message') {
|
|
4267
|
+
const aiMessage = response.messages.find((m) => m.role === 'assistant');
|
|
4268
|
+
return aiMessage;
|
|
4269
|
+
}
|
|
4270
|
+
return response;
|
|
4271
|
+
}
|
|
4272
|
+
async chatWithFile(msg, file, fileName, options, messageMode = 'user-message') {
|
|
4273
|
+
const formData = new FormData();
|
|
4274
|
+
formData.append('file', file, fileName);
|
|
4275
|
+
formData.append('msg', msg);
|
|
4276
|
+
options || (options = {});
|
|
4277
|
+
options.datasources || (options.datasources = []);
|
|
4278
|
+
const params = new URLSearchParams(libExports.stringify(options, { allowEmptyArrays: true }));
|
|
4279
|
+
for (const [key, value] of params.entries()) {
|
|
4280
|
+
formData.append(key, value);
|
|
4281
|
+
}
|
|
4282
|
+
const response = await this.sendPost('/v1/chat', formData).then((res) => res.json());
|
|
4283
|
+
if (messageMode === 'user-message') {
|
|
4284
|
+
const userMessage = response.messages.find((m) => m.role === 'user');
|
|
4285
|
+
return userMessage;
|
|
4286
|
+
}
|
|
4287
|
+
if (messageMode === 'ai-message') {
|
|
4288
|
+
const aiMessage = response.messages.find((m) => m.role === 'assistant');
|
|
4289
|
+
return aiMessage;
|
|
4290
|
+
}
|
|
4291
|
+
return response;
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4294
|
+
|
|
4295
|
+
class DatasourceService extends BaseService {
|
|
4296
|
+
async list(search = '', limit = 20, offset = 0) {
|
|
4297
|
+
const query = libExports.stringify({ q: search, limit, offset });
|
|
4298
|
+
const response = await this.sendGet(`/v1/datasource?${query}`).then((res) => res.json());
|
|
4299
|
+
return response.data || [];
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
|
|
4303
|
+
class GptService extends BaseService {
|
|
4304
|
+
async list(search = '', limit = 20, offset = 0) {
|
|
4305
|
+
const query = libExports.stringify({
|
|
4306
|
+
q: search,
|
|
4307
|
+
limit,
|
|
4308
|
+
offset,
|
|
4309
|
+
});
|
|
4310
|
+
const response = await this.sendGet(`/v1/gpt?${query}`).then((res) => res.json());
|
|
4311
|
+
return response.data || [];
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
|
|
4315
|
+
const services = (instanceId, auth, baseUrl) => ({
|
|
4316
|
+
agent: new AgentService(instanceId, auth, baseUrl),
|
|
4317
|
+
chat: new ChatService(instanceId, auth, baseUrl),
|
|
4318
|
+
datasource: new DatasourceService(instanceId, auth, baseUrl),
|
|
4319
|
+
gpt: new GptService(instanceId, auth, baseUrl),
|
|
4320
|
+
});
|
|
4321
|
+
|
|
4322
|
+
class One extends BaseService {
|
|
4323
|
+
constructor(instanceId, auth, baseUrl) {
|
|
4324
|
+
super(instanceId, auth, baseUrl);
|
|
4325
|
+
this._services || (this._services = services(this.instanceId, this.auth, this.baseUrl));
|
|
4326
|
+
}
|
|
4327
|
+
get agent() {
|
|
4328
|
+
return this._services.agent;
|
|
4329
|
+
}
|
|
4330
|
+
get chat() {
|
|
4331
|
+
return this._services.chat;
|
|
4332
|
+
}
|
|
4333
|
+
get datasource() {
|
|
4334
|
+
return this._services.datasource;
|
|
4335
|
+
}
|
|
4336
|
+
get gpt() {
|
|
4337
|
+
return this._services.gpt;
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
|
|
4341
|
+
exports.One = One;
|
|
4342
|
+
//# sourceMappingURL=index.cjs.map
|