UNPKG

49.3 kBJavaScriptView Raw
1var AbortablePromise = (function () {
2 'use strict';
3
4 function createCommonjsModule(fn, module) {
5 return module = { exports: {} }, fn(module, module.exports), module.exports;
6 }
7
8 var _core = createCommonjsModule(function (module) {
9 var core = module.exports = { version: '2.6.9' };
10 if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
11 });
12 var _core_1 = _core.version;
13
14 var _global = createCommonjsModule(function (module) {
15 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
16 var global = module.exports = typeof window != 'undefined' && window.Math == Math
17 ? window : typeof self != 'undefined' && self.Math == Math ? self
18 // eslint-disable-next-line no-new-func
19 : Function('return this')();
20 if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
21 });
22
23 var _shared = createCommonjsModule(function (module) {
24 var SHARED = '__core-js_shared__';
25 var store = _global[SHARED] || (_global[SHARED] = {});
26
27 (module.exports = function (key, value) {
28 return store[key] || (store[key] = value !== undefined ? value : {});
29 })('versions', []).push({
30 version: _core.version,
31 mode: 'global',
32 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
33 });
34 });
35
36 var id = 0;
37 var px = Math.random();
38 var _uid = function (key) {
39 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
40 };
41
42 var _wks = createCommonjsModule(function (module) {
43 var store = _shared('wks');
44
45 var Symbol = _global.Symbol;
46 var USE_SYMBOL = typeof Symbol == 'function';
47
48 var $exports = module.exports = function (name) {
49 return store[name] || (store[name] =
50 USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
51 };
52
53 $exports.store = store;
54 });
55
56 var _isObject = function (it) {
57 return typeof it === 'object' ? it !== null : typeof it === 'function';
58 };
59
60 var _anObject = function (it) {
61 if (!_isObject(it)) throw TypeError(it + ' is not an object!');
62 return it;
63 };
64
65 var _fails = function (exec) {
66 try {
67 return !!exec();
68 } catch (e) {
69 return true;
70 }
71 };
72
73 // Thank's IE8 for his funny defineProperty
74 var _descriptors = !_fails(function () {
75 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
76 });
77
78 var document$1 = _global.document;
79 // typeof document.createElement is 'object' in old IE
80 var is = _isObject(document$1) && _isObject(document$1.createElement);
81 var _domCreate = function (it) {
82 return is ? document$1.createElement(it) : {};
83 };
84
85 var _ie8DomDefine = !_descriptors && !_fails(function () {
86 return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
87 });
88
89 // 7.1.1 ToPrimitive(input [, PreferredType])
90
91 // instead of the ES6 spec version, we didn't implement @@toPrimitive case
92 // and the second argument - flag - preferred type is a string
93 var _toPrimitive = function (it, S) {
94 if (!_isObject(it)) return it;
95 var fn, val;
96 if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
97 if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
98 if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
99 throw TypeError("Can't convert object to primitive value");
100 };
101
102 var dP = Object.defineProperty;
103
104 var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
105 _anObject(O);
106 P = _toPrimitive(P, true);
107 _anObject(Attributes);
108 if (_ie8DomDefine) try {
109 return dP(O, P, Attributes);
110 } catch (e) { /* empty */ }
111 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
112 if ('value' in Attributes) O[P] = Attributes.value;
113 return O;
114 };
115
116 var _objectDp = {
117 f: f
118 };
119
120 var _propertyDesc = function (bitmap, value) {
121 return {
122 enumerable: !(bitmap & 1),
123 configurable: !(bitmap & 2),
124 writable: !(bitmap & 4),
125 value: value
126 };
127 };
128
129 var _hide = _descriptors ? function (object, key, value) {
130 return _objectDp.f(object, key, _propertyDesc(1, value));
131 } : function (object, key, value) {
132 object[key] = value;
133 return object;
134 };
135
136 // 22.1.3.31 Array.prototype[@@unscopables]
137 var UNSCOPABLES = _wks('unscopables');
138 var ArrayProto = Array.prototype;
139 if (ArrayProto[UNSCOPABLES] == undefined) _hide(ArrayProto, UNSCOPABLES, {});
140 var _addToUnscopables = function (key) {
141 ArrayProto[UNSCOPABLES][key] = true;
142 };
143
144 var _iterStep = function (done, value) {
145 return { value: value, done: !!done };
146 };
147
148 var _iterators = {};
149
150 var toString = {}.toString;
151
152 var _cof = function (it) {
153 return toString.call(it).slice(8, -1);
154 };
155
156 // fallback for non-array-like ES3 and non-enumerable old V8 strings
157
158 // eslint-disable-next-line no-prototype-builtins
159 var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
160 return _cof(it) == 'String' ? it.split('') : Object(it);
161 };
162
163 // 7.2.1 RequireObjectCoercible(argument)
164 var _defined = function (it) {
165 if (it == undefined) throw TypeError("Can't call method on " + it);
166 return it;
167 };
168
169 // to indexed object, toObject with fallback for non-array-like ES3 strings
170
171
172 var _toIobject = function (it) {
173 return _iobject(_defined(it));
174 };
175
176 var hasOwnProperty = {}.hasOwnProperty;
177 var _has = function (it, key) {
178 return hasOwnProperty.call(it, key);
179 };
180
181 var _functionToString = _shared('native-function-to-string', Function.toString);
182
183 var _redefine = createCommonjsModule(function (module) {
184 var SRC = _uid('src');
185
186 var TO_STRING = 'toString';
187 var TPL = ('' + _functionToString).split(TO_STRING);
188
189 _core.inspectSource = function (it) {
190 return _functionToString.call(it);
191 };
192
193 (module.exports = function (O, key, val, safe) {
194 var isFunction = typeof val == 'function';
195 if (isFunction) _has(val, 'name') || _hide(val, 'name', key);
196 if (O[key] === val) return;
197 if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
198 if (O === _global) {
199 O[key] = val;
200 } else if (!safe) {
201 delete O[key];
202 _hide(O, key, val);
203 } else if (O[key]) {
204 O[key] = val;
205 } else {
206 _hide(O, key, val);
207 }
208 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
209 })(Function.prototype, TO_STRING, function toString() {
210 return typeof this == 'function' && this[SRC] || _functionToString.call(this);
211 });
212 });
213
214 var _aFunction = function (it) {
215 if (typeof it != 'function') throw TypeError(it + ' is not a function!');
216 return it;
217 };
218
219 // optional / simple context binding
220
221 var _ctx = function (fn, that, length) {
222 _aFunction(fn);
223 if (that === undefined) return fn;
224 switch (length) {
225 case 1: return function (a) {
226 return fn.call(that, a);
227 };
228 case 2: return function (a, b) {
229 return fn.call(that, a, b);
230 };
231 case 3: return function (a, b, c) {
232 return fn.call(that, a, b, c);
233 };
234 }
235 return function (/* ...args */) {
236 return fn.apply(that, arguments);
237 };
238 };
239
240 var PROTOTYPE = 'prototype';
241
242 var $export = function (type, name, source) {
243 var IS_FORCED = type & $export.F;
244 var IS_GLOBAL = type & $export.G;
245 var IS_STATIC = type & $export.S;
246 var IS_PROTO = type & $export.P;
247 var IS_BIND = type & $export.B;
248 var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
249 var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
250 var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
251 var key, own, out, exp;
252 if (IS_GLOBAL) source = name;
253 for (key in source) {
254 // contains in native
255 own = !IS_FORCED && target && target[key] !== undefined;
256 // export native or passed
257 out = (own ? target : source)[key];
258 // bind timers to global for call from export context
259 exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
260 // extend global
261 if (target) _redefine(target, key, out, type & $export.U);
262 // export
263 if (exports[key] != out) _hide(exports, key, exp);
264 if (IS_PROTO && expProto[key] != out) expProto[key] = out;
265 }
266 };
267 _global.core = _core;
268 // type bitmap
269 $export.F = 1; // forced
270 $export.G = 2; // global
271 $export.S = 4; // static
272 $export.P = 8; // proto
273 $export.B = 16; // bind
274 $export.W = 32; // wrap
275 $export.U = 64; // safe
276 $export.R = 128; // real proto method for `library`
277 var _export = $export;
278
279 // 7.1.4 ToInteger
280 var ceil = Math.ceil;
281 var floor = Math.floor;
282 var _toInteger = function (it) {
283 return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
284 };
285
286 // 7.1.15 ToLength
287
288 var min = Math.min;
289 var _toLength = function (it) {
290 return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
291 };
292
293 var max = Math.max;
294 var min$1 = Math.min;
295 var _toAbsoluteIndex = function (index, length) {
296 index = _toInteger(index);
297 return index < 0 ? max(index + length, 0) : min$1(index, length);
298 };
299
300 // false -> Array#indexOf
301 // true -> Array#includes
302
303
304
305 var _arrayIncludes = function (IS_INCLUDES) {
306 return function ($this, el, fromIndex) {
307 var O = _toIobject($this);
308 var length = _toLength(O.length);
309 var index = _toAbsoluteIndex(fromIndex, length);
310 var value;
311 // Array#includes uses SameValueZero equality algorithm
312 // eslint-disable-next-line no-self-compare
313 if (IS_INCLUDES && el != el) while (length > index) {
314 value = O[index++];
315 // eslint-disable-next-line no-self-compare
316 if (value != value) return true;
317 // Array#indexOf ignores holes, Array#includes - not
318 } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
319 if (O[index] === el) return IS_INCLUDES || index || 0;
320 } return !IS_INCLUDES && -1;
321 };
322 };
323
324 var shared = _shared('keys');
325
326 var _sharedKey = function (key) {
327 return shared[key] || (shared[key] = _uid(key));
328 };
329
330 var arrayIndexOf = _arrayIncludes(false);
331 var IE_PROTO = _sharedKey('IE_PROTO');
332
333 var _objectKeysInternal = function (object, names) {
334 var O = _toIobject(object);
335 var i = 0;
336 var result = [];
337 var key;
338 for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
339 // Don't enum bug & hidden keys
340 while (names.length > i) if (_has(O, key = names[i++])) {
341 ~arrayIndexOf(result, key) || result.push(key);
342 }
343 return result;
344 };
345
346 // IE 8- don't enum bug keys
347 var _enumBugKeys = (
348 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
349 ).split(',');
350
351 // 19.1.2.14 / 15.2.3.14 Object.keys(O)
352
353
354
355 var _objectKeys = Object.keys || function keys(O) {
356 return _objectKeysInternal(O, _enumBugKeys);
357 };
358
359 var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
360 _anObject(O);
361 var keys = _objectKeys(Properties);
362 var length = keys.length;
363 var i = 0;
364 var P;
365 while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
366 return O;
367 };
368
369 var document$2 = _global.document;
370 var _html = document$2 && document$2.documentElement;
371
372 // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
373
374
375
376 var IE_PROTO$1 = _sharedKey('IE_PROTO');
377 var Empty = function () { /* empty */ };
378 var PROTOTYPE$1 = 'prototype';
379
380 // Create object with fake `null` prototype: use iframe Object with cleared prototype
381 var createDict = function () {
382 // Thrash, waste and sodomy: IE GC bug
383 var iframe = _domCreate('iframe');
384 var i = _enumBugKeys.length;
385 var lt = '<';
386 var gt = '>';
387 var iframeDocument;
388 iframe.style.display = 'none';
389 _html.appendChild(iframe);
390 iframe.src = 'javascript:'; // eslint-disable-line no-script-url
391 // createDict = iframe.contentWindow.Object;
392 // html.removeChild(iframe);
393 iframeDocument = iframe.contentWindow.document;
394 iframeDocument.open();
395 iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
396 iframeDocument.close();
397 createDict = iframeDocument.F;
398 while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
399 return createDict();
400 };
401
402 var _objectCreate = Object.create || function create(O, Properties) {
403 var result;
404 if (O !== null) {
405 Empty[PROTOTYPE$1] = _anObject(O);
406 result = new Empty();
407 Empty[PROTOTYPE$1] = null;
408 // add "__proto__" for Object.getPrototypeOf polyfill
409 result[IE_PROTO$1] = O;
410 } else result = createDict();
411 return Properties === undefined ? result : _objectDps(result, Properties);
412 };
413
414 var def = _objectDp.f;
415
416 var TAG = _wks('toStringTag');
417
418 var _setToStringTag = function (it, tag, stat) {
419 if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
420 };
421
422 var IteratorPrototype = {};
423
424 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
425 _hide(IteratorPrototype, _wks('iterator'), function () { return this; });
426
427 var _iterCreate = function (Constructor, NAME, next) {
428 Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) });
429 _setToStringTag(Constructor, NAME + ' Iterator');
430 };
431
432 // 7.1.13 ToObject(argument)
433
434 var _toObject = function (it) {
435 return Object(_defined(it));
436 };
437
438 // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
439
440
441 var IE_PROTO$2 = _sharedKey('IE_PROTO');
442 var ObjectProto = Object.prototype;
443
444 var _objectGpo = Object.getPrototypeOf || function (O) {
445 O = _toObject(O);
446 if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
447 if (typeof O.constructor == 'function' && O instanceof O.constructor) {
448 return O.constructor.prototype;
449 } return O instanceof Object ? ObjectProto : null;
450 };
451
452 var ITERATOR = _wks('iterator');
453 var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
454 var FF_ITERATOR = '@@iterator';
455 var KEYS = 'keys';
456 var VALUES = 'values';
457
458 var returnThis = function () { return this; };
459
460 var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
461 _iterCreate(Constructor, NAME, next);
462 var getMethod = function (kind) {
463 if (!BUGGY && kind in proto) return proto[kind];
464 switch (kind) {
465 case KEYS: return function keys() { return new Constructor(this, kind); };
466 case VALUES: return function values() { return new Constructor(this, kind); };
467 } return function entries() { return new Constructor(this, kind); };
468 };
469 var TAG = NAME + ' Iterator';
470 var DEF_VALUES = DEFAULT == VALUES;
471 var VALUES_BUG = false;
472 var proto = Base.prototype;
473 var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
474 var $default = $native || getMethod(DEFAULT);
475 var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
476 var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
477 var methods, key, IteratorPrototype;
478 // Fix native
479 if ($anyNative) {
480 IteratorPrototype = _objectGpo($anyNative.call(new Base()));
481 if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
482 // Set @@toStringTag to native iterators
483 _setToStringTag(IteratorPrototype, TAG, true);
484 // fix for some old engines
485 if ( typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis);
486 }
487 }
488 // fix Array#{values, @@iterator}.name in V8 / FF
489 if (DEF_VALUES && $native && $native.name !== VALUES) {
490 VALUES_BUG = true;
491 $default = function values() { return $native.call(this); };
492 }
493 // Define iterator
494 if ( (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
495 _hide(proto, ITERATOR, $default);
496 }
497 // Plug for library
498 _iterators[NAME] = $default;
499 _iterators[TAG] = returnThis;
500 if (DEFAULT) {
501 methods = {
502 values: DEF_VALUES ? $default : getMethod(VALUES),
503 keys: IS_SET ? $default : getMethod(KEYS),
504 entries: $entries
505 };
506 if (FORCED) for (key in methods) {
507 if (!(key in proto)) _redefine(proto, key, methods[key]);
508 } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
509 }
510 return methods;
511 };
512
513 // 22.1.3.4 Array.prototype.entries()
514 // 22.1.3.13 Array.prototype.keys()
515 // 22.1.3.29 Array.prototype.values()
516 // 22.1.3.30 Array.prototype[@@iterator]()
517 var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) {
518 this._t = _toIobject(iterated); // target
519 this._i = 0; // next index
520 this._k = kind; // kind
521 // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
522 }, function () {
523 var O = this._t;
524 var kind = this._k;
525 var index = this._i++;
526 if (!O || index >= O.length) {
527 this._t = undefined;
528 return _iterStep(1);
529 }
530 if (kind == 'keys') return _iterStep(0, index);
531 if (kind == 'values') return _iterStep(0, O[index]);
532 return _iterStep(0, [index, O[index]]);
533 }, 'values');
534
535 // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
536 _iterators.Arguments = _iterators.Array;
537
538 _addToUnscopables('keys');
539 _addToUnscopables('values');
540 _addToUnscopables('entries');
541
542 var ITERATOR$1 = _wks('iterator');
543 var TO_STRING_TAG = _wks('toStringTag');
544 var ArrayValues = _iterators.Array;
545
546 var DOMIterables = {
547 CSSRuleList: true, // TODO: Not spec compliant, should be false.
548 CSSStyleDeclaration: false,
549 CSSValueList: false,
550 ClientRectList: false,
551 DOMRectList: false,
552 DOMStringList: false,
553 DOMTokenList: true,
554 DataTransferItemList: false,
555 FileList: false,
556 HTMLAllCollection: false,
557 HTMLCollection: false,
558 HTMLFormElement: false,
559 HTMLSelectElement: false,
560 MediaList: true, // TODO: Not spec compliant, should be false.
561 MimeTypeArray: false,
562 NamedNodeMap: false,
563 NodeList: true,
564 PaintRequestList: false,
565 Plugin: false,
566 PluginArray: false,
567 SVGLengthList: false,
568 SVGNumberList: false,
569 SVGPathSegList: false,
570 SVGPointList: false,
571 SVGStringList: false,
572 SVGTransformList: false,
573 SourceBufferList: false,
574 StyleSheetList: true, // TODO: Not spec compliant, should be false.
575 TextTrackCueList: false,
576 TextTrackList: false,
577 TouchList: false
578 };
579
580 for (var collections = _objectKeys(DOMIterables), i = 0; i < collections.length; i++) {
581 var NAME = collections[i];
582 var explicit = DOMIterables[NAME];
583 var Collection = _global[NAME];
584 var proto = Collection && Collection.prototype;
585 var key;
586 if (proto) {
587 if (!proto[ITERATOR$1]) _hide(proto, ITERATOR$1, ArrayValues);
588 if (!proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME);
589 _iterators[NAME] = ArrayValues;
590 if (explicit) for (key in es6_array_iterator) if (!proto[key]) _redefine(proto, key, es6_array_iterator[key], true);
591 }
592 }
593
594 // true -> String#at
595 // false -> String#codePointAt
596 var _stringAt = function (TO_STRING) {
597 return function (that, pos) {
598 var s = String(_defined(that));
599 var i = _toInteger(pos);
600 var l = s.length;
601 var a, b;
602 if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
603 a = s.charCodeAt(i);
604 return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
605 ? TO_STRING ? s.charAt(i) : a
606 : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
607 };
608 };
609
610 var $at = _stringAt(true);
611
612 // 21.1.3.27 String.prototype[@@iterator]()
613 _iterDefine(String, 'String', function (iterated) {
614 this._t = String(iterated); // target
615 this._i = 0; // next index
616 // 21.1.5.2.1 %StringIteratorPrototype%.next()
617 }, function () {
618 var O = this._t;
619 var index = this._i;
620 var point;
621 if (index >= O.length) return { value: undefined, done: true };
622 point = $at(O, index);
623 this._i += point.length;
624 return { value: point, done: false };
625 });
626
627 // getting tag from 19.1.3.6 Object.prototype.toString()
628
629 var TAG$1 = _wks('toStringTag');
630 // ES3 wrong here
631 var ARG = _cof(function () { return arguments; }()) == 'Arguments';
632
633 // fallback for IE11 Script Access Denied error
634 var tryGet = function (it, key) {
635 try {
636 return it[key];
637 } catch (e) { /* empty */ }
638 };
639
640 var _classof = function (it) {
641 var O, T, B;
642 return it === undefined ? 'Undefined' : it === null ? 'Null'
643 // @@toStringTag case
644 : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
645 // builtinTag case
646 : ARG ? _cof(O)
647 // ES3 arguments fallback
648 : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
649 };
650
651 var _anInstance = function (it, Constructor, name, forbiddenField) {
652 if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
653 throw TypeError(name + ': incorrect invocation!');
654 } return it;
655 };
656
657 // call something on iterator step with safe closing on error
658
659 var _iterCall = function (iterator, fn, value, entries) {
660 try {
661 return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
662 // 7.4.6 IteratorClose(iterator, completion)
663 } catch (e) {
664 var ret = iterator['return'];
665 if (ret !== undefined) _anObject(ret.call(iterator));
666 throw e;
667 }
668 };
669
670 // check on default Array iterator
671
672 var ITERATOR$2 = _wks('iterator');
673 var ArrayProto$1 = Array.prototype;
674
675 var _isArrayIter = function (it) {
676 return it !== undefined && (_iterators.Array === it || ArrayProto$1[ITERATOR$2] === it);
677 };
678
679 var ITERATOR$3 = _wks('iterator');
680
681 var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
682 if (it != undefined) return it[ITERATOR$3]
683 || it['@@iterator']
684 || _iterators[_classof(it)];
685 };
686
687 var _forOf = createCommonjsModule(function (module) {
688 var BREAK = {};
689 var RETURN = {};
690 var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
691 var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable);
692 var f = _ctx(fn, that, entries ? 2 : 1);
693 var index = 0;
694 var length, step, iterator, result;
695 if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
696 // fast case for arrays with default iterator
697 if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {
698 result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
699 if (result === BREAK || result === RETURN) return result;
700 } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
701 result = _iterCall(iterator, f, step.value, entries);
702 if (result === BREAK || result === RETURN) return result;
703 }
704 };
705 exports.BREAK = BREAK;
706 exports.RETURN = RETURN;
707 });
708
709 // 7.3.20 SpeciesConstructor(O, defaultConstructor)
710
711
712 var SPECIES = _wks('species');
713 var _speciesConstructor = function (O, D) {
714 var C = _anObject(O).constructor;
715 var S;
716 return C === undefined || (S = _anObject(C)[SPECIES]) == undefined ? D : _aFunction(S);
717 };
718
719 // fast apply, http://jsperf.lnkit.com/fast-apply/5
720 var _invoke = function (fn, args, that) {
721 var un = that === undefined;
722 switch (args.length) {
723 case 0: return un ? fn()
724 : fn.call(that);
725 case 1: return un ? fn(args[0])
726 : fn.call(that, args[0]);
727 case 2: return un ? fn(args[0], args[1])
728 : fn.call(that, args[0], args[1]);
729 case 3: return un ? fn(args[0], args[1], args[2])
730 : fn.call(that, args[0], args[1], args[2]);
731 case 4: return un ? fn(args[0], args[1], args[2], args[3])
732 : fn.call(that, args[0], args[1], args[2], args[3]);
733 } return fn.apply(that, args);
734 };
735
736 var process = _global.process;
737 var setTask = _global.setImmediate;
738 var clearTask = _global.clearImmediate;
739 var MessageChannel = _global.MessageChannel;
740 var Dispatch = _global.Dispatch;
741 var counter = 0;
742 var queue = {};
743 var ONREADYSTATECHANGE = 'onreadystatechange';
744 var defer, channel, port;
745 var run = function () {
746 var id = +this;
747 // eslint-disable-next-line no-prototype-builtins
748 if (queue.hasOwnProperty(id)) {
749 var fn = queue[id];
750 delete queue[id];
751 fn();
752 }
753 };
754 var listener = function (event) {
755 run.call(event.data);
756 };
757 // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
758 if (!setTask || !clearTask) {
759 setTask = function setImmediate(fn) {
760 var args = [];
761 var i = 1;
762 while (arguments.length > i) args.push(arguments[i++]);
763 queue[++counter] = function () {
764 // eslint-disable-next-line no-new-func
765 _invoke(typeof fn == 'function' ? fn : Function(fn), args);
766 };
767 defer(counter);
768 return counter;
769 };
770 clearTask = function clearImmediate(id) {
771 delete queue[id];
772 };
773 // Node.js 0.8-
774 if (_cof(process) == 'process') {
775 defer = function (id) {
776 process.nextTick(_ctx(run, id, 1));
777 };
778 // Sphere (JS game engine) Dispatch API
779 } else if (Dispatch && Dispatch.now) {
780 defer = function (id) {
781 Dispatch.now(_ctx(run, id, 1));
782 };
783 // Browsers with MessageChannel, includes WebWorkers
784 } else if (MessageChannel) {
785 channel = new MessageChannel();
786 port = channel.port2;
787 channel.port1.onmessage = listener;
788 defer = _ctx(port.postMessage, port, 1);
789 // Browsers with postMessage, skip WebWorkers
790 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
791 } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) {
792 defer = function (id) {
793 _global.postMessage(id + '', '*');
794 };
795 _global.addEventListener('message', listener, false);
796 // IE8-
797 } else if (ONREADYSTATECHANGE in _domCreate('script')) {
798 defer = function (id) {
799 _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () {
800 _html.removeChild(this);
801 run.call(id);
802 };
803 };
804 // Rest old browsers
805 } else {
806 defer = function (id) {
807 setTimeout(_ctx(run, id, 1), 0);
808 };
809 }
810 }
811 var _task = {
812 set: setTask,
813 clear: clearTask
814 };
815
816 var macrotask = _task.set;
817 var Observer = _global.MutationObserver || _global.WebKitMutationObserver;
818 var process$1 = _global.process;
819 var Promise$1 = _global.Promise;
820 var isNode = _cof(process$1) == 'process';
821
822 var _microtask = function () {
823 var head, last, notify;
824
825 var flush = function () {
826 var parent, fn;
827 if (isNode && (parent = process$1.domain)) parent.exit();
828 while (head) {
829 fn = head.fn;
830 head = head.next;
831 try {
832 fn();
833 } catch (e) {
834 if (head) notify();
835 else last = undefined;
836 throw e;
837 }
838 } last = undefined;
839 if (parent) parent.enter();
840 };
841
842 // Node.js
843 if (isNode) {
844 notify = function () {
845 process$1.nextTick(flush);
846 };
847 // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
848 } else if (Observer && !(_global.navigator && _global.navigator.standalone)) {
849 var toggle = true;
850 var node = document.createTextNode('');
851 new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
852 notify = function () {
853 node.data = toggle = !toggle;
854 };
855 // environments with maybe non-completely correct, but existent Promise
856 } else if (Promise$1 && Promise$1.resolve) {
857 // Promise.resolve without an argument throws an error in LG WebOS 2
858 var promise = Promise$1.resolve(undefined);
859 notify = function () {
860 promise.then(flush);
861 };
862 // for other environments - macrotask based on:
863 // - setImmediate
864 // - MessageChannel
865 // - window.postMessag
866 // - onreadystatechange
867 // - setTimeout
868 } else {
869 notify = function () {
870 // strange IE + webpack dev server bug - use .call(global)
871 macrotask.call(_global, flush);
872 };
873 }
874
875 return function (fn) {
876 var task = { fn: fn, next: undefined };
877 if (last) last.next = task;
878 if (!head) {
879 head = task;
880 notify();
881 } last = task;
882 };
883 };
884
885 // 25.4.1.5 NewPromiseCapability(C)
886
887
888 function PromiseCapability(C) {
889 var resolve, reject;
890 this.promise = new C(function ($$resolve, $$reject) {
891 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
892 resolve = $$resolve;
893 reject = $$reject;
894 });
895 this.resolve = _aFunction(resolve);
896 this.reject = _aFunction(reject);
897 }
898
899 var f$1 = function (C) {
900 return new PromiseCapability(C);
901 };
902
903 var _newPromiseCapability = {
904 f: f$1
905 };
906
907 var _perform = function (exec) {
908 try {
909 return { e: false, v: exec() };
910 } catch (e) {
911 return { e: true, v: e };
912 }
913 };
914
915 var navigator = _global.navigator;
916
917 var _userAgent = navigator && navigator.userAgent || '';
918
919 var _promiseResolve = function (C, x) {
920 _anObject(C);
921 if (_isObject(x) && x.constructor === C) return x;
922 var promiseCapability = _newPromiseCapability.f(C);
923 var resolve = promiseCapability.resolve;
924 resolve(x);
925 return promiseCapability.promise;
926 };
927
928 var _redefineAll = function (target, src, safe) {
929 for (var key in src) _redefine(target, key, src[key], safe);
930 return target;
931 };
932
933 var SPECIES$1 = _wks('species');
934
935 var _setSpecies = function (KEY) {
936 var C = _global[KEY];
937 if (_descriptors && C && !C[SPECIES$1]) _objectDp.f(C, SPECIES$1, {
938 configurable: true,
939 get: function () { return this; }
940 });
941 };
942
943 var ITERATOR$4 = _wks('iterator');
944 var SAFE_CLOSING = false;
945
946 try {
947 var riter = [7][ITERATOR$4]();
948 riter['return'] = function () { SAFE_CLOSING = true; };
949 // eslint-disable-next-line no-throw-literal
950 Array.from(riter, function () { throw 2; });
951 } catch (e) { /* empty */ }
952
953 var _iterDetect = function (exec, skipClosing) {
954 if (!skipClosing && !SAFE_CLOSING) return false;
955 var safe = false;
956 try {
957 var arr = [7];
958 var iter = arr[ITERATOR$4]();
959 iter.next = function () { return { done: safe = true }; };
960 arr[ITERATOR$4] = function () { return iter; };
961 exec(arr);
962 } catch (e) { /* empty */ }
963 return safe;
964 };
965
966 var task = _task.set;
967 var microtask = _microtask();
968
969
970
971
972 var PROMISE = 'Promise';
973 var TypeError$1 = _global.TypeError;
974 var process$2 = _global.process;
975 var versions = process$2 && process$2.versions;
976 var v8 = versions && versions.v8 || '';
977 var $Promise = _global[PROMISE];
978 var isNode$1 = _classof(process$2) == 'process';
979 var empty = function () { /* empty */ };
980 var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
981 var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f;
982
983 var USE_NATIVE = !!function () {
984 try {
985 // correct subclassing with @@species support
986 var promise = $Promise.resolve(1);
987 var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) {
988 exec(empty, empty);
989 };
990 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
991 return (isNode$1 || typeof PromiseRejectionEvent == 'function')
992 && promise.then(empty) instanceof FakePromise
993 // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
994 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
995 // we can't detect it synchronously, so just check versions
996 && v8.indexOf('6.6') !== 0
997 && _userAgent.indexOf('Chrome/66') === -1;
998 } catch (e) { /* empty */ }
999 }();
1000
1001 // helpers
1002 var isThenable = function (it) {
1003 var then;
1004 return _isObject(it) && typeof (then = it.then) == 'function' ? then : false;
1005 };
1006 var notify = function (promise, isReject) {
1007 if (promise._n) return;
1008 promise._n = true;
1009 var chain = promise._c;
1010 microtask(function () {
1011 var value = promise._v;
1012 var ok = promise._s == 1;
1013 var i = 0;
1014 var run = function (reaction) {
1015 var handler = ok ? reaction.ok : reaction.fail;
1016 var resolve = reaction.resolve;
1017 var reject = reaction.reject;
1018 var domain = reaction.domain;
1019 var result, then, exited;
1020 try {
1021 if (handler) {
1022 if (!ok) {
1023 if (promise._h == 2) onHandleUnhandled(promise);
1024 promise._h = 1;
1025 }
1026 if (handler === true) result = value;
1027 else {
1028 if (domain) domain.enter();
1029 result = handler(value); // may throw
1030 if (domain) {
1031 domain.exit();
1032 exited = true;
1033 }
1034 }
1035 if (result === reaction.promise) {
1036 reject(TypeError$1('Promise-chain cycle'));
1037 } else if (then = isThenable(result)) {
1038 then.call(result, resolve, reject);
1039 } else resolve(result);
1040 } else reject(value);
1041 } catch (e) {
1042 if (domain && !exited) domain.exit();
1043 reject(e);
1044 }
1045 };
1046 while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
1047 promise._c = [];
1048 promise._n = false;
1049 if (isReject && !promise._h) onUnhandled(promise);
1050 });
1051 };
1052 var onUnhandled = function (promise) {
1053 task.call(_global, function () {
1054 var value = promise._v;
1055 var unhandled = isUnhandled(promise);
1056 var result, handler, console;
1057 if (unhandled) {
1058 result = _perform(function () {
1059 if (isNode$1) {
1060 process$2.emit('unhandledRejection', value, promise);
1061 } else if (handler = _global.onunhandledrejection) {
1062 handler({ promise: promise, reason: value });
1063 } else if ((console = _global.console) && console.error) {
1064 console.error('Unhandled promise rejection', value);
1065 }
1066 });
1067 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
1068 promise._h = isNode$1 || isUnhandled(promise) ? 2 : 1;
1069 } promise._a = undefined;
1070 if (unhandled && result.e) throw result.v;
1071 });
1072 };
1073 var isUnhandled = function (promise) {
1074 return promise._h !== 1 && (promise._a || promise._c).length === 0;
1075 };
1076 var onHandleUnhandled = function (promise) {
1077 task.call(_global, function () {
1078 var handler;
1079 if (isNode$1) {
1080 process$2.emit('rejectionHandled', promise);
1081 } else if (handler = _global.onrejectionhandled) {
1082 handler({ promise: promise, reason: promise._v });
1083 }
1084 });
1085 };
1086 var $reject = function (value) {
1087 var promise = this;
1088 if (promise._d) return;
1089 promise._d = true;
1090 promise = promise._w || promise; // unwrap
1091 promise._v = value;
1092 promise._s = 2;
1093 if (!promise._a) promise._a = promise._c.slice();
1094 notify(promise, true);
1095 };
1096 var $resolve = function (value) {
1097 var promise = this;
1098 var then;
1099 if (promise._d) return;
1100 promise._d = true;
1101 promise = promise._w || promise; // unwrap
1102 try {
1103 if (promise === value) throw TypeError$1("Promise can't be resolved itself");
1104 if (then = isThenable(value)) {
1105 microtask(function () {
1106 var wrapper = { _w: promise, _d: false }; // wrap
1107 try {
1108 then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1));
1109 } catch (e) {
1110 $reject.call(wrapper, e);
1111 }
1112 });
1113 } else {
1114 promise._v = value;
1115 promise._s = 1;
1116 notify(promise, false);
1117 }
1118 } catch (e) {
1119 $reject.call({ _w: promise, _d: false }, e); // wrap
1120 }
1121 };
1122
1123 // constructor polyfill
1124 if (!USE_NATIVE) {
1125 // 25.4.3.1 Promise(executor)
1126 $Promise = function Promise(executor) {
1127 _anInstance(this, $Promise, PROMISE, '_h');
1128 _aFunction(executor);
1129 Internal.call(this);
1130 try {
1131 executor(_ctx($resolve, this, 1), _ctx($reject, this, 1));
1132 } catch (err) {
1133 $reject.call(this, err);
1134 }
1135 };
1136 // eslint-disable-next-line no-unused-vars
1137 Internal = function Promise(executor) {
1138 this._c = []; // <- awaiting reactions
1139 this._a = undefined; // <- checked in isUnhandled reactions
1140 this._s = 0; // <- state
1141 this._d = false; // <- done
1142 this._v = undefined; // <- value
1143 this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
1144 this._n = false; // <- notify
1145 };
1146 Internal.prototype = _redefineAll($Promise.prototype, {
1147 // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
1148 then: function then(onFulfilled, onRejected) {
1149 var reaction = newPromiseCapability(_speciesConstructor(this, $Promise));
1150 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
1151 reaction.fail = typeof onRejected == 'function' && onRejected;
1152 reaction.domain = isNode$1 ? process$2.domain : undefined;
1153 this._c.push(reaction);
1154 if (this._a) this._a.push(reaction);
1155 if (this._s) notify(this, false);
1156 return reaction.promise;
1157 },
1158 // 25.4.5.1 Promise.prototype.catch(onRejected)
1159 'catch': function (onRejected) {
1160 return this.then(undefined, onRejected);
1161 }
1162 });
1163 OwnPromiseCapability = function () {
1164 var promise = new Internal();
1165 this.promise = promise;
1166 this.resolve = _ctx($resolve, promise, 1);
1167 this.reject = _ctx($reject, promise, 1);
1168 };
1169 _newPromiseCapability.f = newPromiseCapability = function (C) {
1170 return C === $Promise || C === Wrapper
1171 ? new OwnPromiseCapability(C)
1172 : newGenericPromiseCapability(C);
1173 };
1174 }
1175
1176 _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Promise: $Promise });
1177 _setToStringTag($Promise, PROMISE);
1178 _setSpecies(PROMISE);
1179 Wrapper = _core[PROMISE];
1180
1181 // statics
1182 _export(_export.S + _export.F * !USE_NATIVE, PROMISE, {
1183 // 25.4.4.5 Promise.reject(r)
1184 reject: function reject(r) {
1185 var capability = newPromiseCapability(this);
1186 var $$reject = capability.reject;
1187 $$reject(r);
1188 return capability.promise;
1189 }
1190 });
1191 _export(_export.S + _export.F * ( !USE_NATIVE), PROMISE, {
1192 // 25.4.4.6 Promise.resolve(x)
1193 resolve: function resolve(x) {
1194 return _promiseResolve( this, x);
1195 }
1196 });
1197 _export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) {
1198 $Promise.all(iter)['catch'](empty);
1199 })), PROMISE, {
1200 // 25.4.4.1 Promise.all(iterable)
1201 all: function all(iterable) {
1202 var C = this;
1203 var capability = newPromiseCapability(C);
1204 var resolve = capability.resolve;
1205 var reject = capability.reject;
1206 var result = _perform(function () {
1207 var values = [];
1208 var index = 0;
1209 var remaining = 1;
1210 _forOf(iterable, false, function (promise) {
1211 var $index = index++;
1212 var alreadyCalled = false;
1213 values.push(undefined);
1214 remaining++;
1215 C.resolve(promise).then(function (value) {
1216 if (alreadyCalled) return;
1217 alreadyCalled = true;
1218 values[$index] = value;
1219 --remaining || resolve(values);
1220 }, reject);
1221 });
1222 --remaining || resolve(values);
1223 });
1224 if (result.e) reject(result.v);
1225 return capability.promise;
1226 },
1227 // 25.4.4.4 Promise.race(iterable)
1228 race: function race(iterable) {
1229 var C = this;
1230 var capability = newPromiseCapability(C);
1231 var reject = capability.reject;
1232 var result = _perform(function () {
1233 _forOf(iterable, false, function (promise) {
1234 C.resolve(promise).then(capability.resolve, reject);
1235 });
1236 });
1237 if (result.e) reject(result.v);
1238 return capability.promise;
1239 }
1240 });
1241
1242 // 19.1.3.6 Object.prototype.toString()
1243
1244 var test = {};
1245 test[_wks('toStringTag')] = 'z';
1246 if (test + '' != '[object z]') {
1247 _redefine(Object.prototype, 'toString', function toString() {
1248 return '[object ' + _classof(this) + ']';
1249 }, true);
1250 }
1251
1252 var f$2 = Object.getOwnPropertySymbols;
1253
1254 var _objectGops = {
1255 f: f$2
1256 };
1257
1258 var f$3 = {}.propertyIsEnumerable;
1259
1260 var _objectPie = {
1261 f: f$3
1262 };
1263
1264 // 19.1.2.1 Object.assign(target, source, ...)
1265
1266
1267
1268
1269
1270
1271 var $assign = Object.assign;
1272
1273 // should work with symbols and should have deterministic property order (V8 bug)
1274 var _objectAssign = !$assign || _fails(function () {
1275 var A = {};
1276 var B = {};
1277 // eslint-disable-next-line no-undef
1278 var S = Symbol();
1279 var K = 'abcdefghijklmnopqrst';
1280 A[S] = 7;
1281 K.split('').forEach(function (k) { B[k] = k; });
1282 return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
1283 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
1284 var T = _toObject(target);
1285 var aLen = arguments.length;
1286 var index = 1;
1287 var getSymbols = _objectGops.f;
1288 var isEnum = _objectPie.f;
1289 while (aLen > index) {
1290 var S = _iobject(arguments[index++]);
1291 var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
1292 var length = keys.length;
1293 var j = 0;
1294 var key;
1295 while (length > j) {
1296 key = keys[j++];
1297 if (!_descriptors || isEnum.call(S, key)) T[key] = S[key];
1298 }
1299 } return T;
1300 } : $assign;
1301
1302 // 19.1.3.1 Object.assign(target, source)
1303
1304
1305 _export(_export.S + _export.F, 'Object', { assign: _objectAssign });
1306
1307 function _classCallCheck(instance, Constructor) {
1308 if (!(instance instanceof Constructor)) {
1309 throw new TypeError("Cannot call a class as a function");
1310 }
1311 }
1312
1313 function _defineProperties(target, props) {
1314 for (var i = 0; i < props.length; i++) {
1315 var descriptor = props[i];
1316 descriptor.enumerable = descriptor.enumerable || false;
1317 descriptor.configurable = true;
1318 if ("value" in descriptor) descriptor.writable = true;
1319 Object.defineProperty(target, descriptor.key, descriptor);
1320 }
1321 }
1322
1323 function _createClass(Constructor, protoProps, staticProps) {
1324 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1325 if (staticProps) _defineProperties(Constructor, staticProps);
1326 return Constructor;
1327 }
1328
1329 function _inherits(subClass, superClass) {
1330 if (typeof superClass !== "function" && superClass !== null) {
1331 throw new TypeError("Super expression must either be null or a function");
1332 }
1333
1334 subClass.prototype = Object.create(superClass && superClass.prototype, {
1335 constructor: {
1336 value: subClass,
1337 writable: true,
1338 configurable: true
1339 }
1340 });
1341 if (superClass) _setPrototypeOf(subClass, superClass);
1342 }
1343
1344 function _getPrototypeOf(o) {
1345 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
1346 return o.__proto__ || Object.getPrototypeOf(o);
1347 };
1348 return _getPrototypeOf(o);
1349 }
1350
1351 function _setPrototypeOf(o, p) {
1352 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
1353 o.__proto__ = p;
1354 return o;
1355 };
1356
1357 return _setPrototypeOf(o, p);
1358 }
1359
1360 function isNativeReflectConstruct() {
1361 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1362 if (Reflect.construct.sham) return false;
1363 if (typeof Proxy === "function") return true;
1364
1365 try {
1366 Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
1367 return true;
1368 } catch (e) {
1369 return false;
1370 }
1371 }
1372
1373 function _construct(Parent, args, Class) {
1374 if (isNativeReflectConstruct()) {
1375 _construct = Reflect.construct;
1376 } else {
1377 _construct = function _construct(Parent, args, Class) {
1378 var a = [null];
1379 a.push.apply(a, args);
1380 var Constructor = Function.bind.apply(Parent, a);
1381 var instance = new Constructor();
1382 if (Class) _setPrototypeOf(instance, Class.prototype);
1383 return instance;
1384 };
1385 }
1386
1387 return _construct.apply(null, arguments);
1388 }
1389
1390 function _isNativeFunction(fn) {
1391 return Function.toString.call(fn).indexOf("[native code]") !== -1;
1392 }
1393
1394 function _wrapNativeSuper(Class) {
1395 var _cache = typeof Map === "function" ? new Map() : undefined;
1396
1397 _wrapNativeSuper = function _wrapNativeSuper(Class) {
1398 if (Class === null || !_isNativeFunction(Class)) return Class;
1399
1400 if (typeof Class !== "function") {
1401 throw new TypeError("Super expression must either be null or a function");
1402 }
1403
1404 if (typeof _cache !== "undefined") {
1405 if (_cache.has(Class)) return _cache.get(Class);
1406
1407 _cache.set(Class, Wrapper);
1408 }
1409
1410 function Wrapper() {
1411 return _construct(Class, arguments, _getPrototypeOf(this).constructor);
1412 }
1413
1414 Wrapper.prototype = Object.create(Class.prototype, {
1415 constructor: {
1416 value: Wrapper,
1417 enumerable: false,
1418 writable: true,
1419 configurable: true
1420 }
1421 });
1422 return _setPrototypeOf(Wrapper, Class);
1423 };
1424
1425 return _wrapNativeSuper(Class);
1426 }
1427
1428 function _assertThisInitialized(self) {
1429 if (self === void 0) {
1430 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1431 }
1432
1433 return self;
1434 }
1435
1436 function _possibleConstructorReturn(self, call) {
1437 if (call && (typeof call === "object" || typeof call === "function")) {
1438 return call;
1439 }
1440
1441 return _assertThisInitialized(self);
1442 }
1443
1444 function _superPropBase(object, property) {
1445 while (!Object.prototype.hasOwnProperty.call(object, property)) {
1446 object = _getPrototypeOf(object);
1447 if (object === null) break;
1448 }
1449
1450 return object;
1451 }
1452
1453 function _get(target, property, receiver) {
1454 if (typeof Reflect !== "undefined" && Reflect.get) {
1455 _get = Reflect.get;
1456 } else {
1457 _get = function _get(target, property, receiver) {
1458 var base = _superPropBase(target, property);
1459
1460 if (!base) return;
1461 var desc = Object.getOwnPropertyDescriptor(base, property);
1462
1463 if (desc.get) {
1464 return desc.get.call(receiver);
1465 }
1466
1467 return desc.value;
1468 };
1469 }
1470
1471 return _get(target, property, receiver || target);
1472 }
1473
1474 /**
1475 * Abortable Promise
1476 *
1477 * @author dondevi
1478 * @create 2019-05-27
1479 */
1480 var AbortablePromise =
1481 /*#__PURE__*/
1482 function (_Promise) {
1483 _inherits(AbortablePromise, _Promise);
1484
1485 function AbortablePromise(executor, abortController) {
1486 var _this;
1487
1488 _classCallCheck(this, AbortablePromise);
1489
1490 _this = _possibleConstructorReturn(this, _getPrototypeOf(AbortablePromise).call(this, function (resolve, reject) {
1491 if (!abortController) {
1492 abortController = getAbortController();
1493 }
1494
1495 executor(resolve, reject, abortController.signal);
1496 }));
1497 _this.abortController = abortController;
1498 return _this;
1499 }
1500
1501 _createClass(AbortablePromise, [{
1502 key: "then",
1503 value: function then(onFulfilled, onRejected) {
1504 var _this2 = this;
1505
1506 return new AbortablePromise(function (resolve, reject, signal) {
1507 var onSettled = function onSettled(status, value, callback) {
1508 if ("function" === typeof callback) {
1509 value = callback(value);
1510
1511 if (value instanceof AbortablePromise) {
1512 Object.assign(signal, value.abortController.signal);
1513 }
1514
1515 return resolve(value);
1516 }
1517
1518 "resolved" === status && resolve(value);
1519 "rejected" === status && reject(value);
1520 };
1521
1522 _get(_getPrototypeOf(AbortablePromise.prototype), "then", _this2).call(_this2, function (value) {
1523 return onSettled("resolved", value, onFulfilled);
1524 }, function (reason) {
1525 return onSettled("rejected", reason, onRejected);
1526 });
1527 }, this.abortController);
1528 } // Equivalent to this.then(undefined, onRejected)
1529 // catch (onRejected) {}
1530
1531 }, {
1532 key: "abort",
1533 value: function abort(reason) {
1534 var _this3 = this;
1535
1536 return new AbortablePromise(function (resolve, reject) {
1537 setTimeout(function () {
1538 _this3.abortController.abort(reason);
1539
1540 _this3.then(resolve, reject);
1541 });
1542 }, this.abortController);
1543 }
1544 }]);
1545
1546 return AbortablePromise;
1547 }(_wrapNativeSuper(Promise));
1548
1549 AbortablePromise.all = function (promises) {
1550 return new AbortablePromise(function (resolve, reject, signal) {
1551 signal.onabort = function (reason) {
1552 promises.forEach(function (promise) {
1553 if (promise instanceof AbortablePromise) {
1554 promise.abort(reason).catch(reject);
1555 }
1556 });
1557 reject(reason);
1558 };
1559
1560 Promise.all(promises).then(resolve, reject);
1561 });
1562 };
1563
1564 AbortablePromise.race = function (promises) {
1565 return new AbortablePromise(function (resolve, reject, signal) {
1566 signal.onabort = function (reason) {
1567 promises.forEach(function (promise) {
1568 if (promise instanceof AbortablePromise) {
1569 promise.abort(reason).catch(reject);
1570 }
1571 });
1572 reject(reason);
1573 };
1574
1575 Promise.race(promises).then(resolve, reject);
1576 });
1577 };
1578 /**
1579 * Custom AbortController
1580 *
1581 * @return {Object} abortController
1582 */
1583
1584
1585 function getAbortController() {
1586 var abortSignal = {
1587 aborted: false,
1588 onabort: null
1589 };
1590
1591 var abort = function abort(reason) {
1592 if (abortSignal.aborted) {
1593 return;
1594 }
1595
1596 var onabort = abortSignal.onabort;
1597 "function" === typeof onabort && onabort(reason);
1598 abortSignal.aborted = true;
1599 };
1600
1601 var abortController = {
1602 signal: abortSignal,
1603 abort: abort
1604 };
1605 return abortController;
1606 }
1607
1608 var src = AbortablePromise;
1609
1610 return src;
1611
1612}());