dcode-chat-vue
Version:
Frontend vue components for the dcode-chat package
1,606 lines (1,605 loc) • 88 kB
JavaScript
import { defineComponent as W, createElementBlock as j, openBlock as F, createElementVNode as C, withKeys as dt, createCommentVNode as I, normalizeClass as q, toDisplayString as re, ref as L, watch as X, createVNode as ne, Fragment as ht, renderList as pt, withDirectives as Jt, withModifiers as Kt, vModelText as Wt, unref as D, createTextVNode as Qt, inject as Xt, onMounted as mt, onBeforeUnmount as Zt, createBlock as yt, provide as Gt } from "vue";
const Yt = { class: "flex items-center border border-gray-300 rounded-lg px-3 py-2 w-full max-w-md" }, er = /* @__PURE__ */ W({
name: "DCodeChatSearch",
__name: "DCodeChatSearch",
props: {
searchRoute: { default: () => "dcode-chat.search.index" }
},
emits: ["searchUpdated"],
setup(t, { emit: e }) {
const r = e, n = (s) => {
r("searchUpdated", s);
};
return (s, o) => (F(), j("div", Yt, [
o[1] || (o[1] = C("svg", {
xmlns: "http://www.w3.org/2000/svg",
class: "h-5 w-5 text-gray-400",
viewBox: "0 0 20 20",
fill: "currentColor"
}, [
C("path", {
"fill-rule": "evenodd",
d: "M12.9 14.32a8 8 0 111.414-1.414l4.387 4.387a1 1 0 01-1.414 1.414l-4.387-4.387zM14 8a6 6 0 11-12 0 6 6 0 0112 0z",
"clip-rule": "evenodd"
})
], -1)),
C("input", {
onKeyup: o[0] || (o[0] = dt((i) => n(i.target.value), ["enter"])),
type: "text",
placeholder: "Search chats",
class: "ml-2 w-full outline-none bg-transparent text-gray-600 placeholder-gray-400"
}, null, 32)
]));
}
}), tr = { class: "flex items-center space-x-3 dcode-chat__listing cursor-default" }, rr = { class: "relative" }, nr = ["src", "alt"], sr = {
key: 0,
class: "absolute top-0 left-0 w-3 h-3 rounded-full border-2 border-red-500 bg-red-500"
}, or = { class: "text-sm font-semibold text-gray-900" }, ir = { class: "text-sm text-gray-500" }, gt = /* @__PURE__ */ W({
name: "DCodeChatListing",
__name: "DCodeChatListing",
props: {
chat: {},
selected: { type: Boolean },
ignoreUnread: { type: Boolean }
},
setup(t) {
return (e, r) => {
var n, s, o, i, f, y, d, c, g, w, m, h, l, a;
return F(), j("div", tr, [
C("div", rr, [
C("div", {
class: q(["w-10 h-10 rounded-full border dcode-chat__listing-avatar flex items-center justify-center", { "border-green-500": e.selected, "border-gray-300": !e.selected }])
}, [
(s = (n = e.chat) == null ? void 0 : n.pivot) != null && s.chat_avatar ? I("", !0) : (F(), j("div", {
key: 0,
class: q(["w-10 h-10", { "fill-green-500": e.selected, "fill-gray-300": !e.selected }])
}, r[0] || (r[0] = [
C("svg", {
xmlns: "http://www.w3.org/2000/svg",
fill: "currentFill",
viewBox: "0 0 24 24"
}, [
C("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" })
], -1)
]), 2)),
(i = (o = e.chat) == null ? void 0 : o.pivot) != null && i.chat_avatar ? (F(), j("img", {
key: 1,
src: ((y = (f = e.chat) == null ? void 0 : f.pivot) == null ? void 0 : y.chat_avatar) + "?selected=" + (e.selected ? "selected" : ""),
alt: (c = (d = e.chat) == null ? void 0 : d.pivot) == null ? void 0 : c.chat_title,
class: "w-full h-full rounded-full object-cover"
}, null, 8, nr)) : I("", !0)
], 2),
(w = (g = e.chat) == null ? void 0 : g.pivot) != null && w.has_new_messages && !e.ignoreUnread ? (F(), j("div", sr)) : I("", !0)
]),
C("div", null, [
C("div", or, re((h = (m = e.chat) == null ? void 0 : m.pivot) == null ? void 0 : h.chat_title), 1),
C("div", ir, re((a = (l = e.chat) == null ? void 0 : l.pivot) == null ? void 0 : a.chat_subtitle), 1)
])
]);
};
}
});
function bt(t, e) {
return function() {
return t.apply(e, arguments);
};
}
const { toString: ar } = Object.prototype, { getPrototypeOf: Be } = Object, { iterator: he, toStringTag: wt } = Symbol, pe = /* @__PURE__ */ ((t) => (e) => {
const r = ar.call(e);
return t[r] || (t[r] = r.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null)), M = (t) => (t = t.toLowerCase(), (e) => pe(e) === t), me = (t) => (e) => typeof e === t, { isArray: Z } = Array, se = me("undefined");
function lr(t) {
return t !== null && !se(t) && t.constructor !== null && !se(t.constructor) && $(t.constructor.isBuffer) && t.constructor.isBuffer(t);
}
const vt = M("ArrayBuffer");
function cr(t) {
let e;
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? e = ArrayBuffer.isView(t) : e = t && t.buffer && vt(t.buffer), e;
}
const ur = me("string"), $ = me("function"), St = me("number"), ye = (t) => t !== null && typeof t == "object", fr = (t) => t === !0 || t === !1, le = (t) => {
if (pe(t) !== "object")
return !1;
const e = Be(t);
return (e === null || e === Object.prototype || Object.getPrototypeOf(e) === null) && !(wt in t) && !(he in t);
}, dr = M("Date"), hr = M("File"), pr = M("Blob"), mr = M("FileList"), yr = (t) => ye(t) && $(t.pipe), gr = (t) => {
let e;
return t && (typeof FormData == "function" && t instanceof FormData || $(t.append) && ((e = pe(t)) === "formdata" || // detect form-data instance
e === "object" && $(t.toString) && t.toString() === "[object FormData]"));
}, br = M("URLSearchParams"), [wr, vr, Sr, Er] = ["ReadableStream", "Request", "Response", "Headers"].map(M), Rr = (t) => t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function oe(t, e, { allOwnKeys: r = !1 } = {}) {
if (t === null || typeof t > "u")
return;
let n, s;
if (typeof t != "object" && (t = [t]), Z(t))
for (n = 0, s = t.length; n < s; n++)
e.call(null, t[n], n, t);
else {
const o = r ? Object.getOwnPropertyNames(t) : Object.keys(t), i = o.length;
let f;
for (n = 0; n < i; n++)
f = o[n], e.call(null, t[f], f, t);
}
}
function Et(t, e) {
e = e.toLowerCase();
const r = Object.keys(t);
let n = r.length, s;
for (; n-- > 0; )
if (s = r[n], e === s.toLowerCase())
return s;
return null;
}
const V = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, Rt = (t) => !se(t) && t !== V;
function Fe() {
const { caseless: t } = Rt(this) && this || {}, e = {}, r = (n, s) => {
const o = t && Et(e, s) || s;
le(e[o]) && le(n) ? e[o] = Fe(e[o], n) : le(n) ? e[o] = Fe({}, n) : Z(n) ? e[o] = n.slice() : e[o] = n;
};
for (let n = 0, s = arguments.length; n < s; n++)
arguments[n] && oe(arguments[n], r);
return e;
}
const xr = (t, e, r, { allOwnKeys: n } = {}) => (oe(e, (s, o) => {
r && $(s) ? t[o] = bt(s, r) : t[o] = s;
}, { allOwnKeys: n }), t), Or = (t) => (t.charCodeAt(0) === 65279 && (t = t.slice(1)), t), _r = (t, e, r, n) => {
t.prototype = Object.create(e.prototype, n), t.prototype.constructor = t, Object.defineProperty(t, "super", {
value: e.prototype
}), r && Object.assign(t.prototype, r);
}, Cr = (t, e, r, n) => {
let s, o, i;
const f = {};
if (e = e || {}, t == null) return e;
do {
for (s = Object.getOwnPropertyNames(t), o = s.length; o-- > 0; )
i = s[o], (!n || n(i, t, e)) && !f[i] && (e[i] = t[i], f[i] = !0);
t = r !== !1 && Be(t);
} while (t && (!r || r(t, e)) && t !== Object.prototype);
return e;
}, Ar = (t, e, r) => {
t = String(t), (r === void 0 || r > t.length) && (r = t.length), r -= e.length;
const n = t.indexOf(e, r);
return n !== -1 && n === r;
}, Tr = (t) => {
if (!t) return null;
if (Z(t)) return t;
let e = t.length;
if (!St(e)) return null;
const r = new Array(e);
for (; e-- > 0; )
r[e] = t[e];
return r;
}, Nr = /* @__PURE__ */ ((t) => (e) => t && e instanceof t)(typeof Uint8Array < "u" && Be(Uint8Array)), Pr = (t, e) => {
const n = (t && t[he]).call(t);
let s;
for (; (s = n.next()) && !s.done; ) {
const o = s.value;
e.call(t, o[0], o[1]);
}
}, Fr = (t, e) => {
let r;
const n = [];
for (; (r = t.exec(e)) !== null; )
n.push(r);
return n;
}, jr = M("HTMLFormElement"), Dr = (t) => t.toLowerCase().replace(
/[-_\s]([a-z\d])(\w*)/g,
function(r, n, s) {
return n.toUpperCase() + s;
}
), We = (({ hasOwnProperty: t }) => (e, r) => t.call(e, r))(Object.prototype), Ur = M("RegExp"), xt = (t, e) => {
const r = Object.getOwnPropertyDescriptors(t), n = {};
oe(r, (s, o) => {
let i;
(i = e(s, o, t)) !== !1 && (n[o] = i || s);
}), Object.defineProperties(t, n);
}, Lr = (t) => {
xt(t, (e, r) => {
if ($(t) && ["arguments", "caller", "callee"].indexOf(r) !== -1)
return !1;
const n = t[r];
if ($(n)) {
if (e.enumerable = !1, "writable" in e) {
e.writable = !1;
return;
}
e.set || (e.set = () => {
throw Error("Can not rewrite read-only method '" + r + "'");
});
}
});
}, $r = (t, e) => {
const r = {}, n = (s) => {
s.forEach((o) => {
r[o] = !0;
});
};
return Z(t) ? n(t) : n(String(t).split(e)), r;
}, kr = () => {
}, Br = (t, e) => t != null && Number.isFinite(t = +t) ? t : e;
function qr(t) {
return !!(t && $(t.append) && t[wt] === "FormData" && t[he]);
}
const Mr = (t) => {
const e = new Array(10), r = (n, s) => {
if (ye(n)) {
if (e.indexOf(n) >= 0)
return;
if (!("toJSON" in n)) {
e[s] = n;
const o = Z(n) ? [] : {};
return oe(n, (i, f) => {
const y = r(i, s + 1);
!se(y) && (o[f] = y);
}), e[s] = void 0, o;
}
}
return n;
};
return r(t, 0);
}, Hr = M("AsyncFunction"), Ir = (t) => t && (ye(t) || $(t)) && $(t.then) && $(t.catch), Ot = ((t, e) => t ? setImmediate : e ? ((r, n) => (V.addEventListener("message", ({ source: s, data: o }) => {
s === V && o === r && n.length && n.shift()();
}, !1), (s) => {
n.push(s), V.postMessage(r, "*");
}))(`axios@${Math.random()}`, []) : (r) => setTimeout(r))(
typeof setImmediate == "function",
$(V.postMessage)
), zr = typeof queueMicrotask < "u" ? queueMicrotask.bind(V) : typeof process < "u" && process.nextTick || Ot, Vr = (t) => t != null && $(t[he]), u = {
isArray: Z,
isArrayBuffer: vt,
isBuffer: lr,
isFormData: gr,
isArrayBufferView: cr,
isString: ur,
isNumber: St,
isBoolean: fr,
isObject: ye,
isPlainObject: le,
isReadableStream: wr,
isRequest: vr,
isResponse: Sr,
isHeaders: Er,
isUndefined: se,
isDate: dr,
isFile: hr,
isBlob: pr,
isRegExp: Ur,
isFunction: $,
isStream: yr,
isURLSearchParams: br,
isTypedArray: Nr,
isFileList: mr,
forEach: oe,
merge: Fe,
extend: xr,
trim: Rr,
stripBOM: Or,
inherits: _r,
toFlatObject: Cr,
kindOf: pe,
kindOfTest: M,
endsWith: Ar,
toArray: Tr,
forEachEntry: Pr,
matchAll: Fr,
isHTMLForm: jr,
hasOwnProperty: We,
hasOwnProp: We,
// an alias to avoid ESLint no-prototype-builtins detection
reduceDescriptors: xt,
freezeMethods: Lr,
toObjectSet: $r,
toCamelCase: Dr,
noop: kr,
toFiniteNumber: Br,
findKey: Et,
global: V,
isContextDefined: Rt,
isSpecCompliantForm: qr,
toJSONObject: Mr,
isAsyncFn: Hr,
isThenable: Ir,
setImmediate: Ot,
asap: zr,
isIterable: Vr
};
function O(t, e, r, n, 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), r && (this.config = r), n && (this.request = n), s && (this.response = s, this.status = s.status ? s.status : null);
}
u.inherits(O, 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: u.toJSONObject(this.config),
code: this.code,
status: this.status
};
}
});
const _t = O.prototype, Ct = {};
[
"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) => {
Ct[t] = { value: t };
});
Object.defineProperties(O, Ct);
Object.defineProperty(_t, "isAxiosError", { value: !0 });
O.from = (t, e, r, n, s, o) => {
const i = Object.create(_t);
return u.toFlatObject(t, i, function(y) {
return y !== Error.prototype;
}, (f) => f !== "isAxiosError"), O.call(i, t.message, e, r, n, s), i.cause = t, i.name = t.name, o && Object.assign(i, o), i;
};
const Jr = null;
function je(t) {
return u.isPlainObject(t) || u.isArray(t);
}
function At(t) {
return u.endsWith(t, "[]") ? t.slice(0, -2) : t;
}
function Qe(t, e, r) {
return t ? t.concat(e).map(function(s, o) {
return s = At(s), !r && o ? "[" + s + "]" : s;
}).join(r ? "." : "") : e;
}
function Kr(t) {
return u.isArray(t) && !t.some(je);
}
const Wr = u.toFlatObject(u, {}, null, function(e) {
return /^is[A-Z]/.test(e);
});
function ge(t, e, r) {
if (!u.isObject(t))
throw new TypeError("target must be an object");
e = e || new FormData(), r = u.toFlatObject(r, {
metaTokens: !0,
dots: !1,
indexes: !1
}, !1, function(l, a) {
return !u.isUndefined(a[l]);
});
const n = r.metaTokens, s = r.visitor || c, o = r.dots, i = r.indexes, y = (r.Blob || typeof Blob < "u" && Blob) && u.isSpecCompliantForm(e);
if (!u.isFunction(s))
throw new TypeError("visitor must be a function");
function d(h) {
if (h === null) return "";
if (u.isDate(h))
return h.toISOString();
if (!y && u.isBlob(h))
throw new O("Blob is not supported. Use a Buffer instead.");
return u.isArrayBuffer(h) || u.isTypedArray(h) ? y && typeof Blob == "function" ? new Blob([h]) : Buffer.from(h) : h;
}
function c(h, l, a) {
let p = h;
if (h && !a && typeof h == "object") {
if (u.endsWith(l, "{}"))
l = n ? l : l.slice(0, -2), h = JSON.stringify(h);
else if (u.isArray(h) && Kr(h) || (u.isFileList(h) || u.endsWith(l, "[]")) && (p = u.toArray(h)))
return l = At(l), p.forEach(function(S, v) {
!(u.isUndefined(S) || S === null) && e.append(
// eslint-disable-next-line no-nested-ternary
i === !0 ? Qe([l], v, o) : i === null ? l : l + "[]",
d(S)
);
}), !1;
}
return je(h) ? !0 : (e.append(Qe(a, l, o), d(h)), !1);
}
const g = [], w = Object.assign(Wr, {
defaultVisitor: c,
convertValue: d,
isVisitable: je
});
function m(h, l) {
if (!u.isUndefined(h)) {
if (g.indexOf(h) !== -1)
throw Error("Circular reference detected in " + l.join("."));
g.push(h), u.forEach(h, function(p, b) {
(!(u.isUndefined(p) || p === null) && s.call(
e,
p,
u.isString(b) ? b.trim() : b,
l,
w
)) === !0 && m(p, l ? l.concat(b) : [b]);
}), g.pop();
}
}
if (!u.isObject(t))
throw new TypeError("data must be an object");
return m(t), e;
}
function Xe(t) {
const e = {
"!": "%21",
"'": "%27",
"(": "%28",
")": "%29",
"~": "%7E",
"%20": "+",
"%00": "\0"
};
return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function(n) {
return e[n];
});
}
function qe(t, e) {
this._pairs = [], t && ge(t, this, e);
}
const Tt = qe.prototype;
Tt.append = function(e, r) {
this._pairs.push([e, r]);
};
Tt.toString = function(e) {
const r = e ? function(n) {
return e.call(this, n, Xe);
} : Xe;
return this._pairs.map(function(s) {
return r(s[0]) + "=" + r(s[1]);
}, "").join("&");
};
function Qr(t) {
return encodeURIComponent(t).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function Nt(t, e, r) {
if (!e)
return t;
const n = r && r.encode || Qr;
u.isFunction(r) && (r = {
serialize: r
});
const s = r && r.serialize;
let o;
if (s ? o = s(e, r) : o = u.isURLSearchParams(e) ? e.toString() : new qe(e, r).toString(n), o) {
const i = t.indexOf("#");
i !== -1 && (t = t.slice(0, i)), t += (t.indexOf("?") === -1 ? "?" : "&") + o;
}
return t;
}
class Ze {
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, r, n) {
return this.handlers.push({
fulfilled: e,
rejected: r,
synchronous: n ? n.synchronous : !1,
runWhen: n ? n.runWhen : null
}), this.handlers.length - 1;
}
/**
* Remove an interceptor from the stack
*
* @param {Number} id The ID that was returned by `use`
*
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
*/
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) {
u.forEach(this.handlers, function(n) {
n !== null && e(n);
});
}
}
const Pt = {
silentJSONParsing: !0,
forcedJSONParsing: !0,
clarifyTimeoutError: !1
}, Xr = typeof URLSearchParams < "u" ? URLSearchParams : qe, Zr = typeof FormData < "u" ? FormData : null, Gr = typeof Blob < "u" ? Blob : null, Yr = {
isBrowser: !0,
classes: {
URLSearchParams: Xr,
FormData: Zr,
Blob: Gr
},
protocols: ["http", "https", "file", "blob", "url", "data"]
}, Me = typeof window < "u" && typeof document < "u", De = typeof navigator == "object" && navigator || void 0, en = Me && (!De || ["ReactNative", "NativeScript", "NS"].indexOf(De.product) < 0), tn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", rn = Me && window.location.href || "http://localhost", nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
hasBrowserEnv: Me,
hasStandardBrowserEnv: en,
hasStandardBrowserWebWorkerEnv: tn,
navigator: De,
origin: rn
}, Symbol.toStringTag, { value: "Module" })), U = {
...nn,
...Yr
};
function sn(t, e) {
return ge(t, new U.classes.URLSearchParams(), Object.assign({
visitor: function(r, n, s, o) {
return U.isNode && u.isBuffer(r) ? (this.append(n, r.toString("base64")), !1) : o.defaultVisitor.apply(this, arguments);
}
}, e));
}
function on(t) {
return u.matchAll(/\w+|\[(\w*)]/g, t).map((e) => e[0] === "[]" ? "" : e[1] || e[0]);
}
function an(t) {
const e = {}, r = Object.keys(t);
let n;
const s = r.length;
let o;
for (n = 0; n < s; n++)
o = r[n], e[o] = t[o];
return e;
}
function Ft(t) {
function e(r, n, s, o) {
let i = r[o++];
if (i === "__proto__") return !0;
const f = Number.isFinite(+i), y = o >= r.length;
return i = !i && u.isArray(s) ? s.length : i, y ? (u.hasOwnProp(s, i) ? s[i] = [s[i], n] : s[i] = n, !f) : ((!s[i] || !u.isObject(s[i])) && (s[i] = []), e(r, n, s[i], o) && u.isArray(s[i]) && (s[i] = an(s[i])), !f);
}
if (u.isFormData(t) && u.isFunction(t.entries)) {
const r = {};
return u.forEachEntry(t, (n, s) => {
e(on(n), s, r, 0);
}), r;
}
return null;
}
function ln(t, e, r) {
if (u.isString(t))
try {
return (e || JSON.parse)(t), u.trim(t);
} catch (n) {
if (n.name !== "SyntaxError")
throw n;
}
return (r || JSON.stringify)(t);
}
const ie = {
transitional: Pt,
adapter: ["xhr", "http", "fetch"],
transformRequest: [function(e, r) {
const n = r.getContentType() || "", s = n.indexOf("application/json") > -1, o = u.isObject(e);
if (o && u.isHTMLForm(e) && (e = new FormData(e)), u.isFormData(e))
return s ? JSON.stringify(Ft(e)) : e;
if (u.isArrayBuffer(e) || u.isBuffer(e) || u.isStream(e) || u.isFile(e) || u.isBlob(e) || u.isReadableStream(e))
return e;
if (u.isArrayBufferView(e))
return e.buffer;
if (u.isURLSearchParams(e))
return r.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
let f;
if (o) {
if (n.indexOf("application/x-www-form-urlencoded") > -1)
return sn(e, this.formSerializer).toString();
if ((f = u.isFileList(e)) || n.indexOf("multipart/form-data") > -1) {
const y = this.env && this.env.FormData;
return ge(
f ? { "files[]": e } : e,
y && new y(),
this.formSerializer
);
}
}
return o || s ? (r.setContentType("application/json", !1), ln(e)) : e;
}],
transformResponse: [function(e) {
const r = this.transitional || ie.transitional, n = r && r.forcedJSONParsing, s = this.responseType === "json";
if (u.isResponse(e) || u.isReadableStream(e))
return e;
if (e && u.isString(e) && (n && !this.responseType || s)) {
const i = !(r && r.silentJSONParsing) && s;
try {
return JSON.parse(e);
} catch (f) {
if (i)
throw f.name === "SyntaxError" ? O.from(f, O.ERR_BAD_RESPONSE, this, null, this.response) : f;
}
}
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: U.classes.FormData,
Blob: U.classes.Blob
},
validateStatus: function(e) {
return e >= 200 && e < 300;
},
headers: {
common: {
Accept: "application/json, text/plain, */*",
"Content-Type": void 0
}
}
};
u.forEach(["delete", "get", "head", "post", "put", "patch"], (t) => {
ie.headers[t] = {};
});
const cn = u.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"
]), un = (t) => {
const e = {};
let r, n, s;
return t && t.split(`
`).forEach(function(i) {
s = i.indexOf(":"), r = i.substring(0, s).trim().toLowerCase(), n = i.substring(s + 1).trim(), !(!r || e[r] && cn[r]) && (r === "set-cookie" ? e[r] ? e[r].push(n) : e[r] = [n] : e[r] = e[r] ? e[r] + ", " + n : n);
}), e;
}, Ge = Symbol("internals");
function te(t) {
return t && String(t).trim().toLowerCase();
}
function ce(t) {
return t === !1 || t == null ? t : u.isArray(t) ? t.map(ce) : String(t);
}
function fn(t) {
const e = /* @__PURE__ */ Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
let n;
for (; n = r.exec(t); )
e[n[1]] = n[2];
return e;
}
const dn = (t) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());
function Re(t, e, r, n, s) {
if (u.isFunction(n))
return n.call(this, e, r);
if (s && (e = r), !!u.isString(e)) {
if (u.isString(n))
return e.indexOf(n) !== -1;
if (u.isRegExp(n))
return n.test(e);
}
}
function hn(t) {
return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (e, r, n) => r.toUpperCase() + n);
}
function pn(t, e) {
const r = u.toCamelCase(" " + e);
["get", "set", "has"].forEach((n) => {
Object.defineProperty(t, n + r, {
value: function(s, o, i) {
return this[n].call(this, e, s, o, i);
},
configurable: !0
});
});
}
let k = class {
constructor(e) {
e && this.set(e);
}
set(e, r, n) {
const s = this;
function o(f, y, d) {
const c = te(y);
if (!c)
throw new Error("header name must be a non-empty string");
const g = u.findKey(s, c);
(!g || s[g] === void 0 || d === !0 || d === void 0 && s[g] !== !1) && (s[g || y] = ce(f));
}
const i = (f, y) => u.forEach(f, (d, c) => o(d, c, y));
if (u.isPlainObject(e) || e instanceof this.constructor)
i(e, r);
else if (u.isString(e) && (e = e.trim()) && !dn(e))
i(un(e), r);
else if (u.isObject(e) && u.isIterable(e)) {
let f = {}, y, d;
for (const c of e) {
if (!u.isArray(c))
throw TypeError("Object iterator must return a key-value pair");
f[d = c[0]] = (y = f[d]) ? u.isArray(y) ? [...y, c[1]] : [y, c[1]] : c[1];
}
i(f, r);
} else
e != null && o(r, e, n);
return this;
}
get(e, r) {
if (e = te(e), e) {
const n = u.findKey(this, e);
if (n) {
const s = this[n];
if (!r)
return s;
if (r === !0)
return fn(s);
if (u.isFunction(r))
return r.call(this, s, n);
if (u.isRegExp(r))
return r.exec(s);
throw new TypeError("parser must be boolean|regexp|function");
}
}
}
has(e, r) {
if (e = te(e), e) {
const n = u.findKey(this, e);
return !!(n && this[n] !== void 0 && (!r || Re(this, this[n], n, r)));
}
return !1;
}
delete(e, r) {
const n = this;
let s = !1;
function o(i) {
if (i = te(i), i) {
const f = u.findKey(n, i);
f && (!r || Re(n, n[f], f, r)) && (delete n[f], s = !0);
}
}
return u.isArray(e) ? e.forEach(o) : o(e), s;
}
clear(e) {
const r = Object.keys(this);
let n = r.length, s = !1;
for (; n--; ) {
const o = r[n];
(!e || Re(this, this[o], o, e, !0)) && (delete this[o], s = !0);
}
return s;
}
normalize(e) {
const r = this, n = {};
return u.forEach(this, (s, o) => {
const i = u.findKey(n, o);
if (i) {
r[i] = ce(s), delete r[o];
return;
}
const f = e ? hn(o) : String(o).trim();
f !== o && delete r[o], r[f] = ce(s), n[f] = !0;
}), this;
}
concat(...e) {
return this.constructor.concat(this, ...e);
}
toJSON(e) {
const r = /* @__PURE__ */ Object.create(null);
return u.forEach(this, (n, s) => {
n != null && n !== !1 && (r[s] = e && u.isArray(n) ? n.join(", ") : n);
}), r;
}
[Symbol.iterator]() {
return Object.entries(this.toJSON())[Symbol.iterator]();
}
toString() {
return Object.entries(this.toJSON()).map(([e, r]) => e + ": " + r).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, ...r) {
const n = new this(e);
return r.forEach((s) => n.set(s)), n;
}
static accessor(e) {
const n = (this[Ge] = this[Ge] = {
accessors: {}
}).accessors, s = this.prototype;
function o(i) {
const f = te(i);
n[f] || (pn(s, i), n[f] = !0);
}
return u.isArray(e) ? e.forEach(o) : o(e), this;
}
};
k.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
u.reduceDescriptors(k.prototype, ({ value: t }, e) => {
let r = e[0].toUpperCase() + e.slice(1);
return {
get: () => t,
set(n) {
this[r] = n;
}
};
});
u.freezeMethods(k);
function xe(t, e) {
const r = this || ie, n = e || r, s = k.from(n.headers);
let o = n.data;
return u.forEach(t, function(f) {
o = f.call(r, o, s.normalize(), e ? e.status : void 0);
}), s.normalize(), o;
}
function jt(t) {
return !!(t && t.__CANCEL__);
}
function G(t, e, r) {
O.call(this, t ?? "canceled", O.ERR_CANCELED, e, r), this.name = "CanceledError";
}
u.inherits(G, O, {
__CANCEL__: !0
});
function Dt(t, e, r) {
const n = r.config.validateStatus;
!r.status || !n || n(r.status) ? t(r) : e(new O(
"Request failed with status code " + r.status,
[O.ERR_BAD_REQUEST, O.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4],
r.config,
r.request,
r
));
}
function mn(t) {
const e = /^([-+\w]{1,25})(:?\/\/|:)/.exec(t);
return e && e[1] || "";
}
function yn(t, e) {
t = t || 10;
const r = new Array(t), n = new Array(t);
let s = 0, o = 0, i;
return e = e !== void 0 ? e : 1e3, function(y) {
const d = Date.now(), c = n[o];
i || (i = d), r[s] = y, n[s] = d;
let g = o, w = 0;
for (; g !== s; )
w += r[g++], g = g % t;
if (s = (s + 1) % t, s === o && (o = (o + 1) % t), d - i < e)
return;
const m = c && d - c;
return m ? Math.round(w * 1e3 / m) : void 0;
};
}
function gn(t, e) {
let r = 0, n = 1e3 / e, s, o;
const i = (d, c = Date.now()) => {
r = c, s = null, o && (clearTimeout(o), o = null), t.apply(null, d);
};
return [(...d) => {
const c = Date.now(), g = c - r;
g >= n ? i(d, c) : (s = d, o || (o = setTimeout(() => {
o = null, i(s);
}, n - g)));
}, () => s && i(s)];
}
const fe = (t, e, r = 3) => {
let n = 0;
const s = yn(50, 250);
return gn((o) => {
const i = o.loaded, f = o.lengthComputable ? o.total : void 0, y = i - n, d = s(y), c = i <= f;
n = i;
const g = {
loaded: i,
total: f,
progress: f ? i / f : void 0,
bytes: y,
rate: d || void 0,
estimated: d && f && c ? (f - i) / d : void 0,
event: o,
lengthComputable: f != null,
[e ? "download" : "upload"]: !0
};
t(g);
}, r);
}, Ye = (t, e) => {
const r = t != null;
return [(n) => e[0]({
lengthComputable: r,
total: t,
loaded: n
}), e[1]];
}, et = (t) => (...e) => u.asap(() => t(...e)), bn = U.hasStandardBrowserEnv ? /* @__PURE__ */ ((t, e) => (r) => (r = new URL(r, U.origin), t.protocol === r.protocol && t.host === r.host && (e || t.port === r.port)))(
new URL(U.origin),
U.navigator && /(msie|trident)/i.test(U.navigator.userAgent)
) : () => !0, wn = U.hasStandardBrowserEnv ? (
// Standard browser envs support document.cookie
{
write(t, e, r, n, s, o) {
const i = [t + "=" + encodeURIComponent(e)];
u.isNumber(r) && i.push("expires=" + new Date(r).toGMTString()), u.isString(n) && i.push("path=" + n), u.isString(s) && i.push("domain=" + s), o === !0 && i.push("secure"), document.cookie = i.join("; ");
},
read(t) {
const e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
return e ? decodeURIComponent(e[3]) : 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 vn(t) {
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
}
function Sn(t, e) {
return e ? t.replace(/\/?\/$/, "") + "/" + e.replace(/^\/+/, "") : t;
}
function Ut(t, e, r) {
let n = !vn(e);
return t && (n || r == !1) ? Sn(t, e) : e;
}
const tt = (t) => t instanceof k ? { ...t } : t;
function K(t, e) {
e = e || {};
const r = {};
function n(d, c, g, w) {
return u.isPlainObject(d) && u.isPlainObject(c) ? u.merge.call({ caseless: w }, d, c) : u.isPlainObject(c) ? u.merge({}, c) : u.isArray(c) ? c.slice() : c;
}
function s(d, c, g, w) {
if (u.isUndefined(c)) {
if (!u.isUndefined(d))
return n(void 0, d, g, w);
} else return n(d, c, g, w);
}
function o(d, c) {
if (!u.isUndefined(c))
return n(void 0, c);
}
function i(d, c) {
if (u.isUndefined(c)) {
if (!u.isUndefined(d))
return n(void 0, d);
} else return n(void 0, c);
}
function f(d, c, g) {
if (g in e)
return n(d, c);
if (g in t)
return n(void 0, d);
}
const y = {
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: f,
headers: (d, c, g) => s(tt(d), tt(c), g, !0)
};
return u.forEach(Object.keys(Object.assign({}, t, e)), function(c) {
const g = y[c] || s, w = g(t[c], e[c], c);
u.isUndefined(w) && g !== f || (r[c] = w);
}), r;
}
const Lt = (t) => {
const e = K({}, t);
let { data: r, withXSRFToken: n, xsrfHeaderName: s, xsrfCookieName: o, headers: i, auth: f } = e;
e.headers = i = k.from(i), e.url = Nt(Ut(e.baseURL, e.url, e.allowAbsoluteUrls), t.params, t.paramsSerializer), f && i.set(
"Authorization",
"Basic " + btoa((f.username || "") + ":" + (f.password ? unescape(encodeURIComponent(f.password)) : ""))
);
let y;
if (u.isFormData(r)) {
if (U.hasStandardBrowserEnv || U.hasStandardBrowserWebWorkerEnv)
i.setContentType(void 0);
else if ((y = i.getContentType()) !== !1) {
const [d, ...c] = y ? y.split(";").map((g) => g.trim()).filter(Boolean) : [];
i.setContentType([d || "multipart/form-data", ...c].join("; "));
}
}
if (U.hasStandardBrowserEnv && (n && u.isFunction(n) && (n = n(e)), n || n !== !1 && bn(e.url))) {
const d = s && o && wn.read(o);
d && i.set(s, d);
}
return e;
}, En = typeof XMLHttpRequest < "u", Rn = En && function(t) {
return new Promise(function(r, n) {
const s = Lt(t);
let o = s.data;
const i = k.from(s.headers).normalize();
let { responseType: f, onUploadProgress: y, onDownloadProgress: d } = s, c, g, w, m, h;
function l() {
m && m(), h && h(), s.cancelToken && s.cancelToken.unsubscribe(c), s.signal && s.signal.removeEventListener("abort", c);
}
let a = new XMLHttpRequest();
a.open(s.method.toUpperCase(), s.url, !0), a.timeout = s.timeout;
function p() {
if (!a)
return;
const S = k.from(
"getAllResponseHeaders" in a && a.getAllResponseHeaders()
), E = {
data: !f || f === "text" || f === "json" ? a.responseText : a.response,
status: a.status,
statusText: a.statusText,
headers: S,
config: t,
request: a
};
Dt(function(_) {
r(_), l();
}, function(_) {
n(_), l();
}, E), a = null;
}
"onloadend" in a ? a.onloadend = p : a.onreadystatechange = function() {
!a || a.readyState !== 4 || a.status === 0 && !(a.responseURL && a.responseURL.indexOf("file:") === 0) || setTimeout(p);
}, a.onabort = function() {
a && (n(new O("Request aborted", O.ECONNABORTED, t, a)), a = null);
}, a.onerror = function() {
n(new O("Network Error", O.ERR_NETWORK, t, a)), a = null;
}, a.ontimeout = function() {
let v = s.timeout ? "timeout of " + s.timeout + "ms exceeded" : "timeout exceeded";
const E = s.transitional || Pt;
s.timeoutErrorMessage && (v = s.timeoutErrorMessage), n(new O(
v,
E.clarifyTimeoutError ? O.ETIMEDOUT : O.ECONNABORTED,
t,
a
)), a = null;
}, o === void 0 && i.setContentType(null), "setRequestHeader" in a && u.forEach(i.toJSON(), function(v, E) {
a.setRequestHeader(E, v);
}), u.isUndefined(s.withCredentials) || (a.withCredentials = !!s.withCredentials), f && f !== "json" && (a.responseType = s.responseType), d && ([w, h] = fe(d, !0), a.addEventListener("progress", w)), y && a.upload && ([g, m] = fe(y), a.upload.addEventListener("progress", g), a.upload.addEventListener("loadend", m)), (s.cancelToken || s.signal) && (c = (S) => {
a && (n(!S || S.type ? new G(null, t, a) : S), a.abort(), a = null);
}, s.cancelToken && s.cancelToken.subscribe(c), s.signal && (s.signal.aborted ? c() : s.signal.addEventListener("abort", c)));
const b = mn(s.url);
if (b && U.protocols.indexOf(b) === -1) {
n(new O("Unsupported protocol " + b + ":", O.ERR_BAD_REQUEST, t));
return;
}
a.send(o || null);
});
}, xn = (t, e) => {
const { length: r } = t = t ? t.filter(Boolean) : [];
if (e || r) {
let n = new AbortController(), s;
const o = function(d) {
if (!s) {
s = !0, f();
const c = d instanceof Error ? d : this.reason;
n.abort(c instanceof O ? c : new G(c instanceof Error ? c.message : c));
}
};
let i = e && setTimeout(() => {
i = null, o(new O(`timeout ${e} of ms exceeded`, O.ETIMEDOUT));
}, e);
const f = () => {
t && (i && clearTimeout(i), i = null, t.forEach((d) => {
d.unsubscribe ? d.unsubscribe(o) : d.removeEventListener("abort", o);
}), t = null);
};
t.forEach((d) => d.addEventListener("abort", o));
const { signal: y } = n;
return y.unsubscribe = () => u.asap(f), y;
}
}, On = function* (t, e) {
let r = t.byteLength;
if (r < e) {
yield t;
return;
}
let n = 0, s;
for (; n < r; )
s = n + e, yield t.slice(n, s), n = s;
}, _n = async function* (t, e) {
for await (const r of Cn(t))
yield* On(r, e);
}, Cn = async function* (t) {
if (t[Symbol.asyncIterator]) {
yield* t;
return;
}
const e = t.getReader();
try {
for (; ; ) {
const { done: r, value: n } = await e.read();
if (r)
break;
yield n;
}
} finally {
await e.cancel();
}
}, rt = (t, e, r, n) => {
const s = _n(t, e);
let o = 0, i, f = (y) => {
i || (i = !0, n && n(y));
};
return new ReadableStream({
async pull(y) {
try {
const { done: d, value: c } = await s.next();
if (d) {
f(), y.close();
return;
}
let g = c.byteLength;
if (r) {
let w = o += g;
r(w);
}
y.enqueue(new Uint8Array(c));
} catch (d) {
throw f(d), d;
}
},
cancel(y) {
return f(y), s.return();
}
}, {
highWaterMark: 2
});
}, be = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", $t = be && typeof ReadableStream == "function", An = be && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((t) => (e) => t.encode(e))(new TextEncoder()) : async (t) => new Uint8Array(await new Response(t).arrayBuffer())), kt = (t, ...e) => {
try {
return !!t(...e);
} catch {
return !1;
}
}, Tn = $t && kt(() => {
let t = !1;
const e = new Request(U.origin, {
body: new ReadableStream(),
method: "POST",
get duplex() {
return t = !0, "half";
}
}).headers.has("Content-Type");
return t && !e;
}), nt = 64 * 1024, Ue = $t && kt(() => u.isReadableStream(new Response("").body)), de = {
stream: Ue && ((t) => t.body)
};
be && ((t) => {
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((e) => {
!de[e] && (de[e] = u.isFunction(t[e]) ? (r) => r[e]() : (r, n) => {
throw new O(`Response type '${e}' is not supported`, O.ERR_NOT_SUPPORT, n);
});
});
})(new Response());
const Nn = async (t) => {
if (t == null)
return 0;
if (u.isBlob(t))
return t.size;
if (u.isSpecCompliantForm(t))
return (await new Request(U.origin, {
method: "POST",
body: t
}).arrayBuffer()).byteLength;
if (u.isArrayBufferView(t) || u.isArrayBuffer(t))
return t.byteLength;
if (u.isURLSearchParams(t) && (t = t + ""), u.isString(t))
return (await An(t)).byteLength;
}, Pn = async (t, e) => {
const r = u.toFiniteNumber(t.getContentLength());
return r ?? Nn(e);
}, Fn = be && (async (t) => {
let {
url: e,
method: r,
data: n,
signal: s,
cancelToken: o,
timeout: i,
onDownloadProgress: f,
onUploadProgress: y,
responseType: d,
headers: c,
withCredentials: g = "same-origin",
fetchOptions: w
} = Lt(t);
d = d ? (d + "").toLowerCase() : "text";
let m = xn([s, o && o.toAbortSignal()], i), h;
const l = m && m.unsubscribe && (() => {
m.unsubscribe();
});
let a;
try {
if (y && Tn && r !== "get" && r !== "head" && (a = await Pn(c, n)) !== 0) {
let E = new Request(e, {
method: "POST",
body: n,
duplex: "half"
}), x;
if (u.isFormData(n) && (x = E.headers.get("content-type")) && c.setContentType(x), E.body) {
const [_, R] = Ye(
a,
fe(et(y))
);
n = rt(E.body, nt, _, R);
}
}
u.isString(g) || (g = g ? "include" : "omit");
const p = "credentials" in Request.prototype;
h = new Request(e, {
...w,
signal: m,
method: r.toUpperCase(),
headers: c.normalize().toJSON(),
body: n,
duplex: "half",
credentials: p ? g : void 0
});
let b = await fetch(h);
const S = Ue && (d === "stream" || d === "response");
if (Ue && (f || S && l)) {
const E = {};
["status", "statusText", "headers"].forEach((A) => {
E[A] = b[A];
});
const x = u.toFiniteNumber(b.headers.get("content-length")), [_, R] = f && Ye(
x,
fe(et(f), !0)
) || [];
b = new Response(
rt(b.body, nt, _, () => {
R && R(), l && l();
}),
E
);
}
d = d || "text";
let v = await de[u.findKey(de, d) || "text"](b, t);
return !S && l && l(), await new Promise((E, x) => {
Dt(E, x, {
data: v,
headers: k.from(b.headers),
status: b.status,
statusText: b.statusText,
config: t,
request: h
});
});
} catch (p) {
throw l && l(), p && p.name === "TypeError" && /Load failed|fetch/i.test(p.message) ? Object.assign(
new O("Network Error", O.ERR_NETWORK, t, h),
{
cause: p.cause || p
}
) : O.from(p, p && p.code, t, h);
}
}), Le = {
http: Jr,
xhr: Rn,
fetch: Fn
};
u.forEach(Le, (t, e) => {
if (t) {
try {
Object.defineProperty(t, "name", { value: e });
} catch {
}
Object.defineProperty(t, "adapterName", { value: e });
}
});
const st = (t) => `- ${t}`, jn = (t) => u.isFunction(t) || t === null || t === !1, Bt = {
getAdapter: (t) => {
t = u.isArray(t) ? t : [t];
const { length: e } = t;
let r, n;
const s = {};
for (let o = 0; o < e; o++) {
r = t[o];
let i;
if (n = r, !jn(r) && (n = Le[(i = String(r)).toLowerCase()], n === void 0))
throw new O(`Unknown adapter '${i}'`);
if (n)
break;
s[i || "#" + o] = n;
}
if (!n) {
const o = Object.entries(s).map(
([f, y]) => `adapter ${f} ` + (y === !1 ? "is not supported by the environment" : "is not available in the build")
);
let i = e ? o.length > 1 ? `since :
` + o.map(st).join(`
`) : " " + st(o[0]) : "as no adapter specified";
throw new O(
"There is no suitable adapter to dispatch the request " + i,
"ERR_NOT_SUPPORT"
);
}
return n;
},
adapters: Le
};
function Oe(t) {
if (t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)
throw new G(null, t);
}
function ot(t) {
return Oe(t), t.headers = k.from(t.headers), t.data = xe.call(
t,
t.transformRequest
), ["post", "put", "patch"].indexOf(t.method) !== -1 && t.headers.setContentType("application/x-www-form-urlencoded", !1), Bt.getAdapter(t.adapter || ie.adapter)(t).then(function(n) {
return Oe(t), n.data = xe.call(
t,
t.transformResponse,
n
), n.headers = k.from(n.headers), n;
}, function(n) {
return jt(n) || (Oe(t), n && n.response && (n.response.data = xe.call(
t,
t.transformResponse,
n.response
), n.response.headers = k.from(n.response.headers))), Promise.reject(n);
});
}
const qt = "1.9.0", we = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((t, e) => {
we[t] = function(n) {
return typeof n === t || "a" + (e < 1 ? "n " : " ") + t;
};
});
const it = {};
we.transitional = function(e, r, n) {
function s(o, i) {
return "[Axios v" + qt + "] Transitional option '" + o + "'" + i + (n ? ". " + n : "");
}
return (o, i, f) => {
if (e === !1)
throw new O(
s(i, " has been removed" + (r ? " in " + r : "")),
O.ERR_DEPRECATED
);
return r && !it[i] && (it[i] = !0, console.warn(
s(
i,
" has been deprecated since v" + r + " and will be removed in the near future"
)
)), e ? e(o, i, f) : !0;
};
};
we.spelling = function(e) {
return (r, n) => (console.warn(`${n} is likely a misspelling of ${e}`), !0);
};
function Dn(t, e, r) {
if (typeof t != "object")
throw new O("options must be an object", O.ERR_BAD_OPTION_VALUE);
const n = Object.keys(t);
let s = n.length;
for (; s-- > 0; ) {
const o = n[s], i = e[o];
if (i) {
const f = t[o], y = f === void 0 || i(f, o, t);
if (y !== !0)
throw new O("option " + o + " must be " + y, O.ERR_BAD_OPTION_VALUE);
continue;
}
if (r !== !0)
throw new O("Unknown option " + o, O.ERR_BAD_OPTION);
}
}
const ue = {
assertOptions: Dn,
validators: we
}, H = ue.validators;
let J = class {
constructor(e) {
this.defaults = e || {}, this.interceptors = {
request: new Ze(),
response: new Ze()
};
}
/**
* 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, r) {
try {
return await this._request(e, r);
} catch (n) {
if (n instanceof Error) {
let s = {};
Error.captureStackTrace ? Error.captureStackTrace(s) : s = new Error();
const o = s.stack ? s.stack.replace(/^.+\n/, "") : "";
try {
n.stack ? o && !String(n.stack).endsWith(o.replace(/^.+\n.+\n/, "")) && (n.stack += `
` + o) : n.stack = o;
} catch {
}
}
throw n;
}
}
_request(e, r) {
typeof e == "string" ? (r = r || {}, r.url = e) : r = e || {}, r = K(this.defaults, r);
const { transitional: n, paramsSerializer: s, headers: o } = r;
n !== void 0 && ue.assertOptions(n, {
silentJSONParsing: H.transitional(H.boolean),
forcedJSONParsing: H.transitional(H.boolean),
clarifyTimeoutError: H.transitional(H.boolean)
}, !1), s != null && (u.isFunction(s) ? r.paramsSerializer = {
serialize: s
} : ue.assertOptions(s, {
encode: H.function,
serialize: H.function
}, !0)), r.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? r.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : r.allowAbsoluteUrls = !0), ue.assertOptions(r, {
baseUrl: H.spelling("baseURL"),
withXsrfToken: H.spelling("withXSRFToken")
}, !0), r.method = (r.method || this.defaults.method || "get").toLowerCase();
let i = o && u.merge(
o.common,
o[r.method]
);
o && u.forEach(
["delete", "get", "head", "post", "put", "patch", "common"],
(h) => {
delete o[h];
}
), r.headers = k.concat(i, o);
const f = [];
let y = !0;
this.interceptors.request.forEach(function(l) {
typeof l.runWhen == "function" && l.runWhen(r) === !1 || (y = y && l.synchronous, f.unshift(l.fulfilled, l.rejected));
});
const d = [];
this.interceptors.response.forEach(function(l) {
d.push(l.fulfilled, l.rejected);
});
let c, g = 0, w;
if (!y) {
const h = [ot.bind(this), void 0];
for (h.unshift.apply(h, f), h.push.apply(h, d), w = h.length, c = Promise.resolve(r); g < w; )
c = c.then(h[g++], h[g++]);
return c;
}
w = f.length;
let m = r;
for (g = 0; g < w; ) {
const h = f[g++], l = f[g++];
try {
m = h(m);
} catch (a) {
l.call(this, a);
break;
}
}
try {
c = ot.call(this, m);
} catch (h) {
return Promise.reject(h);
}
for (g = 0, w = d.length; g < w; )
c = c.then(d[g++], d[g++]);
return c;
}
getUri(e) {
e = K(this.defaults, e);
const r = Ut(e.baseURL, e.url, e.allowAbsoluteUrls);
return Nt(r, e.params, e.paramsSerializer);
}
};
u.forEach(["delete", "get", "head", "options"], function(e) {
J.prototype[e] = function(r, n) {
return this.request(K(n || {}, {
method: e,
url: r,
data: (n || {}).data
}));
};
});
u.forEach(["post", "put", "patch"], function(e) {
function r(n) {
return function(o, i, f) {
return this.request(K(f || {}, {
method: e,
headers: n ? {
"Content-Type": "multipart/form-data"
} : {},
url: o,
data: i
}));
};
}
J.prototype[e] = r(), J.prototype[e + "Form"] = r(!0);
});
let Un = class Mt {
constructor(e) {
if (typeof e != "function")
throw new TypeError("executor must be a function.");
let r;
this.promise = new Promise(function(o) {
r = o;
});
const n = this;
this.promise.then((s) => {
if (!n._listeners) return;
let o = n._listeners.length;
for (; o-- > 0; )
n._listeners[o](s);
n._listeners = null;
}), this.promise.then = (s) => {
let o;
const i = new Promise((f) => {