@tryghost/content-api 1.11.2 → 1.11.4
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/cjs/content-api.js +5 -5
- package/es/content-api.js +356 -2208
- package/es/content-api.js.map +1 -1
- package/package.json +5 -5
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/es/content-api.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return obj;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
1
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
17
2
|
|
|
18
3
|
function createCommonjsModule(fn, module) {
|
|
@@ -55,28 +40,28 @@ var functionBindNative = !fails(function () {
|
|
|
55
40
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
56
41
|
});
|
|
57
42
|
|
|
58
|
-
var call$
|
|
43
|
+
var call$1 = Function.prototype.call;
|
|
59
44
|
|
|
60
|
-
var functionCall = functionBindNative ? call$
|
|
61
|
-
return call$
|
|
45
|
+
var functionCall = functionBindNative ? call$1.bind(call$1) : function () {
|
|
46
|
+
return call$1.apply(call$1, arguments);
|
|
62
47
|
};
|
|
63
48
|
|
|
64
49
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
65
50
|
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
66
|
-
var getOwnPropertyDescriptor$
|
|
51
|
+
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
67
52
|
|
|
68
53
|
// Nashorn ~ JDK8 bug
|
|
69
|
-
var NASHORN_BUG = getOwnPropertyDescriptor$
|
|
54
|
+
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
70
55
|
|
|
71
56
|
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
72
57
|
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
73
|
-
var f$
|
|
74
|
-
var descriptor = getOwnPropertyDescriptor$
|
|
58
|
+
var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
59
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
75
60
|
return !!descriptor && descriptor.enumerable;
|
|
76
61
|
} : $propertyIsEnumerable;
|
|
77
62
|
|
|
78
63
|
var objectPropertyIsEnumerable = {
|
|
79
|
-
f: f$
|
|
64
|
+
f: f$5
|
|
80
65
|
};
|
|
81
66
|
|
|
82
67
|
var createPropertyDescriptor = function (bitmap, value) {
|
|
@@ -88,37 +73,37 @@ var createPropertyDescriptor = function (bitmap, value) {
|
|
|
88
73
|
};
|
|
89
74
|
};
|
|
90
75
|
|
|
91
|
-
var FunctionPrototype$
|
|
92
|
-
var bind$
|
|
93
|
-
var call
|
|
94
|
-
var uncurryThis = functionBindNative && bind$
|
|
76
|
+
var FunctionPrototype$1 = Function.prototype;
|
|
77
|
+
var bind$1 = FunctionPrototype$1.bind;
|
|
78
|
+
var call = FunctionPrototype$1.call;
|
|
79
|
+
var uncurryThis = functionBindNative && bind$1.bind(call, call);
|
|
95
80
|
|
|
96
81
|
var functionUncurryThis = functionBindNative ? function (fn) {
|
|
97
82
|
return fn && uncurryThis(fn);
|
|
98
83
|
} : function (fn) {
|
|
99
84
|
return fn && function () {
|
|
100
|
-
return call
|
|
85
|
+
return call.apply(fn, arguments);
|
|
101
86
|
};
|
|
102
87
|
};
|
|
103
88
|
|
|
104
89
|
var toString$2 = functionUncurryThis({}.toString);
|
|
105
|
-
var stringSlice
|
|
90
|
+
var stringSlice = functionUncurryThis(''.slice);
|
|
106
91
|
|
|
107
92
|
var classofRaw = function (it) {
|
|
108
|
-
return stringSlice
|
|
93
|
+
return stringSlice(toString$2(it), 8, -1);
|
|
109
94
|
};
|
|
110
95
|
|
|
111
|
-
var $Object$
|
|
96
|
+
var $Object$2 = Object;
|
|
112
97
|
var split = functionUncurryThis(''.split);
|
|
113
98
|
|
|
114
99
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
115
100
|
var indexedObject = fails(function () {
|
|
116
101
|
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
117
102
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
118
|
-
return !$Object$
|
|
103
|
+
return !$Object$2('z').propertyIsEnumerable(0);
|
|
119
104
|
}) ? function (it) {
|
|
120
|
-
return classofRaw(it) == 'String' ? split(it, '') : $Object$
|
|
121
|
-
} : $Object$
|
|
105
|
+
return classofRaw(it) == 'String' ? split(it, '') : $Object$2(it);
|
|
106
|
+
} : $Object$2;
|
|
122
107
|
|
|
123
108
|
// we can't use just `it == null` since of `document.all` special case
|
|
124
109
|
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
@@ -126,12 +111,12 @@ var isNullOrUndefined$1 = function (it) {
|
|
|
126
111
|
return it === null || it === undefined;
|
|
127
112
|
};
|
|
128
113
|
|
|
129
|
-
var $TypeError$
|
|
114
|
+
var $TypeError$5 = TypeError;
|
|
130
115
|
|
|
131
116
|
// `RequireObjectCoercible` abstract operation
|
|
132
117
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
133
118
|
var requireObjectCoercible = function (it) {
|
|
134
|
-
if (isNullOrUndefined$1(it)) throw $TypeError$
|
|
119
|
+
if (isNullOrUndefined$1(it)) throw $TypeError$5("Can't call method on " + it);
|
|
135
120
|
return it;
|
|
136
121
|
};
|
|
137
122
|
|
|
@@ -143,18 +128,29 @@ var toIndexedObject = function (it) {
|
|
|
143
128
|
return indexedObject(requireObjectCoercible(it));
|
|
144
129
|
};
|
|
145
130
|
|
|
131
|
+
var documentAll$2 = typeof document == 'object' && document.all;
|
|
132
|
+
|
|
133
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
134
|
+
var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
|
|
135
|
+
|
|
136
|
+
var documentAll_1 = {
|
|
137
|
+
all: documentAll$2,
|
|
138
|
+
IS_HTMLDDA: IS_HTMLDDA
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
var documentAll$1 = documentAll_1.all;
|
|
142
|
+
|
|
146
143
|
// `IsCallable` abstract operation
|
|
147
144
|
// https://tc39.es/ecma262/#sec-iscallable
|
|
148
|
-
var isCallable = function (argument) {
|
|
145
|
+
var isCallable = documentAll_1.IS_HTMLDDA ? function (argument) {
|
|
146
|
+
return typeof argument == 'function' || argument === documentAll$1;
|
|
147
|
+
} : function (argument) {
|
|
149
148
|
return typeof argument == 'function';
|
|
150
149
|
};
|
|
151
150
|
|
|
152
|
-
var documentAll =
|
|
151
|
+
var documentAll = documentAll_1.all;
|
|
153
152
|
|
|
154
|
-
|
|
155
|
-
var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
156
|
-
|
|
157
|
-
var isObject$2 = SPECIAL_DOCUMENT_ALL ? function (it) {
|
|
153
|
+
var isObject$2 = documentAll_1.IS_HTMLDDA ? function (it) {
|
|
158
154
|
return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;
|
|
159
155
|
} : function (it) {
|
|
160
156
|
return typeof it == 'object' ? it !== null : isCallable(it);
|
|
@@ -172,9 +168,9 @@ var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
|
172
168
|
|
|
173
169
|
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
174
170
|
|
|
175
|
-
var process$
|
|
176
|
-
var Deno
|
|
177
|
-
var versions = process$
|
|
171
|
+
var process$1 = global_1.process;
|
|
172
|
+
var Deno = global_1.Deno;
|
|
173
|
+
var versions = process$1 && process$1.versions || Deno && Deno.version;
|
|
178
174
|
var v8 = versions && versions.v8;
|
|
179
175
|
var match, version$1;
|
|
180
176
|
|
|
@@ -218,31 +214,31 @@ var useSymbolAsUid = symbolConstructorDetection
|
|
|
218
214
|
&& !Symbol.sham
|
|
219
215
|
&& typeof Symbol.iterator == 'symbol';
|
|
220
216
|
|
|
221
|
-
var $Object$
|
|
217
|
+
var $Object$1 = Object;
|
|
222
218
|
|
|
223
219
|
var isSymbol = useSymbolAsUid ? function (it) {
|
|
224
220
|
return typeof it == 'symbol';
|
|
225
221
|
} : function (it) {
|
|
226
222
|
var $Symbol = getBuiltIn('Symbol');
|
|
227
|
-
return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$
|
|
223
|
+
return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$1(it));
|
|
228
224
|
};
|
|
229
225
|
|
|
230
|
-
var $String$
|
|
226
|
+
var $String$1 = String;
|
|
231
227
|
|
|
232
228
|
var tryToString = function (argument) {
|
|
233
229
|
try {
|
|
234
|
-
return $String$
|
|
230
|
+
return $String$1(argument);
|
|
235
231
|
} catch (error) {
|
|
236
232
|
return 'Object';
|
|
237
233
|
}
|
|
238
234
|
};
|
|
239
235
|
|
|
240
|
-
var $TypeError$
|
|
236
|
+
var $TypeError$4 = TypeError;
|
|
241
237
|
|
|
242
238
|
// `Assert: IsCallable(argument) is true`
|
|
243
239
|
var aCallable = function (argument) {
|
|
244
240
|
if (isCallable(argument)) return argument;
|
|
245
|
-
throw $TypeError$
|
|
241
|
+
throw $TypeError$4(tryToString(argument) + ' is not a function');
|
|
246
242
|
};
|
|
247
243
|
|
|
248
244
|
// `GetMethod` abstract operation
|
|
@@ -252,7 +248,7 @@ var getMethod = function (V, P) {
|
|
|
252
248
|
return isNullOrUndefined$1(func) ? undefined : aCallable(func);
|
|
253
249
|
};
|
|
254
250
|
|
|
255
|
-
var $TypeError$
|
|
251
|
+
var $TypeError$3 = TypeError;
|
|
256
252
|
|
|
257
253
|
// `OrdinaryToPrimitive` abstract operation
|
|
258
254
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
@@ -261,15 +257,15 @@ var ordinaryToPrimitive = function (input, pref) {
|
|
|
261
257
|
if (pref === 'string' && isCallable(fn = input.toString) && !isObject$2(val = functionCall(fn, input))) return val;
|
|
262
258
|
if (isCallable(fn = input.valueOf) && !isObject$2(val = functionCall(fn, input))) return val;
|
|
263
259
|
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject$2(val = functionCall(fn, input))) return val;
|
|
264
|
-
throw $TypeError$
|
|
260
|
+
throw $TypeError$3("Can't convert object to primitive value");
|
|
265
261
|
};
|
|
266
262
|
|
|
267
263
|
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
268
|
-
var defineProperty$
|
|
264
|
+
var defineProperty$1 = Object.defineProperty;
|
|
269
265
|
|
|
270
266
|
var defineGlobalProperty = function (key, value) {
|
|
271
267
|
try {
|
|
272
|
-
defineProperty$
|
|
268
|
+
defineProperty$1(global_1, key, { value: value, configurable: true, writable: true });
|
|
273
269
|
} catch (error) {
|
|
274
270
|
global_1[key] = value;
|
|
275
271
|
} return value;
|
|
@@ -284,20 +280,20 @@ var shared = createCommonjsModule(function (module) {
|
|
|
284
280
|
(module.exports = function (key, value) {
|
|
285
281
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
286
282
|
})('versions', []).push({
|
|
287
|
-
version: '3.25.
|
|
283
|
+
version: '3.25.2',
|
|
288
284
|
mode: 'global',
|
|
289
285
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
290
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.25.
|
|
286
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.25.2/LICENSE',
|
|
291
287
|
source: 'https://github.com/zloirock/core-js'
|
|
292
288
|
});
|
|
293
289
|
});
|
|
294
290
|
|
|
295
|
-
var $Object
|
|
291
|
+
var $Object = Object;
|
|
296
292
|
|
|
297
293
|
// `ToObject` abstract operation
|
|
298
294
|
// https://tc39.es/ecma262/#sec-toobject
|
|
299
295
|
var toObject = function (argument) {
|
|
300
|
-
return $Object
|
|
296
|
+
return $Object(requireObjectCoercible(argument));
|
|
301
297
|
};
|
|
302
298
|
|
|
303
299
|
var hasOwnProperty$1 = functionUncurryThis({}.hasOwnProperty);
|
|
@@ -335,7 +331,7 @@ var wellKnownSymbol = function (name) {
|
|
|
335
331
|
} return WellKnownSymbolsStore[name];
|
|
336
332
|
};
|
|
337
333
|
|
|
338
|
-
var $TypeError$
|
|
334
|
+
var $TypeError$2 = TypeError;
|
|
339
335
|
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
340
336
|
|
|
341
337
|
// `ToPrimitive` abstract operation
|
|
@@ -348,7 +344,7 @@ var toPrimitive = function (input, pref) {
|
|
|
348
344
|
if (pref === undefined) pref = 'default';
|
|
349
345
|
result = functionCall(exoticToPrim, input, pref);
|
|
350
346
|
if (!isObject$2(result) || isSymbol(result)) return result;
|
|
351
|
-
throw $TypeError$
|
|
347
|
+
throw $TypeError$2("Can't convert object to primitive value");
|
|
352
348
|
}
|
|
353
349
|
if (pref === undefined) pref = 'number';
|
|
354
350
|
return ordinaryToPrimitive(input, pref);
|
|
@@ -361,12 +357,12 @@ var toPropertyKey = function (argument) {
|
|
|
361
357
|
return isSymbol(key) ? key : key + '';
|
|
362
358
|
};
|
|
363
359
|
|
|
364
|
-
var document$
|
|
360
|
+
var document$1 = global_1.document;
|
|
365
361
|
// typeof document.createElement is 'object' in old IE
|
|
366
|
-
var EXISTS$1 = isObject$2(document$
|
|
362
|
+
var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
|
|
367
363
|
|
|
368
364
|
var documentCreateElement = function (it) {
|
|
369
|
-
return EXISTS$1 ? document$
|
|
365
|
+
return EXISTS$1 ? document$1.createElement(it) : {};
|
|
370
366
|
};
|
|
371
367
|
|
|
372
368
|
// Thanks to IE8 for its funny defineProperty
|
|
@@ -382,7 +378,7 @@ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
|
382
378
|
|
|
383
379
|
// `Object.getOwnPropertyDescriptor` method
|
|
384
380
|
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
385
|
-
var f$
|
|
381
|
+
var f$4 = descriptors$1 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
386
382
|
O = toIndexedObject(O);
|
|
387
383
|
P = toPropertyKey(P);
|
|
388
384
|
if (ie8DomDefine) try {
|
|
@@ -392,7 +388,7 @@ var f$5 = descriptors$1 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyD
|
|
|
392
388
|
};
|
|
393
389
|
|
|
394
390
|
var objectGetOwnPropertyDescriptor = {
|
|
395
|
-
f: f$
|
|
391
|
+
f: f$4
|
|
396
392
|
};
|
|
397
393
|
|
|
398
394
|
// V8 ~ Chrome 36-
|
|
@@ -405,16 +401,16 @@ var v8PrototypeDefineBug = descriptors$1 && fails(function () {
|
|
|
405
401
|
}).prototype != 42;
|
|
406
402
|
});
|
|
407
403
|
|
|
408
|
-
var $String
|
|
409
|
-
var $TypeError$
|
|
404
|
+
var $String = String;
|
|
405
|
+
var $TypeError$1 = TypeError;
|
|
410
406
|
|
|
411
407
|
// `Assert: Type(argument) is Object`
|
|
412
408
|
var anObject = function (argument) {
|
|
413
409
|
if (isObject$2(argument)) return argument;
|
|
414
|
-
throw $TypeError$
|
|
410
|
+
throw $TypeError$1($String(argument) + ' is not an object');
|
|
415
411
|
};
|
|
416
412
|
|
|
417
|
-
var $TypeError
|
|
413
|
+
var $TypeError = TypeError;
|
|
418
414
|
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
419
415
|
var $defineProperty = Object.defineProperty;
|
|
420
416
|
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
@@ -425,7 +421,7 @@ var WRITABLE = 'writable';
|
|
|
425
421
|
|
|
426
422
|
// `Object.defineProperty` method
|
|
427
423
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
428
|
-
var f$
|
|
424
|
+
var f$3 = descriptors$1 ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
|
|
429
425
|
anObject(O);
|
|
430
426
|
P = toPropertyKey(P);
|
|
431
427
|
anObject(Attributes);
|
|
@@ -447,13 +443,13 @@ var f$4 = descriptors$1 ? v8PrototypeDefineBug ? function defineProperty(O, P, A
|
|
|
447
443
|
if (ie8DomDefine) try {
|
|
448
444
|
return $defineProperty(O, P, Attributes);
|
|
449
445
|
} catch (error) { /* empty */ }
|
|
450
|
-
if ('get' in Attributes || 'set' in Attributes) throw $TypeError
|
|
446
|
+
if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
|
|
451
447
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
452
448
|
return O;
|
|
453
449
|
};
|
|
454
450
|
|
|
455
451
|
var objectDefineProperty = {
|
|
456
|
-
f: f$
|
|
452
|
+
f: f$3
|
|
457
453
|
};
|
|
458
454
|
|
|
459
455
|
var createNonEnumerableProperty = descriptors$1 ? function (object, key, value) {
|
|
@@ -463,14 +459,14 @@ var createNonEnumerableProperty = descriptors$1 ? function (object, key, value)
|
|
|
463
459
|
return object;
|
|
464
460
|
};
|
|
465
461
|
|
|
466
|
-
var FunctionPrototype
|
|
462
|
+
var FunctionPrototype = Function.prototype;
|
|
467
463
|
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
468
464
|
var getDescriptor = descriptors$1 && Object.getOwnPropertyDescriptor;
|
|
469
465
|
|
|
470
|
-
var EXISTS = hasOwnProperty_1(FunctionPrototype
|
|
466
|
+
var EXISTS = hasOwnProperty_1(FunctionPrototype, 'name');
|
|
471
467
|
// additional protection from minified / mangled / dropped function names
|
|
472
468
|
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
473
|
-
var CONFIGURABLE = EXISTS && (!descriptors$1 || (descriptors$1 && getDescriptor(FunctionPrototype
|
|
469
|
+
var CONFIGURABLE = EXISTS && (!descriptors$1 || (descriptors$1 && getDescriptor(FunctionPrototype, 'name').configurable));
|
|
474
470
|
|
|
475
471
|
var functionName = {
|
|
476
472
|
EXISTS: EXISTS,
|
|
@@ -478,12 +474,12 @@ var functionName = {
|
|
|
478
474
|
CONFIGURABLE: CONFIGURABLE
|
|
479
475
|
};
|
|
480
476
|
|
|
481
|
-
var functionToString
|
|
477
|
+
var functionToString = functionUncurryThis(Function.toString);
|
|
482
478
|
|
|
483
479
|
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
484
480
|
if (!isCallable(sharedStore.inspectSource)) {
|
|
485
481
|
sharedStore.inspectSource = function (it) {
|
|
486
|
-
return functionToString
|
|
482
|
+
return functionToString(it);
|
|
487
483
|
};
|
|
488
484
|
}
|
|
489
485
|
|
|
@@ -502,19 +498,19 @@ var sharedKey = function (key) {
|
|
|
502
498
|
var hiddenKeys$1 = {};
|
|
503
499
|
|
|
504
500
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
505
|
-
var TypeError$
|
|
501
|
+
var TypeError$1 = global_1.TypeError;
|
|
506
502
|
var WeakMap = global_1.WeakMap;
|
|
507
|
-
var set
|
|
503
|
+
var set, get, has;
|
|
508
504
|
|
|
509
505
|
var enforce = function (it) {
|
|
510
|
-
return has(it) ? get(it) : set
|
|
506
|
+
return has(it) ? get(it) : set(it, {});
|
|
511
507
|
};
|
|
512
508
|
|
|
513
509
|
var getterFor = function (TYPE) {
|
|
514
510
|
return function (it) {
|
|
515
511
|
var state;
|
|
516
512
|
if (!isObject$2(it) || (state = get(it)).type !== TYPE) {
|
|
517
|
-
throw TypeError$
|
|
513
|
+
throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
|
|
518
514
|
} return state;
|
|
519
515
|
};
|
|
520
516
|
};
|
|
@@ -524,8 +520,8 @@ if (weakMapBasicDetection || sharedStore.state) {
|
|
|
524
520
|
var wmget = functionUncurryThis(store.get);
|
|
525
521
|
var wmhas = functionUncurryThis(store.has);
|
|
526
522
|
var wmset = functionUncurryThis(store.set);
|
|
527
|
-
set
|
|
528
|
-
if (wmhas(store, it)) throw TypeError$
|
|
523
|
+
set = function (it, metadata) {
|
|
524
|
+
if (wmhas(store, it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
529
525
|
metadata.facade = it;
|
|
530
526
|
wmset(store, it, metadata);
|
|
531
527
|
return metadata;
|
|
@@ -539,8 +535,8 @@ if (weakMapBasicDetection || sharedStore.state) {
|
|
|
539
535
|
} else {
|
|
540
536
|
var STATE = sharedKey('state');
|
|
541
537
|
hiddenKeys$1[STATE] = true;
|
|
542
|
-
set
|
|
543
|
-
if (hasOwnProperty_1(it, STATE)) throw TypeError$
|
|
538
|
+
set = function (it, metadata) {
|
|
539
|
+
if (hasOwnProperty_1(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
544
540
|
metadata.facade = it;
|
|
545
541
|
createNonEnumerableProperty(it, STATE, metadata);
|
|
546
542
|
return metadata;
|
|
@@ -554,7 +550,7 @@ if (weakMapBasicDetection || sharedStore.state) {
|
|
|
554
550
|
}
|
|
555
551
|
|
|
556
552
|
var internalState = {
|
|
557
|
-
set: set
|
|
553
|
+
set: set,
|
|
558
554
|
get: get,
|
|
559
555
|
has: has,
|
|
560
556
|
enforce: enforce,
|
|
@@ -652,22 +648,22 @@ var toIntegerOrInfinity = function (argument) {
|
|
|
652
648
|
};
|
|
653
649
|
|
|
654
650
|
var max = Math.max;
|
|
655
|
-
var min$
|
|
651
|
+
var min$1 = Math.min;
|
|
656
652
|
|
|
657
653
|
// Helper for a popular repeating case of the spec:
|
|
658
654
|
// Let integer be ? ToInteger(index).
|
|
659
655
|
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
660
656
|
var toAbsoluteIndex = function (index, length) {
|
|
661
657
|
var integer = toIntegerOrInfinity(index);
|
|
662
|
-
return integer < 0 ? max(integer + length, 0) : min$
|
|
658
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
663
659
|
};
|
|
664
660
|
|
|
665
|
-
var min
|
|
661
|
+
var min = Math.min;
|
|
666
662
|
|
|
667
663
|
// `ToLength` abstract operation
|
|
668
664
|
// https://tc39.es/ecma262/#sec-tolength
|
|
669
665
|
var toLength = function (argument) {
|
|
670
|
-
return argument > 0 ? min
|
|
666
|
+
return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
671
667
|
};
|
|
672
668
|
|
|
673
669
|
// `LengthOfArrayLike` abstract operation
|
|
@@ -677,7 +673,7 @@ var lengthOfArrayLike = function (obj) {
|
|
|
677
673
|
};
|
|
678
674
|
|
|
679
675
|
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
680
|
-
var createMethod
|
|
676
|
+
var createMethod = function (IS_INCLUDES) {
|
|
681
677
|
return function ($this, el, fromIndex) {
|
|
682
678
|
var O = toIndexedObject($this);
|
|
683
679
|
var length = lengthOfArrayLike(O);
|
|
@@ -699,26 +695,26 @@ var createMethod$2 = function (IS_INCLUDES) {
|
|
|
699
695
|
var arrayIncludes = {
|
|
700
696
|
// `Array.prototype.includes` method
|
|
701
697
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
702
|
-
includes: createMethod
|
|
698
|
+
includes: createMethod(true),
|
|
703
699
|
// `Array.prototype.indexOf` method
|
|
704
700
|
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
705
|
-
indexOf: createMethod
|
|
701
|
+
indexOf: createMethod(false)
|
|
706
702
|
};
|
|
707
703
|
|
|
708
|
-
var indexOf
|
|
704
|
+
var indexOf = arrayIncludes.indexOf;
|
|
709
705
|
|
|
710
706
|
|
|
711
|
-
var push
|
|
707
|
+
var push = functionUncurryThis([].push);
|
|
712
708
|
|
|
713
709
|
var objectKeysInternal = function (object, names) {
|
|
714
710
|
var O = toIndexedObject(object);
|
|
715
711
|
var i = 0;
|
|
716
712
|
var result = [];
|
|
717
713
|
var key;
|
|
718
|
-
for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push
|
|
714
|
+
for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push(result, key);
|
|
719
715
|
// Don't enum bug & hidden keys
|
|
720
716
|
while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
|
|
721
|
-
~indexOf
|
|
717
|
+
~indexOf(result, key) || push(result, key);
|
|
722
718
|
}
|
|
723
719
|
return result;
|
|
724
720
|
};
|
|
@@ -739,28 +735,28 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
|
739
735
|
// `Object.getOwnPropertyNames` method
|
|
740
736
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
741
737
|
// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
|
|
742
|
-
var f$
|
|
738
|
+
var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
743
739
|
return objectKeysInternal(O, hiddenKeys);
|
|
744
740
|
};
|
|
745
741
|
|
|
746
742
|
var objectGetOwnPropertyNames = {
|
|
747
|
-
f: f$
|
|
743
|
+
f: f$2
|
|
748
744
|
};
|
|
749
745
|
|
|
750
746
|
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
|
|
751
|
-
var f$
|
|
747
|
+
var f$1 = Object.getOwnPropertySymbols;
|
|
752
748
|
|
|
753
749
|
var objectGetOwnPropertySymbols = {
|
|
754
|
-
f: f$
|
|
750
|
+
f: f$1
|
|
755
751
|
};
|
|
756
752
|
|
|
757
|
-
var concat
|
|
753
|
+
var concat = functionUncurryThis([].concat);
|
|
758
754
|
|
|
759
755
|
// all object keys, includes non-enumerable and symbols
|
|
760
756
|
var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
761
757
|
var keys = objectGetOwnPropertyNames.f(anObject(it));
|
|
762
758
|
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
|
763
|
-
return getOwnPropertySymbols ? concat
|
|
759
|
+
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
|
764
760
|
};
|
|
765
761
|
|
|
766
762
|
var copyConstructorProperties = function (target, source, exceptions) {
|
|
@@ -770,2086 +766,234 @@ var copyConstructorProperties = function (target, source, exceptions) {
|
|
|
770
766
|
for (var i = 0; i < keys.length; i++) {
|
|
771
767
|
var key = keys[i];
|
|
772
768
|
if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
|
|
773
|
-
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
var replacement = /#|\.prototype\./;
|
|
779
|
-
|
|
780
|
-
var isForced = function (feature, detection) {
|
|
781
|
-
var value = data$1[normalize(feature)];
|
|
782
|
-
return value == POLYFILL ? true
|
|
783
|
-
: value == NATIVE ? false
|
|
784
|
-
: isCallable(detection) ? fails(detection)
|
|
785
|
-
: !!detection;
|
|
786
|
-
};
|
|
787
|
-
|
|
788
|
-
var normalize = isForced.normalize = function (string) {
|
|
789
|
-
return String(string).replace(replacement, '.').toLowerCase();
|
|
790
|
-
};
|
|
791
|
-
|
|
792
|
-
var data$1 = isForced.data = {};
|
|
793
|
-
var NATIVE = isForced.NATIVE = 'N';
|
|
794
|
-
var POLYFILL = isForced.POLYFILL = 'P';
|
|
795
|
-
|
|
796
|
-
var isForced_1 = isForced;
|
|
797
|
-
|
|
798
|
-
var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
/*
|
|
806
|
-
options.target - name of the target object
|
|
807
|
-
options.global - target is the global object
|
|
808
|
-
options.stat - export as static methods of target
|
|
809
|
-
options.proto - export as prototype methods of target
|
|
810
|
-
options.real - real prototype method for the `pure` version
|
|
811
|
-
options.forced - export even if the native feature is available
|
|
812
|
-
options.bind - bind methods to the target, required for the `pure` version
|
|
813
|
-
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
814
|
-
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
815
|
-
options.sham - add a flag to not completely full polyfills
|
|
816
|
-
options.enumerable - export as enumerable property
|
|
817
|
-
options.dontCallGetSet - prevent calling a getter on target
|
|
818
|
-
options.name - the .name of the function if it does not match the key
|
|
819
|
-
*/
|
|
820
|
-
var _export = function (options, source) {
|
|
821
|
-
var TARGET = options.target;
|
|
822
|
-
var GLOBAL = options.global;
|
|
823
|
-
var STATIC = options.stat;
|
|
824
|
-
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
825
|
-
if (GLOBAL) {
|
|
826
|
-
target = global_1;
|
|
827
|
-
} else if (STATIC) {
|
|
828
|
-
target = global_1[TARGET] || defineGlobalProperty(TARGET, {});
|
|
829
|
-
} else {
|
|
830
|
-
target = (global_1[TARGET] || {}).prototype;
|
|
831
|
-
}
|
|
832
|
-
if (target) for (key in source) {
|
|
833
|
-
sourceProperty = source[key];
|
|
834
|
-
if (options.dontCallGetSet) {
|
|
835
|
-
descriptor = getOwnPropertyDescriptor$3(target, key);
|
|
836
|
-
targetProperty = descriptor && descriptor.value;
|
|
837
|
-
} else targetProperty = target[key];
|
|
838
|
-
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
839
|
-
// contained in target
|
|
840
|
-
if (!FORCED && targetProperty !== undefined) {
|
|
841
|
-
if (typeof sourceProperty == typeof targetProperty) continue;
|
|
842
|
-
copyConstructorProperties(sourceProperty, targetProperty);
|
|
843
|
-
}
|
|
844
|
-
// add a flag to not completely full polyfills
|
|
845
|
-
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
846
|
-
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
847
|
-
}
|
|
848
|
-
defineBuiltIn(target, key, sourceProperty, options);
|
|
849
|
-
}
|
|
850
|
-
};
|
|
851
|
-
|
|
852
|
-
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
853
|
-
var test = {};
|
|
854
|
-
|
|
855
|
-
test[TO_STRING_TAG$2] = 'z';
|
|
856
|
-
|
|
857
|
-
var toStringTagSupport = String(test) === '[object z]';
|
|
858
|
-
|
|
859
|
-
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
|
860
|
-
var $Object = Object;
|
|
861
|
-
|
|
862
|
-
// ES3 wrong here
|
|
863
|
-
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
864
|
-
|
|
865
|
-
// fallback for IE11 Script Access Denied error
|
|
866
|
-
var tryGet = function (it, key) {
|
|
867
|
-
try {
|
|
868
|
-
return it[key];
|
|
869
|
-
} catch (error) { /* empty */ }
|
|
870
|
-
};
|
|
871
|
-
|
|
872
|
-
// getting tag from ES6+ `Object.prototype.toString`
|
|
873
|
-
var classof = toStringTagSupport ? classofRaw : function (it) {
|
|
874
|
-
var O, tag, result;
|
|
875
|
-
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
876
|
-
// @@toStringTag case
|
|
877
|
-
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG$1)) == 'string' ? tag
|
|
878
|
-
// builtinTag case
|
|
879
|
-
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
880
|
-
// ES3 arguments fallback
|
|
881
|
-
: (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
882
|
-
};
|
|
883
|
-
|
|
884
|
-
var $String$1 = String;
|
|
885
|
-
|
|
886
|
-
var toString_1 = function (argument) {
|
|
887
|
-
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
888
|
-
return $String$1(argument);
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
// `RegExp.prototype.flags` getter implementation
|
|
892
|
-
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
893
|
-
var regexpFlags = function () {
|
|
894
|
-
var that = anObject(this);
|
|
895
|
-
var result = '';
|
|
896
|
-
if (that.hasIndices) result += 'd';
|
|
897
|
-
if (that.global) result += 'g';
|
|
898
|
-
if (that.ignoreCase) result += 'i';
|
|
899
|
-
if (that.multiline) result += 'm';
|
|
900
|
-
if (that.dotAll) result += 's';
|
|
901
|
-
if (that.unicode) result += 'u';
|
|
902
|
-
if (that.unicodeSets) result += 'v';
|
|
903
|
-
if (that.sticky) result += 'y';
|
|
904
|
-
return result;
|
|
905
|
-
};
|
|
906
|
-
|
|
907
|
-
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
908
|
-
var $RegExp$2 = global_1.RegExp;
|
|
909
|
-
|
|
910
|
-
var UNSUPPORTED_Y$1 = fails(function () {
|
|
911
|
-
var re = $RegExp$2('a', 'y');
|
|
912
|
-
re.lastIndex = 2;
|
|
913
|
-
return re.exec('abcd') != null;
|
|
914
|
-
});
|
|
915
|
-
|
|
916
|
-
// UC Browser bug
|
|
917
|
-
// https://github.com/zloirock/core-js/issues/1008
|
|
918
|
-
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails(function () {
|
|
919
|
-
return !$RegExp$2('a', 'y').sticky;
|
|
920
|
-
});
|
|
921
|
-
|
|
922
|
-
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
|
|
923
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
924
|
-
var re = $RegExp$2('^r', 'gy');
|
|
925
|
-
re.lastIndex = 2;
|
|
926
|
-
return re.exec('str') != null;
|
|
927
|
-
});
|
|
928
|
-
|
|
929
|
-
var regexpStickyHelpers = {
|
|
930
|
-
BROKEN_CARET: BROKEN_CARET,
|
|
931
|
-
MISSED_STICKY: MISSED_STICKY,
|
|
932
|
-
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
933
|
-
};
|
|
934
|
-
|
|
935
|
-
// `Object.keys` method
|
|
936
|
-
// https://tc39.es/ecma262/#sec-object.keys
|
|
937
|
-
// eslint-disable-next-line es-x/no-object-keys -- safe
|
|
938
|
-
var objectKeys$1 = Object.keys || function keys(O) {
|
|
939
|
-
return objectKeysInternal(O, enumBugKeys);
|
|
940
|
-
};
|
|
941
|
-
|
|
942
|
-
// `Object.defineProperties` method
|
|
943
|
-
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
944
|
-
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
945
|
-
var f$1 = descriptors$1 && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
946
|
-
anObject(O);
|
|
947
|
-
var props = toIndexedObject(Properties);
|
|
948
|
-
var keys = objectKeys$1(Properties);
|
|
949
|
-
var length = keys.length;
|
|
950
|
-
var index = 0;
|
|
951
|
-
var key;
|
|
952
|
-
while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
|
|
953
|
-
return O;
|
|
954
|
-
};
|
|
955
|
-
|
|
956
|
-
var objectDefineProperties = {
|
|
957
|
-
f: f$1
|
|
958
|
-
};
|
|
959
|
-
|
|
960
|
-
var html = getBuiltIn('document', 'documentElement');
|
|
961
|
-
|
|
962
|
-
/* global ActiveXObject -- old IE, WSH */
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
var GT = '>';
|
|
972
|
-
var LT = '<';
|
|
973
|
-
var PROTOTYPE = 'prototype';
|
|
974
|
-
var SCRIPT = 'script';
|
|
975
|
-
var IE_PROTO = sharedKey('IE_PROTO');
|
|
976
|
-
|
|
977
|
-
var EmptyConstructor = function () { /* empty */ };
|
|
978
|
-
|
|
979
|
-
var scriptTag = function (content) {
|
|
980
|
-
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
981
|
-
};
|
|
982
|
-
|
|
983
|
-
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
984
|
-
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
985
|
-
activeXDocument.write(scriptTag(''));
|
|
986
|
-
activeXDocument.close();
|
|
987
|
-
var temp = activeXDocument.parentWindow.Object;
|
|
988
|
-
activeXDocument = null; // avoid memory leak
|
|
989
|
-
return temp;
|
|
990
|
-
};
|
|
991
|
-
|
|
992
|
-
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
993
|
-
var NullProtoObjectViaIFrame = function () {
|
|
994
|
-
// Thrash, waste and sodomy: IE GC bug
|
|
995
|
-
var iframe = documentCreateElement('iframe');
|
|
996
|
-
var JS = 'java' + SCRIPT + ':';
|
|
997
|
-
var iframeDocument;
|
|
998
|
-
iframe.style.display = 'none';
|
|
999
|
-
html.appendChild(iframe);
|
|
1000
|
-
// https://github.com/zloirock/core-js/issues/475
|
|
1001
|
-
iframe.src = String(JS);
|
|
1002
|
-
iframeDocument = iframe.contentWindow.document;
|
|
1003
|
-
iframeDocument.open();
|
|
1004
|
-
iframeDocument.write(scriptTag('document.F=Object'));
|
|
1005
|
-
iframeDocument.close();
|
|
1006
|
-
return iframeDocument.F;
|
|
1007
|
-
};
|
|
1008
|
-
|
|
1009
|
-
// Check for document.domain and active x support
|
|
1010
|
-
// No need to use active x approach when document.domain is not set
|
|
1011
|
-
// see https://github.com/es-shims/es5-shim/issues/150
|
|
1012
|
-
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
1013
|
-
// avoid IE GC bug
|
|
1014
|
-
var activeXDocument;
|
|
1015
|
-
var NullProtoObject = function () {
|
|
1016
|
-
try {
|
|
1017
|
-
activeXDocument = new ActiveXObject('htmlfile');
|
|
1018
|
-
} catch (error) { /* ignore */ }
|
|
1019
|
-
NullProtoObject = typeof document != 'undefined'
|
|
1020
|
-
? document.domain && activeXDocument
|
|
1021
|
-
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
1022
|
-
: NullProtoObjectViaIFrame()
|
|
1023
|
-
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
1024
|
-
var length = enumBugKeys.length;
|
|
1025
|
-
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
1026
|
-
return NullProtoObject();
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
|
-
hiddenKeys$1[IE_PROTO] = true;
|
|
1030
|
-
|
|
1031
|
-
// `Object.create` method
|
|
1032
|
-
// https://tc39.es/ecma262/#sec-object.create
|
|
1033
|
-
// eslint-disable-next-line es-x/no-object-create -- safe
|
|
1034
|
-
var objectCreate = Object.create || function create(O, Properties) {
|
|
1035
|
-
var result;
|
|
1036
|
-
if (O !== null) {
|
|
1037
|
-
EmptyConstructor[PROTOTYPE] = anObject(O);
|
|
1038
|
-
result = new EmptyConstructor();
|
|
1039
|
-
EmptyConstructor[PROTOTYPE] = null;
|
|
1040
|
-
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
1041
|
-
result[IE_PROTO] = O;
|
|
1042
|
-
} else result = NullProtoObject();
|
|
1043
|
-
return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
|
|
1044
|
-
};
|
|
1045
|
-
|
|
1046
|
-
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
1047
|
-
var $RegExp$1 = global_1.RegExp;
|
|
1048
|
-
|
|
1049
|
-
var regexpUnsupportedDotAll = fails(function () {
|
|
1050
|
-
var re = $RegExp$1('.', 's');
|
|
1051
|
-
return !(re.dotAll && re.exec('\n') && re.flags === 's');
|
|
1052
|
-
});
|
|
1053
|
-
|
|
1054
|
-
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
1055
|
-
var $RegExp = global_1.RegExp;
|
|
1056
|
-
|
|
1057
|
-
var regexpUnsupportedNcg = fails(function () {
|
|
1058
|
-
var re = $RegExp('(?<a>b)', 'g');
|
|
1059
|
-
return re.exec('b').groups.a !== 'b' ||
|
|
1060
|
-
'b'.replace(re, '$<a>c') !== 'bc';
|
|
1061
|
-
});
|
|
1062
|
-
|
|
1063
|
-
/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
|
|
1064
|
-
/* eslint-disable regexp/no-useless-quantifier -- testing */
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
var getInternalState = internalState.get;
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
1077
|
-
var nativeExec = RegExp.prototype.exec;
|
|
1078
|
-
var patchedExec = nativeExec;
|
|
1079
|
-
var charAt$2 = functionUncurryThis(''.charAt);
|
|
1080
|
-
var indexOf = functionUncurryThis(''.indexOf);
|
|
1081
|
-
var replace = functionUncurryThis(''.replace);
|
|
1082
|
-
var stringSlice$2 = functionUncurryThis(''.slice);
|
|
1083
|
-
|
|
1084
|
-
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
1085
|
-
var re1 = /a/;
|
|
1086
|
-
var re2 = /b*/g;
|
|
1087
|
-
functionCall(nativeExec, re1, 'a');
|
|
1088
|
-
functionCall(nativeExec, re2, 'a');
|
|
1089
|
-
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
|
1090
|
-
})();
|
|
1091
|
-
|
|
1092
|
-
var UNSUPPORTED_Y = regexpStickyHelpers.BROKEN_CARET;
|
|
1093
|
-
|
|
1094
|
-
// nonparticipating capturing group, copied from es5-shim's String#split patch.
|
|
1095
|
-
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
1096
|
-
|
|
1097
|
-
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || regexpUnsupportedDotAll || regexpUnsupportedNcg;
|
|
1098
|
-
|
|
1099
|
-
if (PATCH) {
|
|
1100
|
-
patchedExec = function exec(string) {
|
|
1101
|
-
var re = this;
|
|
1102
|
-
var state = getInternalState(re);
|
|
1103
|
-
var str = toString_1(string);
|
|
1104
|
-
var raw = state.raw;
|
|
1105
|
-
var result, reCopy, lastIndex, match, i, object, group;
|
|
1106
|
-
|
|
1107
|
-
if (raw) {
|
|
1108
|
-
raw.lastIndex = re.lastIndex;
|
|
1109
|
-
result = functionCall(patchedExec, raw, str);
|
|
1110
|
-
re.lastIndex = raw.lastIndex;
|
|
1111
|
-
return result;
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
var groups = state.groups;
|
|
1115
|
-
var sticky = UNSUPPORTED_Y && re.sticky;
|
|
1116
|
-
var flags = functionCall(regexpFlags, re);
|
|
1117
|
-
var source = re.source;
|
|
1118
|
-
var charsAdded = 0;
|
|
1119
|
-
var strCopy = str;
|
|
1120
|
-
|
|
1121
|
-
if (sticky) {
|
|
1122
|
-
flags = replace(flags, 'y', '');
|
|
1123
|
-
if (indexOf(flags, 'g') === -1) {
|
|
1124
|
-
flags += 'g';
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
strCopy = stringSlice$2(str, re.lastIndex);
|
|
1128
|
-
// Support anchored sticky behavior.
|
|
1129
|
-
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$2(str, re.lastIndex - 1) !== '\n')) {
|
|
1130
|
-
source = '(?: ' + source + ')';
|
|
1131
|
-
strCopy = ' ' + strCopy;
|
|
1132
|
-
charsAdded++;
|
|
1133
|
-
}
|
|
1134
|
-
// ^(? + rx + ) is needed, in combination with some str slicing, to
|
|
1135
|
-
// simulate the 'y' flag.
|
|
1136
|
-
reCopy = new RegExp('^(?:' + source + ')', flags);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
if (NPCG_INCLUDED) {
|
|
1140
|
-
reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
|
|
1141
|
-
}
|
|
1142
|
-
if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
|
1143
|
-
|
|
1144
|
-
match = functionCall(nativeExec, sticky ? reCopy : re, strCopy);
|
|
1145
|
-
|
|
1146
|
-
if (sticky) {
|
|
1147
|
-
if (match) {
|
|
1148
|
-
match.input = stringSlice$2(match.input, charsAdded);
|
|
1149
|
-
match[0] = stringSlice$2(match[0], charsAdded);
|
|
1150
|
-
match.index = re.lastIndex;
|
|
1151
|
-
re.lastIndex += match[0].length;
|
|
1152
|
-
} else re.lastIndex = 0;
|
|
1153
|
-
} else if (UPDATES_LAST_INDEX_WRONG && match) {
|
|
1154
|
-
re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
|
1155
|
-
}
|
|
1156
|
-
if (NPCG_INCLUDED && match && match.length > 1) {
|
|
1157
|
-
// Fix browsers whose `exec` methods don't consistently return `undefined`
|
|
1158
|
-
// for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
|
|
1159
|
-
functionCall(nativeReplace, match[0], reCopy, function () {
|
|
1160
|
-
for (i = 1; i < arguments.length - 2; i++) {
|
|
1161
|
-
if (arguments[i] === undefined) match[i] = undefined;
|
|
1162
|
-
}
|
|
1163
|
-
});
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
if (match && groups) {
|
|
1167
|
-
match.groups = object = objectCreate(null);
|
|
1168
|
-
for (i = 0; i < groups.length; i++) {
|
|
1169
|
-
group = groups[i];
|
|
1170
|
-
object[group[0]] = match[group[1]];
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
return match;
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
var regexpExec = patchedExec;
|
|
1179
|
-
|
|
1180
|
-
// `RegExp.prototype.exec` method
|
|
1181
|
-
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
1182
|
-
_export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
|
|
1183
|
-
exec: regexpExec
|
|
1184
|
-
});
|
|
1185
|
-
|
|
1186
|
-
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
var SPECIES$5 = wellKnownSymbol('species');
|
|
1196
|
-
var RegExpPrototype = RegExp.prototype;
|
|
1197
|
-
|
|
1198
|
-
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
1199
|
-
var SYMBOL = wellKnownSymbol(KEY);
|
|
1200
|
-
|
|
1201
|
-
var DELEGATES_TO_SYMBOL = !fails(function () {
|
|
1202
|
-
// String methods call symbol-named RegEp methods
|
|
1203
|
-
var O = {};
|
|
1204
|
-
O[SYMBOL] = function () { return 7; };
|
|
1205
|
-
return ''[KEY](O) != 7;
|
|
1206
|
-
});
|
|
1207
|
-
|
|
1208
|
-
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
|
1209
|
-
// Symbol-named RegExp methods call .exec
|
|
1210
|
-
var execCalled = false;
|
|
1211
|
-
var re = /a/;
|
|
1212
|
-
|
|
1213
|
-
if (KEY === 'split') {
|
|
1214
|
-
// We can't use real regex here since it causes deoptimization
|
|
1215
|
-
// and serious performance degradation in V8
|
|
1216
|
-
// https://github.com/zloirock/core-js/issues/306
|
|
1217
|
-
re = {};
|
|
1218
|
-
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
1219
|
-
// a new one. We need to return the patched regex when creating the new one.
|
|
1220
|
-
re.constructor = {};
|
|
1221
|
-
re.constructor[SPECIES$5] = function () { return re; };
|
|
1222
|
-
re.flags = '';
|
|
1223
|
-
re[SYMBOL] = /./[SYMBOL];
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
re.exec = function () { execCalled = true; return null; };
|
|
1227
|
-
|
|
1228
|
-
re[SYMBOL]('');
|
|
1229
|
-
return !execCalled;
|
|
1230
|
-
});
|
|
1231
|
-
|
|
1232
|
-
if (
|
|
1233
|
-
!DELEGATES_TO_SYMBOL ||
|
|
1234
|
-
!DELEGATES_TO_EXEC ||
|
|
1235
|
-
FORCED
|
|
1236
|
-
) {
|
|
1237
|
-
var uncurriedNativeRegExpMethod = functionUncurryThis(/./[SYMBOL]);
|
|
1238
|
-
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
1239
|
-
var uncurriedNativeMethod = functionUncurryThis(nativeMethod);
|
|
1240
|
-
var $exec = regexp.exec;
|
|
1241
|
-
if ($exec === regexpExec || $exec === RegExpPrototype.exec) {
|
|
1242
|
-
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
1243
|
-
// The native String method already delegates to @@method (this
|
|
1244
|
-
// polyfilled function), leasing to infinite recursion.
|
|
1245
|
-
// We avoid it by directly calling the native @@method method.
|
|
1246
|
-
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
1247
|
-
}
|
|
1248
|
-
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
1249
|
-
}
|
|
1250
|
-
return { done: false };
|
|
1251
|
-
});
|
|
1252
|
-
|
|
1253
|
-
defineBuiltIn(String.prototype, KEY, methods[0]);
|
|
1254
|
-
defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
|
|
1258
|
-
};
|
|
1259
|
-
|
|
1260
|
-
var charAt$1 = functionUncurryThis(''.charAt);
|
|
1261
|
-
var charCodeAt = functionUncurryThis(''.charCodeAt);
|
|
1262
|
-
var stringSlice$1 = functionUncurryThis(''.slice);
|
|
1263
|
-
|
|
1264
|
-
var createMethod$1 = function (CONVERT_TO_STRING) {
|
|
1265
|
-
return function ($this, pos) {
|
|
1266
|
-
var S = toString_1(requireObjectCoercible($this));
|
|
1267
|
-
var position = toIntegerOrInfinity(pos);
|
|
1268
|
-
var size = S.length;
|
|
1269
|
-
var first, second;
|
|
1270
|
-
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
1271
|
-
first = charCodeAt(S, position);
|
|
1272
|
-
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
1273
|
-
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
1274
|
-
? CONVERT_TO_STRING
|
|
1275
|
-
? charAt$1(S, position)
|
|
1276
|
-
: first
|
|
1277
|
-
: CONVERT_TO_STRING
|
|
1278
|
-
? stringSlice$1(S, position, position + 2)
|
|
1279
|
-
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
1280
|
-
};
|
|
1281
|
-
};
|
|
1282
|
-
|
|
1283
|
-
var stringMultibyte = {
|
|
1284
|
-
// `String.prototype.codePointAt` method
|
|
1285
|
-
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
1286
|
-
codeAt: createMethod$1(false),
|
|
1287
|
-
// `String.prototype.at` method
|
|
1288
|
-
// https://github.com/mathiasbynens/String.prototype.at
|
|
1289
|
-
charAt: createMethod$1(true)
|
|
1290
|
-
};
|
|
1291
|
-
|
|
1292
|
-
var charAt = stringMultibyte.charAt;
|
|
1293
|
-
|
|
1294
|
-
// `AdvanceStringIndex` abstract operation
|
|
1295
|
-
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
1296
|
-
var advanceStringIndex = function (S, index, unicode) {
|
|
1297
|
-
return index + (unicode ? charAt(S, index).length : 1);
|
|
1298
|
-
};
|
|
1299
|
-
|
|
1300
|
-
var $TypeError$9 = TypeError;
|
|
1301
|
-
|
|
1302
|
-
// `RegExpExec` abstract operation
|
|
1303
|
-
// https://tc39.es/ecma262/#sec-regexpexec
|
|
1304
|
-
var regexpExecAbstract = function (R, S) {
|
|
1305
|
-
var exec = R.exec;
|
|
1306
|
-
if (isCallable(exec)) {
|
|
1307
|
-
var result = functionCall(exec, R, S);
|
|
1308
|
-
if (result !== null) anObject(result);
|
|
1309
|
-
return result;
|
|
1310
|
-
}
|
|
1311
|
-
if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
|
|
1312
|
-
throw $TypeError$9('RegExp#exec called on incompatible receiver');
|
|
1313
|
-
};
|
|
1314
|
-
|
|
1315
|
-
// @@match logic
|
|
1316
|
-
fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
|
|
1317
|
-
return [
|
|
1318
|
-
// `String.prototype.match` method
|
|
1319
|
-
// https://tc39.es/ecma262/#sec-string.prototype.match
|
|
1320
|
-
function match(regexp) {
|
|
1321
|
-
var O = requireObjectCoercible(this);
|
|
1322
|
-
var matcher = isNullOrUndefined$1(regexp) ? undefined : getMethod(regexp, MATCH);
|
|
1323
|
-
return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
|
|
1324
|
-
},
|
|
1325
|
-
// `RegExp.prototype[@@match]` method
|
|
1326
|
-
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
|
|
1327
|
-
function (string) {
|
|
1328
|
-
var rx = anObject(this);
|
|
1329
|
-
var S = toString_1(string);
|
|
1330
|
-
var res = maybeCallNative(nativeMatch, rx, S);
|
|
1331
|
-
|
|
1332
|
-
if (res.done) return res.value;
|
|
1333
|
-
|
|
1334
|
-
if (!rx.global) return regexpExecAbstract(rx, S);
|
|
1335
|
-
|
|
1336
|
-
var fullUnicode = rx.unicode;
|
|
1337
|
-
rx.lastIndex = 0;
|
|
1338
|
-
var A = [];
|
|
1339
|
-
var n = 0;
|
|
1340
|
-
var result;
|
|
1341
|
-
while ((result = regexpExecAbstract(rx, S)) !== null) {
|
|
1342
|
-
var matchStr = toString_1(result[0]);
|
|
1343
|
-
A[n] = matchStr;
|
|
1344
|
-
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
|
1345
|
-
n++;
|
|
1346
|
-
}
|
|
1347
|
-
return n === 0 ? null : A;
|
|
1348
|
-
}
|
|
1349
|
-
];
|
|
1350
|
-
});
|
|
1351
|
-
|
|
1352
|
-
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
|
1353
|
-
var method = [][METHOD_NAME];
|
|
1354
|
-
return !!method && fails(function () {
|
|
1355
|
-
// eslint-disable-next-line no-useless-call -- required for testing
|
|
1356
|
-
method.call(null, argument || function () { return 1; }, 1);
|
|
1357
|
-
});
|
|
1358
|
-
};
|
|
1359
|
-
|
|
1360
|
-
var nativeJoin = functionUncurryThis([].join);
|
|
1361
|
-
|
|
1362
|
-
var ES3_STRINGS = indexedObject != Object;
|
|
1363
|
-
var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
|
|
1364
|
-
|
|
1365
|
-
// `Array.prototype.join` method
|
|
1366
|
-
// https://tc39.es/ecma262/#sec-array.prototype.join
|
|
1367
|
-
_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
|
|
1368
|
-
join: function join(separator) {
|
|
1369
|
-
return nativeJoin(toIndexedObject(this), separator === undefined ? ',' : separator);
|
|
1370
|
-
}
|
|
1371
|
-
});
|
|
1372
|
-
|
|
1373
|
-
// `Object.prototype.toString` method implementation
|
|
1374
|
-
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1375
|
-
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
1376
|
-
return '[object ' + classof(this) + ']';
|
|
1377
|
-
};
|
|
1378
|
-
|
|
1379
|
-
// `Object.prototype.toString` method
|
|
1380
|
-
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1381
|
-
if (!toStringTagSupport) {
|
|
1382
|
-
defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys$1(1); });
|
|
1386
|
-
|
|
1387
|
-
// `Object.keys` method
|
|
1388
|
-
// https://tc39.es/ecma262/#sec-object.keys
|
|
1389
|
-
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
1390
|
-
keys: function keys(it) {
|
|
1391
|
-
return objectKeys$1(toObject(it));
|
|
1392
|
-
}
|
|
1393
|
-
});
|
|
1394
|
-
|
|
1395
|
-
// `IsArray` abstract operation
|
|
1396
|
-
// https://tc39.es/ecma262/#sec-isarray
|
|
1397
|
-
// eslint-disable-next-line es-x/no-array-isarray -- safe
|
|
1398
|
-
var isArray$2 = Array.isArray || function isArray(argument) {
|
|
1399
|
-
return classofRaw(argument) == 'Array';
|
|
1400
|
-
};
|
|
1401
|
-
|
|
1402
|
-
var $TypeError$8 = TypeError;
|
|
1403
|
-
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
|
|
1404
|
-
|
|
1405
|
-
var doesNotExceedSafeInteger = function (it) {
|
|
1406
|
-
if (it > MAX_SAFE_INTEGER) throw $TypeError$8('Maximum allowed index exceeded');
|
|
1407
|
-
return it;
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
var createProperty = function (object, key, value) {
|
|
1411
|
-
var propertyKey = toPropertyKey(key);
|
|
1412
|
-
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
1413
|
-
else object[propertyKey] = value;
|
|
1414
|
-
};
|
|
1415
|
-
|
|
1416
|
-
var noop = function () { /* empty */ };
|
|
1417
|
-
var empty = [];
|
|
1418
|
-
var construct = getBuiltIn('Reflect', 'construct');
|
|
1419
|
-
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
1420
|
-
var exec = functionUncurryThis(constructorRegExp.exec);
|
|
1421
|
-
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
1422
|
-
|
|
1423
|
-
var isConstructorModern = function isConstructor(argument) {
|
|
1424
|
-
if (!isCallable(argument)) return false;
|
|
1425
|
-
try {
|
|
1426
|
-
construct(noop, empty, argument);
|
|
1427
|
-
return true;
|
|
1428
|
-
} catch (error) {
|
|
1429
|
-
return false;
|
|
1430
|
-
}
|
|
1431
|
-
};
|
|
1432
|
-
|
|
1433
|
-
var isConstructorLegacy = function isConstructor(argument) {
|
|
1434
|
-
if (!isCallable(argument)) return false;
|
|
1435
|
-
switch (classof(argument)) {
|
|
1436
|
-
case 'AsyncFunction':
|
|
1437
|
-
case 'GeneratorFunction':
|
|
1438
|
-
case 'AsyncGeneratorFunction': return false;
|
|
1439
|
-
}
|
|
1440
|
-
try {
|
|
1441
|
-
// we can't check .prototype since constructors produced by .bind haven't it
|
|
1442
|
-
// `Function#toString` throws on some built-it function in some legacy engines
|
|
1443
|
-
// (for example, `DOMQuad` and similar in FF41-)
|
|
1444
|
-
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
|
1445
|
-
} catch (error) {
|
|
1446
|
-
return true;
|
|
1447
|
-
}
|
|
1448
|
-
};
|
|
1449
|
-
|
|
1450
|
-
isConstructorLegacy.sham = true;
|
|
1451
|
-
|
|
1452
|
-
// `IsConstructor` abstract operation
|
|
1453
|
-
// https://tc39.es/ecma262/#sec-isconstructor
|
|
1454
|
-
var isConstructor = !construct || fails(function () {
|
|
1455
|
-
var called;
|
|
1456
|
-
return isConstructorModern(isConstructorModern.call)
|
|
1457
|
-
|| !isConstructorModern(Object)
|
|
1458
|
-
|| !isConstructorModern(function () { called = true; })
|
|
1459
|
-
|| called;
|
|
1460
|
-
}) ? isConstructorLegacy : isConstructorModern;
|
|
1461
|
-
|
|
1462
|
-
var SPECIES$4 = wellKnownSymbol('species');
|
|
1463
|
-
var $Array = Array;
|
|
1464
|
-
|
|
1465
|
-
// a part of `ArraySpeciesCreate` abstract operation
|
|
1466
|
-
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1467
|
-
var arraySpeciesConstructor = function (originalArray) {
|
|
1468
|
-
var C;
|
|
1469
|
-
if (isArray$2(originalArray)) {
|
|
1470
|
-
C = originalArray.constructor;
|
|
1471
|
-
// cross-realm fallback
|
|
1472
|
-
if (isConstructor(C) && (C === $Array || isArray$2(C.prototype))) C = undefined;
|
|
1473
|
-
else if (isObject$2(C)) {
|
|
1474
|
-
C = C[SPECIES$4];
|
|
1475
|
-
if (C === null) C = undefined;
|
|
1476
|
-
}
|
|
1477
|
-
} return C === undefined ? $Array : C;
|
|
1478
|
-
};
|
|
1479
|
-
|
|
1480
|
-
// `ArraySpeciesCreate` abstract operation
|
|
1481
|
-
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1482
|
-
var arraySpeciesCreate = function (originalArray, length) {
|
|
1483
|
-
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
1484
|
-
};
|
|
1485
|
-
|
|
1486
|
-
var SPECIES$3 = wellKnownSymbol('species');
|
|
1487
|
-
|
|
1488
|
-
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
1489
|
-
// We can't use this feature detection in V8 since it causes
|
|
1490
|
-
// deoptimization and serious performance degradation
|
|
1491
|
-
// https://github.com/zloirock/core-js/issues/677
|
|
1492
|
-
return engineV8Version >= 51 || !fails(function () {
|
|
1493
|
-
var array = [];
|
|
1494
|
-
var constructor = array.constructor = {};
|
|
1495
|
-
constructor[SPECIES$3] = function () {
|
|
1496
|
-
return { foo: 1 };
|
|
1497
|
-
};
|
|
1498
|
-
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
1499
|
-
});
|
|
1500
|
-
};
|
|
1501
|
-
|
|
1502
|
-
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
1503
|
-
|
|
1504
|
-
// We can't use this feature detection in V8 since it causes
|
|
1505
|
-
// deoptimization and serious performance degradation
|
|
1506
|
-
// https://github.com/zloirock/core-js/issues/679
|
|
1507
|
-
var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
|
1508
|
-
var array = [];
|
|
1509
|
-
array[IS_CONCAT_SPREADABLE] = false;
|
|
1510
|
-
return array.concat()[0] !== array;
|
|
1511
|
-
});
|
|
1512
|
-
|
|
1513
|
-
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
1514
|
-
|
|
1515
|
-
var isConcatSpreadable = function (O) {
|
|
1516
|
-
if (!isObject$2(O)) return false;
|
|
1517
|
-
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
1518
|
-
return spreadable !== undefined ? !!spreadable : isArray$2(O);
|
|
1519
|
-
};
|
|
1520
|
-
|
|
1521
|
-
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
1522
|
-
|
|
1523
|
-
// `Array.prototype.concat` method
|
|
1524
|
-
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
1525
|
-
// with adding support of @@isConcatSpreadable and @@species
|
|
1526
|
-
_export({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
1527
|
-
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
1528
|
-
concat: function concat(arg) {
|
|
1529
|
-
var O = toObject(this);
|
|
1530
|
-
var A = arraySpeciesCreate(O, 0);
|
|
1531
|
-
var n = 0;
|
|
1532
|
-
var i, k, length, len, E;
|
|
1533
|
-
for (i = -1, length = arguments.length; i < length; i++) {
|
|
1534
|
-
E = i === -1 ? O : arguments[i];
|
|
1535
|
-
if (isConcatSpreadable(E)) {
|
|
1536
|
-
len = lengthOfArrayLike(E);
|
|
1537
|
-
doesNotExceedSafeInteger(n + len);
|
|
1538
|
-
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
1539
|
-
} else {
|
|
1540
|
-
doesNotExceedSafeInteger(n + 1);
|
|
1541
|
-
createProperty(A, n++, E);
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
A.length = n;
|
|
1545
|
-
return A;
|
|
1546
|
-
}
|
|
1547
|
-
});
|
|
1548
|
-
|
|
1549
|
-
var defineProperty$3 = objectDefineProperty.f;
|
|
1550
|
-
|
|
1551
|
-
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
1552
|
-
var ArrayPrototype$1 = Array.prototype;
|
|
1553
|
-
|
|
1554
|
-
// Array.prototype[@@unscopables]
|
|
1555
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1556
|
-
if (ArrayPrototype$1[UNSCOPABLES] == undefined) {
|
|
1557
|
-
defineProperty$3(ArrayPrototype$1, UNSCOPABLES, {
|
|
1558
|
-
configurable: true,
|
|
1559
|
-
value: objectCreate(null)
|
|
1560
|
-
});
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
// add a key to Array.prototype[@@unscopables]
|
|
1564
|
-
var addToUnscopables = function (key) {
|
|
1565
|
-
ArrayPrototype$1[UNSCOPABLES][key] = true;
|
|
1566
|
-
};
|
|
1567
|
-
|
|
1568
|
-
var $includes = arrayIncludes.includes;
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
// FF99+ bug
|
|
1573
|
-
var BROKEN_ON_SPARSE = fails(function () {
|
|
1574
|
-
return !Array(1).includes();
|
|
1575
|
-
});
|
|
1576
|
-
|
|
1577
|
-
// `Array.prototype.includes` method
|
|
1578
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1579
|
-
_export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
1580
|
-
includes: function includes(el /* , fromIndex = 0 */) {
|
|
1581
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
1582
|
-
}
|
|
1583
|
-
});
|
|
1584
|
-
|
|
1585
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1586
|
-
addToUnscopables('includes');
|
|
1587
|
-
|
|
1588
|
-
var MATCH$1 = wellKnownSymbol('match');
|
|
1589
|
-
|
|
1590
|
-
// `IsRegExp` abstract operation
|
|
1591
|
-
// https://tc39.es/ecma262/#sec-isregexp
|
|
1592
|
-
var isRegexp = function (it) {
|
|
1593
|
-
var isRegExp;
|
|
1594
|
-
return isObject$2(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
|
1595
|
-
};
|
|
1596
|
-
|
|
1597
|
-
var $TypeError$7 = TypeError;
|
|
1598
|
-
|
|
1599
|
-
var notARegexp = function (it) {
|
|
1600
|
-
if (isRegexp(it)) {
|
|
1601
|
-
throw $TypeError$7("The method doesn't accept regular expressions");
|
|
1602
|
-
} return it;
|
|
1603
|
-
};
|
|
1604
|
-
|
|
1605
|
-
var MATCH = wellKnownSymbol('match');
|
|
1606
|
-
|
|
1607
|
-
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
1608
|
-
var regexp = /./;
|
|
1609
|
-
try {
|
|
1610
|
-
'/./'[METHOD_NAME](regexp);
|
|
1611
|
-
} catch (error1) {
|
|
1612
|
-
try {
|
|
1613
|
-
regexp[MATCH] = false;
|
|
1614
|
-
return '/./'[METHOD_NAME](regexp);
|
|
1615
|
-
} catch (error2) { /* empty */ }
|
|
1616
|
-
} return false;
|
|
1617
|
-
};
|
|
1618
|
-
|
|
1619
|
-
var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
// eslint-disable-next-line es-x/no-string-prototype-endswith -- safe
|
|
1628
|
-
var nativeEndsWith = functionUncurryThis(''.endsWith);
|
|
1629
|
-
var slice = functionUncurryThis(''.slice);
|
|
1630
|
-
var min$1 = Math.min;
|
|
1631
|
-
|
|
1632
|
-
var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('endsWith');
|
|
1633
|
-
// https://github.com/zloirock/core-js/pull/702
|
|
1634
|
-
var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
|
|
1635
|
-
var descriptor = getOwnPropertyDescriptor$2(String.prototype, 'endsWith');
|
|
1636
|
-
return descriptor && !descriptor.writable;
|
|
1637
|
-
}();
|
|
1638
|
-
|
|
1639
|
-
// `String.prototype.endsWith` method
|
|
1640
|
-
// https://tc39.es/ecma262/#sec-string.prototype.endswith
|
|
1641
|
-
_export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
|
|
1642
|
-
endsWith: function endsWith(searchString /* , endPosition = @length */) {
|
|
1643
|
-
var that = toString_1(requireObjectCoercible(this));
|
|
1644
|
-
notARegexp(searchString);
|
|
1645
|
-
var endPosition = arguments.length > 1 ? arguments[1] : undefined;
|
|
1646
|
-
var len = that.length;
|
|
1647
|
-
var end = endPosition === undefined ? len : min$1(toLength(endPosition), len);
|
|
1648
|
-
var search = toString_1(searchString);
|
|
1649
|
-
return nativeEndsWith
|
|
1650
|
-
? nativeEndsWith(that, search, end)
|
|
1651
|
-
: slice(that, end - search.length, end) === search;
|
|
1652
|
-
}
|
|
1653
|
-
});
|
|
1654
|
-
|
|
1655
|
-
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
// eslint-disable-next-line es-x/no-string-prototype-startswith -- safe
|
|
1664
|
-
var nativeStartsWith = functionUncurryThis(''.startsWith);
|
|
1665
|
-
var stringSlice = functionUncurryThis(''.slice);
|
|
1666
|
-
var min = Math.min;
|
|
1667
|
-
|
|
1668
|
-
var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith');
|
|
1669
|
-
// https://github.com/zloirock/core-js/pull/702
|
|
1670
|
-
var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
|
|
1671
|
-
var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'startsWith');
|
|
1672
|
-
return descriptor && !descriptor.writable;
|
|
1673
|
-
}();
|
|
1674
|
-
|
|
1675
|
-
// `String.prototype.startsWith` method
|
|
1676
|
-
// https://tc39.es/ecma262/#sec-string.prototype.startswith
|
|
1677
|
-
_export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
|
|
1678
|
-
startsWith: function startsWith(searchString /* , position = 0 */) {
|
|
1679
|
-
var that = toString_1(requireObjectCoercible(this));
|
|
1680
|
-
notARegexp(searchString);
|
|
1681
|
-
var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
|
|
1682
|
-
var search = toString_1(searchString);
|
|
1683
|
-
return nativeStartsWith
|
|
1684
|
-
? nativeStartsWith(that, search, index)
|
|
1685
|
-
: stringSlice(that, index, index + search.length) === search;
|
|
1686
|
-
}
|
|
1687
|
-
});
|
|
1688
|
-
|
|
1689
|
-
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
1690
|
-
|
|
1691
|
-
var $String = String;
|
|
1692
|
-
var $TypeError$6 = TypeError;
|
|
1693
|
-
|
|
1694
|
-
var aPossiblePrototype = function (argument) {
|
|
1695
|
-
if (typeof argument == 'object' || isCallable(argument)) return argument;
|
|
1696
|
-
throw $TypeError$6("Can't set " + $String(argument) + ' as a prototype');
|
|
1697
|
-
};
|
|
1698
|
-
|
|
1699
|
-
/* eslint-disable no-proto -- safe */
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
// `Object.setPrototypeOf` method
|
|
1705
|
-
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
1706
|
-
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1707
|
-
// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
|
|
1708
|
-
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1709
|
-
var CORRECT_SETTER = false;
|
|
1710
|
-
var test = {};
|
|
1711
|
-
var setter;
|
|
1712
|
-
try {
|
|
1713
|
-
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
1714
|
-
setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1715
|
-
setter(test, []);
|
|
1716
|
-
CORRECT_SETTER = test instanceof Array;
|
|
1717
|
-
} catch (error) { /* empty */ }
|
|
1718
|
-
return function setPrototypeOf(O, proto) {
|
|
1719
|
-
anObject(O);
|
|
1720
|
-
aPossiblePrototype(proto);
|
|
1721
|
-
if (CORRECT_SETTER) setter(O, proto);
|
|
1722
|
-
else O.__proto__ = proto;
|
|
1723
|
-
return O;
|
|
1724
|
-
};
|
|
1725
|
-
}() : undefined);
|
|
1726
|
-
|
|
1727
|
-
var defineProperty$2 = objectDefineProperty.f;
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
1732
|
-
|
|
1733
|
-
var setToStringTag = function (target, TAG, STATIC) {
|
|
1734
|
-
if (target && !STATIC) target = target.prototype;
|
|
1735
|
-
if (target && !hasOwnProperty_1(target, TO_STRING_TAG)) {
|
|
1736
|
-
defineProperty$2(target, TO_STRING_TAG, { configurable: true, value: TAG });
|
|
1737
|
-
}
|
|
1738
|
-
};
|
|
1739
|
-
|
|
1740
|
-
var SPECIES$2 = wellKnownSymbol('species');
|
|
1741
|
-
|
|
1742
|
-
var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
1743
|
-
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
|
1744
|
-
var defineProperty = objectDefineProperty.f;
|
|
1745
|
-
|
|
1746
|
-
if (descriptors$1 && Constructor && !Constructor[SPECIES$2]) {
|
|
1747
|
-
defineProperty(Constructor, SPECIES$2, {
|
|
1748
|
-
configurable: true,
|
|
1749
|
-
get: function () { return this; }
|
|
1750
|
-
});
|
|
1751
|
-
}
|
|
1752
|
-
};
|
|
1753
|
-
|
|
1754
|
-
var $TypeError$5 = TypeError;
|
|
1755
|
-
|
|
1756
|
-
var anInstance = function (it, Prototype) {
|
|
1757
|
-
if (objectIsPrototypeOf(Prototype, it)) return it;
|
|
1758
|
-
throw $TypeError$5('Incorrect invocation');
|
|
1759
|
-
};
|
|
1760
|
-
|
|
1761
|
-
var $TypeError$4 = TypeError;
|
|
1762
|
-
|
|
1763
|
-
// `Assert: IsConstructor(argument) is true`
|
|
1764
|
-
var aConstructor = function (argument) {
|
|
1765
|
-
if (isConstructor(argument)) return argument;
|
|
1766
|
-
throw $TypeError$4(tryToString(argument) + ' is not a constructor');
|
|
1767
|
-
};
|
|
1768
|
-
|
|
1769
|
-
var SPECIES$1 = wellKnownSymbol('species');
|
|
1770
|
-
|
|
1771
|
-
// `SpeciesConstructor` abstract operation
|
|
1772
|
-
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
1773
|
-
var speciesConstructor = function (O, defaultConstructor) {
|
|
1774
|
-
var C = anObject(O).constructor;
|
|
1775
|
-
var S;
|
|
1776
|
-
return C === undefined || isNullOrUndefined$1(S = anObject(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
|
|
1777
|
-
};
|
|
1778
|
-
|
|
1779
|
-
var FunctionPrototype$1 = Function.prototype;
|
|
1780
|
-
var apply = FunctionPrototype$1.apply;
|
|
1781
|
-
var call = FunctionPrototype$1.call;
|
|
1782
|
-
|
|
1783
|
-
// eslint-disable-next-line es-x/no-reflect -- safe
|
|
1784
|
-
var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () {
|
|
1785
|
-
return call.apply(apply, arguments);
|
|
1786
|
-
});
|
|
1787
|
-
|
|
1788
|
-
var bind$2 = functionUncurryThis(functionUncurryThis.bind);
|
|
1789
|
-
|
|
1790
|
-
// optional / simple context binding
|
|
1791
|
-
var functionBindContext = function (fn, that) {
|
|
1792
|
-
aCallable(fn);
|
|
1793
|
-
return that === undefined ? fn : functionBindNative ? bind$2(fn, that) : function (/* ...args */) {
|
|
1794
|
-
return fn.apply(that, arguments);
|
|
1795
|
-
};
|
|
1796
|
-
};
|
|
1797
|
-
|
|
1798
|
-
var arraySlice = functionUncurryThis([].slice);
|
|
1799
|
-
|
|
1800
|
-
var $TypeError$3 = TypeError;
|
|
1801
|
-
|
|
1802
|
-
var validateArgumentsLength = function (passed, required) {
|
|
1803
|
-
if (passed < required) throw $TypeError$3('Not enough arguments');
|
|
1804
|
-
return passed;
|
|
1805
|
-
};
|
|
1806
|
-
|
|
1807
|
-
var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent);
|
|
1808
|
-
|
|
1809
|
-
var set = global_1.setImmediate;
|
|
1810
|
-
var clear = global_1.clearImmediate;
|
|
1811
|
-
var process$3 = global_1.process;
|
|
1812
|
-
var Dispatch = global_1.Dispatch;
|
|
1813
|
-
var Function$1 = global_1.Function;
|
|
1814
|
-
var MessageChannel = global_1.MessageChannel;
|
|
1815
|
-
var String$1 = global_1.String;
|
|
1816
|
-
var counter = 0;
|
|
1817
|
-
var queue$1 = {};
|
|
1818
|
-
var ONREADYSTATECHANGE = 'onreadystatechange';
|
|
1819
|
-
var location, defer, channel, port;
|
|
1820
|
-
|
|
1821
|
-
try {
|
|
1822
|
-
// Deno throws a ReferenceError on `location` access without `--location` flag
|
|
1823
|
-
location = global_1.location;
|
|
1824
|
-
} catch (error) { /* empty */ }
|
|
1825
|
-
|
|
1826
|
-
var run = function (id) {
|
|
1827
|
-
if (hasOwnProperty_1(queue$1, id)) {
|
|
1828
|
-
var fn = queue$1[id];
|
|
1829
|
-
delete queue$1[id];
|
|
1830
|
-
fn();
|
|
1831
|
-
}
|
|
1832
|
-
};
|
|
1833
|
-
|
|
1834
|
-
var runner = function (id) {
|
|
1835
|
-
return function () {
|
|
1836
|
-
run(id);
|
|
1837
|
-
};
|
|
1838
|
-
};
|
|
1839
|
-
|
|
1840
|
-
var listener = function (event) {
|
|
1841
|
-
run(event.data);
|
|
1842
|
-
};
|
|
1843
|
-
|
|
1844
|
-
var post = function (id) {
|
|
1845
|
-
// old engines have not location.origin
|
|
1846
|
-
global_1.postMessage(String$1(id), location.protocol + '//' + location.host);
|
|
1847
|
-
};
|
|
1848
|
-
|
|
1849
|
-
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
|
|
1850
|
-
if (!set || !clear) {
|
|
1851
|
-
set = function setImmediate(handler) {
|
|
1852
|
-
validateArgumentsLength(arguments.length, 1);
|
|
1853
|
-
var fn = isCallable(handler) ? handler : Function$1(handler);
|
|
1854
|
-
var args = arraySlice(arguments, 1);
|
|
1855
|
-
queue$1[++counter] = function () {
|
|
1856
|
-
functionApply(fn, undefined, args);
|
|
1857
|
-
};
|
|
1858
|
-
defer(counter);
|
|
1859
|
-
return counter;
|
|
1860
|
-
};
|
|
1861
|
-
clear = function clearImmediate(id) {
|
|
1862
|
-
delete queue$1[id];
|
|
1863
|
-
};
|
|
1864
|
-
// Node.js 0.8-
|
|
1865
|
-
if (engineIsNode) {
|
|
1866
|
-
defer = function (id) {
|
|
1867
|
-
process$3.nextTick(runner(id));
|
|
1868
|
-
};
|
|
1869
|
-
// Sphere (JS game engine) Dispatch API
|
|
1870
|
-
} else if (Dispatch && Dispatch.now) {
|
|
1871
|
-
defer = function (id) {
|
|
1872
|
-
Dispatch.now(runner(id));
|
|
1873
|
-
};
|
|
1874
|
-
// Browsers with MessageChannel, includes WebWorkers
|
|
1875
|
-
// except iOS - https://github.com/zloirock/core-js/issues/624
|
|
1876
|
-
} else if (MessageChannel && !engineIsIos) {
|
|
1877
|
-
channel = new MessageChannel();
|
|
1878
|
-
port = channel.port2;
|
|
1879
|
-
channel.port1.onmessage = listener;
|
|
1880
|
-
defer = functionBindContext(port.postMessage, port);
|
|
1881
|
-
// Browsers with postMessage, skip WebWorkers
|
|
1882
|
-
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
|
1883
|
-
} else if (
|
|
1884
|
-
global_1.addEventListener &&
|
|
1885
|
-
isCallable(global_1.postMessage) &&
|
|
1886
|
-
!global_1.importScripts &&
|
|
1887
|
-
location && location.protocol !== 'file:' &&
|
|
1888
|
-
!fails(post)
|
|
1889
|
-
) {
|
|
1890
|
-
defer = post;
|
|
1891
|
-
global_1.addEventListener('message', listener, false);
|
|
1892
|
-
// IE8-
|
|
1893
|
-
} else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
|
|
1894
|
-
defer = function (id) {
|
|
1895
|
-
html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
|
|
1896
|
-
html.removeChild(this);
|
|
1897
|
-
run(id);
|
|
1898
|
-
};
|
|
1899
|
-
};
|
|
1900
|
-
// Rest old browsers
|
|
1901
|
-
} else {
|
|
1902
|
-
defer = function (id) {
|
|
1903
|
-
setTimeout(runner(id), 0);
|
|
1904
|
-
};
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
var task$1 = {
|
|
1909
|
-
set: set,
|
|
1910
|
-
clear: clear
|
|
1911
|
-
};
|
|
1912
|
-
|
|
1913
|
-
var engineIsIosPebble = /ipad|iphone|ipod/i.test(engineUserAgent) && global_1.Pebble !== undefined;
|
|
1914
|
-
|
|
1915
|
-
var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent);
|
|
1916
|
-
|
|
1917
|
-
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
1918
|
-
var macrotask = task$1.set;
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
var MutationObserver = global_1.MutationObserver || global_1.WebKitMutationObserver;
|
|
1925
|
-
var document$2 = global_1.document;
|
|
1926
|
-
var process$2 = global_1.process;
|
|
1927
|
-
var Promise$1 = global_1.Promise;
|
|
1928
|
-
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
|
|
1929
|
-
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global_1, 'queueMicrotask');
|
|
1930
|
-
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
|
|
1931
|
-
|
|
1932
|
-
var flush, head, last, notify$1, toggle, node, promise, then;
|
|
1933
|
-
|
|
1934
|
-
// modern engines have queueMicrotask method
|
|
1935
|
-
if (!queueMicrotask) {
|
|
1936
|
-
flush = function () {
|
|
1937
|
-
var parent, fn;
|
|
1938
|
-
if (engineIsNode && (parent = process$2.domain)) parent.exit();
|
|
1939
|
-
while (head) {
|
|
1940
|
-
fn = head.fn;
|
|
1941
|
-
head = head.next;
|
|
1942
|
-
try {
|
|
1943
|
-
fn();
|
|
1944
|
-
} catch (error) {
|
|
1945
|
-
if (head) notify$1();
|
|
1946
|
-
else last = undefined;
|
|
1947
|
-
throw error;
|
|
1948
|
-
}
|
|
1949
|
-
} last = undefined;
|
|
1950
|
-
if (parent) parent.enter();
|
|
1951
|
-
};
|
|
1952
|
-
|
|
1953
|
-
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
|
|
1954
|
-
// also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
|
|
1955
|
-
if (!engineIsIos && !engineIsNode && !engineIsWebosWebkit && MutationObserver && document$2) {
|
|
1956
|
-
toggle = true;
|
|
1957
|
-
node = document$2.createTextNode('');
|
|
1958
|
-
new MutationObserver(flush).observe(node, { characterData: true });
|
|
1959
|
-
notify$1 = function () {
|
|
1960
|
-
node.data = toggle = !toggle;
|
|
1961
|
-
};
|
|
1962
|
-
// environments with maybe non-completely correct, but existent Promise
|
|
1963
|
-
} else if (!engineIsIosPebble && Promise$1 && Promise$1.resolve) {
|
|
1964
|
-
// Promise.resolve without an argument throws an error in LG WebOS 2
|
|
1965
|
-
promise = Promise$1.resolve(undefined);
|
|
1966
|
-
// workaround of WebKit ~ iOS Safari 10.1 bug
|
|
1967
|
-
promise.constructor = Promise$1;
|
|
1968
|
-
then = functionBindContext(promise.then, promise);
|
|
1969
|
-
notify$1 = function () {
|
|
1970
|
-
then(flush);
|
|
1971
|
-
};
|
|
1972
|
-
// Node.js without promises
|
|
1973
|
-
} else if (engineIsNode) {
|
|
1974
|
-
notify$1 = function () {
|
|
1975
|
-
process$2.nextTick(flush);
|
|
1976
|
-
};
|
|
1977
|
-
// for other environments - macrotask based on:
|
|
1978
|
-
// - setImmediate
|
|
1979
|
-
// - MessageChannel
|
|
1980
|
-
// - window.postMessage
|
|
1981
|
-
// - onreadystatechange
|
|
1982
|
-
// - setTimeout
|
|
1983
|
-
} else {
|
|
1984
|
-
// strange IE + webpack dev server bug - use .bind(global)
|
|
1985
|
-
macrotask = functionBindContext(macrotask, global_1);
|
|
1986
|
-
notify$1 = function () {
|
|
1987
|
-
macrotask(flush);
|
|
1988
|
-
};
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
var microtask = queueMicrotask || function (fn) {
|
|
1993
|
-
var task = { fn: fn, next: undefined };
|
|
1994
|
-
if (last) last.next = task;
|
|
1995
|
-
if (!head) {
|
|
1996
|
-
head = task;
|
|
1997
|
-
notify$1();
|
|
1998
|
-
} last = task;
|
|
1999
|
-
};
|
|
2000
|
-
|
|
2001
|
-
var hostReportErrors = function (a, b) {
|
|
2002
|
-
var console = global_1.console;
|
|
2003
|
-
if (console && console.error) {
|
|
2004
|
-
arguments.length == 1 ? console.error(a) : console.error(a, b);
|
|
2005
|
-
}
|
|
2006
|
-
};
|
|
2007
|
-
|
|
2008
|
-
var perform = function (exec) {
|
|
2009
|
-
try {
|
|
2010
|
-
return { error: false, value: exec() };
|
|
2011
|
-
} catch (error) {
|
|
2012
|
-
return { error: true, value: error };
|
|
2013
|
-
}
|
|
2014
|
-
};
|
|
2015
|
-
|
|
2016
|
-
var Queue = function () {
|
|
2017
|
-
this.head = null;
|
|
2018
|
-
this.tail = null;
|
|
2019
|
-
};
|
|
2020
|
-
|
|
2021
|
-
Queue.prototype = {
|
|
2022
|
-
add: function (item) {
|
|
2023
|
-
var entry = { item: item, next: null };
|
|
2024
|
-
if (this.head) this.tail.next = entry;
|
|
2025
|
-
else this.head = entry;
|
|
2026
|
-
this.tail = entry;
|
|
2027
|
-
},
|
|
2028
|
-
get: function () {
|
|
2029
|
-
var entry = this.head;
|
|
2030
|
-
if (entry) {
|
|
2031
|
-
this.head = entry.next;
|
|
2032
|
-
if (this.tail === entry) this.tail = null;
|
|
2033
|
-
return entry.item;
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
|
-
};
|
|
2037
|
-
|
|
2038
|
-
var queue = Queue;
|
|
2039
|
-
|
|
2040
|
-
var promiseNativeConstructor = global_1.Promise;
|
|
2041
|
-
|
|
2042
|
-
/* global Deno -- Deno case */
|
|
2043
|
-
var engineIsDeno = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
|
|
2044
|
-
|
|
2045
|
-
var engineIsBrowser = !engineIsDeno && !engineIsNode
|
|
2046
|
-
&& typeof window == 'object'
|
|
2047
|
-
&& typeof document == 'object';
|
|
2048
|
-
|
|
2049
|
-
promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
2050
|
-
var SPECIES = wellKnownSymbol('species');
|
|
2051
|
-
var SUBCLASSING = false;
|
|
2052
|
-
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable(global_1.PromiseRejectionEvent);
|
|
2053
|
-
|
|
2054
|
-
var FORCED_PROMISE_CONSTRUCTOR$5 = isForced_1('Promise', function () {
|
|
2055
|
-
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(promiseNativeConstructor);
|
|
2056
|
-
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(promiseNativeConstructor);
|
|
2057
|
-
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
2058
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
2059
|
-
// We can't detect it synchronously, so just check versions
|
|
2060
|
-
if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) return true;
|
|
2061
|
-
// We can't use @@species feature detection in V8 since it causes
|
|
2062
|
-
// deoptimization and performance degradation
|
|
2063
|
-
// https://github.com/zloirock/core-js/issues/679
|
|
2064
|
-
if (!engineV8Version || engineV8Version < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
|
|
2065
|
-
// Detect correctness of subclassing with @@species support
|
|
2066
|
-
var promise = new promiseNativeConstructor(function (resolve) { resolve(1); });
|
|
2067
|
-
var FakePromise = function (exec) {
|
|
2068
|
-
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
2069
|
-
};
|
|
2070
|
-
var constructor = promise.constructor = {};
|
|
2071
|
-
constructor[SPECIES] = FakePromise;
|
|
2072
|
-
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
2073
|
-
if (!SUBCLASSING) return true;
|
|
2074
|
-
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
2075
|
-
} return !GLOBAL_CORE_JS_PROMISE && (engineIsBrowser || engineIsDeno) && !NATIVE_PROMISE_REJECTION_EVENT$1;
|
|
2076
|
-
});
|
|
2077
|
-
|
|
2078
|
-
var promiseConstructorDetection = {
|
|
2079
|
-
CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
|
|
2080
|
-
REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
|
|
2081
|
-
SUBCLASSING: SUBCLASSING
|
|
2082
|
-
};
|
|
2083
|
-
|
|
2084
|
-
var $TypeError$2 = TypeError;
|
|
2085
|
-
|
|
2086
|
-
var PromiseCapability = function (C) {
|
|
2087
|
-
var resolve, reject;
|
|
2088
|
-
this.promise = new C(function ($$resolve, $$reject) {
|
|
2089
|
-
if (resolve !== undefined || reject !== undefined) throw $TypeError$2('Bad Promise constructor');
|
|
2090
|
-
resolve = $$resolve;
|
|
2091
|
-
reject = $$reject;
|
|
2092
|
-
});
|
|
2093
|
-
this.resolve = aCallable(resolve);
|
|
2094
|
-
this.reject = aCallable(reject);
|
|
2095
|
-
};
|
|
2096
|
-
|
|
2097
|
-
// `NewPromiseCapability` abstract operation
|
|
2098
|
-
// https://tc39.es/ecma262/#sec-newpromisecapability
|
|
2099
|
-
var f = function (C) {
|
|
2100
|
-
return new PromiseCapability(C);
|
|
2101
|
-
};
|
|
2102
|
-
|
|
2103
|
-
var newPromiseCapability$1 = {
|
|
2104
|
-
f: f
|
|
2105
|
-
};
|
|
2106
|
-
|
|
2107
|
-
var task = task$1.set;
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
var PROMISE = 'Promise';
|
|
2118
|
-
var FORCED_PROMISE_CONSTRUCTOR$4 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2119
|
-
var NATIVE_PROMISE_REJECTION_EVENT = promiseConstructorDetection.REJECTION_EVENT;
|
|
2120
|
-
var NATIVE_PROMISE_SUBCLASSING = promiseConstructorDetection.SUBCLASSING;
|
|
2121
|
-
var getInternalPromiseState = internalState.getterFor(PROMISE);
|
|
2122
|
-
var setInternalState = internalState.set;
|
|
2123
|
-
var NativePromisePrototype$1 = promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
2124
|
-
var PromiseConstructor = promiseNativeConstructor;
|
|
2125
|
-
var PromisePrototype = NativePromisePrototype$1;
|
|
2126
|
-
var TypeError$1 = global_1.TypeError;
|
|
2127
|
-
var document$1 = global_1.document;
|
|
2128
|
-
var process$1 = global_1.process;
|
|
2129
|
-
var newPromiseCapability = newPromiseCapability$1.f;
|
|
2130
|
-
var newGenericPromiseCapability = newPromiseCapability;
|
|
2131
|
-
|
|
2132
|
-
var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent);
|
|
2133
|
-
var UNHANDLED_REJECTION = 'unhandledrejection';
|
|
2134
|
-
var REJECTION_HANDLED = 'rejectionhandled';
|
|
2135
|
-
var PENDING = 0;
|
|
2136
|
-
var FULFILLED = 1;
|
|
2137
|
-
var REJECTED = 2;
|
|
2138
|
-
var HANDLED = 1;
|
|
2139
|
-
var UNHANDLED = 2;
|
|
2140
|
-
|
|
2141
|
-
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
2142
|
-
|
|
2143
|
-
// helpers
|
|
2144
|
-
var isThenable = function (it) {
|
|
2145
|
-
var then;
|
|
2146
|
-
return isObject$2(it) && isCallable(then = it.then) ? then : false;
|
|
2147
|
-
};
|
|
2148
|
-
|
|
2149
|
-
var callReaction = function (reaction, state) {
|
|
2150
|
-
var value = state.value;
|
|
2151
|
-
var ok = state.state == FULFILLED;
|
|
2152
|
-
var handler = ok ? reaction.ok : reaction.fail;
|
|
2153
|
-
var resolve = reaction.resolve;
|
|
2154
|
-
var reject = reaction.reject;
|
|
2155
|
-
var domain = reaction.domain;
|
|
2156
|
-
var result, then, exited;
|
|
2157
|
-
try {
|
|
2158
|
-
if (handler) {
|
|
2159
|
-
if (!ok) {
|
|
2160
|
-
if (state.rejection === UNHANDLED) onHandleUnhandled(state);
|
|
2161
|
-
state.rejection = HANDLED;
|
|
2162
|
-
}
|
|
2163
|
-
if (handler === true) result = value;
|
|
2164
|
-
else {
|
|
2165
|
-
if (domain) domain.enter();
|
|
2166
|
-
result = handler(value); // can throw
|
|
2167
|
-
if (domain) {
|
|
2168
|
-
domain.exit();
|
|
2169
|
-
exited = true;
|
|
2170
|
-
}
|
|
2171
|
-
}
|
|
2172
|
-
if (result === reaction.promise) {
|
|
2173
|
-
reject(TypeError$1('Promise-chain cycle'));
|
|
2174
|
-
} else if (then = isThenable(result)) {
|
|
2175
|
-
functionCall(then, result, resolve, reject);
|
|
2176
|
-
} else resolve(result);
|
|
2177
|
-
} else reject(value);
|
|
2178
|
-
} catch (error) {
|
|
2179
|
-
if (domain && !exited) domain.exit();
|
|
2180
|
-
reject(error);
|
|
2181
|
-
}
|
|
2182
|
-
};
|
|
2183
|
-
|
|
2184
|
-
var notify = function (state, isReject) {
|
|
2185
|
-
if (state.notified) return;
|
|
2186
|
-
state.notified = true;
|
|
2187
|
-
microtask(function () {
|
|
2188
|
-
var reactions = state.reactions;
|
|
2189
|
-
var reaction;
|
|
2190
|
-
while (reaction = reactions.get()) {
|
|
2191
|
-
callReaction(reaction, state);
|
|
2192
|
-
}
|
|
2193
|
-
state.notified = false;
|
|
2194
|
-
if (isReject && !state.rejection) onUnhandled(state);
|
|
2195
|
-
});
|
|
2196
|
-
};
|
|
2197
|
-
|
|
2198
|
-
var dispatchEvent = function (name, promise, reason) {
|
|
2199
|
-
var event, handler;
|
|
2200
|
-
if (DISPATCH_EVENT) {
|
|
2201
|
-
event = document$1.createEvent('Event');
|
|
2202
|
-
event.promise = promise;
|
|
2203
|
-
event.reason = reason;
|
|
2204
|
-
event.initEvent(name, false, true);
|
|
2205
|
-
global_1.dispatchEvent(event);
|
|
2206
|
-
} else event = { promise: promise, reason: reason };
|
|
2207
|
-
if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global_1['on' + name])) handler(event);
|
|
2208
|
-
else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
|
|
2209
|
-
};
|
|
2210
|
-
|
|
2211
|
-
var onUnhandled = function (state) {
|
|
2212
|
-
functionCall(task, global_1, function () {
|
|
2213
|
-
var promise = state.facade;
|
|
2214
|
-
var value = state.value;
|
|
2215
|
-
var IS_UNHANDLED = isUnhandled(state);
|
|
2216
|
-
var result;
|
|
2217
|
-
if (IS_UNHANDLED) {
|
|
2218
|
-
result = perform(function () {
|
|
2219
|
-
if (engineIsNode) {
|
|
2220
|
-
process$1.emit('unhandledRejection', value, promise);
|
|
2221
|
-
} else dispatchEvent(UNHANDLED_REJECTION, promise, value);
|
|
2222
|
-
});
|
|
2223
|
-
// Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
|
|
2224
|
-
state.rejection = engineIsNode || isUnhandled(state) ? UNHANDLED : HANDLED;
|
|
2225
|
-
if (result.error) throw result.value;
|
|
2226
|
-
}
|
|
2227
|
-
});
|
|
2228
|
-
};
|
|
2229
|
-
|
|
2230
|
-
var isUnhandled = function (state) {
|
|
2231
|
-
return state.rejection !== HANDLED && !state.parent;
|
|
2232
|
-
};
|
|
2233
|
-
|
|
2234
|
-
var onHandleUnhandled = function (state) {
|
|
2235
|
-
functionCall(task, global_1, function () {
|
|
2236
|
-
var promise = state.facade;
|
|
2237
|
-
if (engineIsNode) {
|
|
2238
|
-
process$1.emit('rejectionHandled', promise);
|
|
2239
|
-
} else dispatchEvent(REJECTION_HANDLED, promise, state.value);
|
|
2240
|
-
});
|
|
2241
|
-
};
|
|
2242
|
-
|
|
2243
|
-
var bind$1 = function (fn, state, unwrap) {
|
|
2244
|
-
return function (value) {
|
|
2245
|
-
fn(state, value, unwrap);
|
|
2246
|
-
};
|
|
2247
|
-
};
|
|
2248
|
-
|
|
2249
|
-
var internalReject = function (state, value, unwrap) {
|
|
2250
|
-
if (state.done) return;
|
|
2251
|
-
state.done = true;
|
|
2252
|
-
if (unwrap) state = unwrap;
|
|
2253
|
-
state.value = value;
|
|
2254
|
-
state.state = REJECTED;
|
|
2255
|
-
notify(state, true);
|
|
2256
|
-
};
|
|
2257
|
-
|
|
2258
|
-
var internalResolve = function (state, value, unwrap) {
|
|
2259
|
-
if (state.done) return;
|
|
2260
|
-
state.done = true;
|
|
2261
|
-
if (unwrap) state = unwrap;
|
|
2262
|
-
try {
|
|
2263
|
-
if (state.facade === value) throw TypeError$1("Promise can't be resolved itself");
|
|
2264
|
-
var then = isThenable(value);
|
|
2265
|
-
if (then) {
|
|
2266
|
-
microtask(function () {
|
|
2267
|
-
var wrapper = { done: false };
|
|
2268
|
-
try {
|
|
2269
|
-
functionCall(then, value,
|
|
2270
|
-
bind$1(internalResolve, wrapper, state),
|
|
2271
|
-
bind$1(internalReject, wrapper, state)
|
|
2272
|
-
);
|
|
2273
|
-
} catch (error) {
|
|
2274
|
-
internalReject(wrapper, error, state);
|
|
2275
|
-
}
|
|
2276
|
-
});
|
|
2277
|
-
} else {
|
|
2278
|
-
state.value = value;
|
|
2279
|
-
state.state = FULFILLED;
|
|
2280
|
-
notify(state, false);
|
|
2281
|
-
}
|
|
2282
|
-
} catch (error) {
|
|
2283
|
-
internalReject({ done: false }, error, state);
|
|
2284
|
-
}
|
|
2285
|
-
};
|
|
2286
|
-
|
|
2287
|
-
// constructor polyfill
|
|
2288
|
-
if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
2289
|
-
// 25.4.3.1 Promise(executor)
|
|
2290
|
-
PromiseConstructor = function Promise(executor) {
|
|
2291
|
-
anInstance(this, PromisePrototype);
|
|
2292
|
-
aCallable(executor);
|
|
2293
|
-
functionCall(Internal, this);
|
|
2294
|
-
var state = getInternalPromiseState(this);
|
|
2295
|
-
try {
|
|
2296
|
-
executor(bind$1(internalResolve, state), bind$1(internalReject, state));
|
|
2297
|
-
} catch (error) {
|
|
2298
|
-
internalReject(state, error);
|
|
2299
|
-
}
|
|
2300
|
-
};
|
|
2301
|
-
|
|
2302
|
-
PromisePrototype = PromiseConstructor.prototype;
|
|
2303
|
-
|
|
2304
|
-
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2305
|
-
Internal = function Promise(executor) {
|
|
2306
|
-
setInternalState(this, {
|
|
2307
|
-
type: PROMISE,
|
|
2308
|
-
done: false,
|
|
2309
|
-
notified: false,
|
|
2310
|
-
parent: false,
|
|
2311
|
-
reactions: new queue(),
|
|
2312
|
-
rejection: false,
|
|
2313
|
-
state: PENDING,
|
|
2314
|
-
value: undefined
|
|
2315
|
-
});
|
|
2316
|
-
};
|
|
2317
|
-
|
|
2318
|
-
// `Promise.prototype.then` method
|
|
2319
|
-
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
2320
|
-
Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
2321
|
-
var state = getInternalPromiseState(this);
|
|
2322
|
-
var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
|
|
2323
|
-
state.parent = true;
|
|
2324
|
-
reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
|
|
2325
|
-
reaction.fail = isCallable(onRejected) && onRejected;
|
|
2326
|
-
reaction.domain = engineIsNode ? process$1.domain : undefined;
|
|
2327
|
-
if (state.state == PENDING) state.reactions.add(reaction);
|
|
2328
|
-
else microtask(function () {
|
|
2329
|
-
callReaction(reaction, state);
|
|
2330
|
-
});
|
|
2331
|
-
return reaction.promise;
|
|
2332
|
-
});
|
|
2333
|
-
|
|
2334
|
-
OwnPromiseCapability = function () {
|
|
2335
|
-
var promise = new Internal();
|
|
2336
|
-
var state = getInternalPromiseState(promise);
|
|
2337
|
-
this.promise = promise;
|
|
2338
|
-
this.resolve = bind$1(internalResolve, state);
|
|
2339
|
-
this.reject = bind$1(internalReject, state);
|
|
2340
|
-
};
|
|
2341
|
-
|
|
2342
|
-
newPromiseCapability$1.f = newPromiseCapability = function (C) {
|
|
2343
|
-
return C === PromiseConstructor || C === PromiseWrapper
|
|
2344
|
-
? new OwnPromiseCapability(C)
|
|
2345
|
-
: newGenericPromiseCapability(C);
|
|
2346
|
-
};
|
|
2347
|
-
|
|
2348
|
-
if (isCallable(promiseNativeConstructor) && NativePromisePrototype$1 !== Object.prototype) {
|
|
2349
|
-
nativeThen = NativePromisePrototype$1.then;
|
|
2350
|
-
|
|
2351
|
-
if (!NATIVE_PROMISE_SUBCLASSING) {
|
|
2352
|
-
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
2353
|
-
defineBuiltIn(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
|
|
2354
|
-
var that = this;
|
|
2355
|
-
return new PromiseConstructor(function (resolve, reject) {
|
|
2356
|
-
functionCall(nativeThen, that, resolve, reject);
|
|
2357
|
-
}).then(onFulfilled, onRejected);
|
|
2358
|
-
// https://github.com/zloirock/core-js/issues/640
|
|
2359
|
-
}, { unsafe: true });
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
// make `.constructor === Promise` work for native promise-based APIs
|
|
2363
|
-
try {
|
|
2364
|
-
delete NativePromisePrototype$1.constructor;
|
|
2365
|
-
} catch (error) { /* empty */ }
|
|
2366
|
-
|
|
2367
|
-
// make `instanceof Promise` work for native promise-based APIs
|
|
2368
|
-
if (objectSetPrototypeOf) {
|
|
2369
|
-
objectSetPrototypeOf(NativePromisePrototype$1, PromisePrototype);
|
|
769
|
+
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
2370
770
|
}
|
|
2371
771
|
}
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
_export({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
2375
|
-
Promise: PromiseConstructor
|
|
2376
|
-
});
|
|
2377
|
-
|
|
2378
|
-
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
2379
|
-
setSpecies(PROMISE);
|
|
2380
|
-
|
|
2381
|
-
var iterators = {};
|
|
2382
|
-
|
|
2383
|
-
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
2384
|
-
var ArrayPrototype = Array.prototype;
|
|
2385
|
-
|
|
2386
|
-
// check on default Array iterator
|
|
2387
|
-
var isArrayIteratorMethod = function (it) {
|
|
2388
|
-
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
2389
772
|
};
|
|
2390
773
|
|
|
2391
|
-
var
|
|
774
|
+
var replacement = /#|\.prototype\./;
|
|
2392
775
|
|
|
2393
|
-
var
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
776
|
+
var isForced = function (feature, detection) {
|
|
777
|
+
var value = data$1[normalize(feature)];
|
|
778
|
+
return value == POLYFILL ? true
|
|
779
|
+
: value == NATIVE ? false
|
|
780
|
+
: isCallable(detection) ? fails(detection)
|
|
781
|
+
: !!detection;
|
|
2397
782
|
};
|
|
2398
783
|
|
|
2399
|
-
var
|
|
2400
|
-
|
|
2401
|
-
var getIterator = function (argument, usingIterator) {
|
|
2402
|
-
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
2403
|
-
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
2404
|
-
throw $TypeError$1(tryToString(argument) + ' is not iterable');
|
|
784
|
+
var normalize = isForced.normalize = function (string) {
|
|
785
|
+
return String(string).replace(replacement, '.').toLowerCase();
|
|
2405
786
|
};
|
|
2406
787
|
|
|
2407
|
-
var
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
try {
|
|
2411
|
-
innerResult = getMethod(iterator, 'return');
|
|
2412
|
-
if (!innerResult) {
|
|
2413
|
-
if (kind === 'throw') throw value;
|
|
2414
|
-
return value;
|
|
2415
|
-
}
|
|
2416
|
-
innerResult = functionCall(innerResult, iterator);
|
|
2417
|
-
} catch (error) {
|
|
2418
|
-
innerError = true;
|
|
2419
|
-
innerResult = error;
|
|
2420
|
-
}
|
|
2421
|
-
if (kind === 'throw') throw value;
|
|
2422
|
-
if (innerError) throw innerResult;
|
|
2423
|
-
anObject(innerResult);
|
|
2424
|
-
return value;
|
|
2425
|
-
};
|
|
788
|
+
var data$1 = isForced.data = {};
|
|
789
|
+
var NATIVE = isForced.NATIVE = 'N';
|
|
790
|
+
var POLYFILL = isForced.POLYFILL = 'P';
|
|
2426
791
|
|
|
2427
|
-
var
|
|
792
|
+
var isForced_1 = isForced;
|
|
2428
793
|
|
|
2429
|
-
var
|
|
2430
|
-
this.stopped = stopped;
|
|
2431
|
-
this.result = result;
|
|
2432
|
-
};
|
|
794
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
2433
795
|
|
|
2434
|
-
var ResultPrototype = Result.prototype;
|
|
2435
796
|
|
|
2436
|
-
var iterate = function (iterable, unboundFunction, options) {
|
|
2437
|
-
var that = options && options.that;
|
|
2438
|
-
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
2439
|
-
var IS_RECORD = !!(options && options.IS_RECORD);
|
|
2440
|
-
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
2441
|
-
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
2442
|
-
var fn = functionBindContext(unboundFunction, that);
|
|
2443
|
-
var iterator, iterFn, index, length, result, next, step;
|
|
2444
797
|
|
|
2445
|
-
var stop = function (condition) {
|
|
2446
|
-
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
2447
|
-
return new Result(true, condition);
|
|
2448
|
-
};
|
|
2449
798
|
|
|
2450
|
-
var callFn = function (value) {
|
|
2451
|
-
if (AS_ENTRIES) {
|
|
2452
|
-
anObject(value);
|
|
2453
|
-
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
2454
|
-
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
2455
|
-
};
|
|
2456
799
|
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
800
|
+
|
|
801
|
+
/*
|
|
802
|
+
options.target - name of the target object
|
|
803
|
+
options.global - target is the global object
|
|
804
|
+
options.stat - export as static methods of target
|
|
805
|
+
options.proto - export as prototype methods of target
|
|
806
|
+
options.real - real prototype method for the `pure` version
|
|
807
|
+
options.forced - export even if the native feature is available
|
|
808
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
809
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
810
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
811
|
+
options.sham - add a flag to not completely full polyfills
|
|
812
|
+
options.enumerable - export as enumerable property
|
|
813
|
+
options.dontCallGetSet - prevent calling a getter on target
|
|
814
|
+
options.name - the .name of the function if it does not match the key
|
|
815
|
+
*/
|
|
816
|
+
var _export = function (options, source) {
|
|
817
|
+
var TARGET = options.target;
|
|
818
|
+
var GLOBAL = options.global;
|
|
819
|
+
var STATIC = options.stat;
|
|
820
|
+
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
821
|
+
if (GLOBAL) {
|
|
822
|
+
target = global_1;
|
|
823
|
+
} else if (STATIC) {
|
|
824
|
+
target = global_1[TARGET] || defineGlobalProperty(TARGET, {});
|
|
2461
825
|
} else {
|
|
2462
|
-
|
|
2463
|
-
if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
|
|
2464
|
-
// optimisation for array iterators
|
|
2465
|
-
if (isArrayIteratorMethod(iterFn)) {
|
|
2466
|
-
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
2467
|
-
result = callFn(iterable[index]);
|
|
2468
|
-
if (result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
2469
|
-
} return new Result(false);
|
|
2470
|
-
}
|
|
2471
|
-
iterator = getIterator(iterable, iterFn);
|
|
826
|
+
target = (global_1[TARGET] || {}).prototype;
|
|
2472
827
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
}
|
|
2479
|
-
|
|
828
|
+
if (target) for (key in source) {
|
|
829
|
+
sourceProperty = source[key];
|
|
830
|
+
if (options.dontCallGetSet) {
|
|
831
|
+
descriptor = getOwnPropertyDescriptor(target, key);
|
|
832
|
+
targetProperty = descriptor && descriptor.value;
|
|
833
|
+
} else targetProperty = target[key];
|
|
834
|
+
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
835
|
+
// contained in target
|
|
836
|
+
if (!FORCED && targetProperty !== undefined) {
|
|
837
|
+
if (typeof sourceProperty == typeof targetProperty) continue;
|
|
838
|
+
copyConstructorProperties(sourceProperty, targetProperty);
|
|
2480
839
|
}
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
var ITERATOR = wellKnownSymbol('iterator');
|
|
2486
|
-
var SAFE_CLOSING = false;
|
|
2487
|
-
|
|
2488
|
-
try {
|
|
2489
|
-
var called = 0;
|
|
2490
|
-
var iteratorWithReturn = {
|
|
2491
|
-
next: function () {
|
|
2492
|
-
return { done: !!called++ };
|
|
2493
|
-
},
|
|
2494
|
-
'return': function () {
|
|
2495
|
-
SAFE_CLOSING = true;
|
|
840
|
+
// add a flag to not completely full polyfills
|
|
841
|
+
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
842
|
+
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
2496
843
|
}
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
return this;
|
|
2500
|
-
};
|
|
2501
|
-
// eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
|
|
2502
|
-
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
2503
|
-
} catch (error) { /* empty */ }
|
|
2504
|
-
|
|
2505
|
-
var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
2506
|
-
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
2507
|
-
var ITERATION_SUPPORT = false;
|
|
2508
|
-
try {
|
|
2509
|
-
var object = {};
|
|
2510
|
-
object[ITERATOR] = function () {
|
|
2511
|
-
return {
|
|
2512
|
-
next: function () {
|
|
2513
|
-
return { done: ITERATION_SUPPORT = true };
|
|
2514
|
-
}
|
|
2515
|
-
};
|
|
2516
|
-
};
|
|
2517
|
-
exec(object);
|
|
2518
|
-
} catch (error) { /* empty */ }
|
|
2519
|
-
return ITERATION_SUPPORT;
|
|
844
|
+
defineBuiltIn(target, key, sourceProperty, options);
|
|
845
|
+
}
|
|
2520
846
|
};
|
|
2521
847
|
|
|
2522
|
-
|
|
848
|
+
// `Object.keys` method
|
|
849
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
850
|
+
// eslint-disable-next-line es-x/no-object-keys -- safe
|
|
851
|
+
var objectKeys$1 = Object.keys || function keys(O) {
|
|
852
|
+
return objectKeysInternal(O, enumBugKeys);
|
|
853
|
+
};
|
|
2523
854
|
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
855
|
+
// `Object.defineProperties` method
|
|
856
|
+
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
857
|
+
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
858
|
+
var f = descriptors$1 && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
859
|
+
anObject(O);
|
|
860
|
+
var props = toIndexedObject(Properties);
|
|
861
|
+
var keys = objectKeys$1(Properties);
|
|
862
|
+
var length = keys.length;
|
|
863
|
+
var index = 0;
|
|
864
|
+
var key;
|
|
865
|
+
while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
|
|
866
|
+
return O;
|
|
867
|
+
};
|
|
2527
868
|
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
all: function all(iterable) {
|
|
2532
|
-
var C = this;
|
|
2533
|
-
var capability = newPromiseCapability$1.f(C);
|
|
2534
|
-
var resolve = capability.resolve;
|
|
2535
|
-
var reject = capability.reject;
|
|
2536
|
-
var result = perform(function () {
|
|
2537
|
-
var $promiseResolve = aCallable(C.resolve);
|
|
2538
|
-
var values = [];
|
|
2539
|
-
var counter = 0;
|
|
2540
|
-
var remaining = 1;
|
|
2541
|
-
iterate(iterable, function (promise) {
|
|
2542
|
-
var index = counter++;
|
|
2543
|
-
var alreadyCalled = false;
|
|
2544
|
-
remaining++;
|
|
2545
|
-
functionCall($promiseResolve, C, promise).then(function (value) {
|
|
2546
|
-
if (alreadyCalled) return;
|
|
2547
|
-
alreadyCalled = true;
|
|
2548
|
-
values[index] = value;
|
|
2549
|
-
--remaining || resolve(values);
|
|
2550
|
-
}, reject);
|
|
2551
|
-
});
|
|
2552
|
-
--remaining || resolve(values);
|
|
2553
|
-
});
|
|
2554
|
-
if (result.error) reject(result.value);
|
|
2555
|
-
return capability.promise;
|
|
2556
|
-
}
|
|
2557
|
-
});
|
|
869
|
+
var objectDefineProperties = {
|
|
870
|
+
f: f
|
|
871
|
+
};
|
|
2558
872
|
|
|
2559
|
-
var
|
|
873
|
+
var html = getBuiltIn('document', 'documentElement');
|
|
2560
874
|
|
|
875
|
+
/* global ActiveXObject -- old IE, WSH */
|
|
2561
876
|
|
|
2562
877
|
|
|
2563
878
|
|
|
2564
879
|
|
|
2565
|
-
var NativePromisePrototype = promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
2566
880
|
|
|
2567
|
-
// `Promise.prototype.catch` method
|
|
2568
|
-
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
2569
|
-
_export({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
|
|
2570
|
-
'catch': function (onRejected) {
|
|
2571
|
-
return this.then(undefined, onRejected);
|
|
2572
|
-
}
|
|
2573
|
-
});
|
|
2574
881
|
|
|
2575
|
-
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
2576
|
-
if (isCallable(promiseNativeConstructor)) {
|
|
2577
|
-
var method = getBuiltIn('Promise').prototype['catch'];
|
|
2578
|
-
if (NativePromisePrototype['catch'] !== method) {
|
|
2579
|
-
defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
2580
|
-
}
|
|
2581
|
-
}
|
|
2582
882
|
|
|
2583
|
-
// `Promise.race` method
|
|
2584
|
-
// https://tc39.es/ecma262/#sec-promise.race
|
|
2585
|
-
_export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, {
|
|
2586
|
-
race: function race(iterable) {
|
|
2587
|
-
var C = this;
|
|
2588
|
-
var capability = newPromiseCapability$1.f(C);
|
|
2589
|
-
var reject = capability.reject;
|
|
2590
|
-
var result = perform(function () {
|
|
2591
|
-
var $promiseResolve = aCallable(C.resolve);
|
|
2592
|
-
iterate(iterable, function (promise) {
|
|
2593
|
-
functionCall($promiseResolve, C, promise).then(capability.resolve, reject);
|
|
2594
|
-
});
|
|
2595
|
-
});
|
|
2596
|
-
if (result.error) reject(result.value);
|
|
2597
|
-
return capability.promise;
|
|
2598
|
-
}
|
|
2599
|
-
});
|
|
2600
883
|
|
|
2601
|
-
var
|
|
884
|
+
var GT = '>';
|
|
885
|
+
var LT = '<';
|
|
886
|
+
var PROTOTYPE = 'prototype';
|
|
887
|
+
var SCRIPT = 'script';
|
|
888
|
+
var IE_PROTO = sharedKey('IE_PROTO');
|
|
2602
889
|
|
|
2603
|
-
|
|
2604
|
-
// https://tc39.es/ecma262/#sec-promise.reject
|
|
2605
|
-
_export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
|
|
2606
|
-
reject: function reject(r) {
|
|
2607
|
-
var capability = newPromiseCapability$1.f(this);
|
|
2608
|
-
functionCall(capability.reject, undefined, r);
|
|
2609
|
-
return capability.promise;
|
|
2610
|
-
}
|
|
2611
|
-
});
|
|
890
|
+
var EmptyConstructor = function () { /* empty */ };
|
|
2612
891
|
|
|
2613
|
-
var
|
|
2614
|
-
|
|
2615
|
-
if (isObject$2(x) && x.constructor === C) return x;
|
|
2616
|
-
var promiseCapability = newPromiseCapability$1.f(C);
|
|
2617
|
-
var resolve = promiseCapability.resolve;
|
|
2618
|
-
resolve(x);
|
|
2619
|
-
return promiseCapability.promise;
|
|
892
|
+
var scriptTag = function (content) {
|
|
893
|
+
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
2620
894
|
};
|
|
2621
895
|
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
896
|
+
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
897
|
+
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
898
|
+
activeXDocument.write(scriptTag(''));
|
|
899
|
+
activeXDocument.close();
|
|
900
|
+
var temp = activeXDocument.parentWindow.Object;
|
|
901
|
+
activeXDocument = null; // avoid memory leak
|
|
902
|
+
return temp;
|
|
903
|
+
};
|
|
2626
904
|
|
|
2627
|
-
// `
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
905
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
906
|
+
var NullProtoObjectViaIFrame = function () {
|
|
907
|
+
// Thrash, waste and sodomy: IE GC bug
|
|
908
|
+
var iframe = documentCreateElement('iframe');
|
|
909
|
+
var JS = 'java' + SCRIPT + ':';
|
|
910
|
+
var iframeDocument;
|
|
911
|
+
iframe.style.display = 'none';
|
|
912
|
+
html.appendChild(iframe);
|
|
913
|
+
// https://github.com/zloirock/core-js/issues/475
|
|
914
|
+
iframe.src = String(JS);
|
|
915
|
+
iframeDocument = iframe.contentWindow.document;
|
|
916
|
+
iframeDocument.open();
|
|
917
|
+
iframeDocument.write(scriptTag('document.F=Object'));
|
|
918
|
+
iframeDocument.close();
|
|
919
|
+
return iframeDocument.F;
|
|
920
|
+
};
|
|
2634
921
|
|
|
2635
|
-
//
|
|
2636
|
-
|
|
2637
|
-
//
|
|
2638
|
-
|
|
2639
|
-
|
|
922
|
+
// Check for document.domain and active x support
|
|
923
|
+
// No need to use active x approach when document.domain is not set
|
|
924
|
+
// see https://github.com/es-shims/es5-shim/issues/150
|
|
925
|
+
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
926
|
+
// avoid IE GC bug
|
|
927
|
+
var activeXDocument;
|
|
928
|
+
var NullProtoObject = function () {
|
|
929
|
+
try {
|
|
930
|
+
activeXDocument = new ActiveXObject('htmlfile');
|
|
931
|
+
} catch (error) { /* ignore */ }
|
|
932
|
+
NullProtoObject = typeof document != 'undefined'
|
|
933
|
+
? document.domain && activeXDocument
|
|
934
|
+
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
935
|
+
: NullProtoObjectViaIFrame()
|
|
936
|
+
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
937
|
+
var length = enumBugKeys.length;
|
|
938
|
+
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
939
|
+
return NullProtoObject();
|
|
940
|
+
};
|
|
2640
941
|
|
|
2641
|
-
|
|
2642
|
-
// https://tc39.es/ecma262/#sec-object.assign
|
|
2643
|
-
var objectAssign = !$assign || fails(function () {
|
|
2644
|
-
// should have correct order of operations (Edge bug)
|
|
2645
|
-
if (descriptors$1 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
|
|
2646
|
-
enumerable: true,
|
|
2647
|
-
get: function () {
|
|
2648
|
-
defineProperty$1(this, 'b', {
|
|
2649
|
-
value: 3,
|
|
2650
|
-
enumerable: false
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
}), { b: 2 })).b !== 1) return true;
|
|
2654
|
-
// should work with symbols and should have deterministic property order (V8 bug)
|
|
2655
|
-
var A = {};
|
|
2656
|
-
var B = {};
|
|
2657
|
-
// eslint-disable-next-line es-x/no-symbol -- safe
|
|
2658
|
-
var symbol = Symbol();
|
|
2659
|
-
var alphabet = 'abcdefghijklmnopqrst';
|
|
2660
|
-
A[symbol] = 7;
|
|
2661
|
-
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
|
2662
|
-
return $assign({}, A)[symbol] != 7 || objectKeys$1($assign({}, B)).join('') != alphabet;
|
|
2663
|
-
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
|
|
2664
|
-
var T = toObject(target);
|
|
2665
|
-
var argumentsLength = arguments.length;
|
|
2666
|
-
var index = 1;
|
|
2667
|
-
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
|
2668
|
-
var propertyIsEnumerable = objectPropertyIsEnumerable.f;
|
|
2669
|
-
while (argumentsLength > index) {
|
|
2670
|
-
var S = indexedObject(arguments[index++]);
|
|
2671
|
-
var keys = getOwnPropertySymbols ? concat(objectKeys$1(S), getOwnPropertySymbols(S)) : objectKeys$1(S);
|
|
2672
|
-
var length = keys.length;
|
|
2673
|
-
var j = 0;
|
|
2674
|
-
var key;
|
|
2675
|
-
while (length > j) {
|
|
2676
|
-
key = keys[j++];
|
|
2677
|
-
if (!descriptors$1 || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
2678
|
-
}
|
|
2679
|
-
} return T;
|
|
2680
|
-
} : $assign;
|
|
2681
|
-
|
|
2682
|
-
// `Object.assign` method
|
|
2683
|
-
// https://tc39.es/ecma262/#sec-object.assign
|
|
2684
|
-
// eslint-disable-next-line es-x/no-object-assign -- required for testing
|
|
2685
|
-
_export({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== objectAssign }, {
|
|
2686
|
-
assign: objectAssign
|
|
2687
|
-
});
|
|
942
|
+
hiddenKeys$1[IE_PROTO] = true;
|
|
2688
943
|
|
|
2689
|
-
|
|
944
|
+
// `Object.create` method
|
|
945
|
+
// https://tc39.es/ecma262/#sec-object.create
|
|
946
|
+
// eslint-disable-next-line es-x/no-object-create -- safe
|
|
947
|
+
var objectCreate = Object.create || function create(O, Properties) {
|
|
948
|
+
var result;
|
|
949
|
+
if (O !== null) {
|
|
950
|
+
EmptyConstructor[PROTOTYPE] = anObject(O);
|
|
951
|
+
result = new EmptyConstructor();
|
|
952
|
+
EmptyConstructor[PROTOTYPE] = null;
|
|
953
|
+
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
954
|
+
result[IE_PROTO] = O;
|
|
955
|
+
} else result = NullProtoObject();
|
|
956
|
+
return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
|
|
957
|
+
};
|
|
2690
958
|
|
|
2691
959
|
var defineProperty = objectDefineProperty.f;
|
|
2692
960
|
|
|
2693
|
-
var
|
|
2694
|
-
var
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
// https://tc39.es/ecma262/#sec-function-instances-name
|
|
2701
|
-
if (descriptors$1 && !FUNCTION_NAME_EXISTS) {
|
|
2702
|
-
defineProperty(FunctionPrototype, NAME, {
|
|
961
|
+
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
962
|
+
var ArrayPrototype = Array.prototype;
|
|
963
|
+
|
|
964
|
+
// Array.prototype[@@unscopables]
|
|
965
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
966
|
+
if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
|
967
|
+
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
|
2703
968
|
configurable: true,
|
|
2704
|
-
|
|
2705
|
-
try {
|
|
2706
|
-
return regExpExec(nameRE, functionToString(this))[1];
|
|
2707
|
-
} catch (error) {
|
|
2708
|
-
return '';
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
969
|
+
value: objectCreate(null)
|
|
2711
970
|
});
|
|
2712
971
|
}
|
|
2713
972
|
|
|
2714
|
-
//
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
CSSRuleList: 0,
|
|
2718
|
-
CSSStyleDeclaration: 0,
|
|
2719
|
-
CSSValueList: 0,
|
|
2720
|
-
ClientRectList: 0,
|
|
2721
|
-
DOMRectList: 0,
|
|
2722
|
-
DOMStringList: 0,
|
|
2723
|
-
DOMTokenList: 1,
|
|
2724
|
-
DataTransferItemList: 0,
|
|
2725
|
-
FileList: 0,
|
|
2726
|
-
HTMLAllCollection: 0,
|
|
2727
|
-
HTMLCollection: 0,
|
|
2728
|
-
HTMLFormElement: 0,
|
|
2729
|
-
HTMLSelectElement: 0,
|
|
2730
|
-
MediaList: 0,
|
|
2731
|
-
MimeTypeArray: 0,
|
|
2732
|
-
NamedNodeMap: 0,
|
|
2733
|
-
NodeList: 1,
|
|
2734
|
-
PaintRequestList: 0,
|
|
2735
|
-
Plugin: 0,
|
|
2736
|
-
PluginArray: 0,
|
|
2737
|
-
SVGLengthList: 0,
|
|
2738
|
-
SVGNumberList: 0,
|
|
2739
|
-
SVGPathSegList: 0,
|
|
2740
|
-
SVGPointList: 0,
|
|
2741
|
-
SVGStringList: 0,
|
|
2742
|
-
SVGTransformList: 0,
|
|
2743
|
-
SourceBufferList: 0,
|
|
2744
|
-
StyleSheetList: 0,
|
|
2745
|
-
TextTrackCueList: 0,
|
|
2746
|
-
TextTrackList: 0,
|
|
2747
|
-
TouchList: 0
|
|
2748
|
-
};
|
|
2749
|
-
|
|
2750
|
-
// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
var classList = documentCreateElement('span').classList;
|
|
2754
|
-
var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
|
|
2755
|
-
|
|
2756
|
-
var domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
|
|
2757
|
-
|
|
2758
|
-
var push = functionUncurryThis([].push);
|
|
2759
|
-
|
|
2760
|
-
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
|
|
2761
|
-
var createMethod = function (TYPE) {
|
|
2762
|
-
var IS_MAP = TYPE == 1;
|
|
2763
|
-
var IS_FILTER = TYPE == 2;
|
|
2764
|
-
var IS_SOME = TYPE == 3;
|
|
2765
|
-
var IS_EVERY = TYPE == 4;
|
|
2766
|
-
var IS_FIND_INDEX = TYPE == 6;
|
|
2767
|
-
var IS_FILTER_REJECT = TYPE == 7;
|
|
2768
|
-
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
|
2769
|
-
return function ($this, callbackfn, that, specificCreate) {
|
|
2770
|
-
var O = toObject($this);
|
|
2771
|
-
var self = indexedObject(O);
|
|
2772
|
-
var boundFunction = functionBindContext(callbackfn, that);
|
|
2773
|
-
var length = lengthOfArrayLike(self);
|
|
2774
|
-
var index = 0;
|
|
2775
|
-
var create = specificCreate || arraySpeciesCreate;
|
|
2776
|
-
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
|
|
2777
|
-
var value, result;
|
|
2778
|
-
for (;length > index; index++) if (NO_HOLES || index in self) {
|
|
2779
|
-
value = self[index];
|
|
2780
|
-
result = boundFunction(value, index, O);
|
|
2781
|
-
if (TYPE) {
|
|
2782
|
-
if (IS_MAP) target[index] = result; // map
|
|
2783
|
-
else if (result) switch (TYPE) {
|
|
2784
|
-
case 3: return true; // some
|
|
2785
|
-
case 5: return value; // find
|
|
2786
|
-
case 6: return index; // findIndex
|
|
2787
|
-
case 2: push(target, value); // filter
|
|
2788
|
-
} else switch (TYPE) {
|
|
2789
|
-
case 4: return false; // every
|
|
2790
|
-
case 7: push(target, value); // filterReject
|
|
2791
|
-
}
|
|
2792
|
-
}
|
|
2793
|
-
}
|
|
2794
|
-
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
|
2795
|
-
};
|
|
2796
|
-
};
|
|
2797
|
-
|
|
2798
|
-
var arrayIteration = {
|
|
2799
|
-
// `Array.prototype.forEach` method
|
|
2800
|
-
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
2801
|
-
forEach: createMethod(0),
|
|
2802
|
-
// `Array.prototype.map` method
|
|
2803
|
-
// https://tc39.es/ecma262/#sec-array.prototype.map
|
|
2804
|
-
map: createMethod(1),
|
|
2805
|
-
// `Array.prototype.filter` method
|
|
2806
|
-
// https://tc39.es/ecma262/#sec-array.prototype.filter
|
|
2807
|
-
filter: createMethod(2),
|
|
2808
|
-
// `Array.prototype.some` method
|
|
2809
|
-
// https://tc39.es/ecma262/#sec-array.prototype.some
|
|
2810
|
-
some: createMethod(3),
|
|
2811
|
-
// `Array.prototype.every` method
|
|
2812
|
-
// https://tc39.es/ecma262/#sec-array.prototype.every
|
|
2813
|
-
every: createMethod(4),
|
|
2814
|
-
// `Array.prototype.find` method
|
|
2815
|
-
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
2816
|
-
find: createMethod(5),
|
|
2817
|
-
// `Array.prototype.findIndex` method
|
|
2818
|
-
// https://tc39.es/ecma262/#sec-array.prototype.findIndex
|
|
2819
|
-
findIndex: createMethod(6),
|
|
2820
|
-
// `Array.prototype.filterReject` method
|
|
2821
|
-
// https://github.com/tc39/proposal-array-filtering
|
|
2822
|
-
filterReject: createMethod(7)
|
|
973
|
+
// add a key to Array.prototype[@@unscopables]
|
|
974
|
+
var addToUnscopables = function (key) {
|
|
975
|
+
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
2823
976
|
};
|
|
2824
977
|
|
|
2825
|
-
var $
|
|
2826
|
-
|
|
978
|
+
var $includes = arrayIncludes.includes;
|
|
2827
979
|
|
|
2828
|
-
var STRICT_METHOD = arrayMethodIsStrict('forEach');
|
|
2829
980
|
|
|
2830
|
-
// `Array.prototype.forEach` method implementation
|
|
2831
|
-
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
2832
|
-
var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
|
|
2833
|
-
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
2834
|
-
// eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
|
|
2835
|
-
} : [].forEach;
|
|
2836
981
|
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
} catch (error) {
|
|
2842
|
-
CollectionPrototype.forEach = arrayForEach;
|
|
2843
|
-
}
|
|
2844
|
-
};
|
|
982
|
+
// FF99+ bug
|
|
983
|
+
var BROKEN_ON_SPARSE = fails(function () {
|
|
984
|
+
return !Array(1).includes();
|
|
985
|
+
});
|
|
2845
986
|
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
987
|
+
// `Array.prototype.includes` method
|
|
988
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
989
|
+
_export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
990
|
+
includes: function includes(el /* , fromIndex = 0 */) {
|
|
991
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
2849
992
|
}
|
|
2850
|
-
}
|
|
993
|
+
});
|
|
2851
994
|
|
|
2852
|
-
|
|
995
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
996
|
+
addToUnscopables('includes');
|
|
2853
997
|
|
|
2854
998
|
var bind = function bind(fn, thisArg) {
|
|
2855
999
|
return function wrap() {
|
|
@@ -6071,7 +4215,7 @@ axios_1.default = default_1;
|
|
|
6071
4215
|
var axios = axios_1;
|
|
6072
4216
|
|
|
6073
4217
|
var name$1 = "@tryghost/content-api";
|
|
6074
|
-
var version = "1.11.
|
|
4218
|
+
var version = "1.11.4";
|
|
6075
4219
|
var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
|
|
6076
4220
|
var author = "Ghost Foundation";
|
|
6077
4221
|
var license = "MIT";
|
|
@@ -6100,12 +4244,12 @@ var publishConfig = {
|
|
|
6100
4244
|
access: "public"
|
|
6101
4245
|
};
|
|
6102
4246
|
var devDependencies = {
|
|
6103
|
-
"@babel/core": "7.19.
|
|
4247
|
+
"@babel/core": "7.19.1",
|
|
6104
4248
|
"@babel/polyfill": "7.12.1",
|
|
6105
|
-
"@babel/preset-env": "7.19.
|
|
4249
|
+
"@babel/preset-env": "7.19.1",
|
|
6106
4250
|
"@rollup/plugin-json": "4.1.0",
|
|
6107
4251
|
c8: "7.12.0",
|
|
6108
|
-
"core-js": "3.25.
|
|
4252
|
+
"core-js": "3.25.2",
|
|
6109
4253
|
"eslint-plugin-ghost": "2.15.1",
|
|
6110
4254
|
mocha: "10.0.0",
|
|
6111
4255
|
rollup: "2.79.0",
|
|
@@ -6121,7 +4265,7 @@ var devDependencies = {
|
|
|
6121
4265
|
var dependencies = {
|
|
6122
4266
|
axios: "^0.27.0"
|
|
6123
4267
|
};
|
|
6124
|
-
var gitHead = "
|
|
4268
|
+
var gitHead = "c4bc4d5ee2c7fea2eb9fc8de6cb8fd479ea039e3";
|
|
6125
4269
|
var packageInfo = {
|
|
6126
4270
|
name: name$1,
|
|
6127
4271
|
version: version,
|
|
@@ -6141,11 +4285,11 @@ var packageInfo = {
|
|
|
6141
4285
|
gitHead: gitHead
|
|
6142
4286
|
};
|
|
6143
4287
|
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
4288
|
+
const USER_AGENT_DEFAULT = false;
|
|
4289
|
+
const packageVersion = packageInfo.version;
|
|
4290
|
+
const defaultAcceptVersionHeader = 'v5.0';
|
|
4291
|
+
const supportedVersions = ['v2', 'v3', 'v4', 'v5', 'canary'];
|
|
4292
|
+
const name = '@tryghost/content-api';
|
|
6149
4293
|
/**
|
|
6150
4294
|
* This method can go away in favor of only sending 'Accept-Version` headers
|
|
6151
4295
|
* once the Ghost API removes a concept of version from it's URLS (with Ghost v5)
|
|
@@ -6154,35 +4298,37 @@ var name = '@tryghost/content-api';
|
|
|
6154
4298
|
* @returns {string}
|
|
6155
4299
|
*/
|
|
6156
4300
|
|
|
6157
|
-
|
|
6158
|
-
|
|
4301
|
+
const resolveAPIPrefix = version => {
|
|
4302
|
+
let prefix; // NOTE: the "version.match(/^v5\.\d+/)" expression should be changed to "version.match(/^v\d+\.\d+/)" once Ghost v5 is out
|
|
6159
4303
|
|
|
6160
4304
|
if (version === 'v5' || version === undefined || version.match(/^v5\.\d+/)) {
|
|
6161
|
-
prefix =
|
|
4305
|
+
prefix = `/content/`;
|
|
6162
4306
|
} else if (version.match(/^v\d+\.\d+/)) {
|
|
6163
|
-
|
|
6164
|
-
prefix =
|
|
4307
|
+
const versionPrefix = /^(v\d+)\.\d+/.exec(version)[1];
|
|
4308
|
+
prefix = `/${versionPrefix}/content/`;
|
|
6165
4309
|
} else {
|
|
6166
|
-
prefix =
|
|
4310
|
+
prefix = `/${version}/content/`;
|
|
6167
4311
|
}
|
|
6168
4312
|
|
|
6169
4313
|
return prefix;
|
|
6170
4314
|
};
|
|
6171
4315
|
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
4316
|
+
const defaultMakeRequest = _ref => {
|
|
4317
|
+
let {
|
|
4318
|
+
url,
|
|
4319
|
+
method,
|
|
4320
|
+
params,
|
|
4321
|
+
headers
|
|
4322
|
+
} = _ref;
|
|
6177
4323
|
return axios[method](url, {
|
|
6178
|
-
params
|
|
6179
|
-
paramsSerializer:
|
|
6180
|
-
return Object.keys(parameters).reduce(
|
|
6181
|
-
|
|
6182
|
-
return parts.concat(
|
|
4324
|
+
params,
|
|
4325
|
+
paramsSerializer: parameters => {
|
|
4326
|
+
return Object.keys(parameters).reduce((parts, k) => {
|
|
4327
|
+
const val = encodeURIComponent([].concat(parameters[k]).join(','));
|
|
4328
|
+
return parts.concat(`${k}=${val}`);
|
|
6183
4329
|
}, []).join('&');
|
|
6184
4330
|
},
|
|
6185
|
-
headers
|
|
4331
|
+
headers
|
|
6186
4332
|
});
|
|
6187
4333
|
};
|
|
6188
4334
|
/**
|
|
@@ -6199,15 +4345,15 @@ var defaultMakeRequest = function defaultMakeRequest(_ref) {
|
|
|
6199
4345
|
|
|
6200
4346
|
|
|
6201
4347
|
function GhostContentAPI(_ref2) {
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
4348
|
+
let {
|
|
4349
|
+
url,
|
|
4350
|
+
key,
|
|
4351
|
+
host,
|
|
4352
|
+
version,
|
|
4353
|
+
userAgent,
|
|
4354
|
+
ghostPath = 'ghost',
|
|
4355
|
+
makeRequest = defaultMakeRequest
|
|
4356
|
+
} = _ref2;
|
|
6211
4357
|
|
|
6212
4358
|
/**
|
|
6213
4359
|
* host parameter is deprecated
|
|
@@ -6215,7 +4361,7 @@ function GhostContentAPI(_ref2) {
|
|
|
6215
4361
|
*/
|
|
6216
4362
|
if (host) {
|
|
6217
4363
|
// eslint-disable-next-line
|
|
6218
|
-
console.warn(
|
|
4364
|
+
console.warn(`${name}: The 'host' parameter is deprecated, please use 'url' instead`);
|
|
6219
4365
|
|
|
6220
4366
|
if (!url) {
|
|
6221
4367
|
url = host;
|
|
@@ -6224,20 +4370,20 @@ function GhostContentAPI(_ref2) {
|
|
|
6224
4370
|
|
|
6225
4371
|
if (this instanceof GhostContentAPI) {
|
|
6226
4372
|
return GhostContentAPI({
|
|
6227
|
-
url
|
|
6228
|
-
key
|
|
6229
|
-
version
|
|
6230
|
-
userAgent
|
|
6231
|
-
ghostPath
|
|
6232
|
-
makeRequest
|
|
4373
|
+
url,
|
|
4374
|
+
key,
|
|
4375
|
+
version,
|
|
4376
|
+
userAgent,
|
|
4377
|
+
ghostPath,
|
|
4378
|
+
makeRequest
|
|
6233
4379
|
});
|
|
6234
4380
|
}
|
|
6235
4381
|
|
|
6236
4382
|
if (version === undefined) {
|
|
6237
|
-
throw new Error(
|
|
4383
|
+
throw new Error(`${name} Config Missing: 'version' is required. E.g. ${supportedVersions.join(',')}`);
|
|
6238
4384
|
}
|
|
6239
4385
|
|
|
6240
|
-
|
|
4386
|
+
let acceptVersionHeader;
|
|
6241
4387
|
|
|
6242
4388
|
if (typeof version === 'boolean') {
|
|
6243
4389
|
if (version === true) {
|
|
@@ -6246,68 +4392,70 @@ function GhostContentAPI(_ref2) {
|
|
|
6246
4392
|
|
|
6247
4393
|
version = undefined;
|
|
6248
4394
|
} else if (version && !supportedVersions.includes(version) && !version.match(/^v\d+\.\d+/)) {
|
|
6249
|
-
throw new Error(
|
|
4395
|
+
throw new Error(`${name} Config Invalid: 'version' ${version} is not supported`);
|
|
6250
4396
|
} else {
|
|
6251
4397
|
if (version === 'canary') {
|
|
6252
4398
|
// eslint-disable-next-line
|
|
6253
|
-
console.warn(
|
|
4399
|
+
console.warn(`${name}: The 'version' parameter has a deprecated format 'canary', please use 'v{major}.{minor}' format instead`);
|
|
6254
4400
|
acceptVersionHeader = defaultAcceptVersionHeader;
|
|
6255
4401
|
} else if (version.match(/^v\d+$/)) {
|
|
6256
4402
|
// eslint-disable-next-line
|
|
6257
|
-
console.warn(
|
|
6258
|
-
acceptVersionHeader =
|
|
4403
|
+
console.warn(`${name}: The 'version' parameter has a deprecated format 'v{major}', please use 'v{major}.{minor}' format instead`);
|
|
4404
|
+
acceptVersionHeader = `${version}.0`;
|
|
6259
4405
|
} else {
|
|
6260
4406
|
acceptVersionHeader = version;
|
|
6261
4407
|
}
|
|
6262
4408
|
}
|
|
6263
4409
|
|
|
6264
4410
|
if (!url) {
|
|
6265
|
-
throw new Error(
|
|
4411
|
+
throw new Error(`${name} Config Missing: 'url' is required. E.g. 'https://site.com'`);
|
|
6266
4412
|
}
|
|
6267
4413
|
|
|
6268
4414
|
if (!/https?:\/\//.test(url)) {
|
|
6269
|
-
throw new Error(
|
|
4415
|
+
throw new Error(`${name} Config Invalid: 'url' ${url} requires a protocol. E.g. 'https://site.com'`);
|
|
6270
4416
|
}
|
|
6271
4417
|
|
|
6272
4418
|
if (url.endsWith('/')) {
|
|
6273
|
-
throw new Error(
|
|
4419
|
+
throw new Error(`${name} Config Invalid: 'url' ${url} must not have a trailing slash. E.g. 'https://site.com'`);
|
|
6274
4420
|
}
|
|
6275
4421
|
|
|
6276
4422
|
if (ghostPath.endsWith('/') || ghostPath.startsWith('/')) {
|
|
6277
|
-
throw new Error(
|
|
4423
|
+
throw new Error(`${name} Config Invalid: 'ghostPath' ${ghostPath} must not have a leading or trailing slash. E.g. 'ghost'`);
|
|
6278
4424
|
}
|
|
6279
4425
|
|
|
6280
4426
|
if (key && !/[0-9a-f]{26}/.test(key)) {
|
|
6281
|
-
throw new Error(
|
|
4427
|
+
throw new Error(`${name} Config Invalid: 'key' ${key} must have 26 hex characters`);
|
|
6282
4428
|
}
|
|
6283
4429
|
|
|
6284
4430
|
if (userAgent === undefined) {
|
|
6285
4431
|
userAgent = USER_AGENT_DEFAULT;
|
|
6286
4432
|
}
|
|
6287
4433
|
|
|
6288
|
-
|
|
4434
|
+
const api = ['posts', 'authors', 'tags', 'pages', 'settings', 'tiers', 'newsletters', 'offers'].reduce((apiObject, resourceType) => {
|
|
6289
4435
|
function browse() {
|
|
6290
|
-
|
|
6291
|
-
|
|
4436
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4437
|
+
let memberToken = arguments.length > 1 ? arguments[1] : undefined;
|
|
6292
4438
|
return makeApiRequest(resourceType, options, null, memberToken);
|
|
6293
4439
|
}
|
|
6294
4440
|
|
|
6295
4441
|
function read(data) {
|
|
6296
|
-
|
|
6297
|
-
|
|
4442
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4443
|
+
let memberToken = arguments.length > 2 ? arguments[2] : undefined;
|
|
6298
4444
|
|
|
6299
4445
|
if (!data || !data.id && !data.slug) {
|
|
6300
|
-
return Promise.reject(new Error(
|
|
4446
|
+
return Promise.reject(new Error(`${name} read requires an id or slug.`));
|
|
6301
4447
|
}
|
|
6302
4448
|
|
|
6303
|
-
|
|
6304
|
-
return makeApiRequest(resourceType, params, data.id ||
|
|
4449
|
+
const params = Object.assign({}, data, options);
|
|
4450
|
+
return makeApiRequest(resourceType, params, data.id || `slug/${data.slug}`, memberToken);
|
|
6305
4451
|
}
|
|
6306
4452
|
|
|
6307
|
-
return Object.assign(apiObject,
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
4453
|
+
return Object.assign(apiObject, {
|
|
4454
|
+
[resourceType]: {
|
|
4455
|
+
read,
|
|
4456
|
+
browse
|
|
4457
|
+
}
|
|
4458
|
+
});
|
|
6311
4459
|
}, {}); // Settings, tiers & newsletters only have browse methods, offers only has read
|
|
6312
4460
|
|
|
6313
4461
|
delete api.settings.read;
|
|
@@ -6317,20 +4465,20 @@ function GhostContentAPI(_ref2) {
|
|
|
6317
4465
|
return api;
|
|
6318
4466
|
|
|
6319
4467
|
function makeApiRequest(resourceType, params, id) {
|
|
6320
|
-
|
|
4468
|
+
let membersToken = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
6321
4469
|
|
|
6322
4470
|
if (!membersToken && !key) {
|
|
6323
|
-
return Promise.reject(new Error(
|
|
4471
|
+
return Promise.reject(new Error(`${name} Config Missing: 'key' is required.`));
|
|
6324
4472
|
}
|
|
6325
4473
|
|
|
6326
4474
|
delete params.id;
|
|
6327
|
-
|
|
6328
|
-
Authorization:
|
|
4475
|
+
const headers = membersToken ? {
|
|
4476
|
+
Authorization: `GhostMembers ${membersToken}`
|
|
6329
4477
|
} : {};
|
|
6330
4478
|
|
|
6331
4479
|
if (userAgent) {
|
|
6332
4480
|
if (typeof userAgent === 'boolean') {
|
|
6333
|
-
headers['User-Agent'] =
|
|
4481
|
+
headers['User-Agent'] = `GhostContentSDK/${packageVersion}`;
|
|
6334
4482
|
} else {
|
|
6335
4483
|
headers['User-Agent'] = userAgent;
|
|
6336
4484
|
}
|
|
@@ -6341,15 +4489,15 @@ function GhostContentAPI(_ref2) {
|
|
|
6341
4489
|
}
|
|
6342
4490
|
|
|
6343
4491
|
params = Object.assign({
|
|
6344
|
-
key
|
|
4492
|
+
key
|
|
6345
4493
|
}, params);
|
|
6346
|
-
|
|
4494
|
+
const apiUrl = `${url}/${ghostPath}/api${resolveAPIPrefix(version)}${resourceType}/${id ? id + '/' : ''}`;
|
|
6347
4495
|
return makeRequest({
|
|
6348
4496
|
url: apiUrl,
|
|
6349
4497
|
method: 'get',
|
|
6350
|
-
params
|
|
6351
|
-
headers
|
|
6352
|
-
}).then(
|
|
4498
|
+
params,
|
|
4499
|
+
headers
|
|
4500
|
+
}).then(res => {
|
|
6353
4501
|
if (!Array.isArray(res.data[resourceType])) {
|
|
6354
4502
|
return res.data[resourceType];
|
|
6355
4503
|
}
|
|
@@ -6361,13 +4509,13 @@ function GhostContentAPI(_ref2) {
|
|
|
6361
4509
|
return Object.assign(res.data[resourceType], {
|
|
6362
4510
|
meta: res.data.meta
|
|
6363
4511
|
});
|
|
6364
|
-
}).catch(
|
|
4512
|
+
}).catch(err => {
|
|
6365
4513
|
if (err.response && err.response.data && err.response.data.errors) {
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
4514
|
+
const props = err.response.data.errors[0];
|
|
4515
|
+
const toThrow = new Error(props.message);
|
|
4516
|
+
const keys = Object.keys(props);
|
|
6369
4517
|
toThrow.name = props.type;
|
|
6370
|
-
keys.forEach(
|
|
4518
|
+
keys.forEach(k => {
|
|
6371
4519
|
toThrow[k] = props[k];
|
|
6372
4520
|
});
|
|
6373
4521
|
toThrow.response = err.response; // @TODO: remove in 2.0. We have enhanced the error handling, but we don't want to break existing implementations.
|