radar-sdk-js 3.3.0 → 3.5.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -12,13 +12,14 @@ var check = function (it) {
12
12
 
13
13
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
14
14
  var global_1 =
15
- // eslint-disable-next-line no-undef
15
+ // eslint-disable-next-line es-x/no-global-this -- safe
16
16
  check(typeof globalThis == 'object' && globalThis) ||
17
17
  check(typeof window == 'object' && window) ||
18
+ // eslint-disable-next-line no-restricted-globals -- safe
18
19
  check(typeof self == 'object' && self) ||
19
20
  check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
20
- // eslint-disable-next-line no-new-func
21
- Function('return this')();
21
+ // eslint-disable-next-line no-new-func -- fallback
22
+ (function () { return this; })() || Function('return this')();
22
23
 
23
24
  var fails = function (exec) {
24
25
  try {
@@ -28,23 +29,38 @@ var fails = function (exec) {
28
29
  }
29
30
  };
30
31
 
31
- // Thank's IE8 for his funny defineProperty
32
+ // Detect IE8's incomplete defineProperty implementation
32
33
  var descriptors = !fails(function () {
34
+ // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
33
35
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
34
36
  });
35
37
 
36
- var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
38
+ var functionBindNative = !fails(function () {
39
+ // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
40
+ var test = (function () { /* empty */ }).bind();
41
+ // eslint-disable-next-line no-prototype-builtins -- safe
42
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
43
+ });
44
+
45
+ var call = Function.prototype.call;
46
+
47
+ var functionCall = functionBindNative ? call.bind(call) : function () {
48
+ return call.apply(call, arguments);
49
+ };
50
+
51
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
52
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
37
53
  var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
38
54
 
39
55
  // Nashorn ~ JDK8 bug
40
- var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
56
+ var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
41
57
 
42
58
  // `Object.prototype.propertyIsEnumerable` method implementation
43
- // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
59
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
44
60
  var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
45
61
  var descriptor = getOwnPropertyDescriptor(this, V);
46
62
  return !!descriptor && descriptor.enumerable;
47
- } : nativePropertyIsEnumerable;
63
+ } : $propertyIsEnumerable;
48
64
 
49
65
  var objectPropertyIsEnumerable = {
50
66
  f: f
@@ -59,27 +75,44 @@ var createPropertyDescriptor = function (bitmap, value) {
59
75
  };
60
76
  };
61
77
 
62
- var toString = {}.toString;
78
+ var FunctionPrototype = Function.prototype;
79
+ var bind = FunctionPrototype.bind;
80
+ var call$1 = FunctionPrototype.call;
81
+ var uncurryThis = functionBindNative && bind.bind(call$1, call$1);
82
+
83
+ var functionUncurryThis = functionBindNative ? function (fn) {
84
+ return fn && uncurryThis(fn);
85
+ } : function (fn) {
86
+ return fn && function () {
87
+ return call$1.apply(fn, arguments);
88
+ };
89
+ };
90
+
91
+ var toString = functionUncurryThis({}.toString);
92
+ var stringSlice = functionUncurryThis(''.slice);
63
93
 
64
94
  var classofRaw = function (it) {
65
- return toString.call(it).slice(8, -1);
95
+ return stringSlice(toString(it), 8, -1);
66
96
  };
67
97
 
68
- var split = ''.split;
98
+ var $Object = Object;
99
+ var split = functionUncurryThis(''.split);
69
100
 
70
101
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
71
102
  var indexedObject = fails(function () {
72
103
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
73
- // eslint-disable-next-line no-prototype-builtins
74
- return !Object('z').propertyIsEnumerable(0);
104
+ // eslint-disable-next-line no-prototype-builtins -- safe
105
+ return !$Object('z').propertyIsEnumerable(0);
75
106
  }) ? function (it) {
76
- return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
77
- } : Object;
107
+ return classofRaw(it) == 'String' ? split(it, '') : $Object(it);
108
+ } : $Object;
109
+
110
+ var $TypeError = TypeError;
78
111
 
79
112
  // `RequireObjectCoercible` abstract operation
80
- // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
113
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
81
114
  var requireObjectCoercible = function (it) {
82
- if (it == undefined) throw TypeError("Can't call method on " + it);
115
+ if (it == undefined) throw $TypeError("Can't call method on " + it);
83
116
  return it;
84
117
  };
85
118
 
@@ -91,27 +124,215 @@ var toIndexedObject = function (it) {
91
124
  return indexedObject(requireObjectCoercible(it));
92
125
  };
93
126
 
127
+ // `IsCallable` abstract operation
128
+ // https://tc39.es/ecma262/#sec-iscallable
129
+ var isCallable = function (argument) {
130
+ return typeof argument == 'function';
131
+ };
132
+
94
133
  var isObject = function (it) {
95
- return typeof it === 'object' ? it !== null : typeof it === 'function';
134
+ return typeof it == 'object' ? it !== null : isCallable(it);
96
135
  };
97
136
 
98
- // `ToPrimitive` abstract operation
99
- // https://tc39.github.io/ecma262/#sec-toprimitive
100
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
101
- // and the second argument - flag - preferred type is a string
102
- var toPrimitive = function (input, PREFERRED_STRING) {
103
- if (!isObject(input)) return input;
137
+ var aFunction = function (argument) {
138
+ return isCallable(argument) ? argument : undefined;
139
+ };
140
+
141
+ var getBuiltIn = function (namespace, method) {
142
+ return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
143
+ };
144
+
145
+ var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
146
+
147
+ var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
148
+
149
+ var process = global_1.process;
150
+ var Deno$1 = global_1.Deno;
151
+ var versions = process && process.versions || Deno$1 && Deno$1.version;
152
+ var v8 = versions && versions.v8;
153
+ var match, version;
154
+
155
+ if (v8) {
156
+ match = v8.split('.');
157
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
158
+ // but their correct versions are not interesting for us
159
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
160
+ }
161
+
162
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
163
+ // so check `userAgent` even if `.v8` exists, but 0
164
+ if (!version && engineUserAgent) {
165
+ match = engineUserAgent.match(/Edge\/(\d+)/);
166
+ if (!match || match[1] >= 74) {
167
+ match = engineUserAgent.match(/Chrome\/(\d+)/);
168
+ if (match) version = +match[1];
169
+ }
170
+ }
171
+
172
+ var engineV8Version = version;
173
+
174
+ /* eslint-disable es-x/no-symbol -- required for testing */
175
+
176
+
177
+
178
+ // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
179
+ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
180
+ var symbol = Symbol();
181
+ // Chrome 38 Symbol has incorrect toString conversion
182
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
183
+ return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
184
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
185
+ !Symbol.sham && engineV8Version && engineV8Version < 41;
186
+ });
187
+
188
+ /* eslint-disable es-x/no-symbol -- required for testing */
189
+
190
+
191
+ var useSymbolAsUid = nativeSymbol
192
+ && !Symbol.sham
193
+ && typeof Symbol.iterator == 'symbol';
194
+
195
+ var $Object$1 = Object;
196
+
197
+ var isSymbol = useSymbolAsUid ? function (it) {
198
+ return typeof it == 'symbol';
199
+ } : function (it) {
200
+ var $Symbol = getBuiltIn('Symbol');
201
+ return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$1(it));
202
+ };
203
+
204
+ var $String = String;
205
+
206
+ var tryToString = function (argument) {
207
+ try {
208
+ return $String(argument);
209
+ } catch (error) {
210
+ return 'Object';
211
+ }
212
+ };
213
+
214
+ var $TypeError$1 = TypeError;
215
+
216
+ // `Assert: IsCallable(argument) is true`
217
+ var aCallable = function (argument) {
218
+ if (isCallable(argument)) return argument;
219
+ throw $TypeError$1(tryToString(argument) + ' is not a function');
220
+ };
221
+
222
+ // `GetMethod` abstract operation
223
+ // https://tc39.es/ecma262/#sec-getmethod
224
+ var getMethod = function (V, P) {
225
+ var func = V[P];
226
+ return func == null ? undefined : aCallable(func);
227
+ };
228
+
229
+ var $TypeError$2 = TypeError;
230
+
231
+ // `OrdinaryToPrimitive` abstract operation
232
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
233
+ var ordinaryToPrimitive = function (input, pref) {
104
234
  var fn, val;
105
- if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
106
- if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
107
- if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
108
- throw TypeError("Can't convert object to primitive value");
235
+ if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
236
+ if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) return val;
237
+ if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
238
+ throw $TypeError$2("Can't convert object to primitive value");
109
239
  };
110
240
 
111
- var hasOwnProperty = {}.hasOwnProperty;
241
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
242
+ var defineProperty = Object.defineProperty;
112
243
 
113
- var has = function (it, key) {
114
- return hasOwnProperty.call(it, key);
244
+ var defineGlobalProperty = function (key, value) {
245
+ try {
246
+ defineProperty(global_1, key, { value: value, configurable: true, writable: true });
247
+ } catch (error) {
248
+ global_1[key] = value;
249
+ } return value;
250
+ };
251
+
252
+ var SHARED = '__core-js_shared__';
253
+ var store = global_1[SHARED] || defineGlobalProperty(SHARED, {});
254
+
255
+ var sharedStore = store;
256
+
257
+ var shared = createCommonjsModule(function (module) {
258
+ (module.exports = function (key, value) {
259
+ return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
260
+ })('versions', []).push({
261
+ version: '3.23.3',
262
+ mode: 'global',
263
+ copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
264
+ license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
265
+ source: 'https://github.com/zloirock/core-js'
266
+ });
267
+ });
268
+
269
+ var $Object$2 = Object;
270
+
271
+ // `ToObject` abstract operation
272
+ // https://tc39.es/ecma262/#sec-toobject
273
+ var toObject = function (argument) {
274
+ return $Object$2(requireObjectCoercible(argument));
275
+ };
276
+
277
+ var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
278
+
279
+ // `HasOwnProperty` abstract operation
280
+ // https://tc39.es/ecma262/#sec-hasownproperty
281
+ // eslint-disable-next-line es-x/no-object-hasown -- safe
282
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
283
+ return hasOwnProperty(toObject(it), key);
284
+ };
285
+
286
+ var id = 0;
287
+ var postfix = Math.random();
288
+ var toString$1 = functionUncurryThis(1.0.toString);
289
+
290
+ var uid = function (key) {
291
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
292
+ };
293
+
294
+ var WellKnownSymbolsStore = shared('wks');
295
+ var Symbol$1 = global_1.Symbol;
296
+ var symbolFor = Symbol$1 && Symbol$1['for'];
297
+ var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
298
+
299
+ var wellKnownSymbol = function (name) {
300
+ if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
301
+ var description = 'Symbol.' + name;
302
+ if (nativeSymbol && hasOwnProperty_1(Symbol$1, name)) {
303
+ WellKnownSymbolsStore[name] = Symbol$1[name];
304
+ } else if (useSymbolAsUid && symbolFor) {
305
+ WellKnownSymbolsStore[name] = symbolFor(description);
306
+ } else {
307
+ WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
308
+ }
309
+ } return WellKnownSymbolsStore[name];
310
+ };
311
+
312
+ var $TypeError$3 = TypeError;
313
+ var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
314
+
315
+ // `ToPrimitive` abstract operation
316
+ // https://tc39.es/ecma262/#sec-toprimitive
317
+ var toPrimitive = function (input, pref) {
318
+ if (!isObject(input) || isSymbol(input)) return input;
319
+ var exoticToPrim = getMethod(input, TO_PRIMITIVE);
320
+ var result;
321
+ if (exoticToPrim) {
322
+ if (pref === undefined) pref = 'default';
323
+ result = functionCall(exoticToPrim, input, pref);
324
+ if (!isObject(result) || isSymbol(result)) return result;
325
+ throw $TypeError$3("Can't convert object to primitive value");
326
+ }
327
+ if (pref === undefined) pref = 'number';
328
+ return ordinaryToPrimitive(input, pref);
329
+ };
330
+
331
+ // `ToPropertyKey` abstract operation
332
+ // https://tc39.es/ecma262/#sec-topropertykey
333
+ var toPropertyKey = function (argument) {
334
+ var key = toPrimitive(argument, 'string');
335
+ return isSymbol(key) ? key : key + '';
115
336
  };
116
337
 
117
338
  var document$1 = global_1.document;
@@ -122,48 +343,85 @@ var documentCreateElement = function (it) {
122
343
  return EXISTS ? document$1.createElement(it) : {};
123
344
  };
124
345
 
125
- // Thank's IE8 for his funny defineProperty
346
+ // Thanks to IE8 for its funny defineProperty
126
347
  var ie8DomDefine = !descriptors && !fails(function () {
348
+ // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
127
349
  return Object.defineProperty(documentCreateElement('div'), 'a', {
128
350
  get: function () { return 7; }
129
351
  }).a != 7;
130
352
  });
131
353
 
132
- var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
354
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
355
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
133
356
 
134
357
  // `Object.getOwnPropertyDescriptor` method
135
- // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
136
- var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
358
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
359
+ var f$1 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
137
360
  O = toIndexedObject(O);
138
- P = toPrimitive(P, true);
361
+ P = toPropertyKey(P);
139
362
  if (ie8DomDefine) try {
140
- return nativeGetOwnPropertyDescriptor(O, P);
363
+ return $getOwnPropertyDescriptor(O, P);
141
364
  } catch (error) { /* empty */ }
142
- if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
365
+ if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
143
366
  };
144
367
 
145
368
  var objectGetOwnPropertyDescriptor = {
146
369
  f: f$1
147
370
  };
148
371
 
149
- var anObject = function (it) {
150
- if (!isObject(it)) {
151
- throw TypeError(String(it) + ' is not an object');
152
- } return it;
372
+ // V8 ~ Chrome 36-
373
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
374
+ var v8PrototypeDefineBug = descriptors && fails(function () {
375
+ // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
376
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
377
+ value: 42,
378
+ writable: false
379
+ }).prototype != 42;
380
+ });
381
+
382
+ var $String$1 = String;
383
+ var $TypeError$4 = TypeError;
384
+
385
+ // `Assert: Type(argument) is Object`
386
+ var anObject = function (argument) {
387
+ if (isObject(argument)) return argument;
388
+ throw $TypeError$4($String$1(argument) + ' is not an object');
153
389
  };
154
390
 
155
- var nativeDefineProperty = Object.defineProperty;
391
+ var $TypeError$5 = TypeError;
392
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
393
+ var $defineProperty = Object.defineProperty;
394
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
395
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
396
+ var ENUMERABLE = 'enumerable';
397
+ var CONFIGURABLE = 'configurable';
398
+ var WRITABLE = 'writable';
156
399
 
157
400
  // `Object.defineProperty` method
158
- // https://tc39.github.io/ecma262/#sec-object.defineproperty
159
- var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
401
+ // https://tc39.es/ecma262/#sec-object.defineproperty
402
+ var f$2 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
403
+ anObject(O);
404
+ P = toPropertyKey(P);
405
+ anObject(Attributes);
406
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
407
+ var current = $getOwnPropertyDescriptor$1(O, P);
408
+ if (current && current[WRITABLE]) {
409
+ O[P] = Attributes.value;
410
+ Attributes = {
411
+ configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
412
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
413
+ writable: false
414
+ };
415
+ }
416
+ } return $defineProperty(O, P, Attributes);
417
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
160
418
  anObject(O);
161
- P = toPrimitive(P, true);
419
+ P = toPropertyKey(P);
162
420
  anObject(Attributes);
163
421
  if (ie8DomDefine) try {
164
- return nativeDefineProperty(O, P, Attributes);
422
+ return $defineProperty(O, P, Attributes);
165
423
  } catch (error) { /* empty */ }
166
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
424
+ if ('get' in Attributes || 'set' in Attributes) throw $TypeError$5('Accessors not supported');
167
425
  if ('value' in Attributes) O[P] = Attributes.value;
168
426
  return O;
169
427
  };
@@ -179,25 +437,27 @@ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
179
437
  return object;
180
438
  };
181
439
 
182
- var setGlobal = function (key, value) {
183
- try {
184
- createNonEnumerableProperty(global_1, key, value);
185
- } catch (error) {
186
- global_1[key] = value;
187
- } return value;
188
- };
440
+ var FunctionPrototype$1 = Function.prototype;
441
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
442
+ var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
189
443
 
190
- var SHARED = '__core-js_shared__';
191
- var store = global_1[SHARED] || setGlobal(SHARED, {});
444
+ var EXISTS$1 = hasOwnProperty_1(FunctionPrototype$1, 'name');
445
+ // additional protection from minified / mangled / dropped function names
446
+ var PROPER = EXISTS$1 && (function something() { /* empty */ }).name === 'something';
447
+ var CONFIGURABLE$1 = EXISTS$1 && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$1, 'name').configurable));
192
448
 
193
- var sharedStore = store;
449
+ var functionName = {
450
+ EXISTS: EXISTS$1,
451
+ PROPER: PROPER,
452
+ CONFIGURABLE: CONFIGURABLE$1
453
+ };
194
454
 
195
- var functionToString = Function.toString;
455
+ var functionToString = functionUncurryThis(Function.toString);
196
456
 
197
- // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
198
- if (typeof sharedStore.inspectSource != 'function') {
457
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
458
+ if (!isCallable(sharedStore.inspectSource)) {
199
459
  sharedStore.inspectSource = function (it) {
200
- return functionToString.call(it);
460
+ return functionToString(it);
201
461
  };
202
462
  }
203
463
 
@@ -205,24 +465,7 @@ var inspectSource = sharedStore.inspectSource;
205
465
 
206
466
  var WeakMap = global_1.WeakMap;
207
467
 
208
- var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
209
-
210
- var shared = createCommonjsModule(function (module) {
211
- (module.exports = function (key, value) {
212
- return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
213
- })('versions', []).push({
214
- version: '3.6.4',
215
- mode: 'global',
216
- copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
217
- });
218
- });
219
-
220
- var id = 0;
221
- var postfix = Math.random();
222
-
223
- var uid = function (key) {
224
- return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
225
- };
468
+ var nativeWeakMap = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));
226
469
 
227
470
  var keys = shared('keys');
228
471
 
@@ -232,141 +475,193 @@ var sharedKey = function (key) {
232
475
 
233
476
  var hiddenKeys = {};
234
477
 
478
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
479
+ var TypeError$1 = global_1.TypeError;
235
480
  var WeakMap$1 = global_1.WeakMap;
236
- var set, get, has$1;
481
+ var set, get, has;
237
482
 
238
483
  var enforce = function (it) {
239
- return has$1(it) ? get(it) : set(it, {});
484
+ return has(it) ? get(it) : set(it, {});
240
485
  };
241
486
 
242
487
  var getterFor = function (TYPE) {
243
488
  return function (it) {
244
489
  var state;
245
490
  if (!isObject(it) || (state = get(it)).type !== TYPE) {
246
- throw TypeError('Incompatible receiver, ' + TYPE + ' required');
491
+ throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
247
492
  } return state;
248
493
  };
249
494
  };
250
495
 
251
- if (nativeWeakMap) {
252
- var store$1 = new WeakMap$1();
253
- var wmget = store$1.get;
254
- var wmhas = store$1.has;
255
- var wmset = store$1.set;
496
+ if (nativeWeakMap || sharedStore.state) {
497
+ var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$1());
498
+ var wmget = functionUncurryThis(store$1.get);
499
+ var wmhas = functionUncurryThis(store$1.has);
500
+ var wmset = functionUncurryThis(store$1.set);
256
501
  set = function (it, metadata) {
257
- wmset.call(store$1, it, metadata);
502
+ if (wmhas(store$1, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
503
+ metadata.facade = it;
504
+ wmset(store$1, it, metadata);
258
505
  return metadata;
259
506
  };
260
507
  get = function (it) {
261
- return wmget.call(store$1, it) || {};
508
+ return wmget(store$1, it) || {};
262
509
  };
263
- has$1 = function (it) {
264
- return wmhas.call(store$1, it);
510
+ has = function (it) {
511
+ return wmhas(store$1, it);
265
512
  };
266
513
  } else {
267
514
  var STATE = sharedKey('state');
268
515
  hiddenKeys[STATE] = true;
269
516
  set = function (it, metadata) {
517
+ if (hasOwnProperty_1(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
518
+ metadata.facade = it;
270
519
  createNonEnumerableProperty(it, STATE, metadata);
271
520
  return metadata;
272
521
  };
273
522
  get = function (it) {
274
- return has(it, STATE) ? it[STATE] : {};
523
+ return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
275
524
  };
276
- has$1 = function (it) {
277
- return has(it, STATE);
525
+ has = function (it) {
526
+ return hasOwnProperty_1(it, STATE);
278
527
  };
279
528
  }
280
529
 
281
530
  var internalState = {
282
531
  set: set,
283
532
  get: get,
284
- has: has$1,
533
+ has: has,
285
534
  enforce: enforce,
286
535
  getterFor: getterFor
287
536
  };
288
537
 
289
- var redefine = createCommonjsModule(function (module) {
290
- var getInternalState = internalState.get;
538
+ var makeBuiltIn_1 = createCommonjsModule(function (module) {
539
+ var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
540
+
541
+
542
+
291
543
  var enforceInternalState = internalState.enforce;
544
+ var getInternalState = internalState.get;
545
+ // eslint-disable-next-line es-x/no-object-defineproperty -- safe
546
+ var defineProperty = Object.defineProperty;
547
+
548
+ var CONFIGURABLE_LENGTH = descriptors && !fails(function () {
549
+ return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
550
+ });
551
+
292
552
  var TEMPLATE = String(String).split('String');
293
553
 
294
- (module.exports = function (O, key, value, options) {
295
- var unsafe = options ? !!options.unsafe : false;
296
- var simple = options ? !!options.enumerable : false;
297
- var noTargetGet = options ? !!options.noTargetGet : false;
298
- if (typeof value == 'function') {
299
- if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
300
- enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
554
+ var makeBuiltIn = module.exports = function (value, name, options) {
555
+ if (String(name).slice(0, 7) === 'Symbol(') {
556
+ name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
301
557
  }
302
- if (O === global_1) {
303
- if (simple) O[key] = value;
304
- else setGlobal(key, value);
305
- return;
306
- } else if (!unsafe) {
307
- delete O[key];
308
- } else if (!noTargetGet && O[key]) {
309
- simple = true;
558
+ if (options && options.getter) name = 'get ' + name;
559
+ if (options && options.setter) name = 'set ' + name;
560
+ if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
561
+ if (descriptors) defineProperty(value, 'name', { value: name, configurable: true });
562
+ else value.name = name;
563
+ }
564
+ if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
565
+ defineProperty(value, 'length', { value: options.arity });
310
566
  }
311
- if (simple) O[key] = value;
312
- else createNonEnumerableProperty(O, key, value);
567
+ try {
568
+ if (options && hasOwnProperty_1(options, 'constructor') && options.constructor) {
569
+ if (descriptors) defineProperty(value, 'prototype', { writable: false });
570
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
571
+ } else if (value.prototype) value.prototype = undefined;
572
+ } catch (error) { /* empty */ }
573
+ var state = enforceInternalState(value);
574
+ if (!hasOwnProperty_1(state, 'source')) {
575
+ state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
576
+ } return value;
577
+ };
578
+
313
579
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
314
- })(Function.prototype, 'toString', function toString() {
315
- return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
316
- });
580
+ // eslint-disable-next-line no-extend-native -- required
581
+ Function.prototype.toString = makeBuiltIn(function toString() {
582
+ return isCallable(this) && getInternalState(this).source || inspectSource(this);
583
+ }, 'toString');
317
584
  });
318
585
 
319
- var path = global_1;
320
-
321
- var aFunction = function (variable) {
322
- return typeof variable == 'function' ? variable : undefined;
323
- };
324
-
325
- var getBuiltIn = function (namespace, method) {
326
- return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
327
- : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
586
+ var defineBuiltIn = function (O, key, value, options) {
587
+ if (!options) options = {};
588
+ var simple = options.enumerable;
589
+ var name = options.name !== undefined ? options.name : key;
590
+ if (isCallable(value)) makeBuiltIn_1(value, name, options);
591
+ if (options.global) {
592
+ if (simple) O[key] = value;
593
+ else defineGlobalProperty(key, value);
594
+ } else {
595
+ try {
596
+ if (!options.unsafe) delete O[key];
597
+ else if (O[key]) simple = true;
598
+ } catch (error) { /* empty */ }
599
+ if (simple) O[key] = value;
600
+ else objectDefineProperty.f(O, key, {
601
+ value: value,
602
+ enumerable: false,
603
+ configurable: !options.nonConfigurable,
604
+ writable: !options.nonWritable
605
+ });
606
+ } return O;
328
607
  };
329
608
 
330
609
  var ceil = Math.ceil;
331
610
  var floor = Math.floor;
332
611
 
333
- // `ToInteger` abstract operation
334
- // https://tc39.github.io/ecma262/#sec-tointeger
335
- var toInteger = function (argument) {
336
- return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
612
+ // `Math.trunc` method
613
+ // https://tc39.es/ecma262/#sec-math.trunc
614
+ // eslint-disable-next-line es-x/no-math-trunc -- safe
615
+ var mathTrunc = Math.trunc || function trunc(x) {
616
+ var n = +x;
617
+ return (n > 0 ? floor : ceil)(n);
337
618
  };
338
619
 
339
- var min = Math.min;
340
-
341
- // `ToLength` abstract operation
342
- // https://tc39.github.io/ecma262/#sec-tolength
343
- var toLength = function (argument) {
344
- return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
620
+ // `ToIntegerOrInfinity` abstract operation
621
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
622
+ var toIntegerOrInfinity = function (argument) {
623
+ var number = +argument;
624
+ // eslint-disable-next-line no-self-compare -- NaN check
625
+ return number !== number || number === 0 ? 0 : mathTrunc(number);
345
626
  };
346
627
 
347
628
  var max = Math.max;
348
- var min$1 = Math.min;
629
+ var min = Math.min;
349
630
 
350
631
  // Helper for a popular repeating case of the spec:
351
632
  // Let integer be ? ToInteger(index).
352
633
  // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
353
634
  var toAbsoluteIndex = function (index, length) {
354
- var integer = toInteger(index);
355
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
635
+ var integer = toIntegerOrInfinity(index);
636
+ return integer < 0 ? max(integer + length, 0) : min(integer, length);
637
+ };
638
+
639
+ var min$1 = Math.min;
640
+
641
+ // `ToLength` abstract operation
642
+ // https://tc39.es/ecma262/#sec-tolength
643
+ var toLength = function (argument) {
644
+ return argument > 0 ? min$1(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
645
+ };
646
+
647
+ // `LengthOfArrayLike` abstract operation
648
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
649
+ var lengthOfArrayLike = function (obj) {
650
+ return toLength(obj.length);
356
651
  };
357
652
 
358
653
  // `Array.prototype.{ indexOf, includes }` methods implementation
359
654
  var createMethod = function (IS_INCLUDES) {
360
655
  return function ($this, el, fromIndex) {
361
656
  var O = toIndexedObject($this);
362
- var length = toLength(O.length);
657
+ var length = lengthOfArrayLike(O);
363
658
  var index = toAbsoluteIndex(fromIndex, length);
364
659
  var value;
365
660
  // Array#includes uses SameValueZero equality algorithm
366
- // eslint-disable-next-line no-self-compare
661
+ // eslint-disable-next-line no-self-compare -- NaN check
367
662
  if (IS_INCLUDES && el != el) while (length > index) {
368
663
  value = O[index++];
369
- // eslint-disable-next-line no-self-compare
664
+ // eslint-disable-next-line no-self-compare -- NaN check
370
665
  if (value != value) return true;
371
666
  // Array#indexOf ignores holes, Array#includes - not
372
667
  } else for (;length > index; index++) {
@@ -377,25 +672,27 @@ var createMethod = function (IS_INCLUDES) {
377
672
 
378
673
  var arrayIncludes = {
379
674
  // `Array.prototype.includes` method
380
- // https://tc39.github.io/ecma262/#sec-array.prototype.includes
675
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
381
676
  includes: createMethod(true),
382
677
  // `Array.prototype.indexOf` method
383
- // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
678
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
384
679
  indexOf: createMethod(false)
385
680
  };
386
681
 
387
682
  var indexOf = arrayIncludes.indexOf;
388
683
 
389
684
 
685
+ var push = functionUncurryThis([].push);
686
+
390
687
  var objectKeysInternal = function (object, names) {
391
688
  var O = toIndexedObject(object);
392
689
  var i = 0;
393
690
  var result = [];
394
691
  var key;
395
- for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
692
+ for (key in O) !hasOwnProperty_1(hiddenKeys, key) && hasOwnProperty_1(O, key) && push(result, key);
396
693
  // Don't enum bug & hidden keys
397
- while (names.length > i) if (has(O, key = names[i++])) {
398
- ~indexOf(result, key) || result.push(key);
694
+ while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
695
+ ~indexOf(result, key) || push(result, key);
399
696
  }
400
697
  return result;
401
698
  };
@@ -414,7 +711,8 @@ var enumBugKeys = [
414
711
  var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
415
712
 
416
713
  // `Object.getOwnPropertyNames` method
417
- // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
714
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
715
+ // eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
418
716
  var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
419
717
  return objectKeysInternal(O, hiddenKeys$1);
420
718
  };
@@ -423,26 +721,31 @@ var objectGetOwnPropertyNames = {
423
721
  f: f$3
424
722
  };
425
723
 
724
+ // eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
426
725
  var f$4 = Object.getOwnPropertySymbols;
427
726
 
428
727
  var objectGetOwnPropertySymbols = {
429
728
  f: f$4
430
729
  };
431
730
 
731
+ var concat = functionUncurryThis([].concat);
732
+
432
733
  // all object keys, includes non-enumerable and symbols
433
734
  var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
434
735
  var keys = objectGetOwnPropertyNames.f(anObject(it));
435
736
  var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
436
- return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
737
+ return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
437
738
  };
438
739
 
439
- var copyConstructorProperties = function (target, source) {
740
+ var copyConstructorProperties = function (target, source, exceptions) {
440
741
  var keys = ownKeys(source);
441
742
  var defineProperty = objectDefineProperty.f;
442
743
  var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
443
744
  for (var i = 0; i < keys.length; i++) {
444
745
  var key = keys[i];
445
- if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
746
+ if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
747
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
748
+ }
446
749
  }
447
750
  };
448
751
 
@@ -452,7 +755,7 @@ var isForced = function (feature, detection) {
452
755
  var value = data[normalize(feature)];
453
756
  return value == POLYFILL ? true
454
757
  : value == NATIVE ? false
455
- : typeof detection == 'function' ? fails(detection)
758
+ : isCallable(detection) ? fails(detection)
456
759
  : !!detection;
457
760
  };
458
761
 
@@ -474,18 +777,19 @@ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
474
777
 
475
778
 
476
779
  /*
477
- options.target - name of the target object
478
- options.global - target is the global object
479
- options.stat - export as static methods of target
480
- options.proto - export as prototype methods of target
481
- options.real - real prototype method for the `pure` version
482
- options.forced - export even if the native feature is available
483
- options.bind - bind methods to the target, required for the `pure` version
484
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
485
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
486
- options.sham - add a flag to not completely full polyfills
487
- options.enumerable - export as enumerable property
488
- options.noTargetGet - prevent calling a getter on target
780
+ options.target - name of the target object
781
+ options.global - target is the global object
782
+ options.stat - export as static methods of target
783
+ options.proto - export as prototype methods of target
784
+ options.real - real prototype method for the `pure` version
785
+ options.forced - export even if the native feature is available
786
+ options.bind - bind methods to the target, required for the `pure` version
787
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
788
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
789
+ options.sham - add a flag to not completely full polyfills
790
+ options.enumerable - export as enumerable property
791
+ options.dontCallGetSet - prevent calling a getter on target
792
+ options.name - the .name of the function if it does not match the key
489
793
  */
490
794
  var _export = function (options, source) {
491
795
  var TARGET = options.target;
@@ -495,39 +799,33 @@ var _export = function (options, source) {
495
799
  if (GLOBAL) {
496
800
  target = global_1;
497
801
  } else if (STATIC) {
498
- target = global_1[TARGET] || setGlobal(TARGET, {});
802
+ target = global_1[TARGET] || defineGlobalProperty(TARGET, {});
499
803
  } else {
500
804
  target = (global_1[TARGET] || {}).prototype;
501
805
  }
502
806
  if (target) for (key in source) {
503
807
  sourceProperty = source[key];
504
- if (options.noTargetGet) {
808
+ if (options.dontCallGetSet) {
505
809
  descriptor = getOwnPropertyDescriptor$1(target, key);
506
810
  targetProperty = descriptor && descriptor.value;
507
811
  } else targetProperty = target[key];
508
812
  FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
509
813
  // contained in target
510
814
  if (!FORCED && targetProperty !== undefined) {
511
- if (typeof sourceProperty === typeof targetProperty) continue;
815
+ if (typeof sourceProperty == typeof targetProperty) continue;
512
816
  copyConstructorProperties(sourceProperty, targetProperty);
513
817
  }
514
818
  // add a flag to not completely full polyfills
515
819
  if (options.sham || (targetProperty && targetProperty.sham)) {
516
820
  createNonEnumerableProperty(sourceProperty, 'sham', true);
517
821
  }
518
- // extend global
519
- redefine(target, key, sourceProperty, options);
822
+ defineBuiltIn(target, key, sourceProperty, options);
520
823
  }
521
824
  };
522
825
 
523
- // `ToObject` abstract operation
524
- // https://tc39.github.io/ecma262/#sec-toobject
525
- var toObject = function (argument) {
526
- return Object(requireObjectCoercible(argument));
527
- };
528
-
529
826
  // `Object.keys` method
530
- // https://tc39.github.io/ecma262/#sec-object.keys
827
+ // https://tc39.es/ecma262/#sec-object.keys
828
+ // eslint-disable-next-line es-x/no-object-keys -- safe
531
829
  var objectKeys = Object.keys || function keys(O) {
532
830
  return objectKeysInternal(O, enumBugKeys);
533
831
  };
@@ -535,17 +833,57 @@ var objectKeys = Object.keys || function keys(O) {
535
833
  var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
536
834
 
537
835
  // `Object.keys` method
538
- // https://tc39.github.io/ecma262/#sec-object.keys
836
+ // https://tc39.es/ecma262/#sec-object.keys
539
837
  _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
540
838
  keys: function keys(it) {
541
839
  return objectKeys(toObject(it));
542
840
  }
543
841
  });
544
842
 
843
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
844
+ var test = {};
845
+
846
+ test[TO_STRING_TAG] = 'z';
847
+
848
+ var toStringTagSupport = String(test) === '[object z]';
849
+
850
+ var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
851
+ var $Object$3 = Object;
852
+
853
+ // ES3 wrong here
854
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
855
+
856
+ // fallback for IE11 Script Access Denied error
857
+ var tryGet = function (it, key) {
858
+ try {
859
+ return it[key];
860
+ } catch (error) { /* empty */ }
861
+ };
862
+
863
+ // getting tag from ES6+ `Object.prototype.toString`
864
+ var classof = toStringTagSupport ? classofRaw : function (it) {
865
+ var O, tag, result;
866
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
867
+ // @@toStringTag case
868
+ : typeof (tag = tryGet(O = $Object$3(it), TO_STRING_TAG$1)) == 'string' ? tag
869
+ // builtinTag case
870
+ : CORRECT_ARGUMENTS ? classofRaw(O)
871
+ // ES3 arguments fallback
872
+ : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
873
+ };
874
+
875
+ var $String$2 = String;
876
+
877
+ var toString_1 = function (argument) {
878
+ if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
879
+ return $String$2(argument);
880
+ };
881
+
545
882
  // a string of all valid unicode whitespaces
546
- // eslint-disable-next-line max-len
547
- var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
883
+ var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
884
+ '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
548
885
 
886
+ var replace = functionUncurryThis(''.replace);
549
887
  var whitespace = '[' + whitespaces + ']';
550
888
  var ltrim = RegExp('^' + whitespace + whitespace + '*');
551
889
  var rtrim = RegExp(whitespace + whitespace + '*$');
@@ -553,32 +891,38 @@ var rtrim = RegExp(whitespace + whitespace + '*$');
553
891
  // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
554
892
  var createMethod$1 = function (TYPE) {
555
893
  return function ($this) {
556
- var string = String(requireObjectCoercible($this));
557
- if (TYPE & 1) string = string.replace(ltrim, '');
558
- if (TYPE & 2) string = string.replace(rtrim, '');
894
+ var string = toString_1(requireObjectCoercible($this));
895
+ if (TYPE & 1) string = replace(string, ltrim, '');
896
+ if (TYPE & 2) string = replace(string, rtrim, '');
559
897
  return string;
560
898
  };
561
899
  };
562
900
 
563
901
  var stringTrim = {
564
902
  // `String.prototype.{ trimLeft, trimStart }` methods
565
- // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
903
+ // https://tc39.es/ecma262/#sec-string.prototype.trimstart
566
904
  start: createMethod$1(1),
567
905
  // `String.prototype.{ trimRight, trimEnd }` methods
568
- // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
906
+ // https://tc39.es/ecma262/#sec-string.prototype.trimend
569
907
  end: createMethod$1(2),
570
908
  // `String.prototype.trim` method
571
- // https://tc39.github.io/ecma262/#sec-string.prototype.trim
909
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
572
910
  trim: createMethod$1(3)
573
911
  };
574
912
 
913
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
914
+
915
+
916
+
575
917
  var non = '\u200B\u0085\u180E';
576
918
 
577
919
  // check that a method works with the correct list
578
920
  // of whitespaces and has a correct name
579
921
  var stringTrimForced = function (METHOD_NAME) {
580
922
  return fails(function () {
581
- return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
923
+ return !!whitespaces[METHOD_NAME]()
924
+ || non[METHOD_NAME]() !== non
925
+ || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
582
926
  });
583
927
  };
584
928
 
@@ -586,7 +930,7 @@ var $trim = stringTrim.trim;
586
930
 
587
931
 
588
932
  // `String.prototype.trim` method
589
- // https://tc39.github.io/ecma262/#sec-string.prototype.trim
933
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
590
934
  _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
591
935
  trim: function trim() {
592
936
  return $trim(this);
@@ -716,87 +1060,66 @@ function _objectSpread2(target) {
716
1060
  return target;
717
1061
  }
718
1062
 
719
- var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
720
- // Chrome 38 Symbol has incorrect toString conversion
721
- // eslint-disable-next-line no-undef
722
- return !String(Symbol());
723
- });
1063
+ // `Object.prototype.toString` method implementation
1064
+ // https://tc39.es/ecma262/#sec-object.prototype.tostring
1065
+ var objectToString = toStringTagSupport ? {}.toString : function toString() {
1066
+ return '[object ' + classof(this) + ']';
1067
+ };
724
1068
 
725
- var useSymbolAsUid = nativeSymbol
726
- // eslint-disable-next-line no-undef
727
- && !Symbol.sham
728
- // eslint-disable-next-line no-undef
729
- && typeof Symbol.iterator == 'symbol';
1069
+ // `Object.prototype.toString` method
1070
+ // https://tc39.es/ecma262/#sec-object.prototype.tostring
1071
+ if (!toStringTagSupport) {
1072
+ defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
1073
+ }
730
1074
 
731
- var WellKnownSymbolsStore = shared('wks');
732
- var Symbol$1 = global_1.Symbol;
733
- var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
1075
+ var engineIsNode = classofRaw(global_1.process) == 'process';
734
1076
 
735
- var wellKnownSymbol = function (name) {
736
- if (!has(WellKnownSymbolsStore, name)) {
737
- if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
738
- else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
739
- } return WellKnownSymbolsStore[name];
1077
+ var $String$3 = String;
1078
+ var $TypeError$6 = TypeError;
1079
+
1080
+ var aPossiblePrototype = function (argument) {
1081
+ if (typeof argument == 'object' || isCallable(argument)) return argument;
1082
+ throw $TypeError$6("Can't set " + $String$3(argument) + ' as a prototype');
740
1083
  };
741
1084
 
742
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
743
- var test = {};
1085
+ /* eslint-disable no-proto -- safe */
744
1086
 
745
- test[TO_STRING_TAG] = 'z';
746
1087
 
747
- var toStringTagSupport = String(test) === '[object z]';
748
1088
 
749
- var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
750
- // ES3 wrong here
751
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
752
1089
 
753
- // fallback for IE11 Script Access Denied error
754
- var tryGet = function (it, key) {
1090
+ // `Object.setPrototypeOf` method
1091
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1092
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1093
+ // eslint-disable-next-line es-x/no-object-setprototypeof -- safe
1094
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1095
+ var CORRECT_SETTER = false;
1096
+ var test = {};
1097
+ var setter;
755
1098
  try {
756
- return it[key];
1099
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
1100
+ setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1101
+ setter(test, []);
1102
+ CORRECT_SETTER = test instanceof Array;
757
1103
  } catch (error) { /* empty */ }
758
- };
1104
+ return function setPrototypeOf(O, proto) {
1105
+ anObject(O);
1106
+ aPossiblePrototype(proto);
1107
+ if (CORRECT_SETTER) setter(O, proto);
1108
+ else O.__proto__ = proto;
1109
+ return O;
1110
+ };
1111
+ }() : undefined);
759
1112
 
760
- // getting tag from ES6+ `Object.prototype.toString`
761
- var classof = toStringTagSupport ? classofRaw : function (it) {
762
- var O, tag, result;
763
- return it === undefined ? 'Undefined' : it === null ? 'Null'
764
- // @@toStringTag case
765
- : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
766
- // builtinTag case
767
- : CORRECT_ARGUMENTS ? classofRaw(O)
768
- // ES3 arguments fallback
769
- : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
770
- };
771
-
772
- // `Object.prototype.toString` method implementation
773
- // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
774
- var objectToString = toStringTagSupport ? {}.toString : function toString() {
775
- return '[object ' + classof(this) + ']';
776
- };
777
-
778
- // `Object.prototype.toString` method
779
- // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
780
- if (!toStringTagSupport) {
781
- redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
782
- }
783
-
784
- var nativePromiseConstructor = global_1.Promise;
785
-
786
- var redefineAll = function (target, src, options) {
787
- for (var key in src) redefine(target, key, src[key], options);
788
- return target;
789
- };
790
-
791
- var defineProperty = objectDefineProperty.f;
1113
+ var defineProperty$1 = objectDefineProperty.f;
792
1114
 
793
1115
 
794
1116
 
795
1117
  var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
796
1118
 
797
- var setToStringTag = function (it, TAG, STATIC) {
798
- if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG$2)) {
799
- defineProperty(it, TO_STRING_TAG$2, { configurable: true, value: TAG });
1119
+ var setToStringTag = function (target, TAG, STATIC) {
1120
+ if (target && !STATIC) target = target.prototype;
1121
+ if (target && !hasOwnProperty_1(target, TO_STRING_TAG$2)) {
1122
+ defineProperty$1(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
800
1123
  }
801
1124
  };
802
1125
 
@@ -814,177 +1137,128 @@ var setSpecies = function (CONSTRUCTOR_NAME) {
814
1137
  }
815
1138
  };
816
1139
 
817
- var aFunction$1 = function (it) {
818
- if (typeof it != 'function') {
819
- throw TypeError(String(it) + ' is not a function');
820
- } return it;
821
- };
1140
+ var $TypeError$7 = TypeError;
822
1141
 
823
- var anInstance = function (it, Constructor, name) {
824
- if (!(it instanceof Constructor)) {
825
- throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
826
- } return it;
1142
+ var anInstance = function (it, Prototype) {
1143
+ if (objectIsPrototypeOf(Prototype, it)) return it;
1144
+ throw $TypeError$7('Incorrect invocation');
827
1145
  };
828
1146
 
829
- var iterators = {};
830
-
831
- var ITERATOR = wellKnownSymbol('iterator');
832
- var ArrayPrototype = Array.prototype;
833
-
834
- // check on default Array iterator
835
- var isArrayIteratorMethod = function (it) {
836
- return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR] === it);
837
- };
1147
+ var noop = function () { /* empty */ };
1148
+ var empty = [];
1149
+ var construct = getBuiltIn('Reflect', 'construct');
1150
+ var constructorRegExp = /^\s*(?:class|function)\b/;
1151
+ var exec = functionUncurryThis(constructorRegExp.exec);
1152
+ var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
838
1153
 
839
- // optional / simple context binding
840
- var functionBindContext = function (fn, that, length) {
841
- aFunction$1(fn);
842
- if (that === undefined) return fn;
843
- switch (length) {
844
- case 0: return function () {
845
- return fn.call(that);
846
- };
847
- case 1: return function (a) {
848
- return fn.call(that, a);
849
- };
850
- case 2: return function (a, b) {
851
- return fn.call(that, a, b);
852
- };
853
- case 3: return function (a, b, c) {
854
- return fn.call(that, a, b, c);
855
- };
1154
+ var isConstructorModern = function isConstructor(argument) {
1155
+ if (!isCallable(argument)) return false;
1156
+ try {
1157
+ construct(noop, empty, argument);
1158
+ return true;
1159
+ } catch (error) {
1160
+ return false;
856
1161
  }
857
- return function (/* ...args */) {
858
- return fn.apply(that, arguments);
859
- };
860
1162
  };
861
1163
 
862
- var ITERATOR$1 = wellKnownSymbol('iterator');
863
-
864
- var getIteratorMethod = function (it) {
865
- if (it != undefined) return it[ITERATOR$1]
866
- || it['@@iterator']
867
- || iterators[classof(it)];
868
- };
869
-
870
- // call something on iterator step with safe closing on error
871
- var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
1164
+ var isConstructorLegacy = function isConstructor(argument) {
1165
+ if (!isCallable(argument)) return false;
1166
+ switch (classof(argument)) {
1167
+ case 'AsyncFunction':
1168
+ case 'GeneratorFunction':
1169
+ case 'AsyncGeneratorFunction': return false;
1170
+ }
872
1171
  try {
873
- return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
874
- // 7.4.6 IteratorClose(iterator, completion)
1172
+ // we can't check .prototype since constructors produced by .bind haven't it
1173
+ // `Function#toString` throws on some built-it function in some legacy engines
1174
+ // (for example, `DOMQuad` and similar in FF41-)
1175
+ return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
875
1176
  } catch (error) {
876
- var returnMethod = iterator['return'];
877
- if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
878
- throw error;
1177
+ return true;
879
1178
  }
880
1179
  };
881
1180
 
882
- var iterate_1 = createCommonjsModule(function (module) {
883
- var Result = function (stopped, result) {
884
- this.stopped = stopped;
885
- this.result = result;
886
- };
887
-
888
- var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
889
- var boundFunction = functionBindContext(fn, that, AS_ENTRIES ? 2 : 1);
890
- var iterator, iterFn, index, length, result, next, step;
1181
+ isConstructorLegacy.sham = true;
891
1182
 
892
- if (IS_ITERATOR) {
893
- iterator = iterable;
894
- } else {
895
- iterFn = getIteratorMethod(iterable);
896
- if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
897
- // optimisation for array iterators
898
- if (isArrayIteratorMethod(iterFn)) {
899
- for (index = 0, length = toLength(iterable.length); length > index; index++) {
900
- result = AS_ENTRIES
901
- ? boundFunction(anObject(step = iterable[index])[0], step[1])
902
- : boundFunction(iterable[index]);
903
- if (result && result instanceof Result) return result;
904
- } return new Result(false);
905
- }
906
- iterator = iterFn.call(iterable);
907
- }
1183
+ // `IsConstructor` abstract operation
1184
+ // https://tc39.es/ecma262/#sec-isconstructor
1185
+ var isConstructor = !construct || fails(function () {
1186
+ var called;
1187
+ return isConstructorModern(isConstructorModern.call)
1188
+ || !isConstructorModern(Object)
1189
+ || !isConstructorModern(function () { called = true; })
1190
+ || called;
1191
+ }) ? isConstructorLegacy : isConstructorModern;
908
1192
 
909
- next = iterator.next;
910
- while (!(step = next.call(iterator)).done) {
911
- result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES);
912
- if (typeof result == 'object' && result && result instanceof Result) return result;
913
- } return new Result(false);
914
- };
1193
+ var $TypeError$8 = TypeError;
915
1194
 
916
- iterate.stop = function (result) {
917
- return new Result(true, result);
918
- };
919
- });
920
-
921
- var ITERATOR$2 = wellKnownSymbol('iterator');
922
- var SAFE_CLOSING = false;
923
-
924
- try {
925
- var called = 0;
926
- var iteratorWithReturn = {
927
- next: function () {
928
- return { done: !!called++ };
929
- },
930
- 'return': function () {
931
- SAFE_CLOSING = true;
932
- }
933
- };
934
- iteratorWithReturn[ITERATOR$2] = function () {
935
- return this;
936
- };
937
- // eslint-disable-next-line no-throw-literal
938
- Array.from(iteratorWithReturn, function () { throw 2; });
939
- } catch (error) { /* empty */ }
940
-
941
- var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
942
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
943
- var ITERATION_SUPPORT = false;
944
- try {
945
- var object = {};
946
- object[ITERATOR$2] = function () {
947
- return {
948
- next: function () {
949
- return { done: ITERATION_SUPPORT = true };
950
- }
951
- };
952
- };
953
- exec(object);
954
- } catch (error) { /* empty */ }
955
- return ITERATION_SUPPORT;
1195
+ // `Assert: IsConstructor(argument) is true`
1196
+ var aConstructor = function (argument) {
1197
+ if (isConstructor(argument)) return argument;
1198
+ throw $TypeError$8(tryToString(argument) + ' is not a constructor');
956
1199
  };
957
1200
 
958
1201
  var SPECIES$1 = wellKnownSymbol('species');
959
1202
 
960
1203
  // `SpeciesConstructor` abstract operation
961
- // https://tc39.github.io/ecma262/#sec-speciesconstructor
1204
+ // https://tc39.es/ecma262/#sec-speciesconstructor
962
1205
  var speciesConstructor = function (O, defaultConstructor) {
963
1206
  var C = anObject(O).constructor;
964
1207
  var S;
965
- return C === undefined || (S = anObject(C)[SPECIES$1]) == undefined ? defaultConstructor : aFunction$1(S);
1208
+ return C === undefined || (S = anObject(C)[SPECIES$1]) == undefined ? defaultConstructor : aConstructor(S);
1209
+ };
1210
+
1211
+ var FunctionPrototype$2 = Function.prototype;
1212
+ var apply = FunctionPrototype$2.apply;
1213
+ var call$2 = FunctionPrototype$2.call;
1214
+
1215
+ // eslint-disable-next-line es-x/no-reflect -- safe
1216
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call$2.bind(apply) : function () {
1217
+ return call$2.apply(apply, arguments);
1218
+ });
1219
+
1220
+ var bind$1 = functionUncurryThis(functionUncurryThis.bind);
1221
+
1222
+ // optional / simple context binding
1223
+ var functionBindContext = function (fn, that) {
1224
+ aCallable(fn);
1225
+ return that === undefined ? fn : functionBindNative ? bind$1(fn, that) : function (/* ...args */) {
1226
+ return fn.apply(that, arguments);
1227
+ };
966
1228
  };
967
1229
 
968
1230
  var html = getBuiltIn('document', 'documentElement');
969
1231
 
970
- var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
1232
+ var arraySlice = functionUncurryThis([].slice);
1233
+
1234
+ var $TypeError$9 = TypeError;
1235
+
1236
+ var validateArgumentsLength = function (passed, required) {
1237
+ if (passed < required) throw $TypeError$9('Not enough arguments');
1238
+ return passed;
1239
+ };
971
1240
 
972
- var engineIsIos = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent);
1241
+ var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent);
973
1242
 
974
- var location = global_1.location;
975
1243
  var set$1 = global_1.setImmediate;
976
1244
  var clear = global_1.clearImmediate;
977
- var process = global_1.process;
978
- var MessageChannel = global_1.MessageChannel;
1245
+ var process$1 = global_1.process;
979
1246
  var Dispatch = global_1.Dispatch;
1247
+ var Function$1 = global_1.Function;
1248
+ var MessageChannel = global_1.MessageChannel;
1249
+ var String$1 = global_1.String;
980
1250
  var counter = 0;
981
1251
  var queue = {};
982
1252
  var ONREADYSTATECHANGE = 'onreadystatechange';
983
- var defer, channel, port;
1253
+ var location, defer, channel, port;
1254
+
1255
+ try {
1256
+ // Deno throws a ReferenceError on `location` access without `--location` flag
1257
+ location = global_1.location;
1258
+ } catch (error) { /* empty */ }
984
1259
 
985
1260
  var run = function (id) {
986
- // eslint-disable-next-line no-prototype-builtins
987
- if (queue.hasOwnProperty(id)) {
1261
+ if (hasOwnProperty_1(queue, id)) {
988
1262
  var fn = queue[id];
989
1263
  delete queue[id];
990
1264
  fn();
@@ -1003,18 +1277,17 @@ var listener = function (event) {
1003
1277
 
1004
1278
  var post = function (id) {
1005
1279
  // old engines have not location.origin
1006
- global_1.postMessage(id + '', location.protocol + '//' + location.host);
1280
+ global_1.postMessage(String$1(id), location.protocol + '//' + location.host);
1007
1281
  };
1008
1282
 
1009
1283
  // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
1010
1284
  if (!set$1 || !clear) {
1011
- set$1 = function setImmediate(fn) {
1012
- var args = [];
1013
- var i = 1;
1014
- while (arguments.length > i) args.push(arguments[i++]);
1285
+ set$1 = function setImmediate(handler) {
1286
+ validateArgumentsLength(arguments.length, 1);
1287
+ var fn = isCallable(handler) ? handler : Function$1(handler);
1288
+ var args = arraySlice(arguments, 1);
1015
1289
  queue[++counter] = function () {
1016
- // eslint-disable-next-line no-new-func
1017
- (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
1290
+ functionApply(fn, undefined, args);
1018
1291
  };
1019
1292
  defer(counter);
1020
1293
  return counter;
@@ -1023,9 +1296,9 @@ if (!set$1 || !clear) {
1023
1296
  delete queue[id];
1024
1297
  };
1025
1298
  // Node.js 0.8-
1026
- if (classofRaw(process) == 'process') {
1299
+ if (engineIsNode) {
1027
1300
  defer = function (id) {
1028
- process.nextTick(runner(id));
1301
+ process$1.nextTick(runner(id));
1029
1302
  };
1030
1303
  // Sphere (JS game engine) Dispatch API
1031
1304
  } else if (Dispatch && Dispatch.now) {
@@ -1038,10 +1311,16 @@ if (!set$1 || !clear) {
1038
1311
  channel = new MessageChannel();
1039
1312
  port = channel.port2;
1040
1313
  channel.port1.onmessage = listener;
1041
- defer = functionBindContext(port.postMessage, port, 1);
1314
+ defer = functionBindContext(port.postMessage, port);
1042
1315
  // Browsers with postMessage, skip WebWorkers
1043
1316
  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
1044
- } else if (global_1.addEventListener && typeof postMessage == 'function' && !global_1.importScripts && !fails(post)) {
1317
+ } else if (
1318
+ global_1.addEventListener &&
1319
+ isCallable(global_1.postMessage) &&
1320
+ !global_1.importScripts &&
1321
+ location && location.protocol !== 'file:' &&
1322
+ !fails(post)
1323
+ ) {
1045
1324
  defer = post;
1046
1325
  global_1.addEventListener('message', listener, false);
1047
1326
  // IE8-
@@ -1065,15 +1344,21 @@ var task = {
1065
1344
  clear: clear
1066
1345
  };
1067
1346
 
1068
- var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
1347
+ var engineIsIosPebble = /ipad|iphone|ipod/i.test(engineUserAgent) && global_1.Pebble !== undefined;
1069
1348
 
1349
+ var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent);
1350
+
1351
+ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
1070
1352
  var macrotask = task.set;
1071
1353
 
1072
1354
 
1355
+
1356
+
1357
+
1073
1358
  var MutationObserver = global_1.MutationObserver || global_1.WebKitMutationObserver;
1074
- var process$1 = global_1.process;
1359
+ var document$2 = global_1.document;
1360
+ var process$2 = global_1.process;
1075
1361
  var Promise$1 = global_1.Promise;
1076
- var IS_NODE = classofRaw(process$1) == 'process';
1077
1362
  // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
1078
1363
  var queueMicrotaskDescriptor = getOwnPropertyDescriptor$2(global_1, 'queueMicrotask');
1079
1364
  var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
@@ -1084,7 +1369,7 @@ var flush, head, last, notify, toggle, node, promise, then;
1084
1369
  if (!queueMicrotask) {
1085
1370
  flush = function () {
1086
1371
  var parent, fn;
1087
- if (IS_NODE && (parent = process$1.domain)) parent.exit();
1372
+ if (engineIsNode && (parent = process$2.domain)) parent.exit();
1088
1373
  while (head) {
1089
1374
  fn = head.fn;
1090
1375
  head = head.next;
@@ -1099,37 +1384,41 @@ if (!queueMicrotask) {
1099
1384
  if (parent) parent.enter();
1100
1385
  };
1101
1386
 
1102
- // Node.js
1103
- if (IS_NODE) {
1104
- notify = function () {
1105
- process$1.nextTick(flush);
1106
- };
1107
1387
  // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
1108
- } else if (MutationObserver && !engineIsIos) {
1388
+ // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
1389
+ if (!engineIsIos && !engineIsNode && !engineIsWebosWebkit && MutationObserver && document$2) {
1109
1390
  toggle = true;
1110
- node = document.createTextNode('');
1391
+ node = document$2.createTextNode('');
1111
1392
  new MutationObserver(flush).observe(node, { characterData: true });
1112
1393
  notify = function () {
1113
1394
  node.data = toggle = !toggle;
1114
1395
  };
1115
1396
  // environments with maybe non-completely correct, but existent Promise
1116
- } else if (Promise$1 && Promise$1.resolve) {
1397
+ } else if (!engineIsIosPebble && Promise$1 && Promise$1.resolve) {
1117
1398
  // Promise.resolve without an argument throws an error in LG WebOS 2
1118
1399
  promise = Promise$1.resolve(undefined);
1119
- then = promise.then;
1400
+ // workaround of WebKit ~ iOS Safari 10.1 bug
1401
+ promise.constructor = Promise$1;
1402
+ then = functionBindContext(promise.then, promise);
1403
+ notify = function () {
1404
+ then(flush);
1405
+ };
1406
+ // Node.js without promises
1407
+ } else if (engineIsNode) {
1120
1408
  notify = function () {
1121
- then.call(promise, flush);
1409
+ process$2.nextTick(flush);
1122
1410
  };
1123
1411
  // for other environments - macrotask based on:
1124
1412
  // - setImmediate
1125
1413
  // - MessageChannel
1126
- // - window.postMessag
1414
+ // - window.postMessage
1127
1415
  // - onreadystatechange
1128
1416
  // - setTimeout
1129
1417
  } else {
1418
+ // strange IE + webpack dev server bug - use .bind(global)
1419
+ macrotask = functionBindContext(macrotask, global_1);
1130
1420
  notify = function () {
1131
- // strange IE + webpack dev server bug - use .call(global)
1132
- macrotask.call(global_1, flush);
1421
+ macrotask(flush);
1133
1422
  };
1134
1423
  }
1135
1424
  }
@@ -1143,39 +1432,10 @@ var microtask = queueMicrotask || function (fn) {
1143
1432
  } last = task;
1144
1433
  };
1145
1434
 
1146
- var PromiseCapability = function (C) {
1147
- var resolve, reject;
1148
- this.promise = new C(function ($$resolve, $$reject) {
1149
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
1150
- resolve = $$resolve;
1151
- reject = $$reject;
1152
- });
1153
- this.resolve = aFunction$1(resolve);
1154
- this.reject = aFunction$1(reject);
1155
- };
1156
-
1157
- // 25.4.1.5 NewPromiseCapability(C)
1158
- var f$5 = function (C) {
1159
- return new PromiseCapability(C);
1160
- };
1161
-
1162
- var newPromiseCapability = {
1163
- f: f$5
1164
- };
1165
-
1166
- var promiseResolve = function (C, x) {
1167
- anObject(C);
1168
- if (isObject(x) && x.constructor === C) return x;
1169
- var promiseCapability = newPromiseCapability.f(C);
1170
- var resolve = promiseCapability.resolve;
1171
- resolve(x);
1172
- return promiseCapability.promise;
1173
- };
1174
-
1175
1435
  var hostReportErrors = function (a, b) {
1176
1436
  var console = global_1.console;
1177
1437
  if (console && console.error) {
1178
- arguments.length === 1 ? console.error(a) : console.error(a, b);
1438
+ arguments.length == 1 ? console.error(a) : console.error(a, b);
1179
1439
  }
1180
1440
  };
1181
1441
 
@@ -1187,26 +1447,91 @@ var perform = function (exec) {
1187
1447
  }
1188
1448
  };
1189
1449
 
1190
- var process$2 = global_1.process;
1191
- var versions = process$2 && process$2.versions;
1192
- var v8 = versions && versions.v8;
1193
- var match, version;
1450
+ var Queue = function () {
1451
+ this.head = null;
1452
+ this.tail = null;
1453
+ };
1194
1454
 
1195
- if (v8) {
1196
- match = v8.split('.');
1197
- version = match[0] + match[1];
1198
- } else if (engineUserAgent) {
1199
- match = engineUserAgent.match(/Edge\/(\d+)/);
1200
- if (!match || match[1] >= 74) {
1201
- match = engineUserAgent.match(/Chrome\/(\d+)/);
1202
- if (match) version = match[1];
1455
+ Queue.prototype = {
1456
+ add: function (item) {
1457
+ var entry = { item: item, next: null };
1458
+ if (this.head) this.tail.next = entry;
1459
+ else this.head = entry;
1460
+ this.tail = entry;
1461
+ },
1462
+ get: function () {
1463
+ var entry = this.head;
1464
+ if (entry) {
1465
+ this.head = entry.next;
1466
+ if (this.tail === entry) this.tail = null;
1467
+ return entry.item;
1468
+ }
1203
1469
  }
1204
- }
1470
+ };
1205
1471
 
1206
- var engineV8Version = version && +version;
1472
+ var queue$1 = Queue;
1207
1473
 
1208
- var task$1 = task.set;
1474
+ var promiseNativeConstructor = global_1.Promise;
1475
+
1476
+ var engineIsBrowser = typeof window == 'object' && typeof Deno != 'object';
1477
+
1478
+ var NativePromisePrototype = promiseNativeConstructor && promiseNativeConstructor.prototype;
1479
+ var SPECIES$2 = wellKnownSymbol('species');
1480
+ var SUBCLASSING = false;
1481
+ var NATIVE_PROMISE_REJECTION_EVENT = isCallable(global_1.PromiseRejectionEvent);
1482
+
1483
+ var FORCED_PROMISE_CONSTRUCTOR = isForced_1('Promise', function () {
1484
+ var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(promiseNativeConstructor);
1485
+ var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(promiseNativeConstructor);
1486
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
1487
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
1488
+ // We can't detect it synchronously, so just check versions
1489
+ if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) return true;
1490
+ // We can't use @@species feature detection in V8 since it causes
1491
+ // deoptimization and performance degradation
1492
+ // https://github.com/zloirock/core-js/issues/679
1493
+ if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
1494
+ // Detect correctness of subclassing with @@species support
1495
+ var promise = new promiseNativeConstructor(function (resolve) { resolve(1); });
1496
+ var FakePromise = function (exec) {
1497
+ exec(function () { /* empty */ }, function () { /* empty */ });
1498
+ };
1499
+ var constructor = promise.constructor = {};
1500
+ constructor[SPECIES$2] = FakePromise;
1501
+ SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
1502
+ if (!SUBCLASSING) return true;
1503
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
1504
+ return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_PROMISE_REJECTION_EVENT;
1505
+ });
1506
+
1507
+ var promiseConstructorDetection = {
1508
+ CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,
1509
+ REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,
1510
+ SUBCLASSING: SUBCLASSING
1511
+ };
1512
+
1513
+ var PromiseCapability = function (C) {
1514
+ var resolve, reject;
1515
+ this.promise = new C(function ($$resolve, $$reject) {
1516
+ if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
1517
+ resolve = $$resolve;
1518
+ reject = $$reject;
1519
+ });
1520
+ this.resolve = aCallable(resolve);
1521
+ this.reject = aCallable(reject);
1522
+ };
1523
+
1524
+ // `NewPromiseCapability` abstract operation
1525
+ // https://tc39.es/ecma262/#sec-newpromisecapability
1526
+ var f$5 = function (C) {
1527
+ return new PromiseCapability(C);
1528
+ };
1209
1529
 
1530
+ var newPromiseCapability = {
1531
+ f: f$5
1532
+ };
1533
+
1534
+ var task$1 = task.set;
1210
1535
 
1211
1536
 
1212
1537
 
@@ -1216,20 +1541,22 @@ var task$1 = task.set;
1216
1541
 
1217
1542
 
1218
1543
 
1219
- var SPECIES$2 = wellKnownSymbol('species');
1220
1544
  var PROMISE = 'Promise';
1221
- var getInternalState = internalState.get;
1222
- var setInternalState = internalState.set;
1545
+ var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
1546
+ var NATIVE_PROMISE_REJECTION_EVENT$1 = promiseConstructorDetection.REJECTION_EVENT;
1547
+ var NATIVE_PROMISE_SUBCLASSING = promiseConstructorDetection.SUBCLASSING;
1223
1548
  var getInternalPromiseState = internalState.getterFor(PROMISE);
1224
- var PromiseConstructor = nativePromiseConstructor;
1225
- var TypeError$1 = global_1.TypeError;
1226
- var document$2 = global_1.document;
1549
+ var setInternalState = internalState.set;
1550
+ var NativePromisePrototype$1 = promiseNativeConstructor && promiseNativeConstructor.prototype;
1551
+ var PromiseConstructor = promiseNativeConstructor;
1552
+ var PromisePrototype = NativePromisePrototype$1;
1553
+ var TypeError$2 = global_1.TypeError;
1554
+ var document$3 = global_1.document;
1227
1555
  var process$3 = global_1.process;
1228
- var $fetch = getBuiltIn('fetch');
1229
1556
  var newPromiseCapability$1 = newPromiseCapability.f;
1230
1557
  var newGenericPromiseCapability = newPromiseCapability$1;
1231
- var IS_NODE$1 = classofRaw(process$3) == 'process';
1232
- var DISPATCH_EVENT = !!(document$2 && document$2.createEvent && global_1.dispatchEvent);
1558
+
1559
+ var DISPATCH_EVENT = !!(document$3 && document$3.createEvent && global_1.dispatchEvent);
1233
1560
  var UNHANDLED_REJECTION = 'unhandledrejection';
1234
1561
  var REJECTION_HANDLED = 'rejectionhandled';
1235
1562
  var PENDING = 0;
@@ -1237,116 +1564,91 @@ var FULFILLED = 1;
1237
1564
  var REJECTED = 2;
1238
1565
  var HANDLED = 1;
1239
1566
  var UNHANDLED = 2;
1240
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
1241
-
1242
- var FORCED = isForced_1(PROMISE, function () {
1243
- var GLOBAL_CORE_JS_PROMISE = inspectSource(PromiseConstructor) !== String(PromiseConstructor);
1244
- if (!GLOBAL_CORE_JS_PROMISE) {
1245
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
1246
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
1247
- // We can't detect it synchronously, so just check versions
1248
- if (engineV8Version === 66) return true;
1249
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
1250
- if (!IS_NODE$1 && typeof PromiseRejectionEvent != 'function') return true;
1251
- }
1252
- // We can't use @@species feature detection in V8 since it causes
1253
- // deoptimization and performance degradation
1254
- // https://github.com/zloirock/core-js/issues/679
1255
- if (engineV8Version >= 51 && /native code/.test(PromiseConstructor)) return false;
1256
- // Detect correctness of subclassing with @@species support
1257
- var promise = PromiseConstructor.resolve(1);
1258
- var FakePromise = function (exec) {
1259
- exec(function () { /* empty */ }, function () { /* empty */ });
1260
- };
1261
- var constructor = promise.constructor = {};
1262
- constructor[SPECIES$2] = FakePromise;
1263
- return !(promise.then(function () { /* empty */ }) instanceof FakePromise);
1264
- });
1265
1567
 
1266
- var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
1267
- PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
1268
- });
1568
+ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
1269
1569
 
1270
1570
  // helpers
1271
1571
  var isThenable = function (it) {
1272
1572
  var then;
1273
- return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
1573
+ return isObject(it) && isCallable(then = it.then) ? then : false;
1274
1574
  };
1275
1575
 
1276
- var notify$1 = function (promise, state, isReject) {
1576
+ var callReaction = function (reaction, state) {
1577
+ var value = state.value;
1578
+ var ok = state.state == FULFILLED;
1579
+ var handler = ok ? reaction.ok : reaction.fail;
1580
+ var resolve = reaction.resolve;
1581
+ var reject = reaction.reject;
1582
+ var domain = reaction.domain;
1583
+ var result, then, exited;
1584
+ try {
1585
+ if (handler) {
1586
+ if (!ok) {
1587
+ if (state.rejection === UNHANDLED) onHandleUnhandled(state);
1588
+ state.rejection = HANDLED;
1589
+ }
1590
+ if (handler === true) result = value;
1591
+ else {
1592
+ if (domain) domain.enter();
1593
+ result = handler(value); // can throw
1594
+ if (domain) {
1595
+ domain.exit();
1596
+ exited = true;
1597
+ }
1598
+ }
1599
+ if (result === reaction.promise) {
1600
+ reject(TypeError$2('Promise-chain cycle'));
1601
+ } else if (then = isThenable(result)) {
1602
+ functionCall(then, result, resolve, reject);
1603
+ } else resolve(result);
1604
+ } else reject(value);
1605
+ } catch (error) {
1606
+ if (domain && !exited) domain.exit();
1607
+ reject(error);
1608
+ }
1609
+ };
1610
+
1611
+ var notify$1 = function (state, isReject) {
1277
1612
  if (state.notified) return;
1278
1613
  state.notified = true;
1279
- var chain = state.reactions;
1280
1614
  microtask(function () {
1281
- var value = state.value;
1282
- var ok = state.state == FULFILLED;
1283
- var index = 0;
1284
- // variable length - can't use forEach
1285
- while (chain.length > index) {
1286
- var reaction = chain[index++];
1287
- var handler = ok ? reaction.ok : reaction.fail;
1288
- var resolve = reaction.resolve;
1289
- var reject = reaction.reject;
1290
- var domain = reaction.domain;
1291
- var result, then, exited;
1292
- try {
1293
- if (handler) {
1294
- if (!ok) {
1295
- if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);
1296
- state.rejection = HANDLED;
1297
- }
1298
- if (handler === true) result = value;
1299
- else {
1300
- if (domain) domain.enter();
1301
- result = handler(value); // can throw
1302
- if (domain) {
1303
- domain.exit();
1304
- exited = true;
1305
- }
1306
- }
1307
- if (result === reaction.promise) {
1308
- reject(TypeError$1('Promise-chain cycle'));
1309
- } else if (then = isThenable(result)) {
1310
- then.call(result, resolve, reject);
1311
- } else resolve(result);
1312
- } else reject(value);
1313
- } catch (error) {
1314
- if (domain && !exited) domain.exit();
1315
- reject(error);
1316
- }
1615
+ var reactions = state.reactions;
1616
+ var reaction;
1617
+ while (reaction = reactions.get()) {
1618
+ callReaction(reaction, state);
1317
1619
  }
1318
- state.reactions = [];
1319
1620
  state.notified = false;
1320
- if (isReject && !state.rejection) onUnhandled(promise, state);
1621
+ if (isReject && !state.rejection) onUnhandled(state);
1321
1622
  });
1322
1623
  };
1323
1624
 
1324
1625
  var dispatchEvent = function (name, promise, reason) {
1325
1626
  var event, handler;
1326
1627
  if (DISPATCH_EVENT) {
1327
- event = document$2.createEvent('Event');
1628
+ event = document$3.createEvent('Event');
1328
1629
  event.promise = promise;
1329
1630
  event.reason = reason;
1330
1631
  event.initEvent(name, false, true);
1331
1632
  global_1.dispatchEvent(event);
1332
1633
  } else event = { promise: promise, reason: reason };
1333
- if (handler = global_1['on' + name]) handler(event);
1634
+ if (!NATIVE_PROMISE_REJECTION_EVENT$1 && (handler = global_1['on' + name])) handler(event);
1334
1635
  else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
1335
1636
  };
1336
1637
 
1337
- var onUnhandled = function (promise, state) {
1338
- task$1.call(global_1, function () {
1638
+ var onUnhandled = function (state) {
1639
+ functionCall(task$1, global_1, function () {
1640
+ var promise = state.facade;
1339
1641
  var value = state.value;
1340
1642
  var IS_UNHANDLED = isUnhandled(state);
1341
1643
  var result;
1342
1644
  if (IS_UNHANDLED) {
1343
1645
  result = perform(function () {
1344
- if (IS_NODE$1) {
1646
+ if (engineIsNode) {
1345
1647
  process$3.emit('unhandledRejection', value, promise);
1346
1648
  } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
1347
1649
  });
1348
1650
  // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
1349
- state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;
1651
+ state.rejection = engineIsNode || isUnhandled(state) ? UNHANDLED : HANDLED;
1350
1652
  if (result.error) throw result.value;
1351
1653
  }
1352
1654
  });
@@ -1356,187 +1658,315 @@ var isUnhandled = function (state) {
1356
1658
  return state.rejection !== HANDLED && !state.parent;
1357
1659
  };
1358
1660
 
1359
- var onHandleUnhandled = function (promise, state) {
1360
- task$1.call(global_1, function () {
1361
- if (IS_NODE$1) {
1661
+ var onHandleUnhandled = function (state) {
1662
+ functionCall(task$1, global_1, function () {
1663
+ var promise = state.facade;
1664
+ if (engineIsNode) {
1362
1665
  process$3.emit('rejectionHandled', promise);
1363
1666
  } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
1364
1667
  });
1365
1668
  };
1366
1669
 
1367
- var bind = function (fn, promise, state, unwrap) {
1670
+ var bind$2 = function (fn, state, unwrap) {
1368
1671
  return function (value) {
1369
- fn(promise, state, value, unwrap);
1672
+ fn(state, value, unwrap);
1370
1673
  };
1371
1674
  };
1372
1675
 
1373
- var internalReject = function (promise, state, value, unwrap) {
1676
+ var internalReject = function (state, value, unwrap) {
1374
1677
  if (state.done) return;
1375
1678
  state.done = true;
1376
1679
  if (unwrap) state = unwrap;
1377
1680
  state.value = value;
1378
1681
  state.state = REJECTED;
1379
- notify$1(promise, state, true);
1682
+ notify$1(state, true);
1380
1683
  };
1381
1684
 
1382
- var internalResolve = function (promise, state, value, unwrap) {
1685
+ var internalResolve = function (state, value, unwrap) {
1383
1686
  if (state.done) return;
1384
1687
  state.done = true;
1385
1688
  if (unwrap) state = unwrap;
1386
1689
  try {
1387
- if (promise === value) throw TypeError$1("Promise can't be resolved itself");
1690
+ if (state.facade === value) throw TypeError$2("Promise can't be resolved itself");
1388
1691
  var then = isThenable(value);
1389
1692
  if (then) {
1390
1693
  microtask(function () {
1391
1694
  var wrapper = { done: false };
1392
1695
  try {
1393
- then.call(value,
1394
- bind(internalResolve, promise, wrapper, state),
1395
- bind(internalReject, promise, wrapper, state)
1696
+ functionCall(then, value,
1697
+ bind$2(internalResolve, wrapper, state),
1698
+ bind$2(internalReject, wrapper, state)
1396
1699
  );
1397
1700
  } catch (error) {
1398
- internalReject(promise, wrapper, error, state);
1701
+ internalReject(wrapper, error, state);
1399
1702
  }
1400
1703
  });
1401
1704
  } else {
1402
1705
  state.value = value;
1403
1706
  state.state = FULFILLED;
1404
- notify$1(promise, state, false);
1707
+ notify$1(state, false);
1405
1708
  }
1406
1709
  } catch (error) {
1407
- internalReject(promise, { done: false }, error, state);
1710
+ internalReject({ done: false }, error, state);
1408
1711
  }
1409
1712
  };
1410
1713
 
1411
1714
  // constructor polyfill
1412
- if (FORCED) {
1715
+ if (FORCED_PROMISE_CONSTRUCTOR$1) {
1413
1716
  // 25.4.3.1 Promise(executor)
1414
1717
  PromiseConstructor = function Promise(executor) {
1415
- anInstance(this, PromiseConstructor, PROMISE);
1416
- aFunction$1(executor);
1417
- Internal.call(this);
1418
- var state = getInternalState(this);
1718
+ anInstance(this, PromisePrototype);
1719
+ aCallable(executor);
1720
+ functionCall(Internal, this);
1721
+ var state = getInternalPromiseState(this);
1419
1722
  try {
1420
- executor(bind(internalResolve, this, state), bind(internalReject, this, state));
1723
+ executor(bind$2(internalResolve, state), bind$2(internalReject, state));
1421
1724
  } catch (error) {
1422
- internalReject(this, state, error);
1725
+ internalReject(state, error);
1423
1726
  }
1424
1727
  };
1425
- // eslint-disable-next-line no-unused-vars
1728
+
1729
+ PromisePrototype = PromiseConstructor.prototype;
1730
+
1731
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
1426
1732
  Internal = function Promise(executor) {
1427
1733
  setInternalState(this, {
1428
1734
  type: PROMISE,
1429
1735
  done: false,
1430
1736
  notified: false,
1431
1737
  parent: false,
1432
- reactions: [],
1738
+ reactions: new queue$1(),
1433
1739
  rejection: false,
1434
1740
  state: PENDING,
1435
1741
  value: undefined
1436
1742
  });
1437
1743
  };
1438
- Internal.prototype = redefineAll(PromiseConstructor.prototype, {
1439
- // `Promise.prototype.then` method
1440
- // https://tc39.github.io/ecma262/#sec-promise.prototype.then
1441
- then: function then(onFulfilled, onRejected) {
1442
- var state = getInternalPromiseState(this);
1443
- var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
1444
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
1445
- reaction.fail = typeof onRejected == 'function' && onRejected;
1446
- reaction.domain = IS_NODE$1 ? process$3.domain : undefined;
1447
- state.parent = true;
1448
- state.reactions.push(reaction);
1449
- if (state.state != PENDING) notify$1(this, state, false);
1450
- return reaction.promise;
1451
- },
1452
- // `Promise.prototype.catch` method
1453
- // https://tc39.github.io/ecma262/#sec-promise.prototype.catch
1454
- 'catch': function (onRejected) {
1455
- return this.then(undefined, onRejected);
1456
- }
1744
+
1745
+ // `Promise.prototype.then` method
1746
+ // https://tc39.es/ecma262/#sec-promise.prototype.then
1747
+ Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
1748
+ var state = getInternalPromiseState(this);
1749
+ var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
1750
+ state.parent = true;
1751
+ reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
1752
+ reaction.fail = isCallable(onRejected) && onRejected;
1753
+ reaction.domain = engineIsNode ? process$3.domain : undefined;
1754
+ if (state.state == PENDING) state.reactions.add(reaction);
1755
+ else microtask(function () {
1756
+ callReaction(reaction, state);
1757
+ });
1758
+ return reaction.promise;
1457
1759
  });
1760
+
1458
1761
  OwnPromiseCapability = function () {
1459
1762
  var promise = new Internal();
1460
- var state = getInternalState(promise);
1763
+ var state = getInternalPromiseState(promise);
1461
1764
  this.promise = promise;
1462
- this.resolve = bind(internalResolve, promise, state);
1463
- this.reject = bind(internalReject, promise, state);
1765
+ this.resolve = bind$2(internalResolve, state);
1766
+ this.reject = bind$2(internalReject, state);
1464
1767
  };
1768
+
1465
1769
  newPromiseCapability.f = newPromiseCapability$1 = function (C) {
1466
1770
  return C === PromiseConstructor || C === PromiseWrapper
1467
1771
  ? new OwnPromiseCapability(C)
1468
1772
  : newGenericPromiseCapability(C);
1469
1773
  };
1470
1774
 
1471
- if ( typeof nativePromiseConstructor == 'function') {
1472
- nativeThen = nativePromiseConstructor.prototype.then;
1473
-
1474
- // wrap native Promise#then for native async functions
1475
- redefine(nativePromiseConstructor.prototype, 'then', function then(onFulfilled, onRejected) {
1476
- var that = this;
1477
- return new PromiseConstructor(function (resolve, reject) {
1478
- nativeThen.call(that, resolve, reject);
1479
- }).then(onFulfilled, onRejected);
1480
- // https://github.com/zloirock/core-js/issues/640
1481
- }, { unsafe: true });
1482
-
1483
- // wrap fetch result
1484
- if (typeof $fetch == 'function') _export({ global: true, enumerable: true, forced: true }, {
1485
- // eslint-disable-next-line no-unused-vars
1486
- fetch: function fetch(input /* , init */) {
1487
- return promiseResolve(PromiseConstructor, $fetch.apply(global_1, arguments));
1488
- }
1489
- });
1775
+ if ( isCallable(promiseNativeConstructor) && NativePromisePrototype$1 !== Object.prototype) {
1776
+ nativeThen = NativePromisePrototype$1.then;
1777
+
1778
+ if (!NATIVE_PROMISE_SUBCLASSING) {
1779
+ // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
1780
+ defineBuiltIn(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
1781
+ var that = this;
1782
+ return new PromiseConstructor(function (resolve, reject) {
1783
+ functionCall(nativeThen, that, resolve, reject);
1784
+ }).then(onFulfilled, onRejected);
1785
+ // https://github.com/zloirock/core-js/issues/640
1786
+ }, { unsafe: true });
1787
+ }
1788
+
1789
+ // make `.constructor === Promise` work for native promise-based APIs
1790
+ try {
1791
+ delete NativePromisePrototype$1.constructor;
1792
+ } catch (error) { /* empty */ }
1793
+
1794
+ // make `instanceof Promise` work for native promise-based APIs
1795
+ if (objectSetPrototypeOf) {
1796
+ objectSetPrototypeOf(NativePromisePrototype$1, PromisePrototype);
1797
+ }
1490
1798
  }
1491
1799
  }
1492
1800
 
1493
- _export({ global: true, wrap: true, forced: FORCED }, {
1801
+ _export({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
1494
1802
  Promise: PromiseConstructor
1495
1803
  });
1496
1804
 
1497
1805
  setToStringTag(PromiseConstructor, PROMISE, false);
1498
1806
  setSpecies(PROMISE);
1499
1807
 
1500
- PromiseWrapper = getBuiltIn(PROMISE);
1808
+ var iterators = {};
1501
1809
 
1502
- // statics
1503
- _export({ target: PROMISE, stat: true, forced: FORCED }, {
1504
- // `Promise.reject` method
1505
- // https://tc39.github.io/ecma262/#sec-promise.reject
1506
- reject: function reject(r) {
1507
- var capability = newPromiseCapability$1(this);
1508
- capability.reject.call(undefined, r);
1509
- return capability.promise;
1810
+ var ITERATOR = wellKnownSymbol('iterator');
1811
+ var ArrayPrototype = Array.prototype;
1812
+
1813
+ // check on default Array iterator
1814
+ var isArrayIteratorMethod = function (it) {
1815
+ return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR] === it);
1816
+ };
1817
+
1818
+ var ITERATOR$1 = wellKnownSymbol('iterator');
1819
+
1820
+ var getIteratorMethod = function (it) {
1821
+ if (it != undefined) return getMethod(it, ITERATOR$1)
1822
+ || getMethod(it, '@@iterator')
1823
+ || iterators[classof(it)];
1824
+ };
1825
+
1826
+ var $TypeError$a = TypeError;
1827
+
1828
+ var getIterator = function (argument, usingIterator) {
1829
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
1830
+ if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
1831
+ throw $TypeError$a(tryToString(argument) + ' is not iterable');
1832
+ };
1833
+
1834
+ var iteratorClose = function (iterator, kind, value) {
1835
+ var innerResult, innerError;
1836
+ anObject(iterator);
1837
+ try {
1838
+ innerResult = getMethod(iterator, 'return');
1839
+ if (!innerResult) {
1840
+ if (kind === 'throw') throw value;
1841
+ return value;
1842
+ }
1843
+ innerResult = functionCall(innerResult, iterator);
1844
+ } catch (error) {
1845
+ innerError = true;
1846
+ innerResult = error;
1510
1847
  }
1511
- });
1848
+ if (kind === 'throw') throw value;
1849
+ if (innerError) throw innerResult;
1850
+ anObject(innerResult);
1851
+ return value;
1852
+ };
1512
1853
 
1513
- _export({ target: PROMISE, stat: true, forced: FORCED }, {
1514
- // `Promise.resolve` method
1515
- // https://tc39.github.io/ecma262/#sec-promise.resolve
1516
- resolve: function resolve(x) {
1517
- return promiseResolve( this, x);
1854
+ var $TypeError$b = TypeError;
1855
+
1856
+ var Result = function (stopped, result) {
1857
+ this.stopped = stopped;
1858
+ this.result = result;
1859
+ };
1860
+
1861
+ var ResultPrototype = Result.prototype;
1862
+
1863
+ var iterate = function (iterable, unboundFunction, options) {
1864
+ var that = options && options.that;
1865
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1866
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1867
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
1868
+ var fn = functionBindContext(unboundFunction, that);
1869
+ var iterator, iterFn, index, length, result, next, step;
1870
+
1871
+ var stop = function (condition) {
1872
+ if (iterator) iteratorClose(iterator, 'normal', condition);
1873
+ return new Result(true, condition);
1874
+ };
1875
+
1876
+ var callFn = function (value) {
1877
+ if (AS_ENTRIES) {
1878
+ anObject(value);
1879
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1880
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
1881
+ };
1882
+
1883
+ if (IS_ITERATOR) {
1884
+ iterator = iterable;
1885
+ } else {
1886
+ iterFn = getIteratorMethod(iterable);
1887
+ if (!iterFn) throw $TypeError$b(tryToString(iterable) + ' is not iterable');
1888
+ // optimisation for array iterators
1889
+ if (isArrayIteratorMethod(iterFn)) {
1890
+ for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
1891
+ result = callFn(iterable[index]);
1892
+ if (result && objectIsPrototypeOf(ResultPrototype, result)) return result;
1893
+ } return new Result(false);
1894
+ }
1895
+ iterator = getIterator(iterable, iterFn);
1518
1896
  }
1897
+
1898
+ next = iterator.next;
1899
+ while (!(step = functionCall(next, iterator)).done) {
1900
+ try {
1901
+ result = callFn(step.value);
1902
+ } catch (error) {
1903
+ iteratorClose(iterator, 'throw', error);
1904
+ }
1905
+ if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result;
1906
+ } return new Result(false);
1907
+ };
1908
+
1909
+ var ITERATOR$2 = wellKnownSymbol('iterator');
1910
+ var SAFE_CLOSING = false;
1911
+
1912
+ try {
1913
+ var called = 0;
1914
+ var iteratorWithReturn = {
1915
+ next: function () {
1916
+ return { done: !!called++ };
1917
+ },
1918
+ 'return': function () {
1919
+ SAFE_CLOSING = true;
1920
+ }
1921
+ };
1922
+ iteratorWithReturn[ITERATOR$2] = function () {
1923
+ return this;
1924
+ };
1925
+ // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
1926
+ Array.from(iteratorWithReturn, function () { throw 2; });
1927
+ } catch (error) { /* empty */ }
1928
+
1929
+ var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
1930
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
1931
+ var ITERATION_SUPPORT = false;
1932
+ try {
1933
+ var object = {};
1934
+ object[ITERATOR$2] = function () {
1935
+ return {
1936
+ next: function () {
1937
+ return { done: ITERATION_SUPPORT = true };
1938
+ }
1939
+ };
1940
+ };
1941
+ exec(object);
1942
+ } catch (error) { /* empty */ }
1943
+ return ITERATION_SUPPORT;
1944
+ };
1945
+
1946
+ var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
1947
+
1948
+ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$2 || !checkCorrectnessOfIteration(function (iterable) {
1949
+ promiseNativeConstructor.all(iterable).then(undefined, function () { /* empty */ });
1519
1950
  });
1520
1951
 
1521
- _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
1522
- // `Promise.all` method
1523
- // https://tc39.github.io/ecma262/#sec-promise.all
1952
+ // `Promise.all` method
1953
+ // https://tc39.es/ecma262/#sec-promise.all
1954
+ _export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, {
1524
1955
  all: function all(iterable) {
1525
1956
  var C = this;
1526
- var capability = newPromiseCapability$1(C);
1957
+ var capability = newPromiseCapability.f(C);
1527
1958
  var resolve = capability.resolve;
1528
1959
  var reject = capability.reject;
1529
1960
  var result = perform(function () {
1530
- var $promiseResolve = aFunction$1(C.resolve);
1961
+ var $promiseResolve = aCallable(C.resolve);
1531
1962
  var values = [];
1532
1963
  var counter = 0;
1533
1964
  var remaining = 1;
1534
- iterate_1(iterable, function (promise) {
1965
+ iterate(iterable, function (promise) {
1535
1966
  var index = counter++;
1536
1967
  var alreadyCalled = false;
1537
- values.push(undefined);
1538
1968
  remaining++;
1539
- $promiseResolve.call(C, promise).then(function (value) {
1969
+ functionCall($promiseResolve, C, promise).then(function (value) {
1540
1970
  if (alreadyCalled) return;
1541
1971
  alreadyCalled = true;
1542
1972
  values[index] = value;
@@ -1547,17 +1977,44 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
1547
1977
  });
1548
1978
  if (result.error) reject(result.value);
1549
1979
  return capability.promise;
1550
- },
1551
- // `Promise.race` method
1552
- // https://tc39.github.io/ecma262/#sec-promise.race
1980
+ }
1981
+ });
1982
+
1983
+ var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
1984
+
1985
+
1986
+
1987
+
1988
+
1989
+ var NativePromisePrototype$2 = promiseNativeConstructor && promiseNativeConstructor.prototype;
1990
+
1991
+ // `Promise.prototype.catch` method
1992
+ // https://tc39.es/ecma262/#sec-promise.prototype.catch
1993
+ _export({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$3, real: true }, {
1994
+ 'catch': function (onRejected) {
1995
+ return this.then(undefined, onRejected);
1996
+ }
1997
+ });
1998
+
1999
+ // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
2000
+ if ( isCallable(promiseNativeConstructor)) {
2001
+ var method = getBuiltIn('Promise').prototype['catch'];
2002
+ if (NativePromisePrototype$2['catch'] !== method) {
2003
+ defineBuiltIn(NativePromisePrototype$2, 'catch', method, { unsafe: true });
2004
+ }
2005
+ }
2006
+
2007
+ // `Promise.race` method
2008
+ // https://tc39.es/ecma262/#sec-promise.race
2009
+ _export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, {
1553
2010
  race: function race(iterable) {
1554
2011
  var C = this;
1555
- var capability = newPromiseCapability$1(C);
2012
+ var capability = newPromiseCapability.f(C);
1556
2013
  var reject = capability.reject;
1557
2014
  var result = perform(function () {
1558
- var $promiseResolve = aFunction$1(C.resolve);
1559
- iterate_1(iterable, function (promise) {
1560
- $promiseResolve.call(C, promise).then(capability.resolve, reject);
2015
+ var $promiseResolve = aCallable(C.resolve);
2016
+ iterate(iterable, function (promise) {
2017
+ functionCall($promiseResolve, C, promise).then(capability.resolve, reject);
1561
2018
  });
1562
2019
  });
1563
2020
  if (result.error) reject(result.value);
@@ -1565,6 +2022,40 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
1565
2022
  }
1566
2023
  });
1567
2024
 
2025
+ var FORCED_PROMISE_CONSTRUCTOR$4 = promiseConstructorDetection.CONSTRUCTOR;
2026
+
2027
+ // `Promise.reject` method
2028
+ // https://tc39.es/ecma262/#sec-promise.reject
2029
+ _export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
2030
+ reject: function reject(r) {
2031
+ var capability = newPromiseCapability.f(this);
2032
+ functionCall(capability.reject, undefined, r);
2033
+ return capability.promise;
2034
+ }
2035
+ });
2036
+
2037
+ var promiseResolve = function (C, x) {
2038
+ anObject(C);
2039
+ if (isObject(x) && x.constructor === C) return x;
2040
+ var promiseCapability = newPromiseCapability.f(C);
2041
+ var resolve = promiseCapability.resolve;
2042
+ resolve(x);
2043
+ return promiseCapability.promise;
2044
+ };
2045
+
2046
+ var FORCED_PROMISE_CONSTRUCTOR$5 = promiseConstructorDetection.CONSTRUCTOR;
2047
+
2048
+
2049
+ var PromiseConstructorWrapper = getBuiltIn('Promise');
2050
+
2051
+ // `Promise.resolve` method
2052
+ // https://tc39.es/ecma262/#sec-promise.resolve
2053
+ _export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$5 }, {
2054
+ resolve: function resolve(x) {
2055
+ return promiseResolve( this, x);
2056
+ }
2057
+ });
2058
+
1568
2059
  var STATUS = {
1569
2060
  SUCCESS: 'SUCCESS',
1570
2061
  ERROR_PUBLISHABLE_KEY: 'ERROR_PUBLISHABLE_KEY',
@@ -1625,32 +2116,48 @@ var Navigator = /*#__PURE__*/function () {
1625
2116
  }();
1626
2117
 
1627
2118
  // `IsArray` abstract operation
1628
- // https://tc39.github.io/ecma262/#sec-isarray
1629
- var isArray = Array.isArray || function isArray(arg) {
1630
- return classofRaw(arg) == 'Array';
2119
+ // https://tc39.es/ecma262/#sec-isarray
2120
+ // eslint-disable-next-line es-x/no-array-isarray -- safe
2121
+ var isArray = Array.isArray || function isArray(argument) {
2122
+ return classofRaw(argument) == 'Array';
2123
+ };
2124
+
2125
+ var $TypeError$c = TypeError;
2126
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
2127
+
2128
+ var doesNotExceedSafeInteger = function (it) {
2129
+ if (it > MAX_SAFE_INTEGER) throw $TypeError$c('Maximum allowed index exceeded');
2130
+ return it;
1631
2131
  };
1632
2132
 
1633
2133
  var createProperty = function (object, key, value) {
1634
- var propertyKey = toPrimitive(key);
2134
+ var propertyKey = toPropertyKey(key);
1635
2135
  if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
1636
2136
  else object[propertyKey] = value;
1637
2137
  };
1638
2138
 
1639
2139
  var SPECIES$3 = wellKnownSymbol('species');
2140
+ var $Array = Array;
1640
2141
 
1641
- // `ArraySpeciesCreate` abstract operation
1642
- // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
1643
- var arraySpeciesCreate = function (originalArray, length) {
2142
+ // a part of `ArraySpeciesCreate` abstract operation
2143
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
2144
+ var arraySpeciesConstructor = function (originalArray) {
1644
2145
  var C;
1645
2146
  if (isArray(originalArray)) {
1646
2147
  C = originalArray.constructor;
1647
2148
  // cross-realm fallback
1648
- if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
2149
+ if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;
1649
2150
  else if (isObject(C)) {
1650
2151
  C = C[SPECIES$3];
1651
2152
  if (C === null) C = undefined;
1652
2153
  }
1653
- } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
2154
+ } return C === undefined ? $Array : C;
2155
+ };
2156
+
2157
+ // `ArraySpeciesCreate` abstract operation
2158
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
2159
+ var arraySpeciesCreate = function (originalArray, length) {
2160
+ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
1654
2161
  };
1655
2162
 
1656
2163
  var SPECIES$4 = wellKnownSymbol('species');
@@ -1670,8 +2177,6 @@ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
1670
2177
  };
1671
2178
 
1672
2179
  var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
1673
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
1674
- var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
1675
2180
 
1676
2181
  // We can't use this feature detection in V8 since it causes
1677
2182
  // deoptimization and serious performance degradation
@@ -1690,13 +2195,14 @@ var isConcatSpreadable = function (O) {
1690
2195
  return spreadable !== undefined ? !!spreadable : isArray(O);
1691
2196
  };
1692
2197
 
1693
- var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
2198
+ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1694
2199
 
1695
2200
  // `Array.prototype.concat` method
1696
- // https://tc39.github.io/ecma262/#sec-array.prototype.concat
2201
+ // https://tc39.es/ecma262/#sec-array.prototype.concat
1697
2202
  // with adding support of @@isConcatSpreadable and @@species
1698
- _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
1699
- concat: function concat(arg) { // eslint-disable-line no-unused-vars
2203
+ _export({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
2204
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
2205
+ concat: function concat(arg) {
1700
2206
  var O = toObject(this);
1701
2207
  var A = arraySpeciesCreate(O, 0);
1702
2208
  var n = 0;
@@ -1704,11 +2210,11 @@ _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
1704
2210
  for (i = -1, length = arguments.length; i < length; i++) {
1705
2211
  E = i === -1 ? O : arguments[i];
1706
2212
  if (isConcatSpreadable(E)) {
1707
- len = toLength(E.length);
1708
- if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
2213
+ len = lengthOfArrayLike(E);
2214
+ doesNotExceedSafeInteger(n + len);
1709
2215
  for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1710
2216
  } else {
1711
- if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
2217
+ doesNotExceedSafeInteger(n + 1);
1712
2218
  createProperty(A, n++, E);
1713
2219
  }
1714
2220
  }
@@ -2448,24 +2954,25 @@ try {
2448
2954
  }
2449
2955
  });
2450
2956
 
2451
- var push = [].push;
2957
+ var push$1 = functionUncurryThis([].push);
2452
2958
 
2453
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
2959
+ // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
2454
2960
  var createMethod$2 = function (TYPE) {
2455
2961
  var IS_MAP = TYPE == 1;
2456
2962
  var IS_FILTER = TYPE == 2;
2457
2963
  var IS_SOME = TYPE == 3;
2458
2964
  var IS_EVERY = TYPE == 4;
2459
2965
  var IS_FIND_INDEX = TYPE == 6;
2966
+ var IS_FILTER_REJECT = TYPE == 7;
2460
2967
  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
2461
2968
  return function ($this, callbackfn, that, specificCreate) {
2462
2969
  var O = toObject($this);
2463
2970
  var self = indexedObject(O);
2464
- var boundFunction = functionBindContext(callbackfn, that, 3);
2465
- var length = toLength(self.length);
2971
+ var boundFunction = functionBindContext(callbackfn, that);
2972
+ var length = lengthOfArrayLike(self);
2466
2973
  var index = 0;
2467
2974
  var create = specificCreate || arraySpeciesCreate;
2468
- var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
2975
+ var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
2469
2976
  var value, result;
2470
2977
  for (;length > index; index++) if (NO_HOLES || index in self) {
2471
2978
  value = self[index];
@@ -2476,8 +2983,11 @@ var createMethod$2 = function (TYPE) {
2476
2983
  case 3: return true; // some
2477
2984
  case 5: return value; // find
2478
2985
  case 6: return index; // findIndex
2479
- case 2: push.call(target, value); // filter
2480
- } else if (IS_EVERY) return false; // every
2986
+ case 2: push$1(target, value); // filter
2987
+ } else switch (TYPE) {
2988
+ case 4: return false; // every
2989
+ case 7: push$1(target, value); // filterReject
2990
+ }
2481
2991
  }
2482
2992
  }
2483
2993
  return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
@@ -2486,104 +2996,80 @@ var createMethod$2 = function (TYPE) {
2486
2996
 
2487
2997
  var arrayIteration = {
2488
2998
  // `Array.prototype.forEach` method
2489
- // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
2999
+ // https://tc39.es/ecma262/#sec-array.prototype.foreach
2490
3000
  forEach: createMethod$2(0),
2491
3001
  // `Array.prototype.map` method
2492
- // https://tc39.github.io/ecma262/#sec-array.prototype.map
3002
+ // https://tc39.es/ecma262/#sec-array.prototype.map
2493
3003
  map: createMethod$2(1),
2494
3004
  // `Array.prototype.filter` method
2495
- // https://tc39.github.io/ecma262/#sec-array.prototype.filter
3005
+ // https://tc39.es/ecma262/#sec-array.prototype.filter
2496
3006
  filter: createMethod$2(2),
2497
3007
  // `Array.prototype.some` method
2498
- // https://tc39.github.io/ecma262/#sec-array.prototype.some
3008
+ // https://tc39.es/ecma262/#sec-array.prototype.some
2499
3009
  some: createMethod$2(3),
2500
3010
  // `Array.prototype.every` method
2501
- // https://tc39.github.io/ecma262/#sec-array.prototype.every
3011
+ // https://tc39.es/ecma262/#sec-array.prototype.every
2502
3012
  every: createMethod$2(4),
2503
3013
  // `Array.prototype.find` method
2504
- // https://tc39.github.io/ecma262/#sec-array.prototype.find
3014
+ // https://tc39.es/ecma262/#sec-array.prototype.find
2505
3015
  find: createMethod$2(5),
2506
3016
  // `Array.prototype.findIndex` method
2507
- // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
2508
- findIndex: createMethod$2(6)
3017
+ // https://tc39.es/ecma262/#sec-array.prototype.findIndex
3018
+ findIndex: createMethod$2(6),
3019
+ // `Array.prototype.filterReject` method
3020
+ // https://github.com/tc39/proposal-array-filtering
3021
+ filterReject: createMethod$2(7)
2509
3022
  };
2510
3023
 
2511
3024
  var arrayMethodIsStrict = function (METHOD_NAME, argument) {
2512
3025
  var method = [][METHOD_NAME];
2513
3026
  return !!method && fails(function () {
2514
- // eslint-disable-next-line no-useless-call,no-throw-literal
2515
- method.call(null, argument || function () { throw 1; }, 1);
2516
- });
2517
- };
2518
-
2519
- var defineProperty$1 = Object.defineProperty;
2520
- var cache = {};
2521
-
2522
- var thrower = function (it) { throw it; };
2523
-
2524
- var arrayMethodUsesToLength = function (METHOD_NAME, options) {
2525
- if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
2526
- if (!options) options = {};
2527
- var method = [][METHOD_NAME];
2528
- var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
2529
- var argument0 = has(options, 0) ? options[0] : thrower;
2530
- var argument1 = has(options, 1) ? options[1] : undefined;
2531
-
2532
- return cache[METHOD_NAME] = !!method && !fails(function () {
2533
- if (ACCESSORS && !descriptors) return true;
2534
- var O = { length: -1 };
2535
-
2536
- if (ACCESSORS) defineProperty$1(O, 1, { enumerable: true, get: thrower });
2537
- else O[1] = 1;
2538
-
2539
- method.call(O, argument0, argument1);
3027
+ // eslint-disable-next-line no-useless-call -- required for testing
3028
+ method.call(null, argument || function () { return 1; }, 1);
2540
3029
  });
2541
3030
  };
2542
3031
 
2543
3032
  var $forEach = arrayIteration.forEach;
2544
3033
 
2545
3034
 
2546
-
2547
3035
  var STRICT_METHOD = arrayMethodIsStrict('forEach');
2548
- var USES_TO_LENGTH = arrayMethodUsesToLength('forEach');
2549
3036
 
2550
3037
  // `Array.prototype.forEach` method implementation
2551
- // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
2552
- var arrayForEach = (!STRICT_METHOD || !USES_TO_LENGTH) ? function forEach(callbackfn /* , thisArg */) {
3038
+ // https://tc39.es/ecma262/#sec-array.prototype.foreach
3039
+ var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
2553
3040
  return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
3041
+ // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
2554
3042
  } : [].forEach;
2555
3043
 
2556
3044
  // `Array.prototype.forEach` method
2557
- // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
3045
+ // https://tc39.es/ecma262/#sec-array.prototype.foreach
3046
+ // eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
2558
3047
  _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, {
2559
3048
  forEach: arrayForEach
2560
3049
  });
2561
3050
 
2562
- var nativeJoin = [].join;
3051
+ var un$Join = functionUncurryThis([].join);
2563
3052
 
2564
3053
  var ES3_STRINGS = indexedObject != Object;
2565
3054
  var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
2566
3055
 
2567
3056
  // `Array.prototype.join` method
2568
- // https://tc39.github.io/ecma262/#sec-array.prototype.join
3057
+ // https://tc39.es/ecma262/#sec-array.prototype.join
2569
3058
  _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
2570
3059
  join: function join(separator) {
2571
- return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
3060
+ return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
2572
3061
  }
2573
3062
  });
2574
3063
 
2575
3064
  var $map = arrayIteration.map;
2576
3065
 
2577
3066
 
2578
-
2579
3067
  var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
2580
- // FF49- issue
2581
- var USES_TO_LENGTH$1 = arrayMethodUsesToLength('map');
2582
3068
 
2583
3069
  // `Array.prototype.map` method
2584
- // https://tc39.github.io/ecma262/#sec-array.prototype.map
3070
+ // https://tc39.es/ecma262/#sec-array.prototype.map
2585
3071
  // with adding support of @@species
2586
- _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH$1 }, {
3072
+ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
2587
3073
  map: function map(callbackfn /* , thisArg */) {
2588
3074
  return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2589
3075
  }
@@ -2625,17 +3111,31 @@ var domIterables = {
2625
3111
  TouchList: 0
2626
3112
  };
2627
3113
 
2628
- for (var COLLECTION_NAME in domIterables) {
2629
- var Collection = global_1[COLLECTION_NAME];
2630
- var CollectionPrototype = Collection && Collection.prototype;
3114
+ // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
3115
+
3116
+
3117
+ var classList = documentCreateElement('span').classList;
3118
+ var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
3119
+
3120
+ var domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
3121
+
3122
+ var handlePrototype = function (CollectionPrototype) {
2631
3123
  // some Chrome versions have non-configurable methods on DOMTokenList
2632
3124
  if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
2633
3125
  createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
2634
3126
  } catch (error) {
2635
3127
  CollectionPrototype.forEach = arrayForEach;
2636
3128
  }
3129
+ };
3130
+
3131
+ for (var COLLECTION_NAME in domIterables) {
3132
+ if (domIterables[COLLECTION_NAME]) {
3133
+ handlePrototype(global_1[COLLECTION_NAME] && global_1[COLLECTION_NAME].prototype);
3134
+ }
2637
3135
  }
2638
3136
 
3137
+ handlePrototype(domTokenListPrototype);
3138
+
2639
3139
  var Storage = /*#__PURE__*/function () {
2640
3140
  function Storage() {
2641
3141
  _classCallCheck(this, Storage);
@@ -2774,7 +3274,7 @@ var API_HOST = /*#__PURE__*/function () {
2774
3274
  return API_HOST;
2775
3275
  }();
2776
3276
 
2777
- var SDK_VERSION = '3.3.0';
3277
+ var SDK_VERSION = '3.5.0-beta';
2778
3278
 
2779
3279
  var Http = /*#__PURE__*/function () {
2780
3280
  function Http() {
@@ -2786,7 +3286,8 @@ var Http = /*#__PURE__*/function () {
2786
3286
  value: function request(method, path, data) {
2787
3287
  return new Promise(function (resolve, reject) {
2788
3288
  var xhr = new XMLHttpRequest();
2789
- var url = "".concat(API_HOST.getHost(), "/").concat(path); // remove undefined values
3289
+ var basePath = Storage.getItem(Storage.BASE_API_PATH) || 'v1';
3290
+ var url = "".concat(API_HOST.getHost(), "/").concat(basePath, "/").concat(path); // remove undefined values
2790
3291
 
2791
3292
  var body = {};
2792
3293
  Object.keys(data).forEach(function (key) {
@@ -2941,7 +3442,7 @@ var Context = /*#__PURE__*/function () {
2941
3442
  params = {
2942
3443
  coordinates: "".concat(latitude, ",").concat(longitude)
2943
3444
  };
2944
- return _context.abrupt("return", Http.request('GET', "v1/context", params));
3445
+ return _context.abrupt("return", Http.request('GET', "context", params));
2945
3446
 
2946
3447
  case 8:
2947
3448
  case "end":
@@ -2982,7 +3483,7 @@ var Geocoding = /*#__PURE__*/function () {
2982
3483
  case 0:
2983
3484
  geocodeOptions = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
2984
3485
  query = geocodeOptions.query, layers = geocodeOptions.layers, country = geocodeOptions.country;
2985
- return _context.abrupt("return", Http.request('GET', 'v1/geocode/forward', {
3486
+ return _context.abrupt("return", Http.request('GET', 'geocode/forward', {
2986
3487
  query: query,
2987
3488
  layers: layers,
2988
3489
  country: country
@@ -3043,7 +3544,7 @@ var Geocoding = /*#__PURE__*/function () {
3043
3544
  coordinates: "".concat(latitude, ",").concat(longitude),
3044
3545
  layers: layers
3045
3546
  };
3046
- return _context2.abrupt("return", Http.request('GET', 'v1/geocode/reverse', params));
3547
+ return _context2.abrupt("return", Http.request('GET', 'geocode/reverse', params));
3047
3548
 
3048
3549
  case 12:
3049
3550
  case "end":
@@ -3072,7 +3573,7 @@ var Geocoding = /*#__PURE__*/function () {
3072
3573
  case 0:
3073
3574
  geocodeOptions = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
3074
3575
  ip = geocodeOptions.ip;
3075
- return _context3.abrupt("return", Http.request('GET', 'v1/geocode/ip', {
3576
+ return _context3.abrupt("return", Http.request('GET', 'geocode/ip', {
3076
3577
  ip: ip
3077
3578
  }));
3078
3579
 
@@ -3158,7 +3659,7 @@ var Routing = /*#__PURE__*/function () {
3158
3659
  units: units,
3159
3660
  geometry: geometry
3160
3661
  };
3161
- return _context.abrupt("return", Http.request('GET', 'v1/route/distance', params));
3662
+ return _context.abrupt("return", Http.request('GET', 'route/distance', params));
3162
3663
 
3163
3664
  case 14:
3164
3665
  case "end":
@@ -3228,7 +3729,7 @@ var Routing = /*#__PURE__*/function () {
3228
3729
  units: units,
3229
3730
  geometry: geometry
3230
3731
  };
3231
- return _context2.abrupt("return", Http.request('GET', 'v1/route/matrix', params));
3732
+ return _context2.abrupt("return", Http.request('GET', 'route/matrix', params));
3232
3733
 
3233
3734
  case 13:
3234
3735
  case "end":
@@ -3318,7 +3819,7 @@ var Search = /*#__PURE__*/function () {
3318
3819
  groups: groups,
3319
3820
  limit: limit
3320
3821
  };
3321
- return _context.abrupt("return", Http.request('GET', 'v1/search/places', params));
3822
+ return _context.abrupt("return", Http.request('GET', 'search/places', params));
3322
3823
 
3323
3824
  case 15:
3324
3825
  case "end":
@@ -3396,7 +3897,7 @@ var Search = /*#__PURE__*/function () {
3396
3897
  });
3397
3898
  }
3398
3899
 
3399
- return _context2.abrupt("return", Http.request('GET', 'v1/search/geofences', params));
3900
+ return _context2.abrupt("return", Http.request('GET', 'search/geofences', params));
3400
3901
 
3401
3902
  case 14:
3402
3903
  case "end":
@@ -3445,7 +3946,7 @@ var Search = /*#__PURE__*/function () {
3445
3946
  layers: layers,
3446
3947
  country: country
3447
3948
  };
3448
- return _context3.abrupt("return", Http.request('GET', 'v1/search/autocomplete', params));
3949
+ return _context3.abrupt("return", Http.request('GET', 'search/autocomplete', params));
3449
3950
 
3450
3951
  case 5:
3451
3952
  case "end":
@@ -3467,86 +3968,235 @@ var Search = /*#__PURE__*/function () {
3467
3968
  }();
3468
3969
 
3469
3970
  // `RegExp.prototype.flags` getter implementation
3470
- // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
3971
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
3471
3972
  var regexpFlags = function () {
3472
3973
  var that = anObject(this);
3473
3974
  var result = '';
3975
+ if (that.hasIndices) result += 'd';
3474
3976
  if (that.global) result += 'g';
3475
3977
  if (that.ignoreCase) result += 'i';
3476
3978
  if (that.multiline) result += 'm';
3477
3979
  if (that.dotAll) result += 's';
3478
3980
  if (that.unicode) result += 'u';
3981
+ if (that.unicodeSets) result += 'v';
3479
3982
  if (that.sticky) result += 'y';
3480
3983
  return result;
3481
3984
  };
3482
3985
 
3483
- // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
3484
- // so we use an intermediate function.
3485
- function RE(s, f) {
3486
- return RegExp(s, f);
3487
- }
3986
+ // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
3987
+ var $RegExp = global_1.RegExp;
3488
3988
 
3489
3989
  var UNSUPPORTED_Y = fails(function () {
3490
- // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
3491
- var re = RE('a', 'y');
3990
+ var re = $RegExp('a', 'y');
3492
3991
  re.lastIndex = 2;
3493
3992
  return re.exec('abcd') != null;
3494
3993
  });
3495
3994
 
3496
- var BROKEN_CARET = fails(function () {
3995
+ // UC Browser bug
3996
+ // https://github.com/zloirock/core-js/issues/1008
3997
+ var MISSED_STICKY = UNSUPPORTED_Y || fails(function () {
3998
+ return !$RegExp('a', 'y').sticky;
3999
+ });
4000
+
4001
+ var BROKEN_CARET = UNSUPPORTED_Y || fails(function () {
3497
4002
  // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
3498
- var re = RE('^r', 'gy');
4003
+ var re = $RegExp('^r', 'gy');
3499
4004
  re.lastIndex = 2;
3500
4005
  return re.exec('str') != null;
3501
4006
  });
3502
4007
 
3503
4008
  var regexpStickyHelpers = {
3504
- UNSUPPORTED_Y: UNSUPPORTED_Y,
3505
- BROKEN_CARET: BROKEN_CARET
4009
+ BROKEN_CARET: BROKEN_CARET,
4010
+ MISSED_STICKY: MISSED_STICKY,
4011
+ UNSUPPORTED_Y: UNSUPPORTED_Y
3506
4012
  };
3507
4013
 
3508
- var nativeExec = RegExp.prototype.exec;
3509
- // This always refers to the native implementation, because the
3510
- // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
3511
- // which loads this file before patching the method.
3512
- var nativeReplace = String.prototype.replace;
4014
+ // `Object.defineProperties` method
4015
+ // https://tc39.es/ecma262/#sec-object.defineproperties
4016
+ // eslint-disable-next-line es-x/no-object-defineproperties -- safe
4017
+ var f$6 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
4018
+ anObject(O);
4019
+ var props = toIndexedObject(Properties);
4020
+ var keys = objectKeys(Properties);
4021
+ var length = keys.length;
4022
+ var index = 0;
4023
+ var key;
4024
+ while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
4025
+ return O;
4026
+ };
4027
+
4028
+ var objectDefineProperties = {
4029
+ f: f$6
4030
+ };
3513
4031
 
4032
+ /* global ActiveXObject -- old IE, WSH */
4033
+
4034
+
4035
+
4036
+
4037
+
4038
+
4039
+
4040
+
4041
+ var GT = '>';
4042
+ var LT = '<';
4043
+ var PROTOTYPE = 'prototype';
4044
+ var SCRIPT = 'script';
4045
+ var IE_PROTO = sharedKey('IE_PROTO');
4046
+
4047
+ var EmptyConstructor = function () { /* empty */ };
4048
+
4049
+ var scriptTag = function (content) {
4050
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
4051
+ };
4052
+
4053
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
4054
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
4055
+ activeXDocument.write(scriptTag(''));
4056
+ activeXDocument.close();
4057
+ var temp = activeXDocument.parentWindow.Object;
4058
+ activeXDocument = null; // avoid memory leak
4059
+ return temp;
4060
+ };
4061
+
4062
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
4063
+ var NullProtoObjectViaIFrame = function () {
4064
+ // Thrash, waste and sodomy: IE GC bug
4065
+ var iframe = documentCreateElement('iframe');
4066
+ var JS = 'java' + SCRIPT + ':';
4067
+ var iframeDocument;
4068
+ iframe.style.display = 'none';
4069
+ html.appendChild(iframe);
4070
+ // https://github.com/zloirock/core-js/issues/475
4071
+ iframe.src = String(JS);
4072
+ iframeDocument = iframe.contentWindow.document;
4073
+ iframeDocument.open();
4074
+ iframeDocument.write(scriptTag('document.F=Object'));
4075
+ iframeDocument.close();
4076
+ return iframeDocument.F;
4077
+ };
4078
+
4079
+ // Check for document.domain and active x support
4080
+ // No need to use active x approach when document.domain is not set
4081
+ // see https://github.com/es-shims/es5-shim/issues/150
4082
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
4083
+ // avoid IE GC bug
4084
+ var activeXDocument;
4085
+ var NullProtoObject = function () {
4086
+ try {
4087
+ activeXDocument = new ActiveXObject('htmlfile');
4088
+ } catch (error) { /* ignore */ }
4089
+ NullProtoObject = typeof document != 'undefined'
4090
+ ? document.domain && activeXDocument
4091
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
4092
+ : NullProtoObjectViaIFrame()
4093
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
4094
+ var length = enumBugKeys.length;
4095
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
4096
+ return NullProtoObject();
4097
+ };
4098
+
4099
+ hiddenKeys[IE_PROTO] = true;
4100
+
4101
+ // `Object.create` method
4102
+ // https://tc39.es/ecma262/#sec-object.create
4103
+ // eslint-disable-next-line es-x/no-object-create -- safe
4104
+ var objectCreate = Object.create || function create(O, Properties) {
4105
+ var result;
4106
+ if (O !== null) {
4107
+ EmptyConstructor[PROTOTYPE] = anObject(O);
4108
+ result = new EmptyConstructor();
4109
+ EmptyConstructor[PROTOTYPE] = null;
4110
+ // add "__proto__" for Object.getPrototypeOf polyfill
4111
+ result[IE_PROTO] = O;
4112
+ } else result = NullProtoObject();
4113
+ return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
4114
+ };
4115
+
4116
+ // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
4117
+ var $RegExp$1 = global_1.RegExp;
4118
+
4119
+ var regexpUnsupportedDotAll = fails(function () {
4120
+ var re = $RegExp$1('.', 's');
4121
+ return !(re.dotAll && re.exec('\n') && re.flags === 's');
4122
+ });
4123
+
4124
+ // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
4125
+ var $RegExp$2 = global_1.RegExp;
4126
+
4127
+ var regexpUnsupportedNcg = fails(function () {
4128
+ var re = $RegExp$2('(?<a>b)', 'g');
4129
+ return re.exec('b').groups.a !== 'b' ||
4130
+ 'b'.replace(re, '$<a>c') !== 'bc';
4131
+ });
4132
+
4133
+ /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
4134
+ /* eslint-disable regexp/no-useless-quantifier -- testing */
4135
+
4136
+
4137
+
4138
+
4139
+
4140
+
4141
+
4142
+ var getInternalState = internalState.get;
4143
+
4144
+
4145
+
4146
+ var nativeReplace = shared('native-string-replace', String.prototype.replace);
4147
+ var nativeExec = RegExp.prototype.exec;
3514
4148
  var patchedExec = nativeExec;
4149
+ var charAt = functionUncurryThis(''.charAt);
4150
+ var indexOf$1 = functionUncurryThis(''.indexOf);
4151
+ var replace$1 = functionUncurryThis(''.replace);
4152
+ var stringSlice$1 = functionUncurryThis(''.slice);
3515
4153
 
3516
4154
  var UPDATES_LAST_INDEX_WRONG = (function () {
3517
4155
  var re1 = /a/;
3518
4156
  var re2 = /b*/g;
3519
- nativeExec.call(re1, 'a');
3520
- nativeExec.call(re2, 'a');
4157
+ functionCall(nativeExec, re1, 'a');
4158
+ functionCall(nativeExec, re2, 'a');
3521
4159
  return re1.lastIndex !== 0 || re2.lastIndex !== 0;
3522
4160
  })();
3523
4161
 
3524
- var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
4162
+ var UNSUPPORTED_Y$1 = regexpStickyHelpers.BROKEN_CARET;
3525
4163
 
3526
4164
  // nonparticipating capturing group, copied from es5-shim's String#split patch.
3527
4165
  var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
3528
4166
 
3529
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
4167
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1 || regexpUnsupportedDotAll || regexpUnsupportedNcg;
3530
4168
 
3531
4169
  if (PATCH) {
3532
- patchedExec = function exec(str) {
4170
+ patchedExec = function exec(string) {
3533
4171
  var re = this;
3534
- var lastIndex, reCopy, match, i;
4172
+ var state = getInternalState(re);
4173
+ var str = toString_1(string);
4174
+ var raw = state.raw;
4175
+ var result, reCopy, lastIndex, match, i, object, group;
4176
+
4177
+ if (raw) {
4178
+ raw.lastIndex = re.lastIndex;
4179
+ result = functionCall(patchedExec, raw, str);
4180
+ re.lastIndex = raw.lastIndex;
4181
+ return result;
4182
+ }
4183
+
4184
+ var groups = state.groups;
3535
4185
  var sticky = UNSUPPORTED_Y$1 && re.sticky;
3536
- var flags = regexpFlags.call(re);
4186
+ var flags = functionCall(regexpFlags, re);
3537
4187
  var source = re.source;
3538
4188
  var charsAdded = 0;
3539
4189
  var strCopy = str;
3540
4190
 
3541
4191
  if (sticky) {
3542
- flags = flags.replace('y', '');
3543
- if (flags.indexOf('g') === -1) {
4192
+ flags = replace$1(flags, 'y', '');
4193
+ if (indexOf$1(flags, 'g') === -1) {
3544
4194
  flags += 'g';
3545
4195
  }
3546
4196
 
3547
- strCopy = String(str).slice(re.lastIndex);
4197
+ strCopy = stringSlice$1(str, re.lastIndex);
3548
4198
  // Support anchored sticky behavior.
3549
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
4199
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) {
3550
4200
  source = '(?: ' + source + ')';
3551
4201
  strCopy = ' ' + strCopy;
3552
4202
  charsAdded++;
@@ -3561,12 +4211,12 @@ if (PATCH) {
3561
4211
  }
3562
4212
  if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
3563
4213
 
3564
- match = nativeExec.call(sticky ? reCopy : re, strCopy);
4214
+ match = functionCall(nativeExec, sticky ? reCopy : re, strCopy);
3565
4215
 
3566
4216
  if (sticky) {
3567
4217
  if (match) {
3568
- match.input = match.input.slice(charsAdded);
3569
- match[0] = match[0].slice(charsAdded);
4218
+ match.input = stringSlice$1(match.input, charsAdded);
4219
+ match[0] = stringSlice$1(match[0], charsAdded);
3570
4220
  match.index = re.lastIndex;
3571
4221
  re.lastIndex += match[0].length;
3572
4222
  } else re.lastIndex = 0;
@@ -3576,40 +4226,64 @@ if (PATCH) {
3576
4226
  if (NPCG_INCLUDED && match && match.length > 1) {
3577
4227
  // Fix browsers whose `exec` methods don't consistently return `undefined`
3578
4228
  // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
3579
- nativeReplace.call(match[0], reCopy, function () {
4229
+ functionCall(nativeReplace, match[0], reCopy, function () {
3580
4230
  for (i = 1; i < arguments.length - 2; i++) {
3581
4231
  if (arguments[i] === undefined) match[i] = undefined;
3582
4232
  }
3583
4233
  });
3584
4234
  }
3585
4235
 
4236
+ if (match && groups) {
4237
+ match.groups = object = objectCreate(null);
4238
+ for (i = 0; i < groups.length; i++) {
4239
+ group = groups[i];
4240
+ object[group[0]] = match[group[1]];
4241
+ }
4242
+ }
4243
+
3586
4244
  return match;
3587
4245
  };
3588
4246
  }
3589
4247
 
3590
4248
  var regexpExec = patchedExec;
3591
4249
 
4250
+ // `RegExp.prototype.exec` method
4251
+ // https://tc39.es/ecma262/#sec-regexp.prototype.exec
3592
4252
  _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
3593
4253
  exec: regexpExec
3594
4254
  });
3595
4255
 
3596
- var TO_STRING = 'toString';
3597
4256
  var RegExpPrototype = RegExp.prototype;
3598
- var nativeToString = RegExpPrototype[TO_STRING];
3599
4257
 
3600
- var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
4258
+ var regexpGetFlags = function (R) {
4259
+ var flags = R.flags;
4260
+ return flags === undefined && !('flags' in RegExpPrototype) && !hasOwnProperty_1(R, 'flags') && objectIsPrototypeOf(RegExpPrototype, R)
4261
+ ? functionCall(regexpFlags, R) : flags;
4262
+ };
4263
+
4264
+ var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
4265
+
4266
+
4267
+
4268
+
4269
+
4270
+
4271
+ var TO_STRING = 'toString';
4272
+ var RegExpPrototype$1 = RegExp.prototype;
4273
+ var n$ToString = RegExpPrototype$1[TO_STRING];
4274
+
4275
+ var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
3601
4276
  // FF44- RegExp#toString has a wrong name
3602
- var INCORRECT_NAME = nativeToString.name != TO_STRING;
4277
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && n$ToString.name != TO_STRING;
3603
4278
 
3604
4279
  // `RegExp.prototype.toString` method
3605
- // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
4280
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
3606
4281
  if (NOT_GENERIC || INCORRECT_NAME) {
3607
- redefine(RegExp.prototype, TO_STRING, function toString() {
4282
+ defineBuiltIn(RegExp.prototype, TO_STRING, function toString() {
3608
4283
  var R = anObject(this);
3609
- var p = String(R.source);
3610
- var rf = R.flags;
3611
- var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
3612
- return '/' + p + '/' + f;
4284
+ var pattern = toString_1(R.source);
4285
+ var flags = toString_1(regexpGetFlags(R));
4286
+ return '/' + pattern + '/' + flags;
3613
4287
  }, { unsafe: true });
3614
4288
  }
3615
4289
 
@@ -3621,47 +4295,11 @@ if (NOT_GENERIC || INCORRECT_NAME) {
3621
4295
 
3622
4296
 
3623
4297
 
3624
- var SPECIES$5 = wellKnownSymbol('species');
3625
-
3626
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
3627
- // #replace needs built-in support for named groups.
3628
- // #match works fine because it just return the exec results, even if it has
3629
- // a "grops" property.
3630
- var re = /./;
3631
- re.exec = function () {
3632
- var result = [];
3633
- result.groups = { a: '7' };
3634
- return result;
3635
- };
3636
- return ''.replace(re, '$<a>') !== '7';
3637
- });
3638
-
3639
- // IE <= 11 replaces $0 with the whole match, as if it was $&
3640
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
3641
- var REPLACE_KEEPS_$0 = (function () {
3642
- return 'a'.replace(/./, '$0') === '$0';
3643
- })();
3644
-
3645
- var REPLACE = wellKnownSymbol('replace');
3646
- // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
3647
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
3648
- if (/./[REPLACE]) {
3649
- return /./[REPLACE]('a', '$0') === '';
3650
- }
3651
- return false;
3652
- })();
3653
4298
 
3654
- // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
3655
- // Weex JS has frozen built-in prototypes, so use try / catch wrapper
3656
- var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
3657
- var re = /(?:)/;
3658
- var originalExec = re.exec;
3659
- re.exec = function () { return originalExec.apply(this, arguments); };
3660
- var result = 'ab'.split(re);
3661
- return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
3662
- });
4299
+ var SPECIES$5 = wellKnownSymbol('species');
4300
+ var RegExpPrototype$2 = RegExp.prototype;
3663
4301
 
3664
- var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
4302
+ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
3665
4303
  var SYMBOL = wellKnownSymbol(KEY);
3666
4304
 
3667
4305
  var DELEGATES_TO_SYMBOL = !fails(function () {
@@ -3698,140 +4336,197 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
3698
4336
  if (
3699
4337
  !DELEGATES_TO_SYMBOL ||
3700
4338
  !DELEGATES_TO_EXEC ||
3701
- (KEY === 'replace' && !(
3702
- REPLACE_SUPPORTS_NAMED_GROUPS &&
3703
- REPLACE_KEEPS_$0 &&
3704
- !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
3705
- )) ||
3706
- (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
4339
+ FORCED
3707
4340
  ) {
3708
- var nativeRegExpMethod = /./[SYMBOL];
4341
+ var uncurriedNativeRegExpMethod = functionUncurryThis(/./[SYMBOL]);
3709
4342
  var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
3710
- if (regexp.exec === regexpExec) {
4343
+ var uncurriedNativeMethod = functionUncurryThis(nativeMethod);
4344
+ var $exec = regexp.exec;
4345
+ if ($exec === regexpExec || $exec === RegExpPrototype$2.exec) {
3711
4346
  if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
3712
4347
  // The native String method already delegates to @@method (this
3713
4348
  // polyfilled function), leasing to infinite recursion.
3714
4349
  // We avoid it by directly calling the native @@method method.
3715
- return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
4350
+ return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
3716
4351
  }
3717
- return { done: true, value: nativeMethod.call(str, regexp, arg2) };
4352
+ return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
3718
4353
  }
3719
4354
  return { done: false };
3720
- }, {
3721
- REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
3722
- REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
3723
4355
  });
3724
- var stringMethod = methods[0];
3725
- var regexMethod = methods[1];
3726
-
3727
- redefine(String.prototype, KEY, stringMethod);
3728
- redefine(RegExp.prototype, SYMBOL, length == 2
3729
- // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
3730
- // 21.2.5.11 RegExp.prototype[@@split](string, limit)
3731
- ? function (string, arg) { return regexMethod.call(string, this, arg); }
3732
- // 21.2.5.6 RegExp.prototype[@@match](string)
3733
- // 21.2.5.9 RegExp.prototype[@@search](string)
3734
- : function (string) { return regexMethod.call(string, this); }
3735
- );
4356
+
4357
+ defineBuiltIn(String.prototype, KEY, methods[0]);
4358
+ defineBuiltIn(RegExpPrototype$2, SYMBOL, methods[1]);
3736
4359
  }
3737
4360
 
3738
- if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
4361
+ if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
3739
4362
  };
3740
4363
 
3741
- // `String.prototype.{ codePointAt, at }` methods implementation
4364
+ var charAt$1 = functionUncurryThis(''.charAt);
4365
+ var charCodeAt = functionUncurryThis(''.charCodeAt);
4366
+ var stringSlice$2 = functionUncurryThis(''.slice);
4367
+
3742
4368
  var createMethod$3 = function (CONVERT_TO_STRING) {
3743
4369
  return function ($this, pos) {
3744
- var S = String(requireObjectCoercible($this));
3745
- var position = toInteger(pos);
4370
+ var S = toString_1(requireObjectCoercible($this));
4371
+ var position = toIntegerOrInfinity(pos);
3746
4372
  var size = S.length;
3747
4373
  var first, second;
3748
4374
  if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
3749
- first = S.charCodeAt(position);
4375
+ first = charCodeAt(S, position);
3750
4376
  return first < 0xD800 || first > 0xDBFF || position + 1 === size
3751
- || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
3752
- ? CONVERT_TO_STRING ? S.charAt(position) : first
3753
- : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
4377
+ || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
4378
+ ? CONVERT_TO_STRING
4379
+ ? charAt$1(S, position)
4380
+ : first
4381
+ : CONVERT_TO_STRING
4382
+ ? stringSlice$2(S, position, position + 2)
4383
+ : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
3754
4384
  };
3755
4385
  };
3756
4386
 
3757
4387
  var stringMultibyte = {
3758
4388
  // `String.prototype.codePointAt` method
3759
- // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
4389
+ // https://tc39.es/ecma262/#sec-string.prototype.codepointat
3760
4390
  codeAt: createMethod$3(false),
3761
4391
  // `String.prototype.at` method
3762
4392
  // https://github.com/mathiasbynens/String.prototype.at
3763
4393
  charAt: createMethod$3(true)
3764
4394
  };
3765
4395
 
3766
- var charAt = stringMultibyte.charAt;
4396
+ var charAt$2 = stringMultibyte.charAt;
3767
4397
 
3768
4398
  // `AdvanceStringIndex` abstract operation
3769
- // https://tc39.github.io/ecma262/#sec-advancestringindex
4399
+ // https://tc39.es/ecma262/#sec-advancestringindex
3770
4400
  var advanceStringIndex = function (S, index, unicode) {
3771
- return index + (unicode ? charAt(S, index).length : 1);
4401
+ return index + (unicode ? charAt$2(S, index).length : 1);
4402
+ };
4403
+
4404
+ var floor$1 = Math.floor;
4405
+ var charAt$3 = functionUncurryThis(''.charAt);
4406
+ var replace$2 = functionUncurryThis(''.replace);
4407
+ var stringSlice$3 = functionUncurryThis(''.slice);
4408
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
4409
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
4410
+
4411
+ // `GetSubstitution` abstract operation
4412
+ // https://tc39.es/ecma262/#sec-getsubstitution
4413
+ var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
4414
+ var tailPos = position + matched.length;
4415
+ var m = captures.length;
4416
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
4417
+ if (namedCaptures !== undefined) {
4418
+ namedCaptures = toObject(namedCaptures);
4419
+ symbols = SUBSTITUTION_SYMBOLS;
4420
+ }
4421
+ return replace$2(replacement, symbols, function (match, ch) {
4422
+ var capture;
4423
+ switch (charAt$3(ch, 0)) {
4424
+ case '$': return '$';
4425
+ case '&': return matched;
4426
+ case '`': return stringSlice$3(str, 0, position);
4427
+ case "'": return stringSlice$3(str, tailPos);
4428
+ case '<':
4429
+ capture = namedCaptures[stringSlice$3(ch, 1, -1)];
4430
+ break;
4431
+ default: // \d\d?
4432
+ var n = +ch;
4433
+ if (n === 0) return match;
4434
+ if (n > m) {
4435
+ var f = floor$1(n / 10);
4436
+ if (f === 0) return match;
4437
+ if (f <= m) return captures[f - 1] === undefined ? charAt$3(ch, 1) : captures[f - 1] + charAt$3(ch, 1);
4438
+ return match;
4439
+ }
4440
+ capture = captures[n - 1];
4441
+ }
4442
+ return capture === undefined ? '' : capture;
4443
+ });
3772
4444
  };
3773
4445
 
4446
+ var $TypeError$d = TypeError;
4447
+
3774
4448
  // `RegExpExec` abstract operation
3775
- // https://tc39.github.io/ecma262/#sec-regexpexec
4449
+ // https://tc39.es/ecma262/#sec-regexpexec
3776
4450
  var regexpExecAbstract = function (R, S) {
3777
4451
  var exec = R.exec;
3778
- if (typeof exec === 'function') {
3779
- var result = exec.call(R, S);
3780
- if (typeof result !== 'object') {
3781
- throw TypeError('RegExp exec method returned something other than an Object or null');
3782
- }
4452
+ if (isCallable(exec)) {
4453
+ var result = functionCall(exec, R, S);
4454
+ if (result !== null) anObject(result);
3783
4455
  return result;
3784
4456
  }
3785
-
3786
- if (classofRaw(R) !== 'RegExp') {
3787
- throw TypeError('RegExp#exec called on incompatible receiver');
3788
- }
3789
-
3790
- return regexpExec.call(R, S);
4457
+ if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
4458
+ throw $TypeError$d('RegExp#exec called on incompatible receiver');
3791
4459
  };
3792
4460
 
4461
+ var REPLACE = wellKnownSymbol('replace');
3793
4462
  var max$1 = Math.max;
3794
4463
  var min$2 = Math.min;
3795
- var floor$1 = Math.floor;
3796
- var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
3797
- var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
4464
+ var concat$1 = functionUncurryThis([].concat);
4465
+ var push$2 = functionUncurryThis([].push);
4466
+ var stringIndexOf = functionUncurryThis(''.indexOf);
4467
+ var stringSlice$4 = functionUncurryThis(''.slice);
3798
4468
 
3799
4469
  var maybeToString = function (it) {
3800
4470
  return it === undefined ? it : String(it);
3801
4471
  };
3802
4472
 
4473
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
4474
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
4475
+ var REPLACE_KEEPS_$0 = (function () {
4476
+ // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
4477
+ return 'a'.replace(/./, '$0') === '$0';
4478
+ })();
4479
+
4480
+ // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
4481
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
4482
+ if (/./[REPLACE]) {
4483
+ return /./[REPLACE]('a', '$0') === '';
4484
+ }
4485
+ return false;
4486
+ })();
4487
+
4488
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
4489
+ var re = /./;
4490
+ re.exec = function () {
4491
+ var result = [];
4492
+ result.groups = { a: '7' };
4493
+ return result;
4494
+ };
4495
+ // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
4496
+ return ''.replace(re, '$<a>') !== '7';
4497
+ });
4498
+
3803
4499
  // @@replace logic
3804
- fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
3805
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
3806
- var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
4500
+ fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
3807
4501
  var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
3808
4502
 
3809
4503
  return [
3810
4504
  // `String.prototype.replace` method
3811
- // https://tc39.github.io/ecma262/#sec-string.prototype.replace
4505
+ // https://tc39.es/ecma262/#sec-string.prototype.replace
3812
4506
  function replace(searchValue, replaceValue) {
3813
4507
  var O = requireObjectCoercible(this);
3814
- var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
3815
- return replacer !== undefined
3816
- ? replacer.call(searchValue, O, replaceValue)
3817
- : nativeReplace.call(String(O), searchValue, replaceValue);
4508
+ var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
4509
+ return replacer
4510
+ ? functionCall(replacer, searchValue, O, replaceValue)
4511
+ : functionCall(nativeReplace, toString_1(O), searchValue, replaceValue);
3818
4512
  },
3819
4513
  // `RegExp.prototype[@@replace]` method
3820
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
3821
- function (regexp, replaceValue) {
4514
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
4515
+ function (string, replaceValue) {
4516
+ var rx = anObject(this);
4517
+ var S = toString_1(string);
4518
+
3822
4519
  if (
3823
- (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
3824
- (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
4520
+ typeof replaceValue == 'string' &&
4521
+ stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
4522
+ stringIndexOf(replaceValue, '$<') === -1
3825
4523
  ) {
3826
- var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
4524
+ var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
3827
4525
  if (res.done) return res.value;
3828
4526
  }
3829
4527
 
3830
- var rx = anObject(regexp);
3831
- var S = String(this);
3832
-
3833
- var functionalReplace = typeof replaceValue === 'function';
3834
- if (!functionalReplace) replaceValue = String(replaceValue);
4528
+ var functionalReplace = isCallable(replaceValue);
4529
+ if (!functionalReplace) replaceValue = toString_1(replaceValue);
3835
4530
 
3836
4531
  var global = rx.global;
3837
4532
  if (global) {
@@ -3843,10 +4538,10 @@ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, ma
3843
4538
  var result = regexpExecAbstract(rx, S);
3844
4539
  if (result === null) break;
3845
4540
 
3846
- results.push(result);
4541
+ push$2(results, result);
3847
4542
  if (!global) break;
3848
4543
 
3849
- var matchStr = String(result[0]);
4544
+ var matchStr = toString_1(result[0]);
3850
4545
  if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
3851
4546
  }
3852
4547
 
@@ -3855,66 +4550,32 @@ fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, ma
3855
4550
  for (var i = 0; i < results.length; i++) {
3856
4551
  result = results[i];
3857
4552
 
3858
- var matched = String(result[0]);
3859
- var position = max$1(min$2(toInteger(result.index), S.length), 0);
4553
+ var matched = toString_1(result[0]);
4554
+ var position = max$1(min$2(toIntegerOrInfinity(result.index), S.length), 0);
3860
4555
  var captures = [];
3861
4556
  // NOTE: This is equivalent to
3862
4557
  // captures = result.slice(1).map(maybeToString)
3863
4558
  // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
3864
4559
  // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
3865
4560
  // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
3866
- for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
4561
+ for (var j = 1; j < result.length; j++) push$2(captures, maybeToString(result[j]));
3867
4562
  var namedCaptures = result.groups;
3868
4563
  if (functionalReplace) {
3869
- var replacerArgs = [matched].concat(captures, position, S);
3870
- if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
3871
- var replacement = String(replaceValue.apply(undefined, replacerArgs));
4564
+ var replacerArgs = concat$1([matched], captures, position, S);
4565
+ if (namedCaptures !== undefined) push$2(replacerArgs, namedCaptures);
4566
+ var replacement = toString_1(functionApply(replaceValue, undefined, replacerArgs));
3872
4567
  } else {
3873
4568
  replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
3874
4569
  }
3875
4570
  if (position >= nextSourcePosition) {
3876
- accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
4571
+ accumulatedResult += stringSlice$4(S, nextSourcePosition, position) + replacement;
3877
4572
  nextSourcePosition = position + matched.length;
3878
4573
  }
3879
4574
  }
3880
- return accumulatedResult + S.slice(nextSourcePosition);
4575
+ return accumulatedResult + stringSlice$4(S, nextSourcePosition);
3881
4576
  }
3882
4577
  ];
3883
-
3884
- // https://tc39.github.io/ecma262/#sec-getsubstitution
3885
- function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
3886
- var tailPos = position + matched.length;
3887
- var m = captures.length;
3888
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
3889
- if (namedCaptures !== undefined) {
3890
- namedCaptures = toObject(namedCaptures);
3891
- symbols = SUBSTITUTION_SYMBOLS;
3892
- }
3893
- return nativeReplace.call(replacement, symbols, function (match, ch) {
3894
- var capture;
3895
- switch (ch.charAt(0)) {
3896
- case '$': return '$';
3897
- case '&': return matched;
3898
- case '`': return str.slice(0, position);
3899
- case "'": return str.slice(tailPos);
3900
- case '<':
3901
- capture = namedCaptures[ch.slice(1, -1)];
3902
- break;
3903
- default: // \d\d?
3904
- var n = +ch;
3905
- if (n === 0) return match;
3906
- if (n > m) {
3907
- var f = floor$1(n / 10);
3908
- if (f === 0) return match;
3909
- if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
3910
- return match;
3911
- }
3912
- capture = captures[n - 1];
3913
- }
3914
- return capture === undefined ? '' : capture;
3915
- });
3916
- }
3917
- });
4578
+ }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
3918
4579
 
3919
4580
  var generateUUID = function generateUUID() {
3920
4581
  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (char) {
@@ -3970,10 +4631,7 @@ var Track = /*#__PURE__*/function () {
3970
4631
  deviceType,
3971
4632
  description,
3972
4633
  metadata,
3973
- tripOptions,
3974
4634
  body,
3975
- basePath,
3976
- trackEndpoint,
3977
4635
  response,
3978
4636
  _args = arguments;
3979
4637
  return regeneratorRuntime.wrap(function _callee$(_context) {
@@ -4009,12 +4667,6 @@ var Track = /*#__PURE__*/function () {
4009
4667
  metadata = JSON.parse(metadata);
4010
4668
  }
4011
4669
 
4012
- tripOptions = Storage.getItem(Storage.TRIP_OPTIONS);
4013
-
4014
- if (tripOptions) {
4015
- tripOptions = JSON.parse(tripOptions);
4016
- }
4017
-
4018
4670
  body = _objectSpread2({}, params, {
4019
4671
  accuracy: accuracy,
4020
4672
  description: description,
@@ -4027,15 +4679,12 @@ var Track = /*#__PURE__*/function () {
4027
4679
  metadata: metadata,
4028
4680
  sdkVersion: SDK_VERSION,
4029
4681
  stopped: true,
4030
- userId: userId,
4031
- tripOptions: tripOptions
4682
+ userId: userId
4032
4683
  });
4033
- basePath = Storage.getItem(Storage.BASE_API_PATH) || 'v1';
4034
- trackEndpoint = "".concat(basePath, "/track");
4035
- _context.next = 23;
4036
- return Http.request('POST', trackEndpoint, body);
4684
+ _context.next = 19;
4685
+ return Http.request('POST', 'track', body);
4037
4686
 
4038
- case 23:
4687
+ case 19:
4039
4688
  response = _context.sent;
4040
4689
  response.location = {
4041
4690
  latitude: latitude,
@@ -4044,7 +4693,7 @@ var Track = /*#__PURE__*/function () {
4044
4693
  };
4045
4694
  return _context.abrupt("return", response);
4046
4695
 
4047
- case 26:
4696
+ case 22:
4048
4697
  case "end":
4049
4698
  return _context.stop();
4050
4699
  }
@@ -4069,11 +4718,11 @@ var Trips = /*#__PURE__*/function () {
4069
4718
  }
4070
4719
 
4071
4720
  _createClass(Trips, null, [{
4072
- key: "updateTrip",
4721
+ key: "startTrip",
4073
4722
  value: function () {
4074
- var _updateTrip = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
4723
+ var _startTrip = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
4075
4724
  var tripOptions,
4076
- status,
4725
+ userId,
4077
4726
  externalId,
4078
4727
  destinationGeofenceTag,
4079
4728
  destinationGeofenceExternalId,
@@ -4081,28 +4730,26 @@ var Trips = /*#__PURE__*/function () {
4081
4730
  metadata,
4082
4731
  approachingThreshold,
4083
4732
  params,
4084
- basePath,
4085
4733
  _args = arguments;
4086
4734
  return regeneratorRuntime.wrap(function _callee$(_context) {
4087
4735
  while (1) {
4088
4736
  switch (_context.prev = _context.next) {
4089
4737
  case 0:
4090
4738
  tripOptions = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
4091
- status = _args.length > 1 ? _args[1] : undefined;
4739
+ userId = Storage.getItem(Storage.USER_ID);
4092
4740
  externalId = tripOptions.externalId, destinationGeofenceTag = tripOptions.destinationGeofenceTag, destinationGeofenceExternalId = tripOptions.destinationGeofenceExternalId, mode = tripOptions.mode, metadata = tripOptions.metadata, approachingThreshold = tripOptions.approachingThreshold;
4093
4741
  params = {
4742
+ userId: userId,
4094
4743
  externalId: externalId,
4095
- status: status,
4096
4744
  destinationGeofenceTag: destinationGeofenceTag,
4097
4745
  destinationGeofenceExternalId: destinationGeofenceExternalId,
4098
4746
  mode: mode,
4099
4747
  metadata: metadata,
4100
4748
  approachingThreshold: approachingThreshold
4101
4749
  };
4102
- basePath = Storage.getItem(Storage.BASE_API_PATH) || 'v1';
4103
- return _context.abrupt("return", Http.request('PATCH', "".concat(basePath, "/trips/").concat(externalId), params));
4750
+ return _context.abrupt("return", Http.request('POST', "trips", params));
4104
4751
 
4105
- case 6:
4752
+ case 5:
4106
4753
  case "end":
4107
4754
  return _context.stop();
4108
4755
  }
@@ -4110,6 +4757,55 @@ var Trips = /*#__PURE__*/function () {
4110
4757
  }, _callee);
4111
4758
  }));
4112
4759
 
4760
+ function startTrip() {
4761
+ return _startTrip.apply(this, arguments);
4762
+ }
4763
+
4764
+ return startTrip;
4765
+ }()
4766
+ }, {
4767
+ key: "updateTrip",
4768
+ value: function () {
4769
+ var _updateTrip = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
4770
+ var tripOptions,
4771
+ status,
4772
+ userId,
4773
+ externalId,
4774
+ destinationGeofenceTag,
4775
+ destinationGeofenceExternalId,
4776
+ mode,
4777
+ metadata,
4778
+ approachingThreshold,
4779
+ params,
4780
+ _args2 = arguments;
4781
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
4782
+ while (1) {
4783
+ switch (_context2.prev = _context2.next) {
4784
+ case 0:
4785
+ tripOptions = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
4786
+ status = _args2.length > 1 ? _args2[1] : undefined;
4787
+ userId = Storage.getItem(Storage.USER_ID);
4788
+ externalId = tripOptions.externalId, destinationGeofenceTag = tripOptions.destinationGeofenceTag, destinationGeofenceExternalId = tripOptions.destinationGeofenceExternalId, mode = tripOptions.mode, metadata = tripOptions.metadata, approachingThreshold = tripOptions.approachingThreshold;
4789
+ params = {
4790
+ userId: userId,
4791
+ externalId: externalId,
4792
+ status: status,
4793
+ destinationGeofenceTag: destinationGeofenceTag,
4794
+ destinationGeofenceExternalId: destinationGeofenceExternalId,
4795
+ mode: mode,
4796
+ metadata: metadata,
4797
+ approachingThreshold: approachingThreshold
4798
+ };
4799
+ return _context2.abrupt("return", Http.request('PATCH', "trips/".concat(externalId, "/update"), params));
4800
+
4801
+ case 6:
4802
+ case "end":
4803
+ return _context2.stop();
4804
+ }
4805
+ }
4806
+ }, _callee2);
4807
+ }));
4808
+
4113
4809
  function updateTrip() {
4114
4810
  return _updateTrip.apply(this, arguments);
4115
4811
  }
@@ -4122,6 +4818,7 @@ var Trips = /*#__PURE__*/function () {
4122
4818
  }();
4123
4819
 
4124
4820
  var TRIP_STATUS = {
4821
+ PENDING: "pending",
4125
4822
  STARTED: "started",
4126
4823
  APPROACHING: "approaching",
4127
4824
  ARRIVED: "arrived",
@@ -4297,11 +4994,12 @@ var Radar = /*#__PURE__*/function () {
4297
4994
  key: "startTrip",
4298
4995
  value: function startTrip(tripOptions) {
4299
4996
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultCallback;
4300
- Trips.updateTrip(tripOptions, TRIP_STATUS.STARTED).then(function (response) {
4301
- Radar.setTripOptions(tripOptions);
4997
+ Trips.startTrip(tripOptions).then(function (response) {
4998
+ Radar.setTripOptions(tripOptions); // default events to `[]` for backwards compatibility
4999
+
4302
5000
  callback(null, {
4303
5001
  trip: response.trip,
4304
- events: response.events,
5002
+ events: response.events || [],
4305
5003
  status: STATUS.SUCCESS
4306
5004
  }, response);
4307
5005
  }).catch(handleError(callback));