@gbozee/ultimate 0.0.2-156 → 0.0.2-157
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/index.cjs +3053 -37
- package/dist/index.d.ts +9 -1
- package/dist/index.js +3053 -37
- package/dist/mcp-server.cjs +3053 -37
- package/dist/mcp-server.js +3053 -37
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -27080,7 +27080,7 @@ var require_follow_redirects = __commonJS((exports2, module2) => {
|
|
|
27080
27080
|
module2.exports.wrap = wrap3;
|
|
27081
27081
|
});
|
|
27082
27082
|
|
|
27083
|
-
// node_modules/axios/dist/node/axios.cjs
|
|
27083
|
+
// node_modules/binance/node_modules/axios/dist/node/axios.cjs
|
|
27084
27084
|
var require_axios = __commonJS((exports2, module2) => {
|
|
27085
27085
|
/*! Axios v1.8.4 Copyright (c) 2025 Matt Zabriskie and contributors */
|
|
27086
27086
|
var FormData$1 = require_form_data();
|
|
@@ -38487,6 +38487,3000 @@ var require_p_limit = __commonJS((exports2, module2) => {
|
|
|
38487
38487
|
module2.exports.default = pLimit;
|
|
38488
38488
|
});
|
|
38489
38489
|
|
|
38490
|
+
// node_modules/bybit-api/node_modules/axios/dist/node/axios.cjs
|
|
38491
|
+
var require_axios2 = __commonJS((exports2, module2) => {
|
|
38492
|
+
/*! Axios v1.8.4 Copyright (c) 2025 Matt Zabriskie and contributors */
|
|
38493
|
+
var FormData$1 = require_form_data();
|
|
38494
|
+
var crypto4 = require("crypto");
|
|
38495
|
+
var url = require("url");
|
|
38496
|
+
var proxyFromEnv = require_proxy_from_env();
|
|
38497
|
+
var http2 = require("http");
|
|
38498
|
+
var https2 = require("https");
|
|
38499
|
+
var util4 = require("util");
|
|
38500
|
+
var followRedirects = require_follow_redirects();
|
|
38501
|
+
var zlib = require("zlib");
|
|
38502
|
+
var stream2 = require("stream");
|
|
38503
|
+
var events = require("events");
|
|
38504
|
+
function _interopDefaultLegacy(e2) {
|
|
38505
|
+
return e2 && typeof e2 === "object" && "default" in e2 ? e2 : { default: e2 };
|
|
38506
|
+
}
|
|
38507
|
+
var FormData__default = /* @__PURE__ */ _interopDefaultLegacy(FormData$1);
|
|
38508
|
+
var crypto__default = /* @__PURE__ */ _interopDefaultLegacy(crypto4);
|
|
38509
|
+
var url__default = /* @__PURE__ */ _interopDefaultLegacy(url);
|
|
38510
|
+
var proxyFromEnv__default = /* @__PURE__ */ _interopDefaultLegacy(proxyFromEnv);
|
|
38511
|
+
var http__default = /* @__PURE__ */ _interopDefaultLegacy(http2);
|
|
38512
|
+
var https__default = /* @__PURE__ */ _interopDefaultLegacy(https2);
|
|
38513
|
+
var util__default = /* @__PURE__ */ _interopDefaultLegacy(util4);
|
|
38514
|
+
var followRedirects__default = /* @__PURE__ */ _interopDefaultLegacy(followRedirects);
|
|
38515
|
+
var zlib__default = /* @__PURE__ */ _interopDefaultLegacy(zlib);
|
|
38516
|
+
var stream__default = /* @__PURE__ */ _interopDefaultLegacy(stream2);
|
|
38517
|
+
function bind(fn, thisArg) {
|
|
38518
|
+
return function wrap() {
|
|
38519
|
+
return fn.apply(thisArg, arguments);
|
|
38520
|
+
};
|
|
38521
|
+
}
|
|
38522
|
+
var { toString } = Object.prototype;
|
|
38523
|
+
var { getPrototypeOf } = Object;
|
|
38524
|
+
var kindOf = ((cache2) => (thing) => {
|
|
38525
|
+
const str = toString.call(thing);
|
|
38526
|
+
return cache2[str] || (cache2[str] = str.slice(8, -1).toLowerCase());
|
|
38527
|
+
})(Object.create(null));
|
|
38528
|
+
var kindOfTest = (type) => {
|
|
38529
|
+
type = type.toLowerCase();
|
|
38530
|
+
return (thing) => kindOf(thing) === type;
|
|
38531
|
+
};
|
|
38532
|
+
var typeOfTest = (type) => (thing) => typeof thing === type;
|
|
38533
|
+
var { isArray: isArray3 } = Array;
|
|
38534
|
+
var isUndefined3 = typeOfTest("undefined");
|
|
38535
|
+
function isBuffer(val) {
|
|
38536
|
+
return val !== null && !isUndefined3(val) && val.constructor !== null && !isUndefined3(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
38537
|
+
}
|
|
38538
|
+
var isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
38539
|
+
function isArrayBufferView(val) {
|
|
38540
|
+
let result;
|
|
38541
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
38542
|
+
result = ArrayBuffer.isView(val);
|
|
38543
|
+
} else {
|
|
38544
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
38545
|
+
}
|
|
38546
|
+
return result;
|
|
38547
|
+
}
|
|
38548
|
+
var isString2 = typeOfTest("string");
|
|
38549
|
+
var isFunction = typeOfTest("function");
|
|
38550
|
+
var isNumber2 = typeOfTest("number");
|
|
38551
|
+
var isObject2 = (thing) => thing !== null && typeof thing === "object";
|
|
38552
|
+
var isBoolean2 = (thing) => thing === true || thing === false;
|
|
38553
|
+
var isPlainObject3 = (val) => {
|
|
38554
|
+
if (kindOf(val) !== "object") {
|
|
38555
|
+
return false;
|
|
38556
|
+
}
|
|
38557
|
+
const prototype2 = getPrototypeOf(val);
|
|
38558
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
38559
|
+
};
|
|
38560
|
+
var isDate2 = kindOfTest("Date");
|
|
38561
|
+
var isFile2 = kindOfTest("File");
|
|
38562
|
+
var isBlob = kindOfTest("Blob");
|
|
38563
|
+
var isFileList = kindOfTest("FileList");
|
|
38564
|
+
var isStream = (val) => isObject2(val) && isFunction(val.pipe);
|
|
38565
|
+
var isFormData2 = (thing) => {
|
|
38566
|
+
let kind;
|
|
38567
|
+
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
|
|
38568
|
+
};
|
|
38569
|
+
var isURLSearchParams = kindOfTest("URLSearchParams");
|
|
38570
|
+
var [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
|
|
38571
|
+
var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
38572
|
+
function forEach2(obj, fn, { allOwnKeys = false } = {}) {
|
|
38573
|
+
if (obj === null || typeof obj === "undefined") {
|
|
38574
|
+
return;
|
|
38575
|
+
}
|
|
38576
|
+
let i2;
|
|
38577
|
+
let l;
|
|
38578
|
+
if (typeof obj !== "object") {
|
|
38579
|
+
obj = [obj];
|
|
38580
|
+
}
|
|
38581
|
+
if (isArray3(obj)) {
|
|
38582
|
+
for (i2 = 0, l = obj.length;i2 < l; i2++) {
|
|
38583
|
+
fn.call(null, obj[i2], i2, obj);
|
|
38584
|
+
}
|
|
38585
|
+
} else {
|
|
38586
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
38587
|
+
const len = keys.length;
|
|
38588
|
+
let key;
|
|
38589
|
+
for (i2 = 0;i2 < len; i2++) {
|
|
38590
|
+
key = keys[i2];
|
|
38591
|
+
fn.call(null, obj[key], key, obj);
|
|
38592
|
+
}
|
|
38593
|
+
}
|
|
38594
|
+
}
|
|
38595
|
+
function findKey(obj, key) {
|
|
38596
|
+
key = key.toLowerCase();
|
|
38597
|
+
const keys = Object.keys(obj);
|
|
38598
|
+
let i2 = keys.length;
|
|
38599
|
+
let _key;
|
|
38600
|
+
while (i2-- > 0) {
|
|
38601
|
+
_key = keys[i2];
|
|
38602
|
+
if (key === _key.toLowerCase()) {
|
|
38603
|
+
return _key;
|
|
38604
|
+
}
|
|
38605
|
+
}
|
|
38606
|
+
return null;
|
|
38607
|
+
}
|
|
38608
|
+
var _global2 = (() => {
|
|
38609
|
+
if (typeof globalThis !== "undefined")
|
|
38610
|
+
return globalThis;
|
|
38611
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
38612
|
+
})();
|
|
38613
|
+
var isContextDefined = (context3) => !isUndefined3(context3) && context3 !== _global2;
|
|
38614
|
+
function merge() {
|
|
38615
|
+
const { caseless } = isContextDefined(this) && this || {};
|
|
38616
|
+
const result = {};
|
|
38617
|
+
const assignValue = (val, key) => {
|
|
38618
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
38619
|
+
if (isPlainObject3(result[targetKey]) && isPlainObject3(val)) {
|
|
38620
|
+
result[targetKey] = merge(result[targetKey], val);
|
|
38621
|
+
} else if (isPlainObject3(val)) {
|
|
38622
|
+
result[targetKey] = merge({}, val);
|
|
38623
|
+
} else if (isArray3(val)) {
|
|
38624
|
+
result[targetKey] = val.slice();
|
|
38625
|
+
} else {
|
|
38626
|
+
result[targetKey] = val;
|
|
38627
|
+
}
|
|
38628
|
+
};
|
|
38629
|
+
for (let i2 = 0, l = arguments.length;i2 < l; i2++) {
|
|
38630
|
+
arguments[i2] && forEach2(arguments[i2], assignValue);
|
|
38631
|
+
}
|
|
38632
|
+
return result;
|
|
38633
|
+
}
|
|
38634
|
+
var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
38635
|
+
forEach2(b, (val, key) => {
|
|
38636
|
+
if (thisArg && isFunction(val)) {
|
|
38637
|
+
a[key] = bind(val, thisArg);
|
|
38638
|
+
} else {
|
|
38639
|
+
a[key] = val;
|
|
38640
|
+
}
|
|
38641
|
+
}, { allOwnKeys });
|
|
38642
|
+
return a;
|
|
38643
|
+
};
|
|
38644
|
+
var stripBOM = (content) => {
|
|
38645
|
+
if (content.charCodeAt(0) === 65279) {
|
|
38646
|
+
content = content.slice(1);
|
|
38647
|
+
}
|
|
38648
|
+
return content;
|
|
38649
|
+
};
|
|
38650
|
+
var inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
38651
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
|
38652
|
+
constructor.prototype.constructor = constructor;
|
|
38653
|
+
Object.defineProperty(constructor, "super", {
|
|
38654
|
+
value: superConstructor.prototype
|
|
38655
|
+
});
|
|
38656
|
+
props && Object.assign(constructor.prototype, props);
|
|
38657
|
+
};
|
|
38658
|
+
var toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
38659
|
+
let props;
|
|
38660
|
+
let i2;
|
|
38661
|
+
let prop;
|
|
38662
|
+
const merged = {};
|
|
38663
|
+
destObj = destObj || {};
|
|
38664
|
+
if (sourceObj == null)
|
|
38665
|
+
return destObj;
|
|
38666
|
+
do {
|
|
38667
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
38668
|
+
i2 = props.length;
|
|
38669
|
+
while (i2-- > 0) {
|
|
38670
|
+
prop = props[i2];
|
|
38671
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
38672
|
+
destObj[prop] = sourceObj[prop];
|
|
38673
|
+
merged[prop] = true;
|
|
38674
|
+
}
|
|
38675
|
+
}
|
|
38676
|
+
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
38677
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
38678
|
+
return destObj;
|
|
38679
|
+
};
|
|
38680
|
+
var endsWith = (str, searchString, position2) => {
|
|
38681
|
+
str = String(str);
|
|
38682
|
+
if (position2 === undefined || position2 > str.length) {
|
|
38683
|
+
position2 = str.length;
|
|
38684
|
+
}
|
|
38685
|
+
position2 -= searchString.length;
|
|
38686
|
+
const lastIndex = str.indexOf(searchString, position2);
|
|
38687
|
+
return lastIndex !== -1 && lastIndex === position2;
|
|
38688
|
+
};
|
|
38689
|
+
var toArray = (thing) => {
|
|
38690
|
+
if (!thing)
|
|
38691
|
+
return null;
|
|
38692
|
+
if (isArray3(thing))
|
|
38693
|
+
return thing;
|
|
38694
|
+
let i2 = thing.length;
|
|
38695
|
+
if (!isNumber2(i2))
|
|
38696
|
+
return null;
|
|
38697
|
+
const arr = new Array(i2);
|
|
38698
|
+
while (i2-- > 0) {
|
|
38699
|
+
arr[i2] = thing[i2];
|
|
38700
|
+
}
|
|
38701
|
+
return arr;
|
|
38702
|
+
};
|
|
38703
|
+
var isTypedArray2 = ((TypedArray) => {
|
|
38704
|
+
return (thing) => {
|
|
38705
|
+
return TypedArray && thing instanceof TypedArray;
|
|
38706
|
+
};
|
|
38707
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
38708
|
+
var forEachEntry = (obj, fn) => {
|
|
38709
|
+
const generator = obj && obj[Symbol.iterator];
|
|
38710
|
+
const iterator = generator.call(obj);
|
|
38711
|
+
let result;
|
|
38712
|
+
while ((result = iterator.next()) && !result.done) {
|
|
38713
|
+
const pair = result.value;
|
|
38714
|
+
fn.call(obj, pair[0], pair[1]);
|
|
38715
|
+
}
|
|
38716
|
+
};
|
|
38717
|
+
var matchAll = (regExp, str) => {
|
|
38718
|
+
let matches;
|
|
38719
|
+
const arr = [];
|
|
38720
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
38721
|
+
arr.push(matches);
|
|
38722
|
+
}
|
|
38723
|
+
return arr;
|
|
38724
|
+
};
|
|
38725
|
+
var isHTMLForm = kindOfTest("HTMLFormElement");
|
|
38726
|
+
var toCamelCase = (str) => {
|
|
38727
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
38728
|
+
return p1.toUpperCase() + p2;
|
|
38729
|
+
});
|
|
38730
|
+
};
|
|
38731
|
+
var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
38732
|
+
var isRegExp2 = kindOfTest("RegExp");
|
|
38733
|
+
var reduceDescriptors = (obj, reducer) => {
|
|
38734
|
+
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
|
|
38735
|
+
const reducedDescriptors = {};
|
|
38736
|
+
forEach2(descriptors2, (descriptor, name2) => {
|
|
38737
|
+
let ret;
|
|
38738
|
+
if ((ret = reducer(descriptor, name2, obj)) !== false) {
|
|
38739
|
+
reducedDescriptors[name2] = ret || descriptor;
|
|
38740
|
+
}
|
|
38741
|
+
});
|
|
38742
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
38743
|
+
};
|
|
38744
|
+
var freezeMethods = (obj) => {
|
|
38745
|
+
reduceDescriptors(obj, (descriptor, name2) => {
|
|
38746
|
+
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name2) !== -1) {
|
|
38747
|
+
return false;
|
|
38748
|
+
}
|
|
38749
|
+
const value2 = obj[name2];
|
|
38750
|
+
if (!isFunction(value2))
|
|
38751
|
+
return;
|
|
38752
|
+
descriptor.enumerable = false;
|
|
38753
|
+
if ("writable" in descriptor) {
|
|
38754
|
+
descriptor.writable = false;
|
|
38755
|
+
return;
|
|
38756
|
+
}
|
|
38757
|
+
if (!descriptor.set) {
|
|
38758
|
+
descriptor.set = () => {
|
|
38759
|
+
throw Error("Can not rewrite read-only method '" + name2 + "'");
|
|
38760
|
+
};
|
|
38761
|
+
}
|
|
38762
|
+
});
|
|
38763
|
+
};
|
|
38764
|
+
var toObjectSet = (arrayOrString, delimiter) => {
|
|
38765
|
+
const obj = {};
|
|
38766
|
+
const define2 = (arr) => {
|
|
38767
|
+
arr.forEach((value2) => {
|
|
38768
|
+
obj[value2] = true;
|
|
38769
|
+
});
|
|
38770
|
+
};
|
|
38771
|
+
isArray3(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
|
|
38772
|
+
return obj;
|
|
38773
|
+
};
|
|
38774
|
+
var noop2 = () => {
|
|
38775
|
+
};
|
|
38776
|
+
var toFiniteNumber = (value2, defaultValue) => {
|
|
38777
|
+
return value2 != null && Number.isFinite(value2 = +value2) ? value2 : defaultValue;
|
|
38778
|
+
};
|
|
38779
|
+
function isSpecCompliantForm(thing) {
|
|
38780
|
+
return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
|
|
38781
|
+
}
|
|
38782
|
+
var toJSONObject = (obj) => {
|
|
38783
|
+
const stack = new Array(10);
|
|
38784
|
+
const visit = (source, i2) => {
|
|
38785
|
+
if (isObject2(source)) {
|
|
38786
|
+
if (stack.indexOf(source) >= 0) {
|
|
38787
|
+
return;
|
|
38788
|
+
}
|
|
38789
|
+
if (!("toJSON" in source)) {
|
|
38790
|
+
stack[i2] = source;
|
|
38791
|
+
const target = isArray3(source) ? [] : {};
|
|
38792
|
+
forEach2(source, (value2, key) => {
|
|
38793
|
+
const reducedValue = visit(value2, i2 + 1);
|
|
38794
|
+
!isUndefined3(reducedValue) && (target[key] = reducedValue);
|
|
38795
|
+
});
|
|
38796
|
+
stack[i2] = undefined;
|
|
38797
|
+
return target;
|
|
38798
|
+
}
|
|
38799
|
+
}
|
|
38800
|
+
return source;
|
|
38801
|
+
};
|
|
38802
|
+
return visit(obj, 0);
|
|
38803
|
+
};
|
|
38804
|
+
var isAsyncFn = kindOfTest("AsyncFunction");
|
|
38805
|
+
var isThenable = (thing) => thing && (isObject2(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
38806
|
+
var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
38807
|
+
if (setImmediateSupported) {
|
|
38808
|
+
return setImmediate;
|
|
38809
|
+
}
|
|
38810
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
38811
|
+
_global2.addEventListener("message", ({ source, data }) => {
|
|
38812
|
+
if (source === _global2 && data === token) {
|
|
38813
|
+
callbacks.length && callbacks.shift()();
|
|
38814
|
+
}
|
|
38815
|
+
}, false);
|
|
38816
|
+
return (cb) => {
|
|
38817
|
+
callbacks.push(cb);
|
|
38818
|
+
_global2.postMessage(token, "*");
|
|
38819
|
+
};
|
|
38820
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
38821
|
+
})(typeof setImmediate === "function", isFunction(_global2.postMessage));
|
|
38822
|
+
var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global2) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
38823
|
+
var utils$1 = {
|
|
38824
|
+
isArray: isArray3,
|
|
38825
|
+
isArrayBuffer,
|
|
38826
|
+
isBuffer,
|
|
38827
|
+
isFormData: isFormData2,
|
|
38828
|
+
isArrayBufferView,
|
|
38829
|
+
isString: isString2,
|
|
38830
|
+
isNumber: isNumber2,
|
|
38831
|
+
isBoolean: isBoolean2,
|
|
38832
|
+
isObject: isObject2,
|
|
38833
|
+
isPlainObject: isPlainObject3,
|
|
38834
|
+
isReadableStream,
|
|
38835
|
+
isRequest,
|
|
38836
|
+
isResponse,
|
|
38837
|
+
isHeaders,
|
|
38838
|
+
isUndefined: isUndefined3,
|
|
38839
|
+
isDate: isDate2,
|
|
38840
|
+
isFile: isFile2,
|
|
38841
|
+
isBlob,
|
|
38842
|
+
isRegExp: isRegExp2,
|
|
38843
|
+
isFunction,
|
|
38844
|
+
isStream,
|
|
38845
|
+
isURLSearchParams,
|
|
38846
|
+
isTypedArray: isTypedArray2,
|
|
38847
|
+
isFileList,
|
|
38848
|
+
forEach: forEach2,
|
|
38849
|
+
merge,
|
|
38850
|
+
extend,
|
|
38851
|
+
trim,
|
|
38852
|
+
stripBOM,
|
|
38853
|
+
inherits,
|
|
38854
|
+
toFlatObject,
|
|
38855
|
+
kindOf,
|
|
38856
|
+
kindOfTest,
|
|
38857
|
+
endsWith,
|
|
38858
|
+
toArray,
|
|
38859
|
+
forEachEntry,
|
|
38860
|
+
matchAll,
|
|
38861
|
+
isHTMLForm,
|
|
38862
|
+
hasOwnProperty,
|
|
38863
|
+
hasOwnProp: hasOwnProperty,
|
|
38864
|
+
reduceDescriptors,
|
|
38865
|
+
freezeMethods,
|
|
38866
|
+
toObjectSet,
|
|
38867
|
+
toCamelCase,
|
|
38868
|
+
noop: noop2,
|
|
38869
|
+
toFiniteNumber,
|
|
38870
|
+
findKey,
|
|
38871
|
+
global: _global2,
|
|
38872
|
+
isContextDefined,
|
|
38873
|
+
isSpecCompliantForm,
|
|
38874
|
+
toJSONObject,
|
|
38875
|
+
isAsyncFn,
|
|
38876
|
+
isThenable,
|
|
38877
|
+
setImmediate: _setImmediate,
|
|
38878
|
+
asap
|
|
38879
|
+
};
|
|
38880
|
+
function AxiosError(message2, code, config2, request, response) {
|
|
38881
|
+
Error.call(this);
|
|
38882
|
+
if (Error.captureStackTrace) {
|
|
38883
|
+
Error.captureStackTrace(this, this.constructor);
|
|
38884
|
+
} else {
|
|
38885
|
+
this.stack = new Error().stack;
|
|
38886
|
+
}
|
|
38887
|
+
this.message = message2;
|
|
38888
|
+
this.name = "AxiosError";
|
|
38889
|
+
code && (this.code = code);
|
|
38890
|
+
config2 && (this.config = config2);
|
|
38891
|
+
request && (this.request = request);
|
|
38892
|
+
if (response) {
|
|
38893
|
+
this.response = response;
|
|
38894
|
+
this.status = response.status ? response.status : null;
|
|
38895
|
+
}
|
|
38896
|
+
}
|
|
38897
|
+
utils$1.inherits(AxiosError, Error, {
|
|
38898
|
+
toJSON: function toJSON() {
|
|
38899
|
+
return {
|
|
38900
|
+
message: this.message,
|
|
38901
|
+
name: this.name,
|
|
38902
|
+
description: this.description,
|
|
38903
|
+
number: this.number,
|
|
38904
|
+
fileName: this.fileName,
|
|
38905
|
+
lineNumber: this.lineNumber,
|
|
38906
|
+
columnNumber: this.columnNumber,
|
|
38907
|
+
stack: this.stack,
|
|
38908
|
+
config: utils$1.toJSONObject(this.config),
|
|
38909
|
+
code: this.code,
|
|
38910
|
+
status: this.status
|
|
38911
|
+
};
|
|
38912
|
+
}
|
|
38913
|
+
});
|
|
38914
|
+
var prototype$1 = AxiosError.prototype;
|
|
38915
|
+
var descriptors = {};
|
|
38916
|
+
[
|
|
38917
|
+
"ERR_BAD_OPTION_VALUE",
|
|
38918
|
+
"ERR_BAD_OPTION",
|
|
38919
|
+
"ECONNABORTED",
|
|
38920
|
+
"ETIMEDOUT",
|
|
38921
|
+
"ERR_NETWORK",
|
|
38922
|
+
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
38923
|
+
"ERR_DEPRECATED",
|
|
38924
|
+
"ERR_BAD_RESPONSE",
|
|
38925
|
+
"ERR_BAD_REQUEST",
|
|
38926
|
+
"ERR_CANCELED",
|
|
38927
|
+
"ERR_NOT_SUPPORT",
|
|
38928
|
+
"ERR_INVALID_URL"
|
|
38929
|
+
].forEach((code) => {
|
|
38930
|
+
descriptors[code] = { value: code };
|
|
38931
|
+
});
|
|
38932
|
+
Object.defineProperties(AxiosError, descriptors);
|
|
38933
|
+
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
|
|
38934
|
+
AxiosError.from = (error, code, config2, request, response, customProps) => {
|
|
38935
|
+
const axiosError = Object.create(prototype$1);
|
|
38936
|
+
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
38937
|
+
return obj !== Error.prototype;
|
|
38938
|
+
}, (prop) => {
|
|
38939
|
+
return prop !== "isAxiosError";
|
|
38940
|
+
});
|
|
38941
|
+
AxiosError.call(axiosError, error.message, code, config2, request, response);
|
|
38942
|
+
axiosError.cause = error;
|
|
38943
|
+
axiosError.name = error.name;
|
|
38944
|
+
customProps && Object.assign(axiosError, customProps);
|
|
38945
|
+
return axiosError;
|
|
38946
|
+
};
|
|
38947
|
+
function isVisitable(thing) {
|
|
38948
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
38949
|
+
}
|
|
38950
|
+
function removeBrackets(key) {
|
|
38951
|
+
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
38952
|
+
}
|
|
38953
|
+
function renderKey(path, key, dots) {
|
|
38954
|
+
if (!path)
|
|
38955
|
+
return key;
|
|
38956
|
+
return path.concat(key).map(function each(token, i2) {
|
|
38957
|
+
token = removeBrackets(token);
|
|
38958
|
+
return !dots && i2 ? "[" + token + "]" : token;
|
|
38959
|
+
}).join(dots ? "." : "");
|
|
38960
|
+
}
|
|
38961
|
+
function isFlatArray(arr) {
|
|
38962
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
38963
|
+
}
|
|
38964
|
+
var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
38965
|
+
return /^is[A-Z]/.test(prop);
|
|
38966
|
+
});
|
|
38967
|
+
function toFormData(obj, formData, options) {
|
|
38968
|
+
if (!utils$1.isObject(obj)) {
|
|
38969
|
+
throw new TypeError("target must be an object");
|
|
38970
|
+
}
|
|
38971
|
+
formData = formData || new (FormData__default["default"] || FormData);
|
|
38972
|
+
options = utils$1.toFlatObject(options, {
|
|
38973
|
+
metaTokens: true,
|
|
38974
|
+
dots: false,
|
|
38975
|
+
indexes: false
|
|
38976
|
+
}, false, function defined(option, source) {
|
|
38977
|
+
return !utils$1.isUndefined(source[option]);
|
|
38978
|
+
});
|
|
38979
|
+
const metaTokens = options.metaTokens;
|
|
38980
|
+
const visitor = options.visitor || defaultVisitor;
|
|
38981
|
+
const dots = options.dots;
|
|
38982
|
+
const indexes = options.indexes;
|
|
38983
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
38984
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
38985
|
+
if (!utils$1.isFunction(visitor)) {
|
|
38986
|
+
throw new TypeError("visitor must be a function");
|
|
38987
|
+
}
|
|
38988
|
+
function convertValue(value2) {
|
|
38989
|
+
if (value2 === null)
|
|
38990
|
+
return "";
|
|
38991
|
+
if (utils$1.isDate(value2)) {
|
|
38992
|
+
return value2.toISOString();
|
|
38993
|
+
}
|
|
38994
|
+
if (!useBlob && utils$1.isBlob(value2)) {
|
|
38995
|
+
throw new AxiosError("Blob is not supported. Use a Buffer instead.");
|
|
38996
|
+
}
|
|
38997
|
+
if (utils$1.isArrayBuffer(value2) || utils$1.isTypedArray(value2)) {
|
|
38998
|
+
return useBlob && typeof Blob === "function" ? new Blob([value2]) : Buffer.from(value2);
|
|
38999
|
+
}
|
|
39000
|
+
return value2;
|
|
39001
|
+
}
|
|
39002
|
+
function defaultVisitor(value2, key, path) {
|
|
39003
|
+
let arr = value2;
|
|
39004
|
+
if (value2 && !path && typeof value2 === "object") {
|
|
39005
|
+
if (utils$1.endsWith(key, "{}")) {
|
|
39006
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
39007
|
+
value2 = JSON.stringify(value2);
|
|
39008
|
+
} else if (utils$1.isArray(value2) && isFlatArray(value2) || (utils$1.isFileList(value2) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value2))) {
|
|
39009
|
+
key = removeBrackets(key);
|
|
39010
|
+
arr.forEach(function each(el, index) {
|
|
39011
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]", convertValue(el));
|
|
39012
|
+
});
|
|
39013
|
+
return false;
|
|
39014
|
+
}
|
|
39015
|
+
}
|
|
39016
|
+
if (isVisitable(value2)) {
|
|
39017
|
+
return true;
|
|
39018
|
+
}
|
|
39019
|
+
formData.append(renderKey(path, key, dots), convertValue(value2));
|
|
39020
|
+
return false;
|
|
39021
|
+
}
|
|
39022
|
+
const stack = [];
|
|
39023
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
39024
|
+
defaultVisitor,
|
|
39025
|
+
convertValue,
|
|
39026
|
+
isVisitable
|
|
39027
|
+
});
|
|
39028
|
+
function build(value2, path) {
|
|
39029
|
+
if (utils$1.isUndefined(value2))
|
|
39030
|
+
return;
|
|
39031
|
+
if (stack.indexOf(value2) !== -1) {
|
|
39032
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
39033
|
+
}
|
|
39034
|
+
stack.push(value2);
|
|
39035
|
+
utils$1.forEach(value2, function each(el, key) {
|
|
39036
|
+
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
39037
|
+
if (result === true) {
|
|
39038
|
+
build(el, path ? path.concat(key) : [key]);
|
|
39039
|
+
}
|
|
39040
|
+
});
|
|
39041
|
+
stack.pop();
|
|
39042
|
+
}
|
|
39043
|
+
if (!utils$1.isObject(obj)) {
|
|
39044
|
+
throw new TypeError("data must be an object");
|
|
39045
|
+
}
|
|
39046
|
+
build(obj);
|
|
39047
|
+
return formData;
|
|
39048
|
+
}
|
|
39049
|
+
function encode$1(str) {
|
|
39050
|
+
const charMap = {
|
|
39051
|
+
"!": "%21",
|
|
39052
|
+
"'": "%27",
|
|
39053
|
+
"(": "%28",
|
|
39054
|
+
")": "%29",
|
|
39055
|
+
"~": "%7E",
|
|
39056
|
+
"%20": "+",
|
|
39057
|
+
"%00": "\x00"
|
|
39058
|
+
};
|
|
39059
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
39060
|
+
return charMap[match];
|
|
39061
|
+
});
|
|
39062
|
+
}
|
|
39063
|
+
function AxiosURLSearchParams(params, options) {
|
|
39064
|
+
this._pairs = [];
|
|
39065
|
+
params && toFormData(params, this, options);
|
|
39066
|
+
}
|
|
39067
|
+
var prototype = AxiosURLSearchParams.prototype;
|
|
39068
|
+
prototype.append = function append(name2, value2) {
|
|
39069
|
+
this._pairs.push([name2, value2]);
|
|
39070
|
+
};
|
|
39071
|
+
prototype.toString = function toString(encoder2) {
|
|
39072
|
+
const _encode = encoder2 ? function(value2) {
|
|
39073
|
+
return encoder2.call(this, value2, encode$1);
|
|
39074
|
+
} : encode$1;
|
|
39075
|
+
return this._pairs.map(function each(pair) {
|
|
39076
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
39077
|
+
}, "").join("&");
|
|
39078
|
+
};
|
|
39079
|
+
function encode3(val) {
|
|
39080
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
39081
|
+
}
|
|
39082
|
+
function buildURL(url2, params, options) {
|
|
39083
|
+
if (!params) {
|
|
39084
|
+
return url2;
|
|
39085
|
+
}
|
|
39086
|
+
const _encode = options && options.encode || encode3;
|
|
39087
|
+
if (utils$1.isFunction(options)) {
|
|
39088
|
+
options = {
|
|
39089
|
+
serialize: options
|
|
39090
|
+
};
|
|
39091
|
+
}
|
|
39092
|
+
const serializeFn = options && options.serialize;
|
|
39093
|
+
let serializedParams;
|
|
39094
|
+
if (serializeFn) {
|
|
39095
|
+
serializedParams = serializeFn(params, options);
|
|
39096
|
+
} else {
|
|
39097
|
+
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
|
|
39098
|
+
}
|
|
39099
|
+
if (serializedParams) {
|
|
39100
|
+
const hashmarkIndex = url2.indexOf("#");
|
|
39101
|
+
if (hashmarkIndex !== -1) {
|
|
39102
|
+
url2 = url2.slice(0, hashmarkIndex);
|
|
39103
|
+
}
|
|
39104
|
+
url2 += (url2.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
39105
|
+
}
|
|
39106
|
+
return url2;
|
|
39107
|
+
}
|
|
39108
|
+
|
|
39109
|
+
class InterceptorManager {
|
|
39110
|
+
constructor() {
|
|
39111
|
+
this.handlers = [];
|
|
39112
|
+
}
|
|
39113
|
+
use(fulfilled, rejected, options) {
|
|
39114
|
+
this.handlers.push({
|
|
39115
|
+
fulfilled,
|
|
39116
|
+
rejected,
|
|
39117
|
+
synchronous: options ? options.synchronous : false,
|
|
39118
|
+
runWhen: options ? options.runWhen : null
|
|
39119
|
+
});
|
|
39120
|
+
return this.handlers.length - 1;
|
|
39121
|
+
}
|
|
39122
|
+
eject(id) {
|
|
39123
|
+
if (this.handlers[id]) {
|
|
39124
|
+
this.handlers[id] = null;
|
|
39125
|
+
}
|
|
39126
|
+
}
|
|
39127
|
+
clear() {
|
|
39128
|
+
if (this.handlers) {
|
|
39129
|
+
this.handlers = [];
|
|
39130
|
+
}
|
|
39131
|
+
}
|
|
39132
|
+
forEach(fn) {
|
|
39133
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
39134
|
+
if (h !== null) {
|
|
39135
|
+
fn(h);
|
|
39136
|
+
}
|
|
39137
|
+
});
|
|
39138
|
+
}
|
|
39139
|
+
}
|
|
39140
|
+
var InterceptorManager$1 = InterceptorManager;
|
|
39141
|
+
var transitionalDefaults = {
|
|
39142
|
+
silentJSONParsing: true,
|
|
39143
|
+
forcedJSONParsing: true,
|
|
39144
|
+
clarifyTimeoutError: false
|
|
39145
|
+
};
|
|
39146
|
+
var URLSearchParams2 = url__default["default"].URLSearchParams;
|
|
39147
|
+
var ALPHA = "abcdefghijklmnopqrstuvwxyz";
|
|
39148
|
+
var DIGIT = "0123456789";
|
|
39149
|
+
var ALPHABET = {
|
|
39150
|
+
DIGIT,
|
|
39151
|
+
ALPHA,
|
|
39152
|
+
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
39153
|
+
};
|
|
39154
|
+
var generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
39155
|
+
let str = "";
|
|
39156
|
+
const { length } = alphabet;
|
|
39157
|
+
const randomValues = new Uint32Array(size);
|
|
39158
|
+
crypto__default["default"].randomFillSync(randomValues);
|
|
39159
|
+
for (let i2 = 0;i2 < size; i2++) {
|
|
39160
|
+
str += alphabet[randomValues[i2] % length];
|
|
39161
|
+
}
|
|
39162
|
+
return str;
|
|
39163
|
+
};
|
|
39164
|
+
var platform$1 = {
|
|
39165
|
+
isNode: true,
|
|
39166
|
+
classes: {
|
|
39167
|
+
URLSearchParams: URLSearchParams2,
|
|
39168
|
+
FormData: FormData__default["default"],
|
|
39169
|
+
Blob: typeof Blob !== "undefined" && Blob || null
|
|
39170
|
+
},
|
|
39171
|
+
ALPHABET,
|
|
39172
|
+
generateString,
|
|
39173
|
+
protocols: ["http", "https", "file", "data"]
|
|
39174
|
+
};
|
|
39175
|
+
var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
39176
|
+
var _navigator = typeof navigator === "object" && navigator || undefined;
|
|
39177
|
+
var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
39178
|
+
var hasStandardBrowserWebWorkerEnv = (() => {
|
|
39179
|
+
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
39180
|
+
})();
|
|
39181
|
+
var origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
39182
|
+
var utils = /* @__PURE__ */ Object.freeze({
|
|
39183
|
+
__proto__: null,
|
|
39184
|
+
hasBrowserEnv,
|
|
39185
|
+
hasStandardBrowserWebWorkerEnv,
|
|
39186
|
+
hasStandardBrowserEnv,
|
|
39187
|
+
navigator: _navigator,
|
|
39188
|
+
origin
|
|
39189
|
+
});
|
|
39190
|
+
var platform = {
|
|
39191
|
+
...utils,
|
|
39192
|
+
...platform$1
|
|
39193
|
+
};
|
|
39194
|
+
function toURLEncodedForm(data, options) {
|
|
39195
|
+
return toFormData(data, new platform.classes.URLSearchParams, Object.assign({
|
|
39196
|
+
visitor: function(value2, key, path, helpers) {
|
|
39197
|
+
if (platform.isNode && utils$1.isBuffer(value2)) {
|
|
39198
|
+
this.append(key, value2.toString("base64"));
|
|
39199
|
+
return false;
|
|
39200
|
+
}
|
|
39201
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
39202
|
+
}
|
|
39203
|
+
}, options));
|
|
39204
|
+
}
|
|
39205
|
+
function parsePropPath(name2) {
|
|
39206
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name2).map((match) => {
|
|
39207
|
+
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
39208
|
+
});
|
|
39209
|
+
}
|
|
39210
|
+
function arrayToObject(arr) {
|
|
39211
|
+
const obj = {};
|
|
39212
|
+
const keys = Object.keys(arr);
|
|
39213
|
+
let i2;
|
|
39214
|
+
const len = keys.length;
|
|
39215
|
+
let key;
|
|
39216
|
+
for (i2 = 0;i2 < len; i2++) {
|
|
39217
|
+
key = keys[i2];
|
|
39218
|
+
obj[key] = arr[key];
|
|
39219
|
+
}
|
|
39220
|
+
return obj;
|
|
39221
|
+
}
|
|
39222
|
+
function formDataToJSON(formData) {
|
|
39223
|
+
function buildPath(path, value2, target, index) {
|
|
39224
|
+
let name2 = path[index++];
|
|
39225
|
+
if (name2 === "__proto__")
|
|
39226
|
+
return true;
|
|
39227
|
+
const isNumericKey = Number.isFinite(+name2);
|
|
39228
|
+
const isLast = index >= path.length;
|
|
39229
|
+
name2 = !name2 && utils$1.isArray(target) ? target.length : name2;
|
|
39230
|
+
if (isLast) {
|
|
39231
|
+
if (utils$1.hasOwnProp(target, name2)) {
|
|
39232
|
+
target[name2] = [target[name2], value2];
|
|
39233
|
+
} else {
|
|
39234
|
+
target[name2] = value2;
|
|
39235
|
+
}
|
|
39236
|
+
return !isNumericKey;
|
|
39237
|
+
}
|
|
39238
|
+
if (!target[name2] || !utils$1.isObject(target[name2])) {
|
|
39239
|
+
target[name2] = [];
|
|
39240
|
+
}
|
|
39241
|
+
const result = buildPath(path, value2, target[name2], index);
|
|
39242
|
+
if (result && utils$1.isArray(target[name2])) {
|
|
39243
|
+
target[name2] = arrayToObject(target[name2]);
|
|
39244
|
+
}
|
|
39245
|
+
return !isNumericKey;
|
|
39246
|
+
}
|
|
39247
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
39248
|
+
const obj = {};
|
|
39249
|
+
utils$1.forEachEntry(formData, (name2, value2) => {
|
|
39250
|
+
buildPath(parsePropPath(name2), value2, obj, 0);
|
|
39251
|
+
});
|
|
39252
|
+
return obj;
|
|
39253
|
+
}
|
|
39254
|
+
return null;
|
|
39255
|
+
}
|
|
39256
|
+
function stringifySafely(rawValue, parser, encoder2) {
|
|
39257
|
+
if (utils$1.isString(rawValue)) {
|
|
39258
|
+
try {
|
|
39259
|
+
(parser || JSON.parse)(rawValue);
|
|
39260
|
+
return utils$1.trim(rawValue);
|
|
39261
|
+
} catch (e2) {
|
|
39262
|
+
if (e2.name !== "SyntaxError") {
|
|
39263
|
+
throw e2;
|
|
39264
|
+
}
|
|
39265
|
+
}
|
|
39266
|
+
}
|
|
39267
|
+
return (encoder2 || JSON.stringify)(rawValue);
|
|
39268
|
+
}
|
|
39269
|
+
var defaults = {
|
|
39270
|
+
transitional: transitionalDefaults,
|
|
39271
|
+
adapter: ["xhr", "http", "fetch"],
|
|
39272
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
39273
|
+
const contentType = headers.getContentType() || "";
|
|
39274
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
39275
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
39276
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
39277
|
+
data = new FormData(data);
|
|
39278
|
+
}
|
|
39279
|
+
const isFormData3 = utils$1.isFormData(data);
|
|
39280
|
+
if (isFormData3) {
|
|
39281
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
39282
|
+
}
|
|
39283
|
+
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
|
|
39284
|
+
return data;
|
|
39285
|
+
}
|
|
39286
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
39287
|
+
return data.buffer;
|
|
39288
|
+
}
|
|
39289
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
39290
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
39291
|
+
return data.toString();
|
|
39292
|
+
}
|
|
39293
|
+
let isFileList2;
|
|
39294
|
+
if (isObjectPayload) {
|
|
39295
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
39296
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
39297
|
+
}
|
|
39298
|
+
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
39299
|
+
const _FormData = this.env && this.env.FormData;
|
|
39300
|
+
return toFormData(isFileList2 ? { "files[]": data } : data, _FormData && new _FormData, this.formSerializer);
|
|
39301
|
+
}
|
|
39302
|
+
}
|
|
39303
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
39304
|
+
headers.setContentType("application/json", false);
|
|
39305
|
+
return stringifySafely(data);
|
|
39306
|
+
}
|
|
39307
|
+
return data;
|
|
39308
|
+
}],
|
|
39309
|
+
transformResponse: [function transformResponse(data) {
|
|
39310
|
+
const transitional = this.transitional || defaults.transitional;
|
|
39311
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
39312
|
+
const JSONRequested = this.responseType === "json";
|
|
39313
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
39314
|
+
return data;
|
|
39315
|
+
}
|
|
39316
|
+
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
39317
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
39318
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
39319
|
+
try {
|
|
39320
|
+
return JSON.parse(data);
|
|
39321
|
+
} catch (e2) {
|
|
39322
|
+
if (strictJSONParsing) {
|
|
39323
|
+
if (e2.name === "SyntaxError") {
|
|
39324
|
+
throw AxiosError.from(e2, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
39325
|
+
}
|
|
39326
|
+
throw e2;
|
|
39327
|
+
}
|
|
39328
|
+
}
|
|
39329
|
+
}
|
|
39330
|
+
return data;
|
|
39331
|
+
}],
|
|
39332
|
+
timeout: 0,
|
|
39333
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
39334
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
39335
|
+
maxContentLength: -1,
|
|
39336
|
+
maxBodyLength: -1,
|
|
39337
|
+
env: {
|
|
39338
|
+
FormData: platform.classes.FormData,
|
|
39339
|
+
Blob: platform.classes.Blob
|
|
39340
|
+
},
|
|
39341
|
+
validateStatus: function validateStatus(status) {
|
|
39342
|
+
return status >= 200 && status < 300;
|
|
39343
|
+
},
|
|
39344
|
+
headers: {
|
|
39345
|
+
common: {
|
|
39346
|
+
Accept: "application/json, text/plain, */*",
|
|
39347
|
+
"Content-Type": undefined
|
|
39348
|
+
}
|
|
39349
|
+
}
|
|
39350
|
+
};
|
|
39351
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
39352
|
+
defaults.headers[method] = {};
|
|
39353
|
+
});
|
|
39354
|
+
var defaults$1 = defaults;
|
|
39355
|
+
var ignoreDuplicateOf = utils$1.toObjectSet([
|
|
39356
|
+
"age",
|
|
39357
|
+
"authorization",
|
|
39358
|
+
"content-length",
|
|
39359
|
+
"content-type",
|
|
39360
|
+
"etag",
|
|
39361
|
+
"expires",
|
|
39362
|
+
"from",
|
|
39363
|
+
"host",
|
|
39364
|
+
"if-modified-since",
|
|
39365
|
+
"if-unmodified-since",
|
|
39366
|
+
"last-modified",
|
|
39367
|
+
"location",
|
|
39368
|
+
"max-forwards",
|
|
39369
|
+
"proxy-authorization",
|
|
39370
|
+
"referer",
|
|
39371
|
+
"retry-after",
|
|
39372
|
+
"user-agent"
|
|
39373
|
+
]);
|
|
39374
|
+
var parseHeaders = (rawHeaders) => {
|
|
39375
|
+
const parsed = {};
|
|
39376
|
+
let key;
|
|
39377
|
+
let val;
|
|
39378
|
+
let i2;
|
|
39379
|
+
rawHeaders && rawHeaders.split(`
|
|
39380
|
+
`).forEach(function parser(line) {
|
|
39381
|
+
i2 = line.indexOf(":");
|
|
39382
|
+
key = line.substring(0, i2).trim().toLowerCase();
|
|
39383
|
+
val = line.substring(i2 + 1).trim();
|
|
39384
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
39385
|
+
return;
|
|
39386
|
+
}
|
|
39387
|
+
if (key === "set-cookie") {
|
|
39388
|
+
if (parsed[key]) {
|
|
39389
|
+
parsed[key].push(val);
|
|
39390
|
+
} else {
|
|
39391
|
+
parsed[key] = [val];
|
|
39392
|
+
}
|
|
39393
|
+
} else {
|
|
39394
|
+
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
39395
|
+
}
|
|
39396
|
+
});
|
|
39397
|
+
return parsed;
|
|
39398
|
+
};
|
|
39399
|
+
var $internals = Symbol("internals");
|
|
39400
|
+
function normalizeHeader(header) {
|
|
39401
|
+
return header && String(header).trim().toLowerCase();
|
|
39402
|
+
}
|
|
39403
|
+
function normalizeValue(value2) {
|
|
39404
|
+
if (value2 === false || value2 == null) {
|
|
39405
|
+
return value2;
|
|
39406
|
+
}
|
|
39407
|
+
return utils$1.isArray(value2) ? value2.map(normalizeValue) : String(value2);
|
|
39408
|
+
}
|
|
39409
|
+
function parseTokens(str) {
|
|
39410
|
+
const tokens = Object.create(null);
|
|
39411
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
39412
|
+
let match;
|
|
39413
|
+
while (match = tokensRE.exec(str)) {
|
|
39414
|
+
tokens[match[1]] = match[2];
|
|
39415
|
+
}
|
|
39416
|
+
return tokens;
|
|
39417
|
+
}
|
|
39418
|
+
var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
39419
|
+
function matchHeaderValue(context3, value2, header, filter, isHeaderNameFilter) {
|
|
39420
|
+
if (utils$1.isFunction(filter)) {
|
|
39421
|
+
return filter.call(this, value2, header);
|
|
39422
|
+
}
|
|
39423
|
+
if (isHeaderNameFilter) {
|
|
39424
|
+
value2 = header;
|
|
39425
|
+
}
|
|
39426
|
+
if (!utils$1.isString(value2))
|
|
39427
|
+
return;
|
|
39428
|
+
if (utils$1.isString(filter)) {
|
|
39429
|
+
return value2.indexOf(filter) !== -1;
|
|
39430
|
+
}
|
|
39431
|
+
if (utils$1.isRegExp(filter)) {
|
|
39432
|
+
return filter.test(value2);
|
|
39433
|
+
}
|
|
39434
|
+
}
|
|
39435
|
+
function formatHeader(header) {
|
|
39436
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
39437
|
+
return char.toUpperCase() + str;
|
|
39438
|
+
});
|
|
39439
|
+
}
|
|
39440
|
+
function buildAccessors(obj, header) {
|
|
39441
|
+
const accessorName = utils$1.toCamelCase(" " + header);
|
|
39442
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
39443
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
39444
|
+
value: function(arg1, arg2, arg3) {
|
|
39445
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
39446
|
+
},
|
|
39447
|
+
configurable: true
|
|
39448
|
+
});
|
|
39449
|
+
});
|
|
39450
|
+
}
|
|
39451
|
+
|
|
39452
|
+
class AxiosHeaders {
|
|
39453
|
+
constructor(headers) {
|
|
39454
|
+
headers && this.set(headers);
|
|
39455
|
+
}
|
|
39456
|
+
set(header, valueOrRewrite, rewrite) {
|
|
39457
|
+
const self2 = this;
|
|
39458
|
+
function setHeader(_value, _header, _rewrite) {
|
|
39459
|
+
const lHeader = normalizeHeader(_header);
|
|
39460
|
+
if (!lHeader) {
|
|
39461
|
+
throw new Error("header name must be a non-empty string");
|
|
39462
|
+
}
|
|
39463
|
+
const key = utils$1.findKey(self2, lHeader);
|
|
39464
|
+
if (!key || self2[key] === undefined || _rewrite === true || _rewrite === undefined && self2[key] !== false) {
|
|
39465
|
+
self2[key || _header] = normalizeValue(_value);
|
|
39466
|
+
}
|
|
39467
|
+
}
|
|
39468
|
+
const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
39469
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
39470
|
+
setHeaders(header, valueOrRewrite);
|
|
39471
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
39472
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
39473
|
+
} else if (utils$1.isHeaders(header)) {
|
|
39474
|
+
for (const [key, value2] of header.entries()) {
|
|
39475
|
+
setHeader(value2, key, rewrite);
|
|
39476
|
+
}
|
|
39477
|
+
} else {
|
|
39478
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
39479
|
+
}
|
|
39480
|
+
return this;
|
|
39481
|
+
}
|
|
39482
|
+
get(header, parser) {
|
|
39483
|
+
header = normalizeHeader(header);
|
|
39484
|
+
if (header) {
|
|
39485
|
+
const key = utils$1.findKey(this, header);
|
|
39486
|
+
if (key) {
|
|
39487
|
+
const value2 = this[key];
|
|
39488
|
+
if (!parser) {
|
|
39489
|
+
return value2;
|
|
39490
|
+
}
|
|
39491
|
+
if (parser === true) {
|
|
39492
|
+
return parseTokens(value2);
|
|
39493
|
+
}
|
|
39494
|
+
if (utils$1.isFunction(parser)) {
|
|
39495
|
+
return parser.call(this, value2, key);
|
|
39496
|
+
}
|
|
39497
|
+
if (utils$1.isRegExp(parser)) {
|
|
39498
|
+
return parser.exec(value2);
|
|
39499
|
+
}
|
|
39500
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
39501
|
+
}
|
|
39502
|
+
}
|
|
39503
|
+
}
|
|
39504
|
+
has(header, matcher) {
|
|
39505
|
+
header = normalizeHeader(header);
|
|
39506
|
+
if (header) {
|
|
39507
|
+
const key = utils$1.findKey(this, header);
|
|
39508
|
+
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
39509
|
+
}
|
|
39510
|
+
return false;
|
|
39511
|
+
}
|
|
39512
|
+
delete(header, matcher) {
|
|
39513
|
+
const self2 = this;
|
|
39514
|
+
let deleted = false;
|
|
39515
|
+
function deleteHeader(_header) {
|
|
39516
|
+
_header = normalizeHeader(_header);
|
|
39517
|
+
if (_header) {
|
|
39518
|
+
const key = utils$1.findKey(self2, _header);
|
|
39519
|
+
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
39520
|
+
delete self2[key];
|
|
39521
|
+
deleted = true;
|
|
39522
|
+
}
|
|
39523
|
+
}
|
|
39524
|
+
}
|
|
39525
|
+
if (utils$1.isArray(header)) {
|
|
39526
|
+
header.forEach(deleteHeader);
|
|
39527
|
+
} else {
|
|
39528
|
+
deleteHeader(header);
|
|
39529
|
+
}
|
|
39530
|
+
return deleted;
|
|
39531
|
+
}
|
|
39532
|
+
clear(matcher) {
|
|
39533
|
+
const keys = Object.keys(this);
|
|
39534
|
+
let i2 = keys.length;
|
|
39535
|
+
let deleted = false;
|
|
39536
|
+
while (i2--) {
|
|
39537
|
+
const key = keys[i2];
|
|
39538
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
39539
|
+
delete this[key];
|
|
39540
|
+
deleted = true;
|
|
39541
|
+
}
|
|
39542
|
+
}
|
|
39543
|
+
return deleted;
|
|
39544
|
+
}
|
|
39545
|
+
normalize(format) {
|
|
39546
|
+
const self2 = this;
|
|
39547
|
+
const headers = {};
|
|
39548
|
+
utils$1.forEach(this, (value2, header) => {
|
|
39549
|
+
const key = utils$1.findKey(headers, header);
|
|
39550
|
+
if (key) {
|
|
39551
|
+
self2[key] = normalizeValue(value2);
|
|
39552
|
+
delete self2[header];
|
|
39553
|
+
return;
|
|
39554
|
+
}
|
|
39555
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
39556
|
+
if (normalized !== header) {
|
|
39557
|
+
delete self2[header];
|
|
39558
|
+
}
|
|
39559
|
+
self2[normalized] = normalizeValue(value2);
|
|
39560
|
+
headers[normalized] = true;
|
|
39561
|
+
});
|
|
39562
|
+
return this;
|
|
39563
|
+
}
|
|
39564
|
+
concat(...targets) {
|
|
39565
|
+
return this.constructor.concat(this, ...targets);
|
|
39566
|
+
}
|
|
39567
|
+
toJSON(asStrings) {
|
|
39568
|
+
const obj = Object.create(null);
|
|
39569
|
+
utils$1.forEach(this, (value2, header) => {
|
|
39570
|
+
value2 != null && value2 !== false && (obj[header] = asStrings && utils$1.isArray(value2) ? value2.join(", ") : value2);
|
|
39571
|
+
});
|
|
39572
|
+
return obj;
|
|
39573
|
+
}
|
|
39574
|
+
[Symbol.iterator]() {
|
|
39575
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
39576
|
+
}
|
|
39577
|
+
toString() {
|
|
39578
|
+
return Object.entries(this.toJSON()).map(([header, value2]) => header + ": " + value2).join(`
|
|
39579
|
+
`);
|
|
39580
|
+
}
|
|
39581
|
+
get [Symbol.toStringTag]() {
|
|
39582
|
+
return "AxiosHeaders";
|
|
39583
|
+
}
|
|
39584
|
+
static from(thing) {
|
|
39585
|
+
return thing instanceof this ? thing : new this(thing);
|
|
39586
|
+
}
|
|
39587
|
+
static concat(first, ...targets) {
|
|
39588
|
+
const computed = new this(first);
|
|
39589
|
+
targets.forEach((target) => computed.set(target));
|
|
39590
|
+
return computed;
|
|
39591
|
+
}
|
|
39592
|
+
static accessor(header) {
|
|
39593
|
+
const internals = this[$internals] = this[$internals] = {
|
|
39594
|
+
accessors: {}
|
|
39595
|
+
};
|
|
39596
|
+
const accessors = internals.accessors;
|
|
39597
|
+
const prototype2 = this.prototype;
|
|
39598
|
+
function defineAccessor(_header) {
|
|
39599
|
+
const lHeader = normalizeHeader(_header);
|
|
39600
|
+
if (!accessors[lHeader]) {
|
|
39601
|
+
buildAccessors(prototype2, _header);
|
|
39602
|
+
accessors[lHeader] = true;
|
|
39603
|
+
}
|
|
39604
|
+
}
|
|
39605
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
39606
|
+
return this;
|
|
39607
|
+
}
|
|
39608
|
+
}
|
|
39609
|
+
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
39610
|
+
utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value: value2 }, key) => {
|
|
39611
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
39612
|
+
return {
|
|
39613
|
+
get: () => value2,
|
|
39614
|
+
set(headerValue) {
|
|
39615
|
+
this[mapped] = headerValue;
|
|
39616
|
+
}
|
|
39617
|
+
};
|
|
39618
|
+
});
|
|
39619
|
+
utils$1.freezeMethods(AxiosHeaders);
|
|
39620
|
+
var AxiosHeaders$1 = AxiosHeaders;
|
|
39621
|
+
function transformData(fns, response) {
|
|
39622
|
+
const config2 = this || defaults$1;
|
|
39623
|
+
const context3 = response || config2;
|
|
39624
|
+
const headers = AxiosHeaders$1.from(context3.headers);
|
|
39625
|
+
let data = context3.data;
|
|
39626
|
+
utils$1.forEach(fns, function transform(fn) {
|
|
39627
|
+
data = fn.call(config2, data, headers.normalize(), response ? response.status : undefined);
|
|
39628
|
+
});
|
|
39629
|
+
headers.normalize();
|
|
39630
|
+
return data;
|
|
39631
|
+
}
|
|
39632
|
+
function isCancel(value2) {
|
|
39633
|
+
return !!(value2 && value2.__CANCEL__);
|
|
39634
|
+
}
|
|
39635
|
+
function CanceledError(message2, config2, request) {
|
|
39636
|
+
AxiosError.call(this, message2 == null ? "canceled" : message2, AxiosError.ERR_CANCELED, config2, request);
|
|
39637
|
+
this.name = "CanceledError";
|
|
39638
|
+
}
|
|
39639
|
+
utils$1.inherits(CanceledError, AxiosError, {
|
|
39640
|
+
__CANCEL__: true
|
|
39641
|
+
});
|
|
39642
|
+
function settle(resolve, reject, response) {
|
|
39643
|
+
const validateStatus = response.config.validateStatus;
|
|
39644
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
39645
|
+
resolve(response);
|
|
39646
|
+
} else {
|
|
39647
|
+
reject(new AxiosError("Request failed with status code " + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
|
|
39648
|
+
}
|
|
39649
|
+
}
|
|
39650
|
+
function isAbsoluteURL(url2) {
|
|
39651
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
|
|
39652
|
+
}
|
|
39653
|
+
function combineURLs(baseURL, relativeURL) {
|
|
39654
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
39655
|
+
}
|
|
39656
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
39657
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
39658
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
39659
|
+
return combineURLs(baseURL, requestedURL);
|
|
39660
|
+
}
|
|
39661
|
+
return requestedURL;
|
|
39662
|
+
}
|
|
39663
|
+
var VERSION3 = "1.8.4";
|
|
39664
|
+
function parseProtocol(url2) {
|
|
39665
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
|
|
39666
|
+
return match && match[1] || "";
|
|
39667
|
+
}
|
|
39668
|
+
var DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
|
|
39669
|
+
function fromDataURI(uri, asBlob, options) {
|
|
39670
|
+
const _Blob = options && options.Blob || platform.classes.Blob;
|
|
39671
|
+
const protocol = parseProtocol(uri);
|
|
39672
|
+
if (asBlob === undefined && _Blob) {
|
|
39673
|
+
asBlob = true;
|
|
39674
|
+
}
|
|
39675
|
+
if (protocol === "data") {
|
|
39676
|
+
uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
|
|
39677
|
+
const match = DATA_URL_PATTERN.exec(uri);
|
|
39678
|
+
if (!match) {
|
|
39679
|
+
throw new AxiosError("Invalid URL", AxiosError.ERR_INVALID_URL);
|
|
39680
|
+
}
|
|
39681
|
+
const mime = match[1];
|
|
39682
|
+
const isBase64 = match[2];
|
|
39683
|
+
const body = match[3];
|
|
39684
|
+
const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? "base64" : "utf8");
|
|
39685
|
+
if (asBlob) {
|
|
39686
|
+
if (!_Blob) {
|
|
39687
|
+
throw new AxiosError("Blob is not supported", AxiosError.ERR_NOT_SUPPORT);
|
|
39688
|
+
}
|
|
39689
|
+
return new _Blob([buffer], { type: mime });
|
|
39690
|
+
}
|
|
39691
|
+
return buffer;
|
|
39692
|
+
}
|
|
39693
|
+
throw new AxiosError("Unsupported protocol " + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
39694
|
+
}
|
|
39695
|
+
var kInternals = Symbol("internals");
|
|
39696
|
+
|
|
39697
|
+
class AxiosTransformStream extends stream__default["default"].Transform {
|
|
39698
|
+
constructor(options) {
|
|
39699
|
+
options = utils$1.toFlatObject(options, {
|
|
39700
|
+
maxRate: 0,
|
|
39701
|
+
chunkSize: 64 * 1024,
|
|
39702
|
+
minChunkSize: 100,
|
|
39703
|
+
timeWindow: 500,
|
|
39704
|
+
ticksRate: 2,
|
|
39705
|
+
samplesCount: 15
|
|
39706
|
+
}, null, (prop, source) => {
|
|
39707
|
+
return !utils$1.isUndefined(source[prop]);
|
|
39708
|
+
});
|
|
39709
|
+
super({
|
|
39710
|
+
readableHighWaterMark: options.chunkSize
|
|
39711
|
+
});
|
|
39712
|
+
const internals = this[kInternals] = {
|
|
39713
|
+
timeWindow: options.timeWindow,
|
|
39714
|
+
chunkSize: options.chunkSize,
|
|
39715
|
+
maxRate: options.maxRate,
|
|
39716
|
+
minChunkSize: options.minChunkSize,
|
|
39717
|
+
bytesSeen: 0,
|
|
39718
|
+
isCaptured: false,
|
|
39719
|
+
notifiedBytesLoaded: 0,
|
|
39720
|
+
ts: Date.now(),
|
|
39721
|
+
bytes: 0,
|
|
39722
|
+
onReadCallback: null
|
|
39723
|
+
};
|
|
39724
|
+
this.on("newListener", (event) => {
|
|
39725
|
+
if (event === "progress") {
|
|
39726
|
+
if (!internals.isCaptured) {
|
|
39727
|
+
internals.isCaptured = true;
|
|
39728
|
+
}
|
|
39729
|
+
}
|
|
39730
|
+
});
|
|
39731
|
+
}
|
|
39732
|
+
_read(size) {
|
|
39733
|
+
const internals = this[kInternals];
|
|
39734
|
+
if (internals.onReadCallback) {
|
|
39735
|
+
internals.onReadCallback();
|
|
39736
|
+
}
|
|
39737
|
+
return super._read(size);
|
|
39738
|
+
}
|
|
39739
|
+
_transform(chunk, encoding, callback) {
|
|
39740
|
+
const internals = this[kInternals];
|
|
39741
|
+
const maxRate = internals.maxRate;
|
|
39742
|
+
const readableHighWaterMark = this.readableHighWaterMark;
|
|
39743
|
+
const timeWindow = internals.timeWindow;
|
|
39744
|
+
const divider = 1000 / timeWindow;
|
|
39745
|
+
const bytesThreshold = maxRate / divider;
|
|
39746
|
+
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
|
39747
|
+
const pushChunk = (_chunk, _callback) => {
|
|
39748
|
+
const bytes = Buffer.byteLength(_chunk);
|
|
39749
|
+
internals.bytesSeen += bytes;
|
|
39750
|
+
internals.bytes += bytes;
|
|
39751
|
+
internals.isCaptured && this.emit("progress", internals.bytesSeen);
|
|
39752
|
+
if (this.push(_chunk)) {
|
|
39753
|
+
process.nextTick(_callback);
|
|
39754
|
+
} else {
|
|
39755
|
+
internals.onReadCallback = () => {
|
|
39756
|
+
internals.onReadCallback = null;
|
|
39757
|
+
process.nextTick(_callback);
|
|
39758
|
+
};
|
|
39759
|
+
}
|
|
39760
|
+
};
|
|
39761
|
+
const transformChunk = (_chunk, _callback) => {
|
|
39762
|
+
const chunkSize = Buffer.byteLength(_chunk);
|
|
39763
|
+
let chunkRemainder = null;
|
|
39764
|
+
let maxChunkSize = readableHighWaterMark;
|
|
39765
|
+
let bytesLeft;
|
|
39766
|
+
let passed = 0;
|
|
39767
|
+
if (maxRate) {
|
|
39768
|
+
const now = Date.now();
|
|
39769
|
+
if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
|
|
39770
|
+
internals.ts = now;
|
|
39771
|
+
bytesLeft = bytesThreshold - internals.bytes;
|
|
39772
|
+
internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
|
|
39773
|
+
passed = 0;
|
|
39774
|
+
}
|
|
39775
|
+
bytesLeft = bytesThreshold - internals.bytes;
|
|
39776
|
+
}
|
|
39777
|
+
if (maxRate) {
|
|
39778
|
+
if (bytesLeft <= 0) {
|
|
39779
|
+
return setTimeout(() => {
|
|
39780
|
+
_callback(null, _chunk);
|
|
39781
|
+
}, timeWindow - passed);
|
|
39782
|
+
}
|
|
39783
|
+
if (bytesLeft < maxChunkSize) {
|
|
39784
|
+
maxChunkSize = bytesLeft;
|
|
39785
|
+
}
|
|
39786
|
+
}
|
|
39787
|
+
if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
|
|
39788
|
+
chunkRemainder = _chunk.subarray(maxChunkSize);
|
|
39789
|
+
_chunk = _chunk.subarray(0, maxChunkSize);
|
|
39790
|
+
}
|
|
39791
|
+
pushChunk(_chunk, chunkRemainder ? () => {
|
|
39792
|
+
process.nextTick(_callback, null, chunkRemainder);
|
|
39793
|
+
} : _callback);
|
|
39794
|
+
};
|
|
39795
|
+
transformChunk(chunk, function transformNextChunk(err, _chunk) {
|
|
39796
|
+
if (err) {
|
|
39797
|
+
return callback(err);
|
|
39798
|
+
}
|
|
39799
|
+
if (_chunk) {
|
|
39800
|
+
transformChunk(_chunk, transformNextChunk);
|
|
39801
|
+
} else {
|
|
39802
|
+
callback(null);
|
|
39803
|
+
}
|
|
39804
|
+
});
|
|
39805
|
+
}
|
|
39806
|
+
}
|
|
39807
|
+
var AxiosTransformStream$1 = AxiosTransformStream;
|
|
39808
|
+
var { asyncIterator } = Symbol;
|
|
39809
|
+
var readBlob = async function* (blob) {
|
|
39810
|
+
if (blob.stream) {
|
|
39811
|
+
yield* blob.stream();
|
|
39812
|
+
} else if (blob.arrayBuffer) {
|
|
39813
|
+
yield await blob.arrayBuffer();
|
|
39814
|
+
} else if (blob[asyncIterator]) {
|
|
39815
|
+
yield* blob[asyncIterator]();
|
|
39816
|
+
} else {
|
|
39817
|
+
yield blob;
|
|
39818
|
+
}
|
|
39819
|
+
};
|
|
39820
|
+
var readBlob$1 = readBlob;
|
|
39821
|
+
var BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + "-_";
|
|
39822
|
+
var textEncoder = typeof TextEncoder === "function" ? new TextEncoder : new util__default["default"].TextEncoder;
|
|
39823
|
+
var CRLF = `\r
|
|
39824
|
+
`;
|
|
39825
|
+
var CRLF_BYTES = textEncoder.encode(CRLF);
|
|
39826
|
+
var CRLF_BYTES_COUNT = 2;
|
|
39827
|
+
|
|
39828
|
+
class FormDataPart {
|
|
39829
|
+
constructor(name2, value2) {
|
|
39830
|
+
const { escapeName } = this.constructor;
|
|
39831
|
+
const isStringValue = utils$1.isString(value2);
|
|
39832
|
+
let headers = `Content-Disposition: form-data; name="${escapeName(name2)}"${!isStringValue && value2.name ? `; filename="${escapeName(value2.name)}"` : ""}${CRLF}`;
|
|
39833
|
+
if (isStringValue) {
|
|
39834
|
+
value2 = textEncoder.encode(String(value2).replace(/\r?\n|\r\n?/g, CRLF));
|
|
39835
|
+
} else {
|
|
39836
|
+
headers += `Content-Type: ${value2.type || "application/octet-stream"}${CRLF}`;
|
|
39837
|
+
}
|
|
39838
|
+
this.headers = textEncoder.encode(headers + CRLF);
|
|
39839
|
+
this.contentLength = isStringValue ? value2.byteLength : value2.size;
|
|
39840
|
+
this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
|
|
39841
|
+
this.name = name2;
|
|
39842
|
+
this.value = value2;
|
|
39843
|
+
}
|
|
39844
|
+
async* encode() {
|
|
39845
|
+
yield this.headers;
|
|
39846
|
+
const { value: value2 } = this;
|
|
39847
|
+
if (utils$1.isTypedArray(value2)) {
|
|
39848
|
+
yield value2;
|
|
39849
|
+
} else {
|
|
39850
|
+
yield* readBlob$1(value2);
|
|
39851
|
+
}
|
|
39852
|
+
yield CRLF_BYTES;
|
|
39853
|
+
}
|
|
39854
|
+
static escapeName(name2) {
|
|
39855
|
+
return String(name2).replace(/[\r\n"]/g, (match) => ({
|
|
39856
|
+
"\r": "%0D",
|
|
39857
|
+
"\n": "%0A",
|
|
39858
|
+
'"': "%22"
|
|
39859
|
+
})[match]);
|
|
39860
|
+
}
|
|
39861
|
+
}
|
|
39862
|
+
var formDataToStream = (form, headersHandler, options) => {
|
|
39863
|
+
const {
|
|
39864
|
+
tag: tag2 = "form-data-boundary",
|
|
39865
|
+
size = 25,
|
|
39866
|
+
boundary = tag2 + "-" + platform.generateString(size, BOUNDARY_ALPHABET)
|
|
39867
|
+
} = options || {};
|
|
39868
|
+
if (!utils$1.isFormData(form)) {
|
|
39869
|
+
throw TypeError("FormData instance required");
|
|
39870
|
+
}
|
|
39871
|
+
if (boundary.length < 1 || boundary.length > 70) {
|
|
39872
|
+
throw Error("boundary must be 10-70 characters long");
|
|
39873
|
+
}
|
|
39874
|
+
const boundaryBytes = textEncoder.encode("--" + boundary + CRLF);
|
|
39875
|
+
const footerBytes = textEncoder.encode("--" + boundary + "--" + CRLF + CRLF);
|
|
39876
|
+
let contentLength = footerBytes.byteLength;
|
|
39877
|
+
const parts = Array.from(form.entries()).map(([name2, value2]) => {
|
|
39878
|
+
const part = new FormDataPart(name2, value2);
|
|
39879
|
+
contentLength += part.size;
|
|
39880
|
+
return part;
|
|
39881
|
+
});
|
|
39882
|
+
contentLength += boundaryBytes.byteLength * parts.length;
|
|
39883
|
+
contentLength = utils$1.toFiniteNumber(contentLength);
|
|
39884
|
+
const computedHeaders = {
|
|
39885
|
+
"Content-Type": `multipart/form-data; boundary=${boundary}`
|
|
39886
|
+
};
|
|
39887
|
+
if (Number.isFinite(contentLength)) {
|
|
39888
|
+
computedHeaders["Content-Length"] = contentLength;
|
|
39889
|
+
}
|
|
39890
|
+
headersHandler && headersHandler(computedHeaders);
|
|
39891
|
+
return stream2.Readable.from(async function* () {
|
|
39892
|
+
for (const part of parts) {
|
|
39893
|
+
yield boundaryBytes;
|
|
39894
|
+
yield* part.encode();
|
|
39895
|
+
}
|
|
39896
|
+
yield footerBytes;
|
|
39897
|
+
}());
|
|
39898
|
+
};
|
|
39899
|
+
var formDataToStream$1 = formDataToStream;
|
|
39900
|
+
|
|
39901
|
+
class ZlibHeaderTransformStream extends stream__default["default"].Transform {
|
|
39902
|
+
__transform(chunk, encoding, callback) {
|
|
39903
|
+
this.push(chunk);
|
|
39904
|
+
callback();
|
|
39905
|
+
}
|
|
39906
|
+
_transform(chunk, encoding, callback) {
|
|
39907
|
+
if (chunk.length !== 0) {
|
|
39908
|
+
this._transform = this.__transform;
|
|
39909
|
+
if (chunk[0] !== 120) {
|
|
39910
|
+
const header = Buffer.alloc(2);
|
|
39911
|
+
header[0] = 120;
|
|
39912
|
+
header[1] = 156;
|
|
39913
|
+
this.push(header, encoding);
|
|
39914
|
+
}
|
|
39915
|
+
}
|
|
39916
|
+
this.__transform(chunk, encoding, callback);
|
|
39917
|
+
}
|
|
39918
|
+
}
|
|
39919
|
+
var ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream;
|
|
39920
|
+
var callbackify = (fn, reducer) => {
|
|
39921
|
+
return utils$1.isAsyncFn(fn) ? function(...args) {
|
|
39922
|
+
const cb = args.pop();
|
|
39923
|
+
fn.apply(this, args).then((value2) => {
|
|
39924
|
+
try {
|
|
39925
|
+
reducer ? cb(null, ...reducer(value2)) : cb(null, value2);
|
|
39926
|
+
} catch (err) {
|
|
39927
|
+
cb(err);
|
|
39928
|
+
}
|
|
39929
|
+
}, cb);
|
|
39930
|
+
} : fn;
|
|
39931
|
+
};
|
|
39932
|
+
var callbackify$1 = callbackify;
|
|
39933
|
+
function speedometer(samplesCount, min) {
|
|
39934
|
+
samplesCount = samplesCount || 10;
|
|
39935
|
+
const bytes = new Array(samplesCount);
|
|
39936
|
+
const timestamps = new Array(samplesCount);
|
|
39937
|
+
let head = 0;
|
|
39938
|
+
let tail = 0;
|
|
39939
|
+
let firstSampleTS;
|
|
39940
|
+
min = min !== undefined ? min : 1000;
|
|
39941
|
+
return function push(chunkLength) {
|
|
39942
|
+
const now = Date.now();
|
|
39943
|
+
const startedAt = timestamps[tail];
|
|
39944
|
+
if (!firstSampleTS) {
|
|
39945
|
+
firstSampleTS = now;
|
|
39946
|
+
}
|
|
39947
|
+
bytes[head] = chunkLength;
|
|
39948
|
+
timestamps[head] = now;
|
|
39949
|
+
let i2 = tail;
|
|
39950
|
+
let bytesCount = 0;
|
|
39951
|
+
while (i2 !== head) {
|
|
39952
|
+
bytesCount += bytes[i2++];
|
|
39953
|
+
i2 = i2 % samplesCount;
|
|
39954
|
+
}
|
|
39955
|
+
head = (head + 1) % samplesCount;
|
|
39956
|
+
if (head === tail) {
|
|
39957
|
+
tail = (tail + 1) % samplesCount;
|
|
39958
|
+
}
|
|
39959
|
+
if (now - firstSampleTS < min) {
|
|
39960
|
+
return;
|
|
39961
|
+
}
|
|
39962
|
+
const passed = startedAt && now - startedAt;
|
|
39963
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
39964
|
+
};
|
|
39965
|
+
}
|
|
39966
|
+
function throttle(fn, freq) {
|
|
39967
|
+
let timestamp = 0;
|
|
39968
|
+
let threshold = 1000 / freq;
|
|
39969
|
+
let lastArgs;
|
|
39970
|
+
let timer;
|
|
39971
|
+
const invoke = (args, now = Date.now()) => {
|
|
39972
|
+
timestamp = now;
|
|
39973
|
+
lastArgs = null;
|
|
39974
|
+
if (timer) {
|
|
39975
|
+
clearTimeout(timer);
|
|
39976
|
+
timer = null;
|
|
39977
|
+
}
|
|
39978
|
+
fn.apply(null, args);
|
|
39979
|
+
};
|
|
39980
|
+
const throttled = (...args) => {
|
|
39981
|
+
const now = Date.now();
|
|
39982
|
+
const passed = now - timestamp;
|
|
39983
|
+
if (passed >= threshold) {
|
|
39984
|
+
invoke(args, now);
|
|
39985
|
+
} else {
|
|
39986
|
+
lastArgs = args;
|
|
39987
|
+
if (!timer) {
|
|
39988
|
+
timer = setTimeout(() => {
|
|
39989
|
+
timer = null;
|
|
39990
|
+
invoke(lastArgs);
|
|
39991
|
+
}, threshold - passed);
|
|
39992
|
+
}
|
|
39993
|
+
}
|
|
39994
|
+
};
|
|
39995
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
39996
|
+
return [throttled, flush];
|
|
39997
|
+
}
|
|
39998
|
+
var progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
39999
|
+
let bytesNotified = 0;
|
|
40000
|
+
const _speedometer = speedometer(50, 250);
|
|
40001
|
+
return throttle((e2) => {
|
|
40002
|
+
const loaded = e2.loaded;
|
|
40003
|
+
const total = e2.lengthComputable ? e2.total : undefined;
|
|
40004
|
+
const progressBytes = loaded - bytesNotified;
|
|
40005
|
+
const rate = _speedometer(progressBytes);
|
|
40006
|
+
const inRange = loaded <= total;
|
|
40007
|
+
bytesNotified = loaded;
|
|
40008
|
+
const data = {
|
|
40009
|
+
loaded,
|
|
40010
|
+
total,
|
|
40011
|
+
progress: total ? loaded / total : undefined,
|
|
40012
|
+
bytes: progressBytes,
|
|
40013
|
+
rate: rate ? rate : undefined,
|
|
40014
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
40015
|
+
event: e2,
|
|
40016
|
+
lengthComputable: total != null,
|
|
40017
|
+
[isDownloadStream ? "download" : "upload"]: true
|
|
40018
|
+
};
|
|
40019
|
+
listener(data);
|
|
40020
|
+
}, freq);
|
|
40021
|
+
};
|
|
40022
|
+
var progressEventDecorator = (total, throttled) => {
|
|
40023
|
+
const lengthComputable = total != null;
|
|
40024
|
+
return [(loaded) => throttled[0]({
|
|
40025
|
+
lengthComputable,
|
|
40026
|
+
total,
|
|
40027
|
+
loaded
|
|
40028
|
+
}), throttled[1]];
|
|
40029
|
+
};
|
|
40030
|
+
var asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
40031
|
+
var zlibOptions = {
|
|
40032
|
+
flush: zlib__default["default"].constants.Z_SYNC_FLUSH,
|
|
40033
|
+
finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH
|
|
40034
|
+
};
|
|
40035
|
+
var brotliOptions = {
|
|
40036
|
+
flush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH,
|
|
40037
|
+
finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH
|
|
40038
|
+
};
|
|
40039
|
+
var isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress);
|
|
40040
|
+
var { http: httpFollow, https: httpsFollow } = followRedirects__default["default"];
|
|
40041
|
+
var isHttps = /https:?/;
|
|
40042
|
+
var supportedProtocols = platform.protocols.map((protocol) => {
|
|
40043
|
+
return protocol + ":";
|
|
40044
|
+
});
|
|
40045
|
+
var flushOnFinish = (stream3, [throttled, flush]) => {
|
|
40046
|
+
stream3.on("end", flush).on("error", flush);
|
|
40047
|
+
return throttled;
|
|
40048
|
+
};
|
|
40049
|
+
function dispatchBeforeRedirect(options, responseDetails) {
|
|
40050
|
+
if (options.beforeRedirects.proxy) {
|
|
40051
|
+
options.beforeRedirects.proxy(options);
|
|
40052
|
+
}
|
|
40053
|
+
if (options.beforeRedirects.config) {
|
|
40054
|
+
options.beforeRedirects.config(options, responseDetails);
|
|
40055
|
+
}
|
|
40056
|
+
}
|
|
40057
|
+
function setProxy(options, configProxy, location) {
|
|
40058
|
+
let proxy = configProxy;
|
|
40059
|
+
if (!proxy && proxy !== false) {
|
|
40060
|
+
const proxyUrl = proxyFromEnv__default["default"].getProxyForUrl(location);
|
|
40061
|
+
if (proxyUrl) {
|
|
40062
|
+
proxy = new URL(proxyUrl);
|
|
40063
|
+
}
|
|
40064
|
+
}
|
|
40065
|
+
if (proxy) {
|
|
40066
|
+
if (proxy.username) {
|
|
40067
|
+
proxy.auth = (proxy.username || "") + ":" + (proxy.password || "");
|
|
40068
|
+
}
|
|
40069
|
+
if (proxy.auth) {
|
|
40070
|
+
if (proxy.auth.username || proxy.auth.password) {
|
|
40071
|
+
proxy.auth = (proxy.auth.username || "") + ":" + (proxy.auth.password || "");
|
|
40072
|
+
}
|
|
40073
|
+
const base64 = Buffer.from(proxy.auth, "utf8").toString("base64");
|
|
40074
|
+
options.headers["Proxy-Authorization"] = "Basic " + base64;
|
|
40075
|
+
}
|
|
40076
|
+
options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
|
|
40077
|
+
const proxyHost = proxy.hostname || proxy.host;
|
|
40078
|
+
options.hostname = proxyHost;
|
|
40079
|
+
options.host = proxyHost;
|
|
40080
|
+
options.port = proxy.port;
|
|
40081
|
+
options.path = location;
|
|
40082
|
+
if (proxy.protocol) {
|
|
40083
|
+
options.protocol = proxy.protocol.includes(":") ? proxy.protocol : `${proxy.protocol}:`;
|
|
40084
|
+
}
|
|
40085
|
+
}
|
|
40086
|
+
options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
|
|
40087
|
+
setProxy(redirectOptions, configProxy, redirectOptions.href);
|
|
40088
|
+
};
|
|
40089
|
+
}
|
|
40090
|
+
var isHttpAdapterSupported = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
|
|
40091
|
+
var wrapAsync = (asyncExecutor) => {
|
|
40092
|
+
return new Promise((resolve, reject) => {
|
|
40093
|
+
let onDone;
|
|
40094
|
+
let isDone;
|
|
40095
|
+
const done = (value2, isRejected) => {
|
|
40096
|
+
if (isDone)
|
|
40097
|
+
return;
|
|
40098
|
+
isDone = true;
|
|
40099
|
+
onDone && onDone(value2, isRejected);
|
|
40100
|
+
};
|
|
40101
|
+
const _resolve = (value2) => {
|
|
40102
|
+
done(value2);
|
|
40103
|
+
resolve(value2);
|
|
40104
|
+
};
|
|
40105
|
+
const _reject = (reason) => {
|
|
40106
|
+
done(reason, true);
|
|
40107
|
+
reject(reason);
|
|
40108
|
+
};
|
|
40109
|
+
asyncExecutor(_resolve, _reject, (onDoneHandler) => onDone = onDoneHandler).catch(_reject);
|
|
40110
|
+
});
|
|
40111
|
+
};
|
|
40112
|
+
var resolveFamily = ({ address, family }) => {
|
|
40113
|
+
if (!utils$1.isString(address)) {
|
|
40114
|
+
throw TypeError("address must be a string");
|
|
40115
|
+
}
|
|
40116
|
+
return {
|
|
40117
|
+
address,
|
|
40118
|
+
family: family || (address.indexOf(".") < 0 ? 6 : 4)
|
|
40119
|
+
};
|
|
40120
|
+
};
|
|
40121
|
+
var buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : { address, family });
|
|
40122
|
+
var httpAdapter = isHttpAdapterSupported && function httpAdapter(config2) {
|
|
40123
|
+
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
|
40124
|
+
let { data, lookup, family } = config2;
|
|
40125
|
+
const { responseType, responseEncoding } = config2;
|
|
40126
|
+
const method = config2.method.toUpperCase();
|
|
40127
|
+
let isDone;
|
|
40128
|
+
let rejected = false;
|
|
40129
|
+
let req;
|
|
40130
|
+
if (lookup) {
|
|
40131
|
+
const _lookup = callbackify$1(lookup, (value2) => utils$1.isArray(value2) ? value2 : [value2]);
|
|
40132
|
+
lookup = (hostname, opt, cb) => {
|
|
40133
|
+
_lookup(hostname, opt, (err, arg0, arg1) => {
|
|
40134
|
+
if (err) {
|
|
40135
|
+
return cb(err);
|
|
40136
|
+
}
|
|
40137
|
+
const addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
|
40138
|
+
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
40139
|
+
});
|
|
40140
|
+
};
|
|
40141
|
+
}
|
|
40142
|
+
const emitter = new events.EventEmitter;
|
|
40143
|
+
const onFinished = () => {
|
|
40144
|
+
if (config2.cancelToken) {
|
|
40145
|
+
config2.cancelToken.unsubscribe(abort);
|
|
40146
|
+
}
|
|
40147
|
+
if (config2.signal) {
|
|
40148
|
+
config2.signal.removeEventListener("abort", abort);
|
|
40149
|
+
}
|
|
40150
|
+
emitter.removeAllListeners();
|
|
40151
|
+
};
|
|
40152
|
+
onDone((value2, isRejected) => {
|
|
40153
|
+
isDone = true;
|
|
40154
|
+
if (isRejected) {
|
|
40155
|
+
rejected = true;
|
|
40156
|
+
onFinished();
|
|
40157
|
+
}
|
|
40158
|
+
});
|
|
40159
|
+
function abort(reason) {
|
|
40160
|
+
emitter.emit("abort", !reason || reason.type ? new CanceledError(null, config2, req) : reason);
|
|
40161
|
+
}
|
|
40162
|
+
emitter.once("abort", reject);
|
|
40163
|
+
if (config2.cancelToken || config2.signal) {
|
|
40164
|
+
config2.cancelToken && config2.cancelToken.subscribe(abort);
|
|
40165
|
+
if (config2.signal) {
|
|
40166
|
+
config2.signal.aborted ? abort() : config2.signal.addEventListener("abort", abort);
|
|
40167
|
+
}
|
|
40168
|
+
}
|
|
40169
|
+
const fullPath = buildFullPath(config2.baseURL, config2.url, config2.allowAbsoluteUrls);
|
|
40170
|
+
const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
|
|
40171
|
+
const protocol = parsed.protocol || supportedProtocols[0];
|
|
40172
|
+
if (protocol === "data:") {
|
|
40173
|
+
let convertedData;
|
|
40174
|
+
if (method !== "GET") {
|
|
40175
|
+
return settle(resolve, reject, {
|
|
40176
|
+
status: 405,
|
|
40177
|
+
statusText: "method not allowed",
|
|
40178
|
+
headers: {},
|
|
40179
|
+
config: config2
|
|
40180
|
+
});
|
|
40181
|
+
}
|
|
40182
|
+
try {
|
|
40183
|
+
convertedData = fromDataURI(config2.url, responseType === "blob", {
|
|
40184
|
+
Blob: config2.env && config2.env.Blob
|
|
40185
|
+
});
|
|
40186
|
+
} catch (err) {
|
|
40187
|
+
throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config2);
|
|
40188
|
+
}
|
|
40189
|
+
if (responseType === "text") {
|
|
40190
|
+
convertedData = convertedData.toString(responseEncoding);
|
|
40191
|
+
if (!responseEncoding || responseEncoding === "utf8") {
|
|
40192
|
+
convertedData = utils$1.stripBOM(convertedData);
|
|
40193
|
+
}
|
|
40194
|
+
} else if (responseType === "stream") {
|
|
40195
|
+
convertedData = stream__default["default"].Readable.from(convertedData);
|
|
40196
|
+
}
|
|
40197
|
+
return settle(resolve, reject, {
|
|
40198
|
+
data: convertedData,
|
|
40199
|
+
status: 200,
|
|
40200
|
+
statusText: "OK",
|
|
40201
|
+
headers: new AxiosHeaders$1,
|
|
40202
|
+
config: config2
|
|
40203
|
+
});
|
|
40204
|
+
}
|
|
40205
|
+
if (supportedProtocols.indexOf(protocol) === -1) {
|
|
40206
|
+
return reject(new AxiosError("Unsupported protocol " + protocol, AxiosError.ERR_BAD_REQUEST, config2));
|
|
40207
|
+
}
|
|
40208
|
+
const headers = AxiosHeaders$1.from(config2.headers).normalize();
|
|
40209
|
+
headers.set("User-Agent", "axios/" + VERSION3, false);
|
|
40210
|
+
const { onUploadProgress, onDownloadProgress } = config2;
|
|
40211
|
+
const maxRate = config2.maxRate;
|
|
40212
|
+
let maxUploadRate = undefined;
|
|
40213
|
+
let maxDownloadRate = undefined;
|
|
40214
|
+
if (utils$1.isSpecCompliantForm(data)) {
|
|
40215
|
+
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
|
40216
|
+
data = formDataToStream$1(data, (formHeaders) => {
|
|
40217
|
+
headers.set(formHeaders);
|
|
40218
|
+
}, {
|
|
40219
|
+
tag: `axios-${VERSION3}-boundary`,
|
|
40220
|
+
boundary: userBoundary && userBoundary[1] || undefined
|
|
40221
|
+
});
|
|
40222
|
+
} else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
|
|
40223
|
+
headers.set(data.getHeaders());
|
|
40224
|
+
if (!headers.hasContentLength()) {
|
|
40225
|
+
try {
|
|
40226
|
+
const knownLength = await util__default["default"].promisify(data.getLength).call(data);
|
|
40227
|
+
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
|
40228
|
+
} catch (e2) {
|
|
40229
|
+
}
|
|
40230
|
+
}
|
|
40231
|
+
} else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
|
|
40232
|
+
data.size && headers.setContentType(data.type || "application/octet-stream");
|
|
40233
|
+
headers.setContentLength(data.size || 0);
|
|
40234
|
+
data = stream__default["default"].Readable.from(readBlob$1(data));
|
|
40235
|
+
} else if (data && !utils$1.isStream(data)) {
|
|
40236
|
+
if (Buffer.isBuffer(data))
|
|
40237
|
+
;
|
|
40238
|
+
else if (utils$1.isArrayBuffer(data)) {
|
|
40239
|
+
data = Buffer.from(new Uint8Array(data));
|
|
40240
|
+
} else if (utils$1.isString(data)) {
|
|
40241
|
+
data = Buffer.from(data, "utf-8");
|
|
40242
|
+
} else {
|
|
40243
|
+
return reject(new AxiosError("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream", AxiosError.ERR_BAD_REQUEST, config2));
|
|
40244
|
+
}
|
|
40245
|
+
headers.setContentLength(data.length, false);
|
|
40246
|
+
if (config2.maxBodyLength > -1 && data.length > config2.maxBodyLength) {
|
|
40247
|
+
return reject(new AxiosError("Request body larger than maxBodyLength limit", AxiosError.ERR_BAD_REQUEST, config2));
|
|
40248
|
+
}
|
|
40249
|
+
}
|
|
40250
|
+
const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
|
|
40251
|
+
if (utils$1.isArray(maxRate)) {
|
|
40252
|
+
maxUploadRate = maxRate[0];
|
|
40253
|
+
maxDownloadRate = maxRate[1];
|
|
40254
|
+
} else {
|
|
40255
|
+
maxUploadRate = maxDownloadRate = maxRate;
|
|
40256
|
+
}
|
|
40257
|
+
if (data && (onUploadProgress || maxUploadRate)) {
|
|
40258
|
+
if (!utils$1.isStream(data)) {
|
|
40259
|
+
data = stream__default["default"].Readable.from(data, { objectMode: false });
|
|
40260
|
+
}
|
|
40261
|
+
data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({
|
|
40262
|
+
maxRate: utils$1.toFiniteNumber(maxUploadRate)
|
|
40263
|
+
})], utils$1.noop);
|
|
40264
|
+
onUploadProgress && data.on("progress", flushOnFinish(data, progressEventDecorator(contentLength, progressEventReducer(asyncDecorator(onUploadProgress), false, 3))));
|
|
40265
|
+
}
|
|
40266
|
+
let auth2 = undefined;
|
|
40267
|
+
if (config2.auth) {
|
|
40268
|
+
const username = config2.auth.username || "";
|
|
40269
|
+
const password = config2.auth.password || "";
|
|
40270
|
+
auth2 = username + ":" + password;
|
|
40271
|
+
}
|
|
40272
|
+
if (!auth2 && parsed.username) {
|
|
40273
|
+
const urlUsername = parsed.username;
|
|
40274
|
+
const urlPassword = parsed.password;
|
|
40275
|
+
auth2 = urlUsername + ":" + urlPassword;
|
|
40276
|
+
}
|
|
40277
|
+
auth2 && headers.delete("authorization");
|
|
40278
|
+
let path;
|
|
40279
|
+
try {
|
|
40280
|
+
path = buildURL(parsed.pathname + parsed.search, config2.params, config2.paramsSerializer).replace(/^\?/, "");
|
|
40281
|
+
} catch (err) {
|
|
40282
|
+
const customErr = new Error(err.message);
|
|
40283
|
+
customErr.config = config2;
|
|
40284
|
+
customErr.url = config2.url;
|
|
40285
|
+
customErr.exists = true;
|
|
40286
|
+
return reject(customErr);
|
|
40287
|
+
}
|
|
40288
|
+
headers.set("Accept-Encoding", "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""), false);
|
|
40289
|
+
const options = {
|
|
40290
|
+
path,
|
|
40291
|
+
method,
|
|
40292
|
+
headers: headers.toJSON(),
|
|
40293
|
+
agents: { http: config2.httpAgent, https: config2.httpsAgent },
|
|
40294
|
+
auth: auth2,
|
|
40295
|
+
protocol,
|
|
40296
|
+
family,
|
|
40297
|
+
beforeRedirect: dispatchBeforeRedirect,
|
|
40298
|
+
beforeRedirects: {}
|
|
40299
|
+
};
|
|
40300
|
+
!utils$1.isUndefined(lookup) && (options.lookup = lookup);
|
|
40301
|
+
if (config2.socketPath) {
|
|
40302
|
+
options.socketPath = config2.socketPath;
|
|
40303
|
+
} else {
|
|
40304
|
+
options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
|
|
40305
|
+
options.port = parsed.port;
|
|
40306
|
+
setProxy(options, config2.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
|
|
40307
|
+
}
|
|
40308
|
+
let transport;
|
|
40309
|
+
const isHttpsRequest = isHttps.test(options.protocol);
|
|
40310
|
+
options.agent = isHttpsRequest ? config2.httpsAgent : config2.httpAgent;
|
|
40311
|
+
if (config2.transport) {
|
|
40312
|
+
transport = config2.transport;
|
|
40313
|
+
} else if (config2.maxRedirects === 0) {
|
|
40314
|
+
transport = isHttpsRequest ? https__default["default"] : http__default["default"];
|
|
40315
|
+
} else {
|
|
40316
|
+
if (config2.maxRedirects) {
|
|
40317
|
+
options.maxRedirects = config2.maxRedirects;
|
|
40318
|
+
}
|
|
40319
|
+
if (config2.beforeRedirect) {
|
|
40320
|
+
options.beforeRedirects.config = config2.beforeRedirect;
|
|
40321
|
+
}
|
|
40322
|
+
transport = isHttpsRequest ? httpsFollow : httpFollow;
|
|
40323
|
+
}
|
|
40324
|
+
if (config2.maxBodyLength > -1) {
|
|
40325
|
+
options.maxBodyLength = config2.maxBodyLength;
|
|
40326
|
+
} else {
|
|
40327
|
+
options.maxBodyLength = Infinity;
|
|
40328
|
+
}
|
|
40329
|
+
if (config2.insecureHTTPParser) {
|
|
40330
|
+
options.insecureHTTPParser = config2.insecureHTTPParser;
|
|
40331
|
+
}
|
|
40332
|
+
req = transport.request(options, function handleResponse(res) {
|
|
40333
|
+
if (req.destroyed)
|
|
40334
|
+
return;
|
|
40335
|
+
const streams = [res];
|
|
40336
|
+
const responseLength = +res.headers["content-length"];
|
|
40337
|
+
if (onDownloadProgress || maxDownloadRate) {
|
|
40338
|
+
const transformStream = new AxiosTransformStream$1({
|
|
40339
|
+
maxRate: utils$1.toFiniteNumber(maxDownloadRate)
|
|
40340
|
+
});
|
|
40341
|
+
onDownloadProgress && transformStream.on("progress", flushOnFinish(transformStream, progressEventDecorator(responseLength, progressEventReducer(asyncDecorator(onDownloadProgress), true, 3))));
|
|
40342
|
+
streams.push(transformStream);
|
|
40343
|
+
}
|
|
40344
|
+
let responseStream = res;
|
|
40345
|
+
const lastRequest = res.req || req;
|
|
40346
|
+
if (config2.decompress !== false && res.headers["content-encoding"]) {
|
|
40347
|
+
if (method === "HEAD" || res.statusCode === 204) {
|
|
40348
|
+
delete res.headers["content-encoding"];
|
|
40349
|
+
}
|
|
40350
|
+
switch ((res.headers["content-encoding"] || "").toLowerCase()) {
|
|
40351
|
+
case "gzip":
|
|
40352
|
+
case "x-gzip":
|
|
40353
|
+
case "compress":
|
|
40354
|
+
case "x-compress":
|
|
40355
|
+
streams.push(zlib__default["default"].createUnzip(zlibOptions));
|
|
40356
|
+
delete res.headers["content-encoding"];
|
|
40357
|
+
break;
|
|
40358
|
+
case "deflate":
|
|
40359
|
+
streams.push(new ZlibHeaderTransformStream$1);
|
|
40360
|
+
streams.push(zlib__default["default"].createUnzip(zlibOptions));
|
|
40361
|
+
delete res.headers["content-encoding"];
|
|
40362
|
+
break;
|
|
40363
|
+
case "br":
|
|
40364
|
+
if (isBrotliSupported) {
|
|
40365
|
+
streams.push(zlib__default["default"].createBrotliDecompress(brotliOptions));
|
|
40366
|
+
delete res.headers["content-encoding"];
|
|
40367
|
+
}
|
|
40368
|
+
}
|
|
40369
|
+
}
|
|
40370
|
+
responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils$1.noop) : streams[0];
|
|
40371
|
+
const offListeners = stream__default["default"].finished(responseStream, () => {
|
|
40372
|
+
offListeners();
|
|
40373
|
+
onFinished();
|
|
40374
|
+
});
|
|
40375
|
+
const response = {
|
|
40376
|
+
status: res.statusCode,
|
|
40377
|
+
statusText: res.statusMessage,
|
|
40378
|
+
headers: new AxiosHeaders$1(res.headers),
|
|
40379
|
+
config: config2,
|
|
40380
|
+
request: lastRequest
|
|
40381
|
+
};
|
|
40382
|
+
if (responseType === "stream") {
|
|
40383
|
+
response.data = responseStream;
|
|
40384
|
+
settle(resolve, reject, response);
|
|
40385
|
+
} else {
|
|
40386
|
+
const responseBuffer = [];
|
|
40387
|
+
let totalResponseBytes = 0;
|
|
40388
|
+
responseStream.on("data", function handleStreamData(chunk) {
|
|
40389
|
+
responseBuffer.push(chunk);
|
|
40390
|
+
totalResponseBytes += chunk.length;
|
|
40391
|
+
if (config2.maxContentLength > -1 && totalResponseBytes > config2.maxContentLength) {
|
|
40392
|
+
rejected = true;
|
|
40393
|
+
responseStream.destroy();
|
|
40394
|
+
reject(new AxiosError("maxContentLength size of " + config2.maxContentLength + " exceeded", AxiosError.ERR_BAD_RESPONSE, config2, lastRequest));
|
|
40395
|
+
}
|
|
40396
|
+
});
|
|
40397
|
+
responseStream.on("aborted", function handlerStreamAborted() {
|
|
40398
|
+
if (rejected) {
|
|
40399
|
+
return;
|
|
40400
|
+
}
|
|
40401
|
+
const err = new AxiosError("stream has been aborted", AxiosError.ERR_BAD_RESPONSE, config2, lastRequest);
|
|
40402
|
+
responseStream.destroy(err);
|
|
40403
|
+
reject(err);
|
|
40404
|
+
});
|
|
40405
|
+
responseStream.on("error", function handleStreamError(err) {
|
|
40406
|
+
if (req.destroyed)
|
|
40407
|
+
return;
|
|
40408
|
+
reject(AxiosError.from(err, null, config2, lastRequest));
|
|
40409
|
+
});
|
|
40410
|
+
responseStream.on("end", function handleStreamEnd() {
|
|
40411
|
+
try {
|
|
40412
|
+
let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
|
|
40413
|
+
if (responseType !== "arraybuffer") {
|
|
40414
|
+
responseData = responseData.toString(responseEncoding);
|
|
40415
|
+
if (!responseEncoding || responseEncoding === "utf8") {
|
|
40416
|
+
responseData = utils$1.stripBOM(responseData);
|
|
40417
|
+
}
|
|
40418
|
+
}
|
|
40419
|
+
response.data = responseData;
|
|
40420
|
+
} catch (err) {
|
|
40421
|
+
return reject(AxiosError.from(err, null, config2, response.request, response));
|
|
40422
|
+
}
|
|
40423
|
+
settle(resolve, reject, response);
|
|
40424
|
+
});
|
|
40425
|
+
}
|
|
40426
|
+
emitter.once("abort", (err) => {
|
|
40427
|
+
if (!responseStream.destroyed) {
|
|
40428
|
+
responseStream.emit("error", err);
|
|
40429
|
+
responseStream.destroy();
|
|
40430
|
+
}
|
|
40431
|
+
});
|
|
40432
|
+
});
|
|
40433
|
+
emitter.once("abort", (err) => {
|
|
40434
|
+
reject(err);
|
|
40435
|
+
req.destroy(err);
|
|
40436
|
+
});
|
|
40437
|
+
req.on("error", function handleRequestError(err) {
|
|
40438
|
+
reject(AxiosError.from(err, null, config2, req));
|
|
40439
|
+
});
|
|
40440
|
+
req.on("socket", function handleRequestSocket(socket) {
|
|
40441
|
+
socket.setKeepAlive(true, 1000 * 60);
|
|
40442
|
+
});
|
|
40443
|
+
if (config2.timeout) {
|
|
40444
|
+
const timeout4 = parseInt(config2.timeout, 10);
|
|
40445
|
+
if (Number.isNaN(timeout4)) {
|
|
40446
|
+
reject(new AxiosError("error trying to parse `config.timeout` to int", AxiosError.ERR_BAD_OPTION_VALUE, config2, req));
|
|
40447
|
+
return;
|
|
40448
|
+
}
|
|
40449
|
+
req.setTimeout(timeout4, function handleRequestTimeout() {
|
|
40450
|
+
if (isDone)
|
|
40451
|
+
return;
|
|
40452
|
+
let timeoutErrorMessage = config2.timeout ? "timeout of " + config2.timeout + "ms exceeded" : "timeout exceeded";
|
|
40453
|
+
const transitional = config2.transitional || transitionalDefaults;
|
|
40454
|
+
if (config2.timeoutErrorMessage) {
|
|
40455
|
+
timeoutErrorMessage = config2.timeoutErrorMessage;
|
|
40456
|
+
}
|
|
40457
|
+
reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config2, req));
|
|
40458
|
+
abort();
|
|
40459
|
+
});
|
|
40460
|
+
}
|
|
40461
|
+
if (utils$1.isStream(data)) {
|
|
40462
|
+
let ended = false;
|
|
40463
|
+
let errored = false;
|
|
40464
|
+
data.on("end", () => {
|
|
40465
|
+
ended = true;
|
|
40466
|
+
});
|
|
40467
|
+
data.once("error", (err) => {
|
|
40468
|
+
errored = true;
|
|
40469
|
+
req.destroy(err);
|
|
40470
|
+
});
|
|
40471
|
+
data.on("close", () => {
|
|
40472
|
+
if (!ended && !errored) {
|
|
40473
|
+
abort(new CanceledError("Request stream has been aborted", config2, req));
|
|
40474
|
+
}
|
|
40475
|
+
});
|
|
40476
|
+
data.pipe(req);
|
|
40477
|
+
} else {
|
|
40478
|
+
req.end(data);
|
|
40479
|
+
}
|
|
40480
|
+
});
|
|
40481
|
+
};
|
|
40482
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin2, isMSIE) => (url2) => {
|
|
40483
|
+
url2 = new URL(url2, platform.origin);
|
|
40484
|
+
return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
|
|
40485
|
+
})(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : () => true;
|
|
40486
|
+
var cookies = platform.hasStandardBrowserEnv ? {
|
|
40487
|
+
write(name2, value2, expires, path, domain, secure) {
|
|
40488
|
+
const cookie = [name2 + "=" + encodeURIComponent(value2)];
|
|
40489
|
+
utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
|
|
40490
|
+
utils$1.isString(path) && cookie.push("path=" + path);
|
|
40491
|
+
utils$1.isString(domain) && cookie.push("domain=" + domain);
|
|
40492
|
+
secure === true && cookie.push("secure");
|
|
40493
|
+
document.cookie = cookie.join("; ");
|
|
40494
|
+
},
|
|
40495
|
+
read(name2) {
|
|
40496
|
+
const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name2 + ")=([^;]*)"));
|
|
40497
|
+
return match ? decodeURIComponent(match[3]) : null;
|
|
40498
|
+
},
|
|
40499
|
+
remove(name2) {
|
|
40500
|
+
this.write(name2, "", Date.now() - 86400000);
|
|
40501
|
+
}
|
|
40502
|
+
} : {
|
|
40503
|
+
write() {
|
|
40504
|
+
},
|
|
40505
|
+
read() {
|
|
40506
|
+
return null;
|
|
40507
|
+
},
|
|
40508
|
+
remove() {
|
|
40509
|
+
}
|
|
40510
|
+
};
|
|
40511
|
+
var headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
40512
|
+
function mergeConfig(config1, config2) {
|
|
40513
|
+
config2 = config2 || {};
|
|
40514
|
+
const config3 = {};
|
|
40515
|
+
function getMergedValue(target, source, prop, caseless) {
|
|
40516
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
40517
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
40518
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
40519
|
+
return utils$1.merge({}, source);
|
|
40520
|
+
} else if (utils$1.isArray(source)) {
|
|
40521
|
+
return source.slice();
|
|
40522
|
+
}
|
|
40523
|
+
return source;
|
|
40524
|
+
}
|
|
40525
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
40526
|
+
if (!utils$1.isUndefined(b)) {
|
|
40527
|
+
return getMergedValue(a, b, prop, caseless);
|
|
40528
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
40529
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
40530
|
+
}
|
|
40531
|
+
}
|
|
40532
|
+
function valueFromConfig2(a, b) {
|
|
40533
|
+
if (!utils$1.isUndefined(b)) {
|
|
40534
|
+
return getMergedValue(undefined, b);
|
|
40535
|
+
}
|
|
40536
|
+
}
|
|
40537
|
+
function defaultToConfig2(a, b) {
|
|
40538
|
+
if (!utils$1.isUndefined(b)) {
|
|
40539
|
+
return getMergedValue(undefined, b);
|
|
40540
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
40541
|
+
return getMergedValue(undefined, a);
|
|
40542
|
+
}
|
|
40543
|
+
}
|
|
40544
|
+
function mergeDirectKeys(a, b, prop) {
|
|
40545
|
+
if (prop in config2) {
|
|
40546
|
+
return getMergedValue(a, b);
|
|
40547
|
+
} else if (prop in config1) {
|
|
40548
|
+
return getMergedValue(undefined, a);
|
|
40549
|
+
}
|
|
40550
|
+
}
|
|
40551
|
+
const mergeMap = {
|
|
40552
|
+
url: valueFromConfig2,
|
|
40553
|
+
method: valueFromConfig2,
|
|
40554
|
+
data: valueFromConfig2,
|
|
40555
|
+
baseURL: defaultToConfig2,
|
|
40556
|
+
transformRequest: defaultToConfig2,
|
|
40557
|
+
transformResponse: defaultToConfig2,
|
|
40558
|
+
paramsSerializer: defaultToConfig2,
|
|
40559
|
+
timeout: defaultToConfig2,
|
|
40560
|
+
timeoutMessage: defaultToConfig2,
|
|
40561
|
+
withCredentials: defaultToConfig2,
|
|
40562
|
+
withXSRFToken: defaultToConfig2,
|
|
40563
|
+
adapter: defaultToConfig2,
|
|
40564
|
+
responseType: defaultToConfig2,
|
|
40565
|
+
xsrfCookieName: defaultToConfig2,
|
|
40566
|
+
xsrfHeaderName: defaultToConfig2,
|
|
40567
|
+
onUploadProgress: defaultToConfig2,
|
|
40568
|
+
onDownloadProgress: defaultToConfig2,
|
|
40569
|
+
decompress: defaultToConfig2,
|
|
40570
|
+
maxContentLength: defaultToConfig2,
|
|
40571
|
+
maxBodyLength: defaultToConfig2,
|
|
40572
|
+
beforeRedirect: defaultToConfig2,
|
|
40573
|
+
transport: defaultToConfig2,
|
|
40574
|
+
httpAgent: defaultToConfig2,
|
|
40575
|
+
httpsAgent: defaultToConfig2,
|
|
40576
|
+
cancelToken: defaultToConfig2,
|
|
40577
|
+
socketPath: defaultToConfig2,
|
|
40578
|
+
responseEncoding: defaultToConfig2,
|
|
40579
|
+
validateStatus: mergeDirectKeys,
|
|
40580
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
40581
|
+
};
|
|
40582
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
40583
|
+
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
40584
|
+
const configValue = merge2(config1[prop], config2[prop], prop);
|
|
40585
|
+
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config3[prop] = configValue);
|
|
40586
|
+
});
|
|
40587
|
+
return config3;
|
|
40588
|
+
}
|
|
40589
|
+
var resolveConfig = (config2) => {
|
|
40590
|
+
const newConfig = mergeConfig({}, config2);
|
|
40591
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth: auth2 } = newConfig;
|
|
40592
|
+
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
40593
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config2.params, config2.paramsSerializer);
|
|
40594
|
+
if (auth2) {
|
|
40595
|
+
headers.set("Authorization", "Basic " + btoa((auth2.username || "") + ":" + (auth2.password ? unescape(encodeURIComponent(auth2.password)) : "")));
|
|
40596
|
+
}
|
|
40597
|
+
let contentType;
|
|
40598
|
+
if (utils$1.isFormData(data)) {
|
|
40599
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
40600
|
+
headers.setContentType(undefined);
|
|
40601
|
+
} else if ((contentType = headers.getContentType()) !== false) {
|
|
40602
|
+
const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
|
|
40603
|
+
headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
|
|
40604
|
+
}
|
|
40605
|
+
}
|
|
40606
|
+
if (platform.hasStandardBrowserEnv) {
|
|
40607
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
40608
|
+
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
40609
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
40610
|
+
if (xsrfValue) {
|
|
40611
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
40612
|
+
}
|
|
40613
|
+
}
|
|
40614
|
+
}
|
|
40615
|
+
return newConfig;
|
|
40616
|
+
};
|
|
40617
|
+
var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
40618
|
+
var xhrAdapter = isXHRAdapterSupported && function(config2) {
|
|
40619
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
40620
|
+
const _config = resolveConfig(config2);
|
|
40621
|
+
let requestData = _config.data;
|
|
40622
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
40623
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
40624
|
+
let onCanceled;
|
|
40625
|
+
let uploadThrottled, downloadThrottled;
|
|
40626
|
+
let flushUpload, flushDownload;
|
|
40627
|
+
function done() {
|
|
40628
|
+
flushUpload && flushUpload();
|
|
40629
|
+
flushDownload && flushDownload();
|
|
40630
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
40631
|
+
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
40632
|
+
}
|
|
40633
|
+
let request = new XMLHttpRequest;
|
|
40634
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
40635
|
+
request.timeout = _config.timeout;
|
|
40636
|
+
function onloadend() {
|
|
40637
|
+
if (!request) {
|
|
40638
|
+
return;
|
|
40639
|
+
}
|
|
40640
|
+
const responseHeaders = AxiosHeaders$1.from("getAllResponseHeaders" in request && request.getAllResponseHeaders());
|
|
40641
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
40642
|
+
const response = {
|
|
40643
|
+
data: responseData,
|
|
40644
|
+
status: request.status,
|
|
40645
|
+
statusText: request.statusText,
|
|
40646
|
+
headers: responseHeaders,
|
|
40647
|
+
config: config2,
|
|
40648
|
+
request
|
|
40649
|
+
};
|
|
40650
|
+
settle(function _resolve(value2) {
|
|
40651
|
+
resolve(value2);
|
|
40652
|
+
done();
|
|
40653
|
+
}, function _reject(err) {
|
|
40654
|
+
reject(err);
|
|
40655
|
+
done();
|
|
40656
|
+
}, response);
|
|
40657
|
+
request = null;
|
|
40658
|
+
}
|
|
40659
|
+
if ("onloadend" in request) {
|
|
40660
|
+
request.onloadend = onloadend;
|
|
40661
|
+
} else {
|
|
40662
|
+
request.onreadystatechange = function handleLoad() {
|
|
40663
|
+
if (!request || request.readyState !== 4) {
|
|
40664
|
+
return;
|
|
40665
|
+
}
|
|
40666
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
40667
|
+
return;
|
|
40668
|
+
}
|
|
40669
|
+
setTimeout(onloadend);
|
|
40670
|
+
};
|
|
40671
|
+
}
|
|
40672
|
+
request.onabort = function handleAbort() {
|
|
40673
|
+
if (!request) {
|
|
40674
|
+
return;
|
|
40675
|
+
}
|
|
40676
|
+
reject(new AxiosError("Request aborted", AxiosError.ECONNABORTED, config2, request));
|
|
40677
|
+
request = null;
|
|
40678
|
+
};
|
|
40679
|
+
request.onerror = function handleError() {
|
|
40680
|
+
reject(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config2, request));
|
|
40681
|
+
request = null;
|
|
40682
|
+
};
|
|
40683
|
+
request.ontimeout = function handleTimeout() {
|
|
40684
|
+
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
40685
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
40686
|
+
if (_config.timeoutErrorMessage) {
|
|
40687
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
40688
|
+
}
|
|
40689
|
+
reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config2, request));
|
|
40690
|
+
request = null;
|
|
40691
|
+
};
|
|
40692
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
40693
|
+
if ("setRequestHeader" in request) {
|
|
40694
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
40695
|
+
request.setRequestHeader(key, val);
|
|
40696
|
+
});
|
|
40697
|
+
}
|
|
40698
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
40699
|
+
request.withCredentials = !!_config.withCredentials;
|
|
40700
|
+
}
|
|
40701
|
+
if (responseType && responseType !== "json") {
|
|
40702
|
+
request.responseType = _config.responseType;
|
|
40703
|
+
}
|
|
40704
|
+
if (onDownloadProgress) {
|
|
40705
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
40706
|
+
request.addEventListener("progress", downloadThrottled);
|
|
40707
|
+
}
|
|
40708
|
+
if (onUploadProgress && request.upload) {
|
|
40709
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
40710
|
+
request.upload.addEventListener("progress", uploadThrottled);
|
|
40711
|
+
request.upload.addEventListener("loadend", flushUpload);
|
|
40712
|
+
}
|
|
40713
|
+
if (_config.cancelToken || _config.signal) {
|
|
40714
|
+
onCanceled = (cancel) => {
|
|
40715
|
+
if (!request) {
|
|
40716
|
+
return;
|
|
40717
|
+
}
|
|
40718
|
+
reject(!cancel || cancel.type ? new CanceledError(null, config2, request) : cancel);
|
|
40719
|
+
request.abort();
|
|
40720
|
+
request = null;
|
|
40721
|
+
};
|
|
40722
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
40723
|
+
if (_config.signal) {
|
|
40724
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
|
|
40725
|
+
}
|
|
40726
|
+
}
|
|
40727
|
+
const protocol = parseProtocol(_config.url);
|
|
40728
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
40729
|
+
reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config2));
|
|
40730
|
+
return;
|
|
40731
|
+
}
|
|
40732
|
+
request.send(requestData || null);
|
|
40733
|
+
});
|
|
40734
|
+
};
|
|
40735
|
+
var composeSignals = (signals, timeout4) => {
|
|
40736
|
+
const { length } = signals = signals ? signals.filter(Boolean) : [];
|
|
40737
|
+
if (timeout4 || length) {
|
|
40738
|
+
let controller = new AbortController;
|
|
40739
|
+
let aborted;
|
|
40740
|
+
const onabort = function(reason) {
|
|
40741
|
+
if (!aborted) {
|
|
40742
|
+
aborted = true;
|
|
40743
|
+
unsubscribe();
|
|
40744
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
40745
|
+
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
40746
|
+
}
|
|
40747
|
+
};
|
|
40748
|
+
let timer = timeout4 && setTimeout(() => {
|
|
40749
|
+
timer = null;
|
|
40750
|
+
onabort(new AxiosError(`timeout ${timeout4} of ms exceeded`, AxiosError.ETIMEDOUT));
|
|
40751
|
+
}, timeout4);
|
|
40752
|
+
const unsubscribe = () => {
|
|
40753
|
+
if (signals) {
|
|
40754
|
+
timer && clearTimeout(timer);
|
|
40755
|
+
timer = null;
|
|
40756
|
+
signals.forEach((signal2) => {
|
|
40757
|
+
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
40758
|
+
});
|
|
40759
|
+
signals = null;
|
|
40760
|
+
}
|
|
40761
|
+
};
|
|
40762
|
+
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
40763
|
+
const { signal } = controller;
|
|
40764
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
40765
|
+
return signal;
|
|
40766
|
+
}
|
|
40767
|
+
};
|
|
40768
|
+
var composeSignals$1 = composeSignals;
|
|
40769
|
+
var streamChunk = function* (chunk, chunkSize) {
|
|
40770
|
+
let len = chunk.byteLength;
|
|
40771
|
+
if (!chunkSize || len < chunkSize) {
|
|
40772
|
+
yield chunk;
|
|
40773
|
+
return;
|
|
40774
|
+
}
|
|
40775
|
+
let pos = 0;
|
|
40776
|
+
let end;
|
|
40777
|
+
while (pos < len) {
|
|
40778
|
+
end = pos + chunkSize;
|
|
40779
|
+
yield chunk.slice(pos, end);
|
|
40780
|
+
pos = end;
|
|
40781
|
+
}
|
|
40782
|
+
};
|
|
40783
|
+
var readBytes = async function* (iterable, chunkSize) {
|
|
40784
|
+
for await (const chunk of readStream(iterable)) {
|
|
40785
|
+
yield* streamChunk(chunk, chunkSize);
|
|
40786
|
+
}
|
|
40787
|
+
};
|
|
40788
|
+
var readStream = async function* (stream3) {
|
|
40789
|
+
if (stream3[Symbol.asyncIterator]) {
|
|
40790
|
+
yield* stream3;
|
|
40791
|
+
return;
|
|
40792
|
+
}
|
|
40793
|
+
const reader = stream3.getReader();
|
|
40794
|
+
try {
|
|
40795
|
+
for (;; ) {
|
|
40796
|
+
const { done, value: value2 } = await reader.read();
|
|
40797
|
+
if (done) {
|
|
40798
|
+
break;
|
|
40799
|
+
}
|
|
40800
|
+
yield value2;
|
|
40801
|
+
}
|
|
40802
|
+
} finally {
|
|
40803
|
+
await reader.cancel();
|
|
40804
|
+
}
|
|
40805
|
+
};
|
|
40806
|
+
var trackStream = (stream3, chunkSize, onProgress, onFinish) => {
|
|
40807
|
+
const iterator = readBytes(stream3, chunkSize);
|
|
40808
|
+
let bytes = 0;
|
|
40809
|
+
let done;
|
|
40810
|
+
let _onFinish = (e2) => {
|
|
40811
|
+
if (!done) {
|
|
40812
|
+
done = true;
|
|
40813
|
+
onFinish && onFinish(e2);
|
|
40814
|
+
}
|
|
40815
|
+
};
|
|
40816
|
+
return new ReadableStream({
|
|
40817
|
+
async pull(controller) {
|
|
40818
|
+
try {
|
|
40819
|
+
const { done: done2, value: value2 } = await iterator.next();
|
|
40820
|
+
if (done2) {
|
|
40821
|
+
_onFinish();
|
|
40822
|
+
controller.close();
|
|
40823
|
+
return;
|
|
40824
|
+
}
|
|
40825
|
+
let len = value2.byteLength;
|
|
40826
|
+
if (onProgress) {
|
|
40827
|
+
let loadedBytes = bytes += len;
|
|
40828
|
+
onProgress(loadedBytes);
|
|
40829
|
+
}
|
|
40830
|
+
controller.enqueue(new Uint8Array(value2));
|
|
40831
|
+
} catch (err) {
|
|
40832
|
+
_onFinish(err);
|
|
40833
|
+
throw err;
|
|
40834
|
+
}
|
|
40835
|
+
},
|
|
40836
|
+
cancel(reason) {
|
|
40837
|
+
_onFinish(reason);
|
|
40838
|
+
return iterator.return();
|
|
40839
|
+
}
|
|
40840
|
+
}, {
|
|
40841
|
+
highWaterMark: 2
|
|
40842
|
+
});
|
|
40843
|
+
};
|
|
40844
|
+
var isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
|
|
40845
|
+
var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
|
|
40846
|
+
var encodeText = isFetchSupported && (typeof TextEncoder === "function" ? ((encoder2) => (str) => encoder2.encode(str))(new TextEncoder) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
|
|
40847
|
+
var test = (fn, ...args) => {
|
|
40848
|
+
try {
|
|
40849
|
+
return !!fn(...args);
|
|
40850
|
+
} catch (e2) {
|
|
40851
|
+
return false;
|
|
40852
|
+
}
|
|
40853
|
+
};
|
|
40854
|
+
var supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
40855
|
+
let duplexAccessed = false;
|
|
40856
|
+
const hasContentType = new Request(platform.origin, {
|
|
40857
|
+
body: new ReadableStream,
|
|
40858
|
+
method: "POST",
|
|
40859
|
+
get duplex() {
|
|
40860
|
+
duplexAccessed = true;
|
|
40861
|
+
return "half";
|
|
40862
|
+
}
|
|
40863
|
+
}).headers.has("Content-Type");
|
|
40864
|
+
return duplexAccessed && !hasContentType;
|
|
40865
|
+
});
|
|
40866
|
+
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
40867
|
+
var supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
40868
|
+
var resolvers = {
|
|
40869
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
40870
|
+
};
|
|
40871
|
+
isFetchSupported && ((res) => {
|
|
40872
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
40873
|
+
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config2) => {
|
|
40874
|
+
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config2);
|
|
40875
|
+
});
|
|
40876
|
+
});
|
|
40877
|
+
})(new Response);
|
|
40878
|
+
var getBodyLength = async (body) => {
|
|
40879
|
+
if (body == null) {
|
|
40880
|
+
return 0;
|
|
40881
|
+
}
|
|
40882
|
+
if (utils$1.isBlob(body)) {
|
|
40883
|
+
return body.size;
|
|
40884
|
+
}
|
|
40885
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
40886
|
+
const _request = new Request(platform.origin, {
|
|
40887
|
+
method: "POST",
|
|
40888
|
+
body
|
|
40889
|
+
});
|
|
40890
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
40891
|
+
}
|
|
40892
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
40893
|
+
return body.byteLength;
|
|
40894
|
+
}
|
|
40895
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
40896
|
+
body = body + "";
|
|
40897
|
+
}
|
|
40898
|
+
if (utils$1.isString(body)) {
|
|
40899
|
+
return (await encodeText(body)).byteLength;
|
|
40900
|
+
}
|
|
40901
|
+
};
|
|
40902
|
+
var resolveBodyLength = async (headers, body) => {
|
|
40903
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
40904
|
+
return length == null ? getBodyLength(body) : length;
|
|
40905
|
+
};
|
|
40906
|
+
var fetchAdapter = isFetchSupported && (async (config2) => {
|
|
40907
|
+
let {
|
|
40908
|
+
url: url2,
|
|
40909
|
+
method,
|
|
40910
|
+
data,
|
|
40911
|
+
signal,
|
|
40912
|
+
cancelToken,
|
|
40913
|
+
timeout: timeout4,
|
|
40914
|
+
onDownloadProgress,
|
|
40915
|
+
onUploadProgress,
|
|
40916
|
+
responseType,
|
|
40917
|
+
headers,
|
|
40918
|
+
withCredentials = "same-origin",
|
|
40919
|
+
fetchOptions
|
|
40920
|
+
} = resolveConfig(config2);
|
|
40921
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
40922
|
+
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout4);
|
|
40923
|
+
let request;
|
|
40924
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
40925
|
+
composedSignal.unsubscribe();
|
|
40926
|
+
});
|
|
40927
|
+
let requestContentLength;
|
|
40928
|
+
try {
|
|
40929
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
40930
|
+
let _request = new Request(url2, {
|
|
40931
|
+
method: "POST",
|
|
40932
|
+
body: data,
|
|
40933
|
+
duplex: "half"
|
|
40934
|
+
});
|
|
40935
|
+
let contentTypeHeader;
|
|
40936
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
40937
|
+
headers.setContentType(contentTypeHeader);
|
|
40938
|
+
}
|
|
40939
|
+
if (_request.body) {
|
|
40940
|
+
const [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
|
|
40941
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
40942
|
+
}
|
|
40943
|
+
}
|
|
40944
|
+
if (!utils$1.isString(withCredentials)) {
|
|
40945
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
40946
|
+
}
|
|
40947
|
+
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
40948
|
+
request = new Request(url2, {
|
|
40949
|
+
...fetchOptions,
|
|
40950
|
+
signal: composedSignal,
|
|
40951
|
+
method: method.toUpperCase(),
|
|
40952
|
+
headers: headers.normalize().toJSON(),
|
|
40953
|
+
body: data,
|
|
40954
|
+
duplex: "half",
|
|
40955
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
40956
|
+
});
|
|
40957
|
+
let response = await fetch(request);
|
|
40958
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
40959
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
40960
|
+
const options = {};
|
|
40961
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
40962
|
+
options[prop] = response[prop];
|
|
40963
|
+
});
|
|
40964
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
|
|
40965
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
|
|
40966
|
+
response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
40967
|
+
flush && flush();
|
|
40968
|
+
unsubscribe && unsubscribe();
|
|
40969
|
+
}), options);
|
|
40970
|
+
}
|
|
40971
|
+
responseType = responseType || "text";
|
|
40972
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config2);
|
|
40973
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
40974
|
+
return await new Promise((resolve, reject) => {
|
|
40975
|
+
settle(resolve, reject, {
|
|
40976
|
+
data: responseData,
|
|
40977
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
40978
|
+
status: response.status,
|
|
40979
|
+
statusText: response.statusText,
|
|
40980
|
+
config: config2,
|
|
40981
|
+
request
|
|
40982
|
+
});
|
|
40983
|
+
});
|
|
40984
|
+
} catch (err) {
|
|
40985
|
+
unsubscribe && unsubscribe();
|
|
40986
|
+
if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
|
|
40987
|
+
throw Object.assign(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config2, request), {
|
|
40988
|
+
cause: err.cause || err
|
|
40989
|
+
});
|
|
40990
|
+
}
|
|
40991
|
+
throw AxiosError.from(err, err && err.code, config2, request);
|
|
40992
|
+
}
|
|
40993
|
+
});
|
|
40994
|
+
var knownAdapters = {
|
|
40995
|
+
http: httpAdapter,
|
|
40996
|
+
xhr: xhrAdapter,
|
|
40997
|
+
fetch: fetchAdapter
|
|
40998
|
+
};
|
|
40999
|
+
utils$1.forEach(knownAdapters, (fn, value2) => {
|
|
41000
|
+
if (fn) {
|
|
41001
|
+
try {
|
|
41002
|
+
Object.defineProperty(fn, "name", { value: value2 });
|
|
41003
|
+
} catch (e2) {
|
|
41004
|
+
}
|
|
41005
|
+
Object.defineProperty(fn, "adapterName", { value: value2 });
|
|
41006
|
+
}
|
|
41007
|
+
});
|
|
41008
|
+
var renderReason = (reason) => `- ${reason}`;
|
|
41009
|
+
var isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
41010
|
+
var adapters = {
|
|
41011
|
+
getAdapter: (adapters2) => {
|
|
41012
|
+
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
|
|
41013
|
+
const { length } = adapters2;
|
|
41014
|
+
let nameOrAdapter;
|
|
41015
|
+
let adapter;
|
|
41016
|
+
const rejectedReasons = {};
|
|
41017
|
+
for (let i2 = 0;i2 < length; i2++) {
|
|
41018
|
+
nameOrAdapter = adapters2[i2];
|
|
41019
|
+
let id;
|
|
41020
|
+
adapter = nameOrAdapter;
|
|
41021
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
41022
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
41023
|
+
if (adapter === undefined) {
|
|
41024
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
41025
|
+
}
|
|
41026
|
+
}
|
|
41027
|
+
if (adapter) {
|
|
41028
|
+
break;
|
|
41029
|
+
}
|
|
41030
|
+
rejectedReasons[id || "#" + i2] = adapter;
|
|
41031
|
+
}
|
|
41032
|
+
if (!adapter) {
|
|
41033
|
+
const reasons = Object.entries(rejectedReasons).map(([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build"));
|
|
41034
|
+
let s2 = length ? reasons.length > 1 ? `since :
|
|
41035
|
+
` + reasons.map(renderReason).join(`
|
|
41036
|
+
`) : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
41037
|
+
throw new AxiosError(`There is no suitable adapter to dispatch the request ` + s2, "ERR_NOT_SUPPORT");
|
|
41038
|
+
}
|
|
41039
|
+
return adapter;
|
|
41040
|
+
},
|
|
41041
|
+
adapters: knownAdapters
|
|
41042
|
+
};
|
|
41043
|
+
function throwIfCancellationRequested(config2) {
|
|
41044
|
+
if (config2.cancelToken) {
|
|
41045
|
+
config2.cancelToken.throwIfRequested();
|
|
41046
|
+
}
|
|
41047
|
+
if (config2.signal && config2.signal.aborted) {
|
|
41048
|
+
throw new CanceledError(null, config2);
|
|
41049
|
+
}
|
|
41050
|
+
}
|
|
41051
|
+
function dispatchRequest(config2) {
|
|
41052
|
+
throwIfCancellationRequested(config2);
|
|
41053
|
+
config2.headers = AxiosHeaders$1.from(config2.headers);
|
|
41054
|
+
config2.data = transformData.call(config2, config2.transformRequest);
|
|
41055
|
+
if (["post", "put", "patch"].indexOf(config2.method) !== -1) {
|
|
41056
|
+
config2.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
41057
|
+
}
|
|
41058
|
+
const adapter = adapters.getAdapter(config2.adapter || defaults$1.adapter);
|
|
41059
|
+
return adapter(config2).then(function onAdapterResolution(response) {
|
|
41060
|
+
throwIfCancellationRequested(config2);
|
|
41061
|
+
response.data = transformData.call(config2, config2.transformResponse, response);
|
|
41062
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
41063
|
+
return response;
|
|
41064
|
+
}, function onAdapterRejection(reason) {
|
|
41065
|
+
if (!isCancel(reason)) {
|
|
41066
|
+
throwIfCancellationRequested(config2);
|
|
41067
|
+
if (reason && reason.response) {
|
|
41068
|
+
reason.response.data = transformData.call(config2, config2.transformResponse, reason.response);
|
|
41069
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
41070
|
+
}
|
|
41071
|
+
}
|
|
41072
|
+
return Promise.reject(reason);
|
|
41073
|
+
});
|
|
41074
|
+
}
|
|
41075
|
+
var validators$1 = {};
|
|
41076
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i2) => {
|
|
41077
|
+
validators$1[type] = function validator(thing) {
|
|
41078
|
+
return typeof thing === type || "a" + (i2 < 1 ? "n " : " ") + type;
|
|
41079
|
+
};
|
|
41080
|
+
});
|
|
41081
|
+
var deprecatedWarnings = {};
|
|
41082
|
+
validators$1.transitional = function transitional(validator2, version, message2) {
|
|
41083
|
+
function formatMessage(opt, desc) {
|
|
41084
|
+
return "[Axios v" + VERSION3 + "] Transitional option '" + opt + "'" + desc + (message2 ? ". " + message2 : "");
|
|
41085
|
+
}
|
|
41086
|
+
return (value2, opt, opts) => {
|
|
41087
|
+
if (validator2 === false) {
|
|
41088
|
+
throw new AxiosError(formatMessage(opt, " has been removed" + (version ? " in " + version : "")), AxiosError.ERR_DEPRECATED);
|
|
41089
|
+
}
|
|
41090
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
41091
|
+
deprecatedWarnings[opt] = true;
|
|
41092
|
+
console.warn(formatMessage(opt, " has been deprecated since v" + version + " and will be removed in the near future"));
|
|
41093
|
+
}
|
|
41094
|
+
return validator2 ? validator2(value2, opt, opts) : true;
|
|
41095
|
+
};
|
|
41096
|
+
};
|
|
41097
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
41098
|
+
return (value2, opt) => {
|
|
41099
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
41100
|
+
return true;
|
|
41101
|
+
};
|
|
41102
|
+
};
|
|
41103
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
41104
|
+
if (typeof options !== "object") {
|
|
41105
|
+
throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
|
|
41106
|
+
}
|
|
41107
|
+
const keys = Object.keys(options);
|
|
41108
|
+
let i2 = keys.length;
|
|
41109
|
+
while (i2-- > 0) {
|
|
41110
|
+
const opt = keys[i2];
|
|
41111
|
+
const validator2 = schema[opt];
|
|
41112
|
+
if (validator2) {
|
|
41113
|
+
const value2 = options[opt];
|
|
41114
|
+
const result = value2 === undefined || validator2(value2, opt, options);
|
|
41115
|
+
if (result !== true) {
|
|
41116
|
+
throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
41117
|
+
}
|
|
41118
|
+
continue;
|
|
41119
|
+
}
|
|
41120
|
+
if (allowUnknown !== true) {
|
|
41121
|
+
throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION);
|
|
41122
|
+
}
|
|
41123
|
+
}
|
|
41124
|
+
}
|
|
41125
|
+
var validator = {
|
|
41126
|
+
assertOptions,
|
|
41127
|
+
validators: validators$1
|
|
41128
|
+
};
|
|
41129
|
+
var validators = validator.validators;
|
|
41130
|
+
|
|
41131
|
+
class Axios {
|
|
41132
|
+
constructor(instanceConfig) {
|
|
41133
|
+
this.defaults = instanceConfig;
|
|
41134
|
+
this.interceptors = {
|
|
41135
|
+
request: new InterceptorManager$1,
|
|
41136
|
+
response: new InterceptorManager$1
|
|
41137
|
+
};
|
|
41138
|
+
}
|
|
41139
|
+
async request(configOrUrl, config2) {
|
|
41140
|
+
try {
|
|
41141
|
+
return await this._request(configOrUrl, config2);
|
|
41142
|
+
} catch (err) {
|
|
41143
|
+
if (err instanceof Error) {
|
|
41144
|
+
let dummy = {};
|
|
41145
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error;
|
|
41146
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
41147
|
+
try {
|
|
41148
|
+
if (!err.stack) {
|
|
41149
|
+
err.stack = stack;
|
|
41150
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
41151
|
+
err.stack += `
|
|
41152
|
+
` + stack;
|
|
41153
|
+
}
|
|
41154
|
+
} catch (e2) {
|
|
41155
|
+
}
|
|
41156
|
+
}
|
|
41157
|
+
throw err;
|
|
41158
|
+
}
|
|
41159
|
+
}
|
|
41160
|
+
_request(configOrUrl, config2) {
|
|
41161
|
+
if (typeof configOrUrl === "string") {
|
|
41162
|
+
config2 = config2 || {};
|
|
41163
|
+
config2.url = configOrUrl;
|
|
41164
|
+
} else {
|
|
41165
|
+
config2 = configOrUrl || {};
|
|
41166
|
+
}
|
|
41167
|
+
config2 = mergeConfig(this.defaults, config2);
|
|
41168
|
+
const { transitional, paramsSerializer, headers } = config2;
|
|
41169
|
+
if (transitional !== undefined) {
|
|
41170
|
+
validator.assertOptions(transitional, {
|
|
41171
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
41172
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
41173
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
41174
|
+
}, false);
|
|
41175
|
+
}
|
|
41176
|
+
if (paramsSerializer != null) {
|
|
41177
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
41178
|
+
config2.paramsSerializer = {
|
|
41179
|
+
serialize: paramsSerializer
|
|
41180
|
+
};
|
|
41181
|
+
} else {
|
|
41182
|
+
validator.assertOptions(paramsSerializer, {
|
|
41183
|
+
encode: validators.function,
|
|
41184
|
+
serialize: validators.function
|
|
41185
|
+
}, true);
|
|
41186
|
+
}
|
|
41187
|
+
}
|
|
41188
|
+
if (config2.allowAbsoluteUrls !== undefined)
|
|
41189
|
+
;
|
|
41190
|
+
else if (this.defaults.allowAbsoluteUrls !== undefined) {
|
|
41191
|
+
config2.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
41192
|
+
} else {
|
|
41193
|
+
config2.allowAbsoluteUrls = true;
|
|
41194
|
+
}
|
|
41195
|
+
validator.assertOptions(config2, {
|
|
41196
|
+
baseUrl: validators.spelling("baseURL"),
|
|
41197
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
41198
|
+
}, true);
|
|
41199
|
+
config2.method = (config2.method || this.defaults.method || "get").toLowerCase();
|
|
41200
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config2.method]);
|
|
41201
|
+
headers && utils$1.forEach(["delete", "get", "head", "post", "put", "patch", "common"], (method) => {
|
|
41202
|
+
delete headers[method];
|
|
41203
|
+
});
|
|
41204
|
+
config2.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
41205
|
+
const requestInterceptorChain = [];
|
|
41206
|
+
let synchronousRequestInterceptors = true;
|
|
41207
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
41208
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config2) === false) {
|
|
41209
|
+
return;
|
|
41210
|
+
}
|
|
41211
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
41212
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
41213
|
+
});
|
|
41214
|
+
const responseInterceptorChain = [];
|
|
41215
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
41216
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
41217
|
+
});
|
|
41218
|
+
let promise;
|
|
41219
|
+
let i2 = 0;
|
|
41220
|
+
let len;
|
|
41221
|
+
if (!synchronousRequestInterceptors) {
|
|
41222
|
+
const chain = [dispatchRequest.bind(this), undefined];
|
|
41223
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
41224
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
41225
|
+
len = chain.length;
|
|
41226
|
+
promise = Promise.resolve(config2);
|
|
41227
|
+
while (i2 < len) {
|
|
41228
|
+
promise = promise.then(chain[i2++], chain[i2++]);
|
|
41229
|
+
}
|
|
41230
|
+
return promise;
|
|
41231
|
+
}
|
|
41232
|
+
len = requestInterceptorChain.length;
|
|
41233
|
+
let newConfig = config2;
|
|
41234
|
+
i2 = 0;
|
|
41235
|
+
while (i2 < len) {
|
|
41236
|
+
const onFulfilled = requestInterceptorChain[i2++];
|
|
41237
|
+
const onRejected = requestInterceptorChain[i2++];
|
|
41238
|
+
try {
|
|
41239
|
+
newConfig = onFulfilled(newConfig);
|
|
41240
|
+
} catch (error) {
|
|
41241
|
+
onRejected.call(this, error);
|
|
41242
|
+
break;
|
|
41243
|
+
}
|
|
41244
|
+
}
|
|
41245
|
+
try {
|
|
41246
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
41247
|
+
} catch (error) {
|
|
41248
|
+
return Promise.reject(error);
|
|
41249
|
+
}
|
|
41250
|
+
i2 = 0;
|
|
41251
|
+
len = responseInterceptorChain.length;
|
|
41252
|
+
while (i2 < len) {
|
|
41253
|
+
promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
|
|
41254
|
+
}
|
|
41255
|
+
return promise;
|
|
41256
|
+
}
|
|
41257
|
+
getUri(config2) {
|
|
41258
|
+
config2 = mergeConfig(this.defaults, config2);
|
|
41259
|
+
const fullPath = buildFullPath(config2.baseURL, config2.url, config2.allowAbsoluteUrls);
|
|
41260
|
+
return buildURL(fullPath, config2.params, config2.paramsSerializer);
|
|
41261
|
+
}
|
|
41262
|
+
}
|
|
41263
|
+
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
41264
|
+
Axios.prototype[method] = function(url2, config2) {
|
|
41265
|
+
return this.request(mergeConfig(config2 || {}, {
|
|
41266
|
+
method,
|
|
41267
|
+
url: url2,
|
|
41268
|
+
data: (config2 || {}).data
|
|
41269
|
+
}));
|
|
41270
|
+
};
|
|
41271
|
+
});
|
|
41272
|
+
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
41273
|
+
function generateHTTPMethod(isForm) {
|
|
41274
|
+
return function httpMethod(url2, data, config2) {
|
|
41275
|
+
return this.request(mergeConfig(config2 || {}, {
|
|
41276
|
+
method,
|
|
41277
|
+
headers: isForm ? {
|
|
41278
|
+
"Content-Type": "multipart/form-data"
|
|
41279
|
+
} : {},
|
|
41280
|
+
url: url2,
|
|
41281
|
+
data
|
|
41282
|
+
}));
|
|
41283
|
+
};
|
|
41284
|
+
}
|
|
41285
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
41286
|
+
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
41287
|
+
});
|
|
41288
|
+
var Axios$1 = Axios;
|
|
41289
|
+
|
|
41290
|
+
class CancelToken {
|
|
41291
|
+
constructor(executor) {
|
|
41292
|
+
if (typeof executor !== "function") {
|
|
41293
|
+
throw new TypeError("executor must be a function.");
|
|
41294
|
+
}
|
|
41295
|
+
let resolvePromise;
|
|
41296
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
41297
|
+
resolvePromise = resolve;
|
|
41298
|
+
});
|
|
41299
|
+
const token = this;
|
|
41300
|
+
this.promise.then((cancel) => {
|
|
41301
|
+
if (!token._listeners)
|
|
41302
|
+
return;
|
|
41303
|
+
let i2 = token._listeners.length;
|
|
41304
|
+
while (i2-- > 0) {
|
|
41305
|
+
token._listeners[i2](cancel);
|
|
41306
|
+
}
|
|
41307
|
+
token._listeners = null;
|
|
41308
|
+
});
|
|
41309
|
+
this.promise.then = (onfulfilled) => {
|
|
41310
|
+
let _resolve;
|
|
41311
|
+
const promise = new Promise((resolve) => {
|
|
41312
|
+
token.subscribe(resolve);
|
|
41313
|
+
_resolve = resolve;
|
|
41314
|
+
}).then(onfulfilled);
|
|
41315
|
+
promise.cancel = function reject() {
|
|
41316
|
+
token.unsubscribe(_resolve);
|
|
41317
|
+
};
|
|
41318
|
+
return promise;
|
|
41319
|
+
};
|
|
41320
|
+
executor(function cancel(message2, config2, request) {
|
|
41321
|
+
if (token.reason) {
|
|
41322
|
+
return;
|
|
41323
|
+
}
|
|
41324
|
+
token.reason = new CanceledError(message2, config2, request);
|
|
41325
|
+
resolvePromise(token.reason);
|
|
41326
|
+
});
|
|
41327
|
+
}
|
|
41328
|
+
throwIfRequested() {
|
|
41329
|
+
if (this.reason) {
|
|
41330
|
+
throw this.reason;
|
|
41331
|
+
}
|
|
41332
|
+
}
|
|
41333
|
+
subscribe(listener) {
|
|
41334
|
+
if (this.reason) {
|
|
41335
|
+
listener(this.reason);
|
|
41336
|
+
return;
|
|
41337
|
+
}
|
|
41338
|
+
if (this._listeners) {
|
|
41339
|
+
this._listeners.push(listener);
|
|
41340
|
+
} else {
|
|
41341
|
+
this._listeners = [listener];
|
|
41342
|
+
}
|
|
41343
|
+
}
|
|
41344
|
+
unsubscribe(listener) {
|
|
41345
|
+
if (!this._listeners) {
|
|
41346
|
+
return;
|
|
41347
|
+
}
|
|
41348
|
+
const index = this._listeners.indexOf(listener);
|
|
41349
|
+
if (index !== -1) {
|
|
41350
|
+
this._listeners.splice(index, 1);
|
|
41351
|
+
}
|
|
41352
|
+
}
|
|
41353
|
+
toAbortSignal() {
|
|
41354
|
+
const controller = new AbortController;
|
|
41355
|
+
const abort = (err) => {
|
|
41356
|
+
controller.abort(err);
|
|
41357
|
+
};
|
|
41358
|
+
this.subscribe(abort);
|
|
41359
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
41360
|
+
return controller.signal;
|
|
41361
|
+
}
|
|
41362
|
+
static source() {
|
|
41363
|
+
let cancel;
|
|
41364
|
+
const token = new CancelToken(function executor(c) {
|
|
41365
|
+
cancel = c;
|
|
41366
|
+
});
|
|
41367
|
+
return {
|
|
41368
|
+
token,
|
|
41369
|
+
cancel
|
|
41370
|
+
};
|
|
41371
|
+
}
|
|
41372
|
+
}
|
|
41373
|
+
var CancelToken$1 = CancelToken;
|
|
41374
|
+
function spread(callback) {
|
|
41375
|
+
return function wrap(arr) {
|
|
41376
|
+
return callback.apply(null, arr);
|
|
41377
|
+
};
|
|
41378
|
+
}
|
|
41379
|
+
function isAxiosError(payload) {
|
|
41380
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
41381
|
+
}
|
|
41382
|
+
var HttpStatusCode = {
|
|
41383
|
+
Continue: 100,
|
|
41384
|
+
SwitchingProtocols: 101,
|
|
41385
|
+
Processing: 102,
|
|
41386
|
+
EarlyHints: 103,
|
|
41387
|
+
Ok: 200,
|
|
41388
|
+
Created: 201,
|
|
41389
|
+
Accepted: 202,
|
|
41390
|
+
NonAuthoritativeInformation: 203,
|
|
41391
|
+
NoContent: 204,
|
|
41392
|
+
ResetContent: 205,
|
|
41393
|
+
PartialContent: 206,
|
|
41394
|
+
MultiStatus: 207,
|
|
41395
|
+
AlreadyReported: 208,
|
|
41396
|
+
ImUsed: 226,
|
|
41397
|
+
MultipleChoices: 300,
|
|
41398
|
+
MovedPermanently: 301,
|
|
41399
|
+
Found: 302,
|
|
41400
|
+
SeeOther: 303,
|
|
41401
|
+
NotModified: 304,
|
|
41402
|
+
UseProxy: 305,
|
|
41403
|
+
Unused: 306,
|
|
41404
|
+
TemporaryRedirect: 307,
|
|
41405
|
+
PermanentRedirect: 308,
|
|
41406
|
+
BadRequest: 400,
|
|
41407
|
+
Unauthorized: 401,
|
|
41408
|
+
PaymentRequired: 402,
|
|
41409
|
+
Forbidden: 403,
|
|
41410
|
+
NotFound: 404,
|
|
41411
|
+
MethodNotAllowed: 405,
|
|
41412
|
+
NotAcceptable: 406,
|
|
41413
|
+
ProxyAuthenticationRequired: 407,
|
|
41414
|
+
RequestTimeout: 408,
|
|
41415
|
+
Conflict: 409,
|
|
41416
|
+
Gone: 410,
|
|
41417
|
+
LengthRequired: 411,
|
|
41418
|
+
PreconditionFailed: 412,
|
|
41419
|
+
PayloadTooLarge: 413,
|
|
41420
|
+
UriTooLong: 414,
|
|
41421
|
+
UnsupportedMediaType: 415,
|
|
41422
|
+
RangeNotSatisfiable: 416,
|
|
41423
|
+
ExpectationFailed: 417,
|
|
41424
|
+
ImATeapot: 418,
|
|
41425
|
+
MisdirectedRequest: 421,
|
|
41426
|
+
UnprocessableEntity: 422,
|
|
41427
|
+
Locked: 423,
|
|
41428
|
+
FailedDependency: 424,
|
|
41429
|
+
TooEarly: 425,
|
|
41430
|
+
UpgradeRequired: 426,
|
|
41431
|
+
PreconditionRequired: 428,
|
|
41432
|
+
TooManyRequests: 429,
|
|
41433
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
41434
|
+
UnavailableForLegalReasons: 451,
|
|
41435
|
+
InternalServerError: 500,
|
|
41436
|
+
NotImplemented: 501,
|
|
41437
|
+
BadGateway: 502,
|
|
41438
|
+
ServiceUnavailable: 503,
|
|
41439
|
+
GatewayTimeout: 504,
|
|
41440
|
+
HttpVersionNotSupported: 505,
|
|
41441
|
+
VariantAlsoNegotiates: 506,
|
|
41442
|
+
InsufficientStorage: 507,
|
|
41443
|
+
LoopDetected: 508,
|
|
41444
|
+
NotExtended: 510,
|
|
41445
|
+
NetworkAuthenticationRequired: 511
|
|
41446
|
+
};
|
|
41447
|
+
Object.entries(HttpStatusCode).forEach(([key, value2]) => {
|
|
41448
|
+
HttpStatusCode[value2] = key;
|
|
41449
|
+
});
|
|
41450
|
+
var HttpStatusCode$1 = HttpStatusCode;
|
|
41451
|
+
function createInstance(defaultConfig) {
|
|
41452
|
+
const context3 = new Axios$1(defaultConfig);
|
|
41453
|
+
const instance = bind(Axios$1.prototype.request, context3);
|
|
41454
|
+
utils$1.extend(instance, Axios$1.prototype, context3, { allOwnKeys: true });
|
|
41455
|
+
utils$1.extend(instance, context3, null, { allOwnKeys: true });
|
|
41456
|
+
instance.create = function create(instanceConfig) {
|
|
41457
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
41458
|
+
};
|
|
41459
|
+
return instance;
|
|
41460
|
+
}
|
|
41461
|
+
var axios = createInstance(defaults$1);
|
|
41462
|
+
axios.Axios = Axios$1;
|
|
41463
|
+
axios.CanceledError = CanceledError;
|
|
41464
|
+
axios.CancelToken = CancelToken$1;
|
|
41465
|
+
axios.isCancel = isCancel;
|
|
41466
|
+
axios.VERSION = VERSION3;
|
|
41467
|
+
axios.toFormData = toFormData;
|
|
41468
|
+
axios.AxiosError = AxiosError;
|
|
41469
|
+
axios.Cancel = axios.CanceledError;
|
|
41470
|
+
axios.all = function all(promises) {
|
|
41471
|
+
return Promise.all(promises);
|
|
41472
|
+
};
|
|
41473
|
+
axios.spread = spread;
|
|
41474
|
+
axios.isAxiosError = isAxiosError;
|
|
41475
|
+
axios.mergeConfig = mergeConfig;
|
|
41476
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
41477
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
41478
|
+
axios.getAdapter = adapters.getAdapter;
|
|
41479
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
41480
|
+
axios.default = axios;
|
|
41481
|
+
module2.exports = axios;
|
|
41482
|
+
});
|
|
41483
|
+
|
|
38490
41484
|
// node_modules/bybit-api/lib/util/requestUtils.js
|
|
38491
41485
|
var require_requestUtils2 = __commonJS((exports2) => {
|
|
38492
41486
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -38801,7 +41795,7 @@ var require_BaseRestClient2 = __commonJS((exports2) => {
|
|
|
38801
41795
|
return mod && mod.__esModule ? mod : { default: mod };
|
|
38802
41796
|
};
|
|
38803
41797
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38804
|
-
var axios_1 = __importDefault(
|
|
41798
|
+
var axios_1 = __importDefault(require_axios2());
|
|
38805
41799
|
var https_1 = __importDefault(require("https"));
|
|
38806
41800
|
var requestUtils_1 = require_requestUtils2();
|
|
38807
41801
|
var webCryptoAPI_1 = require_webCryptoAPI();
|
|
@@ -51792,8 +54786,8 @@ class AppDatabase {
|
|
|
51792
54786
|
let default_params = as_view ? {
|
|
51793
54787
|
table: "positions_view",
|
|
51794
54788
|
params: {
|
|
51795
|
-
filter: `symbol:lower="${symbol.toLowerCase()}" &&
|
|
51796
|
-
expand: "
|
|
54789
|
+
filter: `symbol:lower="${symbol.toLowerCase()}" && p_account.owner:lower="${account.owner.toLowerCase()}" && p_account.exchange:lower="${account.exchange.toLowerCase()}"`,
|
|
54790
|
+
expand: "b_config, account_strategy, p_account, proxy"
|
|
51797
54791
|
}
|
|
51798
54792
|
} : {
|
|
51799
54793
|
table: "positions",
|
|
@@ -58736,6 +61730,14 @@ class ExchangePosition {
|
|
|
58736
61730
|
});
|
|
58737
61731
|
return risk_reward;
|
|
58738
61732
|
}
|
|
61733
|
+
get appConfig() {
|
|
61734
|
+
console.log(this.instance.expand);
|
|
61735
|
+
return constructAppConfig({
|
|
61736
|
+
account: this.instance,
|
|
61737
|
+
global_config: this.symbol_config,
|
|
61738
|
+
kelly_config: {}
|
|
61739
|
+
});
|
|
61740
|
+
}
|
|
58739
61741
|
}
|
|
58740
61742
|
|
|
58741
61743
|
// src/exchange-account.ts
|
|
@@ -58746,6 +61748,7 @@ class ExchangeAccount {
|
|
|
58746
61748
|
app_db;
|
|
58747
61749
|
long_position;
|
|
58748
61750
|
short_position;
|
|
61751
|
+
raw_positions;
|
|
58749
61752
|
constructor(payload, options) {
|
|
58750
61753
|
this.instance = payload;
|
|
58751
61754
|
this.exchange = options.exchange;
|
|
@@ -58818,6 +61821,7 @@ class ExchangeAccount {
|
|
|
58818
61821
|
without_view: raw_positions.find((x) => x.kind === "short")
|
|
58819
61822
|
});
|
|
58820
61823
|
await this.short_position.initialize();
|
|
61824
|
+
this.raw_positions = positions;
|
|
58821
61825
|
return payload.kind === "long" ? this.long_position : this.short_position;
|
|
58822
61826
|
}
|
|
58823
61827
|
async getActiveAccount(payload) {
|
|
@@ -60209,7 +63213,7 @@ class ExchangeAccount {
|
|
|
60209
63213
|
symbol,
|
|
60210
63214
|
kind: kind === "long" ? "short" : "long"
|
|
60211
63215
|
});
|
|
60212
|
-
if (
|
|
63216
|
+
if (focusPosition.getInstance().quantity > 0) {
|
|
60213
63217
|
const opposite_config = focusPosition.getOppositeConfig({
|
|
60214
63218
|
ratio: reward_factor
|
|
60215
63219
|
});
|
|
@@ -60566,7 +63570,7 @@ class App {
|
|
|
60566
63570
|
return new Set(positions.map((p) => p.symbol));
|
|
60567
63571
|
}
|
|
60568
63572
|
async refreshAllPositionsWithSymbol(payload) {
|
|
60569
|
-
const { symbol } = payload;
|
|
63573
|
+
const { symbol, callback } = payload;
|
|
60570
63574
|
const positions = await this.app_db.getPositions({
|
|
60571
63575
|
custom_filter: `symbol:lower="${symbol.toLowerCase()}"`,
|
|
60572
63576
|
symbol: "",
|
|
@@ -60586,22 +63590,25 @@ class App {
|
|
|
60586
63590
|
}
|
|
60587
63591
|
const unique_exchanges = Object.values(all_exchanges);
|
|
60588
63592
|
for (const exchange of unique_exchanges) {
|
|
60589
|
-
|
|
60590
|
-
|
|
60591
|
-
|
|
60592
|
-
|
|
60593
|
-
|
|
60594
|
-
|
|
63593
|
+
if (callback) {
|
|
63594
|
+
await callback({
|
|
63595
|
+
symbol,
|
|
63596
|
+
account: exchange
|
|
63597
|
+
});
|
|
63598
|
+
} else {
|
|
63599
|
+
const exchange_account = await this.getExchangeAccount({
|
|
63600
|
+
owner: exchange.owner,
|
|
63601
|
+
exchange: exchange.exchange
|
|
63602
|
+
});
|
|
63603
|
+
if (exchange.exchange === "bybit" && symbol === "BTCUSDC") {
|
|
63604
|
+
continue;
|
|
63605
|
+
}
|
|
63606
|
+
await exchange_account.getFocusPosition({
|
|
63607
|
+
symbol,
|
|
63608
|
+
kind: "long",
|
|
63609
|
+
update: true
|
|
63610
|
+
});
|
|
60595
63611
|
}
|
|
60596
|
-
await exchange_account.placeProfitAndStop({
|
|
60597
|
-
symbol,
|
|
60598
|
-
trigger: true,
|
|
60599
|
-
refresh: true
|
|
60600
|
-
});
|
|
60601
|
-
await exchange_account.syncAccount({
|
|
60602
|
-
symbol,
|
|
60603
|
-
update: true
|
|
60604
|
-
});
|
|
60605
63612
|
}
|
|
60606
63613
|
}
|
|
60607
63614
|
async autoFollowPositions() {
|
|
@@ -60622,25 +63629,34 @@ class App {
|
|
|
60622
63629
|
async getMoverExchangeInstances() {
|
|
60623
63630
|
return await this.app_db.getMoverExchangeInstances();
|
|
60624
63631
|
}
|
|
60625
|
-
async updateTpOnAllMarkets() {
|
|
63632
|
+
async updateTpOnAllMarkets(callback) {
|
|
60626
63633
|
const move_instances = await this.app_db.getAccountWithActivePositions();
|
|
60627
63634
|
for (const instance of move_instances) {
|
|
60628
|
-
|
|
60629
|
-
|
|
60630
|
-
|
|
60631
|
-
|
|
60632
|
-
|
|
60633
|
-
|
|
60634
|
-
const exchange_account = await this.getExchangeAccount(params.account);
|
|
60635
|
-
const symbols = await exchange_account.getSymbolsForPositions();
|
|
60636
|
-
for (const symbol of symbols) {
|
|
60637
|
-
await exchange_account.placeTrade({
|
|
60638
|
-
symbol,
|
|
60639
|
-
kind: "long",
|
|
60640
|
-
tp: true,
|
|
60641
|
-
limit: false
|
|
63635
|
+
if (callback) {
|
|
63636
|
+
await callback({
|
|
63637
|
+
account: {
|
|
63638
|
+
owner: instance.owner,
|
|
63639
|
+
exchange: instance.exchange
|
|
63640
|
+
}
|
|
60642
63641
|
});
|
|
60643
|
-
|
|
63642
|
+
} else {
|
|
63643
|
+
const params = {
|
|
63644
|
+
account: {
|
|
63645
|
+
owner: instance.owner,
|
|
63646
|
+
exchange: instance.exchange
|
|
63647
|
+
}
|
|
63648
|
+
};
|
|
63649
|
+
const exchange_account = await this.getExchangeAccount(params.account);
|
|
63650
|
+
const symbols = await exchange_account.getSymbolsForPositions();
|
|
63651
|
+
for (const symbol of symbols) {
|
|
63652
|
+
await exchange_account.placeTrade({
|
|
63653
|
+
symbol,
|
|
63654
|
+
kind: "long",
|
|
63655
|
+
tp: true,
|
|
63656
|
+
limit: false
|
|
63657
|
+
});
|
|
63658
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
63659
|
+
}
|
|
60644
63660
|
}
|
|
60645
63661
|
}
|
|
60646
63662
|
}
|