proto-sudoku-wc 0.0.482 → 0.0.484

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.
@@ -250,78 +250,85 @@ const createStore = (defaultState, shouldUpdate) => {
250
250
  return map;
251
251
  };
252
252
 
253
- function bind(fn, thisArg) {
253
+ var bind = function bind(fn, thisArg) {
254
254
  return function wrap() {
255
- return fn.apply(thisArg, arguments);
255
+ var args = new Array(arguments.length);
256
+ for (var i = 0; i < args.length; i++) {
257
+ args[i] = arguments[i];
258
+ }
259
+ return fn.apply(thisArg, args);
256
260
  };
257
- }
261
+ };
258
262
 
259
263
  // utils is a library of generic helper functions non-specific to axios
260
264
 
261
- const {toString} = Object.prototype;
262
- const {getPrototypeOf} = Object;
265
+ var toString = Object.prototype.toString;
263
266
 
264
- const kindOf = (cache => thing => {
265
- const str = toString.call(thing);
267
+ // eslint-disable-next-line func-names
268
+ var kindOf = (function(cache) {
269
+ // eslint-disable-next-line func-names
270
+ return function(thing) {
271
+ var str = toString.call(thing);
266
272
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
273
+ };
267
274
  })(Object.create(null));
268
275
 
269
- const kindOfTest = (type) => {
276
+ function kindOfTest(type) {
270
277
  type = type.toLowerCase();
271
- return (thing) => kindOf(thing) === type
272
- };
273
-
274
- const typeOfTest = type => thing => typeof thing === type;
278
+ return function isKindOf(thing) {
279
+ return kindOf(thing) === type;
280
+ };
281
+ }
275
282
 
276
283
  /**
277
284
  * Determine if a value is an Array
278
285
  *
279
286
  * @param {Object} val The value to test
280
- *
281
287
  * @returns {boolean} True if value is an Array, otherwise false
282
288
  */
283
- const {isArray} = Array;
289
+ function isArray(val) {
290
+ return Array.isArray(val);
291
+ }
284
292
 
285
293
  /**
286
294
  * Determine if a value is undefined
287
295
  *
288
- * @param {*} val The value to test
289
- *
296
+ * @param {Object} val The value to test
290
297
  * @returns {boolean} True if the value is undefined, otherwise false
291
298
  */
292
- const isUndefined = typeOfTest('undefined');
299
+ function isUndefined(val) {
300
+ return typeof val === 'undefined';
301
+ }
293
302
 
294
303
  /**
295
304
  * Determine if a value is a Buffer
296
305
  *
297
- * @param {*} val The value to test
298
- *
306
+ * @param {Object} val The value to test
299
307
  * @returns {boolean} True if value is a Buffer, otherwise false
300
308
  */
301
309
  function isBuffer(val) {
302
310
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
303
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
311
+ && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
304
312
  }
305
313
 
306
314
  /**
307
315
  * Determine if a value is an ArrayBuffer
308
316
  *
309
- * @param {*} val The value to test
310
- *
317
+ * @function
318
+ * @param {Object} val The value to test
311
319
  * @returns {boolean} True if value is an ArrayBuffer, otherwise false
312
320
  */
313
- const isArrayBuffer = kindOfTest('ArrayBuffer');
321
+ var isArrayBuffer = kindOfTest('ArrayBuffer');
314
322
 
315
323
 
316
324
  /**
317
325
  * Determine if a value is a view on an ArrayBuffer
318
326
  *
319
- * @param {*} val The value to test
320
- *
327
+ * @param {Object} val The value to test
321
328
  * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
322
329
  */
323
330
  function isArrayBufferView(val) {
324
- let result;
331
+ var result;
325
332
  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
326
333
  result = ArrayBuffer.isView(val);
327
334
  } else {
@@ -333,141 +340,163 @@ function isArrayBufferView(val) {
333
340
  /**
334
341
  * Determine if a value is a String
335
342
  *
336
- * @param {*} val The value to test
337
- *
343
+ * @param {Object} val The value to test
338
344
  * @returns {boolean} True if value is a String, otherwise false
339
345
  */
340
- const isString = typeOfTest('string');
341
-
342
- /**
343
- * Determine if a value is a Function
344
- *
345
- * @param {*} val The value to test
346
- * @returns {boolean} True if value is a Function, otherwise false
347
- */
348
- const isFunction = typeOfTest('function');
346
+ function isString(val) {
347
+ return typeof val === 'string';
348
+ }
349
349
 
350
350
  /**
351
351
  * Determine if a value is a Number
352
352
  *
353
- * @param {*} val The value to test
354
- *
353
+ * @param {Object} val The value to test
355
354
  * @returns {boolean} True if value is a Number, otherwise false
356
355
  */
357
- const isNumber = typeOfTest('number');
356
+ function isNumber(val) {
357
+ return typeof val === 'number';
358
+ }
358
359
 
359
360
  /**
360
361
  * Determine if a value is an Object
361
362
  *
362
- * @param {*} thing The value to test
363
- *
363
+ * @param {Object} val The value to test
364
364
  * @returns {boolean} True if value is an Object, otherwise false
365
365
  */
366
- const isObject = (thing) => thing !== null && typeof thing === 'object';
367
-
368
- /**
369
- * Determine if a value is a Boolean
370
- *
371
- * @param {*} thing The value to test
372
- * @returns {boolean} True if value is a Boolean, otherwise false
373
- */
374
- const isBoolean = thing => thing === true || thing === false;
366
+ function isObject(val) {
367
+ return val !== null && typeof val === 'object';
368
+ }
375
369
 
376
370
  /**
377
371
  * Determine if a value is a plain Object
378
372
  *
379
- * @param {*} val The value to test
380
- *
381
- * @returns {boolean} True if value is a plain Object, otherwise false
373
+ * @param {Object} val The value to test
374
+ * @return {boolean} True if value is a plain Object, otherwise false
382
375
  */
383
- const isPlainObject = (val) => {
376
+ function isPlainObject(val) {
384
377
  if (kindOf(val) !== 'object') {
385
378
  return false;
386
379
  }
387
380
 
388
- const prototype = getPrototypeOf(val);
381
+ var prototype = Object.getPrototypeOf(val);
389
382
  return prototype === null || prototype === Object.prototype;
390
- };
383
+ }
391
384
 
392
385
  /**
393
386
  * Determine if a value is a Date
394
387
  *
395
- * @param {*} val The value to test
396
- *
388
+ * @function
389
+ * @param {Object} val The value to test
397
390
  * @returns {boolean} True if value is a Date, otherwise false
398
391
  */
399
- const isDate = kindOfTest('Date');
392
+ var isDate = kindOfTest('Date');
400
393
 
401
394
  /**
402
395
  * Determine if a value is a File
403
396
  *
404
- * @param {*} val The value to test
405
- *
397
+ * @function
398
+ * @param {Object} val The value to test
406
399
  * @returns {boolean} True if value is a File, otherwise false
407
400
  */
408
- const isFile = kindOfTest('File');
401
+ var isFile = kindOfTest('File');
409
402
 
410
403
  /**
411
404
  * Determine if a value is a Blob
412
405
  *
413
- * @param {*} val The value to test
414
- *
406
+ * @function
407
+ * @param {Object} val The value to test
415
408
  * @returns {boolean} True if value is a Blob, otherwise false
416
409
  */
417
- const isBlob = kindOfTest('Blob');
410
+ var isBlob = kindOfTest('Blob');
418
411
 
419
412
  /**
420
413
  * Determine if a value is a FileList
421
414
  *
422
- * @param {*} val The value to test
423
- *
415
+ * @function
416
+ * @param {Object} val The value to test
424
417
  * @returns {boolean} True if value is a File, otherwise false
425
418
  */
426
- const isFileList = kindOfTest('FileList');
419
+ var isFileList = kindOfTest('FileList');
427
420
 
428
421
  /**
429
- * Determine if a value is a Stream
422
+ * Determine if a value is a Function
430
423
  *
431
- * @param {*} val The value to test
424
+ * @param {Object} val The value to test
425
+ * @returns {boolean} True if value is a Function, otherwise false
426
+ */
427
+ function isFunction(val) {
428
+ return toString.call(val) === '[object Function]';
429
+ }
430
+
431
+ /**
432
+ * Determine if a value is a Stream
432
433
  *
434
+ * @param {Object} val The value to test
433
435
  * @returns {boolean} True if value is a Stream, otherwise false
434
436
  */
435
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
437
+ function isStream(val) {
438
+ return isObject(val) && isFunction(val.pipe);
439
+ }
436
440
 
437
441
  /**
438
442
  * Determine if a value is a FormData
439
443
  *
440
- * @param {*} thing The value to test
441
- *
444
+ * @param {Object} thing The value to test
442
445
  * @returns {boolean} True if value is an FormData, otherwise false
443
446
  */
444
- const isFormData = (thing) => {
445
- const pattern = '[object FormData]';
447
+ function isFormData(thing) {
448
+ var pattern = '[object FormData]';
446
449
  return thing && (
447
450
  (typeof FormData === 'function' && thing instanceof FormData) ||
448
451
  toString.call(thing) === pattern ||
449
452
  (isFunction(thing.toString) && thing.toString() === pattern)
450
453
  );
451
- };
454
+ }
452
455
 
453
456
  /**
454
457
  * Determine if a value is a URLSearchParams object
455
- *
456
- * @param {*} val The value to test
457
- *
458
+ * @function
459
+ * @param {Object} val The value to test
458
460
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
459
461
  */
460
- const isURLSearchParams = kindOfTest('URLSearchParams');
462
+ var isURLSearchParams = kindOfTest('URLSearchParams');
461
463
 
462
464
  /**
463
465
  * Trim excess whitespace off the beginning and end of a string
464
466
  *
465
467
  * @param {String} str The String to trim
466
- *
467
468
  * @returns {String} The String freed of excess whitespace
468
469
  */
469
- const trim = (str) => str.trim ?
470
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
470
+ function trim(str) {
471
+ return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
472
+ }
473
+
474
+ /**
475
+ * Determine if we're running in a standard browser environment
476
+ *
477
+ * This allows axios to run in a web worker, and react-native.
478
+ * Both environments support XMLHttpRequest, but not fully standard globals.
479
+ *
480
+ * web workers:
481
+ * typeof window -> undefined
482
+ * typeof document -> undefined
483
+ *
484
+ * react-native:
485
+ * navigator.product -> 'ReactNative'
486
+ * nativescript
487
+ * navigator.product -> 'NativeScript' or 'NS'
488
+ */
489
+ function isStandardBrowserEnv() {
490
+ if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
491
+ navigator.product === 'NativeScript' ||
492
+ navigator.product === 'NS')) {
493
+ return false;
494
+ }
495
+ return (
496
+ typeof window !== 'undefined' &&
497
+ typeof document !== 'undefined'
498
+ );
499
+ }
471
500
 
472
501
  /**
473
502
  * Iterate over an Array or an Object invoking a function for each item.
@@ -480,19 +509,13 @@ const trim = (str) => str.trim ?
480
509
  *
481
510
  * @param {Object|Array} obj The object to iterate
482
511
  * @param {Function} fn The callback to invoke for each item
483
- *
484
- * @param {Boolean} [allOwnKeys = false]
485
- * @returns {void}
486
512
  */
487
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
513
+ function forEach(obj, fn) {
488
514
  // Don't bother if no value provided
489
515
  if (obj === null || typeof obj === 'undefined') {
490
516
  return;
491
517
  }
492
518
 
493
- let i;
494
- let l;
495
-
496
519
  // Force an array if not already something iterable
497
520
  if (typeof obj !== 'object') {
498
521
  /*eslint no-param-reassign:0*/
@@ -501,18 +524,15 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
501
524
 
502
525
  if (isArray(obj)) {
503
526
  // Iterate over array values
504
- for (i = 0, l = obj.length; i < l; i++) {
527
+ for (var i = 0, l = obj.length; i < l; i++) {
505
528
  fn.call(null, obj[i], i, obj);
506
529
  }
507
530
  } else {
508
531
  // Iterate over object keys
509
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
510
- const len = keys.length;
511
- let key;
512
-
513
- for (i = 0; i < len; i++) {
514
- key = keys[i];
515
- fn.call(null, obj[key], key, obj);
532
+ for (var key in obj) {
533
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
534
+ fn.call(null, obj[key], key, obj);
535
+ }
516
536
  }
517
537
  }
518
538
  }
@@ -532,12 +552,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
532
552
  * ```
533
553
  *
534
554
  * @param {Object} obj1 Object to merge
535
- *
536
555
  * @returns {Object} Result of all merge properties
537
556
  */
538
557
  function merge(/* obj1, obj2, obj3, ... */) {
539
- const result = {};
540
- const assignValue = (val, key) => {
558
+ var result = {};
559
+ function assignValue(val, key) {
541
560
  if (isPlainObject(result[key]) && isPlainObject(val)) {
542
561
  result[key] = merge(result[key], val);
543
562
  } else if (isPlainObject(val)) {
@@ -547,10 +566,10 @@ function merge(/* obj1, obj2, obj3, ... */) {
547
566
  } else {
548
567
  result[key] = val;
549
568
  }
550
- };
569
+ }
551
570
 
552
- for (let i = 0, l = arguments.length; i < l; i++) {
553
- arguments[i] && forEach(arguments[i], assignValue);
571
+ for (var i = 0, l = arguments.length; i < l; i++) {
572
+ forEach(arguments[i], assignValue);
554
573
  }
555
574
  return result;
556
575
  }
@@ -561,34 +580,31 @@ function merge(/* obj1, obj2, obj3, ... */) {
561
580
  * @param {Object} a The object to be extended
562
581
  * @param {Object} b The object to copy properties from
563
582
  * @param {Object} thisArg The object to bind function to
564
- *
565
- * @param {Boolean} [allOwnKeys]
566
- * @returns {Object} The resulting value of object a
583
+ * @return {Object} The resulting value of object a
567
584
  */
568
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
569
- forEach(b, (val, key) => {
570
- if (thisArg && isFunction(val)) {
585
+ function extend(a, b, thisArg) {
586
+ forEach(b, function assignValue(val, key) {
587
+ if (thisArg && typeof val === 'function') {
571
588
  a[key] = bind(val, thisArg);
572
589
  } else {
573
590
  a[key] = val;
574
591
  }
575
- }, {allOwnKeys});
592
+ });
576
593
  return a;
577
- };
594
+ }
578
595
 
579
596
  /**
580
597
  * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
581
598
  *
582
599
  * @param {string} content with BOM
583
- *
584
- * @returns {string} content value without BOM
600
+ * @return {string} content value without BOM
585
601
  */
586
- const stripBOM = (content) => {
602
+ function stripBOM(content) {
587
603
  if (content.charCodeAt(0) === 0xFEFF) {
588
604
  content = content.slice(1);
589
605
  }
590
606
  return content;
591
- };
607
+ }
592
608
 
593
609
  /**
594
610
  * Inherit the prototype methods from one constructor into another
@@ -596,274 +612,246 @@ const stripBOM = (content) => {
596
612
  * @param {function} superConstructor
597
613
  * @param {object} [props]
598
614
  * @param {object} [descriptors]
599
- *
600
- * @returns {void}
601
615
  */
602
- const inherits = (constructor, superConstructor, props, descriptors) => {
616
+
617
+ function inherits(constructor, superConstructor, props, descriptors) {
603
618
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
604
619
  constructor.prototype.constructor = constructor;
605
- Object.defineProperty(constructor, 'super', {
606
- value: superConstructor.prototype
607
- });
608
620
  props && Object.assign(constructor.prototype, props);
609
- };
621
+ }
610
622
 
611
623
  /**
612
624
  * Resolve object with deep prototype chain to a flat object
613
625
  * @param {Object} sourceObj source object
614
626
  * @param {Object} [destObj]
615
- * @param {Function|Boolean} [filter]
616
- * @param {Function} [propFilter]
617
- *
627
+ * @param {Function} [filter]
618
628
  * @returns {Object}
619
629
  */
620
- const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
621
- let props;
622
- let i;
623
- let prop;
624
- const merged = {};
630
+
631
+ function toFlatObject(sourceObj, destObj, filter) {
632
+ var props;
633
+ var i;
634
+ var prop;
635
+ var merged = {};
625
636
 
626
637
  destObj = destObj || {};
627
- // eslint-disable-next-line no-eq-null,eqeqeq
628
- if (sourceObj == null) return destObj;
629
638
 
630
639
  do {
631
640
  props = Object.getOwnPropertyNames(sourceObj);
632
641
  i = props.length;
633
642
  while (i-- > 0) {
634
643
  prop = props[i];
635
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
644
+ if (!merged[prop]) {
636
645
  destObj[prop] = sourceObj[prop];
637
646
  merged[prop] = true;
638
647
  }
639
648
  }
640
- sourceObj = filter !== false && getPrototypeOf(sourceObj);
649
+ sourceObj = Object.getPrototypeOf(sourceObj);
641
650
  } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
642
651
 
643
652
  return destObj;
644
- };
653
+ }
645
654
 
646
- /**
647
- * Determines whether a string ends with the characters of a specified string
648
- *
655
+ /*
656
+ * determines whether a string ends with the characters of a specified string
649
657
  * @param {String} str
650
658
  * @param {String} searchString
651
659
  * @param {Number} [position= 0]
652
- *
653
660
  * @returns {boolean}
654
661
  */
655
- const endsWith = (str, searchString, position) => {
662
+ function endsWith(str, searchString, position) {
656
663
  str = String(str);
657
664
  if (position === undefined || position > str.length) {
658
665
  position = str.length;
659
666
  }
660
667
  position -= searchString.length;
661
- const lastIndex = str.indexOf(searchString, position);
668
+ var lastIndex = str.indexOf(searchString, position);
662
669
  return lastIndex !== -1 && lastIndex === position;
663
- };
670
+ }
664
671
 
665
672
 
666
673
  /**
667
- * Returns new array from array like object or null if failed
668
- *
674
+ * Returns new array from array like object
669
675
  * @param {*} [thing]
670
- *
671
- * @returns {?Array}
676
+ * @returns {Array}
672
677
  */
673
- const toArray = (thing) => {
678
+ function toArray(thing) {
674
679
  if (!thing) return null;
675
- if (isArray(thing)) return thing;
676
- let i = thing.length;
677
- if (!isNumber(i)) return null;
678
- const arr = new Array(i);
680
+ var i = thing.length;
681
+ if (isUndefined(i)) return null;
682
+ var arr = new Array(i);
679
683
  while (i-- > 0) {
680
684
  arr[i] = thing[i];
681
685
  }
682
686
  return arr;
683
- };
687
+ }
684
688
 
685
- /**
686
- * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
687
- * thing passed in is an instance of Uint8Array
688
- *
689
- * @param {TypedArray}
690
- *
691
- * @returns {Array}
692
- */
693
689
  // eslint-disable-next-line func-names
694
- const isTypedArray = (TypedArray => {
690
+ var isTypedArray = (function(TypedArray) {
695
691
  // eslint-disable-next-line func-names
696
- return thing => {
692
+ return function(thing) {
697
693
  return TypedArray && thing instanceof TypedArray;
698
694
  };
699
- })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
695
+ })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
696
+
697
+ var utils = {
698
+ isArray: isArray,
699
+ isArrayBuffer: isArrayBuffer,
700
+ isBuffer: isBuffer,
701
+ isFormData: isFormData,
702
+ isArrayBufferView: isArrayBufferView,
703
+ isString: isString,
704
+ isNumber: isNumber,
705
+ isObject: isObject,
706
+ isPlainObject: isPlainObject,
707
+ isUndefined: isUndefined,
708
+ isDate: isDate,
709
+ isFile: isFile,
710
+ isBlob: isBlob,
711
+ isFunction: isFunction,
712
+ isStream: isStream,
713
+ isURLSearchParams: isURLSearchParams,
714
+ isStandardBrowserEnv: isStandardBrowserEnv,
715
+ forEach: forEach,
716
+ merge: merge,
717
+ extend: extend,
718
+ trim: trim,
719
+ stripBOM: stripBOM,
720
+ inherits: inherits,
721
+ toFlatObject: toFlatObject,
722
+ kindOf: kindOf,
723
+ kindOfTest: kindOfTest,
724
+ endsWith: endsWith,
725
+ toArray: toArray,
726
+ isTypedArray: isTypedArray,
727
+ isFileList: isFileList
728
+ };
729
+
730
+ function encode(val) {
731
+ return encodeURIComponent(val).
732
+ replace(/%3A/gi, ':').
733
+ replace(/%24/g, '$').
734
+ replace(/%2C/gi, ',').
735
+ replace(/%20/g, '+').
736
+ replace(/%5B/gi, '[').
737
+ replace(/%5D/gi, ']');
738
+ }
700
739
 
701
740
  /**
702
- * For each entry in the object, call the function with the key and value.
703
- *
704
- * @param {Object<any, any>} obj - The object to iterate over.
705
- * @param {Function} fn - The function to call for each entry.
741
+ * Build a URL by appending params to the end
706
742
  *
707
- * @returns {void}
743
+ * @param {string} url The base of the url (e.g., http://www.google.com)
744
+ * @param {object} [params] The params to be appended
745
+ * @returns {string} The formatted url
708
746
  */
709
- const forEachEntry = (obj, fn) => {
710
- const generator = obj && obj[Symbol.iterator];
747
+ var buildURL = function buildURL(url, params, paramsSerializer) {
748
+ /*eslint no-param-reassign:0*/
749
+ if (!params) {
750
+ return url;
751
+ }
711
752
 
712
- const iterator = generator.call(obj);
753
+ var serializedParams;
754
+ if (paramsSerializer) {
755
+ serializedParams = paramsSerializer(params);
756
+ } else if (utils.isURLSearchParams(params)) {
757
+ serializedParams = params.toString();
758
+ } else {
759
+ var parts = [];
713
760
 
714
- let result;
761
+ utils.forEach(params, function serialize(val, key) {
762
+ if (val === null || typeof val === 'undefined') {
763
+ return;
764
+ }
715
765
 
716
- while ((result = iterator.next()) && !result.done) {
717
- const pair = result.value;
718
- fn.call(obj, pair[0], pair[1]);
719
- }
720
- };
766
+ if (utils.isArray(val)) {
767
+ key = key + '[]';
768
+ } else {
769
+ val = [val];
770
+ }
721
771
 
722
- /**
723
- * It takes a regular expression and a string, and returns an array of all the matches
724
- *
725
- * @param {string} regExp - The regular expression to match against.
726
- * @param {string} str - The string to search.
727
- *
728
- * @returns {Array<boolean>}
729
- */
730
- const matchAll = (regExp, str) => {
731
- let matches;
732
- const arr = [];
772
+ utils.forEach(val, function parseValue(v) {
773
+ if (utils.isDate(v)) {
774
+ v = v.toISOString();
775
+ } else if (utils.isObject(v)) {
776
+ v = JSON.stringify(v);
777
+ }
778
+ parts.push(encode(key) + '=' + encode(v));
779
+ });
780
+ });
733
781
 
734
- while ((matches = regExp.exec(str)) !== null) {
735
- arr.push(matches);
782
+ serializedParams = parts.join('&');
736
783
  }
737
784
 
738
- return arr;
739
- };
785
+ if (serializedParams) {
786
+ var hashmarkIndex = url.indexOf('#');
787
+ if (hashmarkIndex !== -1) {
788
+ url = url.slice(0, hashmarkIndex);
789
+ }
740
790
 
741
- /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
742
- const isHTMLForm = kindOfTest('HTMLFormElement');
791
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
792
+ }
743
793
 
744
- const toCamelCase = str => {
745
- return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
746
- function replacer(m, p1, p2) {
747
- return p1.toUpperCase() + p2;
748
- }
749
- );
794
+ return url;
750
795
  };
751
796
 
752
- /* Creating a function that will check if an object has a property. */
753
- const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
797
+ function InterceptorManager() {
798
+ this.handlers = [];
799
+ }
754
800
 
755
801
  /**
756
- * Determine if a value is a RegExp object
802
+ * Add a new interceptor to the stack
757
803
  *
758
- * @param {*} val The value to test
804
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
805
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
759
806
  *
760
- * @returns {boolean} True if value is a RegExp object, otherwise false
807
+ * @return {Number} An ID used to remove interceptor later
761
808
  */
762
- const isRegExp = kindOfTest('RegExp');
763
-
764
- const reduceDescriptors = (obj, reducer) => {
765
- const descriptors = Object.getOwnPropertyDescriptors(obj);
766
- const reducedDescriptors = {};
767
-
768
- forEach(descriptors, (descriptor, name) => {
769
- if (reducer(descriptor, name, obj) !== false) {
770
- reducedDescriptors[name] = descriptor;
771
- }
809
+ InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
810
+ this.handlers.push({
811
+ fulfilled: fulfilled,
812
+ rejected: rejected,
813
+ synchronous: options ? options.synchronous : false,
814
+ runWhen: options ? options.runWhen : null
772
815
  });
773
-
774
- Object.defineProperties(obj, reducedDescriptors);
816
+ return this.handlers.length - 1;
775
817
  };
776
818
 
777
819
  /**
778
- * Makes all methods read-only
779
- * @param {Object} obj
820
+ * Remove an interceptor from the stack
821
+ *
822
+ * @param {Number} id The ID that was returned by `use`
780
823
  */
824
+ InterceptorManager.prototype.eject = function eject(id) {
825
+ if (this.handlers[id]) {
826
+ this.handlers[id] = null;
827
+ }
828
+ };
781
829
 
782
- const freezeMethods = (obj) => {
783
- reduceDescriptors(obj, (descriptor, name) => {
784
- const value = obj[name];
785
-
786
- if (!isFunction(value)) return;
787
-
788
- descriptor.enumerable = false;
789
-
790
- if ('writable' in descriptor) {
791
- descriptor.writable = false;
792
- return;
793
- }
794
-
795
- if (!descriptor.set) {
796
- descriptor.set = () => {
797
- throw Error('Can not read-only method \'' + name + '\'');
798
- };
830
+ /**
831
+ * Iterate over all the registered interceptors
832
+ *
833
+ * This method is particularly useful for skipping over any
834
+ * interceptors that may have become `null` calling `eject`.
835
+ *
836
+ * @param {Function} fn The function to call for each interceptor
837
+ */
838
+ InterceptorManager.prototype.forEach = function forEach(fn) {
839
+ utils.forEach(this.handlers, function forEachHandler(h) {
840
+ if (h !== null) {
841
+ fn(h);
799
842
  }
800
843
  });
801
844
  };
802
845
 
803
- const toObjectSet = (arrayOrString, delimiter) => {
804
- const obj = {};
805
-
806
- const define = (arr) => {
807
- arr.forEach(value => {
808
- obj[value] = true;
809
- });
810
- };
846
+ var InterceptorManager_1 = InterceptorManager;
811
847
 
812
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
813
-
814
- return obj;
815
- };
816
-
817
- const noop = () => {};
818
-
819
- const toFiniteNumber = (value, defaultValue) => {
820
- value = +value;
821
- return Number.isFinite(value) ? value : defaultValue;
822
- };
823
-
824
- const utils = {
825
- isArray,
826
- isArrayBuffer,
827
- isBuffer,
828
- isFormData,
829
- isArrayBufferView,
830
- isString,
831
- isNumber,
832
- isBoolean,
833
- isObject,
834
- isPlainObject,
835
- isUndefined,
836
- isDate,
837
- isFile,
838
- isBlob,
839
- isRegExp,
840
- isFunction,
841
- isStream,
842
- isURLSearchParams,
843
- isTypedArray,
844
- isFileList,
845
- forEach,
846
- merge,
847
- extend,
848
- trim,
849
- stripBOM,
850
- inherits,
851
- toFlatObject,
852
- kindOf,
853
- kindOfTest,
854
- endsWith,
855
- toArray,
856
- forEachEntry,
857
- matchAll,
858
- isHTMLForm,
859
- hasOwnProperty,
860
- hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
861
- reduceDescriptors,
862
- freezeMethods,
863
- toObjectSet,
864
- toCamelCase,
865
- noop,
866
- toFiniteNumber
848
+ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
849
+ utils.forEach(headers, function processHeader(value, name) {
850
+ if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
851
+ headers[normalizedName] = value;
852
+ delete headers[name];
853
+ }
854
+ });
867
855
  };
868
856
 
869
857
  /**
@@ -874,18 +862,10 @@ const utils = {
874
862
  * @param {Object} [config] The config.
875
863
  * @param {Object} [request] The request.
876
864
  * @param {Object} [response] The response.
877
- *
878
865
  * @returns {Error} The created error.
879
866
  */
880
867
  function AxiosError(message, code, config, request, response) {
881
868
  Error.call(this);
882
-
883
- if (Error.captureStackTrace) {
884
- Error.captureStackTrace(this, this.constructor);
885
- } else {
886
- this.stack = (new Error()).stack;
887
- }
888
-
889
869
  this.message = message;
890
870
  this.name = 'AxiosError';
891
871
  code && (this.code = code);
@@ -916,8 +896,8 @@ utils.inherits(AxiosError, Error, {
916
896
  }
917
897
  });
918
898
 
919
- const prototype$1 = AxiosError.prototype;
920
- const descriptors = {};
899
+ var prototype = AxiosError.prototype;
900
+ var descriptors = {};
921
901
 
922
902
  [
923
903
  'ERR_BAD_OPTION_VALUE',
@@ -929,31 +909,25 @@ const descriptors = {};
929
909
  'ERR_DEPRECATED',
930
910
  'ERR_BAD_RESPONSE',
931
911
  'ERR_BAD_REQUEST',
932
- 'ERR_CANCELED',
933
- 'ERR_NOT_SUPPORT',
934
- 'ERR_INVALID_URL'
912
+ 'ERR_CANCELED'
935
913
  // eslint-disable-next-line func-names
936
- ].forEach(code => {
914
+ ].forEach(function(code) {
937
915
  descriptors[code] = {value: code};
938
916
  });
939
917
 
940
918
  Object.defineProperties(AxiosError, descriptors);
941
- Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
919
+ Object.defineProperty(prototype, 'isAxiosError', {value: true});
942
920
 
943
921
  // eslint-disable-next-line func-names
944
- AxiosError.from = (error, code, config, request, response, customProps) => {
945
- const axiosError = Object.create(prototype$1);
922
+ AxiosError.from = function(error, code, config, request, response, customProps) {
923
+ var axiosError = Object.create(prototype);
946
924
 
947
925
  utils.toFlatObject(error, axiosError, function filter(obj) {
948
926
  return obj !== Error.prototype;
949
- }, prop => {
950
- return prop !== 'isAxiosError';
951
927
  });
952
928
 
953
929
  AxiosError.call(axiosError, error.message, code, config, request, response);
954
930
 
955
- axiosError.cause = error;
956
-
957
931
  axiosError.name = error.name;
958
932
 
959
933
  customProps && Object.assign(axiosError, customProps);
@@ -961,127 +935,26 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
961
935
  return axiosError;
962
936
  };
963
937
 
964
- /* eslint-env browser */
965
- var browser = typeof self == 'object' ? self.FormData : window.FormData;
966
-
967
- /**
968
- * Determines if the given thing is a array or js object.
969
- *
970
- * @param {string} thing - The object or array to be visited.
971
- *
972
- * @returns {boolean}
973
- */
974
- function isVisitable(thing) {
975
- return utils.isPlainObject(thing) || utils.isArray(thing);
976
- }
977
-
978
- /**
979
- * It removes the brackets from the end of a string
980
- *
981
- * @param {string} key - The key of the parameter.
982
- *
983
- * @returns {string} the key without the brackets.
984
- */
985
- function removeBrackets(key) {
986
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
987
- }
988
-
989
- /**
990
- * It takes a path, a key, and a boolean, and returns a string
991
- *
992
- * @param {string} path - The path to the current key.
993
- * @param {string} key - The key of the current object being iterated over.
994
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
995
- *
996
- * @returns {string} The path to the current key.
997
- */
998
- function renderKey(path, key, dots) {
999
- if (!path) return key;
1000
- return path.concat(key).map(function each(token, i) {
1001
- // eslint-disable-next-line no-param-reassign
1002
- token = removeBrackets(token);
1003
- return !dots && i ? '[' + token + ']' : token;
1004
- }).join(dots ? '.' : '');
1005
- }
1006
-
1007
- /**
1008
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1009
- *
1010
- * @param {Array<any>} arr - The array to check
1011
- *
1012
- * @returns {boolean}
1013
- */
1014
- function isFlatArray(arr) {
1015
- return utils.isArray(arr) && !arr.some(isVisitable);
1016
- }
1017
-
1018
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
1019
- return /^is[A-Z]/.test(prop);
1020
- });
938
+ var AxiosError_1 = AxiosError;
1021
939
 
1022
- /**
1023
- * If the thing is a FormData object, return true, otherwise return false.
1024
- *
1025
- * @param {unknown} thing - The thing to check.
1026
- *
1027
- * @returns {boolean}
1028
- */
1029
- function isSpecCompliant(thing) {
1030
- return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
1031
- }
940
+ var transitional = {
941
+ silentJSONParsing: true,
942
+ forcedJSONParsing: true,
943
+ clarifyTimeoutError: false
944
+ };
1032
945
 
1033
946
  /**
1034
947
  * Convert a data object to FormData
1035
- *
1036
948
  * @param {Object} obj
1037
949
  * @param {?Object} [formData]
1038
- * @param {?Object} [options]
1039
- * @param {Function} [options.visitor]
1040
- * @param {Boolean} [options.metaTokens = true]
1041
- * @param {Boolean} [options.dots = false]
1042
- * @param {?Boolean} [options.indexes = false]
1043
- *
1044
950
  * @returns {Object}
1045
951
  **/
1046
952
 
1047
- /**
1048
- * It converts an object into a FormData object
1049
- *
1050
- * @param {Object<any, any>} obj - The object to convert to form data.
1051
- * @param {string} formData - The FormData object to append to.
1052
- * @param {Object<string, any>} options
1053
- *
1054
- * @returns
1055
- */
1056
- function toFormData(obj, formData, options) {
1057
- if (!utils.isObject(obj)) {
1058
- throw new TypeError('target must be an object');
1059
- }
1060
-
953
+ function toFormData(obj, formData) {
1061
954
  // eslint-disable-next-line no-param-reassign
1062
- formData = formData || new (browser || FormData)();
955
+ formData = formData || new FormData();
1063
956
 
1064
- // eslint-disable-next-line no-param-reassign
1065
- options = utils.toFlatObject(options, {
1066
- metaTokens: true,
1067
- dots: false,
1068
- indexes: false
1069
- }, false, function defined(option, source) {
1070
- // eslint-disable-next-line no-eq-null,eqeqeq
1071
- return !utils.isUndefined(source[option]);
1072
- });
1073
-
1074
- const metaTokens = options.metaTokens;
1075
- // eslint-disable-next-line no-use-before-define
1076
- const visitor = options.visitor || defaultVisitor;
1077
- const dots = options.dots;
1078
- const indexes = options.indexes;
1079
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1080
- const useBlob = _Blob && isSpecCompliant(formData);
1081
-
1082
- if (!utils.isFunction(visitor)) {
1083
- throw new TypeError('visitor must be a function');
1084
- }
957
+ var stack = [];
1085
958
 
1086
959
  function convertValue(value) {
1087
960
  if (value === null) return '';
@@ -1090,95 +963,46 @@ function toFormData(obj, formData, options) {
1090
963
  return value.toISOString();
1091
964
  }
1092
965
 
1093
- if (!useBlob && utils.isBlob(value)) {
1094
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1095
- }
1096
-
1097
966
  if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
1098
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
967
+ return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1099
968
  }
1100
969
 
1101
970
  return value;
1102
971
  }
1103
972
 
1104
- /**
1105
- * Default visitor.
1106
- *
1107
- * @param {*} value
1108
- * @param {String|Number} key
1109
- * @param {Array<String|Number>} path
1110
- * @this {FormData}
1111
- *
1112
- * @returns {boolean} return true to visit the each prop of the value recursively
1113
- */
1114
- function defaultVisitor(value, key, path) {
1115
- let arr = value;
1116
-
1117
- if (value && !path && typeof value === 'object') {
1118
- if (utils.endsWith(key, '{}')) {
1119
- // eslint-disable-next-line no-param-reassign
1120
- key = metaTokens ? key : key.slice(0, -2);
1121
- // eslint-disable-next-line no-param-reassign
1122
- value = JSON.stringify(value);
1123
- } else if (
1124
- (utils.isArray(value) && isFlatArray(value)) ||
1125
- (utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
1126
- )) {
1127
- // eslint-disable-next-line no-param-reassign
1128
- key = removeBrackets(key);
1129
-
1130
- arr.forEach(function each(el, index) {
1131
- !utils.isUndefined(el) && formData.append(
1132
- // eslint-disable-next-line no-nested-ternary
1133
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1134
- convertValue(el)
1135
- );
1136
- });
1137
- return false;
973
+ function build(data, parentKey) {
974
+ if (utils.isPlainObject(data) || utils.isArray(data)) {
975
+ if (stack.indexOf(data) !== -1) {
976
+ throw Error('Circular reference detected in ' + parentKey);
1138
977
  }
1139
- }
1140
978
 
1141
- if (isVisitable(value)) {
1142
- return true;
1143
- }
1144
-
1145
- formData.append(renderKey(path, key, dots), convertValue(value));
1146
-
1147
- return false;
1148
- }
1149
-
1150
- const stack = [];
1151
-
1152
- const exposedHelpers = Object.assign(predicates, {
1153
- defaultVisitor,
1154
- convertValue,
1155
- isVisitable
1156
- });
979
+ stack.push(data);
980
+
981
+ utils.forEach(data, function each(value, key) {
982
+ if (utils.isUndefined(value)) return;
983
+ var fullKey = parentKey ? parentKey + '.' + key : key;
984
+ var arr;
985
+
986
+ if (value && !parentKey && typeof value === 'object') {
987
+ if (utils.endsWith(key, '{}')) {
988
+ // eslint-disable-next-line no-param-reassign
989
+ value = JSON.stringify(value);
990
+ } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
991
+ // eslint-disable-next-line func-names
992
+ arr.forEach(function(el) {
993
+ !utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
994
+ });
995
+ return;
996
+ }
997
+ }
1157
998
 
1158
- function build(value, path) {
1159
- if (utils.isUndefined(value)) return;
999
+ build(value, fullKey);
1000
+ });
1160
1001
 
1161
- if (stack.indexOf(value) !== -1) {
1162
- throw Error('Circular reference detected in ' + path.join('.'));
1002
+ stack.pop();
1003
+ } else {
1004
+ formData.append(parentKey, convertValue(data));
1163
1005
  }
1164
-
1165
- stack.push(value);
1166
-
1167
- utils.forEach(value, function each(el, key) {
1168
- const result = !utils.isUndefined(el) && visitor.call(
1169
- formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
1170
- );
1171
-
1172
- if (result === true) {
1173
- build(el, path ? path.concat(key) : [key]);
1174
- }
1175
- });
1176
-
1177
- stack.pop();
1178
- }
1179
-
1180
- if (!utils.isObject(obj)) {
1181
- throw new TypeError('data must be an object');
1182
1006
  }
1183
1007
 
1184
1008
  build(obj);
@@ -1186,323 +1010,7 @@ function toFormData(obj, formData, options) {
1186
1010
  return formData;
1187
1011
  }
1188
1012
 
1189
- /**
1190
- * It encodes a string by replacing all characters that are not in the unreserved set with
1191
- * their percent-encoded equivalents
1192
- *
1193
- * @param {string} str - The string to encode.
1194
- *
1195
- * @returns {string} The encoded string.
1196
- */
1197
- function encode$1(str) {
1198
- const charMap = {
1199
- '!': '%21',
1200
- "'": '%27',
1201
- '(': '%28',
1202
- ')': '%29',
1203
- '~': '%7E',
1204
- '%20': '+',
1205
- '%00': '\x00'
1206
- };
1207
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1208
- return charMap[match];
1209
- });
1210
- }
1211
-
1212
- /**
1213
- * It takes a params object and converts it to a FormData object
1214
- *
1215
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1216
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1217
- *
1218
- * @returns {void}
1219
- */
1220
- function AxiosURLSearchParams(params, options) {
1221
- this._pairs = [];
1222
-
1223
- params && toFormData(params, this, options);
1224
- }
1225
-
1226
- const prototype = AxiosURLSearchParams.prototype;
1227
-
1228
- prototype.append = function append(name, value) {
1229
- this._pairs.push([name, value]);
1230
- };
1231
-
1232
- prototype.toString = function toString(encoder) {
1233
- const _encode = encoder ? function(value) {
1234
- return encoder.call(this, value, encode$1);
1235
- } : encode$1;
1236
-
1237
- return this._pairs.map(function each(pair) {
1238
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1239
- }, '').join('&');
1240
- };
1241
-
1242
- /**
1243
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1244
- * URI encoded counterparts
1245
- *
1246
- * @param {string} val The value to be encoded.
1247
- *
1248
- * @returns {string} The encoded value.
1249
- */
1250
- function encode(val) {
1251
- return encodeURIComponent(val).
1252
- replace(/%3A/gi, ':').
1253
- replace(/%24/g, '$').
1254
- replace(/%2C/gi, ',').
1255
- replace(/%20/g, '+').
1256
- replace(/%5B/gi, '[').
1257
- replace(/%5D/gi, ']');
1258
- }
1259
-
1260
- /**
1261
- * Build a URL by appending params to the end
1262
- *
1263
- * @param {string} url The base of the url (e.g., http://www.google.com)
1264
- * @param {object} [params] The params to be appended
1265
- * @param {?object} options
1266
- *
1267
- * @returns {string} The formatted url
1268
- */
1269
- function buildURL(url, params, options) {
1270
- /*eslint no-param-reassign:0*/
1271
- if (!params) {
1272
- return url;
1273
- }
1274
-
1275
- const hashmarkIndex = url.indexOf('#');
1276
-
1277
- if (hashmarkIndex !== -1) {
1278
- url = url.slice(0, hashmarkIndex);
1279
- }
1280
-
1281
- const _encode = options && options.encode || encode;
1282
-
1283
- const serializerParams = utils.isURLSearchParams(params) ?
1284
- params.toString() :
1285
- new AxiosURLSearchParams(params, options).toString(_encode);
1286
-
1287
- if (serializerParams) {
1288
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializerParams;
1289
- }
1290
-
1291
- return url;
1292
- }
1293
-
1294
- class InterceptorManager {
1295
- constructor() {
1296
- this.handlers = [];
1297
- }
1298
-
1299
- /**
1300
- * Add a new interceptor to the stack
1301
- *
1302
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1303
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1304
- *
1305
- * @return {Number} An ID used to remove interceptor later
1306
- */
1307
- use(fulfilled, rejected, options) {
1308
- this.handlers.push({
1309
- fulfilled,
1310
- rejected,
1311
- synchronous: options ? options.synchronous : false,
1312
- runWhen: options ? options.runWhen : null
1313
- });
1314
- return this.handlers.length - 1;
1315
- }
1316
-
1317
- /**
1318
- * Remove an interceptor from the stack
1319
- *
1320
- * @param {Number} id The ID that was returned by `use`
1321
- *
1322
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1323
- */
1324
- eject(id) {
1325
- if (this.handlers[id]) {
1326
- this.handlers[id] = null;
1327
- }
1328
- }
1329
-
1330
- /**
1331
- * Clear all interceptors from the stack
1332
- *
1333
- * @returns {void}
1334
- */
1335
- clear() {
1336
- if (this.handlers) {
1337
- this.handlers = [];
1338
- }
1339
- }
1340
-
1341
- /**
1342
- * Iterate over all the registered interceptors
1343
- *
1344
- * This method is particularly useful for skipping over any
1345
- * interceptors that may have become `null` calling `eject`.
1346
- *
1347
- * @param {Function} fn The function to call for each interceptor
1348
- *
1349
- * @returns {void}
1350
- */
1351
- forEach(fn) {
1352
- utils.forEach(this.handlers, function forEachHandler(h) {
1353
- if (h !== null) {
1354
- fn(h);
1355
- }
1356
- });
1357
- }
1358
- }
1359
-
1360
- const transitionalDefaults = {
1361
- silentJSONParsing: true,
1362
- forcedJSONParsing: true,
1363
- clarifyTimeoutError: false
1364
- };
1365
-
1366
- const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1367
-
1368
- const FormData$1 = FormData;
1369
-
1370
- /**
1371
- * Determine if we're running in a standard browser environment
1372
- *
1373
- * This allows axios to run in a web worker, and react-native.
1374
- * Both environments support XMLHttpRequest, but not fully standard globals.
1375
- *
1376
- * web workers:
1377
- * typeof window -> undefined
1378
- * typeof document -> undefined
1379
- *
1380
- * react-native:
1381
- * navigator.product -> 'ReactNative'
1382
- * nativescript
1383
- * navigator.product -> 'NativeScript' or 'NS'
1384
- *
1385
- * @returns {boolean}
1386
- */
1387
- const isStandardBrowserEnv = (() => {
1388
- let product;
1389
- if (typeof navigator !== 'undefined' && (
1390
- (product = navigator.product) === 'ReactNative' ||
1391
- product === 'NativeScript' ||
1392
- product === 'NS')
1393
- ) {
1394
- return false;
1395
- }
1396
-
1397
- return typeof window !== 'undefined' && typeof document !== 'undefined';
1398
- })();
1399
-
1400
- const platform = {
1401
- isBrowser: true,
1402
- classes: {
1403
- URLSearchParams: URLSearchParams$1,
1404
- FormData: FormData$1,
1405
- Blob
1406
- },
1407
- isStandardBrowserEnv,
1408
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1409
- };
1410
-
1411
- function toURLEncodedForm(data, options) {
1412
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1413
- visitor: function(value, key, path, helpers) {
1414
-
1415
- return helpers.defaultVisitor.apply(this, arguments);
1416
- }
1417
- }, options));
1418
- }
1419
-
1420
- /**
1421
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1422
- *
1423
- * @param {string} name - The name of the property to get.
1424
- *
1425
- * @returns An array of strings.
1426
- */
1427
- function parsePropPath(name) {
1428
- // foo[x][y][z]
1429
- // foo.x.y.z
1430
- // foo-x-y-z
1431
- // foo x y z
1432
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1433
- return match[0] === '[]' ? '' : match[1] || match[0];
1434
- });
1435
- }
1436
-
1437
- /**
1438
- * Convert an array to an object.
1439
- *
1440
- * @param {Array<any>} arr - The array to convert to an object.
1441
- *
1442
- * @returns An object with the same keys and values as the array.
1443
- */
1444
- function arrayToObject(arr) {
1445
- const obj = {};
1446
- const keys = Object.keys(arr);
1447
- let i;
1448
- const len = keys.length;
1449
- let key;
1450
- for (i = 0; i < len; i++) {
1451
- key = keys[i];
1452
- obj[key] = arr[key];
1453
- }
1454
- return obj;
1455
- }
1456
-
1457
- /**
1458
- * It takes a FormData object and returns a JavaScript object
1459
- *
1460
- * @param {string} formData The FormData object to convert to JSON.
1461
- *
1462
- * @returns {Object<string, any> | null} The converted object.
1463
- */
1464
- function formDataToJSON(formData) {
1465
- function buildPath(path, value, target, index) {
1466
- let name = path[index++];
1467
- const isNumericKey = Number.isFinite(+name);
1468
- const isLast = index >= path.length;
1469
- name = !name && utils.isArray(target) ? target.length : name;
1470
-
1471
- if (isLast) {
1472
- if (utils.hasOwnProp(target, name)) {
1473
- target[name] = [target[name], value];
1474
- } else {
1475
- target[name] = value;
1476
- }
1477
-
1478
- return !isNumericKey;
1479
- }
1480
-
1481
- if (!target[name] || !utils.isObject(target[name])) {
1482
- target[name] = [];
1483
- }
1484
-
1485
- const result = buildPath(path, value, target[name], index);
1486
-
1487
- if (result && utils.isArray(target[name])) {
1488
- target[name] = arrayToObject(target[name]);
1489
- }
1490
-
1491
- return !isNumericKey;
1492
- }
1493
-
1494
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1495
- const obj = {};
1496
-
1497
- utils.forEachEntry(formData, (name, value) => {
1498
- buildPath(parsePropPath(name), value, obj, 0);
1499
- });
1500
-
1501
- return obj;
1502
- }
1503
-
1504
- return null;
1505
- }
1013
+ var toFormData_1 = toFormData;
1506
1014
 
1507
1015
  /**
1508
1016
  * Resolve or reject a Promise based on response status.
@@ -1510,99 +1018,97 @@ function formDataToJSON(formData) {
1510
1018
  * @param {Function} resolve A function that resolves the promise.
1511
1019
  * @param {Function} reject A function that rejects the promise.
1512
1020
  * @param {object} response The response.
1513
- *
1514
- * @returns {object} The response.
1515
1021
  */
1516
- function settle(resolve, reject, response) {
1517
- const validateStatus = response.config.validateStatus;
1022
+ var settle = function settle(resolve, reject, response) {
1023
+ var validateStatus = response.config.validateStatus;
1518
1024
  if (!response.status || !validateStatus || validateStatus(response.status)) {
1519
1025
  resolve(response);
1520
1026
  } else {
1521
- reject(new AxiosError(
1027
+ reject(new AxiosError_1(
1522
1028
  'Request failed with status code ' + response.status,
1523
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1029
+ [AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1524
1030
  response.config,
1525
1031
  response.request,
1526
1032
  response
1527
1033
  ));
1528
1034
  }
1529
- }
1035
+ };
1530
1036
 
1531
- const cookies = platform.isStandardBrowserEnv ?
1037
+ var cookies = (
1038
+ utils.isStandardBrowserEnv() ?
1532
1039
 
1533
- // Standard browser envs support document.cookie
1534
- (function standardBrowserEnv() {
1535
- return {
1536
- write: function write(name, value, expires, path, domain, secure) {
1537
- const cookie = [];
1538
- cookie.push(name + '=' + encodeURIComponent(value));
1040
+ // Standard browser envs support document.cookie
1041
+ (function standardBrowserEnv() {
1042
+ return {
1043
+ write: function write(name, value, expires, path, domain, secure) {
1044
+ var cookie = [];
1045
+ cookie.push(name + '=' + encodeURIComponent(value));
1539
1046
 
1540
- if (utils.isNumber(expires)) {
1541
- cookie.push('expires=' + new Date(expires).toGMTString());
1542
- }
1047
+ if (utils.isNumber(expires)) {
1048
+ cookie.push('expires=' + new Date(expires).toGMTString());
1049
+ }
1543
1050
 
1544
- if (utils.isString(path)) {
1545
- cookie.push('path=' + path);
1546
- }
1051
+ if (utils.isString(path)) {
1052
+ cookie.push('path=' + path);
1053
+ }
1547
1054
 
1548
- if (utils.isString(domain)) {
1549
- cookie.push('domain=' + domain);
1550
- }
1055
+ if (utils.isString(domain)) {
1056
+ cookie.push('domain=' + domain);
1057
+ }
1551
1058
 
1552
- if (secure === true) {
1553
- cookie.push('secure');
1554
- }
1059
+ if (secure === true) {
1060
+ cookie.push('secure');
1061
+ }
1555
1062
 
1556
- document.cookie = cookie.join('; ');
1557
- },
1063
+ document.cookie = cookie.join('; ');
1064
+ },
1558
1065
 
1559
- read: function read(name) {
1560
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1561
- return (match ? decodeURIComponent(match[3]) : null);
1562
- },
1066
+ read: function read(name) {
1067
+ var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1068
+ return (match ? decodeURIComponent(match[3]) : null);
1069
+ },
1563
1070
 
1564
- remove: function remove(name) {
1565
- this.write(name, '', Date.now() - 86400000);
1566
- }
1567
- };
1568
- })() :
1071
+ remove: function remove(name) {
1072
+ this.write(name, '', Date.now() - 86400000);
1073
+ }
1074
+ };
1075
+ })() :
1569
1076
 
1570
- // Non standard browser env (web workers, react-native) lack needed support.
1571
- (function nonStandardBrowserEnv() {
1572
- return {
1573
- write: function write() {},
1574
- read: function read() { return null; },
1575
- remove: function remove() {}
1576
- };
1577
- })();
1077
+ // Non standard browser env (web workers, react-native) lack needed support.
1078
+ (function nonStandardBrowserEnv() {
1079
+ return {
1080
+ write: function write() {},
1081
+ read: function read() { return null; },
1082
+ remove: function remove() {}
1083
+ };
1084
+ })()
1085
+ );
1578
1086
 
1579
1087
  /**
1580
1088
  * Determines whether the specified URL is absolute
1581
1089
  *
1582
1090
  * @param {string} url The URL to test
1583
- *
1584
1091
  * @returns {boolean} True if the specified URL is absolute, otherwise false
1585
1092
  */
1586
- function isAbsoluteURL(url) {
1093
+ var isAbsoluteURL = function isAbsoluteURL(url) {
1587
1094
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1588
1095
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1589
1096
  // by any combination of letters, digits, plus, period, or hyphen.
1590
1097
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1591
- }
1098
+ };
1592
1099
 
1593
1100
  /**
1594
1101
  * Creates a new URL by combining the specified URLs
1595
1102
  *
1596
1103
  * @param {string} baseURL The base URL
1597
1104
  * @param {string} relativeURL The relative URL
1598
- *
1599
1105
  * @returns {string} The combined URL
1600
1106
  */
1601
- function combineURLs(baseURL, relativeURL) {
1107
+ var combineURLs = function combineURLs(baseURL, relativeURL) {
1602
1108
  return relativeURL
1603
1109
  ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1604
1110
  : baseURL;
1605
- }
1111
+ };
1606
1112
 
1607
1113
  /**
1608
1114
  * Creates a new URL by combining the baseURL with the requestedURL,
@@ -1611,111 +1117,23 @@ function combineURLs(baseURL, relativeURL) {
1611
1117
  *
1612
1118
  * @param {string} baseURL The base URL
1613
1119
  * @param {string} requestedURL Absolute or relative URL to combine
1614
- *
1615
1120
  * @returns {string} The combined full path
1616
1121
  */
1617
- function buildFullPath(baseURL, requestedURL) {
1122
+ var buildFullPath = function buildFullPath(baseURL, requestedURL) {
1618
1123
  if (baseURL && !isAbsoluteURL(requestedURL)) {
1619
1124
  return combineURLs(baseURL, requestedURL);
1620
1125
  }
1621
1126
  return requestedURL;
1622
- }
1623
-
1624
- const isURLSameOrigin = platform.isStandardBrowserEnv ?
1625
-
1626
- // Standard browser envs have full support of the APIs needed to test
1627
- // whether the request URL is of the same origin as current location.
1628
- (function standardBrowserEnv() {
1629
- const msie = /(msie|trident)/i.test(navigator.userAgent);
1630
- const urlParsingNode = document.createElement('a');
1631
- let originURL;
1632
-
1633
- /**
1634
- * Parse a URL to discover it's components
1635
- *
1636
- * @param {String} url The URL to be parsed
1637
- * @returns {Object}
1638
- */
1639
- function resolveURL(url) {
1640
- let href = url;
1641
-
1642
- if (msie) {
1643
- // IE needs attribute set twice to normalize properties
1644
- urlParsingNode.setAttribute('href', href);
1645
- href = urlParsingNode.href;
1646
- }
1647
-
1648
- urlParsingNode.setAttribute('href', href);
1649
-
1650
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1651
- return {
1652
- href: urlParsingNode.href,
1653
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1654
- host: urlParsingNode.host,
1655
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1656
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1657
- hostname: urlParsingNode.hostname,
1658
- port: urlParsingNode.port,
1659
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1660
- urlParsingNode.pathname :
1661
- '/' + urlParsingNode.pathname
1662
- };
1663
- }
1664
-
1665
- originURL = resolveURL(window.location.href);
1666
-
1667
- /**
1668
- * Determine if a URL shares the same origin as the current location
1669
- *
1670
- * @param {String} requestURL The URL to test
1671
- * @returns {boolean} True if URL shares the same origin, otherwise false
1672
- */
1673
- return function isURLSameOrigin(requestURL) {
1674
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1675
- return (parsed.protocol === originURL.protocol &&
1676
- parsed.host === originURL.host);
1677
- };
1678
- })() :
1679
-
1680
- // Non standard browser envs (web workers, react-native) lack needed support.
1681
- (function nonStandardBrowserEnv() {
1682
- return function isURLSameOrigin() {
1683
- return true;
1684
- };
1685
- })();
1686
-
1687
- /**
1688
- * A `CanceledError` is an object that is thrown when an operation is canceled.
1689
- *
1690
- * @param {string=} message The message.
1691
- * @param {Object=} config The config.
1692
- * @param {Object=} request The request.
1693
- *
1694
- * @returns {CanceledError} The created error.
1695
- */
1696
- function CanceledError(message, config, request) {
1697
- // eslint-disable-next-line no-eq-null,eqeqeq
1698
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1699
- this.name = 'CanceledError';
1700
- }
1701
-
1702
- utils.inherits(CanceledError, AxiosError, {
1703
- __CANCEL__: true
1704
- });
1705
-
1706
- function parseProtocol(url) {
1707
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1708
- return match && match[1] || '';
1709
- }
1127
+ };
1710
1128
 
1711
- // RawAxiosHeaders whose duplicates are ignored by node
1129
+ // Headers whose duplicates are ignored by node
1712
1130
  // c.f. https://nodejs.org/api/http.html#http_message_headers
1713
- const ignoreDuplicateOf = utils.toObjectSet([
1131
+ var ignoreDuplicateOf = [
1714
1132
  'age', 'authorization', 'content-length', 'content-type', 'etag',
1715
1133
  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1716
1134
  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1717
1135
  'referer', 'retry-after', 'user-agent'
1718
- ]);
1136
+ ];
1719
1137
 
1720
1138
  /**
1721
1139
  * Parse headers into an object
@@ -1727,393 +1145,131 @@ const ignoreDuplicateOf = utils.toObjectSet([
1727
1145
  * Transfer-Encoding: chunked
1728
1146
  * ```
1729
1147
  *
1730
- * @param {String} rawHeaders Headers needing to be parsed
1731
- *
1148
+ * @param {String} headers Headers needing to be parsed
1732
1149
  * @returns {Object} Headers parsed into an object
1733
1150
  */
1734
- const parseHeaders = rawHeaders => {
1735
- const parsed = {};
1736
- let key;
1737
- let val;
1738
- let i;
1739
-
1740
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1741
- i = line.indexOf(':');
1742
- key = line.substring(0, i).trim().toLowerCase();
1743
- val = line.substring(i + 1).trim();
1744
-
1745
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1746
- return;
1747
- }
1748
-
1749
- if (key === 'set-cookie') {
1750
- if (parsed[key]) {
1751
- parsed[key].push(val);
1752
- } else {
1753
- parsed[key] = [val];
1754
- }
1755
- } else {
1756
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1757
- }
1758
- });
1759
-
1760
- return parsed;
1761
- };
1762
-
1763
- const $internals = Symbol('internals');
1764
- const $defaults = Symbol('defaults');
1765
-
1766
- function normalizeHeader(header) {
1767
- return header && String(header).trim().toLowerCase();
1768
- }
1769
-
1770
- function normalizeValue(value) {
1771
- if (value === false || value == null) {
1772
- return value;
1773
- }
1774
-
1775
- return String(value);
1776
- }
1777
-
1778
- function parseTokens(str) {
1779
- const tokens = Object.create(null);
1780
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1781
- let match;
1782
-
1783
- while ((match = tokensRE.exec(str))) {
1784
- tokens[match[1]] = match[2];
1785
- }
1786
-
1787
- return tokens;
1788
- }
1789
-
1790
- function matchHeaderValue(context, value, header, filter) {
1791
- if (utils.isFunction(filter)) {
1792
- return filter.call(this, value, header);
1793
- }
1794
-
1795
- if (!utils.isString(value)) return;
1796
-
1797
- if (utils.isString(filter)) {
1798
- return value.indexOf(filter) !== -1;
1799
- }
1800
-
1801
- if (utils.isRegExp(filter)) {
1802
- return filter.test(value);
1803
- }
1804
- }
1805
-
1806
- function formatHeader(header) {
1807
- return header.trim()
1808
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1809
- return char.toUpperCase() + str;
1810
- });
1811
- }
1812
-
1813
- function buildAccessors(obj, header) {
1814
- const accessorName = utils.toCamelCase(' ' + header);
1815
-
1816
- ['get', 'set', 'has'].forEach(methodName => {
1817
- Object.defineProperty(obj, methodName + accessorName, {
1818
- value: function(arg1, arg2, arg3) {
1819
- return this[methodName].call(this, header, arg1, arg2, arg3);
1820
- },
1821
- configurable: true
1822
- });
1823
- });
1824
- }
1825
-
1826
- function findKey(obj, key) {
1827
- key = key.toLowerCase();
1828
- const keys = Object.keys(obj);
1829
- let i = keys.length;
1830
- let _key;
1831
- while (i-- > 0) {
1832
- _key = keys[i];
1833
- if (key === _key.toLowerCase()) {
1834
- return _key;
1835
- }
1836
- }
1837
- return null;
1838
- }
1839
-
1840
- function AxiosHeaders(headers, defaults) {
1841
- headers && this.set(headers);
1842
- this[$defaults] = defaults || null;
1843
- }
1844
-
1845
- Object.assign(AxiosHeaders.prototype, {
1846
- set: function(header, valueOrRewrite, rewrite) {
1847
- const self = this;
1848
-
1849
- function setHeader(_value, _header, _rewrite) {
1850
- const lHeader = normalizeHeader(_header);
1851
-
1852
- if (!lHeader) {
1853
- throw new Error('header name must be a non-empty string');
1854
- }
1855
-
1856
- const key = findKey(self, lHeader);
1857
-
1858
- if (key && _rewrite !== true && (self[key] === false || _rewrite === false)) {
1859
- return;
1860
- }
1861
-
1862
- if (utils.isArray(_value)) {
1863
- _value = _value.map(normalizeValue);
1864
- } else {
1865
- _value = normalizeValue(_value);
1866
- }
1867
-
1868
- self[key || _header] = _value;
1869
- }
1870
-
1871
- if (utils.isPlainObject(header)) {
1872
- utils.forEach(header, (_value, _header) => {
1873
- setHeader(_value, _header, valueOrRewrite);
1874
- });
1875
- } else {
1876
- setHeader(valueOrRewrite, header, rewrite);
1877
- }
1878
-
1879
- return this;
1880
- },
1881
-
1882
- get: function(header, parser) {
1883
- header = normalizeHeader(header);
1884
-
1885
- if (!header) return undefined;
1886
-
1887
- const key = findKey(this, header);
1888
-
1889
- if (key) {
1890
- const value = this[key];
1891
-
1892
- if (!parser) {
1893
- return value;
1894
- }
1895
-
1896
- if (parser === true) {
1897
- return parseTokens(value);
1898
- }
1899
-
1900
- if (utils.isFunction(parser)) {
1901
- return parser.call(this, value, key);
1902
- }
1903
-
1904
- if (utils.isRegExp(parser)) {
1905
- return parser.exec(value);
1906
- }
1907
-
1908
- throw new TypeError('parser must be boolean|regexp|function');
1909
- }
1910
- },
1911
-
1912
- has: function(header, matcher) {
1913
- header = normalizeHeader(header);
1914
-
1915
- if (header) {
1916
- const key = findKey(this, header);
1917
-
1918
- return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1919
- }
1920
-
1921
- return false;
1922
- },
1923
-
1924
- delete: function(header, matcher) {
1925
- const self = this;
1926
- let deleted = false;
1927
-
1928
- function deleteHeader(_header) {
1929
- _header = normalizeHeader(_header);
1930
-
1931
- if (_header) {
1932
- const key = findKey(self, _header);
1933
-
1934
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1935
- delete self[key];
1936
-
1937
- deleted = true;
1938
- }
1939
- }
1940
- }
1941
-
1942
- if (utils.isArray(header)) {
1943
- header.forEach(deleteHeader);
1944
- } else {
1945
- deleteHeader(header);
1946
- }
1947
-
1948
- return deleted;
1949
- },
1950
-
1951
- clear: function() {
1952
- return Object.keys(this).forEach(this.delete.bind(this));
1953
- },
1954
-
1955
- normalize: function(format) {
1956
- const self = this;
1957
- const headers = {};
1958
-
1959
- utils.forEach(this, (value, header) => {
1960
- const key = findKey(headers, header);
1961
-
1962
- if (key) {
1963
- self[key] = normalizeValue(value);
1964
- delete self[header];
1965
- return;
1966
- }
1967
-
1968
- const normalized = format ? formatHeader(header) : String(header).trim();
1969
-
1970
- if (normalized !== header) {
1971
- delete self[header];
1972
- }
1973
-
1974
- self[normalized] = normalizeValue(value);
1975
-
1976
- headers[normalized] = true;
1977
- });
1978
-
1979
- return this;
1980
- },
1981
-
1982
- toJSON: function() {
1983
- const obj = Object.create(null);
1984
-
1985
- utils.forEach(Object.assign({}, this[$defaults] || null, this),
1986
- (value, header) => {
1987
- if (value == null || value === false) return;
1988
- obj[header] = utils.isArray(value) ? value.join(', ') : value;
1989
- });
1990
-
1991
- return obj;
1992
- }
1993
- });
1994
-
1995
- Object.assign(AxiosHeaders, {
1996
- from: function(thing) {
1997
- if (utils.isString(thing)) {
1998
- return new this(parseHeaders(thing));
1999
- }
2000
- return thing instanceof this ? thing : new this(thing);
2001
- },
2002
-
2003
- accessor: function(header) {
2004
- const internals = this[$internals] = (this[$internals] = {
2005
- accessors: {}
2006
- });
2007
-
2008
- const accessors = internals.accessors;
2009
- const prototype = this.prototype;
2010
-
2011
- function defineAccessor(_header) {
2012
- const lHeader = normalizeHeader(_header);
2013
-
2014
- if (!accessors[lHeader]) {
2015
- buildAccessors(prototype, _header);
2016
- accessors[lHeader] = true;
2017
- }
2018
- }
2019
-
2020
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2021
-
2022
- return this;
2023
- }
2024
- });
2025
-
2026
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
2027
-
2028
- utils.freezeMethods(AxiosHeaders.prototype);
2029
- utils.freezeMethods(AxiosHeaders);
2030
-
2031
- /**
2032
- * Calculate data maxRate
2033
- * @param {Number} [samplesCount= 10]
2034
- * @param {Number} [min= 1000]
2035
- * @returns {Function}
2036
- */
2037
- function speedometer(samplesCount, min) {
2038
- samplesCount = samplesCount || 10;
2039
- const bytes = new Array(samplesCount);
2040
- const timestamps = new Array(samplesCount);
2041
- let head = 0;
2042
- let tail = 0;
2043
- let firstSampleTS;
2044
-
2045
- min = min !== undefined ? min : 1000;
1151
+ var parseHeaders = function parseHeaders(headers) {
1152
+ var parsed = {};
1153
+ var key;
1154
+ var val;
1155
+ var i;
2046
1156
 
2047
- return function push(chunkLength) {
2048
- const now = Date.now();
1157
+ if (!headers) { return parsed; }
2049
1158
 
2050
- const startedAt = timestamps[tail];
1159
+ utils.forEach(headers.split('\n'), function parser(line) {
1160
+ i = line.indexOf(':');
1161
+ key = utils.trim(line.substr(0, i)).toLowerCase();
1162
+ val = utils.trim(line.substr(i + 1));
2051
1163
 
2052
- if (!firstSampleTS) {
2053
- firstSampleTS = now;
1164
+ if (key) {
1165
+ if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
1166
+ return;
1167
+ }
1168
+ if (key === 'set-cookie') {
1169
+ parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
1170
+ } else {
1171
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1172
+ }
2054
1173
  }
1174
+ });
2055
1175
 
2056
- bytes[head] = chunkLength;
2057
- timestamps[head] = now;
1176
+ return parsed;
1177
+ };
2058
1178
 
2059
- let i = tail;
2060
- let bytesCount = 0;
1179
+ var isURLSameOrigin = (
1180
+ utils.isStandardBrowserEnv() ?
2061
1181
 
2062
- while (i !== head) {
2063
- bytesCount += bytes[i++];
2064
- i = i % samplesCount;
2065
- }
1182
+ // Standard browser envs have full support of the APIs needed to test
1183
+ // whether the request URL is of the same origin as current location.
1184
+ (function standardBrowserEnv() {
1185
+ var msie = /(msie|trident)/i.test(navigator.userAgent);
1186
+ var urlParsingNode = document.createElement('a');
1187
+ var originURL;
2066
1188
 
2067
- head = (head + 1) % samplesCount;
1189
+ /**
1190
+ * Parse a URL to discover it's components
1191
+ *
1192
+ * @param {String} url The URL to be parsed
1193
+ * @returns {Object}
1194
+ */
1195
+ function resolveURL(url) {
1196
+ var href = url;
2068
1197
 
2069
- if (head === tail) {
2070
- tail = (tail + 1) % samplesCount;
2071
- }
1198
+ if (msie) {
1199
+ // IE needs attribute set twice to normalize properties
1200
+ urlParsingNode.setAttribute('href', href);
1201
+ href = urlParsingNode.href;
1202
+ }
2072
1203
 
2073
- if (now - firstSampleTS < min) {
2074
- return;
2075
- }
1204
+ urlParsingNode.setAttribute('href', href);
2076
1205
 
2077
- const passed = startedAt && now - startedAt;
1206
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
1207
+ return {
1208
+ href: urlParsingNode.href,
1209
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
1210
+ host: urlParsingNode.host,
1211
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
1212
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
1213
+ hostname: urlParsingNode.hostname,
1214
+ port: urlParsingNode.port,
1215
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
1216
+ urlParsingNode.pathname :
1217
+ '/' + urlParsingNode.pathname
1218
+ };
1219
+ }
2078
1220
 
2079
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2080
- };
2081
- }
1221
+ originURL = resolveURL(window.location.href);
2082
1222
 
2083
- function progressEventReducer(listener, isDownloadStream) {
2084
- let bytesNotified = 0;
2085
- const _speedometer = speedometer(50, 250);
2086
-
2087
- return e => {
2088
- const loaded = e.loaded;
2089
- const total = e.lengthComputable ? e.total : undefined;
2090
- const progressBytes = loaded - bytesNotified;
2091
- const rate = _speedometer(progressBytes);
2092
- const inRange = loaded <= total;
2093
-
2094
- bytesNotified = loaded;
2095
-
2096
- const data = {
2097
- loaded,
2098
- total,
2099
- progress: total ? (loaded / total) : undefined,
2100
- bytes: progressBytes,
2101
- rate: rate ? rate : undefined,
2102
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined
2103
- };
1223
+ /**
1224
+ * Determine if a URL shares the same origin as the current location
1225
+ *
1226
+ * @param {String} requestURL The URL to test
1227
+ * @returns {boolean} True if URL shares the same origin, otherwise false
1228
+ */
1229
+ return function isURLSameOrigin(requestURL) {
1230
+ var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
1231
+ return (parsed.protocol === originURL.protocol &&
1232
+ parsed.host === originURL.host);
1233
+ };
1234
+ })() :
2104
1235
 
2105
- data[isDownloadStream ? 'download' : 'upload'] = true;
1236
+ // Non standard browser envs (web workers, react-native) lack needed support.
1237
+ (function nonStandardBrowserEnv() {
1238
+ return function isURLSameOrigin() {
1239
+ return true;
1240
+ };
1241
+ })()
1242
+ );
2106
1243
 
2107
- listener(data);
2108
- };
1244
+ /**
1245
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1246
+ *
1247
+ * @class
1248
+ * @param {string=} message The message.
1249
+ */
1250
+ function CanceledError(message) {
1251
+ // eslint-disable-next-line no-eq-null,eqeqeq
1252
+ AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED);
1253
+ this.name = 'CanceledError';
2109
1254
  }
2110
1255
 
2111
- function xhrAdapter(config) {
1256
+ utils.inherits(CanceledError, AxiosError_1, {
1257
+ __CANCEL__: true
1258
+ });
1259
+
1260
+ var CanceledError_1 = CanceledError;
1261
+
1262
+ var parseProtocol = function parseProtocol(url) {
1263
+ var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1264
+ return match && match[1] || '';
1265
+ };
1266
+
1267
+ var xhr = function xhrAdapter(config) {
2112
1268
  return new Promise(function dispatchXhrRequest(resolve, reject) {
2113
- let requestData = config.data;
2114
- const requestHeaders = AxiosHeaders.from(config.headers).normalize();
2115
- const responseType = config.responseType;
2116
- let onCanceled;
1269
+ var requestData = config.data;
1270
+ var requestHeaders = config.headers;
1271
+ var responseType = config.responseType;
1272
+ var onCanceled;
2117
1273
  function done() {
2118
1274
  if (config.cancelToken) {
2119
1275
  config.cancelToken.unsubscribe(onCanceled);
@@ -2124,20 +1280,20 @@ function xhrAdapter(config) {
2124
1280
  }
2125
1281
  }
2126
1282
 
2127
- if (utils.isFormData(requestData) && platform.isStandardBrowserEnv) {
2128
- requestHeaders.setContentType(false); // Let the browser set it
1283
+ if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
1284
+ delete requestHeaders['Content-Type']; // Let the browser set it
2129
1285
  }
2130
1286
 
2131
- let request = new XMLHttpRequest();
1287
+ var request = new XMLHttpRequest();
2132
1288
 
2133
1289
  // HTTP basic authentication
2134
1290
  if (config.auth) {
2135
- const username = config.auth.username || '';
2136
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2137
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
1291
+ var username = config.auth.username || '';
1292
+ var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
1293
+ requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
2138
1294
  }
2139
1295
 
2140
- const fullPath = buildFullPath(config.baseURL, config.url);
1296
+ var fullPath = buildFullPath(config.baseURL, config.url);
2141
1297
 
2142
1298
  request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2143
1299
 
@@ -2149,18 +1305,16 @@ function xhrAdapter(config) {
2149
1305
  return;
2150
1306
  }
2151
1307
  // Prepare the response
2152
- const responseHeaders = AxiosHeaders.from(
2153
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2154
- );
2155
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
1308
+ var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
1309
+ var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2156
1310
  request.responseText : request.response;
2157
- const response = {
1311
+ var response = {
2158
1312
  data: responseData,
2159
1313
  status: request.status,
2160
1314
  statusText: request.statusText,
2161
1315
  headers: responseHeaders,
2162
- config,
2163
- request
1316
+ config: config,
1317
+ request: request
2164
1318
  };
2165
1319
 
2166
1320
  settle(function _resolve(value) {
@@ -2204,7 +1358,7 @@ function xhrAdapter(config) {
2204
1358
  return;
2205
1359
  }
2206
1360
 
2207
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
1361
+ reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
2208
1362
 
2209
1363
  // Clean up request
2210
1364
  request = null;
@@ -2214,7 +1368,7 @@ function xhrAdapter(config) {
2214
1368
  request.onerror = function handleError() {
2215
1369
  // Real errors are hidden from us by the browser
2216
1370
  // onerror should only fire if it's a network error
2217
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
1371
+ reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request, request));
2218
1372
 
2219
1373
  // Clean up request
2220
1374
  request = null;
@@ -2222,14 +1376,14 @@ function xhrAdapter(config) {
2222
1376
 
2223
1377
  // Handle timeout
2224
1378
  request.ontimeout = function handleTimeout() {
2225
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2226
- const transitional = config.transitional || transitionalDefaults;
1379
+ var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
1380
+ var transitional$1 = config.transitional || transitional;
2227
1381
  if (config.timeoutErrorMessage) {
2228
1382
  timeoutErrorMessage = config.timeoutErrorMessage;
2229
1383
  }
2230
- reject(new AxiosError(
1384
+ reject(new AxiosError_1(
2231
1385
  timeoutErrorMessage,
2232
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
1386
+ transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
2233
1387
  config,
2234
1388
  request));
2235
1389
 
@@ -2240,23 +1394,27 @@ function xhrAdapter(config) {
2240
1394
  // Add xsrf header
2241
1395
  // This is only done if running in a standard browser environment.
2242
1396
  // Specifically not if we're in a web worker, or react-native.
2243
- if (platform.isStandardBrowserEnv) {
1397
+ if (utils.isStandardBrowserEnv()) {
2244
1398
  // Add xsrf header
2245
- const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
2246
- && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
1399
+ var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
1400
+ cookies.read(config.xsrfCookieName) :
1401
+ undefined;
2247
1402
 
2248
1403
  if (xsrfValue) {
2249
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
1404
+ requestHeaders[config.xsrfHeaderName] = xsrfValue;
2250
1405
  }
2251
1406
  }
2252
1407
 
2253
- // Remove Content-Type if data is undefined
2254
- requestData === undefined && requestHeaders.setContentType(null);
2255
-
2256
1408
  // Add headers to the request
2257
1409
  if ('setRequestHeader' in request) {
2258
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2259
- request.setRequestHeader(key, val);
1410
+ utils.forEach(requestHeaders, function setRequestHeader(val, key) {
1411
+ if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
1412
+ // Remove Content-Type if data is undefined
1413
+ delete requestHeaders[key];
1414
+ } else {
1415
+ // Otherwise add header to the request
1416
+ request.setRequestHeader(key, val);
1417
+ }
2260
1418
  });
2261
1419
  }
2262
1420
 
@@ -2272,22 +1430,22 @@ function xhrAdapter(config) {
2272
1430
 
2273
1431
  // Handle progress if needed
2274
1432
  if (typeof config.onDownloadProgress === 'function') {
2275
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
1433
+ request.addEventListener('progress', config.onDownloadProgress);
2276
1434
  }
2277
1435
 
2278
1436
  // Not all browsers support upload events
2279
1437
  if (typeof config.onUploadProgress === 'function' && request.upload) {
2280
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
1438
+ request.upload.addEventListener('progress', config.onUploadProgress);
2281
1439
  }
2282
1440
 
2283
1441
  if (config.cancelToken || config.signal) {
2284
1442
  // Handle cancellation
2285
1443
  // eslint-disable-next-line func-names
2286
- onCanceled = cancel => {
1444
+ onCanceled = function(cancel) {
2287
1445
  if (!request) {
2288
1446
  return;
2289
1447
  }
2290
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
1448
+ reject(!cancel || (cancel && cancel.type) ? new CanceledError_1() : cancel);
2291
1449
  request.abort();
2292
1450
  request = null;
2293
1451
  };
@@ -2298,81 +1456,48 @@ function xhrAdapter(config) {
2298
1456
  }
2299
1457
  }
2300
1458
 
2301
- const protocol = parseProtocol(fullPath);
1459
+ if (!requestData) {
1460
+ requestData = null;
1461
+ }
1462
+
1463
+ var protocol = parseProtocol(fullPath);
2302
1464
 
2303
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
2304
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
1465
+ if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
1466
+ reject(new AxiosError_1('Unsupported protocol ' + protocol + ':', AxiosError_1.ERR_BAD_REQUEST, config));
2305
1467
  return;
2306
1468
  }
2307
1469
 
2308
1470
 
2309
1471
  // Send the request
2310
- request.send(requestData || null);
1472
+ request.send(requestData);
2311
1473
  });
2312
- }
2313
-
2314
- const adapters = {
2315
- http: xhrAdapter,
2316
- xhr: xhrAdapter
2317
1474
  };
2318
1475
 
2319
- const adapters$1 = {
2320
- getAdapter: (nameOrAdapter) => {
2321
- if(utils.isString(nameOrAdapter)){
2322
- const adapter = adapters[nameOrAdapter];
2323
-
2324
- if (!nameOrAdapter) {
2325
- throw Error(
2326
- utils.hasOwnProp(nameOrAdapter) ?
2327
- `Adapter '${nameOrAdapter}' is not available in the build` :
2328
- `Can not resolve adapter '${nameOrAdapter}'`
2329
- );
2330
- }
2331
-
2332
- return adapter
2333
- }
2334
-
2335
- if (!utils.isFunction(nameOrAdapter)) {
2336
- throw new TypeError('adapter is not a function');
2337
- }
2338
-
2339
- return nameOrAdapter;
2340
- },
2341
- adapters
2342
- };
1476
+ // eslint-disable-next-line strict
1477
+ var _null = null;
2343
1478
 
2344
- const DEFAULT_CONTENT_TYPE = {
1479
+ var DEFAULT_CONTENT_TYPE = {
2345
1480
  'Content-Type': 'application/x-www-form-urlencoded'
2346
1481
  };
2347
1482
 
2348
- /**
2349
- * If the browser has an XMLHttpRequest object, use the XHR adapter, otherwise use the HTTP
2350
- * adapter
2351
- *
2352
- * @returns {Function}
2353
- */
1483
+ function setContentTypeIfUnset(headers, value) {
1484
+ if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
1485
+ headers['Content-Type'] = value;
1486
+ }
1487
+ }
1488
+
2354
1489
  function getDefaultAdapter() {
2355
- let adapter;
1490
+ var adapter;
2356
1491
  if (typeof XMLHttpRequest !== 'undefined') {
2357
1492
  // For browsers use XHR adapter
2358
- adapter = adapters$1.getAdapter('xhr');
2359
- } else if (typeof process !== 'undefined' && utils.kindOf(process) === 'process') {
1493
+ adapter = xhr;
1494
+ } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
2360
1495
  // For node use HTTP adapter
2361
- adapter = adapters$1.getAdapter('http');
1496
+ adapter = xhr;
2362
1497
  }
2363
1498
  return adapter;
2364
1499
  }
2365
1500
 
2366
- /**
2367
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2368
- * of the input
2369
- *
2370
- * @param {any} rawValue - The value to be stringified.
2371
- * @param {Function} parser - A function that parses a string into a JavaScript object.
2372
- * @param {Function} encoder - A function that takes a value and returns a string.
2373
- *
2374
- * @returns {string} A stringified version of the rawValue.
2375
- */
2376
1501
  function stringifySafely(rawValue, parser, encoder) {
2377
1502
  if (utils.isString(rawValue)) {
2378
1503
  try {
@@ -2388,31 +1513,18 @@ function stringifySafely(rawValue, parser, encoder) {
2388
1513
  return (encoder || JSON.stringify)(rawValue);
2389
1514
  }
2390
1515
 
2391
- const defaults = {
1516
+ var defaults = {
2392
1517
 
2393
- transitional: transitionalDefaults,
1518
+ transitional: transitional,
2394
1519
 
2395
1520
  adapter: getDefaultAdapter(),
2396
1521
 
2397
1522
  transformRequest: [function transformRequest(data, headers) {
2398
- const contentType = headers.getContentType() || '';
2399
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
2400
- const isObjectPayload = utils.isObject(data);
2401
-
2402
- if (isObjectPayload && utils.isHTMLForm(data)) {
2403
- data = new FormData(data);
2404
- }
1523
+ normalizeHeaderName(headers, 'Accept');
1524
+ normalizeHeaderName(headers, 'Content-Type');
2405
1525
 
2406
- const isFormData = utils.isFormData(data);
2407
-
2408
- if (isFormData) {
2409
- if (!hasJSONContentType) {
2410
- return data;
2411
- }
2412
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2413
- }
2414
-
2415
- if (utils.isArrayBuffer(data) ||
1526
+ if (utils.isFormData(data) ||
1527
+ utils.isArrayBuffer(data) ||
2416
1528
  utils.isBuffer(data) ||
2417
1529
  utils.isStream(data) ||
2418
1530
  utils.isFile(data) ||
@@ -2424,30 +1536,20 @@ const defaults = {
2424
1536
  return data.buffer;
2425
1537
  }
2426
1538
  if (utils.isURLSearchParams(data)) {
2427
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1539
+ setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
2428
1540
  return data.toString();
2429
1541
  }
2430
1542
 
2431
- let isFileList;
1543
+ var isObjectPayload = utils.isObject(data);
1544
+ var contentType = headers && headers['Content-Type'];
2432
1545
 
2433
- if (isObjectPayload) {
2434
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2435
- return toURLEncodedForm(data, this.formSerializer).toString();
2436
- }
2437
-
2438
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2439
- const _FormData = this.env && this.env.FormData;
2440
-
2441
- return toFormData(
2442
- isFileList ? {'files[]': data} : data,
2443
- _FormData && new _FormData(),
2444
- this.formSerializer
2445
- );
2446
- }
2447
- }
1546
+ var isFileList;
2448
1547
 
2449
- if (isObjectPayload || hasJSONContentType ) {
2450
- headers.setContentType('application/json', false);
1548
+ if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
1549
+ var _FormData = this.env && this.env.FormData;
1550
+ return toFormData_1(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
1551
+ } else if (isObjectPayload || contentType === 'application/json') {
1552
+ setContentTypeIfUnset(headers, 'application/json');
2451
1553
  return stringifySafely(data);
2452
1554
  }
2453
1555
 
@@ -2455,20 +1557,18 @@ const defaults = {
2455
1557
  }],
2456
1558
 
2457
1559
  transformResponse: [function transformResponse(data) {
2458
- const transitional = this.transitional || defaults.transitional;
2459
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2460
- const JSONRequested = this.responseType === 'json';
2461
-
2462
- if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
2463
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
2464
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
1560
+ var transitional = this.transitional || defaults.transitional;
1561
+ var silentJSONParsing = transitional && transitional.silentJSONParsing;
1562
+ var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1563
+ var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
2465
1564
 
1565
+ if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
2466
1566
  try {
2467
1567
  return JSON.parse(data);
2468
1568
  } catch (e) {
2469
1569
  if (strictJSONParsing) {
2470
1570
  if (e.name === 'SyntaxError') {
2471
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1571
+ throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
2472
1572
  }
2473
1573
  throw e;
2474
1574
  }
@@ -2491,8 +1591,7 @@ const defaults = {
2491
1591
  maxBodyLength: -1,
2492
1592
 
2493
1593
  env: {
2494
- FormData: platform.classes.FormData,
2495
- Blob: platform.classes.Blob
1594
+ FormData: _null
2496
1595
  },
2497
1596
 
2498
1597
  validateStatus: function validateStatus(status) {
@@ -2514,39 +1613,32 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2514
1613
  defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
2515
1614
  });
2516
1615
 
1616
+ var defaults_1 = defaults;
1617
+
2517
1618
  /**
2518
1619
  * Transform the data for a request or a response
2519
1620
  *
1621
+ * @param {Object|String} data The data to be transformed
1622
+ * @param {Array} headers The headers for the request or response
2520
1623
  * @param {Array|Function} fns A single function or Array of functions
2521
- * @param {?Object} response The response object
2522
- *
2523
1624
  * @returns {*} The resulting transformed data
2524
1625
  */
2525
- function transformData(fns, response) {
2526
- const config = this || defaults;
2527
- const context = response || config;
2528
- const headers = AxiosHeaders.from(context.headers);
2529
- let data = context.data;
2530
-
1626
+ var transformData = function transformData(data, headers, fns) {
1627
+ var context = this || defaults_1;
1628
+ /*eslint no-param-reassign:0*/
2531
1629
  utils.forEach(fns, function transform(fn) {
2532
- data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1630
+ data = fn.call(context, data, headers);
2533
1631
  });
2534
1632
 
2535
- headers.normalize();
2536
-
2537
1633
  return data;
2538
- }
1634
+ };
2539
1635
 
2540
- function isCancel(value) {
1636
+ var isCancel = function isCancel(value) {
2541
1637
  return !!(value && value.__CANCEL__);
2542
- }
1638
+ };
2543
1639
 
2544
1640
  /**
2545
1641
  * Throws a `CanceledError` if cancellation has been requested.
2546
- *
2547
- * @param {Object} config The config that is to be used for the request
2548
- *
2549
- * @returns {void}
2550
1642
  */
2551
1643
  function throwIfCancellationRequested(config) {
2552
1644
  if (config.cancelToken) {
@@ -2554,7 +1646,7 @@ function throwIfCancellationRequested(config) {
2554
1646
  }
2555
1647
 
2556
1648
  if (config.signal && config.signal.aborted) {
2557
- throw new CanceledError();
1649
+ throw new CanceledError_1();
2558
1650
  }
2559
1651
  }
2560
1652
 
@@ -2562,21 +1654,37 @@ function throwIfCancellationRequested(config) {
2562
1654
  * Dispatch a request to the server using the configured adapter.
2563
1655
  *
2564
1656
  * @param {object} config The config that is to be used for the request
2565
- *
2566
1657
  * @returns {Promise} The Promise to be fulfilled
2567
1658
  */
2568
- function dispatchRequest(config) {
1659
+ var dispatchRequest = function dispatchRequest(config) {
2569
1660
  throwIfCancellationRequested(config);
2570
1661
 
2571
- config.headers = AxiosHeaders.from(config.headers);
1662
+ // Ensure headers exist
1663
+ config.headers = config.headers || {};
2572
1664
 
2573
1665
  // Transform request data
2574
1666
  config.data = transformData.call(
2575
1667
  config,
1668
+ config.data,
1669
+ config.headers,
2576
1670
  config.transformRequest
2577
1671
  );
2578
1672
 
2579
- const adapter = config.adapter || defaults.adapter;
1673
+ // Flatten headers
1674
+ config.headers = utils.merge(
1675
+ config.headers.common || {},
1676
+ config.headers[config.method] || {},
1677
+ config.headers
1678
+ );
1679
+
1680
+ utils.forEach(
1681
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
1682
+ function cleanHeaderConfig(method) {
1683
+ delete config.headers[method];
1684
+ }
1685
+ );
1686
+
1687
+ var adapter = config.adapter || defaults_1.adapter;
2580
1688
 
2581
1689
  return adapter(config).then(function onAdapterResolution(response) {
2582
1690
  throwIfCancellationRequested(config);
@@ -2584,12 +1692,11 @@ function dispatchRequest(config) {
2584
1692
  // Transform response data
2585
1693
  response.data = transformData.call(
2586
1694
  config,
2587
- config.transformResponse,
2588
- response
1695
+ response.data,
1696
+ response.headers,
1697
+ config.transformResponse
2589
1698
  );
2590
1699
 
2591
- response.headers = AxiosHeaders.from(response.headers);
2592
-
2593
1700
  return response;
2594
1701
  }, function onAdapterRejection(reason) {
2595
1702
  if (!isCancel(reason)) {
@@ -2599,16 +1706,16 @@ function dispatchRequest(config) {
2599
1706
  if (reason && reason.response) {
2600
1707
  reason.response.data = transformData.call(
2601
1708
  config,
2602
- config.transformResponse,
2603
- reason.response
1709
+ reason.response.data,
1710
+ reason.response.headers,
1711
+ config.transformResponse
2604
1712
  );
2605
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
2606
1713
  }
2607
1714
  }
2608
1715
 
2609
1716
  return Promise.reject(reason);
2610
1717
  });
2611
- }
1718
+ };
2612
1719
 
2613
1720
  /**
2614
1721
  * Config-specific merge-function which creates a new config-object
@@ -2616,13 +1723,12 @@ function dispatchRequest(config) {
2616
1723
  *
2617
1724
  * @param {Object} config1
2618
1725
  * @param {Object} config2
2619
- *
2620
1726
  * @returns {Object} New object resulting from merging config2 to config1
2621
1727
  */
2622
- function mergeConfig(config1, config2) {
1728
+ var mergeConfig = function mergeConfig(config1, config2) {
2623
1729
  // eslint-disable-next-line no-param-reassign
2624
1730
  config2 = config2 || {};
2625
- const config = {};
1731
+ var config = {};
2626
1732
 
2627
1733
  function getMergedValue(target, source) {
2628
1734
  if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
@@ -2669,7 +1775,7 @@ function mergeConfig(config1, config2) {
2669
1775
  }
2670
1776
  }
2671
1777
 
2672
- const mergeMap = {
1778
+ var mergeMap = {
2673
1779
  'url': valueFromConfig2,
2674
1780
  'method': valueFromConfig2,
2675
1781
  'data': valueFromConfig2,
@@ -2700,34 +1806,37 @@ function mergeConfig(config1, config2) {
2700
1806
  };
2701
1807
 
2702
1808
  utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
2703
- const merge = mergeMap[prop] || mergeDeepProperties;
2704
- const configValue = merge(prop);
1809
+ var merge = mergeMap[prop] || mergeDeepProperties;
1810
+ var configValue = merge(prop);
2705
1811
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2706
1812
  });
2707
1813
 
2708
1814
  return config;
2709
- }
1815
+ };
1816
+
1817
+ var data = {
1818
+ "version": "0.27.2"
1819
+ };
1820
+
1821
+ var VERSION = data.version;
2710
1822
 
2711
- const VERSION = "1.0.0";
2712
1823
 
2713
- const validators$1 = {};
1824
+ var validators$1 = {};
2714
1825
 
2715
1826
  // eslint-disable-next-line func-names
2716
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
1827
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
2717
1828
  validators$1[type] = function validator(thing) {
2718
1829
  return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2719
1830
  };
2720
1831
  });
2721
1832
 
2722
- const deprecatedWarnings = {};
1833
+ var deprecatedWarnings = {};
2723
1834
 
2724
1835
  /**
2725
1836
  * Transitional option validator
2726
- *
2727
1837
  * @param {function|boolean?} validator - set to false if the transitional option has been removed
2728
1838
  * @param {string?} version - deprecated version / removed since version
2729
1839
  * @param {string?} message - some message with additional info
2730
- *
2731
1840
  * @returns {function}
2732
1841
  */
2733
1842
  validators$1.transitional = function transitional(validator, version, message) {
@@ -2736,11 +1845,11 @@ validators$1.transitional = function transitional(validator, version, message) {
2736
1845
  }
2737
1846
 
2738
1847
  // eslint-disable-next-line func-names
2739
- return (value, opt, opts) => {
1848
+ return function(value, opt, opts) {
2740
1849
  if (validator === false) {
2741
- throw new AxiosError(
1850
+ throw new AxiosError_1(
2742
1851
  formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
2743
- AxiosError.ERR_DEPRECATED
1852
+ AxiosError_1.ERR_DEPRECATED
2744
1853
  );
2745
1854
  }
2746
1855
 
@@ -2761,192 +1870,162 @@ validators$1.transitional = function transitional(validator, version, message) {
2761
1870
 
2762
1871
  /**
2763
1872
  * Assert object's properties type
2764
- *
2765
1873
  * @param {object} options
2766
1874
  * @param {object} schema
2767
1875
  * @param {boolean?} allowUnknown
2768
- *
2769
- * @returns {object}
2770
1876
  */
2771
1877
 
2772
1878
  function assertOptions(options, schema, allowUnknown) {
2773
1879
  if (typeof options !== 'object') {
2774
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
1880
+ throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
2775
1881
  }
2776
- const keys = Object.keys(options);
2777
- let i = keys.length;
1882
+ var keys = Object.keys(options);
1883
+ var i = keys.length;
2778
1884
  while (i-- > 0) {
2779
- const opt = keys[i];
2780
- const validator = schema[opt];
1885
+ var opt = keys[i];
1886
+ var validator = schema[opt];
2781
1887
  if (validator) {
2782
- const value = options[opt];
2783
- const result = value === undefined || validator(value, opt, options);
1888
+ var value = options[opt];
1889
+ var result = value === undefined || validator(value, opt, options);
2784
1890
  if (result !== true) {
2785
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
1891
+ throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
2786
1892
  }
2787
1893
  continue;
2788
1894
  }
2789
1895
  if (allowUnknown !== true) {
2790
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
1896
+ throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
2791
1897
  }
2792
1898
  }
2793
1899
  }
2794
1900
 
2795
- const validator = {
2796
- assertOptions,
1901
+ var validator = {
1902
+ assertOptions: assertOptions,
2797
1903
  validators: validators$1
2798
1904
  };
2799
1905
 
2800
- const validators = validator.validators;
2801
-
1906
+ var validators = validator.validators;
2802
1907
  /**
2803
1908
  * Create a new instance of Axios
2804
1909
  *
2805
1910
  * @param {Object} instanceConfig The default config for the instance
1911
+ */
1912
+ function Axios(instanceConfig) {
1913
+ this.defaults = instanceConfig;
1914
+ this.interceptors = {
1915
+ request: new InterceptorManager_1(),
1916
+ response: new InterceptorManager_1()
1917
+ };
1918
+ }
1919
+
1920
+ /**
1921
+ * Dispatch a request
2806
1922
  *
2807
- * @return {Axios} A new instance of Axios
1923
+ * @param {Object} config The config specific for this request (merged with this.defaults)
2808
1924
  */
2809
- class Axios {
2810
- constructor(instanceConfig) {
2811
- this.defaults = instanceConfig;
2812
- this.interceptors = {
2813
- request: new InterceptorManager(),
2814
- response: new InterceptorManager()
2815
- };
1925
+ Axios.prototype.request = function request(configOrUrl, config) {
1926
+ /*eslint no-param-reassign:0*/
1927
+ // Allow for axios('example/url'[, config]) a la fetch API
1928
+ if (typeof configOrUrl === 'string') {
1929
+ config = config || {};
1930
+ config.url = configOrUrl;
1931
+ } else {
1932
+ config = configOrUrl || {};
2816
1933
  }
2817
1934
 
2818
- /**
2819
- * Dispatch a request
2820
- *
2821
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2822
- * @param {?Object} config
2823
- *
2824
- * @returns {Promise} The Promise to be fulfilled
2825
- */
2826
- request(configOrUrl, config) {
2827
- /*eslint no-param-reassign:0*/
2828
- // Allow for axios('example/url'[, config]) a la fetch API
2829
- if (typeof configOrUrl === 'string') {
2830
- config = config || {};
2831
- config.url = configOrUrl;
2832
- } else {
2833
- config = configOrUrl || {};
2834
- }
2835
-
2836
- config = mergeConfig(this.defaults, config);
2837
-
2838
- const transitional = config.transitional;
2839
-
2840
- if (transitional !== undefined) {
2841
- validator.assertOptions(transitional, {
2842
- silentJSONParsing: validators.transitional(validators.boolean),
2843
- forcedJSONParsing: validators.transitional(validators.boolean),
2844
- clarifyTimeoutError: validators.transitional(validators.boolean)
2845
- }, false);
2846
- }
2847
-
2848
- // Set config.method
2849
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2850
-
2851
- // Flatten headers
2852
- const defaultHeaders = config.headers && utils.merge(
2853
- config.headers.common,
2854
- config.headers[config.method]
2855
- );
1935
+ config = mergeConfig(this.defaults, config);
2856
1936
 
2857
- defaultHeaders && utils.forEach(
2858
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
2859
- function cleanHeaderConfig(method) {
2860
- delete config.headers[method];
2861
- }
2862
- );
1937
+ // Set config.method
1938
+ if (config.method) {
1939
+ config.method = config.method.toLowerCase();
1940
+ } else if (this.defaults.method) {
1941
+ config.method = this.defaults.method.toLowerCase();
1942
+ } else {
1943
+ config.method = 'get';
1944
+ }
2863
1945
 
2864
- config.headers = new AxiosHeaders(config.headers, defaultHeaders);
1946
+ var transitional = config.transitional;
2865
1947
 
2866
- // filter out skipped interceptors
2867
- const requestInterceptorChain = [];
2868
- let synchronousRequestInterceptors = true;
2869
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2870
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
2871
- return;
2872
- }
1948
+ if (transitional !== undefined) {
1949
+ validator.assertOptions(transitional, {
1950
+ silentJSONParsing: validators.transitional(validators.boolean),
1951
+ forcedJSONParsing: validators.transitional(validators.boolean),
1952
+ clarifyTimeoutError: validators.transitional(validators.boolean)
1953
+ }, false);
1954
+ }
2873
1955
 
2874
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
1956
+ // filter out skipped interceptors
1957
+ var requestInterceptorChain = [];
1958
+ var synchronousRequestInterceptors = true;
1959
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
1960
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
1961
+ return;
1962
+ }
2875
1963
 
2876
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2877
- });
1964
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2878
1965
 
2879
- const responseInterceptorChain = [];
2880
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2881
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2882
- });
1966
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
1967
+ });
2883
1968
 
2884
- let promise;
2885
- let i = 0;
2886
- let len;
1969
+ var responseInterceptorChain = [];
1970
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
1971
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
1972
+ });
2887
1973
 
2888
- if (!synchronousRequestInterceptors) {
2889
- const chain = [dispatchRequest.bind(this), undefined];
2890
- chain.unshift.apply(chain, requestInterceptorChain);
2891
- chain.push.apply(chain, responseInterceptorChain);
2892
- len = chain.length;
1974
+ var promise;
2893
1975
 
2894
- promise = Promise.resolve(config);
1976
+ if (!synchronousRequestInterceptors) {
1977
+ var chain = [dispatchRequest, undefined];
2895
1978
 
2896
- while (i < len) {
2897
- promise = promise.then(chain[i++], chain[i++]);
2898
- }
1979
+ Array.prototype.unshift.apply(chain, requestInterceptorChain);
1980
+ chain = chain.concat(responseInterceptorChain);
2899
1981
 
2900
- return promise;
1982
+ promise = Promise.resolve(config);
1983
+ while (chain.length) {
1984
+ promise = promise.then(chain.shift(), chain.shift());
2901
1985
  }
2902
1986
 
2903
- len = requestInterceptorChain.length;
2904
-
2905
- let newConfig = config;
2906
-
2907
- i = 0;
1987
+ return promise;
1988
+ }
2908
1989
 
2909
- while (i < len) {
2910
- const onFulfilled = requestInterceptorChain[i++];
2911
- const onRejected = requestInterceptorChain[i++];
2912
- try {
2913
- newConfig = onFulfilled(newConfig);
2914
- } catch (error) {
2915
- onRejected.call(this, error);
2916
- break;
2917
- }
2918
- }
2919
1990
 
1991
+ var newConfig = config;
1992
+ while (requestInterceptorChain.length) {
1993
+ var onFulfilled = requestInterceptorChain.shift();
1994
+ var onRejected = requestInterceptorChain.shift();
2920
1995
  try {
2921
- promise = dispatchRequest.call(this, newConfig);
1996
+ newConfig = onFulfilled(newConfig);
2922
1997
  } catch (error) {
2923
- return Promise.reject(error);
2924
- }
2925
-
2926
- i = 0;
2927
- len = responseInterceptorChain.length;
2928
-
2929
- while (i < len) {
2930
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
1998
+ onRejected(error);
1999
+ break;
2931
2000
  }
2001
+ }
2932
2002
 
2933
- return promise;
2003
+ try {
2004
+ promise = dispatchRequest(newConfig);
2005
+ } catch (error) {
2006
+ return Promise.reject(error);
2934
2007
  }
2935
2008
 
2936
- getUri(config) {
2937
- config = mergeConfig(this.defaults, config);
2938
- const fullPath = buildFullPath(config.baseURL, config.url);
2939
- return buildURL(fullPath, config.params, config.paramsSerializer);
2009
+ while (responseInterceptorChain.length) {
2010
+ promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
2940
2011
  }
2941
- }
2012
+
2013
+ return promise;
2014
+ };
2015
+
2016
+ Axios.prototype.getUri = function getUri(config) {
2017
+ config = mergeConfig(this.defaults, config);
2018
+ var fullPath = buildFullPath(config.baseURL, config.url);
2019
+ return buildURL(fullPath, config.params, config.paramsSerializer);
2020
+ };
2942
2021
 
2943
2022
  // Provide aliases for supported request methods
2944
2023
  utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2945
2024
  /*eslint func-names:0*/
2946
2025
  Axios.prototype[method] = function(url, config) {
2947
2026
  return this.request(mergeConfig(config || {}, {
2948
- method,
2949
- url,
2027
+ method: method,
2028
+ url: url,
2950
2029
  data: (config || {}).data
2951
2030
  }));
2952
2031
  };
@@ -2958,12 +2037,12 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2958
2037
  function generateHTTPMethod(isForm) {
2959
2038
  return function httpMethod(url, data, config) {
2960
2039
  return this.request(mergeConfig(config || {}, {
2961
- method,
2040
+ method: method,
2962
2041
  headers: isForm ? {
2963
2042
  'Content-Type': 'multipart/form-data'
2964
2043
  } : {},
2965
- url,
2966
- data
2044
+ url: url,
2045
+ data: data
2967
2046
  }));
2968
2047
  };
2969
2048
  }
@@ -2973,121 +2052,123 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2973
2052
  Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
2974
2053
  });
2975
2054
 
2055
+ var Axios_1 = Axios;
2056
+
2976
2057
  /**
2977
2058
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
2978
2059
  *
2060
+ * @class
2979
2061
  * @param {Function} executor The executor function.
2980
- *
2981
- * @returns {CancelToken}
2982
2062
  */
2983
- class CancelToken {
2984
- constructor(executor) {
2985
- if (typeof executor !== 'function') {
2986
- throw new TypeError('executor must be a function.');
2987
- }
2063
+ function CancelToken(executor) {
2064
+ if (typeof executor !== 'function') {
2065
+ throw new TypeError('executor must be a function.');
2066
+ }
2988
2067
 
2989
- let resolvePromise;
2068
+ var resolvePromise;
2990
2069
 
2991
- this.promise = new Promise(function promiseExecutor(resolve) {
2992
- resolvePromise = resolve;
2993
- });
2070
+ this.promise = new Promise(function promiseExecutor(resolve) {
2071
+ resolvePromise = resolve;
2072
+ });
2994
2073
 
2995
- const token = this;
2074
+ var token = this;
2996
2075
 
2997
- // eslint-disable-next-line func-names
2998
- this.promise.then(cancel => {
2999
- if (!token._listeners) return;
2076
+ // eslint-disable-next-line func-names
2077
+ this.promise.then(function(cancel) {
2078
+ if (!token._listeners) return;
3000
2079
 
3001
- let i = token._listeners.length;
2080
+ var i;
2081
+ var l = token._listeners.length;
3002
2082
 
3003
- while (i-- > 0) {
3004
- token._listeners[i](cancel);
3005
- }
3006
- token._listeners = null;
3007
- });
2083
+ for (i = 0; i < l; i++) {
2084
+ token._listeners[i](cancel);
2085
+ }
2086
+ token._listeners = null;
2087
+ });
3008
2088
 
2089
+ // eslint-disable-next-line func-names
2090
+ this.promise.then = function(onfulfilled) {
2091
+ var _resolve;
3009
2092
  // eslint-disable-next-line func-names
3010
- this.promise.then = onfulfilled => {
3011
- let _resolve;
3012
- // eslint-disable-next-line func-names
3013
- const promise = new Promise(resolve => {
3014
- token.subscribe(resolve);
3015
- _resolve = resolve;
3016
- }).then(onfulfilled);
3017
-
3018
- promise.cancel = function reject() {
3019
- token.unsubscribe(_resolve);
3020
- };
2093
+ var promise = new Promise(function(resolve) {
2094
+ token.subscribe(resolve);
2095
+ _resolve = resolve;
2096
+ }).then(onfulfilled);
3021
2097
 
3022
- return promise;
2098
+ promise.cancel = function reject() {
2099
+ token.unsubscribe(_resolve);
3023
2100
  };
3024
2101
 
3025
- executor(function cancel(message, config, request) {
3026
- if (token.reason) {
3027
- // Cancellation has already been requested
3028
- return;
3029
- }
3030
-
3031
- token.reason = new CanceledError(message, config, request);
3032
- resolvePromise(token.reason);
3033
- });
3034
- }
2102
+ return promise;
2103
+ };
3035
2104
 
3036
- /**
3037
- * Throws a `CanceledError` if cancellation has been requested.
3038
- */
3039
- throwIfRequested() {
3040
- if (this.reason) {
3041
- throw this.reason;
2105
+ executor(function cancel(message) {
2106
+ if (token.reason) {
2107
+ // Cancellation has already been requested
2108
+ return;
3042
2109
  }
2110
+
2111
+ token.reason = new CanceledError_1(message);
2112
+ resolvePromise(token.reason);
2113
+ });
2114
+ }
2115
+
2116
+ /**
2117
+ * Throws a `CanceledError` if cancellation has been requested.
2118
+ */
2119
+ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
2120
+ if (this.reason) {
2121
+ throw this.reason;
3043
2122
  }
2123
+ };
3044
2124
 
3045
- /**
3046
- * Subscribe to the cancel signal
3047
- */
2125
+ /**
2126
+ * Subscribe to the cancel signal
2127
+ */
3048
2128
 
3049
- subscribe(listener) {
3050
- if (this.reason) {
3051
- listener(this.reason);
3052
- return;
3053
- }
2129
+ CancelToken.prototype.subscribe = function subscribe(listener) {
2130
+ if (this.reason) {
2131
+ listener(this.reason);
2132
+ return;
2133
+ }
3054
2134
 
3055
- if (this._listeners) {
3056
- this._listeners.push(listener);
3057
- } else {
3058
- this._listeners = [listener];
3059
- }
2135
+ if (this._listeners) {
2136
+ this._listeners.push(listener);
2137
+ } else {
2138
+ this._listeners = [listener];
3060
2139
  }
2140
+ };
3061
2141
 
3062
- /**
3063
- * Unsubscribe from the cancel signal
3064
- */
2142
+ /**
2143
+ * Unsubscribe from the cancel signal
2144
+ */
3065
2145
 
3066
- unsubscribe(listener) {
3067
- if (!this._listeners) {
3068
- return;
3069
- }
3070
- const index = this._listeners.indexOf(listener);
3071
- if (index !== -1) {
3072
- this._listeners.splice(index, 1);
3073
- }
2146
+ CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
2147
+ if (!this._listeners) {
2148
+ return;
3074
2149
  }
3075
-
3076
- /**
3077
- * Returns an object that contains a new `CancelToken` and a function that, when called,
3078
- * cancels the `CancelToken`.
3079
- */
3080
- static source() {
3081
- let cancel;
3082
- const token = new CancelToken(function executor(c) {
3083
- cancel = c;
3084
- });
3085
- return {
3086
- token,
3087
- cancel
3088
- };
2150
+ var index = this._listeners.indexOf(listener);
2151
+ if (index !== -1) {
2152
+ this._listeners.splice(index, 1);
3089
2153
  }
3090
- }
2154
+ };
2155
+
2156
+ /**
2157
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
2158
+ * cancels the `CancelToken`.
2159
+ */
2160
+ CancelToken.source = function source() {
2161
+ var cancel;
2162
+ var token = new CancelToken(function executor(c) {
2163
+ cancel = c;
2164
+ });
2165
+ return {
2166
+ token: token,
2167
+ cancel: cancel
2168
+ };
2169
+ };
2170
+
2171
+ var CancelToken_1 = CancelToken;
3091
2172
 
3092
2173
  /**
3093
2174
  * Syntactic sugar for invoking a function and expanding an array for arguments.
@@ -3107,42 +2188,39 @@ class CancelToken {
3107
2188
  * ```
3108
2189
  *
3109
2190
  * @param {Function} callback
3110
- *
3111
2191
  * @returns {Function}
3112
2192
  */
3113
- function spread(callback) {
2193
+ var spread = function spread(callback) {
3114
2194
  return function wrap(arr) {
3115
2195
  return callback.apply(null, arr);
3116
2196
  };
3117
- }
2197
+ };
3118
2198
 
3119
2199
  /**
3120
2200
  * Determines whether the payload is an error thrown by Axios
3121
2201
  *
3122
2202
  * @param {*} payload The value to test
3123
- *
3124
2203
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3125
2204
  */
3126
- function isAxiosError(payload) {
2205
+ var isAxiosError = function isAxiosError(payload) {
3127
2206
  return utils.isObject(payload) && (payload.isAxiosError === true);
3128
- }
2207
+ };
3129
2208
 
3130
2209
  /**
3131
2210
  * Create an instance of Axios
3132
2211
  *
3133
2212
  * @param {Object} defaultConfig The default config for the instance
3134
- *
3135
- * @returns {Axios} A new instance of Axios
2213
+ * @return {Axios} A new instance of Axios
3136
2214
  */
3137
2215
  function createInstance(defaultConfig) {
3138
- const context = new Axios(defaultConfig);
3139
- const instance = bind(Axios.prototype.request, context);
2216
+ var context = new Axios_1(defaultConfig);
2217
+ var instance = bind(Axios_1.prototype.request, context);
3140
2218
 
3141
2219
  // Copy axios.prototype to instance
3142
- utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
2220
+ utils.extend(instance, Axios_1.prototype, context);
3143
2221
 
3144
2222
  // Copy context to instance
3145
- utils.extend(instance, context, null, {allOwnKeys: true});
2223
+ utils.extend(instance, context);
3146
2224
 
3147
2225
  // Factory for creating new instances
3148
2226
  instance.create = function create(instanceConfig) {
@@ -3153,37 +2231,40 @@ function createInstance(defaultConfig) {
3153
2231
  }
3154
2232
 
3155
2233
  // Create the default instance to be exported
3156
- const axios = createInstance(defaults);
2234
+ var axios$1 = createInstance(defaults_1);
3157
2235
 
3158
2236
  // Expose Axios class to allow class inheritance
3159
- axios.Axios = Axios;
2237
+ axios$1.Axios = Axios_1;
3160
2238
 
3161
2239
  // Expose Cancel & CancelToken
3162
- axios.CanceledError = CanceledError;
3163
- axios.CancelToken = CancelToken;
3164
- axios.isCancel = isCancel;
3165
- axios.VERSION = VERSION;
3166
- axios.toFormData = toFormData;
2240
+ axios$1.CanceledError = CanceledError_1;
2241
+ axios$1.CancelToken = CancelToken_1;
2242
+ axios$1.isCancel = isCancel;
2243
+ axios$1.VERSION = data.version;
2244
+ axios$1.toFormData = toFormData_1;
3167
2245
 
3168
2246
  // Expose AxiosError class
3169
- axios.AxiosError = AxiosError;
2247
+ axios$1.AxiosError = AxiosError_1;
3170
2248
 
3171
2249
  // alias for CanceledError for backward compatibility
3172
- axios.Cancel = axios.CanceledError;
2250
+ axios$1.Cancel = axios$1.CanceledError;
3173
2251
 
3174
2252
  // Expose all/spread
3175
- axios.all = function all(promises) {
2253
+ axios$1.all = function all(promises) {
3176
2254
  return Promise.all(promises);
3177
2255
  };
3178
-
3179
- axios.spread = spread;
2256
+ axios$1.spread = spread;
3180
2257
 
3181
2258
  // Expose isAxiosError
3182
- axios.isAxiosError = isAxiosError;
2259
+ axios$1.isAxiosError = isAxiosError;
3183
2260
 
3184
- axios.formToJSON = thing => {
3185
- return formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
3186
- };
2261
+ var axios_1 = axios$1;
2262
+
2263
+ // Allow use of default import syntax in TypeScript
2264
+ var _default = axios$1;
2265
+ axios_1.default = _default;
2266
+
2267
+ var axios = axios_1;
3187
2268
 
3188
2269
  // --------------------------------------------------------[ mutable store ]
3189
2270
  const storeDef = {