@nsshunt/stsuxvue 1.0.81 → 1.0.82
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/stsuxvue.cjs +2788 -57
- package/dist/stsuxvue.cjs.map +1 -1
- package/dist/stsuxvue.mjs +2790 -59
- package/dist/stsuxvue.mjs.map +1 -1
- package/package.json +1 -1
- package/types/Views/UXModelNavigatorView.vue.d.ts +5 -1
- package/types/Views/UXModelNavigatorView.vue.d.ts.map +1 -1
- package/types/Views/UXModelNavigatorViewSingle.vue.d.ts +4 -1
- package/types/Views/UXModelNavigatorViewSingle.vue.d.ts.map +1 -1
- package/types/components/UXModelNavigator.vue.d.ts.map +1 -1
- package/types/components/restClientSubscriber.d.ts +10 -0
- package/types/components/restClientSubscriber.d.ts.map +1 -0
- package/types/plugins/observabilitySubscriberManager.d.ts +0 -2
- package/types/plugins/observabilitySubscriberManager.d.ts.map +0 -1
package/dist/stsuxvue.cjs
CHANGED
|
@@ -5142,25 +5142,25 @@ function requireDecode() {
|
|
|
5142
5142
|
}
|
|
5143
5143
|
return decode;
|
|
5144
5144
|
}
|
|
5145
|
-
var encode = {};
|
|
5145
|
+
var encode$2 = {};
|
|
5146
5146
|
var hasRequiredEncode;
|
|
5147
5147
|
function requireEncode() {
|
|
5148
|
-
if (hasRequiredEncode) return encode;
|
|
5148
|
+
if (hasRequiredEncode) return encode$2;
|
|
5149
5149
|
hasRequiredEncode = 1;
|
|
5150
|
-
var __importDefault = encode && encode.__importDefault || function(mod) {
|
|
5150
|
+
var __importDefault = encode$2 && encode$2.__importDefault || function(mod) {
|
|
5151
5151
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
5152
5152
|
};
|
|
5153
|
-
Object.defineProperty(encode, "__esModule", { value: true });
|
|
5154
|
-
encode.escapeUTF8 = encode.escape = encode.encodeNonAsciiHTML = encode.encodeHTML = encode.encodeXML = void 0;
|
|
5153
|
+
Object.defineProperty(encode$2, "__esModule", { value: true });
|
|
5154
|
+
encode$2.escapeUTF8 = encode$2.escape = encode$2.encodeNonAsciiHTML = encode$2.encodeHTML = encode$2.encodeXML = void 0;
|
|
5155
5155
|
var xml_json_1 = __importDefault(require$$0$1);
|
|
5156
5156
|
var inverseXML = getInverseObj(xml_json_1.default);
|
|
5157
5157
|
var xmlReplacer = getInverseReplacer(inverseXML);
|
|
5158
|
-
encode.encodeXML = getASCIIEncoder(inverseXML);
|
|
5158
|
+
encode$2.encodeXML = getASCIIEncoder(inverseXML);
|
|
5159
5159
|
var entities_json_1 = __importDefault(require$$1$1);
|
|
5160
5160
|
var inverseHTML = getInverseObj(entities_json_1.default);
|
|
5161
5161
|
var htmlReplacer = getInverseReplacer(inverseHTML);
|
|
5162
|
-
encode.encodeHTML = getInverse(inverseHTML, htmlReplacer);
|
|
5163
|
-
encode.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML);
|
|
5162
|
+
encode$2.encodeHTML = getInverse(inverseHTML, htmlReplacer);
|
|
5163
|
+
encode$2.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML);
|
|
5164
5164
|
function getInverseObj(obj) {
|
|
5165
5165
|
return Object.keys(obj).sort().reduce(function(inverse, name) {
|
|
5166
5166
|
inverse[obj[name]] = "&" + name + ";";
|
|
@@ -5221,11 +5221,11 @@ function requireEncode() {
|
|
|
5221
5221
|
function escape(data) {
|
|
5222
5222
|
return data.replace(reEscapeChars, singleCharReplacer);
|
|
5223
5223
|
}
|
|
5224
|
-
encode.escape = escape;
|
|
5224
|
+
encode$2.escape = escape;
|
|
5225
5225
|
function escapeUTF8(data) {
|
|
5226
5226
|
return data.replace(xmlReplacer, singleCharReplacer);
|
|
5227
5227
|
}
|
|
5228
|
-
encode.escapeUTF8 = escapeUTF8;
|
|
5228
|
+
encode$2.escapeUTF8 = escapeUTF8;
|
|
5229
5229
|
function getASCIIEncoder(obj) {
|
|
5230
5230
|
return function(data) {
|
|
5231
5231
|
return data.replace(reEscapeChars, function(c) {
|
|
@@ -5233,7 +5233,7 @@ function requireEncode() {
|
|
|
5233
5233
|
});
|
|
5234
5234
|
};
|
|
5235
5235
|
}
|
|
5236
|
-
return encode;
|
|
5236
|
+
return encode$2;
|
|
5237
5237
|
}
|
|
5238
5238
|
var hasRequiredLib;
|
|
5239
5239
|
function requireLib() {
|
|
@@ -5380,7 +5380,7 @@ function requireAnsi_to_html() {
|
|
|
5380
5380
|
return arr2;
|
|
5381
5381
|
}
|
|
5382
5382
|
var entities = /* @__PURE__ */ requireLib();
|
|
5383
|
-
var
|
|
5383
|
+
var defaults2 = {
|
|
5384
5384
|
fg: "#FFF",
|
|
5385
5385
|
bg: "#000",
|
|
5386
5386
|
newline: false,
|
|
@@ -5756,9 +5756,9 @@ function requireAnsi_to_html() {
|
|
|
5756
5756
|
_classCallCheck(this, Filter2);
|
|
5757
5757
|
options = options || {};
|
|
5758
5758
|
if (options.colors) {
|
|
5759
|
-
options.colors = Object.assign({},
|
|
5759
|
+
options.colors = Object.assign({}, defaults2.colors, options.colors);
|
|
5760
5760
|
}
|
|
5761
|
-
this.options = Object.assign({},
|
|
5761
|
+
this.options = Object.assign({}, defaults2, options);
|
|
5762
5762
|
this.stack = [];
|
|
5763
5763
|
this.stickyStack = [];
|
|
5764
5764
|
}
|
|
@@ -5801,7 +5801,7 @@ const {
|
|
|
5801
5801
|
entries,
|
|
5802
5802
|
setPrototypeOf,
|
|
5803
5803
|
isFrozen,
|
|
5804
|
-
getPrototypeOf,
|
|
5804
|
+
getPrototypeOf: getPrototypeOf$1,
|
|
5805
5805
|
getOwnPropertyDescriptor
|
|
5806
5806
|
} = Object;
|
|
5807
5807
|
let {
|
|
@@ -5929,7 +5929,7 @@ function lookupGetter(object, prop2) {
|
|
|
5929
5929
|
return unapply(desc.value);
|
|
5930
5930
|
}
|
|
5931
5931
|
}
|
|
5932
|
-
object = getPrototypeOf(object);
|
|
5932
|
+
object = getPrototypeOf$1(object);
|
|
5933
5933
|
}
|
|
5934
5934
|
function fallbackValue() {
|
|
5935
5935
|
return null;
|
|
@@ -6034,9 +6034,9 @@ function createDOMPurify() {
|
|
|
6034
6034
|
return DOMPurify;
|
|
6035
6035
|
}
|
|
6036
6036
|
let {
|
|
6037
|
-
document
|
|
6037
|
+
document: document2
|
|
6038
6038
|
} = window2;
|
|
6039
|
-
const originalDocument =
|
|
6039
|
+
const originalDocument = document2;
|
|
6040
6040
|
const currentScript = originalDocument.currentScript;
|
|
6041
6041
|
const {
|
|
6042
6042
|
DocumentFragment,
|
|
@@ -6056,9 +6056,9 @@ function createDOMPurify() {
|
|
|
6056
6056
|
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
6057
6057
|
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
6058
6058
|
if (typeof HTMLTemplateElement === "function") {
|
|
6059
|
-
const template =
|
|
6059
|
+
const template = document2.createElement("template");
|
|
6060
6060
|
if (template.content && template.content.ownerDocument) {
|
|
6061
|
-
|
|
6061
|
+
document2 = template.content.ownerDocument;
|
|
6062
6062
|
}
|
|
6063
6063
|
}
|
|
6064
6064
|
let trustedTypesPolicy;
|
|
@@ -6068,7 +6068,7 @@ function createDOMPurify() {
|
|
|
6068
6068
|
createNodeIterator,
|
|
6069
6069
|
createDocumentFragment,
|
|
6070
6070
|
getElementsByTagName
|
|
6071
|
-
} =
|
|
6071
|
+
} = document2;
|
|
6072
6072
|
const {
|
|
6073
6073
|
importNode
|
|
6074
6074
|
} = originalDocument;
|
|
@@ -6166,7 +6166,7 @@ function createDOMPurify() {
|
|
|
6166
6166
|
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
6167
6167
|
let transformCaseFunc = null;
|
|
6168
6168
|
let CONFIG = null;
|
|
6169
|
-
const formElement =
|
|
6169
|
+
const formElement = document2.createElement("form");
|
|
6170
6170
|
const isRegexOrFunction = function isRegexOrFunction2(testValue) {
|
|
6171
6171
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
6172
6172
|
};
|
|
@@ -6428,7 +6428,7 @@ function createDOMPurify() {
|
|
|
6428
6428
|
}
|
|
6429
6429
|
const body = doc.body || doc.documentElement;
|
|
6430
6430
|
if (dirty && leadingWhitespace) {
|
|
6431
|
-
body.insertBefore(
|
|
6431
|
+
body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
6432
6432
|
}
|
|
6433
6433
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
6434
6434
|
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
@@ -6527,7 +6527,7 @@ function createDOMPurify() {
|
|
|
6527
6527
|
return false;
|
|
6528
6528
|
};
|
|
6529
6529
|
const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
|
|
6530
|
-
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in
|
|
6530
|
+
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
|
|
6531
6531
|
return false;
|
|
6532
6532
|
}
|
|
6533
6533
|
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
|
|
@@ -8434,7 +8434,7 @@ function requireTemplates() {
|
|
|
8434
8434
|
["e", "\x1B"],
|
|
8435
8435
|
["a", "\x07"]
|
|
8436
8436
|
]);
|
|
8437
|
-
function
|
|
8437
|
+
function unescape2(c) {
|
|
8438
8438
|
const u = c[0] === "u";
|
|
8439
8439
|
const bracket = c[1] === "{";
|
|
8440
8440
|
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
@@ -8454,7 +8454,7 @@ function requireTemplates() {
|
|
|
8454
8454
|
if (!Number.isNaN(number)) {
|
|
8455
8455
|
results.push(number);
|
|
8456
8456
|
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
8457
|
-
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ?
|
|
8457
|
+
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape2(escape) : character));
|
|
8458
8458
|
} else {
|
|
8459
8459
|
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
8460
8460
|
}
|
|
@@ -8501,7 +8501,7 @@ function requireTemplates() {
|
|
|
8501
8501
|
let chunk = [];
|
|
8502
8502
|
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
8503
8503
|
if (escapeCharacter) {
|
|
8504
|
-
chunk.push(
|
|
8504
|
+
chunk.push(unescape2(escapeCharacter));
|
|
8505
8505
|
} else if (style) {
|
|
8506
8506
|
const string = chunk.join("");
|
|
8507
8507
|
chunk = [];
|
|
@@ -8538,7 +8538,7 @@ function requireSource() {
|
|
|
8538
8538
|
stringReplaceAll,
|
|
8539
8539
|
stringEncaseCRLFWithFirstIndex
|
|
8540
8540
|
} = requireUtil();
|
|
8541
|
-
const { isArray } = Array;
|
|
8541
|
+
const { isArray: isArray2 } = Array;
|
|
8542
8542
|
const levelMapping = [
|
|
8543
8543
|
"ansi",
|
|
8544
8544
|
"ansi",
|
|
@@ -8644,24 +8644,24 @@ function requireSource() {
|
|
|
8644
8644
|
parent
|
|
8645
8645
|
};
|
|
8646
8646
|
};
|
|
8647
|
-
const createBuilder = (
|
|
8647
|
+
const createBuilder = (self2, _styler, _isEmpty) => {
|
|
8648
8648
|
const builder = (...arguments_) => {
|
|
8649
|
-
if (
|
|
8649
|
+
if (isArray2(arguments_[0]) && isArray2(arguments_[0].raw)) {
|
|
8650
8650
|
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
8651
8651
|
}
|
|
8652
8652
|
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
8653
8653
|
};
|
|
8654
8654
|
Object.setPrototypeOf(builder, proto);
|
|
8655
|
-
builder._generator =
|
|
8655
|
+
builder._generator = self2;
|
|
8656
8656
|
builder._styler = _styler;
|
|
8657
8657
|
builder._isEmpty = _isEmpty;
|
|
8658
8658
|
return builder;
|
|
8659
8659
|
};
|
|
8660
|
-
const applyStyle = (
|
|
8661
|
-
if (
|
|
8662
|
-
return
|
|
8660
|
+
const applyStyle = (self2, string) => {
|
|
8661
|
+
if (self2.level <= 0 || !string) {
|
|
8662
|
+
return self2._isEmpty ? "" : string;
|
|
8663
8663
|
}
|
|
8664
|
-
let styler =
|
|
8664
|
+
let styler = self2._styler;
|
|
8665
8665
|
if (styler === void 0) {
|
|
8666
8666
|
return string;
|
|
8667
8667
|
}
|
|
@@ -8681,7 +8681,7 @@ function requireSource() {
|
|
|
8681
8681
|
let template;
|
|
8682
8682
|
const chalkTag = (chalk3, ...strings) => {
|
|
8683
8683
|
const [firstString] = strings;
|
|
8684
|
-
if (!
|
|
8684
|
+
if (!isArray2(firstString) || !isArray2(firstString.raw)) {
|
|
8685
8685
|
return strings.join(" ");
|
|
8686
8686
|
}
|
|
8687
8687
|
const arguments_ = strings.slice(1);
|
|
@@ -10033,9 +10033,9 @@ function requireTinyEmitter() {
|
|
|
10033
10033
|
return this;
|
|
10034
10034
|
},
|
|
10035
10035
|
once: function(name, callback, ctx) {
|
|
10036
|
-
var
|
|
10036
|
+
var self2 = this;
|
|
10037
10037
|
function listener() {
|
|
10038
|
-
|
|
10038
|
+
self2.off(name, listener);
|
|
10039
10039
|
callback.apply(ctx, arguments);
|
|
10040
10040
|
}
|
|
10041
10041
|
listener._ = callback;
|
|
@@ -10391,6 +10391,2724 @@ class SocketClientSubscriber extends SocketIoClient {
|
|
|
10391
10391
|
this.LogErrorMessage(chalk.red(`${this.logPrefix}SocketDisconnect(): reason: [${reason}]`));
|
|
10392
10392
|
}
|
|
10393
10393
|
}
|
|
10394
|
+
function bind(fn, thisArg) {
|
|
10395
|
+
return function wrap() {
|
|
10396
|
+
return fn.apply(thisArg, arguments);
|
|
10397
|
+
};
|
|
10398
|
+
}
|
|
10399
|
+
const { toString } = Object.prototype;
|
|
10400
|
+
const { getPrototypeOf } = Object;
|
|
10401
|
+
const { iterator, toStringTag } = Symbol;
|
|
10402
|
+
const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
|
|
10403
|
+
const str = toString.call(thing);
|
|
10404
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
10405
|
+
})(/* @__PURE__ */ Object.create(null));
|
|
10406
|
+
const kindOfTest = (type) => {
|
|
10407
|
+
type = type.toLowerCase();
|
|
10408
|
+
return (thing) => kindOf(thing) === type;
|
|
10409
|
+
};
|
|
10410
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
10411
|
+
const { isArray } = Array;
|
|
10412
|
+
const isUndefined = typeOfTest("undefined");
|
|
10413
|
+
function isBuffer(val) {
|
|
10414
|
+
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
10415
|
+
}
|
|
10416
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
10417
|
+
function isArrayBufferView(val) {
|
|
10418
|
+
let result;
|
|
10419
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
10420
|
+
result = ArrayBuffer.isView(val);
|
|
10421
|
+
} else {
|
|
10422
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
10423
|
+
}
|
|
10424
|
+
return result;
|
|
10425
|
+
}
|
|
10426
|
+
const isString = typeOfTest("string");
|
|
10427
|
+
const isFunction$1 = typeOfTest("function");
|
|
10428
|
+
const isNumber = typeOfTest("number");
|
|
10429
|
+
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
10430
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
10431
|
+
const isPlainObject = (val) => {
|
|
10432
|
+
if (kindOf(val) !== "object") {
|
|
10433
|
+
return false;
|
|
10434
|
+
}
|
|
10435
|
+
const prototype2 = getPrototypeOf(val);
|
|
10436
|
+
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
|
|
10437
|
+
};
|
|
10438
|
+
const isEmptyObject = (val) => {
|
|
10439
|
+
if (!isObject(val) || isBuffer(val)) {
|
|
10440
|
+
return false;
|
|
10441
|
+
}
|
|
10442
|
+
try {
|
|
10443
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
10444
|
+
} catch (e) {
|
|
10445
|
+
return false;
|
|
10446
|
+
}
|
|
10447
|
+
};
|
|
10448
|
+
const isDate = kindOfTest("Date");
|
|
10449
|
+
const isFile = kindOfTest("File");
|
|
10450
|
+
const isBlob = kindOfTest("Blob");
|
|
10451
|
+
const isFileList = kindOfTest("FileList");
|
|
10452
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
10453
|
+
const isFormData = (thing) => {
|
|
10454
|
+
let kind;
|
|
10455
|
+
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
|
|
10456
|
+
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
|
|
10457
|
+
};
|
|
10458
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
10459
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
10460
|
+
"ReadableStream",
|
|
10461
|
+
"Request",
|
|
10462
|
+
"Response",
|
|
10463
|
+
"Headers"
|
|
10464
|
+
].map(kindOfTest);
|
|
10465
|
+
const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
10466
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
10467
|
+
if (obj === null || typeof obj === "undefined") {
|
|
10468
|
+
return;
|
|
10469
|
+
}
|
|
10470
|
+
let i;
|
|
10471
|
+
let l;
|
|
10472
|
+
if (typeof obj !== "object") {
|
|
10473
|
+
obj = [obj];
|
|
10474
|
+
}
|
|
10475
|
+
if (isArray(obj)) {
|
|
10476
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
10477
|
+
fn.call(null, obj[i], i, obj);
|
|
10478
|
+
}
|
|
10479
|
+
} else {
|
|
10480
|
+
if (isBuffer(obj)) {
|
|
10481
|
+
return;
|
|
10482
|
+
}
|
|
10483
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
10484
|
+
const len = keys.length;
|
|
10485
|
+
let key;
|
|
10486
|
+
for (i = 0; i < len; i++) {
|
|
10487
|
+
key = keys[i];
|
|
10488
|
+
fn.call(null, obj[key], key, obj);
|
|
10489
|
+
}
|
|
10490
|
+
}
|
|
10491
|
+
}
|
|
10492
|
+
function findKey(obj, key) {
|
|
10493
|
+
if (isBuffer(obj)) {
|
|
10494
|
+
return null;
|
|
10495
|
+
}
|
|
10496
|
+
key = key.toLowerCase();
|
|
10497
|
+
const keys = Object.keys(obj);
|
|
10498
|
+
let i = keys.length;
|
|
10499
|
+
let _key;
|
|
10500
|
+
while (i-- > 0) {
|
|
10501
|
+
_key = keys[i];
|
|
10502
|
+
if (key === _key.toLowerCase()) {
|
|
10503
|
+
return _key;
|
|
10504
|
+
}
|
|
10505
|
+
}
|
|
10506
|
+
return null;
|
|
10507
|
+
}
|
|
10508
|
+
const _global = (() => {
|
|
10509
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
10510
|
+
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
10511
|
+
})();
|
|
10512
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
10513
|
+
function merge() {
|
|
10514
|
+
const { caseless, skipUndefined } = isContextDefined(this) && this || {};
|
|
10515
|
+
const result = {};
|
|
10516
|
+
const assignValue = (val, key) => {
|
|
10517
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
10518
|
+
return;
|
|
10519
|
+
}
|
|
10520
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
10521
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
10522
|
+
result[targetKey] = merge(result[targetKey], val);
|
|
10523
|
+
} else if (isPlainObject(val)) {
|
|
10524
|
+
result[targetKey] = merge({}, val);
|
|
10525
|
+
} else if (isArray(val)) {
|
|
10526
|
+
result[targetKey] = val.slice();
|
|
10527
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
10528
|
+
result[targetKey] = val;
|
|
10529
|
+
}
|
|
10530
|
+
};
|
|
10531
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
10532
|
+
arguments[i] && forEach(arguments[i], assignValue);
|
|
10533
|
+
}
|
|
10534
|
+
return result;
|
|
10535
|
+
}
|
|
10536
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
10537
|
+
forEach(
|
|
10538
|
+
b,
|
|
10539
|
+
(val, key) => {
|
|
10540
|
+
if (thisArg && isFunction$1(val)) {
|
|
10541
|
+
Object.defineProperty(a, key, {
|
|
10542
|
+
value: bind(val, thisArg),
|
|
10543
|
+
writable: true,
|
|
10544
|
+
enumerable: true,
|
|
10545
|
+
configurable: true
|
|
10546
|
+
});
|
|
10547
|
+
} else {
|
|
10548
|
+
Object.defineProperty(a, key, {
|
|
10549
|
+
value: val,
|
|
10550
|
+
writable: true,
|
|
10551
|
+
enumerable: true,
|
|
10552
|
+
configurable: true
|
|
10553
|
+
});
|
|
10554
|
+
}
|
|
10555
|
+
},
|
|
10556
|
+
{ allOwnKeys }
|
|
10557
|
+
);
|
|
10558
|
+
return a;
|
|
10559
|
+
};
|
|
10560
|
+
const stripBOM = (content) => {
|
|
10561
|
+
if (content.charCodeAt(0) === 65279) {
|
|
10562
|
+
content = content.slice(1);
|
|
10563
|
+
}
|
|
10564
|
+
return content;
|
|
10565
|
+
};
|
|
10566
|
+
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
10567
|
+
constructor.prototype = Object.create(
|
|
10568
|
+
superConstructor.prototype,
|
|
10569
|
+
descriptors
|
|
10570
|
+
);
|
|
10571
|
+
Object.defineProperty(constructor.prototype, "constructor", {
|
|
10572
|
+
value: constructor,
|
|
10573
|
+
writable: true,
|
|
10574
|
+
enumerable: false,
|
|
10575
|
+
configurable: true
|
|
10576
|
+
});
|
|
10577
|
+
Object.defineProperty(constructor, "super", {
|
|
10578
|
+
value: superConstructor.prototype
|
|
10579
|
+
});
|
|
10580
|
+
props && Object.assign(constructor.prototype, props);
|
|
10581
|
+
};
|
|
10582
|
+
const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
10583
|
+
let props;
|
|
10584
|
+
let i;
|
|
10585
|
+
let prop2;
|
|
10586
|
+
const merged = {};
|
|
10587
|
+
destObj = destObj || {};
|
|
10588
|
+
if (sourceObj == null) return destObj;
|
|
10589
|
+
do {
|
|
10590
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
10591
|
+
i = props.length;
|
|
10592
|
+
while (i-- > 0) {
|
|
10593
|
+
prop2 = props[i];
|
|
10594
|
+
if ((!propFilter || propFilter(prop2, sourceObj, destObj)) && !merged[prop2]) {
|
|
10595
|
+
destObj[prop2] = sourceObj[prop2];
|
|
10596
|
+
merged[prop2] = true;
|
|
10597
|
+
}
|
|
10598
|
+
}
|
|
10599
|
+
sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
|
|
10600
|
+
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
10601
|
+
return destObj;
|
|
10602
|
+
};
|
|
10603
|
+
const endsWith = (str, searchString, position) => {
|
|
10604
|
+
str = String(str);
|
|
10605
|
+
if (position === void 0 || position > str.length) {
|
|
10606
|
+
position = str.length;
|
|
10607
|
+
}
|
|
10608
|
+
position -= searchString.length;
|
|
10609
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
10610
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
10611
|
+
};
|
|
10612
|
+
const toArray = (thing) => {
|
|
10613
|
+
if (!thing) return null;
|
|
10614
|
+
if (isArray(thing)) return thing;
|
|
10615
|
+
let i = thing.length;
|
|
10616
|
+
if (!isNumber(i)) return null;
|
|
10617
|
+
const arr = new Array(i);
|
|
10618
|
+
while (i-- > 0) {
|
|
10619
|
+
arr[i] = thing[i];
|
|
10620
|
+
}
|
|
10621
|
+
return arr;
|
|
10622
|
+
};
|
|
10623
|
+
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
|
|
10624
|
+
return (thing) => {
|
|
10625
|
+
return TypedArray && thing instanceof TypedArray;
|
|
10626
|
+
};
|
|
10627
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
10628
|
+
const forEachEntry = (obj, fn) => {
|
|
10629
|
+
const generator = obj && obj[iterator];
|
|
10630
|
+
const _iterator = generator.call(obj);
|
|
10631
|
+
let result;
|
|
10632
|
+
while ((result = _iterator.next()) && !result.done) {
|
|
10633
|
+
const pair = result.value;
|
|
10634
|
+
fn.call(obj, pair[0], pair[1]);
|
|
10635
|
+
}
|
|
10636
|
+
};
|
|
10637
|
+
const matchAll = (regExp, str) => {
|
|
10638
|
+
let matches;
|
|
10639
|
+
const arr = [];
|
|
10640
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
10641
|
+
arr.push(matches);
|
|
10642
|
+
}
|
|
10643
|
+
return arr;
|
|
10644
|
+
};
|
|
10645
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
10646
|
+
const toCamelCase = (str) => {
|
|
10647
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
10648
|
+
return p1.toUpperCase() + p2;
|
|
10649
|
+
});
|
|
10650
|
+
};
|
|
10651
|
+
const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop2) => hasOwnProperty2.call(obj, prop2))(Object.prototype);
|
|
10652
|
+
const isRegExp = kindOfTest("RegExp");
|
|
10653
|
+
const reduceDescriptors = (obj, reducer) => {
|
|
10654
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
10655
|
+
const reducedDescriptors = {};
|
|
10656
|
+
forEach(descriptors, (descriptor, name) => {
|
|
10657
|
+
let ret;
|
|
10658
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
10659
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
10660
|
+
}
|
|
10661
|
+
});
|
|
10662
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
10663
|
+
};
|
|
10664
|
+
const freezeMethods = (obj) => {
|
|
10665
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
10666
|
+
if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
10667
|
+
return false;
|
|
10668
|
+
}
|
|
10669
|
+
const value = obj[name];
|
|
10670
|
+
if (!isFunction$1(value)) return;
|
|
10671
|
+
descriptor.enumerable = false;
|
|
10672
|
+
if ("writable" in descriptor) {
|
|
10673
|
+
descriptor.writable = false;
|
|
10674
|
+
return;
|
|
10675
|
+
}
|
|
10676
|
+
if (!descriptor.set) {
|
|
10677
|
+
descriptor.set = () => {
|
|
10678
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
10679
|
+
};
|
|
10680
|
+
}
|
|
10681
|
+
});
|
|
10682
|
+
};
|
|
10683
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
10684
|
+
const obj = {};
|
|
10685
|
+
const define = (arr) => {
|
|
10686
|
+
arr.forEach((value) => {
|
|
10687
|
+
obj[value] = true;
|
|
10688
|
+
});
|
|
10689
|
+
};
|
|
10690
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
10691
|
+
return obj;
|
|
10692
|
+
};
|
|
10693
|
+
const noop = () => {
|
|
10694
|
+
};
|
|
10695
|
+
const toFiniteNumber = (value, defaultValue) => {
|
|
10696
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
10697
|
+
};
|
|
10698
|
+
function isSpecCompliantForm(thing) {
|
|
10699
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
|
|
10700
|
+
}
|
|
10701
|
+
const toJSONObject = (obj) => {
|
|
10702
|
+
const stack = new Array(10);
|
|
10703
|
+
const visit = (source2, i) => {
|
|
10704
|
+
if (isObject(source2)) {
|
|
10705
|
+
if (stack.indexOf(source2) >= 0) {
|
|
10706
|
+
return;
|
|
10707
|
+
}
|
|
10708
|
+
if (isBuffer(source2)) {
|
|
10709
|
+
return source2;
|
|
10710
|
+
}
|
|
10711
|
+
if (!("toJSON" in source2)) {
|
|
10712
|
+
stack[i] = source2;
|
|
10713
|
+
const target2 = isArray(source2) ? [] : {};
|
|
10714
|
+
forEach(source2, (value, key) => {
|
|
10715
|
+
const reducedValue = visit(value, i + 1);
|
|
10716
|
+
!isUndefined(reducedValue) && (target2[key] = reducedValue);
|
|
10717
|
+
});
|
|
10718
|
+
stack[i] = void 0;
|
|
10719
|
+
return target2;
|
|
10720
|
+
}
|
|
10721
|
+
}
|
|
10722
|
+
return source2;
|
|
10723
|
+
};
|
|
10724
|
+
return visit(obj, 0);
|
|
10725
|
+
};
|
|
10726
|
+
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
10727
|
+
const isThenable = (thing) => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
10728
|
+
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
10729
|
+
if (setImmediateSupported) {
|
|
10730
|
+
return setImmediate;
|
|
10731
|
+
}
|
|
10732
|
+
return postMessageSupported ? ((token, callbacks) => {
|
|
10733
|
+
_global.addEventListener(
|
|
10734
|
+
"message",
|
|
10735
|
+
({ source: source2, data }) => {
|
|
10736
|
+
if (source2 === _global && data === token) {
|
|
10737
|
+
callbacks.length && callbacks.shift()();
|
|
10738
|
+
}
|
|
10739
|
+
},
|
|
10740
|
+
false
|
|
10741
|
+
);
|
|
10742
|
+
return (cb) => {
|
|
10743
|
+
callbacks.push(cb);
|
|
10744
|
+
_global.postMessage(token, "*");
|
|
10745
|
+
};
|
|
10746
|
+
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
10747
|
+
})(typeof setImmediate === "function", isFunction$1(_global.postMessage));
|
|
10748
|
+
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
|
|
10749
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
10750
|
+
const utils$1 = {
|
|
10751
|
+
isArray,
|
|
10752
|
+
isArrayBuffer,
|
|
10753
|
+
isBuffer,
|
|
10754
|
+
isFormData,
|
|
10755
|
+
isArrayBufferView,
|
|
10756
|
+
isString,
|
|
10757
|
+
isNumber,
|
|
10758
|
+
isBoolean,
|
|
10759
|
+
isObject,
|
|
10760
|
+
isPlainObject,
|
|
10761
|
+
isEmptyObject,
|
|
10762
|
+
isReadableStream,
|
|
10763
|
+
isRequest,
|
|
10764
|
+
isResponse,
|
|
10765
|
+
isHeaders,
|
|
10766
|
+
isUndefined,
|
|
10767
|
+
isDate,
|
|
10768
|
+
isFile,
|
|
10769
|
+
isBlob,
|
|
10770
|
+
isRegExp,
|
|
10771
|
+
isFunction: isFunction$1,
|
|
10772
|
+
isStream,
|
|
10773
|
+
isURLSearchParams,
|
|
10774
|
+
isTypedArray,
|
|
10775
|
+
isFileList,
|
|
10776
|
+
forEach,
|
|
10777
|
+
merge,
|
|
10778
|
+
extend,
|
|
10779
|
+
trim,
|
|
10780
|
+
stripBOM,
|
|
10781
|
+
inherits,
|
|
10782
|
+
toFlatObject,
|
|
10783
|
+
kindOf,
|
|
10784
|
+
kindOfTest,
|
|
10785
|
+
endsWith,
|
|
10786
|
+
toArray,
|
|
10787
|
+
forEachEntry,
|
|
10788
|
+
matchAll,
|
|
10789
|
+
isHTMLForm,
|
|
10790
|
+
hasOwnProperty,
|
|
10791
|
+
hasOwnProp: hasOwnProperty,
|
|
10792
|
+
// an alias to avoid ESLint no-prototype-builtins detection
|
|
10793
|
+
reduceDescriptors,
|
|
10794
|
+
freezeMethods,
|
|
10795
|
+
toObjectSet,
|
|
10796
|
+
toCamelCase,
|
|
10797
|
+
noop,
|
|
10798
|
+
toFiniteNumber,
|
|
10799
|
+
findKey,
|
|
10800
|
+
global: _global,
|
|
10801
|
+
isContextDefined,
|
|
10802
|
+
isSpecCompliantForm,
|
|
10803
|
+
toJSONObject,
|
|
10804
|
+
isAsyncFn,
|
|
10805
|
+
isThenable,
|
|
10806
|
+
setImmediate: _setImmediate,
|
|
10807
|
+
asap,
|
|
10808
|
+
isIterable
|
|
10809
|
+
};
|
|
10810
|
+
let AxiosError$1 = class AxiosError extends Error {
|
|
10811
|
+
static from(error, code, config, request, response, customProps) {
|
|
10812
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
10813
|
+
axiosError.cause = error;
|
|
10814
|
+
axiosError.name = error.name;
|
|
10815
|
+
customProps && Object.assign(axiosError, customProps);
|
|
10816
|
+
return axiosError;
|
|
10817
|
+
}
|
|
10818
|
+
/**
|
|
10819
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
10820
|
+
*
|
|
10821
|
+
* @param {string} message The error message.
|
|
10822
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
10823
|
+
* @param {Object} [config] The config.
|
|
10824
|
+
* @param {Object} [request] The request.
|
|
10825
|
+
* @param {Object} [response] The response.
|
|
10826
|
+
*
|
|
10827
|
+
* @returns {Error} The created error.
|
|
10828
|
+
*/
|
|
10829
|
+
constructor(message, code, config, request, response) {
|
|
10830
|
+
super(message);
|
|
10831
|
+
this.name = "AxiosError";
|
|
10832
|
+
this.isAxiosError = true;
|
|
10833
|
+
code && (this.code = code);
|
|
10834
|
+
config && (this.config = config);
|
|
10835
|
+
request && (this.request = request);
|
|
10836
|
+
if (response) {
|
|
10837
|
+
this.response = response;
|
|
10838
|
+
this.status = response.status;
|
|
10839
|
+
}
|
|
10840
|
+
}
|
|
10841
|
+
toJSON() {
|
|
10842
|
+
return {
|
|
10843
|
+
// Standard
|
|
10844
|
+
message: this.message,
|
|
10845
|
+
name: this.name,
|
|
10846
|
+
// Microsoft
|
|
10847
|
+
description: this.description,
|
|
10848
|
+
number: this.number,
|
|
10849
|
+
// Mozilla
|
|
10850
|
+
fileName: this.fileName,
|
|
10851
|
+
lineNumber: this.lineNumber,
|
|
10852
|
+
columnNumber: this.columnNumber,
|
|
10853
|
+
stack: this.stack,
|
|
10854
|
+
// Axios
|
|
10855
|
+
config: utils$1.toJSONObject(this.config),
|
|
10856
|
+
code: this.code,
|
|
10857
|
+
status: this.status
|
|
10858
|
+
};
|
|
10859
|
+
}
|
|
10860
|
+
};
|
|
10861
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";
|
|
10862
|
+
AxiosError$1.ERR_BAD_OPTION = "ERR_BAD_OPTION";
|
|
10863
|
+
AxiosError$1.ECONNABORTED = "ECONNABORTED";
|
|
10864
|
+
AxiosError$1.ETIMEDOUT = "ETIMEDOUT";
|
|
10865
|
+
AxiosError$1.ERR_NETWORK = "ERR_NETWORK";
|
|
10866
|
+
AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";
|
|
10867
|
+
AxiosError$1.ERR_DEPRECATED = "ERR_DEPRECATED";
|
|
10868
|
+
AxiosError$1.ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";
|
|
10869
|
+
AxiosError$1.ERR_BAD_REQUEST = "ERR_BAD_REQUEST";
|
|
10870
|
+
AxiosError$1.ERR_CANCELED = "ERR_CANCELED";
|
|
10871
|
+
AxiosError$1.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
|
|
10872
|
+
AxiosError$1.ERR_INVALID_URL = "ERR_INVALID_URL";
|
|
10873
|
+
const httpAdapter = null;
|
|
10874
|
+
function isVisitable(thing) {
|
|
10875
|
+
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
10876
|
+
}
|
|
10877
|
+
function removeBrackets(key) {
|
|
10878
|
+
return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
10879
|
+
}
|
|
10880
|
+
function renderKey(path, key, dots) {
|
|
10881
|
+
if (!path) return key;
|
|
10882
|
+
return path.concat(key).map(function each(token, i) {
|
|
10883
|
+
token = removeBrackets(token);
|
|
10884
|
+
return !dots && i ? "[" + token + "]" : token;
|
|
10885
|
+
}).join(dots ? "." : "");
|
|
10886
|
+
}
|
|
10887
|
+
function isFlatArray(arr) {
|
|
10888
|
+
return utils$1.isArray(arr) && !arr.some(isVisitable);
|
|
10889
|
+
}
|
|
10890
|
+
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop2) {
|
|
10891
|
+
return /^is[A-Z]/.test(prop2);
|
|
10892
|
+
});
|
|
10893
|
+
function toFormData$1(obj, formData, options) {
|
|
10894
|
+
if (!utils$1.isObject(obj)) {
|
|
10895
|
+
throw new TypeError("target must be an object");
|
|
10896
|
+
}
|
|
10897
|
+
formData = formData || new FormData();
|
|
10898
|
+
options = utils$1.toFlatObject(options, {
|
|
10899
|
+
metaTokens: true,
|
|
10900
|
+
dots: false,
|
|
10901
|
+
indexes: false
|
|
10902
|
+
}, false, function defined(option, source2) {
|
|
10903
|
+
return !utils$1.isUndefined(source2[option]);
|
|
10904
|
+
});
|
|
10905
|
+
const metaTokens = options.metaTokens;
|
|
10906
|
+
const visitor = options.visitor || defaultVisitor;
|
|
10907
|
+
const dots = options.dots;
|
|
10908
|
+
const indexes = options.indexes;
|
|
10909
|
+
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
10910
|
+
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
10911
|
+
if (!utils$1.isFunction(visitor)) {
|
|
10912
|
+
throw new TypeError("visitor must be a function");
|
|
10913
|
+
}
|
|
10914
|
+
function convertValue(value) {
|
|
10915
|
+
if (value === null) return "";
|
|
10916
|
+
if (utils$1.isDate(value)) {
|
|
10917
|
+
return value.toISOString();
|
|
10918
|
+
}
|
|
10919
|
+
if (utils$1.isBoolean(value)) {
|
|
10920
|
+
return value.toString();
|
|
10921
|
+
}
|
|
10922
|
+
if (!useBlob && utils$1.isBlob(value)) {
|
|
10923
|
+
throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
|
|
10924
|
+
}
|
|
10925
|
+
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
10926
|
+
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
10927
|
+
}
|
|
10928
|
+
return value;
|
|
10929
|
+
}
|
|
10930
|
+
function defaultVisitor(value, key, path) {
|
|
10931
|
+
let arr = value;
|
|
10932
|
+
if (value && !path && typeof value === "object") {
|
|
10933
|
+
if (utils$1.endsWith(key, "{}")) {
|
|
10934
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
10935
|
+
value = JSON.stringify(value);
|
|
10936
|
+
} else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
|
|
10937
|
+
key = removeBrackets(key);
|
|
10938
|
+
arr.forEach(function each(el2, index) {
|
|
10939
|
+
!(utils$1.isUndefined(el2) || el2 === null) && formData.append(
|
|
10940
|
+
// eslint-disable-next-line no-nested-ternary
|
|
10941
|
+
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
10942
|
+
convertValue(el2)
|
|
10943
|
+
);
|
|
10944
|
+
});
|
|
10945
|
+
return false;
|
|
10946
|
+
}
|
|
10947
|
+
}
|
|
10948
|
+
if (isVisitable(value)) {
|
|
10949
|
+
return true;
|
|
10950
|
+
}
|
|
10951
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
10952
|
+
return false;
|
|
10953
|
+
}
|
|
10954
|
+
const stack = [];
|
|
10955
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
10956
|
+
defaultVisitor,
|
|
10957
|
+
convertValue,
|
|
10958
|
+
isVisitable
|
|
10959
|
+
});
|
|
10960
|
+
function build(value, path) {
|
|
10961
|
+
if (utils$1.isUndefined(value)) return;
|
|
10962
|
+
if (stack.indexOf(value) !== -1) {
|
|
10963
|
+
throw Error("Circular reference detected in " + path.join("."));
|
|
10964
|
+
}
|
|
10965
|
+
stack.push(value);
|
|
10966
|
+
utils$1.forEach(value, function each(el2, key) {
|
|
10967
|
+
const result = !(utils$1.isUndefined(el2) || el2 === null) && visitor.call(
|
|
10968
|
+
formData,
|
|
10969
|
+
el2,
|
|
10970
|
+
utils$1.isString(key) ? key.trim() : key,
|
|
10971
|
+
path,
|
|
10972
|
+
exposedHelpers
|
|
10973
|
+
);
|
|
10974
|
+
if (result === true) {
|
|
10975
|
+
build(el2, path ? path.concat(key) : [key]);
|
|
10976
|
+
}
|
|
10977
|
+
});
|
|
10978
|
+
stack.pop();
|
|
10979
|
+
}
|
|
10980
|
+
if (!utils$1.isObject(obj)) {
|
|
10981
|
+
throw new TypeError("data must be an object");
|
|
10982
|
+
}
|
|
10983
|
+
build(obj);
|
|
10984
|
+
return formData;
|
|
10985
|
+
}
|
|
10986
|
+
function encode$1(str) {
|
|
10987
|
+
const charMap = {
|
|
10988
|
+
"!": "%21",
|
|
10989
|
+
"'": "%27",
|
|
10990
|
+
"(": "%28",
|
|
10991
|
+
")": "%29",
|
|
10992
|
+
"~": "%7E",
|
|
10993
|
+
"%20": "+",
|
|
10994
|
+
"%00": "\0"
|
|
10995
|
+
};
|
|
10996
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
10997
|
+
return charMap[match];
|
|
10998
|
+
});
|
|
10999
|
+
}
|
|
11000
|
+
function AxiosURLSearchParams(params, options) {
|
|
11001
|
+
this._pairs = [];
|
|
11002
|
+
params && toFormData$1(params, this, options);
|
|
11003
|
+
}
|
|
11004
|
+
const prototype = AxiosURLSearchParams.prototype;
|
|
11005
|
+
prototype.append = function append(name, value) {
|
|
11006
|
+
this._pairs.push([name, value]);
|
|
11007
|
+
};
|
|
11008
|
+
prototype.toString = function toString2(encoder) {
|
|
11009
|
+
const _encode = encoder ? function(value) {
|
|
11010
|
+
return encoder.call(this, value, encode$1);
|
|
11011
|
+
} : encode$1;
|
|
11012
|
+
return this._pairs.map(function each(pair) {
|
|
11013
|
+
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
11014
|
+
}, "").join("&");
|
|
11015
|
+
};
|
|
11016
|
+
function encode(val) {
|
|
11017
|
+
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
11018
|
+
}
|
|
11019
|
+
function buildURL(url, params, options) {
|
|
11020
|
+
if (!params) {
|
|
11021
|
+
return url;
|
|
11022
|
+
}
|
|
11023
|
+
const _encode = options && options.encode || encode;
|
|
11024
|
+
const _options = utils$1.isFunction(options) ? {
|
|
11025
|
+
serialize: options
|
|
11026
|
+
} : options;
|
|
11027
|
+
const serializeFn = _options && _options.serialize;
|
|
11028
|
+
let serializedParams;
|
|
11029
|
+
if (serializeFn) {
|
|
11030
|
+
serializedParams = serializeFn(params, _options);
|
|
11031
|
+
} else {
|
|
11032
|
+
serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
11033
|
+
}
|
|
11034
|
+
if (serializedParams) {
|
|
11035
|
+
const hashmarkIndex = url.indexOf("#");
|
|
11036
|
+
if (hashmarkIndex !== -1) {
|
|
11037
|
+
url = url.slice(0, hashmarkIndex);
|
|
11038
|
+
}
|
|
11039
|
+
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
11040
|
+
}
|
|
11041
|
+
return url;
|
|
11042
|
+
}
|
|
11043
|
+
class InterceptorManager {
|
|
11044
|
+
constructor() {
|
|
11045
|
+
this.handlers = [];
|
|
11046
|
+
}
|
|
11047
|
+
/**
|
|
11048
|
+
* Add a new interceptor to the stack
|
|
11049
|
+
*
|
|
11050
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
11051
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
11052
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
11053
|
+
*
|
|
11054
|
+
* @return {Number} An ID used to remove interceptor later
|
|
11055
|
+
*/
|
|
11056
|
+
use(fulfilled, rejected, options) {
|
|
11057
|
+
this.handlers.push({
|
|
11058
|
+
fulfilled,
|
|
11059
|
+
rejected,
|
|
11060
|
+
synchronous: options ? options.synchronous : false,
|
|
11061
|
+
runWhen: options ? options.runWhen : null
|
|
11062
|
+
});
|
|
11063
|
+
return this.handlers.length - 1;
|
|
11064
|
+
}
|
|
11065
|
+
/**
|
|
11066
|
+
* Remove an interceptor from the stack
|
|
11067
|
+
*
|
|
11068
|
+
* @param {Number} id The ID that was returned by `use`
|
|
11069
|
+
*
|
|
11070
|
+
* @returns {void}
|
|
11071
|
+
*/
|
|
11072
|
+
eject(id) {
|
|
11073
|
+
if (this.handlers[id]) {
|
|
11074
|
+
this.handlers[id] = null;
|
|
11075
|
+
}
|
|
11076
|
+
}
|
|
11077
|
+
/**
|
|
11078
|
+
* Clear all interceptors from the stack
|
|
11079
|
+
*
|
|
11080
|
+
* @returns {void}
|
|
11081
|
+
*/
|
|
11082
|
+
clear() {
|
|
11083
|
+
if (this.handlers) {
|
|
11084
|
+
this.handlers = [];
|
|
11085
|
+
}
|
|
11086
|
+
}
|
|
11087
|
+
/**
|
|
11088
|
+
* Iterate over all the registered interceptors
|
|
11089
|
+
*
|
|
11090
|
+
* This method is particularly useful for skipping over any
|
|
11091
|
+
* interceptors that may have become `null` calling `eject`.
|
|
11092
|
+
*
|
|
11093
|
+
* @param {Function} fn The function to call for each interceptor
|
|
11094
|
+
*
|
|
11095
|
+
* @returns {void}
|
|
11096
|
+
*/
|
|
11097
|
+
forEach(fn) {
|
|
11098
|
+
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
11099
|
+
if (h !== null) {
|
|
11100
|
+
fn(h);
|
|
11101
|
+
}
|
|
11102
|
+
});
|
|
11103
|
+
}
|
|
11104
|
+
}
|
|
11105
|
+
const transitionalDefaults = {
|
|
11106
|
+
silentJSONParsing: true,
|
|
11107
|
+
forcedJSONParsing: true,
|
|
11108
|
+
clarifyTimeoutError: false,
|
|
11109
|
+
legacyInterceptorReqResOrdering: true
|
|
11110
|
+
};
|
|
11111
|
+
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
11112
|
+
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
|
11113
|
+
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
|
|
11114
|
+
const platform$1 = {
|
|
11115
|
+
isBrowser: true,
|
|
11116
|
+
classes: {
|
|
11117
|
+
URLSearchParams: URLSearchParams$1,
|
|
11118
|
+
FormData: FormData$1,
|
|
11119
|
+
Blob: Blob$1
|
|
11120
|
+
},
|
|
11121
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
11122
|
+
};
|
|
11123
|
+
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
11124
|
+
const _navigator = typeof navigator === "object" && navigator || void 0;
|
|
11125
|
+
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
|
|
11126
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
11127
|
+
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
|
11128
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
11129
|
+
})();
|
|
11130
|
+
const origin = hasBrowserEnv && window.location.href || "http://localhost";
|
|
11131
|
+
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
11132
|
+
__proto__: null,
|
|
11133
|
+
hasBrowserEnv,
|
|
11134
|
+
hasStandardBrowserEnv,
|
|
11135
|
+
hasStandardBrowserWebWorkerEnv,
|
|
11136
|
+
navigator: _navigator,
|
|
11137
|
+
origin
|
|
11138
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
11139
|
+
const platform = {
|
|
11140
|
+
...utils,
|
|
11141
|
+
...platform$1
|
|
11142
|
+
};
|
|
11143
|
+
function toURLEncodedForm(data, options) {
|
|
11144
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
11145
|
+
visitor: function(value, key, path, helpers) {
|
|
11146
|
+
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
11147
|
+
this.append(key, value.toString("base64"));
|
|
11148
|
+
return false;
|
|
11149
|
+
}
|
|
11150
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
11151
|
+
},
|
|
11152
|
+
...options
|
|
11153
|
+
});
|
|
11154
|
+
}
|
|
11155
|
+
function parsePropPath(name) {
|
|
11156
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
11157
|
+
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
11158
|
+
});
|
|
11159
|
+
}
|
|
11160
|
+
function arrayToObject(arr) {
|
|
11161
|
+
const obj = {};
|
|
11162
|
+
const keys = Object.keys(arr);
|
|
11163
|
+
let i;
|
|
11164
|
+
const len = keys.length;
|
|
11165
|
+
let key;
|
|
11166
|
+
for (i = 0; i < len; i++) {
|
|
11167
|
+
key = keys[i];
|
|
11168
|
+
obj[key] = arr[key];
|
|
11169
|
+
}
|
|
11170
|
+
return obj;
|
|
11171
|
+
}
|
|
11172
|
+
function formDataToJSON(formData) {
|
|
11173
|
+
function buildPath(path, value, target2, index) {
|
|
11174
|
+
let name = path[index++];
|
|
11175
|
+
if (name === "__proto__") return true;
|
|
11176
|
+
const isNumericKey = Number.isFinite(+name);
|
|
11177
|
+
const isLast = index >= path.length;
|
|
11178
|
+
name = !name && utils$1.isArray(target2) ? target2.length : name;
|
|
11179
|
+
if (isLast) {
|
|
11180
|
+
if (utils$1.hasOwnProp(target2, name)) {
|
|
11181
|
+
target2[name] = [target2[name], value];
|
|
11182
|
+
} else {
|
|
11183
|
+
target2[name] = value;
|
|
11184
|
+
}
|
|
11185
|
+
return !isNumericKey;
|
|
11186
|
+
}
|
|
11187
|
+
if (!target2[name] || !utils$1.isObject(target2[name])) {
|
|
11188
|
+
target2[name] = [];
|
|
11189
|
+
}
|
|
11190
|
+
const result = buildPath(path, value, target2[name], index);
|
|
11191
|
+
if (result && utils$1.isArray(target2[name])) {
|
|
11192
|
+
target2[name] = arrayToObject(target2[name]);
|
|
11193
|
+
}
|
|
11194
|
+
return !isNumericKey;
|
|
11195
|
+
}
|
|
11196
|
+
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
11197
|
+
const obj = {};
|
|
11198
|
+
utils$1.forEachEntry(formData, (name, value) => {
|
|
11199
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
11200
|
+
});
|
|
11201
|
+
return obj;
|
|
11202
|
+
}
|
|
11203
|
+
return null;
|
|
11204
|
+
}
|
|
11205
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
11206
|
+
if (utils$1.isString(rawValue)) {
|
|
11207
|
+
try {
|
|
11208
|
+
(parser || JSON.parse)(rawValue);
|
|
11209
|
+
return utils$1.trim(rawValue);
|
|
11210
|
+
} catch (e) {
|
|
11211
|
+
if (e.name !== "SyntaxError") {
|
|
11212
|
+
throw e;
|
|
11213
|
+
}
|
|
11214
|
+
}
|
|
11215
|
+
}
|
|
11216
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
11217
|
+
}
|
|
11218
|
+
const defaults = {
|
|
11219
|
+
transitional: transitionalDefaults,
|
|
11220
|
+
adapter: ["xhr", "http", "fetch"],
|
|
11221
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
11222
|
+
const contentType = headers.getContentType() || "";
|
|
11223
|
+
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
11224
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
11225
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
11226
|
+
data = new FormData(data);
|
|
11227
|
+
}
|
|
11228
|
+
const isFormData2 = utils$1.isFormData(data);
|
|
11229
|
+
if (isFormData2) {
|
|
11230
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
11231
|
+
}
|
|
11232
|
+
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)) {
|
|
11233
|
+
return data;
|
|
11234
|
+
}
|
|
11235
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
11236
|
+
return data.buffer;
|
|
11237
|
+
}
|
|
11238
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
11239
|
+
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
11240
|
+
return data.toString();
|
|
11241
|
+
}
|
|
11242
|
+
let isFileList2;
|
|
11243
|
+
if (isObjectPayload) {
|
|
11244
|
+
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
11245
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
11246
|
+
}
|
|
11247
|
+
if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
11248
|
+
const _FormData = this.env && this.env.FormData;
|
|
11249
|
+
return toFormData$1(
|
|
11250
|
+
isFileList2 ? { "files[]": data } : data,
|
|
11251
|
+
_FormData && new _FormData(),
|
|
11252
|
+
this.formSerializer
|
|
11253
|
+
);
|
|
11254
|
+
}
|
|
11255
|
+
}
|
|
11256
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
11257
|
+
headers.setContentType("application/json", false);
|
|
11258
|
+
return stringifySafely(data);
|
|
11259
|
+
}
|
|
11260
|
+
return data;
|
|
11261
|
+
}],
|
|
11262
|
+
transformResponse: [function transformResponse(data) {
|
|
11263
|
+
const transitional2 = this.transitional || defaults.transitional;
|
|
11264
|
+
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
11265
|
+
const JSONRequested = this.responseType === "json";
|
|
11266
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
11267
|
+
return data;
|
|
11268
|
+
}
|
|
11269
|
+
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
11270
|
+
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
11271
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
11272
|
+
try {
|
|
11273
|
+
return JSON.parse(data, this.parseReviver);
|
|
11274
|
+
} catch (e) {
|
|
11275
|
+
if (strictJSONParsing) {
|
|
11276
|
+
if (e.name === "SyntaxError") {
|
|
11277
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
11278
|
+
}
|
|
11279
|
+
throw e;
|
|
11280
|
+
}
|
|
11281
|
+
}
|
|
11282
|
+
}
|
|
11283
|
+
return data;
|
|
11284
|
+
}],
|
|
11285
|
+
/**
|
|
11286
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
11287
|
+
* timeout is not created.
|
|
11288
|
+
*/
|
|
11289
|
+
timeout: 0,
|
|
11290
|
+
xsrfCookieName: "XSRF-TOKEN",
|
|
11291
|
+
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
11292
|
+
maxContentLength: -1,
|
|
11293
|
+
maxBodyLength: -1,
|
|
11294
|
+
env: {
|
|
11295
|
+
FormData: platform.classes.FormData,
|
|
11296
|
+
Blob: platform.classes.Blob
|
|
11297
|
+
},
|
|
11298
|
+
validateStatus: function validateStatus(status) {
|
|
11299
|
+
return status >= 200 && status < 300;
|
|
11300
|
+
},
|
|
11301
|
+
headers: {
|
|
11302
|
+
common: {
|
|
11303
|
+
"Accept": "application/json, text/plain, */*",
|
|
11304
|
+
"Content-Type": void 0
|
|
11305
|
+
}
|
|
11306
|
+
}
|
|
11307
|
+
};
|
|
11308
|
+
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
11309
|
+
defaults.headers[method] = {};
|
|
11310
|
+
});
|
|
11311
|
+
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
11312
|
+
"age",
|
|
11313
|
+
"authorization",
|
|
11314
|
+
"content-length",
|
|
11315
|
+
"content-type",
|
|
11316
|
+
"etag",
|
|
11317
|
+
"expires",
|
|
11318
|
+
"from",
|
|
11319
|
+
"host",
|
|
11320
|
+
"if-modified-since",
|
|
11321
|
+
"if-unmodified-since",
|
|
11322
|
+
"last-modified",
|
|
11323
|
+
"location",
|
|
11324
|
+
"max-forwards",
|
|
11325
|
+
"proxy-authorization",
|
|
11326
|
+
"referer",
|
|
11327
|
+
"retry-after",
|
|
11328
|
+
"user-agent"
|
|
11329
|
+
]);
|
|
11330
|
+
const parseHeaders = (rawHeaders) => {
|
|
11331
|
+
const parsed = {};
|
|
11332
|
+
let key;
|
|
11333
|
+
let val;
|
|
11334
|
+
let i;
|
|
11335
|
+
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
11336
|
+
i = line.indexOf(":");
|
|
11337
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
11338
|
+
val = line.substring(i + 1).trim();
|
|
11339
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
11340
|
+
return;
|
|
11341
|
+
}
|
|
11342
|
+
if (key === "set-cookie") {
|
|
11343
|
+
if (parsed[key]) {
|
|
11344
|
+
parsed[key].push(val);
|
|
11345
|
+
} else {
|
|
11346
|
+
parsed[key] = [val];
|
|
11347
|
+
}
|
|
11348
|
+
} else {
|
|
11349
|
+
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
11350
|
+
}
|
|
11351
|
+
});
|
|
11352
|
+
return parsed;
|
|
11353
|
+
};
|
|
11354
|
+
const $internals = /* @__PURE__ */ Symbol("internals");
|
|
11355
|
+
function normalizeHeader(header) {
|
|
11356
|
+
return header && String(header).trim().toLowerCase();
|
|
11357
|
+
}
|
|
11358
|
+
function normalizeValue(value) {
|
|
11359
|
+
if (value === false || value == null) {
|
|
11360
|
+
return value;
|
|
11361
|
+
}
|
|
11362
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
11363
|
+
}
|
|
11364
|
+
function parseTokens(str) {
|
|
11365
|
+
const tokens = /* @__PURE__ */ Object.create(null);
|
|
11366
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
11367
|
+
let match;
|
|
11368
|
+
while (match = tokensRE.exec(str)) {
|
|
11369
|
+
tokens[match[1]] = match[2];
|
|
11370
|
+
}
|
|
11371
|
+
return tokens;
|
|
11372
|
+
}
|
|
11373
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
11374
|
+
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
11375
|
+
if (utils$1.isFunction(filter2)) {
|
|
11376
|
+
return filter2.call(this, value, header);
|
|
11377
|
+
}
|
|
11378
|
+
if (isHeaderNameFilter) {
|
|
11379
|
+
value = header;
|
|
11380
|
+
}
|
|
11381
|
+
if (!utils$1.isString(value)) return;
|
|
11382
|
+
if (utils$1.isString(filter2)) {
|
|
11383
|
+
return value.indexOf(filter2) !== -1;
|
|
11384
|
+
}
|
|
11385
|
+
if (utils$1.isRegExp(filter2)) {
|
|
11386
|
+
return filter2.test(value);
|
|
11387
|
+
}
|
|
11388
|
+
}
|
|
11389
|
+
function formatHeader(header) {
|
|
11390
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
11391
|
+
return char.toUpperCase() + str;
|
|
11392
|
+
});
|
|
11393
|
+
}
|
|
11394
|
+
function buildAccessors(obj, header) {
|
|
11395
|
+
const accessorName = utils$1.toCamelCase(" " + header);
|
|
11396
|
+
["get", "set", "has"].forEach((methodName) => {
|
|
11397
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
11398
|
+
value: function(arg1, arg2, arg3) {
|
|
11399
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
11400
|
+
},
|
|
11401
|
+
configurable: true
|
|
11402
|
+
});
|
|
11403
|
+
});
|
|
11404
|
+
}
|
|
11405
|
+
let AxiosHeaders$1 = class AxiosHeaders {
|
|
11406
|
+
constructor(headers) {
|
|
11407
|
+
headers && this.set(headers);
|
|
11408
|
+
}
|
|
11409
|
+
set(header, valueOrRewrite, rewrite) {
|
|
11410
|
+
const self2 = this;
|
|
11411
|
+
function setHeader(_value, _header, _rewrite) {
|
|
11412
|
+
const lHeader = normalizeHeader(_header);
|
|
11413
|
+
if (!lHeader) {
|
|
11414
|
+
throw new Error("header name must be a non-empty string");
|
|
11415
|
+
}
|
|
11416
|
+
const key = utils$1.findKey(self2, lHeader);
|
|
11417
|
+
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
11418
|
+
self2[key || _header] = normalizeValue(_value);
|
|
11419
|
+
}
|
|
11420
|
+
}
|
|
11421
|
+
const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
11422
|
+
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
11423
|
+
setHeaders(header, valueOrRewrite);
|
|
11424
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
11425
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
11426
|
+
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
11427
|
+
let obj = {}, dest, key;
|
|
11428
|
+
for (const entry of header) {
|
|
11429
|
+
if (!utils$1.isArray(entry)) {
|
|
11430
|
+
throw TypeError("Object iterator must return a key-value pair");
|
|
11431
|
+
}
|
|
11432
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
|
|
11433
|
+
}
|
|
11434
|
+
setHeaders(obj, valueOrRewrite);
|
|
11435
|
+
} else {
|
|
11436
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
11437
|
+
}
|
|
11438
|
+
return this;
|
|
11439
|
+
}
|
|
11440
|
+
get(header, parser) {
|
|
11441
|
+
header = normalizeHeader(header);
|
|
11442
|
+
if (header) {
|
|
11443
|
+
const key = utils$1.findKey(this, header);
|
|
11444
|
+
if (key) {
|
|
11445
|
+
const value = this[key];
|
|
11446
|
+
if (!parser) {
|
|
11447
|
+
return value;
|
|
11448
|
+
}
|
|
11449
|
+
if (parser === true) {
|
|
11450
|
+
return parseTokens(value);
|
|
11451
|
+
}
|
|
11452
|
+
if (utils$1.isFunction(parser)) {
|
|
11453
|
+
return parser.call(this, value, key);
|
|
11454
|
+
}
|
|
11455
|
+
if (utils$1.isRegExp(parser)) {
|
|
11456
|
+
return parser.exec(value);
|
|
11457
|
+
}
|
|
11458
|
+
throw new TypeError("parser must be boolean|regexp|function");
|
|
11459
|
+
}
|
|
11460
|
+
}
|
|
11461
|
+
}
|
|
11462
|
+
has(header, matcher) {
|
|
11463
|
+
header = normalizeHeader(header);
|
|
11464
|
+
if (header) {
|
|
11465
|
+
const key = utils$1.findKey(this, header);
|
|
11466
|
+
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
11467
|
+
}
|
|
11468
|
+
return false;
|
|
11469
|
+
}
|
|
11470
|
+
delete(header, matcher) {
|
|
11471
|
+
const self2 = this;
|
|
11472
|
+
let deleted = false;
|
|
11473
|
+
function deleteHeader(_header) {
|
|
11474
|
+
_header = normalizeHeader(_header);
|
|
11475
|
+
if (_header) {
|
|
11476
|
+
const key = utils$1.findKey(self2, _header);
|
|
11477
|
+
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
11478
|
+
delete self2[key];
|
|
11479
|
+
deleted = true;
|
|
11480
|
+
}
|
|
11481
|
+
}
|
|
11482
|
+
}
|
|
11483
|
+
if (utils$1.isArray(header)) {
|
|
11484
|
+
header.forEach(deleteHeader);
|
|
11485
|
+
} else {
|
|
11486
|
+
deleteHeader(header);
|
|
11487
|
+
}
|
|
11488
|
+
return deleted;
|
|
11489
|
+
}
|
|
11490
|
+
clear(matcher) {
|
|
11491
|
+
const keys = Object.keys(this);
|
|
11492
|
+
let i = keys.length;
|
|
11493
|
+
let deleted = false;
|
|
11494
|
+
while (i--) {
|
|
11495
|
+
const key = keys[i];
|
|
11496
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
11497
|
+
delete this[key];
|
|
11498
|
+
deleted = true;
|
|
11499
|
+
}
|
|
11500
|
+
}
|
|
11501
|
+
return deleted;
|
|
11502
|
+
}
|
|
11503
|
+
normalize(format) {
|
|
11504
|
+
const self2 = this;
|
|
11505
|
+
const headers = {};
|
|
11506
|
+
utils$1.forEach(this, (value, header) => {
|
|
11507
|
+
const key = utils$1.findKey(headers, header);
|
|
11508
|
+
if (key) {
|
|
11509
|
+
self2[key] = normalizeValue(value);
|
|
11510
|
+
delete self2[header];
|
|
11511
|
+
return;
|
|
11512
|
+
}
|
|
11513
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
11514
|
+
if (normalized !== header) {
|
|
11515
|
+
delete self2[header];
|
|
11516
|
+
}
|
|
11517
|
+
self2[normalized] = normalizeValue(value);
|
|
11518
|
+
headers[normalized] = true;
|
|
11519
|
+
});
|
|
11520
|
+
return this;
|
|
11521
|
+
}
|
|
11522
|
+
concat(...targets) {
|
|
11523
|
+
return this.constructor.concat(this, ...targets);
|
|
11524
|
+
}
|
|
11525
|
+
toJSON(asStrings) {
|
|
11526
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
11527
|
+
utils$1.forEach(this, (value, header) => {
|
|
11528
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
|
|
11529
|
+
});
|
|
11530
|
+
return obj;
|
|
11531
|
+
}
|
|
11532
|
+
[Symbol.iterator]() {
|
|
11533
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
11534
|
+
}
|
|
11535
|
+
toString() {
|
|
11536
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
11537
|
+
}
|
|
11538
|
+
getSetCookie() {
|
|
11539
|
+
return this.get("set-cookie") || [];
|
|
11540
|
+
}
|
|
11541
|
+
get [Symbol.toStringTag]() {
|
|
11542
|
+
return "AxiosHeaders";
|
|
11543
|
+
}
|
|
11544
|
+
static from(thing) {
|
|
11545
|
+
return thing instanceof this ? thing : new this(thing);
|
|
11546
|
+
}
|
|
11547
|
+
static concat(first, ...targets) {
|
|
11548
|
+
const computed = new this(first);
|
|
11549
|
+
targets.forEach((target2) => computed.set(target2));
|
|
11550
|
+
return computed;
|
|
11551
|
+
}
|
|
11552
|
+
static accessor(header) {
|
|
11553
|
+
const internals = this[$internals] = this[$internals] = {
|
|
11554
|
+
accessors: {}
|
|
11555
|
+
};
|
|
11556
|
+
const accessors = internals.accessors;
|
|
11557
|
+
const prototype2 = this.prototype;
|
|
11558
|
+
function defineAccessor(_header) {
|
|
11559
|
+
const lHeader = normalizeHeader(_header);
|
|
11560
|
+
if (!accessors[lHeader]) {
|
|
11561
|
+
buildAccessors(prototype2, _header);
|
|
11562
|
+
accessors[lHeader] = true;
|
|
11563
|
+
}
|
|
11564
|
+
}
|
|
11565
|
+
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
11566
|
+
return this;
|
|
11567
|
+
}
|
|
11568
|
+
};
|
|
11569
|
+
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
11570
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
11571
|
+
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
11572
|
+
return {
|
|
11573
|
+
get: () => value,
|
|
11574
|
+
set(headerValue) {
|
|
11575
|
+
this[mapped] = headerValue;
|
|
11576
|
+
}
|
|
11577
|
+
};
|
|
11578
|
+
});
|
|
11579
|
+
utils$1.freezeMethods(AxiosHeaders$1);
|
|
11580
|
+
function transformData(fns, response) {
|
|
11581
|
+
const config = this || defaults;
|
|
11582
|
+
const context = response || config;
|
|
11583
|
+
const headers = AxiosHeaders$1.from(context.headers);
|
|
11584
|
+
let data = context.data;
|
|
11585
|
+
utils$1.forEach(fns, function transform(fn) {
|
|
11586
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
|
11587
|
+
});
|
|
11588
|
+
headers.normalize();
|
|
11589
|
+
return data;
|
|
11590
|
+
}
|
|
11591
|
+
function isCancel$1(value) {
|
|
11592
|
+
return !!(value && value.__CANCEL__);
|
|
11593
|
+
}
|
|
11594
|
+
let CanceledError$1 = class CanceledError extends AxiosError$1 {
|
|
11595
|
+
/**
|
|
11596
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
11597
|
+
*
|
|
11598
|
+
* @param {string=} message The message.
|
|
11599
|
+
* @param {Object=} config The config.
|
|
11600
|
+
* @param {Object=} request The request.
|
|
11601
|
+
*
|
|
11602
|
+
* @returns {CanceledError} The created error.
|
|
11603
|
+
*/
|
|
11604
|
+
constructor(message, config, request) {
|
|
11605
|
+
super(message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
11606
|
+
this.name = "CanceledError";
|
|
11607
|
+
this.__CANCEL__ = true;
|
|
11608
|
+
}
|
|
11609
|
+
};
|
|
11610
|
+
function settle(resolve, reject, response) {
|
|
11611
|
+
const validateStatus2 = response.config.validateStatus;
|
|
11612
|
+
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
11613
|
+
resolve(response);
|
|
11614
|
+
} else {
|
|
11615
|
+
reject(new AxiosError$1(
|
|
11616
|
+
"Request failed with status code " + response.status,
|
|
11617
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
11618
|
+
response.config,
|
|
11619
|
+
response.request,
|
|
11620
|
+
response
|
|
11621
|
+
));
|
|
11622
|
+
}
|
|
11623
|
+
}
|
|
11624
|
+
function parseProtocol(url) {
|
|
11625
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
11626
|
+
return match && match[1] || "";
|
|
11627
|
+
}
|
|
11628
|
+
function speedometer(samplesCount, min) {
|
|
11629
|
+
samplesCount = samplesCount || 10;
|
|
11630
|
+
const bytes = new Array(samplesCount);
|
|
11631
|
+
const timestamps = new Array(samplesCount);
|
|
11632
|
+
let head = 0;
|
|
11633
|
+
let tail = 0;
|
|
11634
|
+
let firstSampleTS;
|
|
11635
|
+
min = min !== void 0 ? min : 1e3;
|
|
11636
|
+
return function push(chunkLength) {
|
|
11637
|
+
const now = Date.now();
|
|
11638
|
+
const startedAt = timestamps[tail];
|
|
11639
|
+
if (!firstSampleTS) {
|
|
11640
|
+
firstSampleTS = now;
|
|
11641
|
+
}
|
|
11642
|
+
bytes[head] = chunkLength;
|
|
11643
|
+
timestamps[head] = now;
|
|
11644
|
+
let i = tail;
|
|
11645
|
+
let bytesCount = 0;
|
|
11646
|
+
while (i !== head) {
|
|
11647
|
+
bytesCount += bytes[i++];
|
|
11648
|
+
i = i % samplesCount;
|
|
11649
|
+
}
|
|
11650
|
+
head = (head + 1) % samplesCount;
|
|
11651
|
+
if (head === tail) {
|
|
11652
|
+
tail = (tail + 1) % samplesCount;
|
|
11653
|
+
}
|
|
11654
|
+
if (now - firstSampleTS < min) {
|
|
11655
|
+
return;
|
|
11656
|
+
}
|
|
11657
|
+
const passed = startedAt && now - startedAt;
|
|
11658
|
+
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
11659
|
+
};
|
|
11660
|
+
}
|
|
11661
|
+
function throttle(fn, freq) {
|
|
11662
|
+
let timestamp = 0;
|
|
11663
|
+
let threshold = 1e3 / freq;
|
|
11664
|
+
let lastArgs;
|
|
11665
|
+
let timer;
|
|
11666
|
+
const invoke = (args, now = Date.now()) => {
|
|
11667
|
+
timestamp = now;
|
|
11668
|
+
lastArgs = null;
|
|
11669
|
+
if (timer) {
|
|
11670
|
+
clearTimeout(timer);
|
|
11671
|
+
timer = null;
|
|
11672
|
+
}
|
|
11673
|
+
fn(...args);
|
|
11674
|
+
};
|
|
11675
|
+
const throttled = (...args) => {
|
|
11676
|
+
const now = Date.now();
|
|
11677
|
+
const passed = now - timestamp;
|
|
11678
|
+
if (passed >= threshold) {
|
|
11679
|
+
invoke(args, now);
|
|
11680
|
+
} else {
|
|
11681
|
+
lastArgs = args;
|
|
11682
|
+
if (!timer) {
|
|
11683
|
+
timer = setTimeout(() => {
|
|
11684
|
+
timer = null;
|
|
11685
|
+
invoke(lastArgs);
|
|
11686
|
+
}, threshold - passed);
|
|
11687
|
+
}
|
|
11688
|
+
}
|
|
11689
|
+
};
|
|
11690
|
+
const flush = () => lastArgs && invoke(lastArgs);
|
|
11691
|
+
return [throttled, flush];
|
|
11692
|
+
}
|
|
11693
|
+
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
11694
|
+
let bytesNotified = 0;
|
|
11695
|
+
const _speedometer = speedometer(50, 250);
|
|
11696
|
+
return throttle((e) => {
|
|
11697
|
+
const loaded = e.loaded;
|
|
11698
|
+
const total = e.lengthComputable ? e.total : void 0;
|
|
11699
|
+
const progressBytes = loaded - bytesNotified;
|
|
11700
|
+
const rate = _speedometer(progressBytes);
|
|
11701
|
+
const inRange = loaded <= total;
|
|
11702
|
+
bytesNotified = loaded;
|
|
11703
|
+
const data = {
|
|
11704
|
+
loaded,
|
|
11705
|
+
total,
|
|
11706
|
+
progress: total ? loaded / total : void 0,
|
|
11707
|
+
bytes: progressBytes,
|
|
11708
|
+
rate: rate ? rate : void 0,
|
|
11709
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
|
11710
|
+
event: e,
|
|
11711
|
+
lengthComputable: total != null,
|
|
11712
|
+
[isDownloadStream ? "download" : "upload"]: true
|
|
11713
|
+
};
|
|
11714
|
+
listener(data);
|
|
11715
|
+
}, freq);
|
|
11716
|
+
};
|
|
11717
|
+
const progressEventDecorator = (total, throttled) => {
|
|
11718
|
+
const lengthComputable = total != null;
|
|
11719
|
+
return [(loaded) => throttled[0]({
|
|
11720
|
+
lengthComputable,
|
|
11721
|
+
total,
|
|
11722
|
+
loaded
|
|
11723
|
+
}), throttled[1]];
|
|
11724
|
+
};
|
|
11725
|
+
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
11726
|
+
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
|
|
11727
|
+
url = new URL(url, platform.origin);
|
|
11728
|
+
return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
|
|
11729
|
+
})(
|
|
11730
|
+
new URL(platform.origin),
|
|
11731
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
11732
|
+
) : () => true;
|
|
11733
|
+
const cookies = platform.hasStandardBrowserEnv ? (
|
|
11734
|
+
// Standard browser envs support document.cookie
|
|
11735
|
+
{
|
|
11736
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
11737
|
+
if (typeof document === "undefined") return;
|
|
11738
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
11739
|
+
if (utils$1.isNumber(expires)) {
|
|
11740
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
11741
|
+
}
|
|
11742
|
+
if (utils$1.isString(path)) {
|
|
11743
|
+
cookie.push(`path=${path}`);
|
|
11744
|
+
}
|
|
11745
|
+
if (utils$1.isString(domain)) {
|
|
11746
|
+
cookie.push(`domain=${domain}`);
|
|
11747
|
+
}
|
|
11748
|
+
if (secure === true) {
|
|
11749
|
+
cookie.push("secure");
|
|
11750
|
+
}
|
|
11751
|
+
if (utils$1.isString(sameSite)) {
|
|
11752
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
11753
|
+
}
|
|
11754
|
+
document.cookie = cookie.join("; ");
|
|
11755
|
+
},
|
|
11756
|
+
read(name) {
|
|
11757
|
+
if (typeof document === "undefined") return null;
|
|
11758
|
+
const match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
|
|
11759
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
11760
|
+
},
|
|
11761
|
+
remove(name) {
|
|
11762
|
+
this.write(name, "", Date.now() - 864e5, "/");
|
|
11763
|
+
}
|
|
11764
|
+
}
|
|
11765
|
+
) : (
|
|
11766
|
+
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
11767
|
+
{
|
|
11768
|
+
write() {
|
|
11769
|
+
},
|
|
11770
|
+
read() {
|
|
11771
|
+
return null;
|
|
11772
|
+
},
|
|
11773
|
+
remove() {
|
|
11774
|
+
}
|
|
11775
|
+
}
|
|
11776
|
+
);
|
|
11777
|
+
function isAbsoluteURL(url) {
|
|
11778
|
+
if (typeof url !== "string") {
|
|
11779
|
+
return false;
|
|
11780
|
+
}
|
|
11781
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
11782
|
+
}
|
|
11783
|
+
function combineURLs(baseURL, relativeURL) {
|
|
11784
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
11785
|
+
}
|
|
11786
|
+
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
11787
|
+
let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
11788
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
|
|
11789
|
+
return combineURLs(baseURL, requestedURL);
|
|
11790
|
+
}
|
|
11791
|
+
return requestedURL;
|
|
11792
|
+
}
|
|
11793
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
11794
|
+
function mergeConfig$1(config1, config2) {
|
|
11795
|
+
config2 = config2 || {};
|
|
11796
|
+
const config = {};
|
|
11797
|
+
function getMergedValue(target2, source2, prop2, caseless) {
|
|
11798
|
+
if (utils$1.isPlainObject(target2) && utils$1.isPlainObject(source2)) {
|
|
11799
|
+
return utils$1.merge.call({ caseless }, target2, source2);
|
|
11800
|
+
} else if (utils$1.isPlainObject(source2)) {
|
|
11801
|
+
return utils$1.merge({}, source2);
|
|
11802
|
+
} else if (utils$1.isArray(source2)) {
|
|
11803
|
+
return source2.slice();
|
|
11804
|
+
}
|
|
11805
|
+
return source2;
|
|
11806
|
+
}
|
|
11807
|
+
function mergeDeepProperties(a, b, prop2, caseless) {
|
|
11808
|
+
if (!utils$1.isUndefined(b)) {
|
|
11809
|
+
return getMergedValue(a, b, prop2, caseless);
|
|
11810
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
11811
|
+
return getMergedValue(void 0, a, prop2, caseless);
|
|
11812
|
+
}
|
|
11813
|
+
}
|
|
11814
|
+
function valueFromConfig2(a, b) {
|
|
11815
|
+
if (!utils$1.isUndefined(b)) {
|
|
11816
|
+
return getMergedValue(void 0, b);
|
|
11817
|
+
}
|
|
11818
|
+
}
|
|
11819
|
+
function defaultToConfig2(a, b) {
|
|
11820
|
+
if (!utils$1.isUndefined(b)) {
|
|
11821
|
+
return getMergedValue(void 0, b);
|
|
11822
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
11823
|
+
return getMergedValue(void 0, a);
|
|
11824
|
+
}
|
|
11825
|
+
}
|
|
11826
|
+
function mergeDirectKeys(a, b, prop2) {
|
|
11827
|
+
if (prop2 in config2) {
|
|
11828
|
+
return getMergedValue(a, b);
|
|
11829
|
+
} else if (prop2 in config1) {
|
|
11830
|
+
return getMergedValue(void 0, a);
|
|
11831
|
+
}
|
|
11832
|
+
}
|
|
11833
|
+
const mergeMap = {
|
|
11834
|
+
url: valueFromConfig2,
|
|
11835
|
+
method: valueFromConfig2,
|
|
11836
|
+
data: valueFromConfig2,
|
|
11837
|
+
baseURL: defaultToConfig2,
|
|
11838
|
+
transformRequest: defaultToConfig2,
|
|
11839
|
+
transformResponse: defaultToConfig2,
|
|
11840
|
+
paramsSerializer: defaultToConfig2,
|
|
11841
|
+
timeout: defaultToConfig2,
|
|
11842
|
+
timeoutMessage: defaultToConfig2,
|
|
11843
|
+
withCredentials: defaultToConfig2,
|
|
11844
|
+
withXSRFToken: defaultToConfig2,
|
|
11845
|
+
adapter: defaultToConfig2,
|
|
11846
|
+
responseType: defaultToConfig2,
|
|
11847
|
+
xsrfCookieName: defaultToConfig2,
|
|
11848
|
+
xsrfHeaderName: defaultToConfig2,
|
|
11849
|
+
onUploadProgress: defaultToConfig2,
|
|
11850
|
+
onDownloadProgress: defaultToConfig2,
|
|
11851
|
+
decompress: defaultToConfig2,
|
|
11852
|
+
maxContentLength: defaultToConfig2,
|
|
11853
|
+
maxBodyLength: defaultToConfig2,
|
|
11854
|
+
beforeRedirect: defaultToConfig2,
|
|
11855
|
+
transport: defaultToConfig2,
|
|
11856
|
+
httpAgent: defaultToConfig2,
|
|
11857
|
+
httpsAgent: defaultToConfig2,
|
|
11858
|
+
cancelToken: defaultToConfig2,
|
|
11859
|
+
socketPath: defaultToConfig2,
|
|
11860
|
+
responseEncoding: defaultToConfig2,
|
|
11861
|
+
validateStatus: mergeDirectKeys,
|
|
11862
|
+
headers: (a, b, prop2) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop2, true)
|
|
11863
|
+
};
|
|
11864
|
+
utils$1.forEach(
|
|
11865
|
+
Object.keys({ ...config1, ...config2 }),
|
|
11866
|
+
function computeConfigValue(prop2) {
|
|
11867
|
+
if (prop2 === "__proto__" || prop2 === "constructor" || prop2 === "prototype")
|
|
11868
|
+
return;
|
|
11869
|
+
const merge2 = utils$1.hasOwnProp(mergeMap, prop2) ? mergeMap[prop2] : mergeDeepProperties;
|
|
11870
|
+
const configValue = merge2(config1[prop2], config2[prop2], prop2);
|
|
11871
|
+
utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop2] = configValue);
|
|
11872
|
+
}
|
|
11873
|
+
);
|
|
11874
|
+
return config;
|
|
11875
|
+
}
|
|
11876
|
+
const resolveConfig = (config) => {
|
|
11877
|
+
const newConfig = mergeConfig$1({}, config);
|
|
11878
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
11879
|
+
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
11880
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
11881
|
+
if (auth) {
|
|
11882
|
+
headers.set(
|
|
11883
|
+
"Authorization",
|
|
11884
|
+
"Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
|
|
11885
|
+
);
|
|
11886
|
+
}
|
|
11887
|
+
if (utils$1.isFormData(data)) {
|
|
11888
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
11889
|
+
headers.setContentType(void 0);
|
|
11890
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
11891
|
+
const formHeaders = data.getHeaders();
|
|
11892
|
+
const allowedHeaders = ["content-type", "content-length"];
|
|
11893
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
11894
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
11895
|
+
headers.set(key, val);
|
|
11896
|
+
}
|
|
11897
|
+
});
|
|
11898
|
+
}
|
|
11899
|
+
}
|
|
11900
|
+
if (platform.hasStandardBrowserEnv) {
|
|
11901
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
11902
|
+
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
11903
|
+
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
11904
|
+
if (xsrfValue) {
|
|
11905
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
11906
|
+
}
|
|
11907
|
+
}
|
|
11908
|
+
}
|
|
11909
|
+
return newConfig;
|
|
11910
|
+
};
|
|
11911
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
11912
|
+
const xhrAdapter = isXHRAdapterSupported && function(config) {
|
|
11913
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
11914
|
+
const _config = resolveConfig(config);
|
|
11915
|
+
let requestData = _config.data;
|
|
11916
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
11917
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
11918
|
+
let onCanceled;
|
|
11919
|
+
let uploadThrottled, downloadThrottled;
|
|
11920
|
+
let flushUpload, flushDownload;
|
|
11921
|
+
function done() {
|
|
11922
|
+
flushUpload && flushUpload();
|
|
11923
|
+
flushDownload && flushDownload();
|
|
11924
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
11925
|
+
_config.signal && _config.signal.removeEventListener("abort", onCanceled);
|
|
11926
|
+
}
|
|
11927
|
+
let request = new XMLHttpRequest();
|
|
11928
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
11929
|
+
request.timeout = _config.timeout;
|
|
11930
|
+
function onloadend() {
|
|
11931
|
+
if (!request) {
|
|
11932
|
+
return;
|
|
11933
|
+
}
|
|
11934
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
11935
|
+
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
11936
|
+
);
|
|
11937
|
+
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
11938
|
+
const response = {
|
|
11939
|
+
data: responseData,
|
|
11940
|
+
status: request.status,
|
|
11941
|
+
statusText: request.statusText,
|
|
11942
|
+
headers: responseHeaders,
|
|
11943
|
+
config,
|
|
11944
|
+
request
|
|
11945
|
+
};
|
|
11946
|
+
settle(function _resolve(value) {
|
|
11947
|
+
resolve(value);
|
|
11948
|
+
done();
|
|
11949
|
+
}, function _reject(err) {
|
|
11950
|
+
reject(err);
|
|
11951
|
+
done();
|
|
11952
|
+
}, response);
|
|
11953
|
+
request = null;
|
|
11954
|
+
}
|
|
11955
|
+
if ("onloadend" in request) {
|
|
11956
|
+
request.onloadend = onloadend;
|
|
11957
|
+
} else {
|
|
11958
|
+
request.onreadystatechange = function handleLoad() {
|
|
11959
|
+
if (!request || request.readyState !== 4) {
|
|
11960
|
+
return;
|
|
11961
|
+
}
|
|
11962
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
11963
|
+
return;
|
|
11964
|
+
}
|
|
11965
|
+
setTimeout(onloadend);
|
|
11966
|
+
};
|
|
11967
|
+
}
|
|
11968
|
+
request.onabort = function handleAbort() {
|
|
11969
|
+
if (!request) {
|
|
11970
|
+
return;
|
|
11971
|
+
}
|
|
11972
|
+
reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
|
|
11973
|
+
request = null;
|
|
11974
|
+
};
|
|
11975
|
+
request.onerror = function handleError(event) {
|
|
11976
|
+
const msg = event && event.message ? event.message : "Network Error";
|
|
11977
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
11978
|
+
err.event = event || null;
|
|
11979
|
+
reject(err);
|
|
11980
|
+
request = null;
|
|
11981
|
+
};
|
|
11982
|
+
request.ontimeout = function handleTimeout() {
|
|
11983
|
+
let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
|
|
11984
|
+
const transitional2 = _config.transitional || transitionalDefaults;
|
|
11985
|
+
if (_config.timeoutErrorMessage) {
|
|
11986
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
11987
|
+
}
|
|
11988
|
+
reject(new AxiosError$1(
|
|
11989
|
+
timeoutErrorMessage,
|
|
11990
|
+
transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
11991
|
+
config,
|
|
11992
|
+
request
|
|
11993
|
+
));
|
|
11994
|
+
request = null;
|
|
11995
|
+
};
|
|
11996
|
+
requestData === void 0 && requestHeaders.setContentType(null);
|
|
11997
|
+
if ("setRequestHeader" in request) {
|
|
11998
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
11999
|
+
request.setRequestHeader(key, val);
|
|
12000
|
+
});
|
|
12001
|
+
}
|
|
12002
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
12003
|
+
request.withCredentials = !!_config.withCredentials;
|
|
12004
|
+
}
|
|
12005
|
+
if (responseType && responseType !== "json") {
|
|
12006
|
+
request.responseType = _config.responseType;
|
|
12007
|
+
}
|
|
12008
|
+
if (onDownloadProgress) {
|
|
12009
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
12010
|
+
request.addEventListener("progress", downloadThrottled);
|
|
12011
|
+
}
|
|
12012
|
+
if (onUploadProgress && request.upload) {
|
|
12013
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
12014
|
+
request.upload.addEventListener("progress", uploadThrottled);
|
|
12015
|
+
request.upload.addEventListener("loadend", flushUpload);
|
|
12016
|
+
}
|
|
12017
|
+
if (_config.cancelToken || _config.signal) {
|
|
12018
|
+
onCanceled = (cancel) => {
|
|
12019
|
+
if (!request) {
|
|
12020
|
+
return;
|
|
12021
|
+
}
|
|
12022
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
12023
|
+
request.abort();
|
|
12024
|
+
request = null;
|
|
12025
|
+
};
|
|
12026
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
12027
|
+
if (_config.signal) {
|
|
12028
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
|
|
12029
|
+
}
|
|
12030
|
+
}
|
|
12031
|
+
const protocol = parseProtocol(_config.url);
|
|
12032
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
12033
|
+
reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
|
|
12034
|
+
return;
|
|
12035
|
+
}
|
|
12036
|
+
request.send(requestData || null);
|
|
12037
|
+
});
|
|
12038
|
+
};
|
|
12039
|
+
const composeSignals = (signals, timeout) => {
|
|
12040
|
+
const { length } = signals = signals ? signals.filter(Boolean) : [];
|
|
12041
|
+
if (timeout || length) {
|
|
12042
|
+
let controller = new AbortController();
|
|
12043
|
+
let aborted;
|
|
12044
|
+
const onabort = function(reason) {
|
|
12045
|
+
if (!aborted) {
|
|
12046
|
+
aborted = true;
|
|
12047
|
+
unsubscribe();
|
|
12048
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
12049
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
12050
|
+
}
|
|
12051
|
+
};
|
|
12052
|
+
let timer = timeout && setTimeout(() => {
|
|
12053
|
+
timer = null;
|
|
12054
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
12055
|
+
}, timeout);
|
|
12056
|
+
const unsubscribe = () => {
|
|
12057
|
+
if (signals) {
|
|
12058
|
+
timer && clearTimeout(timer);
|
|
12059
|
+
timer = null;
|
|
12060
|
+
signals.forEach((signal2) => {
|
|
12061
|
+
signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
|
|
12062
|
+
});
|
|
12063
|
+
signals = null;
|
|
12064
|
+
}
|
|
12065
|
+
};
|
|
12066
|
+
signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
|
|
12067
|
+
const { signal } = controller;
|
|
12068
|
+
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
12069
|
+
return signal;
|
|
12070
|
+
}
|
|
12071
|
+
};
|
|
12072
|
+
const streamChunk = function* (chunk, chunkSize) {
|
|
12073
|
+
let len = chunk.byteLength;
|
|
12074
|
+
if (len < chunkSize) {
|
|
12075
|
+
yield chunk;
|
|
12076
|
+
return;
|
|
12077
|
+
}
|
|
12078
|
+
let pos = 0;
|
|
12079
|
+
let end;
|
|
12080
|
+
while (pos < len) {
|
|
12081
|
+
end = pos + chunkSize;
|
|
12082
|
+
yield chunk.slice(pos, end);
|
|
12083
|
+
pos = end;
|
|
12084
|
+
}
|
|
12085
|
+
};
|
|
12086
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
12087
|
+
for await (const chunk of readStream(iterable)) {
|
|
12088
|
+
yield* streamChunk(chunk, chunkSize);
|
|
12089
|
+
}
|
|
12090
|
+
};
|
|
12091
|
+
const readStream = async function* (stream) {
|
|
12092
|
+
if (stream[Symbol.asyncIterator]) {
|
|
12093
|
+
yield* stream;
|
|
12094
|
+
return;
|
|
12095
|
+
}
|
|
12096
|
+
const reader = stream.getReader();
|
|
12097
|
+
try {
|
|
12098
|
+
for (; ; ) {
|
|
12099
|
+
const { done, value } = await reader.read();
|
|
12100
|
+
if (done) {
|
|
12101
|
+
break;
|
|
12102
|
+
}
|
|
12103
|
+
yield value;
|
|
12104
|
+
}
|
|
12105
|
+
} finally {
|
|
12106
|
+
await reader.cancel();
|
|
12107
|
+
}
|
|
12108
|
+
};
|
|
12109
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
12110
|
+
const iterator2 = readBytes(stream, chunkSize);
|
|
12111
|
+
let bytes = 0;
|
|
12112
|
+
let done;
|
|
12113
|
+
let _onFinish = (e) => {
|
|
12114
|
+
if (!done) {
|
|
12115
|
+
done = true;
|
|
12116
|
+
onFinish && onFinish(e);
|
|
12117
|
+
}
|
|
12118
|
+
};
|
|
12119
|
+
return new ReadableStream({
|
|
12120
|
+
async pull(controller) {
|
|
12121
|
+
try {
|
|
12122
|
+
const { done: done2, value } = await iterator2.next();
|
|
12123
|
+
if (done2) {
|
|
12124
|
+
_onFinish();
|
|
12125
|
+
controller.close();
|
|
12126
|
+
return;
|
|
12127
|
+
}
|
|
12128
|
+
let len = value.byteLength;
|
|
12129
|
+
if (onProgress) {
|
|
12130
|
+
let loadedBytes = bytes += len;
|
|
12131
|
+
onProgress(loadedBytes);
|
|
12132
|
+
}
|
|
12133
|
+
controller.enqueue(new Uint8Array(value));
|
|
12134
|
+
} catch (err) {
|
|
12135
|
+
_onFinish(err);
|
|
12136
|
+
throw err;
|
|
12137
|
+
}
|
|
12138
|
+
},
|
|
12139
|
+
cancel(reason) {
|
|
12140
|
+
_onFinish(reason);
|
|
12141
|
+
return iterator2.return();
|
|
12142
|
+
}
|
|
12143
|
+
}, {
|
|
12144
|
+
highWaterMark: 2
|
|
12145
|
+
});
|
|
12146
|
+
};
|
|
12147
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
12148
|
+
const { isFunction } = utils$1;
|
|
12149
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
12150
|
+
Request,
|
|
12151
|
+
Response
|
|
12152
|
+
}))(utils$1.global);
|
|
12153
|
+
const {
|
|
12154
|
+
ReadableStream: ReadableStream$1,
|
|
12155
|
+
TextEncoder
|
|
12156
|
+
} = utils$1.global;
|
|
12157
|
+
const test = (fn, ...args) => {
|
|
12158
|
+
try {
|
|
12159
|
+
return !!fn(...args);
|
|
12160
|
+
} catch (e) {
|
|
12161
|
+
return false;
|
|
12162
|
+
}
|
|
12163
|
+
};
|
|
12164
|
+
const factory = (env) => {
|
|
12165
|
+
env = utils$1.merge.call({
|
|
12166
|
+
skipUndefined: true
|
|
12167
|
+
}, globalFetchAPI, env);
|
|
12168
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
12169
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === "function";
|
|
12170
|
+
const isRequestSupported = isFunction(Request);
|
|
12171
|
+
const isResponseSupported = isFunction(Response);
|
|
12172
|
+
if (!isFetchSupported) {
|
|
12173
|
+
return false;
|
|
12174
|
+
}
|
|
12175
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
12176
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
12177
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
12178
|
+
let duplexAccessed = false;
|
|
12179
|
+
const hasContentType = new Request(platform.origin, {
|
|
12180
|
+
body: new ReadableStream$1(),
|
|
12181
|
+
method: "POST",
|
|
12182
|
+
get duplex() {
|
|
12183
|
+
duplexAccessed = true;
|
|
12184
|
+
return "half";
|
|
12185
|
+
}
|
|
12186
|
+
}).headers.has("Content-Type");
|
|
12187
|
+
return duplexAccessed && !hasContentType;
|
|
12188
|
+
});
|
|
12189
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
|
|
12190
|
+
const resolvers = {
|
|
12191
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
12192
|
+
};
|
|
12193
|
+
isFetchSupported && (() => {
|
|
12194
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
12195
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
12196
|
+
let method = res && res[type];
|
|
12197
|
+
if (method) {
|
|
12198
|
+
return method.call(res);
|
|
12199
|
+
}
|
|
12200
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
12201
|
+
});
|
|
12202
|
+
});
|
|
12203
|
+
})();
|
|
12204
|
+
const getBodyLength = async (body) => {
|
|
12205
|
+
if (body == null) {
|
|
12206
|
+
return 0;
|
|
12207
|
+
}
|
|
12208
|
+
if (utils$1.isBlob(body)) {
|
|
12209
|
+
return body.size;
|
|
12210
|
+
}
|
|
12211
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
12212
|
+
const _request = new Request(platform.origin, {
|
|
12213
|
+
method: "POST",
|
|
12214
|
+
body
|
|
12215
|
+
});
|
|
12216
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
12217
|
+
}
|
|
12218
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
12219
|
+
return body.byteLength;
|
|
12220
|
+
}
|
|
12221
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
12222
|
+
body = body + "";
|
|
12223
|
+
}
|
|
12224
|
+
if (utils$1.isString(body)) {
|
|
12225
|
+
return (await encodeText(body)).byteLength;
|
|
12226
|
+
}
|
|
12227
|
+
};
|
|
12228
|
+
const resolveBodyLength = async (headers, body) => {
|
|
12229
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
12230
|
+
return length == null ? getBodyLength(body) : length;
|
|
12231
|
+
};
|
|
12232
|
+
return async (config) => {
|
|
12233
|
+
let {
|
|
12234
|
+
url,
|
|
12235
|
+
method,
|
|
12236
|
+
data,
|
|
12237
|
+
signal,
|
|
12238
|
+
cancelToken,
|
|
12239
|
+
timeout,
|
|
12240
|
+
onDownloadProgress,
|
|
12241
|
+
onUploadProgress,
|
|
12242
|
+
responseType,
|
|
12243
|
+
headers,
|
|
12244
|
+
withCredentials = "same-origin",
|
|
12245
|
+
fetchOptions
|
|
12246
|
+
} = resolveConfig(config);
|
|
12247
|
+
let _fetch = envFetch || fetch;
|
|
12248
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
12249
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
12250
|
+
let request = null;
|
|
12251
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
12252
|
+
composedSignal.unsubscribe();
|
|
12253
|
+
});
|
|
12254
|
+
let requestContentLength;
|
|
12255
|
+
try {
|
|
12256
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
12257
|
+
let _request = new Request(url, {
|
|
12258
|
+
method: "POST",
|
|
12259
|
+
body: data,
|
|
12260
|
+
duplex: "half"
|
|
12261
|
+
});
|
|
12262
|
+
let contentTypeHeader;
|
|
12263
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
12264
|
+
headers.setContentType(contentTypeHeader);
|
|
12265
|
+
}
|
|
12266
|
+
if (_request.body) {
|
|
12267
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
12268
|
+
requestContentLength,
|
|
12269
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
12270
|
+
);
|
|
12271
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
12272
|
+
}
|
|
12273
|
+
}
|
|
12274
|
+
if (!utils$1.isString(withCredentials)) {
|
|
12275
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
12276
|
+
}
|
|
12277
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
12278
|
+
const resolvedOptions = {
|
|
12279
|
+
...fetchOptions,
|
|
12280
|
+
signal: composedSignal,
|
|
12281
|
+
method: method.toUpperCase(),
|
|
12282
|
+
headers: headers.normalize().toJSON(),
|
|
12283
|
+
body: data,
|
|
12284
|
+
duplex: "half",
|
|
12285
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
12286
|
+
};
|
|
12287
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
12288
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
12289
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
12290
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
12291
|
+
const options = {};
|
|
12292
|
+
["status", "statusText", "headers"].forEach((prop2) => {
|
|
12293
|
+
options[prop2] = response[prop2];
|
|
12294
|
+
});
|
|
12295
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
|
|
12296
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
12297
|
+
responseContentLength,
|
|
12298
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
12299
|
+
) || [];
|
|
12300
|
+
response = new Response(
|
|
12301
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
12302
|
+
flush && flush();
|
|
12303
|
+
unsubscribe && unsubscribe();
|
|
12304
|
+
}),
|
|
12305
|
+
options
|
|
12306
|
+
);
|
|
12307
|
+
}
|
|
12308
|
+
responseType = responseType || "text";
|
|
12309
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
|
|
12310
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
12311
|
+
return await new Promise((resolve, reject) => {
|
|
12312
|
+
settle(resolve, reject, {
|
|
12313
|
+
data: responseData,
|
|
12314
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
12315
|
+
status: response.status,
|
|
12316
|
+
statusText: response.statusText,
|
|
12317
|
+
config,
|
|
12318
|
+
request
|
|
12319
|
+
});
|
|
12320
|
+
});
|
|
12321
|
+
} catch (err) {
|
|
12322
|
+
unsubscribe && unsubscribe();
|
|
12323
|
+
if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
|
|
12324
|
+
throw Object.assign(
|
|
12325
|
+
new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request, err && err.response),
|
|
12326
|
+
{
|
|
12327
|
+
cause: err.cause || err
|
|
12328
|
+
}
|
|
12329
|
+
);
|
|
12330
|
+
}
|
|
12331
|
+
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
12332
|
+
}
|
|
12333
|
+
};
|
|
12334
|
+
};
|
|
12335
|
+
const seedCache = /* @__PURE__ */ new Map();
|
|
12336
|
+
const getFetch = (config) => {
|
|
12337
|
+
let env = config && config.env || {};
|
|
12338
|
+
const { fetch: fetch2, Request, Response } = env;
|
|
12339
|
+
const seeds = [
|
|
12340
|
+
Request,
|
|
12341
|
+
Response,
|
|
12342
|
+
fetch2
|
|
12343
|
+
];
|
|
12344
|
+
let len = seeds.length, i = len, seed, target2, map2 = seedCache;
|
|
12345
|
+
while (i--) {
|
|
12346
|
+
seed = seeds[i];
|
|
12347
|
+
target2 = map2.get(seed);
|
|
12348
|
+
target2 === void 0 && map2.set(seed, target2 = i ? /* @__PURE__ */ new Map() : factory(env));
|
|
12349
|
+
map2 = target2;
|
|
12350
|
+
}
|
|
12351
|
+
return target2;
|
|
12352
|
+
};
|
|
12353
|
+
getFetch();
|
|
12354
|
+
const knownAdapters = {
|
|
12355
|
+
http: httpAdapter,
|
|
12356
|
+
xhr: xhrAdapter,
|
|
12357
|
+
fetch: {
|
|
12358
|
+
get: getFetch
|
|
12359
|
+
}
|
|
12360
|
+
};
|
|
12361
|
+
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
12362
|
+
if (fn) {
|
|
12363
|
+
try {
|
|
12364
|
+
Object.defineProperty(fn, "name", { value });
|
|
12365
|
+
} catch (e) {
|
|
12366
|
+
}
|
|
12367
|
+
Object.defineProperty(fn, "adapterName", { value });
|
|
12368
|
+
}
|
|
12369
|
+
});
|
|
12370
|
+
const renderReason = (reason) => `- ${reason}`;
|
|
12371
|
+
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
12372
|
+
function getAdapter$1(adapters2, config) {
|
|
12373
|
+
adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
|
|
12374
|
+
const { length } = adapters2;
|
|
12375
|
+
let nameOrAdapter;
|
|
12376
|
+
let adapter;
|
|
12377
|
+
const rejectedReasons = {};
|
|
12378
|
+
for (let i = 0; i < length; i++) {
|
|
12379
|
+
nameOrAdapter = adapters2[i];
|
|
12380
|
+
let id;
|
|
12381
|
+
adapter = nameOrAdapter;
|
|
12382
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
12383
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
12384
|
+
if (adapter === void 0) {
|
|
12385
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
12386
|
+
}
|
|
12387
|
+
}
|
|
12388
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
12389
|
+
break;
|
|
12390
|
+
}
|
|
12391
|
+
rejectedReasons[id || "#" + i] = adapter;
|
|
12392
|
+
}
|
|
12393
|
+
if (!adapter) {
|
|
12394
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
12395
|
+
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
12396
|
+
);
|
|
12397
|
+
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
12398
|
+
throw new AxiosError$1(
|
|
12399
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
12400
|
+
"ERR_NOT_SUPPORT"
|
|
12401
|
+
);
|
|
12402
|
+
}
|
|
12403
|
+
return adapter;
|
|
12404
|
+
}
|
|
12405
|
+
const adapters = {
|
|
12406
|
+
/**
|
|
12407
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
12408
|
+
* @type {Function}
|
|
12409
|
+
*/
|
|
12410
|
+
getAdapter: getAdapter$1,
|
|
12411
|
+
/**
|
|
12412
|
+
* Exposes all known adapters
|
|
12413
|
+
* @type {Object<string, Function|Object>}
|
|
12414
|
+
*/
|
|
12415
|
+
adapters: knownAdapters
|
|
12416
|
+
};
|
|
12417
|
+
function throwIfCancellationRequested(config) {
|
|
12418
|
+
if (config.cancelToken) {
|
|
12419
|
+
config.cancelToken.throwIfRequested();
|
|
12420
|
+
}
|
|
12421
|
+
if (config.signal && config.signal.aborted) {
|
|
12422
|
+
throw new CanceledError$1(null, config);
|
|
12423
|
+
}
|
|
12424
|
+
}
|
|
12425
|
+
function dispatchRequest(config) {
|
|
12426
|
+
throwIfCancellationRequested(config);
|
|
12427
|
+
config.headers = AxiosHeaders$1.from(config.headers);
|
|
12428
|
+
config.data = transformData.call(
|
|
12429
|
+
config,
|
|
12430
|
+
config.transformRequest
|
|
12431
|
+
);
|
|
12432
|
+
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
|
12433
|
+
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
12434
|
+
}
|
|
12435
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
12436
|
+
return adapter(config).then(function onAdapterResolution(response) {
|
|
12437
|
+
throwIfCancellationRequested(config);
|
|
12438
|
+
response.data = transformData.call(
|
|
12439
|
+
config,
|
|
12440
|
+
config.transformResponse,
|
|
12441
|
+
response
|
|
12442
|
+
);
|
|
12443
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
12444
|
+
return response;
|
|
12445
|
+
}, function onAdapterRejection(reason) {
|
|
12446
|
+
if (!isCancel$1(reason)) {
|
|
12447
|
+
throwIfCancellationRequested(config);
|
|
12448
|
+
if (reason && reason.response) {
|
|
12449
|
+
reason.response.data = transformData.call(
|
|
12450
|
+
config,
|
|
12451
|
+
config.transformResponse,
|
|
12452
|
+
reason.response
|
|
12453
|
+
);
|
|
12454
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
12455
|
+
}
|
|
12456
|
+
}
|
|
12457
|
+
return Promise.reject(reason);
|
|
12458
|
+
});
|
|
12459
|
+
}
|
|
12460
|
+
const VERSION$1 = "1.13.5";
|
|
12461
|
+
const validators$1 = {};
|
|
12462
|
+
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
12463
|
+
validators$1[type] = function validator2(thing) {
|
|
12464
|
+
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
12465
|
+
};
|
|
12466
|
+
});
|
|
12467
|
+
const deprecatedWarnings = {};
|
|
12468
|
+
validators$1.transitional = function transitional(validator2, version, message) {
|
|
12469
|
+
function formatMessage(opt, desc) {
|
|
12470
|
+
return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
12471
|
+
}
|
|
12472
|
+
return (value, opt, opts) => {
|
|
12473
|
+
if (validator2 === false) {
|
|
12474
|
+
throw new AxiosError$1(
|
|
12475
|
+
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
12476
|
+
AxiosError$1.ERR_DEPRECATED
|
|
12477
|
+
);
|
|
12478
|
+
}
|
|
12479
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
12480
|
+
deprecatedWarnings[opt] = true;
|
|
12481
|
+
console.warn(
|
|
12482
|
+
formatMessage(
|
|
12483
|
+
opt,
|
|
12484
|
+
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
12485
|
+
)
|
|
12486
|
+
);
|
|
12487
|
+
}
|
|
12488
|
+
return validator2 ? validator2(value, opt, opts) : true;
|
|
12489
|
+
};
|
|
12490
|
+
};
|
|
12491
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
12492
|
+
return (value, opt) => {
|
|
12493
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
12494
|
+
return true;
|
|
12495
|
+
};
|
|
12496
|
+
};
|
|
12497
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
12498
|
+
if (typeof options !== "object") {
|
|
12499
|
+
throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
12500
|
+
}
|
|
12501
|
+
const keys = Object.keys(options);
|
|
12502
|
+
let i = keys.length;
|
|
12503
|
+
while (i-- > 0) {
|
|
12504
|
+
const opt = keys[i];
|
|
12505
|
+
const validator2 = schema[opt];
|
|
12506
|
+
if (validator2) {
|
|
12507
|
+
const value = options[opt];
|
|
12508
|
+
const result = value === void 0 || validator2(value, opt, options);
|
|
12509
|
+
if (result !== true) {
|
|
12510
|
+
throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
12511
|
+
}
|
|
12512
|
+
continue;
|
|
12513
|
+
}
|
|
12514
|
+
if (allowUnknown !== true) {
|
|
12515
|
+
throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
12516
|
+
}
|
|
12517
|
+
}
|
|
12518
|
+
}
|
|
12519
|
+
const validator = {
|
|
12520
|
+
assertOptions,
|
|
12521
|
+
validators: validators$1
|
|
12522
|
+
};
|
|
12523
|
+
const validators = validator.validators;
|
|
12524
|
+
let Axios$1 = class Axios {
|
|
12525
|
+
constructor(instanceConfig) {
|
|
12526
|
+
this.defaults = instanceConfig || {};
|
|
12527
|
+
this.interceptors = {
|
|
12528
|
+
request: new InterceptorManager(),
|
|
12529
|
+
response: new InterceptorManager()
|
|
12530
|
+
};
|
|
12531
|
+
}
|
|
12532
|
+
/**
|
|
12533
|
+
* Dispatch a request
|
|
12534
|
+
*
|
|
12535
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
12536
|
+
* @param {?Object} config
|
|
12537
|
+
*
|
|
12538
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
12539
|
+
*/
|
|
12540
|
+
async request(configOrUrl, config) {
|
|
12541
|
+
try {
|
|
12542
|
+
return await this._request(configOrUrl, config);
|
|
12543
|
+
} catch (err) {
|
|
12544
|
+
if (err instanceof Error) {
|
|
12545
|
+
let dummy = {};
|
|
12546
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
12547
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
12548
|
+
try {
|
|
12549
|
+
if (!err.stack) {
|
|
12550
|
+
err.stack = stack;
|
|
12551
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
12552
|
+
err.stack += "\n" + stack;
|
|
12553
|
+
}
|
|
12554
|
+
} catch (e) {
|
|
12555
|
+
}
|
|
12556
|
+
}
|
|
12557
|
+
throw err;
|
|
12558
|
+
}
|
|
12559
|
+
}
|
|
12560
|
+
_request(configOrUrl, config) {
|
|
12561
|
+
if (typeof configOrUrl === "string") {
|
|
12562
|
+
config = config || {};
|
|
12563
|
+
config.url = configOrUrl;
|
|
12564
|
+
} else {
|
|
12565
|
+
config = configOrUrl || {};
|
|
12566
|
+
}
|
|
12567
|
+
config = mergeConfig$1(this.defaults, config);
|
|
12568
|
+
const { transitional: transitional2, paramsSerializer, headers } = config;
|
|
12569
|
+
if (transitional2 !== void 0) {
|
|
12570
|
+
validator.assertOptions(transitional2, {
|
|
12571
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
12572
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
12573
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
12574
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
|
12575
|
+
}, false);
|
|
12576
|
+
}
|
|
12577
|
+
if (paramsSerializer != null) {
|
|
12578
|
+
if (utils$1.isFunction(paramsSerializer)) {
|
|
12579
|
+
config.paramsSerializer = {
|
|
12580
|
+
serialize: paramsSerializer
|
|
12581
|
+
};
|
|
12582
|
+
} else {
|
|
12583
|
+
validator.assertOptions(paramsSerializer, {
|
|
12584
|
+
encode: validators.function,
|
|
12585
|
+
serialize: validators.function
|
|
12586
|
+
}, true);
|
|
12587
|
+
}
|
|
12588
|
+
}
|
|
12589
|
+
if (config.allowAbsoluteUrls !== void 0) ;
|
|
12590
|
+
else if (this.defaults.allowAbsoluteUrls !== void 0) {
|
|
12591
|
+
config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
|
|
12592
|
+
} else {
|
|
12593
|
+
config.allowAbsoluteUrls = true;
|
|
12594
|
+
}
|
|
12595
|
+
validator.assertOptions(config, {
|
|
12596
|
+
baseUrl: validators.spelling("baseURL"),
|
|
12597
|
+
withXsrfToken: validators.spelling("withXSRFToken")
|
|
12598
|
+
}, true);
|
|
12599
|
+
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
|
12600
|
+
let contextHeaders = headers && utils$1.merge(
|
|
12601
|
+
headers.common,
|
|
12602
|
+
headers[config.method]
|
|
12603
|
+
);
|
|
12604
|
+
headers && utils$1.forEach(
|
|
12605
|
+
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
12606
|
+
(method) => {
|
|
12607
|
+
delete headers[method];
|
|
12608
|
+
}
|
|
12609
|
+
);
|
|
12610
|
+
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
12611
|
+
const requestInterceptorChain = [];
|
|
12612
|
+
let synchronousRequestInterceptors = true;
|
|
12613
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
12614
|
+
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
12615
|
+
return;
|
|
12616
|
+
}
|
|
12617
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
12618
|
+
const transitional3 = config.transitional || transitionalDefaults;
|
|
12619
|
+
const legacyInterceptorReqResOrdering = transitional3 && transitional3.legacyInterceptorReqResOrdering;
|
|
12620
|
+
if (legacyInterceptorReqResOrdering) {
|
|
12621
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
12622
|
+
} else {
|
|
12623
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
12624
|
+
}
|
|
12625
|
+
});
|
|
12626
|
+
const responseInterceptorChain = [];
|
|
12627
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
12628
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
12629
|
+
});
|
|
12630
|
+
let promise;
|
|
12631
|
+
let i = 0;
|
|
12632
|
+
let len;
|
|
12633
|
+
if (!synchronousRequestInterceptors) {
|
|
12634
|
+
const chain = [dispatchRequest.bind(this), void 0];
|
|
12635
|
+
chain.unshift(...requestInterceptorChain);
|
|
12636
|
+
chain.push(...responseInterceptorChain);
|
|
12637
|
+
len = chain.length;
|
|
12638
|
+
promise = Promise.resolve(config);
|
|
12639
|
+
while (i < len) {
|
|
12640
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
12641
|
+
}
|
|
12642
|
+
return promise;
|
|
12643
|
+
}
|
|
12644
|
+
len = requestInterceptorChain.length;
|
|
12645
|
+
let newConfig = config;
|
|
12646
|
+
while (i < len) {
|
|
12647
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
12648
|
+
const onRejected = requestInterceptorChain[i++];
|
|
12649
|
+
try {
|
|
12650
|
+
newConfig = onFulfilled(newConfig);
|
|
12651
|
+
} catch (error) {
|
|
12652
|
+
onRejected.call(this, error);
|
|
12653
|
+
break;
|
|
12654
|
+
}
|
|
12655
|
+
}
|
|
12656
|
+
try {
|
|
12657
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
12658
|
+
} catch (error) {
|
|
12659
|
+
return Promise.reject(error);
|
|
12660
|
+
}
|
|
12661
|
+
i = 0;
|
|
12662
|
+
len = responseInterceptorChain.length;
|
|
12663
|
+
while (i < len) {
|
|
12664
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
12665
|
+
}
|
|
12666
|
+
return promise;
|
|
12667
|
+
}
|
|
12668
|
+
getUri(config) {
|
|
12669
|
+
config = mergeConfig$1(this.defaults, config);
|
|
12670
|
+
const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
|
|
12671
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
12672
|
+
}
|
|
12673
|
+
};
|
|
12674
|
+
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
12675
|
+
Axios$1.prototype[method] = function(url, config) {
|
|
12676
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
12677
|
+
method,
|
|
12678
|
+
url,
|
|
12679
|
+
data: (config || {}).data
|
|
12680
|
+
}));
|
|
12681
|
+
};
|
|
12682
|
+
});
|
|
12683
|
+
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
12684
|
+
function generateHTTPMethod(isForm) {
|
|
12685
|
+
return function httpMethod(url, data, config) {
|
|
12686
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
12687
|
+
method,
|
|
12688
|
+
headers: isForm ? {
|
|
12689
|
+
"Content-Type": "multipart/form-data"
|
|
12690
|
+
} : {},
|
|
12691
|
+
url,
|
|
12692
|
+
data
|
|
12693
|
+
}));
|
|
12694
|
+
};
|
|
12695
|
+
}
|
|
12696
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
|
12697
|
+
Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
12698
|
+
});
|
|
12699
|
+
let CancelToken$1 = class CancelToken {
|
|
12700
|
+
constructor(executor) {
|
|
12701
|
+
if (typeof executor !== "function") {
|
|
12702
|
+
throw new TypeError("executor must be a function.");
|
|
12703
|
+
}
|
|
12704
|
+
let resolvePromise;
|
|
12705
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
12706
|
+
resolvePromise = resolve;
|
|
12707
|
+
});
|
|
12708
|
+
const token = this;
|
|
12709
|
+
this.promise.then((cancel) => {
|
|
12710
|
+
if (!token._listeners) return;
|
|
12711
|
+
let i = token._listeners.length;
|
|
12712
|
+
while (i-- > 0) {
|
|
12713
|
+
token._listeners[i](cancel);
|
|
12714
|
+
}
|
|
12715
|
+
token._listeners = null;
|
|
12716
|
+
});
|
|
12717
|
+
this.promise.then = (onfulfilled) => {
|
|
12718
|
+
let _resolve;
|
|
12719
|
+
const promise = new Promise((resolve) => {
|
|
12720
|
+
token.subscribe(resolve);
|
|
12721
|
+
_resolve = resolve;
|
|
12722
|
+
}).then(onfulfilled);
|
|
12723
|
+
promise.cancel = function reject() {
|
|
12724
|
+
token.unsubscribe(_resolve);
|
|
12725
|
+
};
|
|
12726
|
+
return promise;
|
|
12727
|
+
};
|
|
12728
|
+
executor(function cancel(message, config, request) {
|
|
12729
|
+
if (token.reason) {
|
|
12730
|
+
return;
|
|
12731
|
+
}
|
|
12732
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
12733
|
+
resolvePromise(token.reason);
|
|
12734
|
+
});
|
|
12735
|
+
}
|
|
12736
|
+
/**
|
|
12737
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
12738
|
+
*/
|
|
12739
|
+
throwIfRequested() {
|
|
12740
|
+
if (this.reason) {
|
|
12741
|
+
throw this.reason;
|
|
12742
|
+
}
|
|
12743
|
+
}
|
|
12744
|
+
/**
|
|
12745
|
+
* Subscribe to the cancel signal
|
|
12746
|
+
*/
|
|
12747
|
+
subscribe(listener) {
|
|
12748
|
+
if (this.reason) {
|
|
12749
|
+
listener(this.reason);
|
|
12750
|
+
return;
|
|
12751
|
+
}
|
|
12752
|
+
if (this._listeners) {
|
|
12753
|
+
this._listeners.push(listener);
|
|
12754
|
+
} else {
|
|
12755
|
+
this._listeners = [listener];
|
|
12756
|
+
}
|
|
12757
|
+
}
|
|
12758
|
+
/**
|
|
12759
|
+
* Unsubscribe from the cancel signal
|
|
12760
|
+
*/
|
|
12761
|
+
unsubscribe(listener) {
|
|
12762
|
+
if (!this._listeners) {
|
|
12763
|
+
return;
|
|
12764
|
+
}
|
|
12765
|
+
const index = this._listeners.indexOf(listener);
|
|
12766
|
+
if (index !== -1) {
|
|
12767
|
+
this._listeners.splice(index, 1);
|
|
12768
|
+
}
|
|
12769
|
+
}
|
|
12770
|
+
toAbortSignal() {
|
|
12771
|
+
const controller = new AbortController();
|
|
12772
|
+
const abort = (err) => {
|
|
12773
|
+
controller.abort(err);
|
|
12774
|
+
};
|
|
12775
|
+
this.subscribe(abort);
|
|
12776
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
12777
|
+
return controller.signal;
|
|
12778
|
+
}
|
|
12779
|
+
/**
|
|
12780
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
12781
|
+
* cancels the `CancelToken`.
|
|
12782
|
+
*/
|
|
12783
|
+
static source() {
|
|
12784
|
+
let cancel;
|
|
12785
|
+
const token = new CancelToken(function executor(c) {
|
|
12786
|
+
cancel = c;
|
|
12787
|
+
});
|
|
12788
|
+
return {
|
|
12789
|
+
token,
|
|
12790
|
+
cancel
|
|
12791
|
+
};
|
|
12792
|
+
}
|
|
12793
|
+
};
|
|
12794
|
+
function spread$1(callback) {
|
|
12795
|
+
return function wrap(arr) {
|
|
12796
|
+
return callback.apply(null, arr);
|
|
12797
|
+
};
|
|
12798
|
+
}
|
|
12799
|
+
function isAxiosError$1(payload) {
|
|
12800
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
12801
|
+
}
|
|
12802
|
+
const HttpStatusCode$1 = {
|
|
12803
|
+
Continue: 100,
|
|
12804
|
+
SwitchingProtocols: 101,
|
|
12805
|
+
Processing: 102,
|
|
12806
|
+
EarlyHints: 103,
|
|
12807
|
+
Ok: 200,
|
|
12808
|
+
Created: 201,
|
|
12809
|
+
Accepted: 202,
|
|
12810
|
+
NonAuthoritativeInformation: 203,
|
|
12811
|
+
NoContent: 204,
|
|
12812
|
+
ResetContent: 205,
|
|
12813
|
+
PartialContent: 206,
|
|
12814
|
+
MultiStatus: 207,
|
|
12815
|
+
AlreadyReported: 208,
|
|
12816
|
+
ImUsed: 226,
|
|
12817
|
+
MultipleChoices: 300,
|
|
12818
|
+
MovedPermanently: 301,
|
|
12819
|
+
Found: 302,
|
|
12820
|
+
SeeOther: 303,
|
|
12821
|
+
NotModified: 304,
|
|
12822
|
+
UseProxy: 305,
|
|
12823
|
+
Unused: 306,
|
|
12824
|
+
TemporaryRedirect: 307,
|
|
12825
|
+
PermanentRedirect: 308,
|
|
12826
|
+
BadRequest: 400,
|
|
12827
|
+
Unauthorized: 401,
|
|
12828
|
+
PaymentRequired: 402,
|
|
12829
|
+
Forbidden: 403,
|
|
12830
|
+
NotFound: 404,
|
|
12831
|
+
MethodNotAllowed: 405,
|
|
12832
|
+
NotAcceptable: 406,
|
|
12833
|
+
ProxyAuthenticationRequired: 407,
|
|
12834
|
+
RequestTimeout: 408,
|
|
12835
|
+
Conflict: 409,
|
|
12836
|
+
Gone: 410,
|
|
12837
|
+
LengthRequired: 411,
|
|
12838
|
+
PreconditionFailed: 412,
|
|
12839
|
+
PayloadTooLarge: 413,
|
|
12840
|
+
UriTooLong: 414,
|
|
12841
|
+
UnsupportedMediaType: 415,
|
|
12842
|
+
RangeNotSatisfiable: 416,
|
|
12843
|
+
ExpectationFailed: 417,
|
|
12844
|
+
ImATeapot: 418,
|
|
12845
|
+
MisdirectedRequest: 421,
|
|
12846
|
+
UnprocessableEntity: 422,
|
|
12847
|
+
Locked: 423,
|
|
12848
|
+
FailedDependency: 424,
|
|
12849
|
+
TooEarly: 425,
|
|
12850
|
+
UpgradeRequired: 426,
|
|
12851
|
+
PreconditionRequired: 428,
|
|
12852
|
+
TooManyRequests: 429,
|
|
12853
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
12854
|
+
UnavailableForLegalReasons: 451,
|
|
12855
|
+
InternalServerError: 500,
|
|
12856
|
+
NotImplemented: 501,
|
|
12857
|
+
BadGateway: 502,
|
|
12858
|
+
ServiceUnavailable: 503,
|
|
12859
|
+
GatewayTimeout: 504,
|
|
12860
|
+
HttpVersionNotSupported: 505,
|
|
12861
|
+
VariantAlsoNegotiates: 506,
|
|
12862
|
+
InsufficientStorage: 507,
|
|
12863
|
+
LoopDetected: 508,
|
|
12864
|
+
NotExtended: 510,
|
|
12865
|
+
NetworkAuthenticationRequired: 511,
|
|
12866
|
+
WebServerIsDown: 521,
|
|
12867
|
+
ConnectionTimedOut: 522,
|
|
12868
|
+
OriginIsUnreachable: 523,
|
|
12869
|
+
TimeoutOccurred: 524,
|
|
12870
|
+
SslHandshakeFailed: 525,
|
|
12871
|
+
InvalidSslCertificate: 526
|
|
12872
|
+
};
|
|
12873
|
+
Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
12874
|
+
HttpStatusCode$1[value] = key;
|
|
12875
|
+
});
|
|
12876
|
+
function createInstance(defaultConfig) {
|
|
12877
|
+
const context = new Axios$1(defaultConfig);
|
|
12878
|
+
const instance = bind(Axios$1.prototype.request, context);
|
|
12879
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
12880
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
12881
|
+
instance.create = function create2(instanceConfig) {
|
|
12882
|
+
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
12883
|
+
};
|
|
12884
|
+
return instance;
|
|
12885
|
+
}
|
|
12886
|
+
const axios = createInstance(defaults);
|
|
12887
|
+
axios.Axios = Axios$1;
|
|
12888
|
+
axios.CanceledError = CanceledError$1;
|
|
12889
|
+
axios.CancelToken = CancelToken$1;
|
|
12890
|
+
axios.isCancel = isCancel$1;
|
|
12891
|
+
axios.VERSION = VERSION$1;
|
|
12892
|
+
axios.toFormData = toFormData$1;
|
|
12893
|
+
axios.AxiosError = AxiosError$1;
|
|
12894
|
+
axios.Cancel = axios.CanceledError;
|
|
12895
|
+
axios.all = function all(promises) {
|
|
12896
|
+
return Promise.all(promises);
|
|
12897
|
+
};
|
|
12898
|
+
axios.spread = spread$1;
|
|
12899
|
+
axios.isAxiosError = isAxiosError$1;
|
|
12900
|
+
axios.mergeConfig = mergeConfig$1;
|
|
12901
|
+
axios.AxiosHeaders = AxiosHeaders$1;
|
|
12902
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
12903
|
+
axios.getAdapter = adapters.getAdapter;
|
|
12904
|
+
axios.HttpStatusCode = HttpStatusCode$1;
|
|
12905
|
+
axios.default = axios;
|
|
12906
|
+
const {
|
|
12907
|
+
Axios: Axios2,
|
|
12908
|
+
AxiosError: AxiosError2,
|
|
12909
|
+
CanceledError: CanceledError2,
|
|
12910
|
+
isCancel,
|
|
12911
|
+
CancelToken: CancelToken2,
|
|
12912
|
+
VERSION,
|
|
12913
|
+
all: all2,
|
|
12914
|
+
Cancel,
|
|
12915
|
+
isAxiosError,
|
|
12916
|
+
spread,
|
|
12917
|
+
toFormData,
|
|
12918
|
+
AxiosHeaders: AxiosHeaders2,
|
|
12919
|
+
HttpStatusCode,
|
|
12920
|
+
formToJSON,
|
|
12921
|
+
getAdapter,
|
|
12922
|
+
mergeConfig
|
|
12923
|
+
} = axios;
|
|
12924
|
+
class RESTClientSubscriber {
|
|
12925
|
+
#socketSubscribeKeepAlive = {};
|
|
12926
|
+
#options;
|
|
12927
|
+
// This is required becuase each call to .bind create a new replica bound function - so we need the same instance for on/off event bindings.
|
|
12928
|
+
KeepAliveAckBoundFunction;
|
|
12929
|
+
#currentSubscriptions = [];
|
|
12930
|
+
constructor(options) {
|
|
12931
|
+
this.#options = options;
|
|
12932
|
+
}
|
|
12933
|
+
#LogDebugMessage(message) {
|
|
12934
|
+
this.#options.logger.debug(message);
|
|
12935
|
+
}
|
|
12936
|
+
#LogErrorMessage(message) {
|
|
12937
|
+
this.#options.logger.error(message);
|
|
12938
|
+
}
|
|
12939
|
+
async Subscribe(subscriptions) {
|
|
12940
|
+
subscriptions.map(async (subId) => {
|
|
12941
|
+
this.#RemoveKeepAlive(subId);
|
|
12942
|
+
this.#LogDebugMessage(chalk.yellow(`ObservabilityRESTAPISubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
12943
|
+
try {
|
|
12944
|
+
this.#AddKeepAlive(subId);
|
|
12945
|
+
} catch (error) {
|
|
12946
|
+
this.#LogErrorMessage(chalk.red(`ObservabilityRESTAPISubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
|
|
12947
|
+
this.#RemoveKeepAlive(subId);
|
|
12948
|
+
}
|
|
12949
|
+
});
|
|
12950
|
+
}
|
|
12951
|
+
UnSubscribe(subscriptions) {
|
|
12952
|
+
subscriptions.map(async (subId) => {
|
|
12953
|
+
this.#RemoveKeepAlive(subId);
|
|
12954
|
+
this.#LogDebugMessage(chalk.yellow(`ObservabilityRESTAPISubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
12955
|
+
});
|
|
12956
|
+
}
|
|
12957
|
+
UpdateModelCursor = (subscriptions) => {
|
|
12958
|
+
this.UnSubscribe(this.#currentSubscriptions);
|
|
12959
|
+
this.#currentSubscriptions = subscriptions;
|
|
12960
|
+
this.Subscribe(this.#currentSubscriptions);
|
|
12961
|
+
};
|
|
12962
|
+
async #InvokeRESTAPI(subscription) {
|
|
12963
|
+
const { subscriptionKey } = subscription;
|
|
12964
|
+
let url = "";
|
|
12965
|
+
switch (subscriptionKey.topic) {
|
|
12966
|
+
// Services -------------------------------------------------------------------------------------------
|
|
12967
|
+
case stsobservability.SubscriptionTopic.AllServicesCombined:
|
|
12968
|
+
url = `/metrics`;
|
|
12969
|
+
break;
|
|
12970
|
+
case stsobservability.SubscriptionTopic.Services:
|
|
12971
|
+
url = `/metrics/services`;
|
|
12972
|
+
break;
|
|
12973
|
+
case stsobservability.SubscriptionTopic.ServiceInstances:
|
|
12974
|
+
if (subscriptionKey.key) {
|
|
12975
|
+
url = `/metrics/services/${subscriptionKey.key}`;
|
|
12976
|
+
break;
|
|
12977
|
+
} else {
|
|
12978
|
+
throw new Error(`#OutputSubscription(Services): key not provided for subscription: [${JSON.stringify(subscriptionKey)}]`);
|
|
12979
|
+
}
|
|
12980
|
+
case stsobservability.SubscriptionTopic.ServiceInstance:
|
|
12981
|
+
url = `/metrics/services/${subscriptionKey.key}`;
|
|
12982
|
+
if (subscriptionKey.key && subscriptionKey.subkey) {
|
|
12983
|
+
url = `/metrics/services/${subscriptionKey.key}/${subscriptionKey.subkey}`;
|
|
12984
|
+
break;
|
|
12985
|
+
} else {
|
|
12986
|
+
throw new Error(`#OutputSubscription(Services): key not provided for subscription: [${JSON.stringify(subscriptionKey)}]`);
|
|
12987
|
+
}
|
|
12988
|
+
// Lambdas -------------------------------------------------------------------------------------------
|
|
12989
|
+
case stsobservability.SubscriptionTopic.AllLambdasCombined:
|
|
12990
|
+
url = `/metrics`;
|
|
12991
|
+
break;
|
|
12992
|
+
case stsobservability.SubscriptionTopic.LambdaTechnologies:
|
|
12993
|
+
url = `/metrics/lambdas`;
|
|
12994
|
+
break;
|
|
12995
|
+
case stsobservability.SubscriptionTopic.LambdaSubTechnologies:
|
|
12996
|
+
if (subscriptionKey.key) {
|
|
12997
|
+
url = `/metrics/lambdas/${subscriptionKey.key}`;
|
|
12998
|
+
break;
|
|
12999
|
+
} else {
|
|
13000
|
+
throw new Error(`#OutputSubscription(Lambdas): key not provided for subscription: [${JSON.stringify(subscriptionKey)}]`);
|
|
13001
|
+
}
|
|
13002
|
+
case stsobservability.SubscriptionTopic.LambdaSubTechnologiesInstance:
|
|
13003
|
+
url = `/metrics/lambdas/${subscriptionKey.key}`;
|
|
13004
|
+
if (subscriptionKey.key && subscriptionKey.subkey) {
|
|
13005
|
+
url = `/metrics/lambdas/${subscriptionKey.key}/${subscriptionKey.subkey}`;
|
|
13006
|
+
break;
|
|
13007
|
+
} else {
|
|
13008
|
+
throw new Error(`#OutputSubscription(Lambdas): key not provided for subscription: [${JSON.stringify(subscriptionKey)}]`);
|
|
13009
|
+
}
|
|
13010
|
+
// User Agents -------------------------------------------------------------------------------------------
|
|
13011
|
+
case stsobservability.SubscriptionTopic.AllAgentsCombined:
|
|
13012
|
+
url = `/metrics`;
|
|
13013
|
+
break;
|
|
13014
|
+
case stsobservability.SubscriptionTopic.Agents:
|
|
13015
|
+
url = `/metrics/agents`;
|
|
13016
|
+
break;
|
|
13017
|
+
case stsobservability.SubscriptionTopic.AgentWorkers:
|
|
13018
|
+
if (subscriptionKey.key) {
|
|
13019
|
+
url = `/metrics/agents/${subscriptionKey.key}`;
|
|
13020
|
+
break;
|
|
13021
|
+
} else {
|
|
13022
|
+
throw new Error(`#OutputSubscription(Agents): key not provided for subscription: [${JSON.stringify(subscriptionKey)}]`);
|
|
13023
|
+
}
|
|
13024
|
+
case stsobservability.SubscriptionTopic.AgentWorker:
|
|
13025
|
+
if (subscriptionKey.key && subscriptionKey.subkey) {
|
|
13026
|
+
url = `/metrics/agents/${subscriptionKey.key}/${subscriptionKey.subkey}`;
|
|
13027
|
+
break;
|
|
13028
|
+
} else {
|
|
13029
|
+
throw new Error(`#OutputSubscription(Agents): key and/or subkey not provided for subscription: [${JSON.stringify(subscriptionKey.topic)}]`);
|
|
13030
|
+
}
|
|
13031
|
+
}
|
|
13032
|
+
if (url.localeCompare("") !== 0) {
|
|
13033
|
+
const endPointUrl = `${this.#options.urlBase}${url}`;
|
|
13034
|
+
let retVal;
|
|
13035
|
+
const start = performance.now();
|
|
13036
|
+
try {
|
|
13037
|
+
retVal = await axios(new stsutils.STSAxiosConfig(endPointUrl, "get").withDefaultHeaders().config);
|
|
13038
|
+
const end = performance.now();
|
|
13039
|
+
const diff = end - start;
|
|
13040
|
+
if (subscriptionKey.topic.localeCompare(stsobservability.SubscriptionTopic.AllServicesCombined) === 0) {
|
|
13041
|
+
return retVal.data["services"].data;
|
|
13042
|
+
}
|
|
13043
|
+
if (subscriptionKey.topic.localeCompare(stsobservability.SubscriptionTopic.AllAgentsCombined) === 0) {
|
|
13044
|
+
return retVal.data["agents"].data;
|
|
13045
|
+
}
|
|
13046
|
+
if (subscriptionKey.topic.localeCompare(stsobservability.SubscriptionTopic.AllLambdasCombined) === 0) {
|
|
13047
|
+
return retVal.data["lambdas"].data;
|
|
13048
|
+
}
|
|
13049
|
+
return retVal.data;
|
|
13050
|
+
} catch (error) {
|
|
13051
|
+
return null;
|
|
13052
|
+
}
|
|
13053
|
+
} else {
|
|
13054
|
+
return null;
|
|
13055
|
+
}
|
|
13056
|
+
}
|
|
13057
|
+
#GetData = async (subscription) => {
|
|
13058
|
+
try {
|
|
13059
|
+
const retVal = await this.#InvokeRESTAPI(subscription);
|
|
13060
|
+
if (retVal) {
|
|
13061
|
+
const payload = {
|
|
13062
|
+
subscriptionKey: subscription.subscriptionKey,
|
|
13063
|
+
data: retVal
|
|
13064
|
+
};
|
|
13065
|
+
subscription.cb(payload);
|
|
13066
|
+
}
|
|
13067
|
+
} catch (error) {
|
|
13068
|
+
this.#LogErrorMessage(chalk.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
|
|
13069
|
+
this.#RemoveKeepAlive(subscription);
|
|
13070
|
+
}
|
|
13071
|
+
};
|
|
13072
|
+
#SetupTimeout(socketSubscribeKeepAlive, subscription, timeout) {
|
|
13073
|
+
return setTimeout(async () => {
|
|
13074
|
+
try {
|
|
13075
|
+
const start = performance.now();
|
|
13076
|
+
await this.#GetData(subscription);
|
|
13077
|
+
if (socketSubscribeKeepAlive.timeout) {
|
|
13078
|
+
const end = performance.now();
|
|
13079
|
+
const diff = end - start;
|
|
13080
|
+
let timeoutDuration = (this.#options.keepAlive ?? 1e3) - diff;
|
|
13081
|
+
if (timeoutDuration < 500) {
|
|
13082
|
+
timeoutDuration = 500;
|
|
13083
|
+
}
|
|
13084
|
+
socketSubscribeKeepAlive.timeout = this.#SetupTimeout(socketSubscribeKeepAlive, subscription, timeoutDuration);
|
|
13085
|
+
} else {
|
|
13086
|
+
this.#LogDebugMessage(chalk.yellow(`Subscription removed: [${socketSubscribeKeepAlive.id}]. Processing terminate.`));
|
|
13087
|
+
}
|
|
13088
|
+
} catch (error) {
|
|
13089
|
+
this.#LogErrorMessage(chalk.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
|
|
13090
|
+
this.#RemoveKeepAlive(subscription);
|
|
13091
|
+
}
|
|
13092
|
+
}, timeout);
|
|
13093
|
+
}
|
|
13094
|
+
#AddKeepAlive(subscription) {
|
|
13095
|
+
this.#RemoveKeepAlive(subscription);
|
|
13096
|
+
const socketSubscribeKeepAlive = {
|
|
13097
|
+
id: subscription.subscriptionKey.id
|
|
13098
|
+
};
|
|
13099
|
+
socketSubscribeKeepAlive.timeout = this.#SetupTimeout(socketSubscribeKeepAlive, subscription, this.#options.keepAlive ?? 1e3);
|
|
13100
|
+
this.#socketSubscribeKeepAlive[subscription.subscriptionKey.id] = socketSubscribeKeepAlive;
|
|
13101
|
+
this.#GetData(subscription);
|
|
13102
|
+
}
|
|
13103
|
+
#RemoveKeepAlive(subscription) {
|
|
13104
|
+
if (this.#socketSubscribeKeepAlive[subscription.subscriptionKey.id]) {
|
|
13105
|
+
this.#LogDebugMessage(chalk.gray(`ObservabilityRESTAPISubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
|
|
13106
|
+
clearTimeout(this.#socketSubscribeKeepAlive[subscription.subscriptionKey.id].timeout);
|
|
13107
|
+
delete this.#socketSubscribeKeepAlive[subscription.subscriptionKey.id].timeout;
|
|
13108
|
+
delete this.#socketSubscribeKeepAlive[subscription.subscriptionKey.id];
|
|
13109
|
+
}
|
|
13110
|
+
}
|
|
13111
|
+
}
|
|
10394
13112
|
const _hoisted_1$1 = { class: "d-flex flex-wrap justify-space-between" };
|
|
10395
13113
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
10396
13114
|
__name: "UXModelNavigator",
|
|
@@ -10399,13 +13117,14 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10399
13117
|
},
|
|
10400
13118
|
setup(__props, { expose: __expose }) {
|
|
10401
13119
|
chalk.level = 3;
|
|
13120
|
+
let subscriptionOptions;
|
|
10402
13121
|
const props = __props;
|
|
10403
13122
|
const store = ModelStore();
|
|
10404
13123
|
let observabilitySubscriptionManager = new stsobservability.ObservabilitySubscriptionManager({
|
|
10405
13124
|
logger: stsutils.defaultLogger,
|
|
10406
13125
|
maxLogLength: 200
|
|
10407
13126
|
});
|
|
10408
|
-
let
|
|
13127
|
+
let metricsSubscriber;
|
|
10409
13128
|
const baseColour = chalk.hex("#57A1A8");
|
|
10410
13129
|
const LogDebug = (message) => {
|
|
10411
13130
|
stsutils.defaultLogger.debug(baseColour(`stsuxvue:UXModelNavigator:${message}`));
|
|
@@ -10540,19 +13259,19 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10540
13259
|
}
|
|
10541
13260
|
};
|
|
10542
13261
|
const UpdateModelCursor = () => {
|
|
10543
|
-
const
|
|
10544
|
-
if (
|
|
10545
|
-
|
|
13262
|
+
const subscriptions = reactiveNavigationSubscriptions.currentSubscriptions;
|
|
13263
|
+
if (metricsSubscriber && subscriptions) {
|
|
13264
|
+
metricsSubscriber.UpdateModelCursor(subscriptions);
|
|
10546
13265
|
}
|
|
10547
13266
|
};
|
|
10548
|
-
const navigate = function(
|
|
13267
|
+
const navigate = function(subscriptions) {
|
|
10549
13268
|
if (reactiveNavigationSubscriptions.currentSubscriptions) {
|
|
10550
13269
|
reactiveNavigationSubscriptions.subscriptionHistoryStack.push(reactiveNavigationSubscriptions.currentSubscriptions);
|
|
10551
13270
|
} else {
|
|
10552
13271
|
LogWarning(`navigate: obj.currentSubscriptions not defined`);
|
|
10553
13272
|
}
|
|
10554
|
-
reactiveNavigationSubscriptions.currentSubscriptions =
|
|
10555
|
-
LogDebug(`navigate: observabilitySubscriberManager().UpdateModelCursor(${JSON.stringify(
|
|
13273
|
+
reactiveNavigationSubscriptions.currentSubscriptions = subscriptions;
|
|
13274
|
+
LogDebug(`navigate: observabilitySubscriberManager().UpdateModelCursor(${JSON.stringify(subscriptions)})`);
|
|
10556
13275
|
UpdateModelCursor();
|
|
10557
13276
|
};
|
|
10558
13277
|
const GoBack = function() {
|
|
@@ -10586,28 +13305,40 @@ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
|
10586
13305
|
const Stop = async () => {
|
|
10587
13306
|
LogDebug(`Stop()`);
|
|
10588
13307
|
store.UpdateSate(props.modelId, _estate.STOPPING);
|
|
10589
|
-
if (
|
|
13308
|
+
if (metricsSubscriber) {
|
|
10590
13309
|
if (reactiveNavigationSubscriptions.currentSubscriptions) {
|
|
10591
|
-
|
|
13310
|
+
metricsSubscriber.UnSubscribe(reactiveNavigationSubscriptions.currentSubscriptions);
|
|
10592
13311
|
await stsutils.Sleep(250);
|
|
10593
13312
|
}
|
|
10594
|
-
if (
|
|
10595
|
-
socketClientSubscriber
|
|
13313
|
+
if (metricsSubscriber && subscriptionOptions.consumeInstrumentationMode === "PROXY") {
|
|
13314
|
+
const socketClientSubscriber = metricsSubscriber;
|
|
13315
|
+
if (socketClientSubscriber.socket) {
|
|
13316
|
+
socketClientSubscriber.socket.disconnect();
|
|
13317
|
+
}
|
|
10596
13318
|
}
|
|
10597
|
-
|
|
13319
|
+
metricsSubscriber = void 0;
|
|
10598
13320
|
}
|
|
10599
13321
|
store.UpdateSate(props.modelId, _estate.IDLE);
|
|
10600
13322
|
};
|
|
10601
13323
|
const Start = async (options) => {
|
|
10602
13324
|
LogDebug(`Start()`);
|
|
10603
13325
|
store.UpdateSate(props.modelId, _estate.STARTING);
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
13326
|
+
subscriptionOptions = options;
|
|
13327
|
+
if (options.consumeInstrumentationMode === "PROXY") {
|
|
13328
|
+
metricsSubscriber = new SocketClientSubscriber({
|
|
13329
|
+
instrumentManagerEndpoint: options.instrumentManagerEndpoint,
|
|
13330
|
+
instrumentManagerPort: options.instrumentManagerPort,
|
|
13331
|
+
consumeInstrumentationMode: options.consumeInstrumentationMode,
|
|
13332
|
+
instrumentManagerAPIRoot: options.instrumentManagerAPIRoot,
|
|
13333
|
+
modelId: options.modelId
|
|
13334
|
+
});
|
|
13335
|
+
} else {
|
|
13336
|
+
metricsSubscriber = new RESTClientSubscriber({
|
|
13337
|
+
urlBase: `${options.instrumentManagerEndpoint}:${options.instrumentManagerPort}${options.instrumentManagerAPIRoot}`,
|
|
13338
|
+
logger: stsutils.defaultLogger,
|
|
13339
|
+
keepAlive: 1e3
|
|
13340
|
+
});
|
|
13341
|
+
}
|
|
10611
13342
|
reactiveNavigationSubscriptions.currentSubscriptions = GetRootLevelSubscriptions();
|
|
10612
13343
|
LogDebug(`Start(): observabilitySubscriberManager().UpdateModelCursor(): Mode: [${options.consumeInstrumentationMode}] rootLevelSubscriptions: [(${JSON.stringify(reactiveNavigationSubscriptions.currentSubscriptions)}]`);
|
|
10613
13344
|
UpdateModelCursor();
|