@vtj/utils
Version:
VTJ 是一款基于 Vue3 + Typescript 的低代码页面可视化设计器。内置低代码引擎、渲染器和代码生成器,面向前端开发者,开箱即用。 无缝嵌入本地开发工程,不改变前端开发流程和编码习惯。
1,675 lines • 73.7 kB
JavaScript
var jt = Object.defineProperty;
var Nt = (t, e, n) => e in t ? jt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var C = (t, e, n) => Nt(t, typeof e != "symbol" ? e + "" : e, n);
import { omit as me, merge as W, debounce as Dt, throttle as vt, isUrl as Bt, pathToRegexpCompile as It, uuid as Mt, rURL as qt, template as Ht } from "@vtj/base";
export * from "@vtj/base";
import { ref as ge } from "vue";
(function() {
if (typeof window > "u" || typeof EventTarget > "u")
return;
const t = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(e, n, r) {
typeof r != "boolean" && (r = r || {}, r.passive = !1), t.call(this, e, n, r);
};
})();
/**!
* Copyright (c) 2026, VTJ.PRO All rights reserved.
* @name @vtj/utils
* @author CHC chenhuachun1549@dingtalk.com
* @version 0.14.0
* @license <a href="https://vtj.pro/license.html">MIT License</a>
*/
const Xr = "0.14.0";
function st(t, e) {
return function() {
return t.apply(e, arguments);
};
}
const { toString: $t } = Object.prototype, { getPrototypeOf: Ce } = Object, { iterator: ce, toStringTag: ot } = Symbol, le = /* @__PURE__ */ ((t) => (e) => {
const n = $t.call(e);
return t[n] || (t[n] = n.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null)), L = (t) => (t = t.toLowerCase(), (e) => le(e) === t), ue = (t) => (e) => typeof e === t, { isArray: H } = Array, q = ue("undefined");
function X(t) {
return t !== null && !q(t) && t.constructor !== null && !q(t.constructor) && A(t.constructor.isBuffer) && t.constructor.isBuffer(t);
}
const it = L("ArrayBuffer");
function Jt(t) {
let e;
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && it(t.buffer), e;
}
const zt = ue("string"), A = ue("function"), at = ue("number"), G = (t) => t !== null && typeof t == "object", Wt = (t) => t === !0 || t === !1, se = (t) => {
if (le(t) !== "object")
return !1;
const e = Ce(t);
return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(ot in t) && !(ce in t);
}, Vt = (t) => {
if (!G(t) || X(t))
return !1;
try {
return Object.keys(t).length === 0 && Object.getPrototypeOf(t) === Object.prototype;
} catch {
return !1;
}
}, Kt = L("Date"), Xt = L("File"), Gt = L("Blob"), Qt = L("FileList"), Yt = (t) => G(t) && A(t.pipe), Zt = (t) => {
let e;
return t && (typeof FormData == "function" && t instanceof FormData || A(t.append) && ((e = le(t)) === "formdata" || // detect form-data instance
e === "object" && A(t.toString) && t.toString() === "[object FormData]"));
}, en = L("URLSearchParams"), [tn, nn, rn, sn] = ["ReadableStream", "Request", "Response", "Headers"].map(L), on = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function Q(t, e, { allOwnKeys: n = !1 } = {}) {
if (t === null || typeof t > "u")
return;
let r, s;
if (typeof t != "object" && (t = [t]), H(t))
for (r = 0, s = t.length; r < s; r++)
e.call(null, t[r], r, t);
else {
if (X(t))
return;
const o = n ? Object.getOwnPropertyNames(t) : Object.keys(t), i = o.length;
let a;
for (r = 0; r < i; r++)
a = o[r], e.call(null, t[a], a, t);
}
}
function ct(t, e) {
if (X(t))
return null;
e = e.toLowerCase();
const n = Object.keys(t);
let r = n.length, s;
for (; r-- > 0; )
if (s = n[r], e === s.toLowerCase())
return s;
return null;
}
const v = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, lt = (t) => !q(t) && t !== v;
function Se() {
const { caseless: t, skipUndefined: e } = lt(this) && this || {}, n = {}, r = (s, o) => {
const i = t && ct(n, o) || o;
se(n[i]) && se(s) ? n[i] = Se(n[i], s) : se(s) ? n[i] = Se({}, s) : H(s) ? n[i] = s.slice() : (!e || !q(s)) && (n[i] = s);
};
for (let s = 0, o = arguments.length; s < o; s++)
arguments[s] && Q(arguments[s], r);
return n;
}
const an = (t, e, n, { allOwnKeys: r } = {}) => (Q(e, (s, o) => {
n && A(s) ? t[o] = st(s, n) : t[o] = s;
}, { allOwnKeys: r }), t), cn = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), ln = (t, e, n, r) => {
t.prototype = Object.create(e.prototype, r), t.prototype.constructor = t, Object.defineProperty(t, "super", {
value: e.prototype
}), n && Object.assign(t.prototype, n);
}, un = (t, e, n, r) => {
let s, o, i;
const a = {};
if (e = e || {}, t == null) return e;
do {
for (s = Object.getOwnPropertyNames(t), o = s.length; o-- > 0; )
i = s[o], (!r || r(i, t, e)) && !a[i] && (e[i] = t[i], a[i] = !0);
t = n !== !1 && Ce(t);
} while (t && (!n || n(t, e)) && t !== Object.prototype);
return e;
}, fn = (t, e, n) => {
t = String(t), (n === void 0 || n > t.length) && (n = t.length), n -= e.length;
const r = t.indexOf(e, n);
return r !== -1 && r === n;
}, dn = (t) => {
if (!t) return null;
if (H(t)) return t;
let e = t.length;
if (!at(e)) return null;
const n = new Array(e);
for (; e-- > 0; )
n[e] = t[e];
return n;
}, pn = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Ce(Uint8Array)), hn = (t, e) => {
const r = (t && t[ce]).call(t);
let s;
for (; (s = r.next()) && !s.done; ) {
const o = s.value;
e.call(t, o[0], o[1]);
}
}, mn = (t, e) => {
let n;
const r = [];
for (; (n = t.exec(e)) !== null; )
r.push(n);
return r;
}, gn = L("HTMLFormElement"), yn = (t) => t.toLowerCase().replace(
/[-_\s]([a-z\d])(\w*)/g,
function(n, r, s) {
return r.toUpperCase() + s;
}
), Be = (({ hasOwnProperty: t }) => (e, n) => t.call(e, n))(Object.prototype), wn = L("RegExp"), ut = (t, e) => {
const n = Object.getOwnPropertyDescriptors(t), r = {};
Q(n, (s, o) => {
let i;
(i = e(s, o, t)) !== !1 && (r[o] = i || s);
}), Object.defineProperties(t, r);
}, bn = (t) => {
ut(t, (e, n) => {
if (A(t) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
return !1;
const r = t[n];
if (A(r)) {
if (e.enumerable = !1, "writable" in e) {
e.writable = !1;
return;
}
e.set || (e.set = () => {
throw Error("Can not rewrite read-only method '" + n + "'");
});
}
});
}, En = (t, e) => {
const n = {}, r = (s) => {
s.forEach((o) => {
n[o] = !0;
});
};
return H(t) ? r(t) : r(String(t).split(e)), n;
}, Sn = () => {
}, Rn = (t, e) => t != null && Number.isFinite(t = +t) ? t : e;
function On(t) {
return !!(t && A(t.append) && t[ot] === "FormData" && t[ce]);
}
const Tn = (t) => {
const e = new Array(10), n = (r, s) => {
if (G(r)) {
if (e.indexOf(r) >= 0)
return;
if (X(r))
return r;
if (!("toJSON" in r)) {
e[s] = r;
const o = H(r) ? [] : {};
return Q(r, (i, a) => {
const f = n(i, s + 1);
!q(f) && (o[a] = f);
}), e[s] = void 0, o;
}
}
return r;
};
return n(t, 0);
}, An = L("AsyncFunction"), xn = (t) => t && (G(t) || A(t)) && A(t.then) && A(t.catch), ft = ((t, e) => t ? setImmediate : e ? ((n, r) => (v.addEventListener("message", ({ source: s, data: o }) => {
s === v && o === n && r.length && r.shift()();
}, !1), (s) => {
r.push(s), v.postMessage(n, "*");
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
typeof setImmediate == "function",
A(v.postMessage)
), Cn = typeof queueMicrotask < "u" ? queueMicrotask.bind(v) : typeof process < "u" && process.nextTick || ft, _n = (t) => t != null && A(t[ce]), c = {
isArray: H,
isArrayBuffer: it,
isBuffer: X,
isFormData: Zt,
isArrayBufferView: Jt,
isString: zt,
isNumber: at,
isBoolean: Wt,
isObject: G,
isPlainObject: se,
isEmptyObject: Vt,
isReadableStream: tn,
isRequest: nn,
isResponse: rn,
isHeaders: sn,
isUndefined: q,
isDate: Kt,
isFile: Xt,
isBlob: Gt,
isRegExp: wn,
isFunction: A,
isStream: Yt,
isURLSearchParams: en,
isTypedArray: pn,
isFileList: Qt,
forEach: Q,
merge: Se,
extend: an,
trim: on,
stripBOM: cn,
inherits: ln,
toFlatObject: un,
kindOf: le,
kindOfTest: L,
endsWith: fn,
toArray: dn,
forEachEntry: hn,
matchAll: mn,
isHTMLForm: gn,
hasOwnProperty: Be,
hasOwnProp: Be,
// an alias to avoid ESLint no-prototype-builtins detection
reduceDescriptors: ut,
freezeMethods: bn,
toObjectSet: En,
toCamelCase: yn,
noop: Sn,
toFiniteNumber: Rn,
findKey: ct,
global: v,
isContextDefined: lt,
isSpecCompliantForm: On,
toJSONObject: Tn,
isAsyncFn: An,
isThenable: xn,
setImmediate: ft,
asap: Cn,
isIterable: _n
};
function g(t, e, n, r, s) {
Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = t, this.name = "AxiosError", e && (this.code = e), n && (this.config = n), r && (this.request = r), s && (this.response = s, this.status = s.status ? s.status : null);
}
c.inherits(g, Error, {
toJSON: function() {
return {
// Standard
message: this.message,
name: this.name,
// Microsoft
description: this.description,
number: this.number,
// Mozilla
fileName: this.fileName,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
stack: this.stack,
// Axios
config: c.toJSONObject(this.config),
code: this.code,
status: this.status
};
}
});
const dt = g.prototype, pt = {};
[
"ERR_BAD_OPTION_VALUE",
"ERR_BAD_OPTION",
"ECONNABORTED",
"ETIMEDOUT",
"ERR_NETWORK",
"ERR_FR_TOO_MANY_REDIRECTS",
"ERR_DEPRECATED",
"ERR_BAD_RESPONSE",
"ERR_BAD_REQUEST",
"ERR_CANCELED",
"ERR_NOT_SUPPORT",
"ERR_INVALID_URL"
// eslint-disable-next-line func-names
].forEach((t) => {
pt[t] = { value: t };
});
Object.defineProperties(g, pt);
Object.defineProperty(dt, "isAxiosError", { value: !0 });
g.from = (t, e, n, r, s, o) => {
const i = Object.create(dt);
c.toFlatObject(t, i, function(l) {
return l !== Error.prototype;
}, (u) => u !== "isAxiosError");
const a = t && t.message ? t.message : "Error", f = e == null && t ? t.code : e;
return g.call(i, a, f, n, r, s), t && i.cause == null && Object.defineProperty(i, "cause", { value: t, configurable: !0 }), i.name = t && t.name || "Error", o && Object.assign(i, o), i;
};
const Pn = null;
function Re(t) {
return c.isPlainObject(t) || c.isArray(t);
}
function ht(t) {
return c.endsWith(t, "[]") ? t.slice(0, -2) : t;
}
function Ie(t, e, n) {
return t ? t.concat(e).map(function(s, o) {
return s = ht(s), !n && o ? "[" + s + "]" : s;
}).join(n ? "." : "") : e;
}
function Ln(t) {
return c.isArray(t) && !t.some(Re);
}
const Un = c.toFlatObject(c, {}, null, function(e) {
return /^is[A-Z]/.test(e);
});
function fe(t, e, n) {
if (!c.isObject(t))
throw new TypeError("target must be an object");
e = e || new FormData(), n = c.toFlatObject(n, {
metaTokens: !0,
dots: !1,
indexes: !1
}, !1, function(m, h) {
return !c.isUndefined(h[m]);
});
const r = n.metaTokens, s = n.visitor || l, o = n.dots, i = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && c.isSpecCompliantForm(e);
if (!c.isFunction(s))
throw new TypeError("visitor must be a function");
function u(d) {
if (d === null) return "";
if (c.isDate(d))
return d.toISOString();
if (c.isBoolean(d))
return d.toString();
if (!f && c.isBlob(d))
throw new g("Blob is not supported. Use a Buffer instead.");
return c.isArrayBuffer(d) || c.isTypedArray(d) ? f && typeof Blob == "function" ? new Blob([d]) : Buffer.from(d) : d;
}
function l(d, m, h) {
let w = d;
if (d && !h && typeof d == "object") {
if (c.endsWith(m, "{}"))
m = r ? m : m.slice(0, -2), d = JSON.stringify(d);
else if (c.isArray(d) && Ln(d) || (c.isFileList(d) || c.endsWith(m, "[]")) && (w = c.toArray(d)))
return m = ht(m), w.forEach(function(b, O) {
!(c.isUndefined(b) || b === null) && e.append(
// eslint-disable-next-line no-nested-ternary
i === !0 ? Ie([m], O, o) : i === null ? m : m + "[]",
u(b)
);
}), !1;
}
return Re(d) ? !0 : (e.append(Ie(h, m, o), u(d)), !1);
}
const p = [], y = Object.assign(Un, {
defaultVisitor: l,
convertValue: u,
isVisitable: Re
});
function E(d, m) {
if (!c.isUndefined(d)) {
if (p.indexOf(d) !== -1)
throw Error("Circular reference detected in " + m.join("."));
p.push(d), c.forEach(d, function(w, R) {
(!(c.isUndefined(w) || w === null) && s.call(
e,
w,
c.isString(R) ? R.trim() : R,
m,
y
)) === !0 && E(w, m ? m.concat(R) : [R]);
}), p.pop();
}
}
if (!c.isObject(t))
throw new TypeError("data must be an object");
return E(t), e;
}
function Me(t) {
const e = {
"!": "%21",
"'": "%27",
"(": "%28",
")": "%29",
"~": "%7E",
"%20": "+",
"%00": "\0"
};
return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(r) {
return e[r];
});
}
function _e(t, e) {
this._pairs = [], t && fe(t, this, e);
}
const mt = _e.prototype;
mt.append = function(e, n) {
this._pairs.push([e, n]);
};
mt.toString = function(e) {
const n = e ? function(r) {
return e.call(this, r, Me);
} : Me;
return this._pairs.map(function(s) {
return n(s[0]) + "=" + n(s[1]);
}, "").join("&");
};
function kn(t) {
return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
}
function gt(t, e, n) {
if (!e)
return t;
const r = n && n.encode || kn;
c.isFunction(n) && (n = {
serialize: n
});
const s = n && n.serialize;
let o;
if (s ? o = s(e, n) : o = c.isURLSearchParams(e) ? e.toString() : new _e(e, n).toString(r), o) {
const i = t.indexOf("#");
i !== -1 && (t = t.slice(0, i)), t += (t.indexOf("?") === -1 ? "?" : "&") + o;
}
return t;
}
class qe {
constructor() {
this.handlers = [];
}
/**
* Add a new interceptor to the stack
*
* @param {Function} fulfilled The function to handle `then` for a `Promise`
* @param {Function} rejected The function to handle `reject` for a `Promise`
*
* @return {Number} An ID used to remove interceptor later
*/
use(e, n, r) {
return this.handlers.push({
fulfilled: e,
rejected: n,
synchronous: r ? r.synchronous : !1,
runWhen: r ? r.runWhen : null
}), this.handlers.length - 1;
}
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*
* @returns {void}
*/
eject(e) {
this.handlers[e] && (this.handlers[e] = null);
}
/**
* Clear all interceptors from the stack
*
* @returns {void}
*/
clear() {
this.handlers && (this.handlers = []);
}
/**
* Iterate over all the registered interceptors
*
* This method is particularly useful for skipping over any
* interceptors that may have become `null` calling `eject`.
*
* @param {Function} fn The function to call for each interceptor
*
* @returns {void}
*/
forEach(e) {
c.forEach(this.handlers, function(r) {
r !== null && e(r);
});
}
}
const yt = {
silentJSONParsing: !0,
forcedJSONParsing: !0,
clarifyTimeoutError: !1
}, Fn = typeof URLSearchParams < "u" ? URLSearchParams : _e, jn = typeof FormData < "u" ? FormData : null, Nn = typeof Blob < "u" ? Blob : null, Dn = {
isBrowser: !0,
classes: {
URLSearchParams: Fn,
FormData: jn,
Blob: Nn
},
protocols: ["http", "https", "file", "blob", "url", "data"]
}, Pe = typeof window < "u" && typeof document < "u", Oe = typeof navigator == "object" && navigator || void 0, vn = Pe && (!Oe || ["ReactNative", "NativeScript", "NS"].indexOf(Oe.product) < 0), Bn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", In = Pe && window.location.href || "http://localhost", Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
hasBrowserEnv: Pe,
hasStandardBrowserEnv: vn,
hasStandardBrowserWebWorkerEnv: Bn,
navigator: Oe,
origin: In
}, Symbol.toStringTag, { value: "Module" })), T = {
...Mn,
...Dn
};
function qn(t, e) {
return fe(t, new T.classes.URLSearchParams(), {
visitor: function(n, r, s, o) {
return T.isNode && c.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
},
...e
});
}
function Hn(t) {
return c.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
}
function $n(t) {
const e = {}, n = Object.keys(t);
let r;
const s = n.length;
let o;
for (r = 0; r < s; r++)
o = n[r], e[o] = t[o];
return e;
}
function wt(t) {
function e(n, r, s, o) {
let i = n[o++];
if (i === "__proto__") return !0;
const a = Number.isFinite(+i), f = o >= n.length;
return i = !i && c.isArray(s) ? s.length : i, f ? (c.hasOwnProp(s, i) ? s[i] = [s[i], r] : s[i] = r, !a) : ((!s[i] || !c.isObject(s[i])) && (s[i] = []), e(n, r, s[i], o) && c.isArray(s[i]) && (s[i] = $n(s[i])), !a);
}
if (c.isFormData(t) && c.isFunction(t.entries)) {
const n = {};
return c.forEachEntry(t, (r, s) => {
e(Hn(r), s, n, 0);
}), n;
}
return null;
}
function Jn(t, e, n) {
if (c.isString(t))
try {
return (e || JSON.parse)(t), c.trim(t);
} catch (r) {
if (r.name !== "SyntaxError")
throw r;
}
return (n || JSON.stringify)(t);
}
const Y = {
transitional: yt,
adapter: ["xhr", "http", "fetch"],
transformRequest: [function(e, n) {
const r = n.getContentType() || "", s = r.indexOf("application/json") > -1, o = c.isObject(e);
if (o && c.isHTMLForm(e) && (e = new FormData(e)), c.isFormData(e))
return s ? JSON.stringify(wt(e)) : e;
if (c.isArrayBuffer(e) || c.isBuffer(e) || c.isStream(e) || c.isFile(e) || c.isBlob(e) || c.isReadableStream(e))
return e;
if (c.isArrayBufferView(e))
return e.buffer;
if (c.isURLSearchParams(e))
return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
let a;
if (o) {
if (r.indexOf("application/x-www-form-urlencoded") > -1)
return qn(e, this.formSerializer).toString();
if ((a = c.isFileList(e)) || r.indexOf("multipart/form-data") > -1) {
const f = this.env && this.env.FormData;
return fe(
a ? { "files[]": e } : e,
f && new f(),
this.formSerializer
);
}
}
return o || s ? (n.setContentType("application/json", !1), Jn(e)) : e;
}],
transformResponse: [function(e) {
const n = this.transitional || Y.transitional, r = n && n.forcedJSONParsing, s = this.responseType === "json";
if (c.isResponse(e) || c.isReadableStream(e))
return e;
if (e && c.isString(e) && (r && !this.responseType || s)) {
const i = !(n && n.silentJSONParsing) && s;
try {
return JSON.parse(e, this.parseReviver);
} catch (a) {
if (i)
throw a.name === "SyntaxError" ? g.from(a, g.ERR_BAD_RESPONSE, this, null, this.response) : a;
}
}
return e;
}],
/**
* A timeout in milliseconds to abort a request. If set to 0 (default) a
* timeout is not created.
*/
timeout: 0,
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN",
maxContentLength: -1,
maxBodyLength: -1,
env: {
FormData: T.classes.FormData,
Blob: T.classes.Blob
},
validateStatus: function(e) {
return e >= 200 && e < 300;
},
headers: {
common: {
Accept: "application/json, text/plain, */*",
"Content-Type": void 0
}
}
};
c.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
Y.headers[t] = {};
});
const zn = c.toObjectSet([
"age",
"authorization",
"content-length",
"content-type",
"etag",
"expires",
"from",
"host",
"if-modified-since",
"if-unmodified-since",
"last-modified",
"location",
"max-forwards",
"proxy-authorization",
"referer",
"retry-after",
"user-agent"
]), Wn = (t) => {
const e = {};
let n, r, s;
return t && t.split(`
`).forEach(function(i) {
s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || e[n] && zn[n]) && (n === "set-cookie" ? e[n] ? e[n].push(r) : e[n] = [r] : e[n] = e[n] ? e[n] + ", " + r : r);
}), e;
}, He = Symbol("internals");
function z(t) {
return t && String(t).trim().toLowerCase();
}
function oe(t) {
return t === !1 || t == null ? t : c.isArray(t) ? t.map(oe) : String(t);
}
function Vn(t) {
const e = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
let r;
for (; r = n.exec(t); )
e[r[1]] = r[2];
return e;
}
const Kn = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
function ye(t, e, n, r, s) {
if (c.isFunction(r))
return r.call(this, e, n);
if (s && (e = n), !!c.isString(e)) {
if (c.isString(r))
return e.indexOf(r) !== -1;
if (c.isRegExp(r))
return r.test(e);
}
}
function Xn(t) {
return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, n, r) => n.toUpperCase() + r);
}
function Gn(t, e) {
const n = c.toCamelCase(" " + e);
["get", "set", "has"].forEach((r) => {
Object.defineProperty(t, r + n, {
value: function(s, o, i) {
return this[r].call(this, e, s, o, i);
},
configurable: !0
});
});
}
let x = class {
constructor(e) {
e && this.set(e);
}
set(e, n, r) {
const s = this;
function o(a, f, u) {
const l = z(f);
if (!l)
throw new Error("header name must be a non-empty string");
const p = c.findKey(s, l);
(!p || s[p] === void 0 || u === !0 || u === void 0 && s[p] !== !1) && (s[p || f] = oe(a));
}
const i = (a, f) => c.forEach(a, (u, l) => o(u, l, f));
if (c.isPlainObject(e) || e instanceof this.constructor)
i(e, n);
else if (c.isString(e) && (e = e.trim()) && !Kn(e))
i(Wn(e), n);
else if (c.isObject(e) && c.isIterable(e)) {
let a = {}, f, u;
for (const l of e) {
if (!c.isArray(l))
throw TypeError("Object iterator must return a key-value pair");
a[u = l[0]] = (f = a[u]) ? c.isArray(f) ? [...f, l[1]] : [f, l[1]] : l[1];
}
i(a, n);
} else
e != null && o(n, e, r);
return this;
}
get(e, n) {
if (e = z(e), e) {
const r = c.findKey(this, e);
if (r) {
const s = this[r];
if (!n)
return s;
if (n === !0)
return Vn(s);
if (c.isFunction(n))
return n.call(this, s, r);
if (c.isRegExp(n))
return n.exec(s);
throw new TypeError("parser must be boolean|regexp|function");
}
}
}
has(e, n) {
if (e = z(e), e) {
const r = c.findKey(this, e);
return !!(r && this[r] !== void 0 && (!n || ye(this, this[r], r, n)));
}
return !1;
}
delete(e, n) {
const r = this;
let s = !1;
function o(i) {
if (i = z(i), i) {
const a = c.findKey(r, i);
a && (!n || ye(r, r[a], a, n)) && (delete r[a], s = !0);
}
}
return c.isArray(e) ? e.forEach(o) : o(e), s;
}
clear(e) {
const n = Object.keys(this);
let r = n.length, s = !1;
for (; r--; ) {
const o = n[r];
(!e || ye(this, this[o], o, e, !0)) && (delete this[o], s = !0);
}
return s;
}
normalize(e) {
const n = this, r = {};
return c.forEach(this, (s, o) => {
const i = c.findKey(r, o);
if (i) {
n[i] = oe(s), delete n[o];
return;
}
const a = e ? Xn(o) : String(o).trim();
a !== o && delete n[o], n[a] = oe(s), r[a] = !0;
}), this;
}
concat(...e) {
return this.constructor.concat(this, ...e);
}
toJSON(e) {
const n = /* @__PURE__ */ Object.create(null);
return c.forEach(this, (r, s) => {
r != null && r !== !1 && (n[s] = e && c.isArray(r) ? r.join(", ") : r);
}), n;
}
[Symbol.iterator]() {
return Object.entries(this.toJSON())[Symbol.iterator]();
}
toString() {
return Object.entries(this.toJSON()).map(([e, n]) => e + ": " + n).join(`
`);
}
getSetCookie() {
return this.get("set-cookie") || [];
}
get [Symbol.toStringTag]() {
return "AxiosHeaders";
}
static from(e) {
return e instanceof this ? e : new this(e);
}
static concat(e, ...n) {
const r = new this(e);
return n.forEach((s) => r.set(s)), r;
}
static accessor(e) {
const r = (this[He] = this[He] = {
accessors: {}
}).accessors, s = this.prototype;
function o(i) {
const a = z(i);
r[a] || (Gn(s, i), r[a] = !0);
}
return c.isArray(e) ? e.forEach(o) : o(e), this;
}
};
x.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
c.reduceDescriptors(x.prototype, ({ value: t }, e) => {
let n = e[0].toUpperCase() + e.slice(1);
return {
get: () => t,
set(r) {
this[n] = r;
}
};
});
c.freezeMethods(x);
function we(t, e) {
const n = this || Y, r = e || n, s = x.from(r.headers);
let o = r.data;
return c.forEach(t, function(a) {
o = a.call(n, o, s.normalize(), e ? e.status : void 0);
}), s.normalize(), o;
}
function bt(t) {
return !!(t && t.__CANCEL__);
}
function $(t, e, n) {
g.call(this, t ?? "canceled", g.ERR_CANCELED, e, n), this.name = "CanceledError";
}
c.inherits($, g, {
__CANCEL__: !0
});
function Et(t, e, n) {
const r = n.config.validateStatus;
!n.status || !r || r(n.status) ? t(n) : e(new g(
"Request failed with status code " + n.status,
[g.ERR_BAD_REQUEST, g.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
n.config,
n.request,
n
));
}
function Qn(t) {
const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
return e && e[1] || "";
}
function Yn(t, e) {
t = t || 10;
const n = new Array(t), r = new Array(t);
let s = 0, o = 0, i;
return e = e !== void 0 ? e : 1e3, function(f) {
const u = Date.now(), l = r[o];
i || (i = u), n[s] = f, r[s] = u;
let p = o, y = 0;
for (; p !== s; )
y += n[p++], p = p % t;
if (s = (s + 1) % t, s === o && (o = (o + 1) % t), u - i < e)
return;
const E = l && u - l;
return E ? Math.round(y * 1e3 / E) : void 0;
};
}
function Zn(t, e) {
let n = 0, r = 1e3 / e, s, o;
const i = (u, l = Date.now()) => {
n = l, s = null, o && (clearTimeout(o), o = null), t(...u);
};
return [(...u) => {
const l = Date.now(), p = l - n;
p >= r ? i(u, l) : (s = u, o || (o = setTimeout(() => {
o = null, i(s);
}, r - p)));
}, () => s && i(s)];
}
const ae = (t, e, n = 3) => {
let r = 0;
const s = Yn(50, 250);
return Zn((o) => {
const i = o.loaded, a = o.lengthComputable ? o.total : void 0, f = i - r, u = s(f), l = i <= a;
r = i;
const p = {
loaded: i,
total: a,
progress: a ? i / a : void 0,
bytes: f,
rate: u || void 0,
estimated: u && a && l ? (a - i) / u : void 0,
event: o,
lengthComputable: a != null,
[e ? "download" : "upload"]: !0
};
t(p);
}, n);
}, $e = (t, e) => {
const n = t != null;
return [(r) => e[0]({
lengthComputable: n,
total: t,
loaded: r
}), e[1]];
}, Je = (t) => (...e) => c.asap(() => t(...e)), er = T.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (n) => (n = new URL(n, T.origin), t.protocol === n.protocol && t.host === n.host && (e || t.port === n.port)))(
new URL(T.origin),
T.navigator && /(msie|trident)/i.test(T.navigator.userAgent)
) : () => !0, tr = T.hasStandardBrowserEnv ? (
// Standard browser envs support document.cookie
{
write(t, e, n, r, s, o, i) {
if (typeof document > "u") return;
const a = [`${t}=${encodeURIComponent(e)}`];
c.isNumber(n) && a.push(`expires=${new Date(n).toUTCString()}`), c.isString(r) && a.push(`path=${r}`), c.isString(s) && a.push(`domain=${s}`), o === !0 && a.push("secure"), c.isString(i) && a.push(`SameSite=${i}`), document.cookie = a.join("; ");
},
read(t) {
if (typeof document > "u") return null;
const e = document.cookie.match(new RegExp("(?:^|; )" + t + "=([^;]*)"));
return e ? decodeURIComponent(e[1]) : null;
},
remove(t) {
this.write(t, "", Date.now() - 864e5, "/");
}
}
) : (
// Non-standard browser env (web workers, react-native) lack needed support.
{
write() {
},
read() {
return null;
},
remove() {
}
}
);
function nr(t) {
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
}
function rr(t, e) {
return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
}
function St(t, e, n) {
let r = !nr(e);
return t && (r || n == !1) ? rr(t, e) : e;
}
const ze = (t) => t instanceof x ? { ...t } : t;
function I(t, e) {
e = e || {};
const n = {};
function r(u, l, p, y) {
return c.isPlainObject(u) && c.isPlainObject(l) ? c.merge.call({ caseless: y }, u, l) : c.isPlainObject(l) ? c.merge({}, l) : c.isArray(l) ? l.slice() : l;
}
function s(u, l, p, y) {
if (c.isUndefined(l)) {
if (!c.isUndefined(u))
return r(void 0, u, p, y);
} else return r(u, l, p, y);
}
function o(u, l) {
if (!c.isUndefined(l))
return r(void 0, l);
}
function i(u, l) {
if (c.isUndefined(l)) {
if (!c.isUndefined(u))
return r(void 0, u);
} else return r(void 0, l);
}
function a(u, l, p) {
if (p in e)
return r(u, l);
if (p in t)
return r(void 0, u);
}
const f = {
url: o,
method: o,
data: o,
baseURL: i,
transformRequest: i,
transformResponse: i,
paramsSerializer: i,
timeout: i,
timeoutMessage: i,
withCredentials: i,
withXSRFToken: i,
adapter: i,
responseType: i,
xsrfCookieName: i,
xsrfHeaderName: i,
onUploadProgress: i,
onDownloadProgress: i,
decompress: i,
maxContentLength: i,
maxBodyLength: i,
beforeRedirect: i,
transport: i,
httpAgent: i,
httpsAgent: i,
cancelToken: i,
socketPath: i,
responseEncoding: i,
validateStatus: a,
headers: (u, l, p) => s(ze(u), ze(l), p, !0)
};
return c.forEach(Object.keys({ ...t, ...e }), function(l) {
const p = f[l] || s, y = p(t[l], e[l], l);
c.isUndefined(y) && p !== a || (n[l] = y);
}), n;
}
const Rt = (t) => {
const e = I({}, t);
let { data: n, withXSRFToken: r, xsrfHeaderName: s, xsrfCookieName: o, headers: i, auth: a } = e;
if (e.headers = i = x.from(i), e.url = gt(St(e.baseURL, e.url, e.allowAbsoluteUrls), t.params, t.paramsSerializer), a && i.set(
"Authorization",
"Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))
), c.isFormData(n)) {
if (T.hasStandardBrowserEnv || T.hasStandardBrowserWebWorkerEnv)
i.setContentType(void 0);
else if (c.isFunction(n.getHeaders)) {
const f = n.getHeaders(), u = ["content-type", "content-length"];
Object.entries(f).forEach(([l, p]) => {
u.includes(l.toLowerCase()) && i.set(l, p);
});
}
}
if (T.hasStandardBrowserEnv && (r && c.isFunction(r) && (r = r(e)), r || r !== !1 && er(e.url))) {
const f = s && o && tr.read(o);
f && i.set(s, f);
}
return e;
}, sr = typeof XMLHttpRequest < "u", or = sr && function(t) {
return new Promise(function(n, r) {
const s = Rt(t);
let o = s.data;
const i = x.from(s.headers).normalize();
let { responseType: a, onUploadProgress: f, onDownloadProgress: u } = s, l, p, y, E, d;
function m() {
E && E(), d && d(), s.cancelToken && s.cancelToken.unsubscribe(l), s.signal && s.signal.removeEventListener("abort", l);
}
let h = new XMLHttpRequest();
h.open(s.method.toUpperCase(), s.url, !0), h.timeout = s.timeout;
function w() {
if (!h)
return;
const b = x.from(
"getAllResponseHeaders" in h && h.getAllResponseHeaders()
), _ = {
data: !a || a === "text" || a === "json" ? h.responseText : h.response,
status: h.status,
statusText: h.statusText,
headers: b,
config: t,
request: h
};
Et(function(P) {
n(P), m();
}, function(P) {
r(P), m();
}, _), h = null;
}
"onloadend" in h ? h.onloadend = w : h.onreadystatechange = function() {
!h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(w);
}, h.onabort = function() {
h && (r(new g("Request aborted", g.ECONNABORTED, t, h)), h = null);
}, h.onerror = function(O) {
const _ = O && O.message ? O.message : "Network Error", N = new g(_, g.ERR_NETWORK, t, h);
N.event = O || null, r(N), h = null;
}, h.ontimeout = function() {
let O = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
const _ = s.transitional || yt;
s.timeoutErrorMessage && (O = s.timeoutErrorMessage), r(new g(
O,
_.clarifyTimeoutError ? g.ETIMEDOUT : g.ECONNABORTED,
t,
h
)), h = null;
}, o === void 0 && i.setContentType(null), "setRequestHeader" in h && c.forEach(i.toJSON(), function(O, _) {
h.setRequestHeader(_, O);
}), c.isUndefined(s.withCredentials) || (h.withCredentials = !!s.withCredentials), a && a !== "json" && (h.responseType = s.responseType), u && ([y, d] = ae(u, !0), h.addEventListener("progress", y)), f && h.upload && ([p, E] = ae(f), h.upload.addEventListener("progress", p), h.upload.addEventListener("loadend", E)), (s.cancelToken || s.signal) && (l = (b) => {
h && (r(!b || b.type ? new $(null, t, h) : b), h.abort(), h = null);
}, s.cancelToken && s.cancelToken.subscribe(l), s.signal && (s.signal.aborted ? l() : s.signal.addEventListener("abort", l)));
const R = Qn(s.url);
if (R && T.protocols.indexOf(R) === -1) {
r(new g("Unsupported protocol " + R + ":", g.ERR_BAD_REQUEST, t));
return;
}
h.send(o || null);
});
}, ir = (t, e) => {
const { length: n } = t = t ? t.filter(Boolean) : [];
if (e || n) {
let r = new AbortController(), s;
const o = function(u) {
if (!s) {
s = !0, a();
const l = u instanceof Error ? u : this.reason;
r.abort(l instanceof g ? l : new $(l instanceof Error ? l.message : l));
}
};
let i = e && setTimeout(() => {
i = null, o(new g(`timeout ${e} of ms exceeded`, g.ETIMEDOUT));
}, e);
const a = () => {
t && (i && clearTimeout(i), i = null, t.forEach((u) => {
u.unsubscribe ? u.unsubscribe(o) : u.removeEventListener("abort", o);
}), t = null);
};
t.forEach((u) => u.addEventListener("abort", o));
const { signal: f } = r;
return f.unsubscribe = () => c.asap(a), f;
}
}, ar = function* (t, e) {
let n = t.byteLength;
if (n < e) {
yield t;
return;
}
let r = 0, s;
for (; r < n; )
s = r + e, yield t.slice(r, s), r = s;
}, cr = async function* (t, e) {
for await (const n of lr(t))
yield* ar(n, e);
}, lr = async function* (t) {
if (t[Symbol.asyncIterator]) {
yield* t;
return;
}
const e = t.getReader();
try {
for (; ; ) {
const { done: n, value: r } = await e.read();
if (n)
break;
yield r;
}
} finally {
await e.cancel();
}
}, We = (t, e, n, r) => {
const s = cr(t, e);
let o = 0, i, a = (f) => {
i || (i = !0, r && r(f));
};
return new ReadableStream({
async pull(f) {
try {
const { done: u, value: l } = await s.next();
if (u) {
a(), f.close();
return;
}
let p = l.byteLength;
if (n) {
let y = o += p;
n(y);
}
f.enqueue(new Uint8Array(l));
} catch (u) {
throw a(u), u;
}
},
cancel(f) {
return a(f), s.return();
}
}, {
highWaterMark: 2
});
}, Ve = 64 * 1024, { isFunction: ne } = c, ur = (({ Request: t, Response: e }) => ({
Request: t,
Response: e
}))(c.global), {
ReadableStream: Ke,
TextEncoder: Xe
} = c.global, Ge = (t, ...e) => {
try {
return !!t(...e);
} catch {
return !1;
}
}, fr = (t) => {
t = c.merge.call({
skipUndefined: !0
}, ur, t);
const { fetch: e, Request: n, Response: r } = t, s = e ? ne(e) : typeof fetch == "function", o = ne(n), i = ne(r);
if (!s)
return !1;
const a = s && ne(Ke), f = s && (typeof Xe == "function" ? /* @__PURE__ */ ((d) => (m) => d.encode(m))(new Xe()) : async (d) => new Uint8Array(await new n(d).arrayBuffer())), u = o && a && Ge(() => {
let d = !1;
const m = new n(T.origin, {
body: new Ke(),
method: "POST",
get duplex() {
return d = !0, "half";
}
}).headers.has("Content-Type");
return d && !m;
}), l = i && a && Ge(() => c.isReadableStream(new r("").body)), p = {
stream: l && ((d) => d.body)
};
s && ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((d) => {
!p[d] && (p[d] = (m, h) => {
let w = m && m[d];
if (w)
return w.call(m);
throw new g(`Response type '${d}' is not supported`, g.ERR_NOT_SUPPORT, h);
});
});
const y = async (d) => {
if (d == null)
return 0;
if (c.isBlob(d))
return d.size;
if (c.isSpecCompliantForm(d))
return (await new n(T.origin, {
method: "POST",
body: d
}).arrayBuffer()).byteLength;
if (c.isArrayBufferView(d) || c.isArrayBuffer(d))
return d.byteLength;
if (c.isURLSearchParams(d) && (d = d + ""), c.isString(d))
return (await f(d)).byteLength;
}, E = async (d, m) => {
const h = c.toFiniteNumber(d.getContentLength());
return h ?? y(m);
};
return async (d) => {
let {
url: m,
method: h,
data: w,
signal: R,
cancelToken: b,
timeout: O,
onDownloadProgress: _,
onUploadProgress: N,
responseType: P,
headers: pe,
withCredentials: Z = "same-origin",
fetchOptions: ke
} = Rt(d), Fe = e || fetch;
P = P ? (P + "").toLowerCase() : "text";
let ee = ir([R, b && b.toAbortSignal()], O), J = null;
const D = ee && ee.unsubscribe && (() => {
ee.unsubscribe();
});
let je;
try {
if (N && u && h !== "get" && h !== "head" && (je = await E(pe, w)) !== 0) {
let j = new n(m, {
method: "POST",
body: w,
duplex: "half"
}), M;
if (c.isFormData(w) && (M = j.headers.get("content-type")) && pe.setContentType(M), j.body) {
const [he, te] = $e(
je,
ae(Je(N))
);
w = We(j.body, Ve, he, te);
}
}
c.isString(Z) || (Z = Z ? "include" : "omit");
const U = o && "credentials" in n.prototype, Ne = {
...ke,
signal: ee,
method: h.toUpperCase(),
headers: pe.normalize().toJSON(),
body: w,
duplex: "half",
credentials: U ? Z : void 0
};
J = o && new n(m, Ne);
let F = await (o ? Fe(J, ke) : Fe(m, Ne));
const De = l && (P === "stream" || P === "response");
if (l && (_ || De && D)) {
const j = {};
["status", "statusText", "headers"].forEach((ve) => {
j[ve] = F[ve];
});
const M = c.toFiniteNumber(F.headers.get("content-length")), [he, te] = _ && $e(
M,
ae(Je(_), !0)
) || [];
F = new r(
We(F.body, Ve, he, () => {
te && te(), D && D();
}),
j
);
}
P = P || "text";
let Ft = await p[c.findKey(p, P) || "text"](F, d);
return !De && D && D(), await new Promise((j, M) => {
Et(j, M, {
data: Ft,
headers: x.from(F.headers),
status: F.status,
statusText: F.statusText,
config: d,
request: J
});
});
} catch (U) {
throw D && D(), U && U.name === "TypeError" && /Load failed|fetch/i.test(U.message) ? Object.assign(
new g("Network Error", g.ERR_NETWORK, d, J),
{
cause: U.cause || U
}
) : g.from(U, U && U.code, d, J);
}
};
}, dr = /* @__PURE__ */ new Map(), Ot = (t) => {
let e = t && t.env || {};
const { fetch: n, Request: r, Response: s } = e, o = [
r,
s,
n
];
let i = o.length, a = i, f, u, l = dr;
for (; a--; )
f = o[a], u = l.get(f), u === void 0 && l.set(f, u = a ? /* @__PURE__ */ new Map() : fr(e)), l = u;
return u;
};
Ot();
const Le = {
http: Pn,
xhr: or,
fetch: {
get: Ot
}
};
c.forEach(Le, (t, e) => {
if (t) {
try {
Object.defineProperty(t, "name", { value: e });
} catch {
}
Object.defineProperty(t, "adapterName", { value: e });
}
});
const Qe = (t) => `- ${t}`, pr = (t) => c.isFunction(t) || t === null || t === !1;
function hr(t, e) {
t = c.isArray(t) ? t : [t];
const { length: n } = t;
let r, s;
const o = {};
for (let i = 0; i < n; i++) {
r = t[i];
let a;
if (s = r, !pr(r) && (s = Le[(a = String(r)).toLowerCase()], s === void 0))
throw new g(`Unknown adapter '${a}'`);
if (s && (c.isFunction(s) || (s = s.get(e))))
break;
o[a || "#" + i] = s;
}
if (!s) {
const i = Object.entries(o).map(
([f, u]) => `adapter ${f} ` + (u === !1 ? "is not supported by the environment" : "is not available in the build")
);
let a = n ? i.length > 1 ? `since :
` + i.map(Qe).join(`
`) : " " + Qe(i[0]) : "as no adapter specified";
throw new g(
"There is no suitable adapter to dispatch the request " + a,
"ERR_NOT_SUPPORT"
);
}
return s;
}
const Tt = {
/**
* Resolve an adapter from a list of adapter names or functions.
* @type {Function}
*/
getAdapter: hr,
/**
* Exposes all known adapters
* @type {Object<string, Function|Object>}
*/
adapters: Le
};
function be(t) {
if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
throw new $(null, t);
}
function Ye(t) {
return be(t), t.headers = x.from(t.headers), t.data = we.call(
t,
t.transformRequest
), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), Tt.getAdapter(t.adapter || Y.adapter, t)(t).then(function(r) {
return be(t), r.data = we.call(
t,
t.transformResponse,
r
), r.headers = x.from(r.headers), r;
}, function(r) {
return bt(r) || (be(t), r && r.response && (r.response.data = we.call(
t,
t.transformResponse,
r.response
), r.response.headers = x.from(r.response.headers))), Promise.reject(r);
});
}
const At = "1.13.2", de = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
de[t] = function(r) {
return typeof r === t || "a" + (e < 1 ? "n " : " ") + t;
};
});
const Ze = {};
de.transitional = function(e, n, r) {
function s(o, i) {
return "[Axios v" + At + "] Transitional option '" + o + "'" + i + (r ? ". " + r : "");
}
return (o, i, a) => {
if (e === !1)
throw new g(
s(i, " has been removed" + (n ? " in " + n : "")),
g.ERR_DEPRECATED
);
return n && !Ze[i] && (Ze[i] = !0, console.warn(
s(
i,
" has been deprecated since v" + n + " and will be removed in the near future"
)
)), e ? e(o, i, a) : !0;
};
};
de.spelling = function(e) {
return (n, r) => (console.warn(`${r} is likely a misspelling of ${e}`), !0);
};
function mr(t, e, n) {
if (typeof t != "object")
throw new g("options must be an object", g.ERR_BAD_OPTION_VALUE);
const r = Object.keys(t);
let s = r.length;
for (; s-- > 0; ) {
const o = r[s], i = e[o];
if (i) {
const a = t[o], f = a === void 0 || i(a, o, t);
if (f !== !0)
throw new g("option " + o + " must be " + f, g.ERR_BAD_OPTION_VALUE);
continue;
}
if (n !== !0)
throw new g("Unknown option " + o, g.ERR_BAD_OPTION);
}
}
const ie = {
assertOptions: mr,
validators: de
}, k = ie.validators;
let B = class {
constructor(e) {
this.defaults = e || {}, this.interceptors = {
request: new qe(),
response: new qe()
};
}
/**
* Dispatch a request
*
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
* @param {?Object} config
*
* @returns {Promise} The Promise to be fulfilled
*/
async request(e, n) {
try {
return await this._request(e, n);
} catch (r) {
if (r instanceof Error) {
let s = {};
Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
try {
r.stack ? o && !String(r.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (r.stack += `
` + o) : r.stack = o;
} catch {
}
}
throw r;
}
}
_request(e, n) {
typeof e == "string" ? (n = n || {}, n.url = e) : n = e || {}, n = I(this.defaults, n);
const { transitional: r, paramsSerializer: s, headers: o } = n;
r !== void 0 && ie.assertOptions(r, {
silentJSONParsing: k.transitional(k.boolean),
forcedJSONParsing: k.transitional(k.boolean),
clarifyTimeoutError: k.transitional(k.boolean)
}, !1), s != null && (c.isFunction(s) ? n.paramsSerializer = {
serialize: s
} : ie.assertOptions(s, {
encode: k.function,
serialize: k.function
}, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), ie.assertOptions(n, {
baseUrl: k.spelling("baseURL"),
withXsrfToken: k.spelling("withXSRFToken")
}, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
let i = o && c.merge(
o.common,
o[n.method]
);
o && c.forEach(
["delete", "get", "head", "post", "put", "patch", "common"],
(d) => {
delete o[d];
}
), n.headers = x.concat(i, o);
const a = [];
let f = !0;
this.interceptors.request.forEach(function(m) {
typeof m.runWhen == "function" && m.runWhen(n) === !1 || (f = f && m.synchronous, a.unshift(m.fulfilled, m.rejected));
});
const u = [];
this.interceptors.response.forEach(function(m) {
u.push(m.fulfilled, m.rejected);
});
let l, p = 0, y;
if (!f) {
const d = [Ye.bind(this), void 0];
for (d.unshift(...a), d.push(...u), y = d.length, l = Promise.resolve(n); p < y; )
l = l.then(d[p++], d[p++]);
return l;
}
y = a.length;
let E = n;
for (; p < y; ) {
const d = a[p++], m = a[p++];
try {
E = d(E);
} catch (h) {
m.call(this, h);
break;
}
}
try {
l = Ye.call(this, E);
} catch (d) {
return Promise.reject(d);
}
for (p = 0, y = u.length; p < y; )
l = l.then(u[p++], u[p++]);
return l;
}
getUri(e) {
e = I(this.defaults, e);
const n = St(e.baseURL, e.url, e.allowAbsoluteUrls);
return gt(n, e.params, e.paramsSerializer);
}
};
c.forEach(["delete", "get", "head", "options"], function(e) {
B.prototype[e] = function(n, r) {
return this.request(I(r || {}, {
method: e,
url: n,
data: (r || {}).data
}));
};
});
c.forEach(["post", "put", "patch"], function(e) {
function n(r) {
return function(o, i, a) {
return this.request(I(a || {}, {
method: e,
headers: r ? {
"Content-Type": "multipart/form-data"
} : {},
url: o,
data: i
}));
};
}
B.prototype[e] = n(), B.prototype[e + "Form"] = n(!0);
});
let gr = class xt {
constructor(e) {
if (typeof e != "function")
throw new TypeError("executor must be a function.");
let n;
this.promise = new Promise(function(o) {
n = o;
});
const r = this;
this.promise.then((s) => {
if (!r._listeners) return;
let o = r._listeners.length;
for (; o-- > 0; )
r._listeners[o](s);
r._listeners = null;
}), this.promise.then = (s) => {
let o;
const i = new Promise((a) => {
r.subscribe(a), o = a;
}).then(s);
return i.cancel = function() {
r.unsubscribe(o);
}, i;
}, e(function(o, i, a) {
r.reason || (r.reason = new $(o, i, a), n(r.reason));
});
}
/**
* Throws a `CanceledError` if cancellation has been requested.
*/
throwIfRequested() {
if (this.reason)
throw this.reason;
}
/**
* Subscribe to the cancel signal
*/
subscribe(e) {
if (this.reason) {
e(this.reason);
return;
}
this._listeners ? this._listeners.push(e) : this._listeners = [e];
}
/**
* Unsubscribe from the cancel signal
*/
unsubscribe(e) {
if (!this._listeners)
return;
const n = this._listeners.indexOf(e);
n !== -1 && this._listeners.splice(n, 1);
}
toAbortSignal() {
const e = new AbortController(), n = (r) => {
e.abort(r);
};
return this.subscribe(n), e.signal.unsubscribe = () => this.unsubscribe(n), e.signal;
}
/**
* Returns an object that contains a new `CancelToken` and a function that, when called,
* cancels the `CancelToken`.
*/
static source() {
let e;
return {
token: new xt(function(s) {
e = s;
}),
cancel: e
};
}
};
function yr(t) {
return function(n) {
return t.apply(null, n);
};
}
function wr(t) {
return c.isObject(t) && t.isAxiosError === !0;
}
const Te = {
Continue: