proto-sudoku-wc 0.0.482 → 0.0.483

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