unika-components 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/unika-components.css +1092 -1092
- package/dist/unika-components.esm.js +52 -3725
- package/dist/unika-components.umd.js +56 -3732
- package/package.json +1 -2
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["unika-components"] = {}, global.vue
|
|
5
|
-
})(this, (function (exports, vue
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
10
|
-
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
11
|
-
var url__default = /*#__PURE__*/_interopDefaultLegacy(url);
|
|
12
|
-
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
13
|
-
var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert);
|
|
14
|
-
var tty__default = /*#__PURE__*/_interopDefaultLegacy(tty);
|
|
15
|
-
var util__default = /*#__PURE__*/_interopDefaultLegacy(util);
|
|
16
|
-
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
17
|
-
var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["unika-components"] = {}, global.vue));
|
|
5
|
+
})(this, (function (exports, vue) { 'use strict';
|
|
18
6
|
|
|
19
7
|
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
20
8
|
window.addEventListener('resize', () => {
|
|
@@ -22501,15 +22489,15 @@
|
|
|
22501
22489
|
function isObjectLike(value) {
|
|
22502
22490
|
return value != null && typeof value == "object";
|
|
22503
22491
|
}
|
|
22504
|
-
var isArray
|
|
22505
|
-
var isArray$1
|
|
22506
|
-
function isObject
|
|
22492
|
+
var isArray = Array.isArray;
|
|
22493
|
+
var isArray$1 = isArray;
|
|
22494
|
+
function isObject(value) {
|
|
22507
22495
|
var type = typeof value;
|
|
22508
22496
|
return value != null && (type == "object" || type == "function");
|
|
22509
22497
|
}
|
|
22510
22498
|
var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
22511
|
-
function isFunction
|
|
22512
|
-
if (!isObject
|
|
22499
|
+
function isFunction(value) {
|
|
22500
|
+
if (!isObject(value)) {
|
|
22513
22501
|
return false;
|
|
22514
22502
|
}
|
|
22515
22503
|
var tag = baseGetTag(value);
|
|
@@ -22546,10 +22534,10 @@
|
|
|
22546
22534
|
var hasOwnProperty$a = objectProto$c.hasOwnProperty;
|
|
22547
22535
|
var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$a).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
|
|
22548
22536
|
function baseIsNative(value) {
|
|
22549
|
-
if (!isObject
|
|
22537
|
+
if (!isObject(value) || isMasked(value)) {
|
|
22550
22538
|
return false;
|
|
22551
22539
|
}
|
|
22552
|
-
var pattern = isFunction
|
|
22540
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
22553
22541
|
return pattern.test(toSource(value));
|
|
22554
22542
|
}
|
|
22555
22543
|
function getValue(object, key) {
|
|
@@ -22566,7 +22554,7 @@
|
|
|
22566
22554
|
function object() {
|
|
22567
22555
|
}
|
|
22568
22556
|
return function(proto) {
|
|
22569
|
-
if (!isObject
|
|
22557
|
+
if (!isObject(proto)) {
|
|
22570
22558
|
return {};
|
|
22571
22559
|
}
|
|
22572
22560
|
if (objectCreate) {
|
|
@@ -22658,7 +22646,7 @@
|
|
|
22658
22646
|
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
22659
22647
|
}
|
|
22660
22648
|
function isArrayLike(value) {
|
|
22661
|
-
return value != null && isLength(value.length) && !isFunction
|
|
22649
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
22662
22650
|
}
|
|
22663
22651
|
var objectProto$a = Object.prototype;
|
|
22664
22652
|
function isPrototype(value) {
|
|
@@ -22693,8 +22681,8 @@
|
|
|
22693
22681
|
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
|
|
22694
22682
|
var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
|
|
22695
22683
|
var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
|
|
22696
|
-
var isBuffer
|
|
22697
|
-
var isBuffer$1
|
|
22684
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
22685
|
+
var isBuffer$1 = isBuffer;
|
|
22698
22686
|
var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
|
|
22699
22687
|
var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
|
|
22700
22688
|
var typedArrayTags = {};
|
|
@@ -22729,7 +22717,7 @@
|
|
|
22729
22717
|
var objectProto$8 = Object.prototype;
|
|
22730
22718
|
var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
|
|
22731
22719
|
function arrayLikeKeys(value, inherited) {
|
|
22732
|
-
var isArr = isArray$1
|
|
22720
|
+
var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
22733
22721
|
for (var key in value) {
|
|
22734
22722
|
if ((inherited || hasOwnProperty$7.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
|
|
22735
22723
|
result.push(key);
|
|
@@ -22773,7 +22761,7 @@
|
|
|
22773
22761
|
var objectProto$6 = Object.prototype;
|
|
22774
22762
|
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
22775
22763
|
function baseKeysIn(object) {
|
|
22776
|
-
if (!isObject
|
|
22764
|
+
if (!isObject(object)) {
|
|
22777
22765
|
return nativeKeysIn(object);
|
|
22778
22766
|
}
|
|
22779
22767
|
var isProto = isPrototype(object), result = [];
|
|
@@ -23053,7 +23041,7 @@
|
|
|
23053
23041
|
}
|
|
23054
23042
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
23055
23043
|
var result = keysFunc(object);
|
|
23056
|
-
return isArray$1
|
|
23044
|
+
return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
23057
23045
|
}
|
|
23058
23046
|
function getAllKeys(object) {
|
|
23059
23047
|
return baseGetAllKeys(object, keys, getSymbols$1);
|
|
@@ -23193,10 +23181,10 @@
|
|
|
23193
23181
|
if (result !== void 0) {
|
|
23194
23182
|
return result;
|
|
23195
23183
|
}
|
|
23196
|
-
if (!isObject
|
|
23184
|
+
if (!isObject(value)) {
|
|
23197
23185
|
return value;
|
|
23198
23186
|
}
|
|
23199
|
-
var isArr = isArray$1
|
|
23187
|
+
var isArr = isArray$1(value);
|
|
23200
23188
|
if (isArr) {
|
|
23201
23189
|
result = initCloneArray(value);
|
|
23202
23190
|
if (!isDeep) {
|
|
@@ -23204,7 +23192,7 @@
|
|
|
23204
23192
|
}
|
|
23205
23193
|
} else {
|
|
23206
23194
|
var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
|
|
23207
|
-
if (isBuffer$1
|
|
23195
|
+
if (isBuffer$1(value)) {
|
|
23208
23196
|
return cloneBuffer(value, isDeep);
|
|
23209
23197
|
}
|
|
23210
23198
|
if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
|
|
@@ -23437,12 +23425,12 @@
|
|
|
23437
23425
|
var objectProto = Object.prototype;
|
|
23438
23426
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
23439
23427
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
23440
|
-
var objIsArr = isArray$1
|
|
23428
|
+
var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
|
|
23441
23429
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
23442
23430
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
23443
23431
|
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
23444
|
-
if (isSameTag && isBuffer$1
|
|
23445
|
-
if (!isBuffer$1
|
|
23432
|
+
if (isSameTag && isBuffer$1(object)) {
|
|
23433
|
+
if (!isBuffer$1(other)) {
|
|
23446
23434
|
return false;
|
|
23447
23435
|
}
|
|
23448
23436
|
objIsArr = true;
|
|
@@ -24013,3691 +24001,20 @@
|
|
|
24013
24001
|
app.component(script$h.name, script$h);
|
|
24014
24002
|
};
|
|
24015
24003
|
|
|
24016
|
-
|
|
24017
|
-
|
|
24018
|
-
|
|
24019
|
-
|
|
24020
|
-
|
|
24021
|
-
|
|
24022
|
-
|
|
24023
|
-
|
|
24024
|
-
|
|
24025
|
-
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
|
|
24029
|
-
|
|
24030
|
-
var toString = Object.prototype.toString;
|
|
24031
|
-
|
|
24032
|
-
/**
|
|
24033
|
-
* Determine if a value is an Array
|
|
24034
|
-
*
|
|
24035
|
-
* @param {Object} val The value to test
|
|
24036
|
-
* @returns {boolean} True if value is an Array, otherwise false
|
|
24037
|
-
*/
|
|
24038
|
-
function isArray(val) {
|
|
24039
|
-
return toString.call(val) === '[object Array]';
|
|
24040
|
-
}
|
|
24041
|
-
|
|
24042
|
-
/**
|
|
24043
|
-
* Determine if a value is undefined
|
|
24044
|
-
*
|
|
24045
|
-
* @param {Object} val The value to test
|
|
24046
|
-
* @returns {boolean} True if the value is undefined, otherwise false
|
|
24047
|
-
*/
|
|
24048
|
-
function isUndefined(val) {
|
|
24049
|
-
return typeof val === 'undefined';
|
|
24050
|
-
}
|
|
24051
|
-
|
|
24052
|
-
/**
|
|
24053
|
-
* Determine if a value is a Buffer
|
|
24054
|
-
*
|
|
24055
|
-
* @param {Object} val The value to test
|
|
24056
|
-
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
24057
|
-
*/
|
|
24058
|
-
function isBuffer$1(val) {
|
|
24059
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
24060
|
-
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
|
|
24061
|
-
}
|
|
24062
|
-
|
|
24063
|
-
/**
|
|
24064
|
-
* Determine if a value is an ArrayBuffer
|
|
24065
|
-
*
|
|
24066
|
-
* @param {Object} val The value to test
|
|
24067
|
-
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
24068
|
-
*/
|
|
24069
|
-
function isArrayBuffer(val) {
|
|
24070
|
-
return toString.call(val) === '[object ArrayBuffer]';
|
|
24071
|
-
}
|
|
24072
|
-
|
|
24073
|
-
/**
|
|
24074
|
-
* Determine if a value is a FormData
|
|
24075
|
-
*
|
|
24076
|
-
* @param {Object} val The value to test
|
|
24077
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
|
24078
|
-
*/
|
|
24079
|
-
function isFormData(val) {
|
|
24080
|
-
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
|
24081
|
-
}
|
|
24082
|
-
|
|
24083
|
-
/**
|
|
24084
|
-
* Determine if a value is a view on an ArrayBuffer
|
|
24085
|
-
*
|
|
24086
|
-
* @param {Object} val The value to test
|
|
24087
|
-
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
24088
|
-
*/
|
|
24089
|
-
function isArrayBufferView(val) {
|
|
24090
|
-
var result;
|
|
24091
|
-
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
24092
|
-
result = ArrayBuffer.isView(val);
|
|
24093
|
-
} else {
|
|
24094
|
-
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
|
24095
|
-
}
|
|
24096
|
-
return result;
|
|
24097
|
-
}
|
|
24098
|
-
|
|
24099
|
-
/**
|
|
24100
|
-
* Determine if a value is a String
|
|
24101
|
-
*
|
|
24102
|
-
* @param {Object} val The value to test
|
|
24103
|
-
* @returns {boolean} True if value is a String, otherwise false
|
|
24104
|
-
*/
|
|
24105
|
-
function isString$1(val) {
|
|
24106
|
-
return typeof val === 'string';
|
|
24107
|
-
}
|
|
24108
|
-
|
|
24109
|
-
/**
|
|
24110
|
-
* Determine if a value is a Number
|
|
24111
|
-
*
|
|
24112
|
-
* @param {Object} val The value to test
|
|
24113
|
-
* @returns {boolean} True if value is a Number, otherwise false
|
|
24114
|
-
*/
|
|
24115
|
-
function isNumber(val) {
|
|
24116
|
-
return typeof val === 'number';
|
|
24117
|
-
}
|
|
24118
|
-
|
|
24119
|
-
/**
|
|
24120
|
-
* Determine if a value is an Object
|
|
24121
|
-
*
|
|
24122
|
-
* @param {Object} val The value to test
|
|
24123
|
-
* @returns {boolean} True if value is an Object, otherwise false
|
|
24124
|
-
*/
|
|
24125
|
-
function isObject(val) {
|
|
24126
|
-
return val !== null && typeof val === 'object';
|
|
24127
|
-
}
|
|
24128
|
-
|
|
24129
|
-
/**
|
|
24130
|
-
* Determine if a value is a plain Object
|
|
24131
|
-
*
|
|
24132
|
-
* @param {Object} val The value to test
|
|
24133
|
-
* @return {boolean} True if value is a plain Object, otherwise false
|
|
24134
|
-
*/
|
|
24135
|
-
function isPlainObject(val) {
|
|
24136
|
-
if (toString.call(val) !== '[object Object]') {
|
|
24137
|
-
return false;
|
|
24138
|
-
}
|
|
24139
|
-
|
|
24140
|
-
var prototype = Object.getPrototypeOf(val);
|
|
24141
|
-
return prototype === null || prototype === Object.prototype;
|
|
24142
|
-
}
|
|
24143
|
-
|
|
24144
|
-
/**
|
|
24145
|
-
* Determine if a value is a Date
|
|
24146
|
-
*
|
|
24147
|
-
* @param {Object} val The value to test
|
|
24148
|
-
* @returns {boolean} True if value is a Date, otherwise false
|
|
24149
|
-
*/
|
|
24150
|
-
function isDate(val) {
|
|
24151
|
-
return toString.call(val) === '[object Date]';
|
|
24152
|
-
}
|
|
24153
|
-
|
|
24154
|
-
/**
|
|
24155
|
-
* Determine if a value is a File
|
|
24156
|
-
*
|
|
24157
|
-
* @param {Object} val The value to test
|
|
24158
|
-
* @returns {boolean} True if value is a File, otherwise false
|
|
24159
|
-
*/
|
|
24160
|
-
function isFile(val) {
|
|
24161
|
-
return toString.call(val) === '[object File]';
|
|
24162
|
-
}
|
|
24163
|
-
|
|
24164
|
-
/**
|
|
24165
|
-
* Determine if a value is a Blob
|
|
24166
|
-
*
|
|
24167
|
-
* @param {Object} val The value to test
|
|
24168
|
-
* @returns {boolean} True if value is a Blob, otherwise false
|
|
24169
|
-
*/
|
|
24170
|
-
function isBlob(val) {
|
|
24171
|
-
return toString.call(val) === '[object Blob]';
|
|
24172
|
-
}
|
|
24173
|
-
|
|
24174
|
-
/**
|
|
24175
|
-
* Determine if a value is a Function
|
|
24176
|
-
*
|
|
24177
|
-
* @param {Object} val The value to test
|
|
24178
|
-
* @returns {boolean} True if value is a Function, otherwise false
|
|
24179
|
-
*/
|
|
24180
|
-
function isFunction$1(val) {
|
|
24181
|
-
return toString.call(val) === '[object Function]';
|
|
24182
|
-
}
|
|
24183
|
-
|
|
24184
|
-
/**
|
|
24185
|
-
* Determine if a value is a Stream
|
|
24186
|
-
*
|
|
24187
|
-
* @param {Object} val The value to test
|
|
24188
|
-
* @returns {boolean} True if value is a Stream, otherwise false
|
|
24189
|
-
*/
|
|
24190
|
-
function isStream(val) {
|
|
24191
|
-
return isObject(val) && isFunction$1(val.pipe);
|
|
24192
|
-
}
|
|
24193
|
-
|
|
24194
|
-
/**
|
|
24195
|
-
* Determine if a value is a URLSearchParams object
|
|
24196
|
-
*
|
|
24197
|
-
* @param {Object} val The value to test
|
|
24198
|
-
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
24199
|
-
*/
|
|
24200
|
-
function isURLSearchParams(val) {
|
|
24201
|
-
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
|
24202
|
-
}
|
|
24203
|
-
|
|
24204
|
-
/**
|
|
24205
|
-
* Trim excess whitespace off the beginning and end of a string
|
|
24206
|
-
*
|
|
24207
|
-
* @param {String} str The String to trim
|
|
24208
|
-
* @returns {String} The String freed of excess whitespace
|
|
24209
|
-
*/
|
|
24210
|
-
function trim(str) {
|
|
24211
|
-
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
|
24212
|
-
}
|
|
24213
|
-
|
|
24214
|
-
/**
|
|
24215
|
-
* Determine if we're running in a standard browser environment
|
|
24216
|
-
*
|
|
24217
|
-
* This allows axios to run in a web worker, and react-native.
|
|
24218
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
24219
|
-
*
|
|
24220
|
-
* web workers:
|
|
24221
|
-
* typeof window -> undefined
|
|
24222
|
-
* typeof document -> undefined
|
|
24223
|
-
*
|
|
24224
|
-
* react-native:
|
|
24225
|
-
* navigator.product -> 'ReactNative'
|
|
24226
|
-
* nativescript
|
|
24227
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
24228
|
-
*/
|
|
24229
|
-
function isStandardBrowserEnv() {
|
|
24230
|
-
if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
|
|
24231
|
-
navigator.product === 'NativeScript' ||
|
|
24232
|
-
navigator.product === 'NS')) {
|
|
24233
|
-
return false;
|
|
24234
|
-
}
|
|
24235
|
-
return (
|
|
24236
|
-
typeof window !== 'undefined' &&
|
|
24237
|
-
typeof document !== 'undefined'
|
|
24238
|
-
);
|
|
24239
|
-
}
|
|
24240
|
-
|
|
24241
|
-
/**
|
|
24242
|
-
* Iterate over an Array or an Object invoking a function for each item.
|
|
24243
|
-
*
|
|
24244
|
-
* If `obj` is an Array callback will be called passing
|
|
24245
|
-
* the value, index, and complete array for each item.
|
|
24246
|
-
*
|
|
24247
|
-
* If 'obj' is an Object callback will be called passing
|
|
24248
|
-
* the value, key, and complete object for each property.
|
|
24249
|
-
*
|
|
24250
|
-
* @param {Object|Array} obj The object to iterate
|
|
24251
|
-
* @param {Function} fn The callback to invoke for each item
|
|
24252
|
-
*/
|
|
24253
|
-
function forEach(obj, fn) {
|
|
24254
|
-
// Don't bother if no value provided
|
|
24255
|
-
if (obj === null || typeof obj === 'undefined') {
|
|
24256
|
-
return;
|
|
24257
|
-
}
|
|
24258
|
-
|
|
24259
|
-
// Force an array if not already something iterable
|
|
24260
|
-
if (typeof obj !== 'object') {
|
|
24261
|
-
/*eslint no-param-reassign:0*/
|
|
24262
|
-
obj = [obj];
|
|
24263
|
-
}
|
|
24264
|
-
|
|
24265
|
-
if (isArray(obj)) {
|
|
24266
|
-
// Iterate over array values
|
|
24267
|
-
for (var i = 0, l = obj.length; i < l; i++) {
|
|
24268
|
-
fn.call(null, obj[i], i, obj);
|
|
24269
|
-
}
|
|
24270
|
-
} else {
|
|
24271
|
-
// Iterate over object keys
|
|
24272
|
-
for (var key in obj) {
|
|
24273
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
24274
|
-
fn.call(null, obj[key], key, obj);
|
|
24275
|
-
}
|
|
24276
|
-
}
|
|
24277
|
-
}
|
|
24278
|
-
}
|
|
24279
|
-
|
|
24280
|
-
/**
|
|
24281
|
-
* Accepts varargs expecting each argument to be an object, then
|
|
24282
|
-
* immutably merges the properties of each object and returns result.
|
|
24283
|
-
*
|
|
24284
|
-
* When multiple objects contain the same key the later object in
|
|
24285
|
-
* the arguments list will take precedence.
|
|
24286
|
-
*
|
|
24287
|
-
* Example:
|
|
24288
|
-
*
|
|
24289
|
-
* ```js
|
|
24290
|
-
* var result = merge({foo: 123}, {foo: 456});
|
|
24291
|
-
* console.log(result.foo); // outputs 456
|
|
24292
|
-
* ```
|
|
24293
|
-
*
|
|
24294
|
-
* @param {Object} obj1 Object to merge
|
|
24295
|
-
* @returns {Object} Result of all merge properties
|
|
24296
|
-
*/
|
|
24297
|
-
function merge(/* obj1, obj2, obj3, ... */) {
|
|
24298
|
-
var result = {};
|
|
24299
|
-
function assignValue(val, key) {
|
|
24300
|
-
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
|
24301
|
-
result[key] = merge(result[key], val);
|
|
24302
|
-
} else if (isPlainObject(val)) {
|
|
24303
|
-
result[key] = merge({}, val);
|
|
24304
|
-
} else if (isArray(val)) {
|
|
24305
|
-
result[key] = val.slice();
|
|
24306
|
-
} else {
|
|
24307
|
-
result[key] = val;
|
|
24308
|
-
}
|
|
24309
|
-
}
|
|
24310
|
-
|
|
24311
|
-
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
24312
|
-
forEach(arguments[i], assignValue);
|
|
24313
|
-
}
|
|
24314
|
-
return result;
|
|
24315
|
-
}
|
|
24316
|
-
|
|
24317
|
-
/**
|
|
24318
|
-
* Extends object a by mutably adding to it the properties of object b.
|
|
24319
|
-
*
|
|
24320
|
-
* @param {Object} a The object to be extended
|
|
24321
|
-
* @param {Object} b The object to copy properties from
|
|
24322
|
-
* @param {Object} thisArg The object to bind function to
|
|
24323
|
-
* @return {Object} The resulting value of object a
|
|
24324
|
-
*/
|
|
24325
|
-
function extend(a, b, thisArg) {
|
|
24326
|
-
forEach(b, function assignValue(val, key) {
|
|
24327
|
-
if (thisArg && typeof val === 'function') {
|
|
24328
|
-
a[key] = bind(val, thisArg);
|
|
24329
|
-
} else {
|
|
24330
|
-
a[key] = val;
|
|
24331
|
-
}
|
|
24332
|
-
});
|
|
24333
|
-
return a;
|
|
24334
|
-
}
|
|
24335
|
-
|
|
24336
|
-
/**
|
|
24337
|
-
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
24338
|
-
*
|
|
24339
|
-
* @param {string} content with BOM
|
|
24340
|
-
* @return {string} content value without BOM
|
|
24341
|
-
*/
|
|
24342
|
-
function stripBOM(content) {
|
|
24343
|
-
if (content.charCodeAt(0) === 0xFEFF) {
|
|
24344
|
-
content = content.slice(1);
|
|
24345
|
-
}
|
|
24346
|
-
return content;
|
|
24347
|
-
}
|
|
24348
|
-
|
|
24349
|
-
var utils = {
|
|
24350
|
-
isArray: isArray,
|
|
24351
|
-
isArrayBuffer: isArrayBuffer,
|
|
24352
|
-
isBuffer: isBuffer$1,
|
|
24353
|
-
isFormData: isFormData,
|
|
24354
|
-
isArrayBufferView: isArrayBufferView,
|
|
24355
|
-
isString: isString$1,
|
|
24356
|
-
isNumber: isNumber,
|
|
24357
|
-
isObject: isObject,
|
|
24358
|
-
isPlainObject: isPlainObject,
|
|
24359
|
-
isUndefined: isUndefined,
|
|
24360
|
-
isDate: isDate,
|
|
24361
|
-
isFile: isFile,
|
|
24362
|
-
isBlob: isBlob,
|
|
24363
|
-
isFunction: isFunction$1,
|
|
24364
|
-
isStream: isStream,
|
|
24365
|
-
isURLSearchParams: isURLSearchParams,
|
|
24366
|
-
isStandardBrowserEnv: isStandardBrowserEnv,
|
|
24367
|
-
forEach: forEach,
|
|
24368
|
-
merge: merge,
|
|
24369
|
-
extend: extend,
|
|
24370
|
-
trim: trim,
|
|
24371
|
-
stripBOM: stripBOM
|
|
24372
|
-
};
|
|
24373
|
-
|
|
24374
|
-
function encode(val) {
|
|
24375
|
-
return encodeURIComponent(val).
|
|
24376
|
-
replace(/%3A/gi, ':').
|
|
24377
|
-
replace(/%24/g, '$').
|
|
24378
|
-
replace(/%2C/gi, ',').
|
|
24379
|
-
replace(/%20/g, '+').
|
|
24380
|
-
replace(/%5B/gi, '[').
|
|
24381
|
-
replace(/%5D/gi, ']');
|
|
24382
|
-
}
|
|
24383
|
-
|
|
24384
|
-
/**
|
|
24385
|
-
* Build a URL by appending params to the end
|
|
24386
|
-
*
|
|
24387
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
24388
|
-
* @param {object} [params] The params to be appended
|
|
24389
|
-
* @returns {string} The formatted url
|
|
24390
|
-
*/
|
|
24391
|
-
var buildURL = function buildURL(url, params, paramsSerializer) {
|
|
24392
|
-
/*eslint no-param-reassign:0*/
|
|
24393
|
-
if (!params) {
|
|
24394
|
-
return url;
|
|
24395
|
-
}
|
|
24396
|
-
|
|
24397
|
-
var serializedParams;
|
|
24398
|
-
if (paramsSerializer) {
|
|
24399
|
-
serializedParams = paramsSerializer(params);
|
|
24400
|
-
} else if (utils.isURLSearchParams(params)) {
|
|
24401
|
-
serializedParams = params.toString();
|
|
24402
|
-
} else {
|
|
24403
|
-
var parts = [];
|
|
24404
|
-
|
|
24405
|
-
utils.forEach(params, function serialize(val, key) {
|
|
24406
|
-
if (val === null || typeof val === 'undefined') {
|
|
24407
|
-
return;
|
|
24408
|
-
}
|
|
24409
|
-
|
|
24410
|
-
if (utils.isArray(val)) {
|
|
24411
|
-
key = key + '[]';
|
|
24412
|
-
} else {
|
|
24413
|
-
val = [val];
|
|
24414
|
-
}
|
|
24415
|
-
|
|
24416
|
-
utils.forEach(val, function parseValue(v) {
|
|
24417
|
-
if (utils.isDate(v)) {
|
|
24418
|
-
v = v.toISOString();
|
|
24419
|
-
} else if (utils.isObject(v)) {
|
|
24420
|
-
v = JSON.stringify(v);
|
|
24421
|
-
}
|
|
24422
|
-
parts.push(encode(key) + '=' + encode(v));
|
|
24423
|
-
});
|
|
24424
|
-
});
|
|
24425
|
-
|
|
24426
|
-
serializedParams = parts.join('&');
|
|
24427
|
-
}
|
|
24428
|
-
|
|
24429
|
-
if (serializedParams) {
|
|
24430
|
-
var hashmarkIndex = url.indexOf('#');
|
|
24431
|
-
if (hashmarkIndex !== -1) {
|
|
24432
|
-
url = url.slice(0, hashmarkIndex);
|
|
24433
|
-
}
|
|
24434
|
-
|
|
24435
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
24436
|
-
}
|
|
24437
|
-
|
|
24438
|
-
return url;
|
|
24439
|
-
};
|
|
24440
|
-
|
|
24441
|
-
function InterceptorManager() {
|
|
24442
|
-
this.handlers = [];
|
|
24443
|
-
}
|
|
24444
|
-
|
|
24445
|
-
/**
|
|
24446
|
-
* Add a new interceptor to the stack
|
|
24447
|
-
*
|
|
24448
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
24449
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
24450
|
-
*
|
|
24451
|
-
* @return {Number} An ID used to remove interceptor later
|
|
24452
|
-
*/
|
|
24453
|
-
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
|
24454
|
-
this.handlers.push({
|
|
24455
|
-
fulfilled: fulfilled,
|
|
24456
|
-
rejected: rejected
|
|
24457
|
-
});
|
|
24458
|
-
return this.handlers.length - 1;
|
|
24459
|
-
};
|
|
24460
|
-
|
|
24461
|
-
/**
|
|
24462
|
-
* Remove an interceptor from the stack
|
|
24463
|
-
*
|
|
24464
|
-
* @param {Number} id The ID that was returned by `use`
|
|
24465
|
-
*/
|
|
24466
|
-
InterceptorManager.prototype.eject = function eject(id) {
|
|
24467
|
-
if (this.handlers[id]) {
|
|
24468
|
-
this.handlers[id] = null;
|
|
24469
|
-
}
|
|
24470
|
-
};
|
|
24471
|
-
|
|
24472
|
-
/**
|
|
24473
|
-
* Iterate over all the registered interceptors
|
|
24474
|
-
*
|
|
24475
|
-
* This method is particularly useful for skipping over any
|
|
24476
|
-
* interceptors that may have become `null` calling `eject`.
|
|
24477
|
-
*
|
|
24478
|
-
* @param {Function} fn The function to call for each interceptor
|
|
24479
|
-
*/
|
|
24480
|
-
InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
24481
|
-
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
24482
|
-
if (h !== null) {
|
|
24483
|
-
fn(h);
|
|
24484
|
-
}
|
|
24485
|
-
});
|
|
24486
|
-
};
|
|
24487
|
-
|
|
24488
|
-
var InterceptorManager_1 = InterceptorManager;
|
|
24489
|
-
|
|
24490
|
-
/**
|
|
24491
|
-
* Transform the data for a request or a response
|
|
24492
|
-
*
|
|
24493
|
-
* @param {Object|String} data The data to be transformed
|
|
24494
|
-
* @param {Array} headers The headers for the request or response
|
|
24495
|
-
* @param {Array|Function} fns A single function or Array of functions
|
|
24496
|
-
* @returns {*} The resulting transformed data
|
|
24497
|
-
*/
|
|
24498
|
-
var transformData = function transformData(data, headers, fns) {
|
|
24499
|
-
/*eslint no-param-reassign:0*/
|
|
24500
|
-
utils.forEach(fns, function transform(fn) {
|
|
24501
|
-
data = fn(data, headers);
|
|
24502
|
-
});
|
|
24503
|
-
|
|
24504
|
-
return data;
|
|
24505
|
-
};
|
|
24506
|
-
|
|
24507
|
-
var isCancel = function isCancel(value) {
|
|
24508
|
-
return !!(value && value.__CANCEL__);
|
|
24509
|
-
};
|
|
24510
|
-
|
|
24511
|
-
var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
|
|
24512
|
-
utils.forEach(headers, function processHeader(value, name) {
|
|
24513
|
-
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
24514
|
-
headers[normalizedName] = value;
|
|
24515
|
-
delete headers[name];
|
|
24516
|
-
}
|
|
24517
|
-
});
|
|
24518
|
-
};
|
|
24519
|
-
|
|
24520
|
-
/**
|
|
24521
|
-
* Update an Error with the specified config, error code, and response.
|
|
24522
|
-
*
|
|
24523
|
-
* @param {Error} error The error to update.
|
|
24524
|
-
* @param {Object} config The config.
|
|
24525
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
24526
|
-
* @param {Object} [request] The request.
|
|
24527
|
-
* @param {Object} [response] The response.
|
|
24528
|
-
* @returns {Error} The error.
|
|
24529
|
-
*/
|
|
24530
|
-
var enhanceError = function enhanceError(error, config, code, request, response) {
|
|
24531
|
-
error.config = config;
|
|
24532
|
-
if (code) {
|
|
24533
|
-
error.code = code;
|
|
24534
|
-
}
|
|
24535
|
-
|
|
24536
|
-
error.request = request;
|
|
24537
|
-
error.response = response;
|
|
24538
|
-
error.isAxiosError = true;
|
|
24539
|
-
|
|
24540
|
-
error.toJSON = function toJSON() {
|
|
24541
|
-
return {
|
|
24542
|
-
// Standard
|
|
24543
|
-
message: this.message,
|
|
24544
|
-
name: this.name,
|
|
24545
|
-
// Microsoft
|
|
24546
|
-
description: this.description,
|
|
24547
|
-
number: this.number,
|
|
24548
|
-
// Mozilla
|
|
24549
|
-
fileName: this.fileName,
|
|
24550
|
-
lineNumber: this.lineNumber,
|
|
24551
|
-
columnNumber: this.columnNumber,
|
|
24552
|
-
stack: this.stack,
|
|
24553
|
-
// Axios
|
|
24554
|
-
config: this.config,
|
|
24555
|
-
code: this.code
|
|
24556
|
-
};
|
|
24557
|
-
};
|
|
24558
|
-
return error;
|
|
24559
|
-
};
|
|
24560
|
-
|
|
24561
|
-
/**
|
|
24562
|
-
* Create an Error with the specified message, config, error code, request and response.
|
|
24563
|
-
*
|
|
24564
|
-
* @param {string} message The error message.
|
|
24565
|
-
* @param {Object} config The config.
|
|
24566
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
24567
|
-
* @param {Object} [request] The request.
|
|
24568
|
-
* @param {Object} [response] The response.
|
|
24569
|
-
* @returns {Error} The created error.
|
|
24570
|
-
*/
|
|
24571
|
-
var createError = function createError(message, config, code, request, response) {
|
|
24572
|
-
var error = new Error(message);
|
|
24573
|
-
return enhanceError(error, config, code, request, response);
|
|
24574
|
-
};
|
|
24575
|
-
|
|
24576
|
-
/**
|
|
24577
|
-
* Resolve or reject a Promise based on response status.
|
|
24578
|
-
*
|
|
24579
|
-
* @param {Function} resolve A function that resolves the promise.
|
|
24580
|
-
* @param {Function} reject A function that rejects the promise.
|
|
24581
|
-
* @param {object} response The response.
|
|
24582
|
-
*/
|
|
24583
|
-
var settle = function settle(resolve, reject, response) {
|
|
24584
|
-
var validateStatus = response.config.validateStatus;
|
|
24585
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
24586
|
-
resolve(response);
|
|
24587
|
-
} else {
|
|
24588
|
-
reject(createError(
|
|
24589
|
-
'Request failed with status code ' + response.status,
|
|
24590
|
-
response.config,
|
|
24591
|
-
null,
|
|
24592
|
-
response.request,
|
|
24593
|
-
response
|
|
24594
|
-
));
|
|
24595
|
-
}
|
|
24596
|
-
};
|
|
24597
|
-
|
|
24598
|
-
var cookies = (
|
|
24599
|
-
utils.isStandardBrowserEnv() ?
|
|
24600
|
-
|
|
24601
|
-
// Standard browser envs support document.cookie
|
|
24602
|
-
(function standardBrowserEnv() {
|
|
24603
|
-
return {
|
|
24604
|
-
write: function write(name, value, expires, path, domain, secure) {
|
|
24605
|
-
var cookie = [];
|
|
24606
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
|
24607
|
-
|
|
24608
|
-
if (utils.isNumber(expires)) {
|
|
24609
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
24610
|
-
}
|
|
24611
|
-
|
|
24612
|
-
if (utils.isString(path)) {
|
|
24613
|
-
cookie.push('path=' + path);
|
|
24614
|
-
}
|
|
24615
|
-
|
|
24616
|
-
if (utils.isString(domain)) {
|
|
24617
|
-
cookie.push('domain=' + domain);
|
|
24618
|
-
}
|
|
24619
|
-
|
|
24620
|
-
if (secure === true) {
|
|
24621
|
-
cookie.push('secure');
|
|
24622
|
-
}
|
|
24623
|
-
|
|
24624
|
-
document.cookie = cookie.join('; ');
|
|
24625
|
-
},
|
|
24626
|
-
|
|
24627
|
-
read: function read(name) {
|
|
24628
|
-
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
24629
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
24630
|
-
},
|
|
24631
|
-
|
|
24632
|
-
remove: function remove(name) {
|
|
24633
|
-
this.write(name, '', Date.now() - 86400000);
|
|
24634
|
-
}
|
|
24635
|
-
};
|
|
24636
|
-
})() :
|
|
24637
|
-
|
|
24638
|
-
// Non standard browser env (web workers, react-native) lack needed support.
|
|
24639
|
-
(function nonStandardBrowserEnv() {
|
|
24640
|
-
return {
|
|
24641
|
-
write: function write() {},
|
|
24642
|
-
read: function read() { return null; },
|
|
24643
|
-
remove: function remove() {}
|
|
24644
|
-
};
|
|
24645
|
-
})()
|
|
24646
|
-
);
|
|
24647
|
-
|
|
24648
|
-
/**
|
|
24649
|
-
* Determines whether the specified URL is absolute
|
|
24650
|
-
*
|
|
24651
|
-
* @param {string} url The URL to test
|
|
24652
|
-
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
24653
|
-
*/
|
|
24654
|
-
var isAbsoluteURL = function isAbsoluteURL(url) {
|
|
24655
|
-
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
24656
|
-
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
24657
|
-
// by any combination of letters, digits, plus, period, or hyphen.
|
|
24658
|
-
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
24659
|
-
};
|
|
24660
|
-
|
|
24661
|
-
/**
|
|
24662
|
-
* Creates a new URL by combining the specified URLs
|
|
24663
|
-
*
|
|
24664
|
-
* @param {string} baseURL The base URL
|
|
24665
|
-
* @param {string} relativeURL The relative URL
|
|
24666
|
-
* @returns {string} The combined URL
|
|
24667
|
-
*/
|
|
24668
|
-
var combineURLs = function combineURLs(baseURL, relativeURL) {
|
|
24669
|
-
return relativeURL
|
|
24670
|
-
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
24671
|
-
: baseURL;
|
|
24672
|
-
};
|
|
24673
|
-
|
|
24674
|
-
/**
|
|
24675
|
-
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
24676
|
-
* only when the requestedURL is not already an absolute URL.
|
|
24677
|
-
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
24678
|
-
*
|
|
24679
|
-
* @param {string} baseURL The base URL
|
|
24680
|
-
* @param {string} requestedURL Absolute or relative URL to combine
|
|
24681
|
-
* @returns {string} The combined full path
|
|
24682
|
-
*/
|
|
24683
|
-
var buildFullPath = function buildFullPath(baseURL, requestedURL) {
|
|
24684
|
-
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
24685
|
-
return combineURLs(baseURL, requestedURL);
|
|
24686
|
-
}
|
|
24687
|
-
return requestedURL;
|
|
24688
|
-
};
|
|
24689
|
-
|
|
24690
|
-
// Headers whose duplicates are ignored by node
|
|
24691
|
-
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
24692
|
-
var ignoreDuplicateOf = [
|
|
24693
|
-
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
24694
|
-
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
24695
|
-
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
24696
|
-
'referer', 'retry-after', 'user-agent'
|
|
24697
|
-
];
|
|
24698
|
-
|
|
24699
|
-
/**
|
|
24700
|
-
* Parse headers into an object
|
|
24701
|
-
*
|
|
24702
|
-
* ```
|
|
24703
|
-
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
24704
|
-
* Content-Type: application/json
|
|
24705
|
-
* Connection: keep-alive
|
|
24706
|
-
* Transfer-Encoding: chunked
|
|
24707
|
-
* ```
|
|
24708
|
-
*
|
|
24709
|
-
* @param {String} headers Headers needing to be parsed
|
|
24710
|
-
* @returns {Object} Headers parsed into an object
|
|
24711
|
-
*/
|
|
24712
|
-
var parseHeaders = function parseHeaders(headers) {
|
|
24713
|
-
var parsed = {};
|
|
24714
|
-
var key;
|
|
24715
|
-
var val;
|
|
24716
|
-
var i;
|
|
24717
|
-
|
|
24718
|
-
if (!headers) { return parsed; }
|
|
24719
|
-
|
|
24720
|
-
utils.forEach(headers.split('\n'), function parser(line) {
|
|
24721
|
-
i = line.indexOf(':');
|
|
24722
|
-
key = utils.trim(line.substr(0, i)).toLowerCase();
|
|
24723
|
-
val = utils.trim(line.substr(i + 1));
|
|
24724
|
-
|
|
24725
|
-
if (key) {
|
|
24726
|
-
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
|
24727
|
-
return;
|
|
24728
|
-
}
|
|
24729
|
-
if (key === 'set-cookie') {
|
|
24730
|
-
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
24731
|
-
} else {
|
|
24732
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
24733
|
-
}
|
|
24734
|
-
}
|
|
24735
|
-
});
|
|
24736
|
-
|
|
24737
|
-
return parsed;
|
|
24738
|
-
};
|
|
24739
|
-
|
|
24740
|
-
var isURLSameOrigin = (
|
|
24741
|
-
utils.isStandardBrowserEnv() ?
|
|
24742
|
-
|
|
24743
|
-
// Standard browser envs have full support of the APIs needed to test
|
|
24744
|
-
// whether the request URL is of the same origin as current location.
|
|
24745
|
-
(function standardBrowserEnv() {
|
|
24746
|
-
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
24747
|
-
var urlParsingNode = document.createElement('a');
|
|
24748
|
-
var originURL;
|
|
24749
|
-
|
|
24750
|
-
/**
|
|
24751
|
-
* Parse a URL to discover it's components
|
|
24752
|
-
*
|
|
24753
|
-
* @param {String} url The URL to be parsed
|
|
24754
|
-
* @returns {Object}
|
|
24755
|
-
*/
|
|
24756
|
-
function resolveURL(url) {
|
|
24757
|
-
var href = url;
|
|
24758
|
-
|
|
24759
|
-
if (msie) {
|
|
24760
|
-
// IE needs attribute set twice to normalize properties
|
|
24761
|
-
urlParsingNode.setAttribute('href', href);
|
|
24762
|
-
href = urlParsingNode.href;
|
|
24763
|
-
}
|
|
24764
|
-
|
|
24765
|
-
urlParsingNode.setAttribute('href', href);
|
|
24766
|
-
|
|
24767
|
-
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
24768
|
-
return {
|
|
24769
|
-
href: urlParsingNode.href,
|
|
24770
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
24771
|
-
host: urlParsingNode.host,
|
|
24772
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
24773
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
24774
|
-
hostname: urlParsingNode.hostname,
|
|
24775
|
-
port: urlParsingNode.port,
|
|
24776
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
24777
|
-
urlParsingNode.pathname :
|
|
24778
|
-
'/' + urlParsingNode.pathname
|
|
24779
|
-
};
|
|
24780
|
-
}
|
|
24781
|
-
|
|
24782
|
-
originURL = resolveURL(window.location.href);
|
|
24783
|
-
|
|
24784
|
-
/**
|
|
24785
|
-
* Determine if a URL shares the same origin as the current location
|
|
24786
|
-
*
|
|
24787
|
-
* @param {String} requestURL The URL to test
|
|
24788
|
-
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
24789
|
-
*/
|
|
24790
|
-
return function isURLSameOrigin(requestURL) {
|
|
24791
|
-
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
24792
|
-
return (parsed.protocol === originURL.protocol &&
|
|
24793
|
-
parsed.host === originURL.host);
|
|
24794
|
-
};
|
|
24795
|
-
})() :
|
|
24796
|
-
|
|
24797
|
-
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
24798
|
-
(function nonStandardBrowserEnv() {
|
|
24799
|
-
return function isURLSameOrigin() {
|
|
24800
|
-
return true;
|
|
24801
|
-
};
|
|
24802
|
-
})()
|
|
24803
|
-
);
|
|
24804
|
-
|
|
24805
|
-
var xhr = function xhrAdapter(config) {
|
|
24806
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
24807
|
-
var requestData = config.data;
|
|
24808
|
-
var requestHeaders = config.headers;
|
|
24809
|
-
|
|
24810
|
-
if (utils.isFormData(requestData)) {
|
|
24811
|
-
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
24812
|
-
}
|
|
24813
|
-
|
|
24814
|
-
var request = new XMLHttpRequest();
|
|
24815
|
-
|
|
24816
|
-
// HTTP basic authentication
|
|
24817
|
-
if (config.auth) {
|
|
24818
|
-
var username = config.auth.username || '';
|
|
24819
|
-
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
24820
|
-
requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
|
|
24821
|
-
}
|
|
24822
|
-
|
|
24823
|
-
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
24824
|
-
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
24825
|
-
|
|
24826
|
-
// Set the request timeout in MS
|
|
24827
|
-
request.timeout = config.timeout;
|
|
24828
|
-
|
|
24829
|
-
// Listen for ready state
|
|
24830
|
-
request.onreadystatechange = function handleLoad() {
|
|
24831
|
-
if (!request || request.readyState !== 4) {
|
|
24832
|
-
return;
|
|
24833
|
-
}
|
|
24834
|
-
|
|
24835
|
-
// The request errored out and we didn't get a response, this will be
|
|
24836
|
-
// handled by onerror instead
|
|
24837
|
-
// With one exception: request that using file: protocol, most browsers
|
|
24838
|
-
// will return status as 0 even though it's a successful request
|
|
24839
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
24840
|
-
return;
|
|
24841
|
-
}
|
|
24842
|
-
|
|
24843
|
-
// Prepare the response
|
|
24844
|
-
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
|
24845
|
-
var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
|
|
24846
|
-
var response = {
|
|
24847
|
-
data: responseData,
|
|
24848
|
-
status: request.status,
|
|
24849
|
-
statusText: request.statusText,
|
|
24850
|
-
headers: responseHeaders,
|
|
24851
|
-
config: config,
|
|
24852
|
-
request: request
|
|
24853
|
-
};
|
|
24854
|
-
|
|
24855
|
-
settle(resolve, reject, response);
|
|
24856
|
-
|
|
24857
|
-
// Clean up request
|
|
24858
|
-
request = null;
|
|
24859
|
-
};
|
|
24860
|
-
|
|
24861
|
-
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
24862
|
-
request.onabort = function handleAbort() {
|
|
24863
|
-
if (!request) {
|
|
24864
|
-
return;
|
|
24865
|
-
}
|
|
24866
|
-
|
|
24867
|
-
reject(createError('Request aborted', config, 'ECONNABORTED', request));
|
|
24868
|
-
|
|
24869
|
-
// Clean up request
|
|
24870
|
-
request = null;
|
|
24871
|
-
};
|
|
24872
|
-
|
|
24873
|
-
// Handle low level network errors
|
|
24874
|
-
request.onerror = function handleError() {
|
|
24875
|
-
// Real errors are hidden from us by the browser
|
|
24876
|
-
// onerror should only fire if it's a network error
|
|
24877
|
-
reject(createError('Network Error', config, null, request));
|
|
24878
|
-
|
|
24879
|
-
// Clean up request
|
|
24880
|
-
request = null;
|
|
24881
|
-
};
|
|
24882
|
-
|
|
24883
|
-
// Handle timeout
|
|
24884
|
-
request.ontimeout = function handleTimeout() {
|
|
24885
|
-
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
|
24886
|
-
if (config.timeoutErrorMessage) {
|
|
24887
|
-
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
24888
|
-
}
|
|
24889
|
-
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
|
|
24890
|
-
request));
|
|
24891
|
-
|
|
24892
|
-
// Clean up request
|
|
24893
|
-
request = null;
|
|
24894
|
-
};
|
|
24895
|
-
|
|
24896
|
-
// Add xsrf header
|
|
24897
|
-
// This is only done if running in a standard browser environment.
|
|
24898
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
24899
|
-
if (utils.isStandardBrowserEnv()) {
|
|
24900
|
-
// Add xsrf header
|
|
24901
|
-
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
|
24902
|
-
cookies.read(config.xsrfCookieName) :
|
|
24903
|
-
undefined;
|
|
24904
|
-
|
|
24905
|
-
if (xsrfValue) {
|
|
24906
|
-
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
|
24907
|
-
}
|
|
24908
|
-
}
|
|
24909
|
-
|
|
24910
|
-
// Add headers to the request
|
|
24911
|
-
if ('setRequestHeader' in request) {
|
|
24912
|
-
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
24913
|
-
if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
|
|
24914
|
-
// Remove Content-Type if data is undefined
|
|
24915
|
-
delete requestHeaders[key];
|
|
24916
|
-
} else {
|
|
24917
|
-
// Otherwise add header to the request
|
|
24918
|
-
request.setRequestHeader(key, val);
|
|
24919
|
-
}
|
|
24920
|
-
});
|
|
24921
|
-
}
|
|
24922
|
-
|
|
24923
|
-
// Add withCredentials to request if needed
|
|
24924
|
-
if (!utils.isUndefined(config.withCredentials)) {
|
|
24925
|
-
request.withCredentials = !!config.withCredentials;
|
|
24926
|
-
}
|
|
24927
|
-
|
|
24928
|
-
// Add responseType to request if needed
|
|
24929
|
-
if (config.responseType) {
|
|
24930
|
-
try {
|
|
24931
|
-
request.responseType = config.responseType;
|
|
24932
|
-
} catch (e) {
|
|
24933
|
-
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
|
|
24934
|
-
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
|
|
24935
|
-
if (config.responseType !== 'json') {
|
|
24936
|
-
throw e;
|
|
24937
|
-
}
|
|
24938
|
-
}
|
|
24939
|
-
}
|
|
24940
|
-
|
|
24941
|
-
// Handle progress if needed
|
|
24942
|
-
if (typeof config.onDownloadProgress === 'function') {
|
|
24943
|
-
request.addEventListener('progress', config.onDownloadProgress);
|
|
24944
|
-
}
|
|
24945
|
-
|
|
24946
|
-
// Not all browsers support upload events
|
|
24947
|
-
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
24948
|
-
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
24949
|
-
}
|
|
24950
|
-
|
|
24951
|
-
if (config.cancelToken) {
|
|
24952
|
-
// Handle cancellation
|
|
24953
|
-
config.cancelToken.promise.then(function onCanceled(cancel) {
|
|
24954
|
-
if (!request) {
|
|
24955
|
-
return;
|
|
24956
|
-
}
|
|
24957
|
-
|
|
24958
|
-
request.abort();
|
|
24959
|
-
reject(cancel);
|
|
24960
|
-
// Clean up request
|
|
24961
|
-
request = null;
|
|
24962
|
-
});
|
|
24963
|
-
}
|
|
24964
|
-
|
|
24965
|
-
if (!requestData) {
|
|
24966
|
-
requestData = null;
|
|
24967
|
-
}
|
|
24968
|
-
|
|
24969
|
-
// Send the request
|
|
24970
|
-
request.send(requestData);
|
|
24971
|
-
});
|
|
24972
|
-
};
|
|
24973
|
-
|
|
24974
|
-
/**
|
|
24975
|
-
* Helpers.
|
|
24976
|
-
*/
|
|
24977
|
-
|
|
24978
|
-
var s = 1000;
|
|
24979
|
-
var m = s * 60;
|
|
24980
|
-
var h = m * 60;
|
|
24981
|
-
var d = h * 24;
|
|
24982
|
-
var w = d * 7;
|
|
24983
|
-
var y = d * 365.25;
|
|
24984
|
-
|
|
24985
|
-
/**
|
|
24986
|
-
* Parse or format the given `val`.
|
|
24987
|
-
*
|
|
24988
|
-
* Options:
|
|
24989
|
-
*
|
|
24990
|
-
* - `long` verbose formatting [false]
|
|
24991
|
-
*
|
|
24992
|
-
* @param {String|Number} val
|
|
24993
|
-
* @param {Object} [options]
|
|
24994
|
-
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
24995
|
-
* @return {String|Number}
|
|
24996
|
-
* @api public
|
|
24997
|
-
*/
|
|
24998
|
-
|
|
24999
|
-
var ms = function(val, options) {
|
|
25000
|
-
options = options || {};
|
|
25001
|
-
var type = typeof val;
|
|
25002
|
-
if (type === 'string' && val.length > 0) {
|
|
25003
|
-
return parse(val);
|
|
25004
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
25005
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
25006
|
-
}
|
|
25007
|
-
throw new Error(
|
|
25008
|
-
'val is not a non-empty string or a valid number. val=' +
|
|
25009
|
-
JSON.stringify(val)
|
|
25010
|
-
);
|
|
25011
|
-
};
|
|
25012
|
-
|
|
25013
|
-
/**
|
|
25014
|
-
* Parse the given `str` and return milliseconds.
|
|
25015
|
-
*
|
|
25016
|
-
* @param {String} str
|
|
25017
|
-
* @return {Number}
|
|
25018
|
-
* @api private
|
|
25019
|
-
*/
|
|
25020
|
-
|
|
25021
|
-
function parse(str) {
|
|
25022
|
-
str = String(str);
|
|
25023
|
-
if (str.length > 100) {
|
|
25024
|
-
return;
|
|
25025
|
-
}
|
|
25026
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
25027
|
-
str
|
|
25028
|
-
);
|
|
25029
|
-
if (!match) {
|
|
25030
|
-
return;
|
|
25031
|
-
}
|
|
25032
|
-
var n = parseFloat(match[1]);
|
|
25033
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
25034
|
-
switch (type) {
|
|
25035
|
-
case 'years':
|
|
25036
|
-
case 'year':
|
|
25037
|
-
case 'yrs':
|
|
25038
|
-
case 'yr':
|
|
25039
|
-
case 'y':
|
|
25040
|
-
return n * y;
|
|
25041
|
-
case 'weeks':
|
|
25042
|
-
case 'week':
|
|
25043
|
-
case 'w':
|
|
25044
|
-
return n * w;
|
|
25045
|
-
case 'days':
|
|
25046
|
-
case 'day':
|
|
25047
|
-
case 'd':
|
|
25048
|
-
return n * d;
|
|
25049
|
-
case 'hours':
|
|
25050
|
-
case 'hour':
|
|
25051
|
-
case 'hrs':
|
|
25052
|
-
case 'hr':
|
|
25053
|
-
case 'h':
|
|
25054
|
-
return n * h;
|
|
25055
|
-
case 'minutes':
|
|
25056
|
-
case 'minute':
|
|
25057
|
-
case 'mins':
|
|
25058
|
-
case 'min':
|
|
25059
|
-
case 'm':
|
|
25060
|
-
return n * m;
|
|
25061
|
-
case 'seconds':
|
|
25062
|
-
case 'second':
|
|
25063
|
-
case 'secs':
|
|
25064
|
-
case 'sec':
|
|
25065
|
-
case 's':
|
|
25066
|
-
return n * s;
|
|
25067
|
-
case 'milliseconds':
|
|
25068
|
-
case 'millisecond':
|
|
25069
|
-
case 'msecs':
|
|
25070
|
-
case 'msec':
|
|
25071
|
-
case 'ms':
|
|
25072
|
-
return n;
|
|
25073
|
-
default:
|
|
25074
|
-
return undefined;
|
|
25075
|
-
}
|
|
25076
|
-
}
|
|
25077
|
-
|
|
25078
|
-
/**
|
|
25079
|
-
* Short format for `ms`.
|
|
25080
|
-
*
|
|
25081
|
-
* @param {Number} ms
|
|
25082
|
-
* @return {String}
|
|
25083
|
-
* @api private
|
|
25084
|
-
*/
|
|
25085
|
-
|
|
25086
|
-
function fmtShort(ms) {
|
|
25087
|
-
var msAbs = Math.abs(ms);
|
|
25088
|
-
if (msAbs >= d) {
|
|
25089
|
-
return Math.round(ms / d) + 'd';
|
|
25090
|
-
}
|
|
25091
|
-
if (msAbs >= h) {
|
|
25092
|
-
return Math.round(ms / h) + 'h';
|
|
25093
|
-
}
|
|
25094
|
-
if (msAbs >= m) {
|
|
25095
|
-
return Math.round(ms / m) + 'm';
|
|
25096
|
-
}
|
|
25097
|
-
if (msAbs >= s) {
|
|
25098
|
-
return Math.round(ms / s) + 's';
|
|
25099
|
-
}
|
|
25100
|
-
return ms + 'ms';
|
|
25101
|
-
}
|
|
25102
|
-
|
|
25103
|
-
/**
|
|
25104
|
-
* Long format for `ms`.
|
|
25105
|
-
*
|
|
25106
|
-
* @param {Number} ms
|
|
25107
|
-
* @return {String}
|
|
25108
|
-
* @api private
|
|
25109
|
-
*/
|
|
25110
|
-
|
|
25111
|
-
function fmtLong(ms) {
|
|
25112
|
-
var msAbs = Math.abs(ms);
|
|
25113
|
-
if (msAbs >= d) {
|
|
25114
|
-
return plural(ms, msAbs, d, 'day');
|
|
25115
|
-
}
|
|
25116
|
-
if (msAbs >= h) {
|
|
25117
|
-
return plural(ms, msAbs, h, 'hour');
|
|
25118
|
-
}
|
|
25119
|
-
if (msAbs >= m) {
|
|
25120
|
-
return plural(ms, msAbs, m, 'minute');
|
|
25121
|
-
}
|
|
25122
|
-
if (msAbs >= s) {
|
|
25123
|
-
return plural(ms, msAbs, s, 'second');
|
|
25124
|
-
}
|
|
25125
|
-
return ms + ' ms';
|
|
25126
|
-
}
|
|
25127
|
-
|
|
25128
|
-
/**
|
|
25129
|
-
* Pluralization helper.
|
|
25130
|
-
*/
|
|
25131
|
-
|
|
25132
|
-
function plural(ms, msAbs, n, name) {
|
|
25133
|
-
var isPlural = msAbs >= n * 1.5;
|
|
25134
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
25135
|
-
}
|
|
25136
|
-
|
|
25137
|
-
/**
|
|
25138
|
-
* This is the common logic for both the Node.js and web browser
|
|
25139
|
-
* implementations of `debug()`.
|
|
25140
|
-
*/
|
|
25141
|
-
|
|
25142
|
-
function setup(env) {
|
|
25143
|
-
createDebug.debug = createDebug;
|
|
25144
|
-
createDebug.default = createDebug;
|
|
25145
|
-
createDebug.coerce = coerce;
|
|
25146
|
-
createDebug.disable = disable;
|
|
25147
|
-
createDebug.enable = enable;
|
|
25148
|
-
createDebug.enabled = enabled;
|
|
25149
|
-
createDebug.humanize = ms;
|
|
25150
|
-
createDebug.destroy = destroy;
|
|
25151
|
-
|
|
25152
|
-
Object.keys(env).forEach(key => {
|
|
25153
|
-
createDebug[key] = env[key];
|
|
25154
|
-
});
|
|
25155
|
-
|
|
25156
|
-
/**
|
|
25157
|
-
* The currently active debug mode names, and names to skip.
|
|
25158
|
-
*/
|
|
25159
|
-
|
|
25160
|
-
createDebug.names = [];
|
|
25161
|
-
createDebug.skips = [];
|
|
25162
|
-
|
|
25163
|
-
/**
|
|
25164
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
25165
|
-
*
|
|
25166
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
25167
|
-
*/
|
|
25168
|
-
createDebug.formatters = {};
|
|
25169
|
-
|
|
25170
|
-
/**
|
|
25171
|
-
* Selects a color for a debug namespace
|
|
25172
|
-
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
25173
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
|
25174
|
-
* @api private
|
|
25175
|
-
*/
|
|
25176
|
-
function selectColor(namespace) {
|
|
25177
|
-
let hash = 0;
|
|
25178
|
-
|
|
25179
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
25180
|
-
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
25181
|
-
hash |= 0; // Convert to 32bit integer
|
|
25182
|
-
}
|
|
25183
|
-
|
|
25184
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
25185
|
-
}
|
|
25186
|
-
createDebug.selectColor = selectColor;
|
|
25187
|
-
|
|
25188
|
-
/**
|
|
25189
|
-
* Create a debugger with the given `namespace`.
|
|
25190
|
-
*
|
|
25191
|
-
* @param {String} namespace
|
|
25192
|
-
* @return {Function}
|
|
25193
|
-
* @api public
|
|
25194
|
-
*/
|
|
25195
|
-
function createDebug(namespace) {
|
|
25196
|
-
let prevTime;
|
|
25197
|
-
let enableOverride = null;
|
|
25198
|
-
let namespacesCache;
|
|
25199
|
-
let enabledCache;
|
|
25200
|
-
|
|
25201
|
-
function debug(...args) {
|
|
25202
|
-
// Disabled?
|
|
25203
|
-
if (!debug.enabled) {
|
|
25204
|
-
return;
|
|
25205
|
-
}
|
|
25206
|
-
|
|
25207
|
-
const self = debug;
|
|
25208
|
-
|
|
25209
|
-
// Set `diff` timestamp
|
|
25210
|
-
const curr = Number(new Date());
|
|
25211
|
-
const ms = curr - (prevTime || curr);
|
|
25212
|
-
self.diff = ms;
|
|
25213
|
-
self.prev = prevTime;
|
|
25214
|
-
self.curr = curr;
|
|
25215
|
-
prevTime = curr;
|
|
25216
|
-
|
|
25217
|
-
args[0] = createDebug.coerce(args[0]);
|
|
25218
|
-
|
|
25219
|
-
if (typeof args[0] !== 'string') {
|
|
25220
|
-
// Anything else let's inspect with %O
|
|
25221
|
-
args.unshift('%O');
|
|
25222
|
-
}
|
|
25223
|
-
|
|
25224
|
-
// Apply any `formatters` transformations
|
|
25225
|
-
let index = 0;
|
|
25226
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
25227
|
-
// If we encounter an escaped % then don't increase the array index
|
|
25228
|
-
if (match === '%%') {
|
|
25229
|
-
return '%';
|
|
25230
|
-
}
|
|
25231
|
-
index++;
|
|
25232
|
-
const formatter = createDebug.formatters[format];
|
|
25233
|
-
if (typeof formatter === 'function') {
|
|
25234
|
-
const val = args[index];
|
|
25235
|
-
match = formatter.call(self, val);
|
|
25236
|
-
|
|
25237
|
-
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
25238
|
-
args.splice(index, 1);
|
|
25239
|
-
index--;
|
|
25240
|
-
}
|
|
25241
|
-
return match;
|
|
25242
|
-
});
|
|
25243
|
-
|
|
25244
|
-
// Apply env-specific formatting (colors, etc.)
|
|
25245
|
-
createDebug.formatArgs.call(self, args);
|
|
25246
|
-
|
|
25247
|
-
const logFn = self.log || createDebug.log;
|
|
25248
|
-
logFn.apply(self, args);
|
|
25249
|
-
}
|
|
25250
|
-
|
|
25251
|
-
debug.namespace = namespace;
|
|
25252
|
-
debug.useColors = createDebug.useColors();
|
|
25253
|
-
debug.color = createDebug.selectColor(namespace);
|
|
25254
|
-
debug.extend = extend;
|
|
25255
|
-
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
25256
|
-
|
|
25257
|
-
Object.defineProperty(debug, 'enabled', {
|
|
25258
|
-
enumerable: true,
|
|
25259
|
-
configurable: false,
|
|
25260
|
-
get: () => {
|
|
25261
|
-
if (enableOverride !== null) {
|
|
25262
|
-
return enableOverride;
|
|
25263
|
-
}
|
|
25264
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
25265
|
-
namespacesCache = createDebug.namespaces;
|
|
25266
|
-
enabledCache = createDebug.enabled(namespace);
|
|
25267
|
-
}
|
|
25268
|
-
|
|
25269
|
-
return enabledCache;
|
|
25270
|
-
},
|
|
25271
|
-
set: v => {
|
|
25272
|
-
enableOverride = v;
|
|
25273
|
-
}
|
|
25274
|
-
});
|
|
25275
|
-
|
|
25276
|
-
// Env-specific initialization logic for debug instances
|
|
25277
|
-
if (typeof createDebug.init === 'function') {
|
|
25278
|
-
createDebug.init(debug);
|
|
25279
|
-
}
|
|
25280
|
-
|
|
25281
|
-
return debug;
|
|
25282
|
-
}
|
|
25283
|
-
|
|
25284
|
-
function extend(namespace, delimiter) {
|
|
25285
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
25286
|
-
newDebug.log = this.log;
|
|
25287
|
-
return newDebug;
|
|
25288
|
-
}
|
|
25289
|
-
|
|
25290
|
-
/**
|
|
25291
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
25292
|
-
* separated by a colon and wildcards.
|
|
25293
|
-
*
|
|
25294
|
-
* @param {String} namespaces
|
|
25295
|
-
* @api public
|
|
25296
|
-
*/
|
|
25297
|
-
function enable(namespaces) {
|
|
25298
|
-
createDebug.save(namespaces);
|
|
25299
|
-
createDebug.namespaces = namespaces;
|
|
25300
|
-
|
|
25301
|
-
createDebug.names = [];
|
|
25302
|
-
createDebug.skips = [];
|
|
25303
|
-
|
|
25304
|
-
let i;
|
|
25305
|
-
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
25306
|
-
const len = split.length;
|
|
25307
|
-
|
|
25308
|
-
for (i = 0; i < len; i++) {
|
|
25309
|
-
if (!split[i]) {
|
|
25310
|
-
// ignore empty strings
|
|
25311
|
-
continue;
|
|
25312
|
-
}
|
|
25313
|
-
|
|
25314
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
25315
|
-
|
|
25316
|
-
if (namespaces[0] === '-') {
|
|
25317
|
-
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
25318
|
-
} else {
|
|
25319
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
25320
|
-
}
|
|
25321
|
-
}
|
|
25322
|
-
}
|
|
25323
|
-
|
|
25324
|
-
/**
|
|
25325
|
-
* Disable debug output.
|
|
25326
|
-
*
|
|
25327
|
-
* @return {String} namespaces
|
|
25328
|
-
* @api public
|
|
25329
|
-
*/
|
|
25330
|
-
function disable() {
|
|
25331
|
-
const namespaces = [
|
|
25332
|
-
...createDebug.names.map(toNamespace),
|
|
25333
|
-
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
25334
|
-
].join(',');
|
|
25335
|
-
createDebug.enable('');
|
|
25336
|
-
return namespaces;
|
|
25337
|
-
}
|
|
25338
|
-
|
|
25339
|
-
/**
|
|
25340
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
25341
|
-
*
|
|
25342
|
-
* @param {String} name
|
|
25343
|
-
* @return {Boolean}
|
|
25344
|
-
* @api public
|
|
25345
|
-
*/
|
|
25346
|
-
function enabled(name) {
|
|
25347
|
-
if (name[name.length - 1] === '*') {
|
|
25348
|
-
return true;
|
|
25349
|
-
}
|
|
25350
|
-
|
|
25351
|
-
let i;
|
|
25352
|
-
let len;
|
|
25353
|
-
|
|
25354
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
25355
|
-
if (createDebug.skips[i].test(name)) {
|
|
25356
|
-
return false;
|
|
25357
|
-
}
|
|
25358
|
-
}
|
|
25359
|
-
|
|
25360
|
-
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
25361
|
-
if (createDebug.names[i].test(name)) {
|
|
25362
|
-
return true;
|
|
25363
|
-
}
|
|
25364
|
-
}
|
|
25365
|
-
|
|
25366
|
-
return false;
|
|
25367
|
-
}
|
|
25368
|
-
|
|
25369
|
-
/**
|
|
25370
|
-
* Convert regexp to namespace
|
|
25371
|
-
*
|
|
25372
|
-
* @param {RegExp} regxep
|
|
25373
|
-
* @return {String} namespace
|
|
25374
|
-
* @api private
|
|
25375
|
-
*/
|
|
25376
|
-
function toNamespace(regexp) {
|
|
25377
|
-
return regexp.toString()
|
|
25378
|
-
.substring(2, regexp.toString().length - 2)
|
|
25379
|
-
.replace(/\.\*\?$/, '*');
|
|
25380
|
-
}
|
|
25381
|
-
|
|
25382
|
-
/**
|
|
25383
|
-
* Coerce `val`.
|
|
25384
|
-
*
|
|
25385
|
-
* @param {Mixed} val
|
|
25386
|
-
* @return {Mixed}
|
|
25387
|
-
* @api private
|
|
25388
|
-
*/
|
|
25389
|
-
function coerce(val) {
|
|
25390
|
-
if (val instanceof Error) {
|
|
25391
|
-
return val.stack || val.message;
|
|
25392
|
-
}
|
|
25393
|
-
return val;
|
|
25394
|
-
}
|
|
25395
|
-
|
|
25396
|
-
/**
|
|
25397
|
-
* XXX DO NOT USE. This is a temporary stub function.
|
|
25398
|
-
* XXX It WILL be removed in the next major release.
|
|
25399
|
-
*/
|
|
25400
|
-
function destroy() {
|
|
25401
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
25402
|
-
}
|
|
25403
|
-
|
|
25404
|
-
createDebug.enable(createDebug.load());
|
|
25405
|
-
|
|
25406
|
-
return createDebug;
|
|
25407
|
-
}
|
|
25408
|
-
|
|
25409
|
-
var common = setup;
|
|
25410
|
-
|
|
25411
|
-
var browser$1 = createCommonjsModule(function (module, exports) {
|
|
25412
|
-
/* eslint-env browser */
|
|
25413
|
-
|
|
25414
|
-
/**
|
|
25415
|
-
* This is the web browser implementation of `debug()`.
|
|
25416
|
-
*/
|
|
25417
|
-
|
|
25418
|
-
exports.formatArgs = formatArgs;
|
|
25419
|
-
exports.save = save;
|
|
25420
|
-
exports.load = load;
|
|
25421
|
-
exports.useColors = useColors;
|
|
25422
|
-
exports.storage = localstorage();
|
|
25423
|
-
exports.destroy = (() => {
|
|
25424
|
-
let warned = false;
|
|
25425
|
-
|
|
25426
|
-
return () => {
|
|
25427
|
-
if (!warned) {
|
|
25428
|
-
warned = true;
|
|
25429
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
25430
|
-
}
|
|
25431
|
-
};
|
|
25432
|
-
})();
|
|
25433
|
-
|
|
25434
|
-
/**
|
|
25435
|
-
* Colors.
|
|
25436
|
-
*/
|
|
25437
|
-
|
|
25438
|
-
exports.colors = [
|
|
25439
|
-
'#0000CC',
|
|
25440
|
-
'#0000FF',
|
|
25441
|
-
'#0033CC',
|
|
25442
|
-
'#0033FF',
|
|
25443
|
-
'#0066CC',
|
|
25444
|
-
'#0066FF',
|
|
25445
|
-
'#0099CC',
|
|
25446
|
-
'#0099FF',
|
|
25447
|
-
'#00CC00',
|
|
25448
|
-
'#00CC33',
|
|
25449
|
-
'#00CC66',
|
|
25450
|
-
'#00CC99',
|
|
25451
|
-
'#00CCCC',
|
|
25452
|
-
'#00CCFF',
|
|
25453
|
-
'#3300CC',
|
|
25454
|
-
'#3300FF',
|
|
25455
|
-
'#3333CC',
|
|
25456
|
-
'#3333FF',
|
|
25457
|
-
'#3366CC',
|
|
25458
|
-
'#3366FF',
|
|
25459
|
-
'#3399CC',
|
|
25460
|
-
'#3399FF',
|
|
25461
|
-
'#33CC00',
|
|
25462
|
-
'#33CC33',
|
|
25463
|
-
'#33CC66',
|
|
25464
|
-
'#33CC99',
|
|
25465
|
-
'#33CCCC',
|
|
25466
|
-
'#33CCFF',
|
|
25467
|
-
'#6600CC',
|
|
25468
|
-
'#6600FF',
|
|
25469
|
-
'#6633CC',
|
|
25470
|
-
'#6633FF',
|
|
25471
|
-
'#66CC00',
|
|
25472
|
-
'#66CC33',
|
|
25473
|
-
'#9900CC',
|
|
25474
|
-
'#9900FF',
|
|
25475
|
-
'#9933CC',
|
|
25476
|
-
'#9933FF',
|
|
25477
|
-
'#99CC00',
|
|
25478
|
-
'#99CC33',
|
|
25479
|
-
'#CC0000',
|
|
25480
|
-
'#CC0033',
|
|
25481
|
-
'#CC0066',
|
|
25482
|
-
'#CC0099',
|
|
25483
|
-
'#CC00CC',
|
|
25484
|
-
'#CC00FF',
|
|
25485
|
-
'#CC3300',
|
|
25486
|
-
'#CC3333',
|
|
25487
|
-
'#CC3366',
|
|
25488
|
-
'#CC3399',
|
|
25489
|
-
'#CC33CC',
|
|
25490
|
-
'#CC33FF',
|
|
25491
|
-
'#CC6600',
|
|
25492
|
-
'#CC6633',
|
|
25493
|
-
'#CC9900',
|
|
25494
|
-
'#CC9933',
|
|
25495
|
-
'#CCCC00',
|
|
25496
|
-
'#CCCC33',
|
|
25497
|
-
'#FF0000',
|
|
25498
|
-
'#FF0033',
|
|
25499
|
-
'#FF0066',
|
|
25500
|
-
'#FF0099',
|
|
25501
|
-
'#FF00CC',
|
|
25502
|
-
'#FF00FF',
|
|
25503
|
-
'#FF3300',
|
|
25504
|
-
'#FF3333',
|
|
25505
|
-
'#FF3366',
|
|
25506
|
-
'#FF3399',
|
|
25507
|
-
'#FF33CC',
|
|
25508
|
-
'#FF33FF',
|
|
25509
|
-
'#FF6600',
|
|
25510
|
-
'#FF6633',
|
|
25511
|
-
'#FF9900',
|
|
25512
|
-
'#FF9933',
|
|
25513
|
-
'#FFCC00',
|
|
25514
|
-
'#FFCC33'
|
|
25515
|
-
];
|
|
25516
|
-
|
|
25517
|
-
/**
|
|
25518
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
25519
|
-
* and the Firebug extension (any Firefox version) are known
|
|
25520
|
-
* to support "%c" CSS customizations.
|
|
25521
|
-
*
|
|
25522
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
25523
|
-
*/
|
|
25524
|
-
|
|
25525
|
-
// eslint-disable-next-line complexity
|
|
25526
|
-
function useColors() {
|
|
25527
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
|
25528
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
25529
|
-
// explicitly
|
|
25530
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
25531
|
-
return true;
|
|
25532
|
-
}
|
|
25533
|
-
|
|
25534
|
-
// Internet Explorer and Edge do not support colors.
|
|
25535
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
25536
|
-
return false;
|
|
25537
|
-
}
|
|
25538
|
-
|
|
25539
|
-
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
25540
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
25541
|
-
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
25542
|
-
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
25543
|
-
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
25544
|
-
// Is firefox >= v31?
|
|
25545
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
25546
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
25547
|
-
// Double check webkit in userAgent just in case we are in a worker
|
|
25548
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
25549
|
-
}
|
|
25550
|
-
|
|
25551
|
-
/**
|
|
25552
|
-
* Colorize log arguments if enabled.
|
|
25553
|
-
*
|
|
25554
|
-
* @api public
|
|
25555
|
-
*/
|
|
25556
|
-
|
|
25557
|
-
function formatArgs(args) {
|
|
25558
|
-
args[0] = (this.useColors ? '%c' : '') +
|
|
25559
|
-
this.namespace +
|
|
25560
|
-
(this.useColors ? ' %c' : ' ') +
|
|
25561
|
-
args[0] +
|
|
25562
|
-
(this.useColors ? '%c ' : ' ') +
|
|
25563
|
-
'+' + module.exports.humanize(this.diff);
|
|
25564
|
-
|
|
25565
|
-
if (!this.useColors) {
|
|
25566
|
-
return;
|
|
25567
|
-
}
|
|
25568
|
-
|
|
25569
|
-
const c = 'color: ' + this.color;
|
|
25570
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
25571
|
-
|
|
25572
|
-
// The final "%c" is somewhat tricky, because there could be other
|
|
25573
|
-
// arguments passed either before or after the %c, so we need to
|
|
25574
|
-
// figure out the correct index to insert the CSS into
|
|
25575
|
-
let index = 0;
|
|
25576
|
-
let lastC = 0;
|
|
25577
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
25578
|
-
if (match === '%%') {
|
|
25579
|
-
return;
|
|
25580
|
-
}
|
|
25581
|
-
index++;
|
|
25582
|
-
if (match === '%c') {
|
|
25583
|
-
// We only are interested in the *last* %c
|
|
25584
|
-
// (the user may have provided their own)
|
|
25585
|
-
lastC = index;
|
|
25586
|
-
}
|
|
25587
|
-
});
|
|
25588
|
-
|
|
25589
|
-
args.splice(lastC, 0, c);
|
|
25590
|
-
}
|
|
25591
|
-
|
|
25592
|
-
/**
|
|
25593
|
-
* Invokes `console.debug()` when available.
|
|
25594
|
-
* No-op when `console.debug` is not a "function".
|
|
25595
|
-
* If `console.debug` is not available, falls back
|
|
25596
|
-
* to `console.log`.
|
|
25597
|
-
*
|
|
25598
|
-
* @api public
|
|
25599
|
-
*/
|
|
25600
|
-
exports.log = console.debug || console.log || (() => {});
|
|
25601
|
-
|
|
25602
|
-
/**
|
|
25603
|
-
* Save `namespaces`.
|
|
25604
|
-
*
|
|
25605
|
-
* @param {String} namespaces
|
|
25606
|
-
* @api private
|
|
25607
|
-
*/
|
|
25608
|
-
function save(namespaces) {
|
|
25609
|
-
try {
|
|
25610
|
-
if (namespaces) {
|
|
25611
|
-
exports.storage.setItem('debug', namespaces);
|
|
25612
|
-
} else {
|
|
25613
|
-
exports.storage.removeItem('debug');
|
|
25614
|
-
}
|
|
25615
|
-
} catch (error) {
|
|
25616
|
-
// Swallow
|
|
25617
|
-
// XXX (@Qix-) should we be logging these?
|
|
25618
|
-
}
|
|
25619
|
-
}
|
|
25620
|
-
|
|
25621
|
-
/**
|
|
25622
|
-
* Load `namespaces`.
|
|
25623
|
-
*
|
|
25624
|
-
* @return {String} returns the previously persisted debug modes
|
|
25625
|
-
* @api private
|
|
25626
|
-
*/
|
|
25627
|
-
function load() {
|
|
25628
|
-
let r;
|
|
25629
|
-
try {
|
|
25630
|
-
r = exports.storage.getItem('debug');
|
|
25631
|
-
} catch (error) {
|
|
25632
|
-
// Swallow
|
|
25633
|
-
// XXX (@Qix-) should we be logging these?
|
|
25634
|
-
}
|
|
25635
|
-
|
|
25636
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
25637
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
25638
|
-
r = process.env.DEBUG;
|
|
25639
|
-
}
|
|
25640
|
-
|
|
25641
|
-
return r;
|
|
25642
|
-
}
|
|
25643
|
-
|
|
25644
|
-
/**
|
|
25645
|
-
* Localstorage attempts to return the localstorage.
|
|
25646
|
-
*
|
|
25647
|
-
* This is necessary because safari throws
|
|
25648
|
-
* when a user disables cookies/localstorage
|
|
25649
|
-
* and you attempt to access it.
|
|
25650
|
-
*
|
|
25651
|
-
* @return {LocalStorage}
|
|
25652
|
-
* @api private
|
|
25653
|
-
*/
|
|
25654
|
-
|
|
25655
|
-
function localstorage() {
|
|
25656
|
-
try {
|
|
25657
|
-
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
25658
|
-
// The Browser also has localStorage in the global context.
|
|
25659
|
-
return localStorage;
|
|
25660
|
-
} catch (error) {
|
|
25661
|
-
// Swallow
|
|
25662
|
-
// XXX (@Qix-) should we be logging these?
|
|
25663
|
-
}
|
|
25664
|
-
}
|
|
25665
|
-
|
|
25666
|
-
module.exports = common(exports);
|
|
25667
|
-
|
|
25668
|
-
const {formatters} = module.exports;
|
|
25669
|
-
|
|
25670
|
-
/**
|
|
25671
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
25672
|
-
*/
|
|
25673
|
-
|
|
25674
|
-
formatters.j = function (v) {
|
|
25675
|
-
try {
|
|
25676
|
-
return JSON.stringify(v);
|
|
25677
|
-
} catch (error) {
|
|
25678
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
25679
|
-
}
|
|
25680
|
-
};
|
|
25681
|
-
});
|
|
25682
|
-
|
|
25683
|
-
var hasFlag = (flag, argv = process.argv) => {
|
|
25684
|
-
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
|
|
25685
|
-
const position = argv.indexOf(prefix + flag);
|
|
25686
|
-
const terminatorPosition = argv.indexOf('--');
|
|
25687
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
25688
|
-
};
|
|
25689
|
-
|
|
25690
|
-
const {env} = process;
|
|
25691
|
-
|
|
25692
|
-
let forceColor;
|
|
25693
|
-
if (hasFlag('no-color') ||
|
|
25694
|
-
hasFlag('no-colors') ||
|
|
25695
|
-
hasFlag('color=false') ||
|
|
25696
|
-
hasFlag('color=never')) {
|
|
25697
|
-
forceColor = 0;
|
|
25698
|
-
} else if (hasFlag('color') ||
|
|
25699
|
-
hasFlag('colors') ||
|
|
25700
|
-
hasFlag('color=true') ||
|
|
25701
|
-
hasFlag('color=always')) {
|
|
25702
|
-
forceColor = 1;
|
|
25703
|
-
}
|
|
25704
|
-
|
|
25705
|
-
if ('FORCE_COLOR' in env) {
|
|
25706
|
-
if (env.FORCE_COLOR === 'true') {
|
|
25707
|
-
forceColor = 1;
|
|
25708
|
-
} else if (env.FORCE_COLOR === 'false') {
|
|
25709
|
-
forceColor = 0;
|
|
25710
|
-
} else {
|
|
25711
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
25712
|
-
}
|
|
25713
|
-
}
|
|
25714
|
-
|
|
25715
|
-
function translateLevel(level) {
|
|
25716
|
-
if (level === 0) {
|
|
25717
|
-
return false;
|
|
25718
|
-
}
|
|
25719
|
-
|
|
25720
|
-
return {
|
|
25721
|
-
level,
|
|
25722
|
-
hasBasic: true,
|
|
25723
|
-
has256: level >= 2,
|
|
25724
|
-
has16m: level >= 3
|
|
25725
|
-
};
|
|
25726
|
-
}
|
|
25727
|
-
|
|
25728
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
25729
|
-
if (forceColor === 0) {
|
|
25730
|
-
return 0;
|
|
25731
|
-
}
|
|
25732
|
-
|
|
25733
|
-
if (hasFlag('color=16m') ||
|
|
25734
|
-
hasFlag('color=full') ||
|
|
25735
|
-
hasFlag('color=truecolor')) {
|
|
25736
|
-
return 3;
|
|
25737
|
-
}
|
|
25738
|
-
|
|
25739
|
-
if (hasFlag('color=256')) {
|
|
25740
|
-
return 2;
|
|
25741
|
-
}
|
|
25742
|
-
|
|
25743
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
25744
|
-
return 0;
|
|
25745
|
-
}
|
|
25746
|
-
|
|
25747
|
-
const min = forceColor || 0;
|
|
25748
|
-
|
|
25749
|
-
if (env.TERM === 'dumb') {
|
|
25750
|
-
return min;
|
|
25751
|
-
}
|
|
25752
|
-
|
|
25753
|
-
if (process.platform === 'win32') {
|
|
25754
|
-
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
25755
|
-
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
25756
|
-
const osRelease = os__default["default"].release().split('.');
|
|
25757
|
-
if (
|
|
25758
|
-
Number(osRelease[0]) >= 10 &&
|
|
25759
|
-
Number(osRelease[2]) >= 10586
|
|
25760
|
-
) {
|
|
25761
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
25762
|
-
}
|
|
25763
|
-
|
|
25764
|
-
return 1;
|
|
25765
|
-
}
|
|
25766
|
-
|
|
25767
|
-
if ('CI' in env) {
|
|
25768
|
-
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
25769
|
-
return 1;
|
|
25770
|
-
}
|
|
25771
|
-
|
|
25772
|
-
return min;
|
|
25773
|
-
}
|
|
25774
|
-
|
|
25775
|
-
if ('TEAMCITY_VERSION' in env) {
|
|
25776
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
25777
|
-
}
|
|
25778
|
-
|
|
25779
|
-
if (env.COLORTERM === 'truecolor') {
|
|
25780
|
-
return 3;
|
|
25781
|
-
}
|
|
25782
|
-
|
|
25783
|
-
if ('TERM_PROGRAM' in env) {
|
|
25784
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
25785
|
-
|
|
25786
|
-
switch (env.TERM_PROGRAM) {
|
|
25787
|
-
case 'iTerm.app':
|
|
25788
|
-
return version >= 3 ? 3 : 2;
|
|
25789
|
-
case 'Apple_Terminal':
|
|
25790
|
-
return 2;
|
|
25791
|
-
// No default
|
|
25792
|
-
}
|
|
25793
|
-
}
|
|
25794
|
-
|
|
25795
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
25796
|
-
return 2;
|
|
25797
|
-
}
|
|
25798
|
-
|
|
25799
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
25800
|
-
return 1;
|
|
25801
|
-
}
|
|
25802
|
-
|
|
25803
|
-
if ('COLORTERM' in env) {
|
|
25804
|
-
return 1;
|
|
25805
|
-
}
|
|
25806
|
-
|
|
25807
|
-
return min;
|
|
25808
|
-
}
|
|
25809
|
-
|
|
25810
|
-
function getSupportLevel(stream) {
|
|
25811
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
25812
|
-
return translateLevel(level);
|
|
25813
|
-
}
|
|
25814
|
-
|
|
25815
|
-
var supportsColor_1 = {
|
|
25816
|
-
supportsColor: getSupportLevel,
|
|
25817
|
-
stdout: translateLevel(supportsColor(true, tty__default["default"].isatty(1))),
|
|
25818
|
-
stderr: translateLevel(supportsColor(true, tty__default["default"].isatty(2)))
|
|
25819
|
-
};
|
|
25820
|
-
|
|
25821
|
-
var node = createCommonjsModule(function (module, exports) {
|
|
25822
|
-
/**
|
|
25823
|
-
* Module dependencies.
|
|
25824
|
-
*/
|
|
25825
|
-
|
|
25826
|
-
|
|
25827
|
-
|
|
25828
|
-
|
|
25829
|
-
/**
|
|
25830
|
-
* This is the Node.js implementation of `debug()`.
|
|
25831
|
-
*/
|
|
25832
|
-
|
|
25833
|
-
exports.init = init;
|
|
25834
|
-
exports.log = log;
|
|
25835
|
-
exports.formatArgs = formatArgs;
|
|
25836
|
-
exports.save = save;
|
|
25837
|
-
exports.load = load;
|
|
25838
|
-
exports.useColors = useColors;
|
|
25839
|
-
exports.destroy = util__default["default"].deprecate(
|
|
25840
|
-
() => {},
|
|
25841
|
-
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
25842
|
-
);
|
|
25843
|
-
|
|
25844
|
-
/**
|
|
25845
|
-
* Colors.
|
|
25846
|
-
*/
|
|
25847
|
-
|
|
25848
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
25849
|
-
|
|
25850
|
-
try {
|
|
25851
|
-
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
25852
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
25853
|
-
const supportsColor = supportsColor_1;
|
|
25854
|
-
|
|
25855
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
25856
|
-
exports.colors = [
|
|
25857
|
-
20,
|
|
25858
|
-
21,
|
|
25859
|
-
26,
|
|
25860
|
-
27,
|
|
25861
|
-
32,
|
|
25862
|
-
33,
|
|
25863
|
-
38,
|
|
25864
|
-
39,
|
|
25865
|
-
40,
|
|
25866
|
-
41,
|
|
25867
|
-
42,
|
|
25868
|
-
43,
|
|
25869
|
-
44,
|
|
25870
|
-
45,
|
|
25871
|
-
56,
|
|
25872
|
-
57,
|
|
25873
|
-
62,
|
|
25874
|
-
63,
|
|
25875
|
-
68,
|
|
25876
|
-
69,
|
|
25877
|
-
74,
|
|
25878
|
-
75,
|
|
25879
|
-
76,
|
|
25880
|
-
77,
|
|
25881
|
-
78,
|
|
25882
|
-
79,
|
|
25883
|
-
80,
|
|
25884
|
-
81,
|
|
25885
|
-
92,
|
|
25886
|
-
93,
|
|
25887
|
-
98,
|
|
25888
|
-
99,
|
|
25889
|
-
112,
|
|
25890
|
-
113,
|
|
25891
|
-
128,
|
|
25892
|
-
129,
|
|
25893
|
-
134,
|
|
25894
|
-
135,
|
|
25895
|
-
148,
|
|
25896
|
-
149,
|
|
25897
|
-
160,
|
|
25898
|
-
161,
|
|
25899
|
-
162,
|
|
25900
|
-
163,
|
|
25901
|
-
164,
|
|
25902
|
-
165,
|
|
25903
|
-
166,
|
|
25904
|
-
167,
|
|
25905
|
-
168,
|
|
25906
|
-
169,
|
|
25907
|
-
170,
|
|
25908
|
-
171,
|
|
25909
|
-
172,
|
|
25910
|
-
173,
|
|
25911
|
-
178,
|
|
25912
|
-
179,
|
|
25913
|
-
184,
|
|
25914
|
-
185,
|
|
25915
|
-
196,
|
|
25916
|
-
197,
|
|
25917
|
-
198,
|
|
25918
|
-
199,
|
|
25919
|
-
200,
|
|
25920
|
-
201,
|
|
25921
|
-
202,
|
|
25922
|
-
203,
|
|
25923
|
-
204,
|
|
25924
|
-
205,
|
|
25925
|
-
206,
|
|
25926
|
-
207,
|
|
25927
|
-
208,
|
|
25928
|
-
209,
|
|
25929
|
-
214,
|
|
25930
|
-
215,
|
|
25931
|
-
220,
|
|
25932
|
-
221
|
|
25933
|
-
];
|
|
25934
|
-
}
|
|
25935
|
-
} catch (error) {
|
|
25936
|
-
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
25937
|
-
}
|
|
25938
|
-
|
|
25939
|
-
/**
|
|
25940
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
|
25941
|
-
*
|
|
25942
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
25943
|
-
*/
|
|
25944
|
-
|
|
25945
|
-
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
|
25946
|
-
return /^debug_/i.test(key);
|
|
25947
|
-
}).reduce((obj, key) => {
|
|
25948
|
-
// Camel-case
|
|
25949
|
-
const prop = key
|
|
25950
|
-
.substring(6)
|
|
25951
|
-
.toLowerCase()
|
|
25952
|
-
.replace(/_([a-z])/g, (_, k) => {
|
|
25953
|
-
return k.toUpperCase();
|
|
25954
|
-
});
|
|
25955
|
-
|
|
25956
|
-
// Coerce string value into JS value
|
|
25957
|
-
let val = process.env[key];
|
|
25958
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
25959
|
-
val = true;
|
|
25960
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
25961
|
-
val = false;
|
|
25962
|
-
} else if (val === 'null') {
|
|
25963
|
-
val = null;
|
|
25964
|
-
} else {
|
|
25965
|
-
val = Number(val);
|
|
25966
|
-
}
|
|
25967
|
-
|
|
25968
|
-
obj[prop] = val;
|
|
25969
|
-
return obj;
|
|
25970
|
-
}, {});
|
|
25971
|
-
|
|
25972
|
-
/**
|
|
25973
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
25974
|
-
*/
|
|
25975
|
-
|
|
25976
|
-
function useColors() {
|
|
25977
|
-
return 'colors' in exports.inspectOpts ?
|
|
25978
|
-
Boolean(exports.inspectOpts.colors) :
|
|
25979
|
-
tty__default["default"].isatty(process.stderr.fd);
|
|
25980
|
-
}
|
|
25981
|
-
|
|
25982
|
-
/**
|
|
25983
|
-
* Adds ANSI color escape codes if enabled.
|
|
25984
|
-
*
|
|
25985
|
-
* @api public
|
|
25986
|
-
*/
|
|
25987
|
-
|
|
25988
|
-
function formatArgs(args) {
|
|
25989
|
-
const {namespace: name, useColors} = this;
|
|
25990
|
-
|
|
25991
|
-
if (useColors) {
|
|
25992
|
-
const c = this.color;
|
|
25993
|
-
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
25994
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
25995
|
-
|
|
25996
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
25997
|
-
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
25998
|
-
} else {
|
|
25999
|
-
args[0] = getDate() + name + ' ' + args[0];
|
|
26000
|
-
}
|
|
26001
|
-
}
|
|
26002
|
-
|
|
26003
|
-
function getDate() {
|
|
26004
|
-
if (exports.inspectOpts.hideDate) {
|
|
26005
|
-
return '';
|
|
26006
|
-
}
|
|
26007
|
-
return new Date().toISOString() + ' ';
|
|
26008
|
-
}
|
|
26009
|
-
|
|
26010
|
-
/**
|
|
26011
|
-
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
|
26012
|
-
*/
|
|
26013
|
-
|
|
26014
|
-
function log(...args) {
|
|
26015
|
-
return process.stderr.write(util__default["default"].format(...args) + '\n');
|
|
26016
|
-
}
|
|
26017
|
-
|
|
26018
|
-
/**
|
|
26019
|
-
* Save `namespaces`.
|
|
26020
|
-
*
|
|
26021
|
-
* @param {String} namespaces
|
|
26022
|
-
* @api private
|
|
26023
|
-
*/
|
|
26024
|
-
function save(namespaces) {
|
|
26025
|
-
if (namespaces) {
|
|
26026
|
-
process.env.DEBUG = namespaces;
|
|
26027
|
-
} else {
|
|
26028
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
|
26029
|
-
// string 'null' or 'undefined'. Just delete instead.
|
|
26030
|
-
delete process.env.DEBUG;
|
|
26031
|
-
}
|
|
26032
|
-
}
|
|
26033
|
-
|
|
26034
|
-
/**
|
|
26035
|
-
* Load `namespaces`.
|
|
26036
|
-
*
|
|
26037
|
-
* @return {String} returns the previously persisted debug modes
|
|
26038
|
-
* @api private
|
|
26039
|
-
*/
|
|
26040
|
-
|
|
26041
|
-
function load() {
|
|
26042
|
-
return process.env.DEBUG;
|
|
26043
|
-
}
|
|
26044
|
-
|
|
26045
|
-
/**
|
|
26046
|
-
* Init logic for `debug` instances.
|
|
26047
|
-
*
|
|
26048
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
|
26049
|
-
* differently for a particular `debug` instance.
|
|
26050
|
-
*/
|
|
26051
|
-
|
|
26052
|
-
function init(debug) {
|
|
26053
|
-
debug.inspectOpts = {};
|
|
26054
|
-
|
|
26055
|
-
const keys = Object.keys(exports.inspectOpts);
|
|
26056
|
-
for (let i = 0; i < keys.length; i++) {
|
|
26057
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
26058
|
-
}
|
|
26059
|
-
}
|
|
26060
|
-
|
|
26061
|
-
module.exports = common(exports);
|
|
26062
|
-
|
|
26063
|
-
const {formatters} = module.exports;
|
|
26064
|
-
|
|
26065
|
-
/**
|
|
26066
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
26067
|
-
*/
|
|
26068
|
-
|
|
26069
|
-
formatters.o = function (v) {
|
|
26070
|
-
this.inspectOpts.colors = this.useColors;
|
|
26071
|
-
return util__default["default"].inspect(v, this.inspectOpts)
|
|
26072
|
-
.split('\n')
|
|
26073
|
-
.map(str => str.trim())
|
|
26074
|
-
.join(' ');
|
|
26075
|
-
};
|
|
26076
|
-
|
|
26077
|
-
/**
|
|
26078
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
26079
|
-
*/
|
|
26080
|
-
|
|
26081
|
-
formatters.O = function (v) {
|
|
26082
|
-
this.inspectOpts.colors = this.useColors;
|
|
26083
|
-
return util__default["default"].inspect(v, this.inspectOpts);
|
|
26084
|
-
};
|
|
26085
|
-
});
|
|
26086
|
-
|
|
26087
|
-
var src = createCommonjsModule(function (module) {
|
|
26088
|
-
/**
|
|
26089
|
-
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
26090
|
-
* treat as a browser.
|
|
26091
|
-
*/
|
|
26092
|
-
|
|
26093
|
-
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
26094
|
-
module.exports = browser$1;
|
|
26095
|
-
} else {
|
|
26096
|
-
module.exports = node;
|
|
26097
|
-
}
|
|
26098
|
-
});
|
|
26099
|
-
|
|
26100
|
-
var debug;
|
|
26101
|
-
|
|
26102
|
-
var debug_1 = function () {
|
|
26103
|
-
if (!debug) {
|
|
26104
|
-
try {
|
|
26105
|
-
/* eslint global-require: off */
|
|
26106
|
-
debug = src("follow-redirects");
|
|
26107
|
-
}
|
|
26108
|
-
catch (error) { /* */ }
|
|
26109
|
-
if (typeof debug !== "function") {
|
|
26110
|
-
debug = function () { /* */ };
|
|
26111
|
-
}
|
|
26112
|
-
}
|
|
26113
|
-
debug.apply(null, arguments);
|
|
26114
|
-
};
|
|
26115
|
-
|
|
26116
|
-
var URL$1 = url__default["default"].URL;
|
|
26117
|
-
|
|
26118
|
-
|
|
26119
|
-
var Writable = require$$0__default["default"].Writable;
|
|
26120
|
-
|
|
26121
|
-
|
|
26122
|
-
|
|
26123
|
-
// Whether to use the native URL object or the legacy url module
|
|
26124
|
-
var useNativeURL = false;
|
|
26125
|
-
try {
|
|
26126
|
-
assert__default["default"](new URL$1());
|
|
26127
|
-
}
|
|
26128
|
-
catch (error) {
|
|
26129
|
-
useNativeURL = error.code === "ERR_INVALID_URL";
|
|
26130
|
-
}
|
|
26131
|
-
|
|
26132
|
-
// URL fields to preserve in copy operations
|
|
26133
|
-
var preservedUrlFields = [
|
|
26134
|
-
"auth",
|
|
26135
|
-
"host",
|
|
26136
|
-
"hostname",
|
|
26137
|
-
"href",
|
|
26138
|
-
"path",
|
|
26139
|
-
"pathname",
|
|
26140
|
-
"port",
|
|
26141
|
-
"protocol",
|
|
26142
|
-
"query",
|
|
26143
|
-
"search",
|
|
26144
|
-
"hash",
|
|
26145
|
-
];
|
|
26146
|
-
|
|
26147
|
-
// Create handlers that pass events from native requests
|
|
26148
|
-
var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
|
|
26149
|
-
var eventHandlers = Object.create(null);
|
|
26150
|
-
events.forEach(function (event) {
|
|
26151
|
-
eventHandlers[event] = function (arg1, arg2, arg3) {
|
|
26152
|
-
this._redirectable.emit(event, arg1, arg2, arg3);
|
|
26153
|
-
};
|
|
26154
|
-
});
|
|
26155
|
-
|
|
26156
|
-
// Error types with codes
|
|
26157
|
-
var InvalidUrlError = createErrorType(
|
|
26158
|
-
"ERR_INVALID_URL",
|
|
26159
|
-
"Invalid URL",
|
|
26160
|
-
TypeError
|
|
26161
|
-
);
|
|
26162
|
-
var RedirectionError = createErrorType(
|
|
26163
|
-
"ERR_FR_REDIRECTION_FAILURE",
|
|
26164
|
-
"Redirected request failed"
|
|
26165
|
-
);
|
|
26166
|
-
var TooManyRedirectsError = createErrorType(
|
|
26167
|
-
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
26168
|
-
"Maximum number of redirects exceeded",
|
|
26169
|
-
RedirectionError
|
|
26170
|
-
);
|
|
26171
|
-
var MaxBodyLengthExceededError = createErrorType(
|
|
26172
|
-
"ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
|
|
26173
|
-
"Request body larger than maxBodyLength limit"
|
|
26174
|
-
);
|
|
26175
|
-
var WriteAfterEndError = createErrorType(
|
|
26176
|
-
"ERR_STREAM_WRITE_AFTER_END",
|
|
26177
|
-
"write after end"
|
|
26178
|
-
);
|
|
26179
|
-
|
|
26180
|
-
// istanbul ignore next
|
|
26181
|
-
var destroy = Writable.prototype.destroy || noop;
|
|
26182
|
-
|
|
26183
|
-
// An HTTP(S) request that can be redirected
|
|
26184
|
-
function RedirectableRequest(options, responseCallback) {
|
|
26185
|
-
// Initialize the request
|
|
26186
|
-
Writable.call(this);
|
|
26187
|
-
this._sanitizeOptions(options);
|
|
26188
|
-
this._options = options;
|
|
26189
|
-
this._ended = false;
|
|
26190
|
-
this._ending = false;
|
|
26191
|
-
this._redirectCount = 0;
|
|
26192
|
-
this._redirects = [];
|
|
26193
|
-
this._requestBodyLength = 0;
|
|
26194
|
-
this._requestBodyBuffers = [];
|
|
26195
|
-
|
|
26196
|
-
// Attach a callback if passed
|
|
26197
|
-
if (responseCallback) {
|
|
26198
|
-
this.on("response", responseCallback);
|
|
26199
|
-
}
|
|
26200
|
-
|
|
26201
|
-
// React to responses of native requests
|
|
26202
|
-
var self = this;
|
|
26203
|
-
this._onNativeResponse = function (response) {
|
|
26204
|
-
try {
|
|
26205
|
-
self._processResponse(response);
|
|
26206
|
-
}
|
|
26207
|
-
catch (cause) {
|
|
26208
|
-
self.emit("error", cause instanceof RedirectionError ?
|
|
26209
|
-
cause : new RedirectionError({ cause: cause }));
|
|
26210
|
-
}
|
|
26211
|
-
};
|
|
26212
|
-
|
|
26213
|
-
// Perform the first request
|
|
26214
|
-
this._performRequest();
|
|
26215
|
-
}
|
|
26216
|
-
RedirectableRequest.prototype = Object.create(Writable.prototype);
|
|
26217
|
-
|
|
26218
|
-
RedirectableRequest.prototype.abort = function () {
|
|
26219
|
-
destroyRequest(this._currentRequest);
|
|
26220
|
-
this._currentRequest.abort();
|
|
26221
|
-
this.emit("abort");
|
|
26222
|
-
};
|
|
26223
|
-
|
|
26224
|
-
RedirectableRequest.prototype.destroy = function (error) {
|
|
26225
|
-
destroyRequest(this._currentRequest, error);
|
|
26226
|
-
destroy.call(this, error);
|
|
26227
|
-
return this;
|
|
26228
|
-
};
|
|
26229
|
-
|
|
26230
|
-
// Writes buffered data to the current native request
|
|
26231
|
-
RedirectableRequest.prototype.write = function (data, encoding, callback) {
|
|
26232
|
-
// Writing is not allowed if end has been called
|
|
26233
|
-
if (this._ending) {
|
|
26234
|
-
throw new WriteAfterEndError();
|
|
26235
|
-
}
|
|
26236
|
-
|
|
26237
|
-
// Validate input and shift parameters if necessary
|
|
26238
|
-
if (!isString(data) && !isBuffer(data)) {
|
|
26239
|
-
throw new TypeError("data should be a string, Buffer or Uint8Array");
|
|
26240
|
-
}
|
|
26241
|
-
if (isFunction(encoding)) {
|
|
26242
|
-
callback = encoding;
|
|
26243
|
-
encoding = null;
|
|
26244
|
-
}
|
|
26245
|
-
|
|
26246
|
-
// Ignore empty buffers, since writing them doesn't invoke the callback
|
|
26247
|
-
// https://github.com/nodejs/node/issues/22066
|
|
26248
|
-
if (data.length === 0) {
|
|
26249
|
-
if (callback) {
|
|
26250
|
-
callback();
|
|
26251
|
-
}
|
|
26252
|
-
return;
|
|
26253
|
-
}
|
|
26254
|
-
// Only write when we don't exceed the maximum body length
|
|
26255
|
-
if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
|
|
26256
|
-
this._requestBodyLength += data.length;
|
|
26257
|
-
this._requestBodyBuffers.push({ data: data, encoding: encoding });
|
|
26258
|
-
this._currentRequest.write(data, encoding, callback);
|
|
26259
|
-
}
|
|
26260
|
-
// Error when we exceed the maximum body length
|
|
26261
|
-
else {
|
|
26262
|
-
this.emit("error", new MaxBodyLengthExceededError());
|
|
26263
|
-
this.abort();
|
|
26264
|
-
}
|
|
26265
|
-
};
|
|
26266
|
-
|
|
26267
|
-
// Ends the current native request
|
|
26268
|
-
RedirectableRequest.prototype.end = function (data, encoding, callback) {
|
|
26269
|
-
// Shift parameters if necessary
|
|
26270
|
-
if (isFunction(data)) {
|
|
26271
|
-
callback = data;
|
|
26272
|
-
data = encoding = null;
|
|
26273
|
-
}
|
|
26274
|
-
else if (isFunction(encoding)) {
|
|
26275
|
-
callback = encoding;
|
|
26276
|
-
encoding = null;
|
|
26277
|
-
}
|
|
26278
|
-
|
|
26279
|
-
// Write data if needed and end
|
|
26280
|
-
if (!data) {
|
|
26281
|
-
this._ended = this._ending = true;
|
|
26282
|
-
this._currentRequest.end(null, null, callback);
|
|
26283
|
-
}
|
|
26284
|
-
else {
|
|
26285
|
-
var self = this;
|
|
26286
|
-
var currentRequest = this._currentRequest;
|
|
26287
|
-
this.write(data, encoding, function () {
|
|
26288
|
-
self._ended = true;
|
|
26289
|
-
currentRequest.end(null, null, callback);
|
|
26290
|
-
});
|
|
26291
|
-
this._ending = true;
|
|
26292
|
-
}
|
|
26293
|
-
};
|
|
26294
|
-
|
|
26295
|
-
// Sets a header value on the current native request
|
|
26296
|
-
RedirectableRequest.prototype.setHeader = function (name, value) {
|
|
26297
|
-
this._options.headers[name] = value;
|
|
26298
|
-
this._currentRequest.setHeader(name, value);
|
|
26299
|
-
};
|
|
26300
|
-
|
|
26301
|
-
// Clears a header value on the current native request
|
|
26302
|
-
RedirectableRequest.prototype.removeHeader = function (name) {
|
|
26303
|
-
delete this._options.headers[name];
|
|
26304
|
-
this._currentRequest.removeHeader(name);
|
|
26305
|
-
};
|
|
26306
|
-
|
|
26307
|
-
// Global timeout for all underlying requests
|
|
26308
|
-
RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
|
|
26309
|
-
var self = this;
|
|
26310
|
-
|
|
26311
|
-
// Destroys the socket on timeout
|
|
26312
|
-
function destroyOnTimeout(socket) {
|
|
26313
|
-
socket.setTimeout(msecs);
|
|
26314
|
-
socket.removeListener("timeout", socket.destroy);
|
|
26315
|
-
socket.addListener("timeout", socket.destroy);
|
|
26316
|
-
}
|
|
26317
|
-
|
|
26318
|
-
// Sets up a timer to trigger a timeout event
|
|
26319
|
-
function startTimer(socket) {
|
|
26320
|
-
if (self._timeout) {
|
|
26321
|
-
clearTimeout(self._timeout);
|
|
26322
|
-
}
|
|
26323
|
-
self._timeout = setTimeout(function () {
|
|
26324
|
-
self.emit("timeout");
|
|
26325
|
-
clearTimer();
|
|
26326
|
-
}, msecs);
|
|
26327
|
-
destroyOnTimeout(socket);
|
|
26328
|
-
}
|
|
26329
|
-
|
|
26330
|
-
// Stops a timeout from triggering
|
|
26331
|
-
function clearTimer() {
|
|
26332
|
-
// Clear the timeout
|
|
26333
|
-
if (self._timeout) {
|
|
26334
|
-
clearTimeout(self._timeout);
|
|
26335
|
-
self._timeout = null;
|
|
26336
|
-
}
|
|
26337
|
-
|
|
26338
|
-
// Clean up all attached listeners
|
|
26339
|
-
self.removeListener("abort", clearTimer);
|
|
26340
|
-
self.removeListener("error", clearTimer);
|
|
26341
|
-
self.removeListener("response", clearTimer);
|
|
26342
|
-
self.removeListener("close", clearTimer);
|
|
26343
|
-
if (callback) {
|
|
26344
|
-
self.removeListener("timeout", callback);
|
|
26345
|
-
}
|
|
26346
|
-
if (!self.socket) {
|
|
26347
|
-
self._currentRequest.removeListener("socket", startTimer);
|
|
26348
|
-
}
|
|
26349
|
-
}
|
|
26350
|
-
|
|
26351
|
-
// Attach callback if passed
|
|
26352
|
-
if (callback) {
|
|
26353
|
-
this.on("timeout", callback);
|
|
26354
|
-
}
|
|
26355
|
-
|
|
26356
|
-
// Start the timer if or when the socket is opened
|
|
26357
|
-
if (this.socket) {
|
|
26358
|
-
startTimer(this.socket);
|
|
26359
|
-
}
|
|
26360
|
-
else {
|
|
26361
|
-
this._currentRequest.once("socket", startTimer);
|
|
26362
|
-
}
|
|
26363
|
-
|
|
26364
|
-
// Clean up on events
|
|
26365
|
-
this.on("socket", destroyOnTimeout);
|
|
26366
|
-
this.on("abort", clearTimer);
|
|
26367
|
-
this.on("error", clearTimer);
|
|
26368
|
-
this.on("response", clearTimer);
|
|
26369
|
-
this.on("close", clearTimer);
|
|
26370
|
-
|
|
26371
|
-
return this;
|
|
26372
|
-
};
|
|
26373
|
-
|
|
26374
|
-
// Proxy all other public ClientRequest methods
|
|
26375
|
-
[
|
|
26376
|
-
"flushHeaders", "getHeader",
|
|
26377
|
-
"setNoDelay", "setSocketKeepAlive",
|
|
26378
|
-
].forEach(function (method) {
|
|
26379
|
-
RedirectableRequest.prototype[method] = function (a, b) {
|
|
26380
|
-
return this._currentRequest[method](a, b);
|
|
26381
|
-
};
|
|
26382
|
-
});
|
|
26383
|
-
|
|
26384
|
-
// Proxy all public ClientRequest properties
|
|
26385
|
-
["aborted", "connection", "socket"].forEach(function (property) {
|
|
26386
|
-
Object.defineProperty(RedirectableRequest.prototype, property, {
|
|
26387
|
-
get: function () { return this._currentRequest[property]; },
|
|
26388
|
-
});
|
|
26389
|
-
});
|
|
26390
|
-
|
|
26391
|
-
RedirectableRequest.prototype._sanitizeOptions = function (options) {
|
|
26392
|
-
// Ensure headers are always present
|
|
26393
|
-
if (!options.headers) {
|
|
26394
|
-
options.headers = {};
|
|
26395
|
-
}
|
|
26396
|
-
|
|
26397
|
-
// Since http.request treats host as an alias of hostname,
|
|
26398
|
-
// but the url module interprets host as hostname plus port,
|
|
26399
|
-
// eliminate the host property to avoid confusion.
|
|
26400
|
-
if (options.host) {
|
|
26401
|
-
// Use hostname if set, because it has precedence
|
|
26402
|
-
if (!options.hostname) {
|
|
26403
|
-
options.hostname = options.host;
|
|
26404
|
-
}
|
|
26405
|
-
delete options.host;
|
|
26406
|
-
}
|
|
26407
|
-
|
|
26408
|
-
// Complete the URL object when necessary
|
|
26409
|
-
if (!options.pathname && options.path) {
|
|
26410
|
-
var searchPos = options.path.indexOf("?");
|
|
26411
|
-
if (searchPos < 0) {
|
|
26412
|
-
options.pathname = options.path;
|
|
26413
|
-
}
|
|
26414
|
-
else {
|
|
26415
|
-
options.pathname = options.path.substring(0, searchPos);
|
|
26416
|
-
options.search = options.path.substring(searchPos);
|
|
26417
|
-
}
|
|
26418
|
-
}
|
|
26419
|
-
};
|
|
26420
|
-
|
|
26421
|
-
|
|
26422
|
-
// Executes the next native request (initial or redirect)
|
|
26423
|
-
RedirectableRequest.prototype._performRequest = function () {
|
|
26424
|
-
// Load the native protocol
|
|
26425
|
-
var protocol = this._options.protocol;
|
|
26426
|
-
var nativeProtocol = this._options.nativeProtocols[protocol];
|
|
26427
|
-
if (!nativeProtocol) {
|
|
26428
|
-
throw new TypeError("Unsupported protocol " + protocol);
|
|
26429
|
-
}
|
|
26430
|
-
|
|
26431
|
-
// If specified, use the agent corresponding to the protocol
|
|
26432
|
-
// (HTTP and HTTPS use different types of agents)
|
|
26433
|
-
if (this._options.agents) {
|
|
26434
|
-
var scheme = protocol.slice(0, -1);
|
|
26435
|
-
this._options.agent = this._options.agents[scheme];
|
|
26436
|
-
}
|
|
26437
|
-
|
|
26438
|
-
// Create the native request and set up its event handlers
|
|
26439
|
-
var request = this._currentRequest =
|
|
26440
|
-
nativeProtocol.request(this._options, this._onNativeResponse);
|
|
26441
|
-
request._redirectable = this;
|
|
26442
|
-
for (var event of events) {
|
|
26443
|
-
request.on(event, eventHandlers[event]);
|
|
26444
|
-
}
|
|
26445
|
-
|
|
26446
|
-
// RFC7230§5.3.1: When making a request directly to an origin server, […]
|
|
26447
|
-
// a client MUST send only the absolute path […] as the request-target.
|
|
26448
|
-
this._currentUrl = /^\//.test(this._options.path) ?
|
|
26449
|
-
url__default["default"].format(this._options) :
|
|
26450
|
-
// When making a request to a proxy, […]
|
|
26451
|
-
// a client MUST send the target URI in absolute-form […].
|
|
26452
|
-
this._options.path;
|
|
26453
|
-
|
|
26454
|
-
// End a redirected request
|
|
26455
|
-
// (The first request must be ended explicitly with RedirectableRequest#end)
|
|
26456
|
-
if (this._isRedirect) {
|
|
26457
|
-
// Write the request entity and end
|
|
26458
|
-
var i = 0;
|
|
26459
|
-
var self = this;
|
|
26460
|
-
var buffers = this._requestBodyBuffers;
|
|
26461
|
-
(function writeNext(error) {
|
|
26462
|
-
// Only write if this request has not been redirected yet
|
|
26463
|
-
/* istanbul ignore else */
|
|
26464
|
-
if (request === self._currentRequest) {
|
|
26465
|
-
// Report any write errors
|
|
26466
|
-
/* istanbul ignore if */
|
|
26467
|
-
if (error) {
|
|
26468
|
-
self.emit("error", error);
|
|
26469
|
-
}
|
|
26470
|
-
// Write the next buffer if there are still left
|
|
26471
|
-
else if (i < buffers.length) {
|
|
26472
|
-
var buffer = buffers[i++];
|
|
26473
|
-
/* istanbul ignore else */
|
|
26474
|
-
if (!request.finished) {
|
|
26475
|
-
request.write(buffer.data, buffer.encoding, writeNext);
|
|
26476
|
-
}
|
|
26477
|
-
}
|
|
26478
|
-
// End the request if `end` has been called on us
|
|
26479
|
-
else if (self._ended) {
|
|
26480
|
-
request.end();
|
|
26481
|
-
}
|
|
26482
|
-
}
|
|
26483
|
-
}());
|
|
26484
|
-
}
|
|
26485
|
-
};
|
|
26486
|
-
|
|
26487
|
-
// Processes a response from the current native request
|
|
26488
|
-
RedirectableRequest.prototype._processResponse = function (response) {
|
|
26489
|
-
// Store the redirected response
|
|
26490
|
-
var statusCode = response.statusCode;
|
|
26491
|
-
if (this._options.trackRedirects) {
|
|
26492
|
-
this._redirects.push({
|
|
26493
|
-
url: this._currentUrl,
|
|
26494
|
-
headers: response.headers,
|
|
26495
|
-
statusCode: statusCode,
|
|
26496
|
-
});
|
|
26497
|
-
}
|
|
26498
|
-
|
|
26499
|
-
// RFC7231§6.4: The 3xx (Redirection) class of status code indicates
|
|
26500
|
-
// that further action needs to be taken by the user agent in order to
|
|
26501
|
-
// fulfill the request. If a Location header field is provided,
|
|
26502
|
-
// the user agent MAY automatically redirect its request to the URI
|
|
26503
|
-
// referenced by the Location field value,
|
|
26504
|
-
// even if the specific status code is not understood.
|
|
26505
|
-
|
|
26506
|
-
// If the response is not a redirect; return it as-is
|
|
26507
|
-
var location = response.headers.location;
|
|
26508
|
-
if (!location || this._options.followRedirects === false ||
|
|
26509
|
-
statusCode < 300 || statusCode >= 400) {
|
|
26510
|
-
response.responseUrl = this._currentUrl;
|
|
26511
|
-
response.redirects = this._redirects;
|
|
26512
|
-
this.emit("response", response);
|
|
26513
|
-
|
|
26514
|
-
// Clean up
|
|
26515
|
-
this._requestBodyBuffers = [];
|
|
26516
|
-
return;
|
|
26517
|
-
}
|
|
26518
|
-
|
|
26519
|
-
// The response is a redirect, so abort the current request
|
|
26520
|
-
destroyRequest(this._currentRequest);
|
|
26521
|
-
// Discard the remainder of the response to avoid waiting for data
|
|
26522
|
-
response.destroy();
|
|
26523
|
-
|
|
26524
|
-
// RFC7231§6.4: A client SHOULD detect and intervene
|
|
26525
|
-
// in cyclical redirections (i.e., "infinite" redirection loops).
|
|
26526
|
-
if (++this._redirectCount > this._options.maxRedirects) {
|
|
26527
|
-
throw new TooManyRedirectsError();
|
|
26528
|
-
}
|
|
26529
|
-
|
|
26530
|
-
// Store the request headers if applicable
|
|
26531
|
-
var requestHeaders;
|
|
26532
|
-
var beforeRedirect = this._options.beforeRedirect;
|
|
26533
|
-
if (beforeRedirect) {
|
|
26534
|
-
requestHeaders = Object.assign({
|
|
26535
|
-
// The Host header was set by nativeProtocol.request
|
|
26536
|
-
Host: response.req.getHeader("host"),
|
|
26537
|
-
}, this._options.headers);
|
|
26538
|
-
}
|
|
26539
|
-
|
|
26540
|
-
// RFC7231§6.4: Automatic redirection needs to done with
|
|
26541
|
-
// care for methods not known to be safe, […]
|
|
26542
|
-
// RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
|
|
26543
|
-
// the request method from POST to GET for the subsequent request.
|
|
26544
|
-
var method = this._options.method;
|
|
26545
|
-
if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
|
|
26546
|
-
// RFC7231§6.4.4: The 303 (See Other) status code indicates that
|
|
26547
|
-
// the server is redirecting the user agent to a different resource […]
|
|
26548
|
-
// A user agent can perform a retrieval request targeting that URI
|
|
26549
|
-
// (a GET or HEAD request if using HTTP) […]
|
|
26550
|
-
(statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
|
|
26551
|
-
this._options.method = "GET";
|
|
26552
|
-
// Drop a possible entity and headers related to it
|
|
26553
|
-
this._requestBodyBuffers = [];
|
|
26554
|
-
removeMatchingHeaders(/^content-/i, this._options.headers);
|
|
26555
|
-
}
|
|
26556
|
-
|
|
26557
|
-
// Drop the Host header, as the redirect might lead to a different host
|
|
26558
|
-
var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
|
|
26559
|
-
|
|
26560
|
-
// If the redirect is relative, carry over the host of the last request
|
|
26561
|
-
var currentUrlParts = parseUrl(this._currentUrl);
|
|
26562
|
-
var currentHost = currentHostHeader || currentUrlParts.host;
|
|
26563
|
-
var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
|
|
26564
|
-
url__default["default"].format(Object.assign(currentUrlParts, { host: currentHost }));
|
|
26565
|
-
|
|
26566
|
-
// Create the redirected request
|
|
26567
|
-
var redirectUrl = resolveUrl(location, currentUrl);
|
|
26568
|
-
debug_1("redirecting to", redirectUrl.href);
|
|
26569
|
-
this._isRedirect = true;
|
|
26570
|
-
spreadUrlObject(redirectUrl, this._options);
|
|
26571
|
-
|
|
26572
|
-
// Drop confidential headers when redirecting to a less secure protocol
|
|
26573
|
-
// or to a different domain that is not a superdomain
|
|
26574
|
-
if (redirectUrl.protocol !== currentUrlParts.protocol &&
|
|
26575
|
-
redirectUrl.protocol !== "https:" ||
|
|
26576
|
-
redirectUrl.host !== currentHost &&
|
|
26577
|
-
!isSubdomain(redirectUrl.host, currentHost)) {
|
|
26578
|
-
removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
|
|
26579
|
-
}
|
|
26580
|
-
|
|
26581
|
-
// Evaluate the beforeRedirect callback
|
|
26582
|
-
if (isFunction(beforeRedirect)) {
|
|
26583
|
-
var responseDetails = {
|
|
26584
|
-
headers: response.headers,
|
|
26585
|
-
statusCode: statusCode,
|
|
26586
|
-
};
|
|
26587
|
-
var requestDetails = {
|
|
26588
|
-
url: currentUrl,
|
|
26589
|
-
method: method,
|
|
26590
|
-
headers: requestHeaders,
|
|
26591
|
-
};
|
|
26592
|
-
beforeRedirect(this._options, responseDetails, requestDetails);
|
|
26593
|
-
this._sanitizeOptions(this._options);
|
|
26594
|
-
}
|
|
26595
|
-
|
|
26596
|
-
// Perform the redirected request
|
|
26597
|
-
this._performRequest();
|
|
26598
|
-
};
|
|
26599
|
-
|
|
26600
|
-
// Wraps the key/value object of protocols with redirect functionality
|
|
26601
|
-
function wrap(protocols) {
|
|
26602
|
-
// Default settings
|
|
26603
|
-
var exports = {
|
|
26604
|
-
maxRedirects: 21,
|
|
26605
|
-
maxBodyLength: 10 * 1024 * 1024,
|
|
26606
|
-
};
|
|
26607
|
-
|
|
26608
|
-
// Wrap each protocol
|
|
26609
|
-
var nativeProtocols = {};
|
|
26610
|
-
Object.keys(protocols).forEach(function (scheme) {
|
|
26611
|
-
var protocol = scheme + ":";
|
|
26612
|
-
var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
|
|
26613
|
-
var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
|
|
26614
|
-
|
|
26615
|
-
// Executes a request, following redirects
|
|
26616
|
-
function request(input, options, callback) {
|
|
26617
|
-
// Parse parameters, ensuring that input is an object
|
|
26618
|
-
if (isURL(input)) {
|
|
26619
|
-
input = spreadUrlObject(input);
|
|
26620
|
-
}
|
|
26621
|
-
else if (isString(input)) {
|
|
26622
|
-
input = spreadUrlObject(parseUrl(input));
|
|
26623
|
-
}
|
|
26624
|
-
else {
|
|
26625
|
-
callback = options;
|
|
26626
|
-
options = validateUrl(input);
|
|
26627
|
-
input = { protocol: protocol };
|
|
26628
|
-
}
|
|
26629
|
-
if (isFunction(options)) {
|
|
26630
|
-
callback = options;
|
|
26631
|
-
options = null;
|
|
26632
|
-
}
|
|
26633
|
-
|
|
26634
|
-
// Set defaults
|
|
26635
|
-
options = Object.assign({
|
|
26636
|
-
maxRedirects: exports.maxRedirects,
|
|
26637
|
-
maxBodyLength: exports.maxBodyLength,
|
|
26638
|
-
}, input, options);
|
|
26639
|
-
options.nativeProtocols = nativeProtocols;
|
|
26640
|
-
if (!isString(options.host) && !isString(options.hostname)) {
|
|
26641
|
-
options.hostname = "::1";
|
|
26642
|
-
}
|
|
26643
|
-
|
|
26644
|
-
assert__default["default"].equal(options.protocol, protocol, "protocol mismatch");
|
|
26645
|
-
debug_1("options", options);
|
|
26646
|
-
return new RedirectableRequest(options, callback);
|
|
26647
|
-
}
|
|
26648
|
-
|
|
26649
|
-
// Executes a GET request, following redirects
|
|
26650
|
-
function get(input, options, callback) {
|
|
26651
|
-
var wrappedRequest = wrappedProtocol.request(input, options, callback);
|
|
26652
|
-
wrappedRequest.end();
|
|
26653
|
-
return wrappedRequest;
|
|
26654
|
-
}
|
|
26655
|
-
|
|
26656
|
-
// Expose the properties on the wrapped protocol
|
|
26657
|
-
Object.defineProperties(wrappedProtocol, {
|
|
26658
|
-
request: { value: request, configurable: true, enumerable: true, writable: true },
|
|
26659
|
-
get: { value: get, configurable: true, enumerable: true, writable: true },
|
|
26660
|
-
});
|
|
26661
|
-
});
|
|
26662
|
-
return exports;
|
|
26663
|
-
}
|
|
26664
|
-
|
|
26665
|
-
function noop() { /* empty */ }
|
|
26666
|
-
|
|
26667
|
-
function parseUrl(input) {
|
|
26668
|
-
var parsed;
|
|
26669
|
-
/* istanbul ignore else */
|
|
26670
|
-
if (useNativeURL) {
|
|
26671
|
-
parsed = new URL$1(input);
|
|
26672
|
-
}
|
|
26673
|
-
else {
|
|
26674
|
-
// Ensure the URL is valid and absolute
|
|
26675
|
-
parsed = validateUrl(url__default["default"].parse(input));
|
|
26676
|
-
if (!isString(parsed.protocol)) {
|
|
26677
|
-
throw new InvalidUrlError({ input });
|
|
26678
|
-
}
|
|
26679
|
-
}
|
|
26680
|
-
return parsed;
|
|
26681
|
-
}
|
|
26682
|
-
|
|
26683
|
-
function resolveUrl(relative, base) {
|
|
26684
|
-
/* istanbul ignore next */
|
|
26685
|
-
return useNativeURL ? new URL$1(relative, base) : parseUrl(url__default["default"].resolve(base, relative));
|
|
26686
|
-
}
|
|
26687
|
-
|
|
26688
|
-
function validateUrl(input) {
|
|
26689
|
-
if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
|
|
26690
|
-
throw new InvalidUrlError({ input: input.href || input });
|
|
26691
|
-
}
|
|
26692
|
-
if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) {
|
|
26693
|
-
throw new InvalidUrlError({ input: input.href || input });
|
|
26694
|
-
}
|
|
26695
|
-
return input;
|
|
26696
|
-
}
|
|
26697
|
-
|
|
26698
|
-
function spreadUrlObject(urlObject, target) {
|
|
26699
|
-
var spread = target || {};
|
|
26700
|
-
for (var key of preservedUrlFields) {
|
|
26701
|
-
spread[key] = urlObject[key];
|
|
26702
|
-
}
|
|
26703
|
-
|
|
26704
|
-
// Fix IPv6 hostname
|
|
26705
|
-
if (spread.hostname.startsWith("[")) {
|
|
26706
|
-
spread.hostname = spread.hostname.slice(1, -1);
|
|
26707
|
-
}
|
|
26708
|
-
// Ensure port is a number
|
|
26709
|
-
if (spread.port !== "") {
|
|
26710
|
-
spread.port = Number(spread.port);
|
|
26711
|
-
}
|
|
26712
|
-
// Concatenate path
|
|
26713
|
-
spread.path = spread.search ? spread.pathname + spread.search : spread.pathname;
|
|
26714
|
-
|
|
26715
|
-
return spread;
|
|
26716
|
-
}
|
|
26717
|
-
|
|
26718
|
-
function removeMatchingHeaders(regex, headers) {
|
|
26719
|
-
var lastValue;
|
|
26720
|
-
for (var header in headers) {
|
|
26721
|
-
if (regex.test(header)) {
|
|
26722
|
-
lastValue = headers[header];
|
|
26723
|
-
delete headers[header];
|
|
26724
|
-
}
|
|
26725
|
-
}
|
|
26726
|
-
return (lastValue === null || typeof lastValue === "undefined") ?
|
|
26727
|
-
undefined : String(lastValue).trim();
|
|
26728
|
-
}
|
|
26729
|
-
|
|
26730
|
-
function createErrorType(code, message, baseClass) {
|
|
26731
|
-
// Create constructor
|
|
26732
|
-
function CustomError(properties) {
|
|
26733
|
-
Error.captureStackTrace(this, this.constructor);
|
|
26734
|
-
Object.assign(this, properties || {});
|
|
26735
|
-
this.code = code;
|
|
26736
|
-
this.message = this.cause ? message + ": " + this.cause.message : message;
|
|
26737
|
-
}
|
|
26738
|
-
|
|
26739
|
-
// Attach constructor and set default properties
|
|
26740
|
-
CustomError.prototype = new (baseClass || Error)();
|
|
26741
|
-
Object.defineProperties(CustomError.prototype, {
|
|
26742
|
-
constructor: {
|
|
26743
|
-
value: CustomError,
|
|
26744
|
-
enumerable: false,
|
|
26745
|
-
},
|
|
26746
|
-
name: {
|
|
26747
|
-
value: "Error [" + code + "]",
|
|
26748
|
-
enumerable: false,
|
|
26749
|
-
},
|
|
26750
|
-
});
|
|
26751
|
-
return CustomError;
|
|
26752
|
-
}
|
|
26753
|
-
|
|
26754
|
-
function destroyRequest(request, error) {
|
|
26755
|
-
for (var event of events) {
|
|
26756
|
-
request.removeListener(event, eventHandlers[event]);
|
|
26757
|
-
}
|
|
26758
|
-
request.on("error", noop);
|
|
26759
|
-
request.destroy(error);
|
|
26760
|
-
}
|
|
26761
|
-
|
|
26762
|
-
function isSubdomain(subdomain, domain) {
|
|
26763
|
-
assert__default["default"](isString(subdomain) && isString(domain));
|
|
26764
|
-
var dot = subdomain.length - domain.length - 1;
|
|
26765
|
-
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
|
|
26766
|
-
}
|
|
26767
|
-
|
|
26768
|
-
function isString(value) {
|
|
26769
|
-
return typeof value === "string" || value instanceof String;
|
|
26770
|
-
}
|
|
26771
|
-
|
|
26772
|
-
function isFunction(value) {
|
|
26773
|
-
return typeof value === "function";
|
|
26774
|
-
}
|
|
26775
|
-
|
|
26776
|
-
function isBuffer(value) {
|
|
26777
|
-
return typeof value === "object" && ("length" in value);
|
|
26778
|
-
}
|
|
26779
|
-
|
|
26780
|
-
function isURL(value) {
|
|
26781
|
-
return URL$1 && value instanceof URL$1;
|
|
26782
|
-
}
|
|
26783
|
-
|
|
26784
|
-
// Exports
|
|
26785
|
-
var followRedirects = wrap({ http: http__default["default"], https: https__default["default"] });
|
|
26786
|
-
var wrap_1 = wrap;
|
|
26787
|
-
followRedirects.wrap = wrap_1;
|
|
26788
|
-
|
|
26789
|
-
var _from = "axios@0.21.0";
|
|
26790
|
-
var _id = "axios@0.21.0";
|
|
26791
|
-
var _inBundle = false;
|
|
26792
|
-
var _integrity = "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==";
|
|
26793
|
-
var _location = "/axios";
|
|
26794
|
-
var _phantomChildren = {
|
|
26795
|
-
};
|
|
26796
|
-
var _requested = {
|
|
26797
|
-
type: "version",
|
|
26798
|
-
registry: true,
|
|
26799
|
-
raw: "axios@0.21.0",
|
|
26800
|
-
name: "axios",
|
|
26801
|
-
escapedName: "axios",
|
|
26802
|
-
rawSpec: "0.21.0",
|
|
26803
|
-
saveSpec: null,
|
|
26804
|
-
fetchSpec: "0.21.0"
|
|
26805
|
-
};
|
|
26806
|
-
var _requiredBy = [
|
|
26807
|
-
"#DEV:/",
|
|
26808
|
-
"#USER"
|
|
26809
|
-
];
|
|
26810
|
-
var _resolved = "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz";
|
|
26811
|
-
var _shasum = "26df088803a2350dff2c27f96fef99fe49442aca";
|
|
26812
|
-
var _spec = "axios@0.21.0";
|
|
26813
|
-
var _where = "/Users/jingtongyu/Downloads/unika/unika-components";
|
|
26814
|
-
var author = {
|
|
26815
|
-
name: "Matt Zabriskie"
|
|
26816
|
-
};
|
|
26817
|
-
var browser = {
|
|
26818
|
-
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
|
26819
|
-
};
|
|
26820
|
-
var bugs = {
|
|
26821
|
-
url: "https://github.com/axios/axios/issues"
|
|
26822
|
-
};
|
|
26823
|
-
var bundleDependencies = false;
|
|
26824
|
-
var bundlesize = [
|
|
26825
|
-
{
|
|
26826
|
-
path: "./dist/axios.min.js",
|
|
26827
|
-
threshold: "5kB"
|
|
26828
|
-
}
|
|
26829
|
-
];
|
|
26830
|
-
var dependencies = {
|
|
26831
|
-
"follow-redirects": "^1.10.0"
|
|
26832
|
-
};
|
|
26833
|
-
var deprecated = "Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410";
|
|
26834
|
-
var description = "Promise based HTTP client for the browser and node.js";
|
|
26835
|
-
var devDependencies = {
|
|
26836
|
-
bundlesize: "^0.17.0",
|
|
26837
|
-
coveralls: "^3.0.0",
|
|
26838
|
-
"es6-promise": "^4.2.4",
|
|
26839
|
-
grunt: "^1.0.2",
|
|
26840
|
-
"grunt-banner": "^0.6.0",
|
|
26841
|
-
"grunt-cli": "^1.2.0",
|
|
26842
|
-
"grunt-contrib-clean": "^1.1.0",
|
|
26843
|
-
"grunt-contrib-watch": "^1.0.0",
|
|
26844
|
-
"grunt-eslint": "^20.1.0",
|
|
26845
|
-
"grunt-karma": "^2.0.0",
|
|
26846
|
-
"grunt-mocha-test": "^0.13.3",
|
|
26847
|
-
"grunt-ts": "^6.0.0-beta.19",
|
|
26848
|
-
"grunt-webpack": "^1.0.18",
|
|
26849
|
-
"istanbul-instrumenter-loader": "^1.0.0",
|
|
26850
|
-
"jasmine-core": "^2.4.1",
|
|
26851
|
-
karma: "^1.3.0",
|
|
26852
|
-
"karma-chrome-launcher": "^2.2.0",
|
|
26853
|
-
"karma-coverage": "^1.1.1",
|
|
26854
|
-
"karma-firefox-launcher": "^1.1.0",
|
|
26855
|
-
"karma-jasmine": "^1.1.1",
|
|
26856
|
-
"karma-jasmine-ajax": "^0.1.13",
|
|
26857
|
-
"karma-opera-launcher": "^1.0.0",
|
|
26858
|
-
"karma-safari-launcher": "^1.0.0",
|
|
26859
|
-
"karma-sauce-launcher": "^1.2.0",
|
|
26860
|
-
"karma-sinon": "^1.0.5",
|
|
26861
|
-
"karma-sourcemap-loader": "^0.3.7",
|
|
26862
|
-
"karma-webpack": "^1.7.0",
|
|
26863
|
-
"load-grunt-tasks": "^3.5.2",
|
|
26864
|
-
minimist: "^1.2.0",
|
|
26865
|
-
mocha: "^5.2.0",
|
|
26866
|
-
sinon: "^4.5.0",
|
|
26867
|
-
typescript: "^2.8.1",
|
|
26868
|
-
"url-search-params": "^0.10.0",
|
|
26869
|
-
webpack: "^1.13.1",
|
|
26870
|
-
"webpack-dev-server": "^1.14.1"
|
|
26871
|
-
};
|
|
26872
|
-
var homepage = "https://github.com/axios/axios";
|
|
26873
|
-
var jsdelivr = "dist/axios.min.js";
|
|
26874
|
-
var keywords = [
|
|
26875
|
-
"xhr",
|
|
26876
|
-
"http",
|
|
26877
|
-
"ajax",
|
|
26878
|
-
"promise",
|
|
26879
|
-
"node"
|
|
26880
|
-
];
|
|
26881
|
-
var license = "MIT";
|
|
26882
|
-
var main = "index.js";
|
|
26883
|
-
var name = "axios";
|
|
26884
|
-
var repository = {
|
|
26885
|
-
type: "git",
|
|
26886
|
-
url: "git+https://github.com/axios/axios.git"
|
|
26887
|
-
};
|
|
26888
|
-
var scripts = {
|
|
26889
|
-
build: "NODE_ENV=production grunt build",
|
|
26890
|
-
coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
26891
|
-
examples: "node ./examples/server.js",
|
|
26892
|
-
fix: "eslint --fix lib/**/*.js",
|
|
26893
|
-
postversion: "git push && git push --tags",
|
|
26894
|
-
preversion: "npm test",
|
|
26895
|
-
start: "node ./sandbox/server.js",
|
|
26896
|
-
test: "grunt test && bundlesize",
|
|
26897
|
-
version: "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json"
|
|
26898
|
-
};
|
|
26899
|
-
var typings = "./index.d.ts";
|
|
26900
|
-
var unpkg = "dist/axios.min.js";
|
|
26901
|
-
var version = "0.21.0";
|
|
26902
|
-
var pkg = {
|
|
26903
|
-
_from: _from,
|
|
26904
|
-
_id: _id,
|
|
26905
|
-
_inBundle: _inBundle,
|
|
26906
|
-
_integrity: _integrity,
|
|
26907
|
-
_location: _location,
|
|
26908
|
-
_phantomChildren: _phantomChildren,
|
|
26909
|
-
_requested: _requested,
|
|
26910
|
-
_requiredBy: _requiredBy,
|
|
26911
|
-
_resolved: _resolved,
|
|
26912
|
-
_shasum: _shasum,
|
|
26913
|
-
_spec: _spec,
|
|
26914
|
-
_where: _where,
|
|
26915
|
-
author: author,
|
|
26916
|
-
browser: browser,
|
|
26917
|
-
bugs: bugs,
|
|
26918
|
-
bundleDependencies: bundleDependencies,
|
|
26919
|
-
bundlesize: bundlesize,
|
|
26920
|
-
dependencies: dependencies,
|
|
26921
|
-
deprecated: deprecated,
|
|
26922
|
-
description: description,
|
|
26923
|
-
devDependencies: devDependencies,
|
|
26924
|
-
homepage: homepage,
|
|
26925
|
-
jsdelivr: jsdelivr,
|
|
26926
|
-
keywords: keywords,
|
|
26927
|
-
license: license,
|
|
26928
|
-
main: main,
|
|
26929
|
-
name: name,
|
|
26930
|
-
repository: repository,
|
|
26931
|
-
scripts: scripts,
|
|
26932
|
-
typings: typings,
|
|
26933
|
-
unpkg: unpkg,
|
|
26934
|
-
version: version
|
|
26935
|
-
};
|
|
26936
|
-
|
|
26937
|
-
var httpFollow = followRedirects.http;
|
|
26938
|
-
var httpsFollow = followRedirects.https;
|
|
26939
|
-
|
|
26940
|
-
|
|
26941
|
-
|
|
26942
|
-
|
|
26943
|
-
|
|
26944
|
-
|
|
26945
|
-
var isHttps = /https:?/;
|
|
26946
|
-
|
|
26947
|
-
/*eslint consistent-return:0*/
|
|
26948
|
-
var http_1 = function httpAdapter(config) {
|
|
26949
|
-
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
|
26950
|
-
var resolve = function resolve(value) {
|
|
26951
|
-
resolvePromise(value);
|
|
26952
|
-
};
|
|
26953
|
-
var reject = function reject(value) {
|
|
26954
|
-
rejectPromise(value);
|
|
26955
|
-
};
|
|
26956
|
-
var data = config.data;
|
|
26957
|
-
var headers = config.headers;
|
|
26958
|
-
|
|
26959
|
-
// Set User-Agent (required by some servers)
|
|
26960
|
-
// Only set header if it hasn't been set in config
|
|
26961
|
-
// See https://github.com/axios/axios/issues/69
|
|
26962
|
-
if (!headers['User-Agent'] && !headers['user-agent']) {
|
|
26963
|
-
headers['User-Agent'] = 'axios/' + pkg.version;
|
|
26964
|
-
}
|
|
26965
|
-
|
|
26966
|
-
if (data && !utils.isStream(data)) {
|
|
26967
|
-
if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
|
|
26968
|
-
data = Buffer.from(new Uint8Array(data));
|
|
26969
|
-
} else if (utils.isString(data)) {
|
|
26970
|
-
data = Buffer.from(data, 'utf-8');
|
|
26971
|
-
} else {
|
|
26972
|
-
return reject(createError(
|
|
26973
|
-
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
|
26974
|
-
config
|
|
26975
|
-
));
|
|
26976
|
-
}
|
|
26977
|
-
|
|
26978
|
-
// Add Content-Length header if data exists
|
|
26979
|
-
headers['Content-Length'] = data.length;
|
|
26980
|
-
}
|
|
26981
|
-
|
|
26982
|
-
// HTTP basic authentication
|
|
26983
|
-
var auth = undefined;
|
|
26984
|
-
if (config.auth) {
|
|
26985
|
-
var username = config.auth.username || '';
|
|
26986
|
-
var password = config.auth.password || '';
|
|
26987
|
-
auth = username + ':' + password;
|
|
26988
|
-
}
|
|
26989
|
-
|
|
26990
|
-
// Parse url
|
|
26991
|
-
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
26992
|
-
var parsed = url__default["default"].parse(fullPath);
|
|
26993
|
-
var protocol = parsed.protocol || 'http:';
|
|
26994
|
-
|
|
26995
|
-
if (!auth && parsed.auth) {
|
|
26996
|
-
var urlAuth = parsed.auth.split(':');
|
|
26997
|
-
var urlUsername = urlAuth[0] || '';
|
|
26998
|
-
var urlPassword = urlAuth[1] || '';
|
|
26999
|
-
auth = urlUsername + ':' + urlPassword;
|
|
27000
|
-
}
|
|
27001
|
-
|
|
27002
|
-
if (auth) {
|
|
27003
|
-
delete headers.Authorization;
|
|
27004
|
-
}
|
|
27005
|
-
|
|
27006
|
-
var isHttpsRequest = isHttps.test(protocol);
|
|
27007
|
-
var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
|
|
27008
|
-
|
|
27009
|
-
var options = {
|
|
27010
|
-
path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
|
|
27011
|
-
method: config.method.toUpperCase(),
|
|
27012
|
-
headers: headers,
|
|
27013
|
-
agent: agent,
|
|
27014
|
-
agents: { http: config.httpAgent, https: config.httpsAgent },
|
|
27015
|
-
auth: auth
|
|
27016
|
-
};
|
|
27017
|
-
|
|
27018
|
-
if (config.socketPath) {
|
|
27019
|
-
options.socketPath = config.socketPath;
|
|
27020
|
-
} else {
|
|
27021
|
-
options.hostname = parsed.hostname;
|
|
27022
|
-
options.port = parsed.port;
|
|
27023
|
-
}
|
|
27024
|
-
|
|
27025
|
-
var proxy = config.proxy;
|
|
27026
|
-
if (!proxy && proxy !== false) {
|
|
27027
|
-
var proxyEnv = protocol.slice(0, -1) + '_proxy';
|
|
27028
|
-
var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
|
|
27029
|
-
if (proxyUrl) {
|
|
27030
|
-
var parsedProxyUrl = url__default["default"].parse(proxyUrl);
|
|
27031
|
-
var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
|
|
27032
|
-
var shouldProxy = true;
|
|
27033
|
-
|
|
27034
|
-
if (noProxyEnv) {
|
|
27035
|
-
var noProxy = noProxyEnv.split(',').map(function trim(s) {
|
|
27036
|
-
return s.trim();
|
|
27037
|
-
});
|
|
27038
|
-
|
|
27039
|
-
shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
|
|
27040
|
-
if (!proxyElement) {
|
|
27041
|
-
return false;
|
|
27042
|
-
}
|
|
27043
|
-
if (proxyElement === '*') {
|
|
27044
|
-
return true;
|
|
27045
|
-
}
|
|
27046
|
-
if (proxyElement[0] === '.' &&
|
|
27047
|
-
parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
|
|
27048
|
-
return true;
|
|
27049
|
-
}
|
|
27050
|
-
|
|
27051
|
-
return parsed.hostname === proxyElement;
|
|
27052
|
-
});
|
|
27053
|
-
}
|
|
27054
|
-
|
|
27055
|
-
|
|
27056
|
-
if (shouldProxy) {
|
|
27057
|
-
proxy = {
|
|
27058
|
-
host: parsedProxyUrl.hostname,
|
|
27059
|
-
port: parsedProxyUrl.port
|
|
27060
|
-
};
|
|
27061
|
-
|
|
27062
|
-
if (parsedProxyUrl.auth) {
|
|
27063
|
-
var proxyUrlAuth = parsedProxyUrl.auth.split(':');
|
|
27064
|
-
proxy.auth = {
|
|
27065
|
-
username: proxyUrlAuth[0],
|
|
27066
|
-
password: proxyUrlAuth[1]
|
|
27067
|
-
};
|
|
27068
|
-
}
|
|
27069
|
-
}
|
|
27070
|
-
}
|
|
27071
|
-
}
|
|
27072
|
-
|
|
27073
|
-
if (proxy) {
|
|
27074
|
-
options.hostname = proxy.host;
|
|
27075
|
-
options.host = proxy.host;
|
|
27076
|
-
options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
|
|
27077
|
-
options.port = proxy.port;
|
|
27078
|
-
options.path = protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path;
|
|
27079
|
-
|
|
27080
|
-
// Basic proxy authorization
|
|
27081
|
-
if (proxy.auth) {
|
|
27082
|
-
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
|
27083
|
-
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
|
27084
|
-
}
|
|
27085
|
-
}
|
|
27086
|
-
|
|
27087
|
-
var transport;
|
|
27088
|
-
var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
|
|
27089
|
-
if (config.transport) {
|
|
27090
|
-
transport = config.transport;
|
|
27091
|
-
} else if (config.maxRedirects === 0) {
|
|
27092
|
-
transport = isHttpsProxy ? https__default["default"] : http__default["default"];
|
|
27093
|
-
} else {
|
|
27094
|
-
if (config.maxRedirects) {
|
|
27095
|
-
options.maxRedirects = config.maxRedirects;
|
|
27096
|
-
}
|
|
27097
|
-
transport = isHttpsProxy ? httpsFollow : httpFollow;
|
|
27098
|
-
}
|
|
27099
|
-
|
|
27100
|
-
if (config.maxBodyLength > -1) {
|
|
27101
|
-
options.maxBodyLength = config.maxBodyLength;
|
|
27102
|
-
}
|
|
27103
|
-
|
|
27104
|
-
// Create the request
|
|
27105
|
-
var req = transport.request(options, function handleResponse(res) {
|
|
27106
|
-
if (req.aborted) return;
|
|
27107
|
-
|
|
27108
|
-
// uncompress the response body transparently if required
|
|
27109
|
-
var stream = res;
|
|
27110
|
-
|
|
27111
|
-
// return the last request in case of redirects
|
|
27112
|
-
var lastRequest = res.req || req;
|
|
27113
|
-
|
|
27114
|
-
|
|
27115
|
-
// if no content, is HEAD request or decompress disabled we should not decompress
|
|
27116
|
-
if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
|
|
27117
|
-
switch (res.headers['content-encoding']) {
|
|
27118
|
-
/*eslint default-case:0*/
|
|
27119
|
-
case 'gzip':
|
|
27120
|
-
case 'compress':
|
|
27121
|
-
case 'deflate':
|
|
27122
|
-
// add the unzipper to the body stream processing pipeline
|
|
27123
|
-
stream = stream.pipe(zlib__default["default"].createUnzip());
|
|
27124
|
-
|
|
27125
|
-
// remove the content-encoding in order to not confuse downstream operations
|
|
27126
|
-
delete res.headers['content-encoding'];
|
|
27127
|
-
break;
|
|
27128
|
-
}
|
|
27129
|
-
}
|
|
27130
|
-
|
|
27131
|
-
var response = {
|
|
27132
|
-
status: res.statusCode,
|
|
27133
|
-
statusText: res.statusMessage,
|
|
27134
|
-
headers: res.headers,
|
|
27135
|
-
config: config,
|
|
27136
|
-
request: lastRequest
|
|
27137
|
-
};
|
|
27138
|
-
|
|
27139
|
-
if (config.responseType === 'stream') {
|
|
27140
|
-
response.data = stream;
|
|
27141
|
-
settle(resolve, reject, response);
|
|
27142
|
-
} else {
|
|
27143
|
-
var responseBuffer = [];
|
|
27144
|
-
stream.on('data', function handleStreamData(chunk) {
|
|
27145
|
-
responseBuffer.push(chunk);
|
|
27146
|
-
|
|
27147
|
-
// make sure the content length is not over the maxContentLength if specified
|
|
27148
|
-
if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
|
|
27149
|
-
stream.destroy();
|
|
27150
|
-
reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
27151
|
-
config, null, lastRequest));
|
|
27152
|
-
}
|
|
27153
|
-
});
|
|
27154
|
-
|
|
27155
|
-
stream.on('error', function handleStreamError(err) {
|
|
27156
|
-
if (req.aborted) return;
|
|
27157
|
-
reject(enhanceError(err, config, null, lastRequest));
|
|
27158
|
-
});
|
|
27159
|
-
|
|
27160
|
-
stream.on('end', function handleStreamEnd() {
|
|
27161
|
-
var responseData = Buffer.concat(responseBuffer);
|
|
27162
|
-
if (config.responseType !== 'arraybuffer') {
|
|
27163
|
-
responseData = responseData.toString(config.responseEncoding);
|
|
27164
|
-
if (!config.responseEncoding || config.responseEncoding === 'utf8') {
|
|
27165
|
-
responseData = utils.stripBOM(responseData);
|
|
27166
|
-
}
|
|
27167
|
-
}
|
|
27168
|
-
|
|
27169
|
-
response.data = responseData;
|
|
27170
|
-
settle(resolve, reject, response);
|
|
27171
|
-
});
|
|
27172
|
-
}
|
|
27173
|
-
});
|
|
27174
|
-
|
|
27175
|
-
// Handle errors
|
|
27176
|
-
req.on('error', function handleRequestError(err) {
|
|
27177
|
-
if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
|
|
27178
|
-
reject(enhanceError(err, config, null, req));
|
|
27179
|
-
});
|
|
27180
|
-
|
|
27181
|
-
// Handle request timeout
|
|
27182
|
-
if (config.timeout) {
|
|
27183
|
-
// Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
|
|
27184
|
-
// And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
|
|
27185
|
-
// 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.
|
|
27186
|
-
// And then these socket which be hang up will devoring CPU little by little.
|
|
27187
|
-
// ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
|
|
27188
|
-
req.setTimeout(config.timeout, function handleRequestTimeout() {
|
|
27189
|
-
req.abort();
|
|
27190
|
-
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
|
|
27191
|
-
});
|
|
27192
|
-
}
|
|
27193
|
-
|
|
27194
|
-
if (config.cancelToken) {
|
|
27195
|
-
// Handle cancellation
|
|
27196
|
-
config.cancelToken.promise.then(function onCanceled(cancel) {
|
|
27197
|
-
if (req.aborted) return;
|
|
27198
|
-
|
|
27199
|
-
req.abort();
|
|
27200
|
-
reject(cancel);
|
|
27201
|
-
});
|
|
27202
|
-
}
|
|
27203
|
-
|
|
27204
|
-
// Send the request
|
|
27205
|
-
if (utils.isStream(data)) {
|
|
27206
|
-
data.on('error', function handleStreamError(err) {
|
|
27207
|
-
reject(enhanceError(err, config, null, req));
|
|
27208
|
-
}).pipe(req);
|
|
27209
|
-
} else {
|
|
27210
|
-
req.end(data);
|
|
27211
|
-
}
|
|
27212
|
-
});
|
|
27213
|
-
};
|
|
27214
|
-
|
|
27215
|
-
var DEFAULT_CONTENT_TYPE = {
|
|
27216
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
27217
|
-
};
|
|
27218
|
-
|
|
27219
|
-
function setContentTypeIfUnset(headers, value) {
|
|
27220
|
-
if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
|
|
27221
|
-
headers['Content-Type'] = value;
|
|
27222
|
-
}
|
|
27223
|
-
}
|
|
27224
|
-
|
|
27225
|
-
function getDefaultAdapter() {
|
|
27226
|
-
var adapter;
|
|
27227
|
-
if (typeof XMLHttpRequest !== 'undefined') {
|
|
27228
|
-
// For browsers use XHR adapter
|
|
27229
|
-
adapter = xhr;
|
|
27230
|
-
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
|
27231
|
-
// For node use HTTP adapter
|
|
27232
|
-
adapter = http_1;
|
|
27233
|
-
}
|
|
27234
|
-
return adapter;
|
|
27235
|
-
}
|
|
27236
|
-
|
|
27237
|
-
var defaults = {
|
|
27238
|
-
adapter: getDefaultAdapter(),
|
|
27239
|
-
|
|
27240
|
-
transformRequest: [function transformRequest(data, headers) {
|
|
27241
|
-
normalizeHeaderName(headers, 'Accept');
|
|
27242
|
-
normalizeHeaderName(headers, 'Content-Type');
|
|
27243
|
-
if (utils.isFormData(data) ||
|
|
27244
|
-
utils.isArrayBuffer(data) ||
|
|
27245
|
-
utils.isBuffer(data) ||
|
|
27246
|
-
utils.isStream(data) ||
|
|
27247
|
-
utils.isFile(data) ||
|
|
27248
|
-
utils.isBlob(data)
|
|
27249
|
-
) {
|
|
27250
|
-
return data;
|
|
27251
|
-
}
|
|
27252
|
-
if (utils.isArrayBufferView(data)) {
|
|
27253
|
-
return data.buffer;
|
|
27254
|
-
}
|
|
27255
|
-
if (utils.isURLSearchParams(data)) {
|
|
27256
|
-
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
27257
|
-
return data.toString();
|
|
27258
|
-
}
|
|
27259
|
-
if (utils.isObject(data)) {
|
|
27260
|
-
setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
|
|
27261
|
-
return JSON.stringify(data);
|
|
27262
|
-
}
|
|
27263
|
-
return data;
|
|
27264
|
-
}],
|
|
27265
|
-
|
|
27266
|
-
transformResponse: [function transformResponse(data) {
|
|
27267
|
-
/*eslint no-param-reassign:0*/
|
|
27268
|
-
if (typeof data === 'string') {
|
|
27269
|
-
try {
|
|
27270
|
-
data = JSON.parse(data);
|
|
27271
|
-
} catch (e) { /* Ignore */ }
|
|
27272
|
-
}
|
|
27273
|
-
return data;
|
|
27274
|
-
}],
|
|
27275
|
-
|
|
27276
|
-
/**
|
|
27277
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
27278
|
-
* timeout is not created.
|
|
27279
|
-
*/
|
|
27280
|
-
timeout: 0,
|
|
27281
|
-
|
|
27282
|
-
xsrfCookieName: 'XSRF-TOKEN',
|
|
27283
|
-
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
27284
|
-
|
|
27285
|
-
maxContentLength: -1,
|
|
27286
|
-
maxBodyLength: -1,
|
|
27287
|
-
|
|
27288
|
-
validateStatus: function validateStatus(status) {
|
|
27289
|
-
return status >= 200 && status < 300;
|
|
27290
|
-
}
|
|
27291
|
-
};
|
|
27292
|
-
|
|
27293
|
-
defaults.headers = {
|
|
27294
|
-
common: {
|
|
27295
|
-
'Accept': 'application/json, text/plain, */*'
|
|
27296
|
-
}
|
|
27297
|
-
};
|
|
27298
|
-
|
|
27299
|
-
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
27300
|
-
defaults.headers[method] = {};
|
|
27301
|
-
});
|
|
27302
|
-
|
|
27303
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
27304
|
-
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
27305
|
-
});
|
|
27306
|
-
|
|
27307
|
-
var defaults_1 = defaults;
|
|
27308
|
-
|
|
27309
|
-
/**
|
|
27310
|
-
* Throws a `Cancel` if cancellation has been requested.
|
|
27311
|
-
*/
|
|
27312
|
-
function throwIfCancellationRequested(config) {
|
|
27313
|
-
if (config.cancelToken) {
|
|
27314
|
-
config.cancelToken.throwIfRequested();
|
|
27315
|
-
}
|
|
27316
|
-
}
|
|
27317
|
-
|
|
27318
|
-
/**
|
|
27319
|
-
* Dispatch a request to the server using the configured adapter.
|
|
27320
|
-
*
|
|
27321
|
-
* @param {object} config The config that is to be used for the request
|
|
27322
|
-
* @returns {Promise} The Promise to be fulfilled
|
|
27323
|
-
*/
|
|
27324
|
-
var dispatchRequest = function dispatchRequest(config) {
|
|
27325
|
-
throwIfCancellationRequested(config);
|
|
27326
|
-
|
|
27327
|
-
// Ensure headers exist
|
|
27328
|
-
config.headers = config.headers || {};
|
|
27329
|
-
|
|
27330
|
-
// Transform request data
|
|
27331
|
-
config.data = transformData(
|
|
27332
|
-
config.data,
|
|
27333
|
-
config.headers,
|
|
27334
|
-
config.transformRequest
|
|
27335
|
-
);
|
|
27336
|
-
|
|
27337
|
-
// Flatten headers
|
|
27338
|
-
config.headers = utils.merge(
|
|
27339
|
-
config.headers.common || {},
|
|
27340
|
-
config.headers[config.method] || {},
|
|
27341
|
-
config.headers
|
|
27342
|
-
);
|
|
27343
|
-
|
|
27344
|
-
utils.forEach(
|
|
27345
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
27346
|
-
function cleanHeaderConfig(method) {
|
|
27347
|
-
delete config.headers[method];
|
|
27348
|
-
}
|
|
27349
|
-
);
|
|
27350
|
-
|
|
27351
|
-
var adapter = config.adapter || defaults_1.adapter;
|
|
27352
|
-
|
|
27353
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
27354
|
-
throwIfCancellationRequested(config);
|
|
27355
|
-
|
|
27356
|
-
// Transform response data
|
|
27357
|
-
response.data = transformData(
|
|
27358
|
-
response.data,
|
|
27359
|
-
response.headers,
|
|
27360
|
-
config.transformResponse
|
|
27361
|
-
);
|
|
27362
|
-
|
|
27363
|
-
return response;
|
|
27364
|
-
}, function onAdapterRejection(reason) {
|
|
27365
|
-
if (!isCancel(reason)) {
|
|
27366
|
-
throwIfCancellationRequested(config);
|
|
27367
|
-
|
|
27368
|
-
// Transform response data
|
|
27369
|
-
if (reason && reason.response) {
|
|
27370
|
-
reason.response.data = transformData(
|
|
27371
|
-
reason.response.data,
|
|
27372
|
-
reason.response.headers,
|
|
27373
|
-
config.transformResponse
|
|
27374
|
-
);
|
|
27375
|
-
}
|
|
27376
|
-
}
|
|
27377
|
-
|
|
27378
|
-
return Promise.reject(reason);
|
|
27379
|
-
});
|
|
27380
|
-
};
|
|
27381
|
-
|
|
27382
|
-
/**
|
|
27383
|
-
* Config-specific merge-function which creates a new config-object
|
|
27384
|
-
* by merging two configuration objects together.
|
|
27385
|
-
*
|
|
27386
|
-
* @param {Object} config1
|
|
27387
|
-
* @param {Object} config2
|
|
27388
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
27389
|
-
*/
|
|
27390
|
-
var mergeConfig = function mergeConfig(config1, config2) {
|
|
27391
|
-
// eslint-disable-next-line no-param-reassign
|
|
27392
|
-
config2 = config2 || {};
|
|
27393
|
-
var config = {};
|
|
27394
|
-
|
|
27395
|
-
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
|
27396
|
-
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
|
27397
|
-
var defaultToConfig2Keys = [
|
|
27398
|
-
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
|
27399
|
-
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
|
27400
|
-
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
|
27401
|
-
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
|
27402
|
-
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
|
27403
|
-
];
|
|
27404
|
-
var directMergeKeys = ['validateStatus'];
|
|
27405
|
-
|
|
27406
|
-
function getMergedValue(target, source) {
|
|
27407
|
-
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
27408
|
-
return utils.merge(target, source);
|
|
27409
|
-
} else if (utils.isPlainObject(source)) {
|
|
27410
|
-
return utils.merge({}, source);
|
|
27411
|
-
} else if (utils.isArray(source)) {
|
|
27412
|
-
return source.slice();
|
|
27413
|
-
}
|
|
27414
|
-
return source;
|
|
27415
|
-
}
|
|
27416
|
-
|
|
27417
|
-
function mergeDeepProperties(prop) {
|
|
27418
|
-
if (!utils.isUndefined(config2[prop])) {
|
|
27419
|
-
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
27420
|
-
} else if (!utils.isUndefined(config1[prop])) {
|
|
27421
|
-
config[prop] = getMergedValue(undefined, config1[prop]);
|
|
27422
|
-
}
|
|
27423
|
-
}
|
|
27424
|
-
|
|
27425
|
-
utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
|
27426
|
-
if (!utils.isUndefined(config2[prop])) {
|
|
27427
|
-
config[prop] = getMergedValue(undefined, config2[prop]);
|
|
27428
|
-
}
|
|
27429
|
-
});
|
|
27430
|
-
|
|
27431
|
-
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
27432
|
-
|
|
27433
|
-
utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
|
27434
|
-
if (!utils.isUndefined(config2[prop])) {
|
|
27435
|
-
config[prop] = getMergedValue(undefined, config2[prop]);
|
|
27436
|
-
} else if (!utils.isUndefined(config1[prop])) {
|
|
27437
|
-
config[prop] = getMergedValue(undefined, config1[prop]);
|
|
27438
|
-
}
|
|
27439
|
-
});
|
|
27440
|
-
|
|
27441
|
-
utils.forEach(directMergeKeys, function merge(prop) {
|
|
27442
|
-
if (prop in config2) {
|
|
27443
|
-
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
27444
|
-
} else if (prop in config1) {
|
|
27445
|
-
config[prop] = getMergedValue(undefined, config1[prop]);
|
|
27446
|
-
}
|
|
27447
|
-
});
|
|
27448
|
-
|
|
27449
|
-
var axiosKeys = valueFromConfig2Keys
|
|
27450
|
-
.concat(mergeDeepPropertiesKeys)
|
|
27451
|
-
.concat(defaultToConfig2Keys)
|
|
27452
|
-
.concat(directMergeKeys);
|
|
27453
|
-
|
|
27454
|
-
var otherKeys = Object
|
|
27455
|
-
.keys(config1)
|
|
27456
|
-
.concat(Object.keys(config2))
|
|
27457
|
-
.filter(function filterAxiosKeys(key) {
|
|
27458
|
-
return axiosKeys.indexOf(key) === -1;
|
|
27459
|
-
});
|
|
27460
|
-
|
|
27461
|
-
utils.forEach(otherKeys, mergeDeepProperties);
|
|
27462
|
-
|
|
27463
|
-
return config;
|
|
27464
|
-
};
|
|
27465
|
-
|
|
27466
|
-
/**
|
|
27467
|
-
* Create a new instance of Axios
|
|
27468
|
-
*
|
|
27469
|
-
* @param {Object} instanceConfig The default config for the instance
|
|
27470
|
-
*/
|
|
27471
|
-
function Axios(instanceConfig) {
|
|
27472
|
-
this.defaults = instanceConfig;
|
|
27473
|
-
this.interceptors = {
|
|
27474
|
-
request: new InterceptorManager_1(),
|
|
27475
|
-
response: new InterceptorManager_1()
|
|
27476
|
-
};
|
|
27477
|
-
}
|
|
27478
|
-
|
|
27479
|
-
/**
|
|
27480
|
-
* Dispatch a request
|
|
27481
|
-
*
|
|
27482
|
-
* @param {Object} config The config specific for this request (merged with this.defaults)
|
|
27483
|
-
*/
|
|
27484
|
-
Axios.prototype.request = function request(config) {
|
|
27485
|
-
/*eslint no-param-reassign:0*/
|
|
27486
|
-
// Allow for axios('example/url'[, config]) a la fetch API
|
|
27487
|
-
if (typeof config === 'string') {
|
|
27488
|
-
config = arguments[1] || {};
|
|
27489
|
-
config.url = arguments[0];
|
|
27490
|
-
} else {
|
|
27491
|
-
config = config || {};
|
|
27492
|
-
}
|
|
27493
|
-
|
|
27494
|
-
config = mergeConfig(this.defaults, config);
|
|
27495
|
-
|
|
27496
|
-
// Set config.method
|
|
27497
|
-
if (config.method) {
|
|
27498
|
-
config.method = config.method.toLowerCase();
|
|
27499
|
-
} else if (this.defaults.method) {
|
|
27500
|
-
config.method = this.defaults.method.toLowerCase();
|
|
27501
|
-
} else {
|
|
27502
|
-
config.method = 'get';
|
|
27503
|
-
}
|
|
27504
|
-
|
|
27505
|
-
// Hook up interceptors middleware
|
|
27506
|
-
var chain = [dispatchRequest, undefined];
|
|
27507
|
-
var promise = Promise.resolve(config);
|
|
27508
|
-
|
|
27509
|
-
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
27510
|
-
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
27511
|
-
});
|
|
27512
|
-
|
|
27513
|
-
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
27514
|
-
chain.push(interceptor.fulfilled, interceptor.rejected);
|
|
27515
|
-
});
|
|
27516
|
-
|
|
27517
|
-
while (chain.length) {
|
|
27518
|
-
promise = promise.then(chain.shift(), chain.shift());
|
|
27519
|
-
}
|
|
27520
|
-
|
|
27521
|
-
return promise;
|
|
27522
|
-
};
|
|
27523
|
-
|
|
27524
|
-
Axios.prototype.getUri = function getUri(config) {
|
|
27525
|
-
config = mergeConfig(this.defaults, config);
|
|
27526
|
-
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
|
27527
|
-
};
|
|
27528
|
-
|
|
27529
|
-
// Provide aliases for supported request methods
|
|
27530
|
-
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
27531
|
-
/*eslint func-names:0*/
|
|
27532
|
-
Axios.prototype[method] = function(url, config) {
|
|
27533
|
-
return this.request(mergeConfig(config || {}, {
|
|
27534
|
-
method: method,
|
|
27535
|
-
url: url,
|
|
27536
|
-
data: (config || {}).data
|
|
27537
|
-
}));
|
|
27538
|
-
};
|
|
27539
|
-
});
|
|
27540
|
-
|
|
27541
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
27542
|
-
/*eslint func-names:0*/
|
|
27543
|
-
Axios.prototype[method] = function(url, data, config) {
|
|
27544
|
-
return this.request(mergeConfig(config || {}, {
|
|
27545
|
-
method: method,
|
|
27546
|
-
url: url,
|
|
27547
|
-
data: data
|
|
27548
|
-
}));
|
|
27549
|
-
};
|
|
27550
|
-
});
|
|
27551
|
-
|
|
27552
|
-
var Axios_1 = Axios;
|
|
27553
|
-
|
|
27554
|
-
/**
|
|
27555
|
-
* A `Cancel` is an object that is thrown when an operation is canceled.
|
|
27556
|
-
*
|
|
27557
|
-
* @class
|
|
27558
|
-
* @param {string=} message The message.
|
|
27559
|
-
*/
|
|
27560
|
-
function Cancel(message) {
|
|
27561
|
-
this.message = message;
|
|
27562
|
-
}
|
|
27563
|
-
|
|
27564
|
-
Cancel.prototype.toString = function toString() {
|
|
27565
|
-
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
|
27566
|
-
};
|
|
27567
|
-
|
|
27568
|
-
Cancel.prototype.__CANCEL__ = true;
|
|
27569
|
-
|
|
27570
|
-
var Cancel_1 = Cancel;
|
|
27571
|
-
|
|
27572
|
-
/**
|
|
27573
|
-
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
27574
|
-
*
|
|
27575
|
-
* @class
|
|
27576
|
-
* @param {Function} executor The executor function.
|
|
27577
|
-
*/
|
|
27578
|
-
function CancelToken(executor) {
|
|
27579
|
-
if (typeof executor !== 'function') {
|
|
27580
|
-
throw new TypeError('executor must be a function.');
|
|
27581
|
-
}
|
|
27582
|
-
|
|
27583
|
-
var resolvePromise;
|
|
27584
|
-
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
27585
|
-
resolvePromise = resolve;
|
|
27586
|
-
});
|
|
27587
|
-
|
|
27588
|
-
var token = this;
|
|
27589
|
-
executor(function cancel(message) {
|
|
27590
|
-
if (token.reason) {
|
|
27591
|
-
// Cancellation has already been requested
|
|
27592
|
-
return;
|
|
27593
|
-
}
|
|
27594
|
-
|
|
27595
|
-
token.reason = new Cancel_1(message);
|
|
27596
|
-
resolvePromise(token.reason);
|
|
27597
|
-
});
|
|
27598
|
-
}
|
|
27599
|
-
|
|
27600
|
-
/**
|
|
27601
|
-
* Throws a `Cancel` if cancellation has been requested.
|
|
27602
|
-
*/
|
|
27603
|
-
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
27604
|
-
if (this.reason) {
|
|
27605
|
-
throw this.reason;
|
|
27606
|
-
}
|
|
27607
|
-
};
|
|
27608
|
-
|
|
27609
|
-
/**
|
|
27610
|
-
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
27611
|
-
* cancels the `CancelToken`.
|
|
27612
|
-
*/
|
|
27613
|
-
CancelToken.source = function source() {
|
|
27614
|
-
var cancel;
|
|
27615
|
-
var token = new CancelToken(function executor(c) {
|
|
27616
|
-
cancel = c;
|
|
27617
|
-
});
|
|
27618
|
-
return {
|
|
27619
|
-
token: token,
|
|
27620
|
-
cancel: cancel
|
|
27621
|
-
};
|
|
27622
|
-
};
|
|
27623
|
-
|
|
27624
|
-
var CancelToken_1 = CancelToken;
|
|
27625
|
-
|
|
27626
|
-
/**
|
|
27627
|
-
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
27628
|
-
*
|
|
27629
|
-
* Common use case would be to use `Function.prototype.apply`.
|
|
27630
|
-
*
|
|
27631
|
-
* ```js
|
|
27632
|
-
* function f(x, y, z) {}
|
|
27633
|
-
* var args = [1, 2, 3];
|
|
27634
|
-
* f.apply(null, args);
|
|
27635
|
-
* ```
|
|
27636
|
-
*
|
|
27637
|
-
* With `spread` this example can be re-written.
|
|
27638
|
-
*
|
|
27639
|
-
* ```js
|
|
27640
|
-
* spread(function(x, y, z) {})([1, 2, 3]);
|
|
27641
|
-
* ```
|
|
27642
|
-
*
|
|
27643
|
-
* @param {Function} callback
|
|
27644
|
-
* @returns {Function}
|
|
27645
|
-
*/
|
|
27646
|
-
var spread = function spread(callback) {
|
|
27647
|
-
return function wrap(arr) {
|
|
27648
|
-
return callback.apply(null, arr);
|
|
27649
|
-
};
|
|
27650
|
-
};
|
|
27651
|
-
|
|
27652
|
-
/**
|
|
27653
|
-
* Create an instance of Axios
|
|
27654
|
-
*
|
|
27655
|
-
* @param {Object} defaultConfig The default config for the instance
|
|
27656
|
-
* @return {Axios} A new instance of Axios
|
|
27657
|
-
*/
|
|
27658
|
-
function createInstance(defaultConfig) {
|
|
27659
|
-
var context = new Axios_1(defaultConfig);
|
|
27660
|
-
var instance = bind(Axios_1.prototype.request, context);
|
|
27661
|
-
|
|
27662
|
-
// Copy axios.prototype to instance
|
|
27663
|
-
utils.extend(instance, Axios_1.prototype, context);
|
|
27664
|
-
|
|
27665
|
-
// Copy context to instance
|
|
27666
|
-
utils.extend(instance, context);
|
|
27667
|
-
|
|
27668
|
-
return instance;
|
|
27669
|
-
}
|
|
27670
|
-
|
|
27671
|
-
// Create the default instance to be exported
|
|
27672
|
-
var axios$1 = createInstance(defaults_1);
|
|
27673
|
-
|
|
27674
|
-
// Expose Axios class to allow class inheritance
|
|
27675
|
-
axios$1.Axios = Axios_1;
|
|
27676
|
-
|
|
27677
|
-
// Factory for creating new instances
|
|
27678
|
-
axios$1.create = function create(instanceConfig) {
|
|
27679
|
-
return createInstance(mergeConfig(axios$1.defaults, instanceConfig));
|
|
27680
|
-
};
|
|
27681
|
-
|
|
27682
|
-
// Expose Cancel & CancelToken
|
|
27683
|
-
axios$1.Cancel = Cancel_1;
|
|
27684
|
-
axios$1.CancelToken = CancelToken_1;
|
|
27685
|
-
axios$1.isCancel = isCancel;
|
|
27686
|
-
|
|
27687
|
-
// Expose all/spread
|
|
27688
|
-
axios$1.all = function all(promises) {
|
|
27689
|
-
return Promise.all(promises);
|
|
27690
|
-
};
|
|
27691
|
-
axios$1.spread = spread;
|
|
27692
|
-
|
|
27693
|
-
var axios_1 = axios$1;
|
|
27694
|
-
|
|
27695
|
-
// Allow use of default import syntax in TypeScript
|
|
27696
|
-
var _default = axios$1;
|
|
27697
|
-
axios_1.default = _default;
|
|
27698
|
-
|
|
27699
|
-
var axios = axios_1;
|
|
27700
|
-
|
|
24004
|
+
async function requestJson(url, init) {
|
|
24005
|
+
const timeout = init?.timeout ?? 8000;
|
|
24006
|
+
const controller = new AbortController();
|
|
24007
|
+
const timer = window.setTimeout(() => controller.abort(), timeout);
|
|
24008
|
+
const { timeout: _timeout, ...fetchInit } = init ?? {};
|
|
24009
|
+
try {
|
|
24010
|
+
const res = await fetch(url, { ...fetchInit, signal: controller.signal });
|
|
24011
|
+
const data = (await res.json());
|
|
24012
|
+
return { status: res.status, data };
|
|
24013
|
+
}
|
|
24014
|
+
finally {
|
|
24015
|
+
window.clearTimeout(timer);
|
|
24016
|
+
}
|
|
24017
|
+
}
|
|
27701
24018
|
var script$g = vue.defineComponent({
|
|
27702
24019
|
name: 'uni-barrage',
|
|
27703
24020
|
props: {
|
|
@@ -27763,7 +24080,7 @@
|
|
|
27763
24080
|
});
|
|
27764
24081
|
const initBullets = async () => {
|
|
27765
24082
|
try {
|
|
27766
|
-
const res = await
|
|
24083
|
+
const res = await requestJson(host + '/api/barrage/' + props.global.sceneId);
|
|
27767
24084
|
if (res.status === 200 && res.data.error === 0) {
|
|
27768
24085
|
praiseCount.value = res.data.data[0] && res.data.data[0].praiseCount ? res.data.data[0].praiseCount : 0;
|
|
27769
24086
|
bulletList.value.push(...res.data.data[0].barrageContents.map((bullet, index) => ({
|
|
@@ -27880,11 +24197,14 @@
|
|
|
27880
24197
|
praiseCount.value += 1;
|
|
27881
24198
|
isPraised.value = true;
|
|
27882
24199
|
}
|
|
27883
|
-
await
|
|
27884
|
-
|
|
27885
|
-
|
|
27886
|
-
|
|
27887
|
-
|
|
24200
|
+
await requestJson(host + '/api/praiseCount/', {
|
|
24201
|
+
method: 'POST',
|
|
24202
|
+
headers: { 'Content-Type': 'application/json' },
|
|
24203
|
+
body: JSON.stringify({
|
|
24204
|
+
sceneId: props.global.sceneId,
|
|
24205
|
+
praiseCount: praiseCount.value,
|
|
24206
|
+
}),
|
|
24207
|
+
timeout: 8000,
|
|
27888
24208
|
});
|
|
27889
24209
|
};
|
|
27890
24210
|
const submitBlessing = async () => {
|
|
@@ -27899,11 +24219,15 @@
|
|
|
27899
24219
|
return;
|
|
27900
24220
|
}
|
|
27901
24221
|
try {
|
|
27902
|
-
const res = await
|
|
27903
|
-
|
|
27904
|
-
|
|
27905
|
-
|
|
27906
|
-
|
|
24222
|
+
const res = await requestJson(host + '/api/barrage/', {
|
|
24223
|
+
method: 'POST',
|
|
24224
|
+
headers: { 'Content-Type': 'application/json' },
|
|
24225
|
+
body: JSON.stringify({
|
|
24226
|
+
sceneId: props.global.sceneId,
|
|
24227
|
+
name: trimmedName,
|
|
24228
|
+
content: trimmedMessage,
|
|
24229
|
+
}),
|
|
24230
|
+
timeout: 8000,
|
|
27907
24231
|
});
|
|
27908
24232
|
if (res.status === 200 && res.data.error === 0) {
|
|
27909
24233
|
addBullet(trimmedName, trimmedMessage);
|