vue-laravel-crud 1.4.4 → 1.4.5

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.
@@ -1,4 +1,4 @@
1
- 'use strict';var http=require('http'),https=require('https'),url=require('url'),require$$0$1=require('stream'),assert=require('assert'),tty=require('tty'),util=require('util'),os=require('os'),zlib=require('zlib');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var http__default=/*#__PURE__*/_interopDefaultLegacy(http);var https__default=/*#__PURE__*/_interopDefaultLegacy(https);var url__default=/*#__PURE__*/_interopDefaultLegacy(url);var require$$0__default=/*#__PURE__*/_interopDefaultLegacy(require$$0$1);var assert__default=/*#__PURE__*/_interopDefaultLegacy(assert);var tty__default=/*#__PURE__*/_interopDefaultLegacy(tty);var util__default=/*#__PURE__*/_interopDefaultLegacy(util);var os__default=/*#__PURE__*/_interopDefaultLegacy(os);var zlib__default=/*#__PURE__*/_interopDefaultLegacy(zlib);function _iterableToArrayLimit(arr, i) {
1
+ 'use strict';function _iterableToArrayLimit(arr, i) {
2
2
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
3
3
  if (null != _i) {
4
4
  var _s,
@@ -564,11 +564,11 @@ var captureMode = {
564
564
  passive: false
565
565
  };
566
566
 
567
- function on(el, event, fn) {
567
+ function on$1(el, event, fn) {
568
568
  el.addEventListener(event, fn, !IE11OrLess && captureMode);
569
569
  }
570
570
 
571
- function off(el, event, fn) {
571
+ function off$1(el, event, fn) {
572
572
  el.removeEventListener(event, fn, !IE11OrLess && captureMode);
573
573
  }
574
574
 
@@ -1190,15 +1190,15 @@ function calculateRealTime(animatingRect, fromRect, toRect, options) {
1190
1190
  }
1191
1191
 
1192
1192
  var plugins = [];
1193
- var defaults$1 = {
1193
+ var defaults$3 = {
1194
1194
  initializeByDefault: true
1195
1195
  };
1196
1196
  var PluginManager = {
1197
1197
  mount: function mount(plugin) {
1198
1198
  // Set default static properties
1199
- for (var option in defaults$1) {
1200
- if (defaults$1.hasOwnProperty(option) && !(option in plugin)) {
1201
- plugin[option] = defaults$1[option];
1199
+ for (var option in defaults$3) {
1200
+ if (defaults$3.hasOwnProperty(option) && !(option in plugin)) {
1201
+ plugin[option] = defaults$3[option];
1202
1202
  }
1203
1203
  }
1204
1204
 
@@ -1673,15 +1673,15 @@ function Sortable(el, options) {
1673
1673
 
1674
1674
 
1675
1675
  if (options.supportPointer) {
1676
- on(el, 'pointerdown', this._onTapStart);
1676
+ on$1(el, 'pointerdown', this._onTapStart);
1677
1677
  } else {
1678
- on(el, 'mousedown', this._onTapStart);
1679
- on(el, 'touchstart', this._onTapStart);
1678
+ on$1(el, 'mousedown', this._onTapStart);
1679
+ on$1(el, 'touchstart', this._onTapStart);
1680
1680
  }
1681
1681
 
1682
1682
  if (this.nativeDraggable) {
1683
- on(el, 'dragover', this);
1684
- on(el, 'dragenter', this);
1683
+ on$1(el, 'dragover', this);
1684
+ on$1(el, 'dragenter', this);
1685
1685
  }
1686
1686
 
1687
1687
  sortables.push(this.el); // Restore sorting
@@ -1870,12 +1870,12 @@ Sortable.prototype =
1870
1870
  options.ignore.split(',').forEach(function (criteria) {
1871
1871
  find(dragEl, criteria.trim(), _disableDraggable);
1872
1872
  });
1873
- on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
1874
- on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
1875
- on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
1876
- on(ownerDocument, 'mouseup', _this._onDrop);
1877
- on(ownerDocument, 'touchend', _this._onDrop);
1878
- on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
1873
+ on$1(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
1874
+ on$1(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
1875
+ on$1(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
1876
+ on$1(ownerDocument, 'mouseup', _this._onDrop);
1877
+ on$1(ownerDocument, 'touchend', _this._onDrop);
1878
+ on$1(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
1879
1879
 
1880
1880
  if (FireFox && this.nativeDraggable) {
1881
1881
  this.options.touchStartThreshold = 4;
@@ -1896,12 +1896,12 @@ Sortable.prototype =
1896
1896
  // disable the delayed drag
1897
1897
 
1898
1898
 
1899
- on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
1900
- on(ownerDocument, 'touchend', _this._disableDelayedDrag);
1901
- on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
1902
- on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
1903
- on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
1904
- options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
1899
+ on$1(ownerDocument, 'mouseup', _this._disableDelayedDrag);
1900
+ on$1(ownerDocument, 'touchend', _this._disableDelayedDrag);
1901
+ on$1(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
1902
+ on$1(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
1903
+ on$1(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
1904
+ options.supportPointer && on$1(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
1905
1905
  _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
1906
1906
  } else {
1907
1907
  dragStartFn();
@@ -1925,12 +1925,12 @@ Sortable.prototype =
1925
1925
  },
1926
1926
  _disableDelayedDragEvents: function _disableDelayedDragEvents() {
1927
1927
  var ownerDocument = this.el.ownerDocument;
1928
- off(ownerDocument, 'mouseup', this._disableDelayedDrag);
1929
- off(ownerDocument, 'touchend', this._disableDelayedDrag);
1930
- off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
1931
- off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
1932
- off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
1933
- off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
1928
+ off$1(ownerDocument, 'mouseup', this._disableDelayedDrag);
1929
+ off$1(ownerDocument, 'touchend', this._disableDelayedDrag);
1930
+ off$1(ownerDocument, 'touchcancel', this._disableDelayedDrag);
1931
+ off$1(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
1932
+ off$1(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
1933
+ off$1(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
1934
1934
  },
1935
1935
  _triggerDragStart: function _triggerDragStart(
1936
1936
  /** Event */
@@ -1941,15 +1941,15 @@ Sortable.prototype =
1941
1941
 
1942
1942
  if (!this.nativeDraggable || touch) {
1943
1943
  if (this.options.supportPointer) {
1944
- on(document, 'pointermove', this._onTouchMove);
1944
+ on$1(document, 'pointermove', this._onTouchMove);
1945
1945
  } else if (touch) {
1946
- on(document, 'touchmove', this._onTouchMove);
1946
+ on$1(document, 'touchmove', this._onTouchMove);
1947
1947
  } else {
1948
- on(document, 'mousemove', this._onTouchMove);
1948
+ on$1(document, 'mousemove', this._onTouchMove);
1949
1949
  }
1950
1950
  } else {
1951
- on(dragEl, 'dragend', this);
1952
- on(rootEl, 'dragstart', this._onDragStart);
1951
+ on$1(dragEl, 'dragend', this);
1952
+ on$1(rootEl, 'dragstart', this._onDragStart);
1953
1953
  }
1954
1954
 
1955
1955
  try {
@@ -1973,7 +1973,7 @@ Sortable.prototype =
1973
1973
  });
1974
1974
 
1975
1975
  if (this.nativeDraggable) {
1976
- on(document, 'dragover', _checkOutsideTargetEl);
1976
+ on$1(document, 'dragover', _checkOutsideTargetEl);
1977
1977
  }
1978
1978
 
1979
1979
  var options = this.options; // Apply effect
@@ -2190,23 +2190,23 @@ Sortable.prototype =
2190
2190
  _this._loopId = setInterval(_this._emulateDragOver, 50);
2191
2191
  } else {
2192
2192
  // Undo what was set in _prepareDragStart before drag started
2193
- off(document, 'mouseup', _this._onDrop);
2194
- off(document, 'touchend', _this._onDrop);
2195
- off(document, 'touchcancel', _this._onDrop);
2193
+ off$1(document, 'mouseup', _this._onDrop);
2194
+ off$1(document, 'touchend', _this._onDrop);
2195
+ off$1(document, 'touchcancel', _this._onDrop);
2196
2196
 
2197
2197
  if (dataTransfer) {
2198
2198
  dataTransfer.effectAllowed = 'move';
2199
2199
  options.setData && options.setData.call(_this, dataTransfer, dragEl);
2200
2200
  }
2201
2201
 
2202
- on(document, 'drop', _this); // #1276 fix:
2202
+ on$1(document, 'drop', _this); // #1276 fix:
2203
2203
 
2204
2204
  css(dragEl, 'transform', 'translateZ(0)');
2205
2205
  }
2206
2206
 
2207
2207
  awaitingDragStarted = true;
2208
2208
  _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
2209
- on(document, 'selectstart', _this);
2209
+ on$1(document, 'selectstart', _this);
2210
2210
  moved = true;
2211
2211
 
2212
2212
  if (Safari) {
@@ -2487,20 +2487,20 @@ Sortable.prototype =
2487
2487
  },
2488
2488
  _ignoreWhileAnimating: null,
2489
2489
  _offMoveEvents: function _offMoveEvents() {
2490
- off(document, 'mousemove', this._onTouchMove);
2491
- off(document, 'touchmove', this._onTouchMove);
2492
- off(document, 'pointermove', this._onTouchMove);
2493
- off(document, 'dragover', nearestEmptyInsertDetectEvent);
2494
- off(document, 'mousemove', nearestEmptyInsertDetectEvent);
2495
- off(document, 'touchmove', nearestEmptyInsertDetectEvent);
2490
+ off$1(document, 'mousemove', this._onTouchMove);
2491
+ off$1(document, 'touchmove', this._onTouchMove);
2492
+ off$1(document, 'pointermove', this._onTouchMove);
2493
+ off$1(document, 'dragover', nearestEmptyInsertDetectEvent);
2494
+ off$1(document, 'mousemove', nearestEmptyInsertDetectEvent);
2495
+ off$1(document, 'touchmove', nearestEmptyInsertDetectEvent);
2496
2496
  },
2497
2497
  _offUpEvents: function _offUpEvents() {
2498
2498
  var ownerDocument = this.el.ownerDocument;
2499
- off(ownerDocument, 'mouseup', this._onDrop);
2500
- off(ownerDocument, 'touchend', this._onDrop);
2501
- off(ownerDocument, 'pointerup', this._onDrop);
2502
- off(ownerDocument, 'touchcancel', this._onDrop);
2503
- off(document, 'selectstart', this);
2499
+ off$1(ownerDocument, 'mouseup', this._onDrop);
2500
+ off$1(ownerDocument, 'touchend', this._onDrop);
2501
+ off$1(ownerDocument, 'pointerup', this._onDrop);
2502
+ off$1(ownerDocument, 'touchcancel', this._onDrop);
2503
+ off$1(document, 'selectstart', this);
2504
2504
  },
2505
2505
  _onDrop: function _onDrop(
2506
2506
  /**Event*/
@@ -2536,8 +2536,8 @@ Sortable.prototype =
2536
2536
 
2537
2537
 
2538
2538
  if (this.nativeDraggable) {
2539
- off(document, 'drop', this);
2540
- off(el, 'dragstart', this._onDragStart);
2539
+ off$1(document, 'drop', this);
2540
+ off$1(el, 'dragstart', this._onDragStart);
2541
2541
  }
2542
2542
 
2543
2543
  this._offMoveEvents();
@@ -2565,7 +2565,7 @@ Sortable.prototype =
2565
2565
 
2566
2566
  if (dragEl) {
2567
2567
  if (this.nativeDraggable) {
2568
- off(dragEl, 'dragend', this);
2568
+ off$1(dragEl, 'dragend', this);
2569
2569
  }
2570
2570
 
2571
2571
  _disableDraggable(dragEl);
@@ -2798,13 +2798,13 @@ Sortable.prototype =
2798
2798
  pluginEvent('destroy', this);
2799
2799
  var el = this.el;
2800
2800
  el[expando] = null;
2801
- off(el, 'mousedown', this._onTapStart);
2802
- off(el, 'touchstart', this._onTapStart);
2803
- off(el, 'pointerdown', this._onTapStart);
2801
+ off$1(el, 'mousedown', this._onTapStart);
2802
+ off$1(el, 'touchstart', this._onTapStart);
2803
+ off$1(el, 'pointerdown', this._onTapStart);
2804
2804
 
2805
2805
  if (this.nativeDraggable) {
2806
- off(el, 'dragover', this);
2807
- off(el, 'dragenter', this);
2806
+ off$1(el, 'dragover', this);
2807
+ off$1(el, 'dragenter', this);
2808
2808
  } // Remove draggable attributes
2809
2809
 
2810
2810
 
@@ -3019,7 +3019,7 @@ function _cancelNextTick(id) {
3019
3019
 
3020
3020
 
3021
3021
  if (documentExists) {
3022
- on(document, 'touchmove', function (evt) {
3022
+ on$1(document, 'touchmove', function (evt) {
3023
3023
  if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
3024
3024
  evt.preventDefault();
3025
3025
  }
@@ -3028,8 +3028,8 @@ if (documentExists) {
3028
3028
 
3029
3029
 
3030
3030
  Sortable.utils = {
3031
- on: on,
3032
- off: off,
3031
+ on: on$1,
3032
+ off: off$1,
3033
3033
  css: css,
3034
3034
  find: find,
3035
3035
  is: function is(el, selector) {
@@ -3120,14 +3120,14 @@ function AutoScrollPlugin() {
3120
3120
  var originalEvent = _ref.originalEvent;
3121
3121
 
3122
3122
  if (this.sortable.nativeDraggable) {
3123
- on(document, 'dragover', this._handleAutoScroll);
3123
+ on$1(document, 'dragover', this._handleAutoScroll);
3124
3124
  } else {
3125
3125
  if (this.options.supportPointer) {
3126
- on(document, 'pointermove', this._handleFallbackAutoScroll);
3126
+ on$1(document, 'pointermove', this._handleFallbackAutoScroll);
3127
3127
  } else if (originalEvent.touches) {
3128
- on(document, 'touchmove', this._handleFallbackAutoScroll);
3128
+ on$1(document, 'touchmove', this._handleFallbackAutoScroll);
3129
3129
  } else {
3130
- on(document, 'mousemove', this._handleFallbackAutoScroll);
3130
+ on$1(document, 'mousemove', this._handleFallbackAutoScroll);
3131
3131
  }
3132
3132
  }
3133
3133
  },
@@ -3141,11 +3141,11 @@ function AutoScrollPlugin() {
3141
3141
  },
3142
3142
  drop: function drop() {
3143
3143
  if (this.sortable.nativeDraggable) {
3144
- off(document, 'dragover', this._handleAutoScroll);
3144
+ off$1(document, 'dragover', this._handleAutoScroll);
3145
3145
  } else {
3146
- off(document, 'pointermove', this._handleFallbackAutoScroll);
3147
- off(document, 'touchmove', this._handleFallbackAutoScroll);
3148
- off(document, 'mousemove', this._handleFallbackAutoScroll);
3146
+ off$1(document, 'pointermove', this._handleFallbackAutoScroll);
3147
+ off$1(document, 'touchmove', this._handleFallbackAutoScroll);
3148
+ off$1(document, 'mousemove', this._handleFallbackAutoScroll);
3149
3149
  }
3150
3150
 
3151
3151
  clearPointerElemChangedInterval();
@@ -3516,14 +3516,14 @@ function MultiDragPlugin() {
3516
3516
  }
3517
3517
 
3518
3518
  if (sortable.options.supportPointer) {
3519
- on(document, 'pointerup', this._deselectMultiDrag);
3519
+ on$1(document, 'pointerup', this._deselectMultiDrag);
3520
3520
  } else {
3521
- on(document, 'mouseup', this._deselectMultiDrag);
3522
- on(document, 'touchend', this._deselectMultiDrag);
3521
+ on$1(document, 'mouseup', this._deselectMultiDrag);
3522
+ on$1(document, 'touchend', this._deselectMultiDrag);
3523
3523
  }
3524
3524
 
3525
- on(document, 'keydown', this._checkKeyDown);
3526
- on(document, 'keyup', this._checkKeyUp);
3525
+ on$1(document, 'keydown', this._checkKeyDown);
3526
+ on$1(document, 'keyup', this._checkKeyUp);
3527
3527
  this.defaults = {
3528
3528
  selectedClass: 'sortable-selected',
3529
3529
  multiDragKey: null,
@@ -3949,11 +3949,11 @@ function MultiDragPlugin() {
3949
3949
  destroyGlobal: function destroyGlobal() {
3950
3950
  this._deselectMultiDrag();
3951
3951
 
3952
- off(document, 'pointerup', this._deselectMultiDrag);
3953
- off(document, 'mouseup', this._deselectMultiDrag);
3954
- off(document, 'touchend', this._deselectMultiDrag);
3955
- off(document, 'keydown', this._checkKeyDown);
3956
- off(document, 'keyup', this._checkKeyUp);
3952
+ off$1(document, 'pointerup', this._deselectMultiDrag);
3953
+ off$1(document, 'mouseup', this._deselectMultiDrag);
3954
+ off$1(document, 'touchend', this._deselectMultiDrag);
3955
+ off$1(document, 'keydown', this._checkKeyDown);
3956
+ off$1(document, 'keyup', this._checkKeyUp);
3957
3957
  },
3958
3958
  _deselectMultiDrag: function _deselectMultiDrag(evt) {
3959
3959
  if (typeof dragStarted !== "undefined" && dragStarted) return; // Only deselect if selection is in this sortable
@@ -6569,7 +6569,7 @@ function isUndefined(val) {
6569
6569
  * @param {Object} val The value to test
6570
6570
  * @returns {boolean} True if value is a Buffer, otherwise false
6571
6571
  */
6572
- function isBuffer$1(val) {
6572
+ function isBuffer(val) {
6573
6573
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
6574
6574
  && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
6575
6575
  }
@@ -6616,7 +6616,7 @@ function isArrayBufferView(val) {
6616
6616
  * @param {Object} val The value to test
6617
6617
  * @returns {boolean} True if value is a String, otherwise false
6618
6618
  */
6619
- function isString$1(val) {
6619
+ function isString(val) {
6620
6620
  return typeof val === 'string';
6621
6621
  }
6622
6622
 
@@ -6691,7 +6691,7 @@ function isBlob(val) {
6691
6691
  * @param {Object} val The value to test
6692
6692
  * @returns {boolean} True if value is a Function, otherwise false
6693
6693
  */
6694
- function isFunction$1(val) {
6694
+ function isFunction(val) {
6695
6695
  return toString.call(val) === '[object Function]';
6696
6696
  }
6697
6697
 
@@ -6702,7 +6702,7 @@ function isFunction$1(val) {
6702
6702
  * @returns {boolean} True if value is a Stream, otherwise false
6703
6703
  */
6704
6704
  function isStream(val) {
6705
- return isObject(val) && isFunction$1(val.pipe);
6705
+ return isObject(val) && isFunction(val.pipe);
6706
6706
  }
6707
6707
 
6708
6708
  /**
@@ -6860,13 +6860,13 @@ function stripBOM(content) {
6860
6860
  return content;
6861
6861
  }
6862
6862
 
6863
- var utils = {
6863
+ var utils$1 = {
6864
6864
  isArray: isArray,
6865
6865
  isArrayBuffer: isArrayBuffer,
6866
- isBuffer: isBuffer$1,
6866
+ isBuffer: isBuffer,
6867
6867
  isFormData: isFormData,
6868
6868
  isArrayBufferView: isArrayBufferView,
6869
- isString: isString$1,
6869
+ isString: isString,
6870
6870
  isNumber: isNumber,
6871
6871
  isObject: isObject,
6872
6872
  isPlainObject: isPlainObject,
@@ -6874,7 +6874,7 @@ var utils = {
6874
6874
  isDate: isDate,
6875
6875
  isFile: isFile,
6876
6876
  isBlob: isBlob,
6877
- isFunction: isFunction$1,
6877
+ isFunction: isFunction,
6878
6878
  isStream: isStream,
6879
6879
  isURLSearchParams: isURLSearchParams,
6880
6880
  isStandardBrowserEnv: isStandardBrowserEnv,
@@ -6909,26 +6909,26 @@ var buildURL = function buildURL(url, params, paramsSerializer) {
6909
6909
  var serializedParams;
6910
6910
  if (paramsSerializer) {
6911
6911
  serializedParams = paramsSerializer(params);
6912
- } else if (utils.isURLSearchParams(params)) {
6912
+ } else if (utils$1.isURLSearchParams(params)) {
6913
6913
  serializedParams = params.toString();
6914
6914
  } else {
6915
6915
  var parts = [];
6916
6916
 
6917
- utils.forEach(params, function serialize(val, key) {
6917
+ utils$1.forEach(params, function serialize(val, key) {
6918
6918
  if (val === null || typeof val === 'undefined') {
6919
6919
  return;
6920
6920
  }
6921
6921
 
6922
- if (utils.isArray(val)) {
6922
+ if (utils$1.isArray(val)) {
6923
6923
  key = key + '[]';
6924
6924
  } else {
6925
6925
  val = [val];
6926
6926
  }
6927
6927
 
6928
- utils.forEach(val, function parseValue(v) {
6929
- if (utils.isDate(v)) {
6928
+ utils$1.forEach(val, function parseValue(v) {
6929
+ if (utils$1.isDate(v)) {
6930
6930
  v = v.toISOString();
6931
- } else if (utils.isObject(v)) {
6931
+ } else if (utils$1.isObject(v)) {
6932
6932
  v = JSON.stringify(v);
6933
6933
  }
6934
6934
  parts.push(encode(key) + '=' + encode(v));
@@ -6988,7 +6988,7 @@ InterceptorManager.prototype.eject = function eject(id) {
6988
6988
  * @param {Function} fn The function to call for each interceptor
6989
6989
  */
6990
6990
  InterceptorManager.prototype.forEach = function forEach(fn) {
6991
- utils.forEach(this.handlers, function forEachHandler(h) {
6991
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
6992
6992
  if (h !== null) {
6993
6993
  fn(h);
6994
6994
  }
@@ -7005,2501 +7005,350 @@ var InterceptorManager_1 = InterceptorManager;/**
7005
7005
  */
7006
7006
  var transformData = function transformData(data, headers, fns) {
7007
7007
  /*eslint no-param-reassign:0*/
7008
- utils.forEach(fns, function transform(fn) {
7008
+ utils$1.forEach(fns, function transform(fn) {
7009
7009
  data = fn(data, headers);
7010
7010
  });
7011
7011
 
7012
7012
  return data;
7013
7013
  };var isCancel = function isCancel(value) {
7014
7014
  return !!(value && value.__CANCEL__);
7015
- };var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
7016
- utils.forEach(headers, function processHeader(value, name) {
7017
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
7018
- headers[normalizedName] = value;
7019
- delete headers[name];
7020
- }
7021
- });
7022
- };/**
7023
- * Update an Error with the specified config, error code, and response.
7024
- *
7025
- * @param {Error} error The error to update.
7026
- * @param {Object} config The config.
7027
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
7028
- * @param {Object} [request] The request.
7029
- * @param {Object} [response] The response.
7030
- * @returns {Error} The error.
7031
- */
7032
- var enhanceError = function enhanceError(error, config, code, request, response) {
7033
- error.config = config;
7034
- if (code) {
7035
- error.code = code;
7036
- }
7037
-
7038
- error.request = request;
7039
- error.response = response;
7040
- error.isAxiosError = true;
7041
-
7042
- error.toJSON = function toJSON() {
7043
- return {
7044
- // Standard
7045
- message: this.message,
7046
- name: this.name,
7047
- // Microsoft
7048
- description: this.description,
7049
- number: this.number,
7050
- // Mozilla
7051
- fileName: this.fileName,
7052
- lineNumber: this.lineNumber,
7053
- columnNumber: this.columnNumber,
7054
- stack: this.stack,
7055
- // Axios
7056
- config: this.config,
7057
- code: this.code
7058
- };
7059
- };
7060
- return error;
7061
- };/**
7062
- * Create an Error with the specified message, config, error code, request and response.
7063
- *
7064
- * @param {string} message The error message.
7065
- * @param {Object} config The config.
7066
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
7067
- * @param {Object} [request] The request.
7068
- * @param {Object} [response] The response.
7069
- * @returns {Error} The created error.
7070
- */
7071
- var createError = function createError(message, config, code, request, response) {
7072
- var error = new Error(message);
7073
- return enhanceError(error, config, code, request, response);
7074
- };/**
7075
- * Resolve or reject a Promise based on response status.
7076
- *
7077
- * @param {Function} resolve A function that resolves the promise.
7078
- * @param {Function} reject A function that rejects the promise.
7079
- * @param {object} response The response.
7080
- */
7081
- var settle = function settle(resolve, reject, response) {
7082
- var validateStatus = response.config.validateStatus;
7083
- if (!response.status || !validateStatus || validateStatus(response.status)) {
7084
- resolve(response);
7085
- } else {
7086
- reject(createError(
7087
- 'Request failed with status code ' + response.status,
7088
- response.config,
7089
- null,
7090
- response.request,
7091
- response
7092
- ));
7093
- }
7094
- };var cookies = (
7095
- utils.isStandardBrowserEnv() ?
7096
-
7097
- // Standard browser envs support document.cookie
7098
- (function standardBrowserEnv() {
7099
- return {
7100
- write: function write(name, value, expires, path, domain, secure) {
7101
- var cookie = [];
7102
- cookie.push(name + '=' + encodeURIComponent(value));
7103
-
7104
- if (utils.isNumber(expires)) {
7105
- cookie.push('expires=' + new Date(expires).toGMTString());
7106
- }
7107
-
7108
- if (utils.isString(path)) {
7109
- cookie.push('path=' + path);
7110
- }
7111
-
7112
- if (utils.isString(domain)) {
7113
- cookie.push('domain=' + domain);
7114
- }
7115
-
7116
- if (secure === true) {
7117
- cookie.push('secure');
7118
- }
7015
+ };var global$1 = (typeof global !== "undefined" ? global :
7016
+ typeof self !== "undefined" ? self :
7017
+ typeof window !== "undefined" ? window : {});// shim for using process in browser
7018
+ // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
7119
7019
 
7120
- document.cookie = cookie.join('; ');
7121
- },
7122
-
7123
- read: function read(name) {
7124
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
7125
- return (match ? decodeURIComponent(match[3]) : null);
7126
- },
7127
-
7128
- remove: function remove(name) {
7129
- this.write(name, '', Date.now() - 86400000);
7130
- }
7131
- };
7132
- })() :
7133
-
7134
- // Non standard browser env (web workers, react-native) lack needed support.
7135
- (function nonStandardBrowserEnv() {
7136
- return {
7137
- write: function write() {},
7138
- read: function read() { return null; },
7139
- remove: function remove() {}
7140
- };
7141
- })()
7142
- );/**
7143
- * Determines whether the specified URL is absolute
7144
- *
7145
- * @param {string} url The URL to test
7146
- * @returns {boolean} True if the specified URL is absolute, otherwise false
7147
- */
7148
- var isAbsoluteURL = function isAbsoluteURL(url) {
7149
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
7150
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
7151
- // by any combination of letters, digits, plus, period, or hyphen.
7152
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
7153
- };/**
7154
- * Creates a new URL by combining the specified URLs
7155
- *
7156
- * @param {string} baseURL The base URL
7157
- * @param {string} relativeURL The relative URL
7158
- * @returns {string} The combined URL
7159
- */
7160
- var combineURLs = function combineURLs(baseURL, relativeURL) {
7161
- return relativeURL
7162
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
7163
- : baseURL;
7164
- };/**
7165
- * Creates a new URL by combining the baseURL with the requestedURL,
7166
- * only when the requestedURL is not already an absolute URL.
7167
- * If the requestURL is absolute, this function returns the requestedURL untouched.
7168
- *
7169
- * @param {string} baseURL The base URL
7170
- * @param {string} requestedURL Absolute or relative URL to combine
7171
- * @returns {string} The combined full path
7172
- */
7173
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
7174
- if (baseURL && !isAbsoluteURL(requestedURL)) {
7175
- return combineURLs(baseURL, requestedURL);
7176
- }
7177
- return requestedURL;
7178
- };// Headers whose duplicates are ignored by node
7179
- // c.f. https://nodejs.org/api/http.html#http_message_headers
7180
- var ignoreDuplicateOf = [
7181
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
7182
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
7183
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
7184
- 'referer', 'retry-after', 'user-agent'
7185
- ];
7186
-
7187
- /**
7188
- * Parse headers into an object
7189
- *
7190
- * ```
7191
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
7192
- * Content-Type: application/json
7193
- * Connection: keep-alive
7194
- * Transfer-Encoding: chunked
7195
- * ```
7196
- *
7197
- * @param {String} headers Headers needing to be parsed
7198
- * @returns {Object} Headers parsed into an object
7199
- */
7200
- var parseHeaders = function parseHeaders(headers) {
7201
- var parsed = {};
7202
- var key;
7203
- var val;
7204
- var i;
7205
-
7206
- if (!headers) { return parsed; }
7207
-
7208
- utils.forEach(headers.split('\n'), function parser(line) {
7209
- i = line.indexOf(':');
7210
- key = utils.trim(line.substr(0, i)).toLowerCase();
7211
- val = utils.trim(line.substr(i + 1));
7020
+ function defaultSetTimout() {
7021
+ throw new Error('setTimeout has not been defined');
7022
+ }
7023
+ function defaultClearTimeout () {
7024
+ throw new Error('clearTimeout has not been defined');
7025
+ }
7026
+ var cachedSetTimeout = defaultSetTimout;
7027
+ var cachedClearTimeout = defaultClearTimeout;
7028
+ if (typeof global$1.setTimeout === 'function') {
7029
+ cachedSetTimeout = setTimeout;
7030
+ }
7031
+ if (typeof global$1.clearTimeout === 'function') {
7032
+ cachedClearTimeout = clearTimeout;
7033
+ }
7212
7034
 
7213
- if (key) {
7214
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
7215
- return;
7216
- }
7217
- if (key === 'set-cookie') {
7218
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
7219
- } else {
7220
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
7221
- }
7035
+ function runTimeout(fun) {
7036
+ if (cachedSetTimeout === setTimeout) {
7037
+ //normal enviroments in sane situations
7038
+ return setTimeout(fun, 0);
7222
7039
  }
7223
- });
7224
-
7225
- return parsed;
7226
- };var isURLSameOrigin = (
7227
- utils.isStandardBrowserEnv() ?
7228
-
7229
- // Standard browser envs have full support of the APIs needed to test
7230
- // whether the request URL is of the same origin as current location.
7231
- (function standardBrowserEnv() {
7232
- var msie = /(msie|trident)/i.test(navigator.userAgent);
7233
- var urlParsingNode = document.createElement('a');
7234
- var originURL;
7235
-
7236
- /**
7237
- * Parse a URL to discover it's components
7238
- *
7239
- * @param {String} url The URL to be parsed
7240
- * @returns {Object}
7241
- */
7242
- function resolveURL(url) {
7243
- var href = url;
7244
-
7245
- if (msie) {
7246
- // IE needs attribute set twice to normalize properties
7247
- urlParsingNode.setAttribute('href', href);
7248
- href = urlParsingNode.href;
7040
+ // if setTimeout wasn't available but was latter defined
7041
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
7042
+ cachedSetTimeout = setTimeout;
7043
+ return setTimeout(fun, 0);
7044
+ }
7045
+ try {
7046
+ // when when somebody has screwed with setTimeout but no I.E. maddness
7047
+ return cachedSetTimeout(fun, 0);
7048
+ } catch(e){
7049
+ try {
7050
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
7051
+ return cachedSetTimeout.call(null, fun, 0);
7052
+ } catch(e){
7053
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
7054
+ return cachedSetTimeout.call(this, fun, 0);
7249
7055
  }
7250
-
7251
- urlParsingNode.setAttribute('href', href);
7252
-
7253
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
7254
- return {
7255
- href: urlParsingNode.href,
7256
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
7257
- host: urlParsingNode.host,
7258
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
7259
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
7260
- hostname: urlParsingNode.hostname,
7261
- port: urlParsingNode.port,
7262
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
7263
- urlParsingNode.pathname :
7264
- '/' + urlParsingNode.pathname
7265
- };
7266
- }
7267
-
7268
- originURL = resolveURL(window.location.href);
7269
-
7270
- /**
7271
- * Determine if a URL shares the same origin as the current location
7272
- *
7273
- * @param {String} requestURL The URL to test
7274
- * @returns {boolean} True if URL shares the same origin, otherwise false
7275
- */
7276
- return function isURLSameOrigin(requestURL) {
7277
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
7278
- return (parsed.protocol === originURL.protocol &&
7279
- parsed.host === originURL.host);
7280
- };
7281
- })() :
7282
-
7283
- // Non standard browser envs (web workers, react-native) lack needed support.
7284
- (function nonStandardBrowserEnv() {
7285
- return function isURLSameOrigin() {
7286
- return true;
7287
- };
7288
- })()
7289
- );var xhr = function xhrAdapter(config) {
7290
- return new Promise(function dispatchXhrRequest(resolve, reject) {
7291
- var requestData = config.data;
7292
- var requestHeaders = config.headers;
7293
-
7294
- if (utils.isFormData(requestData)) {
7295
- delete requestHeaders['Content-Type']; // Let the browser set it
7296
7056
  }
7297
7057
 
7298
- var request = new XMLHttpRequest();
7299
7058
 
7300
- // HTTP basic authentication
7301
- if (config.auth) {
7302
- var username = config.auth.username || '';
7303
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
7304
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
7059
+ }
7060
+ function runClearTimeout(marker) {
7061
+ if (cachedClearTimeout === clearTimeout) {
7062
+ //normal enviroments in sane situations
7063
+ return clearTimeout(marker);
7064
+ }
7065
+ // if clearTimeout wasn't available but was latter defined
7066
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
7067
+ cachedClearTimeout = clearTimeout;
7068
+ return clearTimeout(marker);
7069
+ }
7070
+ try {
7071
+ // when when somebody has screwed with setTimeout but no I.E. maddness
7072
+ return cachedClearTimeout(marker);
7073
+ } catch (e){
7074
+ try {
7075
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
7076
+ return cachedClearTimeout.call(null, marker);
7077
+ } catch (e){
7078
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
7079
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
7080
+ return cachedClearTimeout.call(this, marker);
7081
+ }
7305
7082
  }
7306
7083
 
7307
- var fullPath = buildFullPath(config.baseURL, config.url);
7308
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
7309
7084
 
7310
- // Set the request timeout in MS
7311
- request.timeout = config.timeout;
7312
7085
 
7313
- // Listen for ready state
7314
- request.onreadystatechange = function handleLoad() {
7315
- if (!request || request.readyState !== 4) {
7316
- return;
7317
- }
7086
+ }
7087
+ var queue = [];
7088
+ var draining = false;
7089
+ var currentQueue;
7090
+ var queueIndex = -1;
7318
7091
 
7319
- // The request errored out and we didn't get a response, this will be
7320
- // handled by onerror instead
7321
- // With one exception: request that using file: protocol, most browsers
7322
- // will return status as 0 even though it's a successful request
7323
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
7092
+ function cleanUpNextTick() {
7093
+ if (!draining || !currentQueue) {
7324
7094
  return;
7325
- }
7326
-
7327
- // Prepare the response
7328
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
7329
- var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
7330
- var response = {
7331
- data: responseData,
7332
- status: request.status,
7333
- statusText: request.statusText,
7334
- headers: responseHeaders,
7335
- config: config,
7336
- request: request
7337
- };
7338
-
7339
- settle(resolve, reject, response);
7340
-
7341
- // Clean up request
7342
- request = null;
7343
- };
7095
+ }
7096
+ draining = false;
7097
+ if (currentQueue.length) {
7098
+ queue = currentQueue.concat(queue);
7099
+ } else {
7100
+ queueIndex = -1;
7101
+ }
7102
+ if (queue.length) {
7103
+ drainQueue();
7104
+ }
7105
+ }
7344
7106
 
7345
- // Handle browser request cancellation (as opposed to a manual cancellation)
7346
- request.onabort = function handleAbort() {
7347
- if (!request) {
7107
+ function drainQueue() {
7108
+ if (draining) {
7348
7109
  return;
7349
- }
7350
-
7351
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
7352
-
7353
- // Clean up request
7354
- request = null;
7355
- };
7356
-
7357
- // Handle low level network errors
7358
- request.onerror = function handleError() {
7359
- // Real errors are hidden from us by the browser
7360
- // onerror should only fire if it's a network error
7361
- reject(createError('Network Error', config, null, request));
7362
-
7363
- // Clean up request
7364
- request = null;
7365
- };
7366
-
7367
- // Handle timeout
7368
- request.ontimeout = function handleTimeout() {
7369
- var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
7370
- if (config.timeoutErrorMessage) {
7371
- timeoutErrorMessage = config.timeoutErrorMessage;
7372
- }
7373
- reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
7374
- request));
7375
-
7376
- // Clean up request
7377
- request = null;
7378
- };
7379
-
7380
- // Add xsrf header
7381
- // This is only done if running in a standard browser environment.
7382
- // Specifically not if we're in a web worker, or react-native.
7383
- if (utils.isStandardBrowserEnv()) {
7384
- // Add xsrf header
7385
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
7386
- cookies.read(config.xsrfCookieName) :
7387
- undefined;
7388
-
7389
- if (xsrfValue) {
7390
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
7391
- }
7392
7110
  }
7111
+ var timeout = runTimeout(cleanUpNextTick);
7112
+ draining = true;
7393
7113
 
7394
- // Add headers to the request
7395
- if ('setRequestHeader' in request) {
7396
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
7397
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
7398
- // Remove Content-Type if data is undefined
7399
- delete requestHeaders[key];
7400
- } else {
7401
- // Otherwise add header to the request
7402
- request.setRequestHeader(key, val);
7114
+ var len = queue.length;
7115
+ while(len) {
7116
+ currentQueue = queue;
7117
+ queue = [];
7118
+ while (++queueIndex < len) {
7119
+ if (currentQueue) {
7120
+ currentQueue[queueIndex].run();
7121
+ }
7403
7122
  }
7404
- });
7405
- }
7406
-
7407
- // Add withCredentials to request if needed
7408
- if (!utils.isUndefined(config.withCredentials)) {
7409
- request.withCredentials = !!config.withCredentials;
7123
+ queueIndex = -1;
7124
+ len = queue.length;
7410
7125
  }
7411
-
7412
- // Add responseType to request if needed
7413
- if (config.responseType) {
7414
- try {
7415
- request.responseType = config.responseType;
7416
- } catch (e) {
7417
- // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
7418
- // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
7419
- if (config.responseType !== 'json') {
7420
- throw e;
7126
+ currentQueue = null;
7127
+ draining = false;
7128
+ runClearTimeout(timeout);
7129
+ }
7130
+ function nextTick(fun) {
7131
+ var args = new Array(arguments.length - 1);
7132
+ if (arguments.length > 1) {
7133
+ for (var i = 1; i < arguments.length; i++) {
7134
+ args[i - 1] = arguments[i];
7421
7135
  }
7422
- }
7423
7136
  }
7424
-
7425
- // Handle progress if needed
7426
- if (typeof config.onDownloadProgress === 'function') {
7427
- request.addEventListener('progress', config.onDownloadProgress);
7137
+ queue.push(new Item(fun, args));
7138
+ if (queue.length === 1 && !draining) {
7139
+ runTimeout(drainQueue);
7428
7140
  }
7141
+ }
7142
+ // v8 likes predictible objects
7143
+ function Item(fun, array) {
7144
+ this.fun = fun;
7145
+ this.array = array;
7146
+ }
7147
+ Item.prototype.run = function () {
7148
+ this.fun.apply(null, this.array);
7149
+ };
7150
+ var title = 'browser';
7151
+ var platform = 'browser';
7152
+ var browser = true;
7153
+ var env = {};
7154
+ var argv = [];
7155
+ var version = ''; // empty string to avoid regexp issues
7156
+ var versions = {};
7157
+ var release = {};
7158
+ var config = {};
7159
+
7160
+ function noop() {}
7161
+
7162
+ var on = noop;
7163
+ var addListener = noop;
7164
+ var once = noop;
7165
+ var off = noop;
7166
+ var removeListener = noop;
7167
+ var removeAllListeners = noop;
7168
+ var emit = noop;
7169
+
7170
+ function binding(name) {
7171
+ throw new Error('process.binding is not supported');
7172
+ }
7173
+
7174
+ function cwd () { return '/' }
7175
+ function chdir (dir) {
7176
+ throw new Error('process.chdir is not supported');
7177
+ }function umask() { return 0; }
7178
+
7179
+ // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
7180
+ var performance = global$1.performance || {};
7181
+ var performanceNow =
7182
+ performance.now ||
7183
+ performance.mozNow ||
7184
+ performance.msNow ||
7185
+ performance.oNow ||
7186
+ performance.webkitNow ||
7187
+ function(){ return (new Date()).getTime() };
7188
+
7189
+ // generate timestamp or delta
7190
+ // see http://nodejs.org/api/process.html#process_process_hrtime
7191
+ function hrtime(previousTimestamp){
7192
+ var clocktime = performanceNow.call(performance)*1e-3;
7193
+ var seconds = Math.floor(clocktime);
7194
+ var nanoseconds = Math.floor((clocktime%1)*1e9);
7195
+ if (previousTimestamp) {
7196
+ seconds = seconds - previousTimestamp[0];
7197
+ nanoseconds = nanoseconds - previousTimestamp[1];
7198
+ if (nanoseconds<0) {
7199
+ seconds--;
7200
+ nanoseconds += 1e9;
7201
+ }
7202
+ }
7203
+ return [seconds,nanoseconds]
7204
+ }
7205
+
7206
+ var startTime = new Date();
7207
+ function uptime() {
7208
+ var currentTime = new Date();
7209
+ var dif = currentTime - startTime;
7210
+ return dif / 1000;
7211
+ }
7212
+
7213
+ var browser$1 = {
7214
+ nextTick: nextTick,
7215
+ title: title,
7216
+ browser: browser,
7217
+ env: env,
7218
+ argv: argv,
7219
+ version: version,
7220
+ versions: versions,
7221
+ on: on,
7222
+ addListener: addListener,
7223
+ once: once,
7224
+ off: off,
7225
+ removeListener: removeListener,
7226
+ removeAllListeners: removeAllListeners,
7227
+ emit: emit,
7228
+ binding: binding,
7229
+ cwd: cwd,
7230
+ chdir: chdir,
7231
+ umask: umask,
7232
+ hrtime: hrtime,
7233
+ platform: platform,
7234
+ release: release,
7235
+ config: config,
7236
+ uptime: uptime
7237
+ };var utils = require('./utils');
7238
+ var normalizeHeaderName = require('./helpers/normalizeHeaderName');
7239
+
7240
+ var DEFAULT_CONTENT_TYPE = {
7241
+ 'Content-Type': 'application/x-www-form-urlencoded'
7242
+ };
7429
7243
 
7430
- // Not all browsers support upload events
7431
- if (typeof config.onUploadProgress === 'function' && request.upload) {
7432
- request.upload.addEventListener('progress', config.onUploadProgress);
7433
- }
7244
+ function setContentTypeIfUnset(headers, value) {
7245
+ if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
7246
+ headers['Content-Type'] = value;
7247
+ }
7248
+ }
7434
7249
 
7435
- if (config.cancelToken) {
7436
- // Handle cancellation
7437
- config.cancelToken.promise.then(function onCanceled(cancel) {
7438
- if (!request) {
7439
- return;
7440
- }
7250
+ function getDefaultAdapter() {
7251
+ var adapter;
7252
+ if (typeof XMLHttpRequest !== 'undefined') {
7253
+ // For browsers use XHR adapter
7254
+ adapter = require('./adapters/xhr');
7255
+ } else if (typeof browser$1 !== 'undefined' && Object.prototype.toString.call(browser$1) === '[object process]') {
7256
+ // For node use HTTP adapter
7257
+ adapter = require('./adapters/http');
7258
+ }
7259
+ return adapter;
7260
+ }
7441
7261
 
7442
- request.abort();
7443
- reject(cancel);
7444
- // Clean up request
7445
- request = null;
7446
- });
7262
+ var defaults$1 = {
7263
+ adapter: getDefaultAdapter(),
7264
+
7265
+ transformRequest: [function transformRequest(data, headers) {
7266
+ normalizeHeaderName(headers, 'Accept');
7267
+ normalizeHeaderName(headers, 'Content-Type');
7268
+ if (utils.isFormData(data) ||
7269
+ utils.isArrayBuffer(data) ||
7270
+ utils.isBuffer(data) ||
7271
+ utils.isStream(data) ||
7272
+ utils.isFile(data) ||
7273
+ utils.isBlob(data)
7274
+ ) {
7275
+ return data;
7276
+ }
7277
+ if (utils.isArrayBufferView(data)) {
7278
+ return data.buffer;
7279
+ }
7280
+ if (utils.isURLSearchParams(data)) {
7281
+ setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
7282
+ return data.toString();
7283
+ }
7284
+ if (utils.isObject(data)) {
7285
+ setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
7286
+ return JSON.stringify(data);
7447
7287
  }
7288
+ return data;
7289
+ }],
7448
7290
 
7449
- if (!requestData) {
7450
- requestData = null;
7291
+ transformResponse: [function transformResponse(data) {
7292
+ /*eslint no-param-reassign:0*/
7293
+ if (typeof data === 'string') {
7294
+ try {
7295
+ data = JSON.parse(data);
7296
+ } catch (e) { /* Ignore */ }
7451
7297
  }
7298
+ return data;
7299
+ }],
7452
7300
 
7453
- // Send the request
7454
- request.send(requestData);
7455
- });
7456
- };/**
7457
- * Helpers.
7458
- */
7459
- var s = 1000;
7460
- var m = s * 60;
7461
- var h = m * 60;
7462
- var d = h * 24;
7463
- var y = d * 365.25;
7301
+ /**
7302
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
7303
+ * timeout is not created.
7304
+ */
7305
+ timeout: 0,
7464
7306
 
7465
- /**
7466
- * Parse or format the given `val`.
7467
- *
7468
- * Options:
7469
- *
7470
- * - `long` verbose formatting [false]
7471
- *
7472
- * @param {String|Number} val
7473
- * @param {Object} [options]
7474
- * @throws {Error} throw an error if val is not a non-empty string or a number
7475
- * @return {String|Number}
7476
- * @api public
7477
- */
7307
+ xsrfCookieName: 'XSRF-TOKEN',
7308
+ xsrfHeaderName: 'X-XSRF-TOKEN',
7478
7309
 
7479
- var ms = function(val, options) {
7480
- options = options || {};
7481
- var type = typeof val;
7482
- if (type === 'string' && val.length > 0) {
7483
- return parse(val);
7484
- } else if (type === 'number' && isNaN(val) === false) {
7485
- return options.long ? fmtLong(val) : fmtShort(val);
7310
+ maxContentLength: -1,
7311
+ maxBodyLength: -1,
7312
+
7313
+ validateStatus: function validateStatus(status) {
7314
+ return status >= 200 && status < 300;
7486
7315
  }
7487
- throw new Error(
7488
- 'val is not a non-empty string or a valid number. val=' +
7489
- JSON.stringify(val)
7490
- );
7491
7316
  };
7492
7317
 
7493
- /**
7494
- * Parse the given `str` and return milliseconds.
7495
- *
7496
- * @param {String} str
7497
- * @return {Number}
7498
- * @api private
7499
- */
7500
-
7501
- function parse(str) {
7502
- str = String(str);
7503
- if (str.length > 100) {
7504
- return;
7505
- }
7506
- var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
7507
- str
7508
- );
7509
- if (!match) {
7510
- return;
7511
- }
7512
- var n = parseFloat(match[1]);
7513
- var type = (match[2] || 'ms').toLowerCase();
7514
- switch (type) {
7515
- case 'years':
7516
- case 'year':
7517
- case 'yrs':
7518
- case 'yr':
7519
- case 'y':
7520
- return n * y;
7521
- case 'days':
7522
- case 'day':
7523
- case 'd':
7524
- return n * d;
7525
- case 'hours':
7526
- case 'hour':
7527
- case 'hrs':
7528
- case 'hr':
7529
- case 'h':
7530
- return n * h;
7531
- case 'minutes':
7532
- case 'minute':
7533
- case 'mins':
7534
- case 'min':
7535
- case 'm':
7536
- return n * m;
7537
- case 'seconds':
7538
- case 'second':
7539
- case 'secs':
7540
- case 'sec':
7541
- case 's':
7542
- return n * s;
7543
- case 'milliseconds':
7544
- case 'millisecond':
7545
- case 'msecs':
7546
- case 'msec':
7547
- case 'ms':
7548
- return n;
7549
- default:
7550
- return undefined;
7318
+ defaults$1.headers = {
7319
+ common: {
7320
+ 'Accept': 'application/json, text/plain, */*'
7551
7321
  }
7552
- }
7322
+ };
7553
7323
 
7554
- /**
7555
- * Short format for `ms`.
7556
- *
7557
- * @param {Number} ms
7558
- * @return {String}
7559
- * @api private
7560
- */
7324
+ utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
7325
+ defaults$1.headers[method] = {};
7326
+ });
7561
7327
 
7562
- function fmtShort(ms) {
7563
- if (ms >= d) {
7564
- return Math.round(ms / d) + 'd';
7565
- }
7566
- if (ms >= h) {
7567
- return Math.round(ms / h) + 'h';
7568
- }
7569
- if (ms >= m) {
7570
- return Math.round(ms / m) + 'm';
7571
- }
7572
- if (ms >= s) {
7573
- return Math.round(ms / s) + 's';
7574
- }
7575
- return ms + 'ms';
7576
- }
7328
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
7329
+ defaults$1.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
7330
+ });
7577
7331
 
7578
- /**
7579
- * Long format for `ms`.
7580
- *
7581
- * @param {Number} ms
7582
- * @return {String}
7583
- * @api private
7332
+ module.exports = defaults$1;var defaults$2=/*#__PURE__*/Object.freeze({__proto__:null});var defaults = /*@__PURE__*/getAugmentedNamespace(defaults$2);/**
7333
+ * Throws a `Cancel` if cancellation has been requested.
7584
7334
  */
7585
-
7586
- function fmtLong(ms) {
7587
- return plural(ms, d, 'day') ||
7588
- plural(ms, h, 'hour') ||
7589
- plural(ms, m, 'minute') ||
7590
- plural(ms, s, 'second') ||
7591
- ms + ' ms';
7335
+ function throwIfCancellationRequested(config) {
7336
+ if (config.cancelToken) {
7337
+ config.cancelToken.throwIfRequested();
7338
+ }
7592
7339
  }
7593
7340
 
7594
7341
  /**
7595
- * Pluralization helper.
7596
- */
7597
-
7598
- function plural(ms, n, name) {
7599
- if (ms < n) {
7600
- return;
7601
- }
7602
- if (ms < n * 1.5) {
7603
- return Math.floor(ms / n) + ' ' + name;
7604
- }
7605
- return Math.ceil(ms / n) + ' ' + name + 's';
7606
- }var debug$1 = createCommonjsModule(function (module, exports) {
7607
- /**
7608
- * This is the common logic for both the Node.js and web browser
7609
- * implementations of `debug()`.
7342
+ * Dispatch a request to the server using the configured adapter.
7610
7343
  *
7611
- * Expose `debug()` as the module.
7344
+ * @param {object} config The config that is to be used for the request
7345
+ * @returns {Promise} The Promise to be fulfilled
7612
7346
  */
7347
+ var dispatchRequest = function dispatchRequest(config) {
7348
+ throwIfCancellationRequested(config);
7613
7349
 
7614
- exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
7615
- exports.coerce = coerce;
7616
- exports.disable = disable;
7617
- exports.enable = enable;
7618
- exports.enabled = enabled;
7619
- exports.humanize = ms;
7620
-
7621
- /**
7622
- * Active `debug` instances.
7623
- */
7624
- exports.instances = [];
7625
-
7626
- /**
7627
- * The currently active debug mode names, and names to skip.
7628
- */
7629
-
7630
- exports.names = [];
7631
- exports.skips = [];
7632
-
7633
- /**
7634
- * Map of special "%n" handling functions, for the debug "format" argument.
7635
- *
7636
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
7637
- */
7638
-
7639
- exports.formatters = {};
7640
-
7641
- /**
7642
- * Select a color.
7643
- * @param {String} namespace
7644
- * @return {Number}
7645
- * @api private
7646
- */
7647
-
7648
- function selectColor(namespace) {
7649
- var hash = 0, i;
7650
-
7651
- for (i in namespace) {
7652
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
7653
- hash |= 0; // Convert to 32bit integer
7654
- }
7655
-
7656
- return exports.colors[Math.abs(hash) % exports.colors.length];
7657
- }
7658
-
7659
- /**
7660
- * Create a debugger with the given `namespace`.
7661
- *
7662
- * @param {String} namespace
7663
- * @return {Function}
7664
- * @api public
7665
- */
7666
-
7667
- function createDebug(namespace) {
7668
-
7669
- var prevTime;
7670
-
7671
- function debug() {
7672
- // disabled?
7673
- if (!debug.enabled) return;
7674
-
7675
- var self = debug;
7676
-
7677
- // set `diff` timestamp
7678
- var curr = +new Date();
7679
- var ms = curr - (prevTime || curr);
7680
- self.diff = ms;
7681
- self.prev = prevTime;
7682
- self.curr = curr;
7683
- prevTime = curr;
7684
-
7685
- // turn the `arguments` into a proper Array
7686
- var args = new Array(arguments.length);
7687
- for (var i = 0; i < args.length; i++) {
7688
- args[i] = arguments[i];
7689
- }
7690
-
7691
- args[0] = exports.coerce(args[0]);
7692
-
7693
- if ('string' !== typeof args[0]) {
7694
- // anything else let's inspect with %O
7695
- args.unshift('%O');
7696
- }
7697
-
7698
- // apply any `formatters` transformations
7699
- var index = 0;
7700
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
7701
- // if we encounter an escaped % then don't increase the array index
7702
- if (match === '%%') return match;
7703
- index++;
7704
- var formatter = exports.formatters[format];
7705
- if ('function' === typeof formatter) {
7706
- var val = args[index];
7707
- match = formatter.call(self, val);
7708
-
7709
- // now we need to remove `args[index]` since it's inlined in the `format`
7710
- args.splice(index, 1);
7711
- index--;
7712
- }
7713
- return match;
7714
- });
7715
-
7716
- // apply env-specific formatting (colors, etc.)
7717
- exports.formatArgs.call(self, args);
7718
-
7719
- var logFn = debug.log || exports.log || console.log.bind(console);
7720
- logFn.apply(self, args);
7721
- }
7722
-
7723
- debug.namespace = namespace;
7724
- debug.enabled = exports.enabled(namespace);
7725
- debug.useColors = exports.useColors();
7726
- debug.color = selectColor(namespace);
7727
- debug.destroy = destroy;
7728
-
7729
- // env-specific initialization logic for debug instances
7730
- if ('function' === typeof exports.init) {
7731
- exports.init(debug);
7732
- }
7733
-
7734
- exports.instances.push(debug);
7735
-
7736
- return debug;
7737
- }
7738
-
7739
- function destroy () {
7740
- var index = exports.instances.indexOf(this);
7741
- if (index !== -1) {
7742
- exports.instances.splice(index, 1);
7743
- return true;
7744
- } else {
7745
- return false;
7746
- }
7747
- }
7748
-
7749
- /**
7750
- * Enables a debug mode by namespaces. This can include modes
7751
- * separated by a colon and wildcards.
7752
- *
7753
- * @param {String} namespaces
7754
- * @api public
7755
- */
7756
-
7757
- function enable(namespaces) {
7758
- exports.save(namespaces);
7759
-
7760
- exports.names = [];
7761
- exports.skips = [];
7762
-
7763
- var i;
7764
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
7765
- var len = split.length;
7766
-
7767
- for (i = 0; i < len; i++) {
7768
- if (!split[i]) continue; // ignore empty strings
7769
- namespaces = split[i].replace(/\*/g, '.*?');
7770
- if (namespaces[0] === '-') {
7771
- exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
7772
- } else {
7773
- exports.names.push(new RegExp('^' + namespaces + '$'));
7774
- }
7775
- }
7776
-
7777
- for (i = 0; i < exports.instances.length; i++) {
7778
- var instance = exports.instances[i];
7779
- instance.enabled = exports.enabled(instance.namespace);
7780
- }
7781
- }
7782
-
7783
- /**
7784
- * Disable debug output.
7785
- *
7786
- * @api public
7787
- */
7788
-
7789
- function disable() {
7790
- exports.enable('');
7791
- }
7792
-
7793
- /**
7794
- * Returns true if the given mode name is enabled, false otherwise.
7795
- *
7796
- * @param {String} name
7797
- * @return {Boolean}
7798
- * @api public
7799
- */
7800
-
7801
- function enabled(name) {
7802
- if (name[name.length - 1] === '*') {
7803
- return true;
7804
- }
7805
- var i, len;
7806
- for (i = 0, len = exports.skips.length; i < len; i++) {
7807
- if (exports.skips[i].test(name)) {
7808
- return false;
7809
- }
7810
- }
7811
- for (i = 0, len = exports.names.length; i < len; i++) {
7812
- if (exports.names[i].test(name)) {
7813
- return true;
7814
- }
7815
- }
7816
- return false;
7817
- }
7818
-
7819
- /**
7820
- * Coerce `val`.
7821
- *
7822
- * @param {Mixed} val
7823
- * @return {Mixed}
7824
- * @api private
7825
- */
7826
-
7827
- function coerce(val) {
7828
- if (val instanceof Error) return val.stack || val.message;
7829
- return val;
7830
- }
7831
- });/**
7832
- * This is the web browser implementation of `debug()`.
7833
- *
7834
- * Expose `debug()` as the module.
7835
- */
7836
-
7837
- var browser$1 = createCommonjsModule(function (module, exports) {
7838
- exports = module.exports = debug$1;
7839
- exports.log = log;
7840
- exports.formatArgs = formatArgs;
7841
- exports.save = save;
7842
- exports.load = load;
7843
- exports.useColors = useColors;
7844
- exports.storage = 'undefined' != typeof chrome
7845
- && 'undefined' != typeof chrome.storage
7846
- ? chrome.storage.local
7847
- : localstorage();
7848
-
7849
- /**
7850
- * Colors.
7851
- */
7852
-
7853
- exports.colors = [
7854
- '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
7855
- '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
7856
- '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
7857
- '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
7858
- '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
7859
- '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
7860
- '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
7861
- '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
7862
- '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
7863
- '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
7864
- '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
7865
- ];
7866
-
7867
- /**
7868
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
7869
- * and the Firebug extension (any Firefox version) are known
7870
- * to support "%c" CSS customizations.
7871
- *
7872
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
7873
- */
7874
-
7875
- function useColors() {
7876
- // NB: In an Electron preload script, document will be defined but not fully
7877
- // initialized. Since we know we're in Chrome, we'll just detect this case
7878
- // explicitly
7879
- if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
7880
- return true;
7881
- }
7882
-
7883
- // Internet Explorer and Edge do not support colors.
7884
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
7885
- return false;
7886
- }
7887
-
7888
- // is webkit? http://stackoverflow.com/a/16459606/376773
7889
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
7890
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
7891
- // is firebug? http://stackoverflow.com/a/398120/376773
7892
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
7893
- // is firefox >= v31?
7894
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
7895
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
7896
- // double check webkit in userAgent just in case we are in a worker
7897
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
7898
- }
7899
-
7900
- /**
7901
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
7902
- */
7903
-
7904
- exports.formatters.j = function(v) {
7905
- try {
7906
- return JSON.stringify(v);
7907
- } catch (err) {
7908
- return '[UnexpectedJSONParseError]: ' + err.message;
7909
- }
7910
- };
7911
-
7912
-
7913
- /**
7914
- * Colorize log arguments if enabled.
7915
- *
7916
- * @api public
7917
- */
7918
-
7919
- function formatArgs(args) {
7920
- var useColors = this.useColors;
7921
-
7922
- args[0] = (useColors ? '%c' : '')
7923
- + this.namespace
7924
- + (useColors ? ' %c' : ' ')
7925
- + args[0]
7926
- + (useColors ? '%c ' : ' ')
7927
- + '+' + exports.humanize(this.diff);
7928
-
7929
- if (!useColors) return;
7930
-
7931
- var c = 'color: ' + this.color;
7932
- args.splice(1, 0, c, 'color: inherit');
7933
-
7934
- // the final "%c" is somewhat tricky, because there could be other
7935
- // arguments passed either before or after the %c, so we need to
7936
- // figure out the correct index to insert the CSS into
7937
- var index = 0;
7938
- var lastC = 0;
7939
- args[0].replace(/%[a-zA-Z%]/g, function(match) {
7940
- if ('%%' === match) return;
7941
- index++;
7942
- if ('%c' === match) {
7943
- // we only are interested in the *last* %c
7944
- // (the user may have provided their own)
7945
- lastC = index;
7946
- }
7947
- });
7948
-
7949
- args.splice(lastC, 0, c);
7950
- }
7951
-
7952
- /**
7953
- * Invokes `console.log()` when available.
7954
- * No-op when `console.log` is not a "function".
7955
- *
7956
- * @api public
7957
- */
7958
-
7959
- function log() {
7960
- // this hackery is required for IE8/9, where
7961
- // the `console.log` function doesn't have 'apply'
7962
- return 'object' === typeof console
7963
- && console.log
7964
- && Function.prototype.apply.call(console.log, console, arguments);
7965
- }
7966
-
7967
- /**
7968
- * Save `namespaces`.
7969
- *
7970
- * @param {String} namespaces
7971
- * @api private
7972
- */
7973
-
7974
- function save(namespaces) {
7975
- try {
7976
- if (null == namespaces) {
7977
- exports.storage.removeItem('debug');
7978
- } else {
7979
- exports.storage.debug = namespaces;
7980
- }
7981
- } catch(e) {}
7982
- }
7983
-
7984
- /**
7985
- * Load `namespaces`.
7986
- *
7987
- * @return {String} returns the previously persisted debug modes
7988
- * @api private
7989
- */
7990
-
7991
- function load() {
7992
- var r;
7993
- try {
7994
- r = exports.storage.debug;
7995
- } catch(e) {}
7996
-
7997
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
7998
- if (!r && typeof process !== 'undefined' && 'env' in process) {
7999
- r = process.env.DEBUG;
8000
- }
8001
-
8002
- return r;
8003
- }
8004
-
8005
- /**
8006
- * Enable namespaces listed in `localStorage.debug` initially.
8007
- */
8008
-
8009
- exports.enable(load());
8010
-
8011
- /**
8012
- * Localstorage attempts to return the localstorage.
8013
- *
8014
- * This is necessary because safari throws
8015
- * when a user disables cookies/localstorage
8016
- * and you attempt to access it.
8017
- *
8018
- * @return {LocalStorage}
8019
- * @api private
8020
- */
8021
-
8022
- function localstorage() {
8023
- try {
8024
- return window.localStorage;
8025
- } catch (e) {}
8026
- }
8027
- });var hasFlag = (flag, argv = process.argv) => {
8028
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
8029
- const position = argv.indexOf(prefix + flag);
8030
- const terminatorPosition = argv.indexOf('--');
8031
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
8032
- };const {env} = process;
8033
-
8034
- let forceColor;
8035
- if (hasFlag('no-color') ||
8036
- hasFlag('no-colors') ||
8037
- hasFlag('color=false') ||
8038
- hasFlag('color=never')) {
8039
- forceColor = 0;
8040
- } else if (hasFlag('color') ||
8041
- hasFlag('colors') ||
8042
- hasFlag('color=true') ||
8043
- hasFlag('color=always')) {
8044
- forceColor = 1;
8045
- }
8046
-
8047
- if ('FORCE_COLOR' in env) {
8048
- if (env.FORCE_COLOR === 'true') {
8049
- forceColor = 1;
8050
- } else if (env.FORCE_COLOR === 'false') {
8051
- forceColor = 0;
8052
- } else {
8053
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
8054
- }
8055
- }
8056
-
8057
- function translateLevel(level) {
8058
- if (level === 0) {
8059
- return false;
8060
- }
8061
-
8062
- return {
8063
- level,
8064
- hasBasic: true,
8065
- has256: level >= 2,
8066
- has16m: level >= 3
8067
- };
8068
- }
8069
-
8070
- function supportsColor(haveStream, streamIsTTY) {
8071
- if (forceColor === 0) {
8072
- return 0;
8073
- }
8074
-
8075
- if (hasFlag('color=16m') ||
8076
- hasFlag('color=full') ||
8077
- hasFlag('color=truecolor')) {
8078
- return 3;
8079
- }
8080
-
8081
- if (hasFlag('color=256')) {
8082
- return 2;
8083
- }
8084
-
8085
- if (haveStream && !streamIsTTY && forceColor === undefined) {
8086
- return 0;
8087
- }
8088
-
8089
- const min = forceColor || 0;
8090
-
8091
- if (env.TERM === 'dumb') {
8092
- return min;
8093
- }
8094
-
8095
- if (process.platform === 'win32') {
8096
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
8097
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
8098
- const osRelease = os__default["default"].release().split('.');
8099
- if (
8100
- Number(osRelease[0]) >= 10 &&
8101
- Number(osRelease[2]) >= 10586
8102
- ) {
8103
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
8104
- }
8105
-
8106
- return 1;
8107
- }
8108
-
8109
- if ('CI' in env) {
8110
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
8111
- return 1;
8112
- }
8113
-
8114
- return min;
8115
- }
8116
-
8117
- if ('TEAMCITY_VERSION' in env) {
8118
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
8119
- }
8120
-
8121
- if (env.COLORTERM === 'truecolor') {
8122
- return 3;
8123
- }
8124
-
8125
- if ('TERM_PROGRAM' in env) {
8126
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
8127
-
8128
- switch (env.TERM_PROGRAM) {
8129
- case 'iTerm.app':
8130
- return version >= 3 ? 3 : 2;
8131
- case 'Apple_Terminal':
8132
- return 2;
8133
- // No default
8134
- }
8135
- }
8136
-
8137
- if (/-256(color)?$/i.test(env.TERM)) {
8138
- return 2;
8139
- }
8140
-
8141
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
8142
- return 1;
8143
- }
8144
-
8145
- if ('COLORTERM' in env) {
8146
- return 1;
8147
- }
8148
-
8149
- return min;
8150
- }
8151
-
8152
- function getSupportLevel(stream) {
8153
- const level = supportsColor(stream, stream && stream.isTTY);
8154
- return translateLevel(level);
8155
- }
8156
-
8157
- var supportsColor_1 = {
8158
- supportsColor: getSupportLevel,
8159
- stdout: translateLevel(supportsColor(true, tty__default["default"].isatty(1))),
8160
- stderr: translateLevel(supportsColor(true, tty__default["default"].isatty(2)))
8161
- };/**
8162
- * Module dependencies.
8163
- */
8164
-
8165
- var node = createCommonjsModule(function (module, exports) {
8166
- /**
8167
- * This is the Node.js implementation of `debug()`.
8168
- *
8169
- * Expose `debug()` as the module.
8170
- */
8171
-
8172
- exports = module.exports = debug$1;
8173
- exports.init = init;
8174
- exports.log = log;
8175
- exports.formatArgs = formatArgs;
8176
- exports.save = save;
8177
- exports.load = load;
8178
- exports.useColors = useColors;
8179
-
8180
- /**
8181
- * Colors.
8182
- */
8183
-
8184
- exports.colors = [ 6, 2, 3, 4, 5, 1 ];
8185
-
8186
- try {
8187
- var supportsColor = supportsColor_1;
8188
- if (supportsColor && supportsColor.level >= 2) {
8189
- exports.colors = [
8190
- 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68,
8191
- 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134,
8192
- 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
8193
- 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204,
8194
- 205, 206, 207, 208, 209, 214, 215, 220, 221
8195
- ];
8196
- }
8197
- } catch (err) {
8198
- // swallow - we only care if `supports-color` is available; it doesn't have to be.
8199
- }
8200
-
8201
- /**
8202
- * Build up the default `inspectOpts` object from the environment variables.
8203
- *
8204
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
8205
- */
8206
-
8207
- exports.inspectOpts = Object.keys(process.env).filter(function (key) {
8208
- return /^debug_/i.test(key);
8209
- }).reduce(function (obj, key) {
8210
- // camel-case
8211
- var prop = key
8212
- .substring(6)
8213
- .toLowerCase()
8214
- .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
8215
-
8216
- // coerce string value into JS value
8217
- var val = process.env[key];
8218
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
8219
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
8220
- else if (val === 'null') val = null;
8221
- else val = Number(val);
8222
-
8223
- obj[prop] = val;
8224
- return obj;
8225
- }, {});
8226
-
8227
- /**
8228
- * Is stdout a TTY? Colored output is enabled when `true`.
8229
- */
8230
-
8231
- function useColors() {
8232
- return 'colors' in exports.inspectOpts
8233
- ? Boolean(exports.inspectOpts.colors)
8234
- : tty__default["default"].isatty(process.stderr.fd);
8235
- }
8236
-
8237
- /**
8238
- * Map %o to `util.inspect()`, all on a single line.
8239
- */
8240
-
8241
- exports.formatters.o = function(v) {
8242
- this.inspectOpts.colors = this.useColors;
8243
- return util__default["default"].inspect(v, this.inspectOpts)
8244
- .split('\n').map(function(str) {
8245
- return str.trim()
8246
- }).join(' ');
8247
- };
8248
-
8249
- /**
8250
- * Map %o to `util.inspect()`, allowing multiple lines if needed.
8251
- */
8252
-
8253
- exports.formatters.O = function(v) {
8254
- this.inspectOpts.colors = this.useColors;
8255
- return util__default["default"].inspect(v, this.inspectOpts);
8256
- };
8257
-
8258
- /**
8259
- * Adds ANSI color escape codes if enabled.
8260
- *
8261
- * @api public
8262
- */
8263
-
8264
- function formatArgs(args) {
8265
- var name = this.namespace;
8266
- var useColors = this.useColors;
8267
-
8268
- if (useColors) {
8269
- var c = this.color;
8270
- var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c);
8271
- var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m';
8272
-
8273
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
8274
- args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
8275
- } else {
8276
- args[0] = getDate() + name + ' ' + args[0];
8277
- }
8278
- }
8279
-
8280
- function getDate() {
8281
- if (exports.inspectOpts.hideDate) {
8282
- return '';
8283
- } else {
8284
- return new Date().toISOString() + ' ';
8285
- }
8286
- }
8287
-
8288
- /**
8289
- * Invokes `util.format()` with the specified arguments and writes to stderr.
8290
- */
8291
-
8292
- function log() {
8293
- return process.stderr.write(util__default["default"].format.apply(util__default["default"], arguments) + '\n');
8294
- }
8295
-
8296
- /**
8297
- * Save `namespaces`.
8298
- *
8299
- * @param {String} namespaces
8300
- * @api private
8301
- */
8302
-
8303
- function save(namespaces) {
8304
- if (null == namespaces) {
8305
- // If you set a process.env field to null or undefined, it gets cast to the
8306
- // string 'null' or 'undefined'. Just delete instead.
8307
- delete process.env.DEBUG;
8308
- } else {
8309
- process.env.DEBUG = namespaces;
8310
- }
8311
- }
8312
-
8313
- /**
8314
- * Load `namespaces`.
8315
- *
8316
- * @return {String} returns the previously persisted debug modes
8317
- * @api private
8318
- */
8319
-
8320
- function load() {
8321
- return process.env.DEBUG;
8322
- }
8323
-
8324
- /**
8325
- * Init logic for `debug` instances.
8326
- *
8327
- * Create a new `inspectOpts` object in case `useColors` is set
8328
- * differently for a particular `debug` instance.
8329
- */
8330
-
8331
- function init (debug) {
8332
- debug.inspectOpts = {};
8333
-
8334
- var keys = Object.keys(exports.inspectOpts);
8335
- for (var i = 0; i < keys.length; i++) {
8336
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
8337
- }
8338
- }
8339
-
8340
- /**
8341
- * Enable namespaces listed in `process.env.DEBUG` initially.
8342
- */
8343
-
8344
- exports.enable(load());
8345
- });/**
8346
- * Detect Electron renderer process, which is node, but we should
8347
- * treat as a browser.
8348
- */
8349
-
8350
- var src = createCommonjsModule(function (module) {
8351
- if (typeof process === 'undefined' || process.type === 'renderer') {
8352
- module.exports = browser$1;
8353
- } else {
8354
- module.exports = node;
8355
- }
8356
- });var debug;
8357
-
8358
- var debug_1 = function () {
8359
- if (!debug) {
8360
- try {
8361
- /* eslint global-require: off */
8362
- debug = src("follow-redirects");
8363
- }
8364
- catch (error) { /* */ }
8365
- if (typeof debug !== "function") {
8366
- debug = function () { /* */ };
8367
- }
8368
- }
8369
- debug.apply(null, arguments);
8370
- };var URL = url__default["default"].URL;
8371
-
8372
-
8373
- var Writable = require$$0__default["default"].Writable;
8374
-
8375
-
8376
-
8377
- // Create handlers that pass events from native requests
8378
- var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
8379
- var eventHandlers = Object.create(null);
8380
- events.forEach(function (event) {
8381
- eventHandlers[event] = function (arg1, arg2, arg3) {
8382
- this._redirectable.emit(event, arg1, arg2, arg3);
8383
- };
8384
- });
8385
-
8386
- var InvalidUrlError = createErrorType(
8387
- "ERR_INVALID_URL",
8388
- "Invalid URL",
8389
- TypeError
8390
- );
8391
- // Error types with codes
8392
- var RedirectionError = createErrorType(
8393
- "ERR_FR_REDIRECTION_FAILURE",
8394
- "Redirected request failed"
8395
- );
8396
- var TooManyRedirectsError = createErrorType(
8397
- "ERR_FR_TOO_MANY_REDIRECTS",
8398
- "Maximum number of redirects exceeded"
8399
- );
8400
- var MaxBodyLengthExceededError = createErrorType(
8401
- "ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
8402
- "Request body larger than maxBodyLength limit"
8403
- );
8404
- var WriteAfterEndError = createErrorType(
8405
- "ERR_STREAM_WRITE_AFTER_END",
8406
- "write after end"
8407
- );
8408
-
8409
- // An HTTP(S) request that can be redirected
8410
- function RedirectableRequest(options, responseCallback) {
8411
- // Initialize the request
8412
- Writable.call(this);
8413
- this._sanitizeOptions(options);
8414
- this._options = options;
8415
- this._ended = false;
8416
- this._ending = false;
8417
- this._redirectCount = 0;
8418
- this._redirects = [];
8419
- this._requestBodyLength = 0;
8420
- this._requestBodyBuffers = [];
8421
-
8422
- // Attach a callback if passed
8423
- if (responseCallback) {
8424
- this.on("response", responseCallback);
8425
- }
8426
-
8427
- // React to responses of native requests
8428
- var self = this;
8429
- this._onNativeResponse = function (response) {
8430
- self._processResponse(response);
8431
- };
8432
-
8433
- // Perform the first request
8434
- this._performRequest();
8435
- }
8436
- RedirectableRequest.prototype = Object.create(Writable.prototype);
8437
-
8438
- RedirectableRequest.prototype.abort = function () {
8439
- abortRequest(this._currentRequest);
8440
- this.emit("abort");
8441
- };
8442
-
8443
- // Writes buffered data to the current native request
8444
- RedirectableRequest.prototype.write = function (data, encoding, callback) {
8445
- // Writing is not allowed if end has been called
8446
- if (this._ending) {
8447
- throw new WriteAfterEndError();
8448
- }
8449
-
8450
- // Validate input and shift parameters if necessary
8451
- if (!isString(data) && !isBuffer(data)) {
8452
- throw new TypeError("data should be a string, Buffer or Uint8Array");
8453
- }
8454
- if (isFunction(encoding)) {
8455
- callback = encoding;
8456
- encoding = null;
8457
- }
8458
-
8459
- // Ignore empty buffers, since writing them doesn't invoke the callback
8460
- // https://github.com/nodejs/node/issues/22066
8461
- if (data.length === 0) {
8462
- if (callback) {
8463
- callback();
8464
- }
8465
- return;
8466
- }
8467
- // Only write when we don't exceed the maximum body length
8468
- if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
8469
- this._requestBodyLength += data.length;
8470
- this._requestBodyBuffers.push({ data: data, encoding: encoding });
8471
- this._currentRequest.write(data, encoding, callback);
8472
- }
8473
- // Error when we exceed the maximum body length
8474
- else {
8475
- this.emit("error", new MaxBodyLengthExceededError());
8476
- this.abort();
8477
- }
8478
- };
8479
-
8480
- // Ends the current native request
8481
- RedirectableRequest.prototype.end = function (data, encoding, callback) {
8482
- // Shift parameters if necessary
8483
- if (isFunction(data)) {
8484
- callback = data;
8485
- data = encoding = null;
8486
- }
8487
- else if (isFunction(encoding)) {
8488
- callback = encoding;
8489
- encoding = null;
8490
- }
8491
-
8492
- // Write data if needed and end
8493
- if (!data) {
8494
- this._ended = this._ending = true;
8495
- this._currentRequest.end(null, null, callback);
8496
- }
8497
- else {
8498
- var self = this;
8499
- var currentRequest = this._currentRequest;
8500
- this.write(data, encoding, function () {
8501
- self._ended = true;
8502
- currentRequest.end(null, null, callback);
8503
- });
8504
- this._ending = true;
8505
- }
8506
- };
8507
-
8508
- // Sets a header value on the current native request
8509
- RedirectableRequest.prototype.setHeader = function (name, value) {
8510
- this._options.headers[name] = value;
8511
- this._currentRequest.setHeader(name, value);
8512
- };
8513
-
8514
- // Clears a header value on the current native request
8515
- RedirectableRequest.prototype.removeHeader = function (name) {
8516
- delete this._options.headers[name];
8517
- this._currentRequest.removeHeader(name);
8518
- };
8519
-
8520
- // Global timeout for all underlying requests
8521
- RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
8522
- var self = this;
8523
-
8524
- // Destroys the socket on timeout
8525
- function destroyOnTimeout(socket) {
8526
- socket.setTimeout(msecs);
8527
- socket.removeListener("timeout", socket.destroy);
8528
- socket.addListener("timeout", socket.destroy);
8529
- }
8530
-
8531
- // Sets up a timer to trigger a timeout event
8532
- function startTimer(socket) {
8533
- if (self._timeout) {
8534
- clearTimeout(self._timeout);
8535
- }
8536
- self._timeout = setTimeout(function () {
8537
- self.emit("timeout");
8538
- clearTimer();
8539
- }, msecs);
8540
- destroyOnTimeout(socket);
8541
- }
8542
-
8543
- // Stops a timeout from triggering
8544
- function clearTimer() {
8545
- // Clear the timeout
8546
- if (self._timeout) {
8547
- clearTimeout(self._timeout);
8548
- self._timeout = null;
8549
- }
8550
-
8551
- // Clean up all attached listeners
8552
- self.removeListener("abort", clearTimer);
8553
- self.removeListener("error", clearTimer);
8554
- self.removeListener("response", clearTimer);
8555
- if (callback) {
8556
- self.removeListener("timeout", callback);
8557
- }
8558
- if (!self.socket) {
8559
- self._currentRequest.removeListener("socket", startTimer);
8560
- }
8561
- }
8562
-
8563
- // Attach callback if passed
8564
- if (callback) {
8565
- this.on("timeout", callback);
8566
- }
8567
-
8568
- // Start the timer if or when the socket is opened
8569
- if (this.socket) {
8570
- startTimer(this.socket);
8571
- }
8572
- else {
8573
- this._currentRequest.once("socket", startTimer);
8574
- }
8575
-
8576
- // Clean up on events
8577
- this.on("socket", destroyOnTimeout);
8578
- this.on("abort", clearTimer);
8579
- this.on("error", clearTimer);
8580
- this.on("response", clearTimer);
8581
-
8582
- return this;
8583
- };
8584
-
8585
- // Proxy all other public ClientRequest methods
8586
- [
8587
- "flushHeaders", "getHeader",
8588
- "setNoDelay", "setSocketKeepAlive",
8589
- ].forEach(function (method) {
8590
- RedirectableRequest.prototype[method] = function (a, b) {
8591
- return this._currentRequest[method](a, b);
8592
- };
8593
- });
8594
-
8595
- // Proxy all public ClientRequest properties
8596
- ["aborted", "connection", "socket"].forEach(function (property) {
8597
- Object.defineProperty(RedirectableRequest.prototype, property, {
8598
- get: function () { return this._currentRequest[property]; },
8599
- });
8600
- });
8601
-
8602
- RedirectableRequest.prototype._sanitizeOptions = function (options) {
8603
- // Ensure headers are always present
8604
- if (!options.headers) {
8605
- options.headers = {};
8606
- }
8607
-
8608
- // Since http.request treats host as an alias of hostname,
8609
- // but the url module interprets host as hostname plus port,
8610
- // eliminate the host property to avoid confusion.
8611
- if (options.host) {
8612
- // Use hostname if set, because it has precedence
8613
- if (!options.hostname) {
8614
- options.hostname = options.host;
8615
- }
8616
- delete options.host;
8617
- }
8618
-
8619
- // Complete the URL object when necessary
8620
- if (!options.pathname && options.path) {
8621
- var searchPos = options.path.indexOf("?");
8622
- if (searchPos < 0) {
8623
- options.pathname = options.path;
8624
- }
8625
- else {
8626
- options.pathname = options.path.substring(0, searchPos);
8627
- options.search = options.path.substring(searchPos);
8628
- }
8629
- }
8630
- };
8631
-
8632
-
8633
- // Executes the next native request (initial or redirect)
8634
- RedirectableRequest.prototype._performRequest = function () {
8635
- // Load the native protocol
8636
- var protocol = this._options.protocol;
8637
- var nativeProtocol = this._options.nativeProtocols[protocol];
8638
- if (!nativeProtocol) {
8639
- this.emit("error", new TypeError("Unsupported protocol " + protocol));
8640
- return;
8641
- }
8642
-
8643
- // If specified, use the agent corresponding to the protocol
8644
- // (HTTP and HTTPS use different types of agents)
8645
- if (this._options.agents) {
8646
- var scheme = protocol.slice(0, -1);
8647
- this._options.agent = this._options.agents[scheme];
8648
- }
8649
-
8650
- // Create the native request and set up its event handlers
8651
- var request = this._currentRequest =
8652
- nativeProtocol.request(this._options, this._onNativeResponse);
8653
- request._redirectable = this;
8654
- for (var event of events) {
8655
- request.on(event, eventHandlers[event]);
8656
- }
8657
-
8658
- // RFC7230§5.3.1: When making a request directly to an origin server, […]
8659
- // a client MUST send only the absolute path […] as the request-target.
8660
- this._currentUrl = /^\//.test(this._options.path) ?
8661
- url__default["default"].format(this._options) :
8662
- // When making a request to a proxy, […]
8663
- // a client MUST send the target URI in absolute-form […].
8664
- this._options.path;
8665
-
8666
- // End a redirected request
8667
- // (The first request must be ended explicitly with RedirectableRequest#end)
8668
- if (this._isRedirect) {
8669
- // Write the request entity and end
8670
- var i = 0;
8671
- var self = this;
8672
- var buffers = this._requestBodyBuffers;
8673
- (function writeNext(error) {
8674
- // Only write if this request has not been redirected yet
8675
- /* istanbul ignore else */
8676
- if (request === self._currentRequest) {
8677
- // Report any write errors
8678
- /* istanbul ignore if */
8679
- if (error) {
8680
- self.emit("error", error);
8681
- }
8682
- // Write the next buffer if there are still left
8683
- else if (i < buffers.length) {
8684
- var buffer = buffers[i++];
8685
- /* istanbul ignore else */
8686
- if (!request.finished) {
8687
- request.write(buffer.data, buffer.encoding, writeNext);
8688
- }
8689
- }
8690
- // End the request if `end` has been called on us
8691
- else if (self._ended) {
8692
- request.end();
8693
- }
8694
- }
8695
- }());
8696
- }
8697
- };
8698
-
8699
- // Processes a response from the current native request
8700
- RedirectableRequest.prototype._processResponse = function (response) {
8701
- // Store the redirected response
8702
- var statusCode = response.statusCode;
8703
- if (this._options.trackRedirects) {
8704
- this._redirects.push({
8705
- url: this._currentUrl,
8706
- headers: response.headers,
8707
- statusCode: statusCode,
8708
- });
8709
- }
8710
-
8711
- // RFC7231§6.4: The 3xx (Redirection) class of status code indicates
8712
- // that further action needs to be taken by the user agent in order to
8713
- // fulfill the request. If a Location header field is provided,
8714
- // the user agent MAY automatically redirect its request to the URI
8715
- // referenced by the Location field value,
8716
- // even if the specific status code is not understood.
8717
-
8718
- // If the response is not a redirect; return it as-is
8719
- var location = response.headers.location;
8720
- if (!location || this._options.followRedirects === false ||
8721
- statusCode < 300 || statusCode >= 400) {
8722
- response.responseUrl = this._currentUrl;
8723
- response.redirects = this._redirects;
8724
- this.emit("response", response);
8725
-
8726
- // Clean up
8727
- this._requestBodyBuffers = [];
8728
- return;
8729
- }
8730
-
8731
- // The response is a redirect, so abort the current request
8732
- abortRequest(this._currentRequest);
8733
- // Discard the remainder of the response to avoid waiting for data
8734
- response.destroy();
8735
-
8736
- // RFC7231§6.4: A client SHOULD detect and intervene
8737
- // in cyclical redirections (i.e., "infinite" redirection loops).
8738
- if (++this._redirectCount > this._options.maxRedirects) {
8739
- this.emit("error", new TooManyRedirectsError());
8740
- return;
8741
- }
8742
-
8743
- // Store the request headers if applicable
8744
- var requestHeaders;
8745
- var beforeRedirect = this._options.beforeRedirect;
8746
- if (beforeRedirect) {
8747
- requestHeaders = Object.assign({
8748
- // The Host header was set by nativeProtocol.request
8749
- Host: response.req.getHeader("host"),
8750
- }, this._options.headers);
8751
- }
8752
-
8753
- // RFC7231§6.4: Automatic redirection needs to done with
8754
- // care for methods not known to be safe, […]
8755
- // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
8756
- // the request method from POST to GET for the subsequent request.
8757
- var method = this._options.method;
8758
- if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
8759
- // RFC7231§6.4.4: The 303 (See Other) status code indicates that
8760
- // the server is redirecting the user agent to a different resource […]
8761
- // A user agent can perform a retrieval request targeting that URI
8762
- // (a GET or HEAD request if using HTTP) […]
8763
- (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
8764
- this._options.method = "GET";
8765
- // Drop a possible entity and headers related to it
8766
- this._requestBodyBuffers = [];
8767
- removeMatchingHeaders(/^content-/i, this._options.headers);
8768
- }
8769
-
8770
- // Drop the Host header, as the redirect might lead to a different host
8771
- var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
8772
-
8773
- // If the redirect is relative, carry over the host of the last request
8774
- var currentUrlParts = url__default["default"].parse(this._currentUrl);
8775
- var currentHost = currentHostHeader || currentUrlParts.host;
8776
- var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
8777
- url__default["default"].format(Object.assign(currentUrlParts, { host: currentHost }));
8778
-
8779
- // Determine the URL of the redirection
8780
- var redirectUrl;
8781
- try {
8782
- redirectUrl = url__default["default"].resolve(currentUrl, location);
8783
- }
8784
- catch (cause) {
8785
- this.emit("error", new RedirectionError({ cause: cause }));
8786
- return;
8787
- }
8788
-
8789
- // Create the redirected request
8790
- debug_1("redirecting to", redirectUrl);
8791
- this._isRedirect = true;
8792
- var redirectUrlParts = url__default["default"].parse(redirectUrl);
8793
- Object.assign(this._options, redirectUrlParts);
8794
-
8795
- // Drop confidential headers when redirecting to a less secure protocol
8796
- // or to a different domain that is not a superdomain
8797
- if (redirectUrlParts.protocol !== currentUrlParts.protocol &&
8798
- redirectUrlParts.protocol !== "https:" ||
8799
- redirectUrlParts.host !== currentHost &&
8800
- !isSubdomain(redirectUrlParts.host, currentHost)) {
8801
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
8802
- }
8803
-
8804
- // Evaluate the beforeRedirect callback
8805
- if (isFunction(beforeRedirect)) {
8806
- var responseDetails = {
8807
- headers: response.headers,
8808
- statusCode: statusCode,
8809
- };
8810
- var requestDetails = {
8811
- url: currentUrl,
8812
- method: method,
8813
- headers: requestHeaders,
8814
- };
8815
- try {
8816
- beforeRedirect(this._options, responseDetails, requestDetails);
8817
- }
8818
- catch (err) {
8819
- this.emit("error", err);
8820
- return;
8821
- }
8822
- this._sanitizeOptions(this._options);
8823
- }
8824
-
8825
- // Perform the redirected request
8826
- try {
8827
- this._performRequest();
8828
- }
8829
- catch (cause) {
8830
- this.emit("error", new RedirectionError({ cause: cause }));
8831
- }
8832
- };
8833
-
8834
- // Wraps the key/value object of protocols with redirect functionality
8835
- function wrap(protocols) {
8836
- // Default settings
8837
- var exports = {
8838
- maxRedirects: 21,
8839
- maxBodyLength: 10 * 1024 * 1024,
8840
- };
8841
-
8842
- // Wrap each protocol
8843
- var nativeProtocols = {};
8844
- Object.keys(protocols).forEach(function (scheme) {
8845
- var protocol = scheme + ":";
8846
- var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
8847
- var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
8848
-
8849
- // Executes a request, following redirects
8850
- function request(input, options, callback) {
8851
- // Parse parameters
8852
- if (isString(input)) {
8853
- var parsed;
8854
- try {
8855
- parsed = urlToOptions(new URL(input));
8856
- }
8857
- catch (err) {
8858
- /* istanbul ignore next */
8859
- parsed = url__default["default"].parse(input);
8860
- }
8861
- if (!isString(parsed.protocol)) {
8862
- throw new InvalidUrlError({ input });
8863
- }
8864
- input = parsed;
8865
- }
8866
- else if (URL && (input instanceof URL)) {
8867
- input = urlToOptions(input);
8868
- }
8869
- else {
8870
- callback = options;
8871
- options = input;
8872
- input = { protocol: protocol };
8873
- }
8874
- if (isFunction(options)) {
8875
- callback = options;
8876
- options = null;
8877
- }
8878
-
8879
- // Set defaults
8880
- options = Object.assign({
8881
- maxRedirects: exports.maxRedirects,
8882
- maxBodyLength: exports.maxBodyLength,
8883
- }, input, options);
8884
- options.nativeProtocols = nativeProtocols;
8885
- if (!isString(options.host) && !isString(options.hostname)) {
8886
- options.hostname = "::1";
8887
- }
8888
-
8889
- assert__default["default"].equal(options.protocol, protocol, "protocol mismatch");
8890
- debug_1("options", options);
8891
- return new RedirectableRequest(options, callback);
8892
- }
8893
-
8894
- // Executes a GET request, following redirects
8895
- function get(input, options, callback) {
8896
- var wrappedRequest = wrappedProtocol.request(input, options, callback);
8897
- wrappedRequest.end();
8898
- return wrappedRequest;
8899
- }
8900
-
8901
- // Expose the properties on the wrapped protocol
8902
- Object.defineProperties(wrappedProtocol, {
8903
- request: { value: request, configurable: true, enumerable: true, writable: true },
8904
- get: { value: get, configurable: true, enumerable: true, writable: true },
8905
- });
8906
- });
8907
- return exports;
8908
- }
8909
-
8910
- /* istanbul ignore next */
8911
- function noop() { /* empty */ }
8912
-
8913
- // from https://github.com/nodejs/node/blob/master/lib/internal/url.js
8914
- function urlToOptions(urlObject) {
8915
- var options = {
8916
- protocol: urlObject.protocol,
8917
- hostname: urlObject.hostname.startsWith("[") ?
8918
- /* istanbul ignore next */
8919
- urlObject.hostname.slice(1, -1) :
8920
- urlObject.hostname,
8921
- hash: urlObject.hash,
8922
- search: urlObject.search,
8923
- pathname: urlObject.pathname,
8924
- path: urlObject.pathname + urlObject.search,
8925
- href: urlObject.href,
8926
- };
8927
- if (urlObject.port !== "") {
8928
- options.port = Number(urlObject.port);
8929
- }
8930
- return options;
8931
- }
8932
-
8933
- function removeMatchingHeaders(regex, headers) {
8934
- var lastValue;
8935
- for (var header in headers) {
8936
- if (regex.test(header)) {
8937
- lastValue = headers[header];
8938
- delete headers[header];
8939
- }
8940
- }
8941
- return (lastValue === null || typeof lastValue === "undefined") ?
8942
- undefined : String(lastValue).trim();
8943
- }
8944
-
8945
- function createErrorType(code, message, baseClass) {
8946
- // Create constructor
8947
- function CustomError(properties) {
8948
- Error.captureStackTrace(this, this.constructor);
8949
- Object.assign(this, properties || {});
8950
- this.code = code;
8951
- this.message = this.cause ? message + ": " + this.cause.message : message;
8952
- }
8953
-
8954
- // Attach constructor and set default properties
8955
- CustomError.prototype = new (baseClass || Error)();
8956
- CustomError.prototype.constructor = CustomError;
8957
- CustomError.prototype.name = "Error [" + code + "]";
8958
- return CustomError;
8959
- }
8960
-
8961
- function abortRequest(request) {
8962
- for (var event of events) {
8963
- request.removeListener(event, eventHandlers[event]);
8964
- }
8965
- request.on("error", noop);
8966
- request.abort();
8967
- }
8968
-
8969
- function isSubdomain(subdomain, domain) {
8970
- assert__default["default"](isString(subdomain) && isString(domain));
8971
- var dot = subdomain.length - domain.length - 1;
8972
- return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
8973
- }
8974
-
8975
- function isString(value) {
8976
- return typeof value === "string" || value instanceof String;
8977
- }
8978
-
8979
- function isFunction(value) {
8980
- return typeof value === "function";
8981
- }
8982
-
8983
- function isBuffer(value) {
8984
- return typeof value === "object" && ("length" in value);
8985
- }
8986
-
8987
- // Exports
8988
- var followRedirects = wrap({ http: http__default["default"], https: https__default["default"] });
8989
- var wrap_1 = wrap;
8990
- followRedirects.wrap = wrap_1;var name = "axios";
8991
- var version = "0.21.1";
8992
- var description = "Promise based HTTP client for the browser and node.js";
8993
- var main = "index.js";
8994
- var scripts = {
8995
- test: "grunt test && bundlesize",
8996
- start: "node ./sandbox/server.js",
8997
- build: "NODE_ENV=production grunt build",
8998
- preversion: "npm test",
8999
- version: "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",
9000
- postversion: "git push && git push --tags",
9001
- examples: "node ./examples/server.js",
9002
- coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
9003
- fix: "eslint --fix lib/**/*.js"
9004
- };
9005
- var repository = {
9006
- type: "git",
9007
- url: "https://github.com/axios/axios.git"
9008
- };
9009
- var keywords = [
9010
- "xhr",
9011
- "http",
9012
- "ajax",
9013
- "promise",
9014
- "node"
9015
- ];
9016
- var author = "Matt Zabriskie";
9017
- var license = "MIT";
9018
- var bugs = {
9019
- url: "https://github.com/axios/axios/issues"
9020
- };
9021
- var homepage = "https://github.com/axios/axios";
9022
- var devDependencies = {
9023
- bundlesize: "^0.17.0",
9024
- coveralls: "^3.0.0",
9025
- "es6-promise": "^4.2.4",
9026
- grunt: "^1.0.2",
9027
- "grunt-banner": "^0.6.0",
9028
- "grunt-cli": "^1.2.0",
9029
- "grunt-contrib-clean": "^1.1.0",
9030
- "grunt-contrib-watch": "^1.0.0",
9031
- "grunt-eslint": "^20.1.0",
9032
- "grunt-karma": "^2.0.0",
9033
- "grunt-mocha-test": "^0.13.3",
9034
- "grunt-ts": "^6.0.0-beta.19",
9035
- "grunt-webpack": "^1.0.18",
9036
- "istanbul-instrumenter-loader": "^1.0.0",
9037
- "jasmine-core": "^2.4.1",
9038
- karma: "^1.3.0",
9039
- "karma-chrome-launcher": "^2.2.0",
9040
- "karma-coverage": "^1.1.1",
9041
- "karma-firefox-launcher": "^1.1.0",
9042
- "karma-jasmine": "^1.1.1",
9043
- "karma-jasmine-ajax": "^0.1.13",
9044
- "karma-opera-launcher": "^1.0.0",
9045
- "karma-safari-launcher": "^1.0.0",
9046
- "karma-sauce-launcher": "^1.2.0",
9047
- "karma-sinon": "^1.0.5",
9048
- "karma-sourcemap-loader": "^0.3.7",
9049
- "karma-webpack": "^1.7.0",
9050
- "load-grunt-tasks": "^3.5.2",
9051
- minimist: "^1.2.0",
9052
- mocha: "^5.2.0",
9053
- sinon: "^4.5.0",
9054
- typescript: "^2.8.1",
9055
- "url-search-params": "^0.10.0",
9056
- webpack: "^1.13.1",
9057
- "webpack-dev-server": "^1.14.1"
9058
- };
9059
- var browser = {
9060
- "./lib/adapters/http.js": "./lib/adapters/xhr.js"
9061
- };
9062
- var jsdelivr = "dist/axios.min.js";
9063
- var unpkg = "dist/axios.min.js";
9064
- var typings = "./index.d.ts";
9065
- var dependencies = {
9066
- "follow-redirects": "^1.10.0"
9067
- };
9068
- var bundlesize = [
9069
- {
9070
- path: "./dist/axios.min.js",
9071
- threshold: "5kB"
9072
- }
9073
- ];
9074
- var _resolved = "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz";
9075
- var _integrity = "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==";
9076
- var _from = "axios@0.21.1";
9077
- var pkg = {
9078
- name: name,
9079
- version: version,
9080
- description: description,
9081
- main: main,
9082
- scripts: scripts,
9083
- repository: repository,
9084
- keywords: keywords,
9085
- author: author,
9086
- license: license,
9087
- bugs: bugs,
9088
- homepage: homepage,
9089
- devDependencies: devDependencies,
9090
- browser: browser,
9091
- jsdelivr: jsdelivr,
9092
- unpkg: unpkg,
9093
- typings: typings,
9094
- dependencies: dependencies,
9095
- bundlesize: bundlesize,
9096
- _resolved: _resolved,
9097
- _integrity: _integrity,
9098
- _from: _from
9099
- };var httpFollow = followRedirects.http;
9100
- var httpsFollow = followRedirects.https;
9101
-
9102
-
9103
-
9104
-
9105
-
9106
-
9107
- var isHttps = /https:?/;
9108
-
9109
- /**
9110
- *
9111
- * @param {http.ClientRequestArgs} options
9112
- * @param {AxiosProxyConfig} proxy
9113
- * @param {string} location
9114
- */
9115
- function setProxy(options, proxy, location) {
9116
- options.hostname = proxy.host;
9117
- options.host = proxy.host;
9118
- options.port = proxy.port;
9119
- options.path = location;
9120
-
9121
- // Basic proxy authorization
9122
- if (proxy.auth) {
9123
- var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
9124
- options.headers['Proxy-Authorization'] = 'Basic ' + base64;
9125
- }
9126
-
9127
- // If a proxy is used, any redirects must also pass through the proxy
9128
- options.beforeRedirect = function beforeRedirect(redirection) {
9129
- redirection.headers.host = redirection.host;
9130
- setProxy(redirection, proxy, redirection.href);
9131
- };
9132
- }
9133
-
9134
- /*eslint consistent-return:0*/
9135
- var http_1 = function httpAdapter(config) {
9136
- return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
9137
- var resolve = function resolve(value) {
9138
- resolvePromise(value);
9139
- };
9140
- var reject = function reject(value) {
9141
- rejectPromise(value);
9142
- };
9143
- var data = config.data;
9144
- var headers = config.headers;
9145
-
9146
- // Set User-Agent (required by some servers)
9147
- // Only set header if it hasn't been set in config
9148
- // See https://github.com/axios/axios/issues/69
9149
- if (!headers['User-Agent'] && !headers['user-agent']) {
9150
- headers['User-Agent'] = 'axios/' + pkg.version;
9151
- }
9152
-
9153
- if (data && !utils.isStream(data)) {
9154
- if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
9155
- data = Buffer.from(new Uint8Array(data));
9156
- } else if (utils.isString(data)) {
9157
- data = Buffer.from(data, 'utf-8');
9158
- } else {
9159
- return reject(createError(
9160
- 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
9161
- config
9162
- ));
9163
- }
9164
-
9165
- // Add Content-Length header if data exists
9166
- headers['Content-Length'] = data.length;
9167
- }
9168
-
9169
- // HTTP basic authentication
9170
- var auth = undefined;
9171
- if (config.auth) {
9172
- var username = config.auth.username || '';
9173
- var password = config.auth.password || '';
9174
- auth = username + ':' + password;
9175
- }
9176
-
9177
- // Parse url
9178
- var fullPath = buildFullPath(config.baseURL, config.url);
9179
- var parsed = url__default["default"].parse(fullPath);
9180
- var protocol = parsed.protocol || 'http:';
9181
-
9182
- if (!auth && parsed.auth) {
9183
- var urlAuth = parsed.auth.split(':');
9184
- var urlUsername = urlAuth[0] || '';
9185
- var urlPassword = urlAuth[1] || '';
9186
- auth = urlUsername + ':' + urlPassword;
9187
- }
9188
-
9189
- if (auth) {
9190
- delete headers.Authorization;
9191
- }
9192
-
9193
- var isHttpsRequest = isHttps.test(protocol);
9194
- var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
9195
-
9196
- var options = {
9197
- path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
9198
- method: config.method.toUpperCase(),
9199
- headers: headers,
9200
- agent: agent,
9201
- agents: { http: config.httpAgent, https: config.httpsAgent },
9202
- auth: auth
9203
- };
9204
-
9205
- if (config.socketPath) {
9206
- options.socketPath = config.socketPath;
9207
- } else {
9208
- options.hostname = parsed.hostname;
9209
- options.port = parsed.port;
9210
- }
9211
-
9212
- var proxy = config.proxy;
9213
- if (!proxy && proxy !== false) {
9214
- var proxyEnv = protocol.slice(0, -1) + '_proxy';
9215
- var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
9216
- if (proxyUrl) {
9217
- var parsedProxyUrl = url__default["default"].parse(proxyUrl);
9218
- var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
9219
- var shouldProxy = true;
9220
-
9221
- if (noProxyEnv) {
9222
- var noProxy = noProxyEnv.split(',').map(function trim(s) {
9223
- return s.trim();
9224
- });
9225
-
9226
- shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
9227
- if (!proxyElement) {
9228
- return false;
9229
- }
9230
- if (proxyElement === '*') {
9231
- return true;
9232
- }
9233
- if (proxyElement[0] === '.' &&
9234
- parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
9235
- return true;
9236
- }
9237
-
9238
- return parsed.hostname === proxyElement;
9239
- });
9240
- }
9241
-
9242
- if (shouldProxy) {
9243
- proxy = {
9244
- host: parsedProxyUrl.hostname,
9245
- port: parsedProxyUrl.port,
9246
- protocol: parsedProxyUrl.protocol
9247
- };
9248
-
9249
- if (parsedProxyUrl.auth) {
9250
- var proxyUrlAuth = parsedProxyUrl.auth.split(':');
9251
- proxy.auth = {
9252
- username: proxyUrlAuth[0],
9253
- password: proxyUrlAuth[1]
9254
- };
9255
- }
9256
- }
9257
- }
9258
- }
9259
-
9260
- if (proxy) {
9261
- options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
9262
- setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
9263
- }
9264
-
9265
- var transport;
9266
- var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
9267
- if (config.transport) {
9268
- transport = config.transport;
9269
- } else if (config.maxRedirects === 0) {
9270
- transport = isHttpsProxy ? https__default["default"] : http__default["default"];
9271
- } else {
9272
- if (config.maxRedirects) {
9273
- options.maxRedirects = config.maxRedirects;
9274
- }
9275
- transport = isHttpsProxy ? httpsFollow : httpFollow;
9276
- }
9277
-
9278
- if (config.maxBodyLength > -1) {
9279
- options.maxBodyLength = config.maxBodyLength;
9280
- }
9281
-
9282
- // Create the request
9283
- var req = transport.request(options, function handleResponse(res) {
9284
- if (req.aborted) return;
9285
-
9286
- // uncompress the response body transparently if required
9287
- var stream = res;
9288
-
9289
- // return the last request in case of redirects
9290
- var lastRequest = res.req || req;
9291
-
9292
-
9293
- // if no content, is HEAD request or decompress disabled we should not decompress
9294
- if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
9295
- switch (res.headers['content-encoding']) {
9296
- /*eslint default-case:0*/
9297
- case 'gzip':
9298
- case 'compress':
9299
- case 'deflate':
9300
- // add the unzipper to the body stream processing pipeline
9301
- stream = stream.pipe(zlib__default["default"].createUnzip());
9302
-
9303
- // remove the content-encoding in order to not confuse downstream operations
9304
- delete res.headers['content-encoding'];
9305
- break;
9306
- }
9307
- }
9308
-
9309
- var response = {
9310
- status: res.statusCode,
9311
- statusText: res.statusMessage,
9312
- headers: res.headers,
9313
- config: config,
9314
- request: lastRequest
9315
- };
9316
-
9317
- if (config.responseType === 'stream') {
9318
- response.data = stream;
9319
- settle(resolve, reject, response);
9320
- } else {
9321
- var responseBuffer = [];
9322
- stream.on('data', function handleStreamData(chunk) {
9323
- responseBuffer.push(chunk);
9324
-
9325
- // make sure the content length is not over the maxContentLength if specified
9326
- if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
9327
- stream.destroy();
9328
- reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
9329
- config, null, lastRequest));
9330
- }
9331
- });
9332
-
9333
- stream.on('error', function handleStreamError(err) {
9334
- if (req.aborted) return;
9335
- reject(enhanceError(err, config, null, lastRequest));
9336
- });
9337
-
9338
- stream.on('end', function handleStreamEnd() {
9339
- var responseData = Buffer.concat(responseBuffer);
9340
- if (config.responseType !== 'arraybuffer') {
9341
- responseData = responseData.toString(config.responseEncoding);
9342
- if (!config.responseEncoding || config.responseEncoding === 'utf8') {
9343
- responseData = utils.stripBOM(responseData);
9344
- }
9345
- }
9346
-
9347
- response.data = responseData;
9348
- settle(resolve, reject, response);
9349
- });
9350
- }
9351
- });
9352
-
9353
- // Handle errors
9354
- req.on('error', function handleRequestError(err) {
9355
- if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
9356
- reject(enhanceError(err, config, null, req));
9357
- });
9358
-
9359
- // Handle request timeout
9360
- if (config.timeout) {
9361
- // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
9362
- // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
9363
- // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
9364
- // And then these socket which be hang up will devoring CPU little by little.
9365
- // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
9366
- req.setTimeout(config.timeout, function handleRequestTimeout() {
9367
- req.abort();
9368
- reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
9369
- });
9370
- }
9371
-
9372
- if (config.cancelToken) {
9373
- // Handle cancellation
9374
- config.cancelToken.promise.then(function onCanceled(cancel) {
9375
- if (req.aborted) return;
9376
-
9377
- req.abort();
9378
- reject(cancel);
9379
- });
9380
- }
9381
-
9382
- // Send the request
9383
- if (utils.isStream(data)) {
9384
- data.on('error', function handleStreamError(err) {
9385
- reject(enhanceError(err, config, null, req));
9386
- }).pipe(req);
9387
- } else {
9388
- req.end(data);
9389
- }
9390
- });
9391
- };var DEFAULT_CONTENT_TYPE = {
9392
- 'Content-Type': 'application/x-www-form-urlencoded'
9393
- };
9394
-
9395
- function setContentTypeIfUnset(headers, value) {
9396
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
9397
- headers['Content-Type'] = value;
9398
- }
9399
- }
9400
-
9401
- function getDefaultAdapter() {
9402
- var adapter;
9403
- if (typeof XMLHttpRequest !== 'undefined') {
9404
- // For browsers use XHR adapter
9405
- adapter = xhr;
9406
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
9407
- // For node use HTTP adapter
9408
- adapter = http_1;
9409
- }
9410
- return adapter;
9411
- }
9412
-
9413
- var defaults = {
9414
- adapter: getDefaultAdapter(),
9415
-
9416
- transformRequest: [function transformRequest(data, headers) {
9417
- normalizeHeaderName(headers, 'Accept');
9418
- normalizeHeaderName(headers, 'Content-Type');
9419
- if (utils.isFormData(data) ||
9420
- utils.isArrayBuffer(data) ||
9421
- utils.isBuffer(data) ||
9422
- utils.isStream(data) ||
9423
- utils.isFile(data) ||
9424
- utils.isBlob(data)
9425
- ) {
9426
- return data;
9427
- }
9428
- if (utils.isArrayBufferView(data)) {
9429
- return data.buffer;
9430
- }
9431
- if (utils.isURLSearchParams(data)) {
9432
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
9433
- return data.toString();
9434
- }
9435
- if (utils.isObject(data)) {
9436
- setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
9437
- return JSON.stringify(data);
9438
- }
9439
- return data;
9440
- }],
9441
-
9442
- transformResponse: [function transformResponse(data) {
9443
- /*eslint no-param-reassign:0*/
9444
- if (typeof data === 'string') {
9445
- try {
9446
- data = JSON.parse(data);
9447
- } catch (e) { /* Ignore */ }
9448
- }
9449
- return data;
9450
- }],
9451
-
9452
- /**
9453
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
9454
- * timeout is not created.
9455
- */
9456
- timeout: 0,
9457
-
9458
- xsrfCookieName: 'XSRF-TOKEN',
9459
- xsrfHeaderName: 'X-XSRF-TOKEN',
9460
-
9461
- maxContentLength: -1,
9462
- maxBodyLength: -1,
9463
-
9464
- validateStatus: function validateStatus(status) {
9465
- return status >= 200 && status < 300;
9466
- }
9467
- };
9468
-
9469
- defaults.headers = {
9470
- common: {
9471
- 'Accept': 'application/json, text/plain, */*'
9472
- }
9473
- };
9474
-
9475
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
9476
- defaults.headers[method] = {};
9477
- });
9478
-
9479
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
9480
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
9481
- });
9482
-
9483
- var defaults_1 = defaults;/**
9484
- * Throws a `Cancel` if cancellation has been requested.
9485
- */
9486
- function throwIfCancellationRequested(config) {
9487
- if (config.cancelToken) {
9488
- config.cancelToken.throwIfRequested();
9489
- }
9490
- }
9491
-
9492
- /**
9493
- * Dispatch a request to the server using the configured adapter.
9494
- *
9495
- * @param {object} config The config that is to be used for the request
9496
- * @returns {Promise} The Promise to be fulfilled
9497
- */
9498
- var dispatchRequest = function dispatchRequest(config) {
9499
- throwIfCancellationRequested(config);
9500
-
9501
- // Ensure headers exist
9502
- config.headers = config.headers || {};
7350
+ // Ensure headers exist
7351
+ config.headers = config.headers || {};
9503
7352
 
9504
7353
  // Transform request data
9505
7354
  config.data = transformData(
@@ -9509,20 +7358,20 @@ var dispatchRequest = function dispatchRequest(config) {
9509
7358
  );
9510
7359
 
9511
7360
  // Flatten headers
9512
- config.headers = utils.merge(
7361
+ config.headers = utils$1.merge(
9513
7362
  config.headers.common || {},
9514
7363
  config.headers[config.method] || {},
9515
7364
  config.headers
9516
7365
  );
9517
7366
 
9518
- utils.forEach(
7367
+ utils$1.forEach(
9519
7368
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
9520
7369
  function cleanHeaderConfig(method) {
9521
7370
  delete config.headers[method];
9522
7371
  }
9523
7372
  );
9524
7373
 
9525
- var adapter = config.adapter || defaults_1.adapter;
7374
+ var adapter = config.adapter || defaults.adapter;
9526
7375
 
9527
7376
  return adapter(config).then(function onAdapterResolution(response) {
9528
7377
  throwIfCancellationRequested(config);
@@ -9576,41 +7425,41 @@ var mergeConfig = function mergeConfig(config1, config2) {
9576
7425
  var directMergeKeys = ['validateStatus'];
9577
7426
 
9578
7427
  function getMergedValue(target, source) {
9579
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
9580
- return utils.merge(target, source);
9581
- } else if (utils.isPlainObject(source)) {
9582
- return utils.merge({}, source);
9583
- } else if (utils.isArray(source)) {
7428
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
7429
+ return utils$1.merge(target, source);
7430
+ } else if (utils$1.isPlainObject(source)) {
7431
+ return utils$1.merge({}, source);
7432
+ } else if (utils$1.isArray(source)) {
9584
7433
  return source.slice();
9585
7434
  }
9586
7435
  return source;
9587
7436
  }
9588
7437
 
9589
7438
  function mergeDeepProperties(prop) {
9590
- if (!utils.isUndefined(config2[prop])) {
7439
+ if (!utils$1.isUndefined(config2[prop])) {
9591
7440
  config[prop] = getMergedValue(config1[prop], config2[prop]);
9592
- } else if (!utils.isUndefined(config1[prop])) {
7441
+ } else if (!utils$1.isUndefined(config1[prop])) {
9593
7442
  config[prop] = getMergedValue(undefined, config1[prop]);
9594
7443
  }
9595
7444
  }
9596
7445
 
9597
- utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
9598
- if (!utils.isUndefined(config2[prop])) {
7446
+ utils$1.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
7447
+ if (!utils$1.isUndefined(config2[prop])) {
9599
7448
  config[prop] = getMergedValue(undefined, config2[prop]);
9600
7449
  }
9601
7450
  });
9602
7451
 
9603
- utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
7452
+ utils$1.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
9604
7453
 
9605
- utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
9606
- if (!utils.isUndefined(config2[prop])) {
7454
+ utils$1.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
7455
+ if (!utils$1.isUndefined(config2[prop])) {
9607
7456
  config[prop] = getMergedValue(undefined, config2[prop]);
9608
- } else if (!utils.isUndefined(config1[prop])) {
7457
+ } else if (!utils$1.isUndefined(config1[prop])) {
9609
7458
  config[prop] = getMergedValue(undefined, config1[prop]);
9610
7459
  }
9611
7460
  });
9612
7461
 
9613
- utils.forEach(directMergeKeys, function merge(prop) {
7462
+ utils$1.forEach(directMergeKeys, function merge(prop) {
9614
7463
  if (prop in config2) {
9615
7464
  config[prop] = getMergedValue(config1[prop], config2[prop]);
9616
7465
  } else if (prop in config1) {
@@ -9630,7 +7479,7 @@ var mergeConfig = function mergeConfig(config1, config2) {
9630
7479
  return axiosKeys.indexOf(key) === -1;
9631
7480
  });
9632
7481
 
9633
- utils.forEach(otherKeys, mergeDeepProperties);
7482
+ utils$1.forEach(otherKeys, mergeDeepProperties);
9634
7483
 
9635
7484
  return config;
9636
7485
  };/**
@@ -9697,7 +7546,7 @@ Axios.prototype.getUri = function getUri(config) {
9697
7546
  };
9698
7547
 
9699
7548
  // Provide aliases for supported request methods
9700
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
7549
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
9701
7550
  /*eslint func-names:0*/
9702
7551
  Axios.prototype[method] = function(url, config) {
9703
7552
  return this.request(mergeConfig(config || {}, {
@@ -9708,7 +7557,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
9708
7557
  };
9709
7558
  });
9710
7559
 
9711
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
7560
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
9712
7561
  /*eslint func-names:0*/
9713
7562
  Axios.prototype[method] = function(url, data, config) {
9714
7563
  return this.request(mergeConfig(config || {}, {
@@ -9830,16 +7679,16 @@ function createInstance(defaultConfig) {
9830
7679
  var instance = bind(Axios_1.prototype.request, context);
9831
7680
 
9832
7681
  // Copy axios.prototype to instance
9833
- utils.extend(instance, Axios_1.prototype, context);
7682
+ utils$1.extend(instance, Axios_1.prototype, context);
9834
7683
 
9835
7684
  // Copy context to instance
9836
- utils.extend(instance, context);
7685
+ utils$1.extend(instance, context);
9837
7686
 
9838
7687
  return instance;
9839
7688
  }
9840
7689
 
9841
7690
  // Create the default instance to be exported
9842
- var axios$1 = createInstance(defaults_1);
7691
+ var axios$1 = createInstance(defaults);
9843
7692
 
9844
7693
  // Expose Axios class to allow class inheritance
9845
7694
  axios$1.Axios = Axios_1;