frappe-tuba-react-sdk
Version: 
React hooks for Frappe Framework
1,365 lines (1,364 loc) • 193 kB
JavaScript
var _i = Object.defineProperty;
var vi = (t, e, n) => e in t ? _i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var ze = (t, e, n) => vi(t, typeof e != "symbol" ? e + "" : e, n);
import { jsx as Es } from "react/jsx-runtime";
import bt, { createContext as Xs, useContext as Z, useMemo as Kt, useRef as Pe, useEffect as at, useLayoutEffect as Ei, createElement as Si, useCallback as I, useDebugValue as Ri, useState as V } from "react";
var Ti = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, et = {}, pt = {}, Oe = {}, Ss;
function Ys() {
  if (Ss) return Oe;
  Ss = 1;
  var t = Oe && Oe.__assign || function() {
    return t = Object.assign || function(a) {
      for (var c, o = 1, d = arguments.length; o < d; o++) {
        c = arguments[o];
        for (var h in c) Object.prototype.hasOwnProperty.call(c, h) && (a[h] = c[h]);
      }
      return a;
    }, t.apply(this, arguments);
  }, e = Oe && Oe.__awaiter || function(a, c, o, d) {
    function h(l) {
      return l instanceof o ? l : new o(function(p) {
        p(l);
      });
    }
    return new (o || (o = Promise))(function(l, p) {
      function w(E) {
        try {
          m(d.next(E));
        } catch (R) {
          p(R);
        }
      }
      function v(E) {
        try {
          m(d.throw(E));
        } catch (R) {
          p(R);
        }
      }
      function m(E) {
        E.done ? l(E.value) : h(E.value).then(w, v);
      }
      m((d = d.apply(a, c || [])).next());
    });
  }, n = Oe && Oe.__generator || function(a, c) {
    var o = { label: 0, sent: function() {
      if (l[0] & 1) throw l[1];
      return l[1];
    }, trys: [], ops: [] }, d, h, l, p;
    return p = { next: w(0), throw: w(1), return: w(2) }, typeof Symbol == "function" && (p[Symbol.iterator] = function() {
      return this;
    }), p;
    function w(m) {
      return function(E) {
        return v([m, E]);
      };
    }
    function v(m) {
      if (d) throw new TypeError("Generator is already executing.");
      for (; p && (p = 0, m[0] && (o = 0)), o; ) try {
        if (d = 1, h && (l = m[0] & 2 ? h.return : m[0] ? h.throw || ((l = h.return) && l.call(h), 0) : h.next) && !(l = l.call(h, m[1])).done) return l;
        switch (h = 0, l && (m = [m[0] & 2, l.value]), m[0]) {
          case 0:
          case 1:
            l = m;
            break;
          case 4:
            return o.label++, { value: m[1], done: !1 };
          case 5:
            o.label++, h = m[1], m = [0];
            continue;
          case 7:
            m = o.ops.pop(), o.trys.pop();
            continue;
          default:
            if (l = o.trys, !(l = l.length > 0 && l[l.length - 1]) && (m[0] === 6 || m[0] === 2)) {
              o = 0;
              continue;
            }
            if (m[0] === 3 && (!l || m[1] > l[0] && m[1] < l[3])) {
              o.label = m[1];
              break;
            }
            if (m[0] === 6 && o.label < l[1]) {
              o.label = l[1], l = m;
              break;
            }
            if (l && o.label < l[2]) {
              o.label = l[2], o.ops.push(m);
              break;
            }
            l[2] && o.ops.pop(), o.trys.pop();
            continue;
        }
        m = c.call(a, o);
      } catch (E) {
        m = [6, E], h = 0;
      } finally {
        d = l = 0;
      }
      if (m[0] & 5) throw m[1];
      return { value: m[0] ? m[1] : void 0, done: !0 };
    }
  };
  Object.defineProperty(Oe, "__esModule", { value: !0 }), Oe.FrappeCall = void 0;
  var s = (
    /** @class */
    function() {
      function a(c, o, d, h, l) {
        this.appURL = c, this.axios = o, this.useToken = d ?? !1, this.token = h, this.tokenType = l;
      }
      return a.prototype.get = function(c, o) {
        return e(this, void 0, void 0, function() {
          var d;
          return n(this, function(h) {
            return d = new URLSearchParams(), o && Object.entries(o).forEach(function(l) {
              var p = l[0], w = l[1];
              if (w != null) {
                var v = typeof w == "object" ? JSON.stringify(w) : w;
                d.set(p, v);
              }
            }), [2, this.axios.get("/api/method/".concat(c), {
              params: d
            }).then(function(l) {
              return l.data;
            }).catch(function(l) {
              var p, w;
              throw t(t({}, l.response.data), { httpStatus: l.response.status, httpStatusText: l.response.statusText, message: (p = l.response.data.message) !== null && p !== void 0 ? p : "There was an error.", exception: (w = l.response.data.exception) !== null && w !== void 0 ? w : "" });
            })];
          });
        });
      }, a.prototype.post = function(c, o) {
        return e(this, void 0, void 0, function() {
          return n(this, function(d) {
            return [2, this.axios.post("/api/method/".concat(c), t({}, o)).then(function(h) {
              return h.data;
            }).catch(function(h) {
              var l, p;
              throw t(t({}, h.response.data), { httpStatus: h.response.status, httpStatusText: h.response.statusText, message: (l = h.response.data.message) !== null && l !== void 0 ? l : "There was an error.", exception: (p = h.response.data.exception) !== null && p !== void 0 ? p : "" });
            })];
          });
        });
      }, a.prototype.put = function(c, o) {
        return e(this, void 0, void 0, function() {
          return n(this, function(d) {
            return [2, this.axios.put("/api/method/".concat(c), t({}, o)).then(function(h) {
              return h.data;
            }).catch(function(h) {
              var l, p;
              throw t(t({}, h.response.data), { httpStatus: h.response.status, httpStatusText: h.response.statusText, message: (l = h.response.data.message) !== null && l !== void 0 ? l : "There was an error.", exception: (p = h.response.data.exception) !== null && p !== void 0 ? p : "" });
            })];
          });
        });
      }, a.prototype.delete = function(c, o) {
        return e(this, void 0, void 0, function() {
          return n(this, function(d) {
            return [2, this.axios.delete("/api/method/".concat(c), { params: o }).then(function(h) {
              return h.data;
            }).catch(function(h) {
              var l, p;
              throw t(t({}, h.response.data), { httpStatus: h.response.status, httpStatusText: h.response.statusText, message: (l = h.response.data.message) !== null && l !== void 0 ? l : "There was an error.", exception: (p = h.response.data.exception) !== null && p !== void 0 ? p : "" });
            })];
          });
        });
      }, a;
    }()
  );
  return Oe.FrappeCall = s, Oe;
}
var xe = {}, Rs;
function Qs() {
  if (Rs) return xe;
  Rs = 1;
  var t = xe && xe.__assign || function() {
    return t = Object.assign || function(a) {
      for (var c, o = 1, d = arguments.length; o < d; o++) {
        c = arguments[o];
        for (var h in c) Object.prototype.hasOwnProperty.call(c, h) && (a[h] = c[h]);
      }
      return a;
    }, t.apply(this, arguments);
  }, e = xe && xe.__awaiter || function(a, c, o, d) {
    function h(l) {
      return l instanceof o ? l : new o(function(p) {
        p(l);
      });
    }
    return new (o || (o = Promise))(function(l, p) {
      function w(E) {
        try {
          m(d.next(E));
        } catch (R) {
          p(R);
        }
      }
      function v(E) {
        try {
          m(d.throw(E));
        } catch (R) {
          p(R);
        }
      }
      function m(E) {
        E.done ? l(E.value) : h(E.value).then(w, v);
      }
      m((d = d.apply(a, c || [])).next());
    });
  }, n = xe && xe.__generator || function(a, c) {
    var o = { label: 0, sent: function() {
      if (l[0] & 1) throw l[1];
      return l[1];
    }, trys: [], ops: [] }, d, h, l, p;
    return p = { next: w(0), throw: w(1), return: w(2) }, typeof Symbol == "function" && (p[Symbol.iterator] = function() {
      return this;
    }), p;
    function w(m) {
      return function(E) {
        return v([m, E]);
      };
    }
    function v(m) {
      if (d) throw new TypeError("Generator is already executing.");
      for (; p && (p = 0, m[0] && (o = 0)), o; ) try {
        if (d = 1, h && (l = m[0] & 2 ? h.return : m[0] ? h.throw || ((l = h.return) && l.call(h), 0) : h.next) && !(l = l.call(h, m[1])).done) return l;
        switch (h = 0, l && (m = [m[0] & 2, l.value]), m[0]) {
          case 0:
          case 1:
            l = m;
            break;
          case 4:
            return o.label++, { value: m[1], done: !1 };
          case 5:
            o.label++, h = m[1], m = [0];
            continue;
          case 7:
            m = o.ops.pop(), o.trys.pop();
            continue;
          default:
            if (l = o.trys, !(l = l.length > 0 && l[l.length - 1]) && (m[0] === 6 || m[0] === 2)) {
              o = 0;
              continue;
            }
            if (m[0] === 3 && (!l || m[1] > l[0] && m[1] < l[3])) {
              o.label = m[1];
              break;
            }
            if (m[0] === 6 && o.label < l[1]) {
              o.label = l[1], l = m;
              break;
            }
            if (l && o.label < l[2]) {
              o.label = l[2], o.ops.push(m);
              break;
            }
            l[2] && o.ops.pop(), o.trys.pop();
            continue;
        }
        m = c.call(a, o);
      } catch (E) {
        m = [6, E], h = 0;
      } finally {
        d = l = 0;
      }
      if (m[0] & 5) throw m[1];
      return { value: m[0] ? m[1] : void 0, done: !0 };
    }
  };
  Object.defineProperty(xe, "__esModule", { value: !0 }), xe.FrappeDB = void 0;
  var s = (
    /** @class */
    function() {
      function a(c, o, d, h, l) {
        this.appURL = c, this.axios = o, this.useToken = d ?? !1, this.token = h, this.tokenType = l;
      }
      return a.prototype.getDoc = function(c, o) {
        return o === void 0 && (o = ""), e(this, void 0, void 0, function() {
          return n(this, function(d) {
            return [2, this.axios.get("/api/document/".concat(c, "/").concat(encodeURIComponent(o))).then(function(h) {
              return h.data.data;
            }).catch(function(h) {
              var l, p;
              throw t(t({}, h.response.data), { httpStatus: h.response.status, httpStatusText: h.response.statusText, message: "There was an error while fetching the document.", exception: (p = (l = h.response.data.exception) !== null && l !== void 0 ? l : h.response.data.exc_type) !== null && p !== void 0 ? p : "" });
            })];
          });
        });
      }, a.prototype.getDocList = function(c, o) {
        var d;
        return e(this, void 0, void 0, function() {
          var h, l, p, w, v, m, E, R, q, x, X;
          return n(this, function(z) {
            return h = {}, o && (l = o.fields, p = o.filters, w = o.orFilters, v = o.orderBy, m = o.limit, E = o.limit_start, R = o.groupBy, q = o.asDict, x = q === void 0 ? !0 : q, X = v ? "".concat(String(v == null ? void 0 : v.field), " ").concat((d = v == null ? void 0 : v.order) !== null && d !== void 0 ? d : "asc") : "", h = {
              fields: l ? JSON.stringify(l) : void 0,
              filters: p ? JSON.stringify(p) : void 0,
              or_filters: w ? JSON.stringify(w) : void 0,
              order_by: X,
              group_by: R,
              limit: m,
              limit_start: E,
              as_dict: x
            }), [2, this.axios.get("/api/document/".concat(c), { params: h }).then(function(H) {
              return H.data.data;
            }).catch(function(H) {
              var U, J;
              throw t(t({}, H.response.data), { httpStatus: H.response.status, httpStatusText: H.response.statusText, message: "There was an error while fetching the documents.", exception: (J = (U = H.response.data.exception) !== null && U !== void 0 ? U : H.response.data.exc_type) !== null && J !== void 0 ? J : "" });
            })];
          });
        });
      }, a.prototype.createDoc = function(c, o) {
        return e(this, void 0, void 0, function() {
          return n(this, function(d) {
            return [2, this.axios.post("/api/document/".concat(c), t({}, o)).then(function(h) {
              return h.data.data;
            }).catch(function(h) {
              var l, p, w;
              throw t(t({}, h.response.data), { httpStatus: h.response.status, httpStatusText: h.response.statusText, message: (l = h.response.data.message) !== null && l !== void 0 ? l : "There was an error while creating the document.", exception: (w = (p = h.response.data.exception) !== null && p !== void 0 ? p : h.response.data.exc_type) !== null && w !== void 0 ? w : "" });
            })];
          });
        });
      }, a.prototype.updateDoc = function(c, o, d) {
        return e(this, void 0, void 0, function() {
          return n(this, function(h) {
            return [2, this.axios.put("/api/document/".concat(c, "/").concat(o && encodeURIComponent(o)), t({}, d)).then(function(l) {
              return l.data.data;
            }).catch(function(l) {
              var p, w, v;
              throw t(t({}, l.response.data), { httpStatus: l.response.status, httpStatusText: l.response.statusText, message: (p = l.response.data.message) !== null && p !== void 0 ? p : "There was an error while updating the document.", exception: (v = (w = l.response.data.exception) !== null && w !== void 0 ? w : l.response.data.exc_type) !== null && v !== void 0 ? v : "" });
            })];
          });
        });
      }, a.prototype.deleteDoc = function(c, o) {
        return e(this, void 0, void 0, function() {
          return n(this, function(d) {
            return [2, this.axios.delete("/api/document/".concat(c, "/").concat(o && encodeURIComponent(o))).then(function(h) {
              return h.data;
            }).catch(function(h) {
              var l, p;
              throw t(t({}, h.response.data), { httpStatus: h.response.status, httpStatusText: h.response.statusText, message: "There was an error while deleting the document.", exception: (p = (l = h.response.data.exception) !== null && l !== void 0 ? l : h.response.data.exc_type) !== null && p !== void 0 ? p : "" });
            })];
          });
        });
      }, a.prototype.getCount = function(c, o, d, h) {
        return d === void 0 && (d = !1), h === void 0 && (h = !1), e(this, void 0, void 0, function() {
          var l;
          return n(this, function(p) {
            return l = {
              doctype: c,
              filters: []
            }, d && (l.cache = d), h && (l.debug = h), o && (l.filters = o ? JSON.stringify(o) : void 0), [2, this.axios.get("/api/method/frappe.client.get_count", { params: l }).then(function(w) {
              return w.data.message;
            }).catch(function(w) {
              var v, m;
              throw t(t({}, w.response.data), { httpStatus: w.response.status, httpStatusText: w.response.statusText, message: "There was an error while getting the count.", exception: (m = (v = w.response.data.exception) !== null && v !== void 0 ? v : w.response.data.exc_type) !== null && m !== void 0 ? m : "" });
            })];
          });
        });
      }, a.prototype.getLastDoc = function(c, o) {
        return e(this, void 0, void 0, function() {
          var d, h;
          return n(this, function(l) {
            switch (l.label) {
              case 0:
                return d = {
                  orderBy: {
                    field: "creation",
                    order: "desc"
                  }
                }, o && (d = t(t({}, d), o)), [4, this.getDocList(c, t(t({}, d), { limit: 1, fields: ["name"] }))];
              case 1:
                return h = l.sent(), h.length > 0 ? [2, this.getDoc(c, h[0].name)] : [2, {}];
            }
          });
        });
      }, a.prototype.renameDoc = function(c, o, d, h) {
        return h === void 0 && (h = !1), e(this, void 0, void 0, function() {
          return n(this, function(l) {
            return [2, this.axios.post("/api/method/frappe.client.rename_doc", {
              doctype: c,
              old_name: o,
              new_name: d,
              merge: h
            }).then(function(p) {
              return p.data;
            }).catch(function(p) {
              var w, v, m;
              throw t(t({}, p.response.data), { httpStatus: p.response.status, httpStatusText: p.response.statusText, message: (w = p.response.data.message) !== null && w !== void 0 ? w : "There was an error while renaming the document.", exception: (m = (v = p.response.data.exception) !== null && v !== void 0 ? v : p.response.data.exc_type) !== null && m !== void 0 ? m : "" });
            })];
          });
        });
      }, a.prototype.getValue = function(c, o, d, h, l, p) {
        return h === void 0 && (h = !0), l === void 0 && (l = !1), p === void 0 && (p = null), e(this, void 0, void 0, function() {
          var w;
          return n(this, function(v) {
            return w = {
              doctype: c,
              fieldname: "[]",
              filters: [],
              as_dict: h,
              debug: l,
              parent: null
            }, o && (w.fieldname = typeof o == "object" ? JSON.stringify(o) : o), d && (w.filters = d ? JSON.stringify(d) : void 0), p && (w.parent = p), [2, this.axios.get("/api/method/frappe.client.get_value", { params: w }).then(function(m) {
              return m.data;
            }).catch(function(m) {
              var E, R;
              throw t(t({}, m.response.data), { httpStatus: m.response.status, httpStatusText: m.response.statusText, message: "There was an error while getting the value.", exception: (R = (E = m.response.data.exception) !== null && E !== void 0 ? E : m.response.data.exc_type) !== null && R !== void 0 ? R : "" });
            })];
          });
        });
      }, a.prototype.setValue = function(c, o, d, h) {
        return e(this, void 0, void 0, function() {
          return n(this, function(l) {
            return d !== null && typeof d == "object" && !Array.isArray(d) && (h = void 0), [2, this.axios.post("/api/method/frappe.client.set_value", {
              doctype: c,
              name: o,
              fieldname: d,
              value: h
            }).then(function(p) {
              return p.data;
            }).catch(function(p) {
              var w, v;
              throw t(t({}, p.response.data), { httpStatus: p.response.status, httpStatusText: p.response.statusText, message: "There was an error while setting the value.", exception: (v = (w = p.response.data.exception) !== null && w !== void 0 ? w : p.response.data.exc_type) !== null && v !== void 0 ? v : "" });
            })];
          });
        });
      }, a.prototype.getSingleValue = function(c, o) {
        return e(this, void 0, void 0, function() {
          var d;
          return n(this, function(h) {
            return d = {
              doctype: c,
              field: o
            }, [2, this.axios.get("/api/method/frappe.client.get_single_value", { params: d }).then(function(l) {
              return l.data;
            }).catch(function(l) {
              var p, w;
              throw t(t({}, l.response.data), { httpStatus: l.response.status, httpStatusText: l.response.statusText, message: "There was an error while getting the value of single doctype.", exception: (w = (p = l.response.data.exception) !== null && p !== void 0 ? p : l.response.data.exc_type) !== null && w !== void 0 ? w : "" });
            })];
          });
        });
      }, a.prototype.submit = function(c) {
        return e(this, void 0, void 0, function() {
          return n(this, function(o) {
            return [2, this.axios.post("/api/method/frappe.client.submit", { doc: c }).then(function(d) {
              return d.data.message;
            }).catch(function(d) {
              var h, l;
              throw t(t({}, d.response.data), { httpStatus: d.response.status, httpStatusText: d.response.statusText, message: "There was an error while submitting the document.", exception: (l = (h = d.response.data.exception) !== null && h !== void 0 ? h : d.response.data.exc_type) !== null && l !== void 0 ? l : "" });
            })];
          });
        });
      }, a.prototype.cancel = function(c, o) {
        return e(this, void 0, void 0, function() {
          return n(this, function(d) {
            return [2, this.axios.post("/api/method/frappe.client.cancel", { doctype: c, name: o }).then(function(h) {
              return h.data;
            }).catch(function(h) {
              var l, p;
              throw t(t({}, h.response.data), { httpStatus: h.response.status, httpStatusText: h.response.statusText, message: "There was an error while cancelling the document.", exception: (p = (l = h.response.data.exception) !== null && l !== void 0 ? l : h.response.data.exc_type) !== null && p !== void 0 ? p : "" });
            })];
          });
        });
      }, a;
    }()
  );
  return xe.FrappeDB = s, xe;
}
var Ae = {}, Ie = {};
/*! Axios v1.8.2 Copyright (c) 2025 Matt Zabriskie and contributors */
var pn, Ts;
function Oi() {
  if (Ts) return pn;
  Ts = 1;
  function t(r, i) {
    return function() {
      return r.apply(i, arguments);
    };
  }
  const { toString: e } = Object.prototype, { getPrototypeOf: n } = Object, s = /* @__PURE__ */ ((r) => (i) => {
    const u = e.call(i);
    return r[u] || (r[u] = u.slice(8, -1).toLowerCase());
  })(/* @__PURE__ */ Object.create(null)), a = (r) => (r = r.toLowerCase(), (i) => s(i) === r), c = (r) => (i) => typeof i === r, { isArray: o } = Array, d = c("undefined");
  function h(r) {
    return r !== null && !d(r) && r.constructor !== null && !d(r.constructor) && v(r.constructor.isBuffer) && r.constructor.isBuffer(r);
  }
  const l = a("ArrayBuffer");
  function p(r) {
    let i;
    return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? i = ArrayBuffer.isView(r) : i = r && r.buffer && l(r.buffer), i;
  }
  const w = c("string"), v = c("function"), m = c("number"), E = (r) => r !== null && typeof r == "object", R = (r) => r === !0 || r === !1, q = (r) => {
    if (s(r) !== "object")
      return !1;
    const i = n(r);
    return (i === null || i === Object.prototype || Object.getPrototypeOf(i) === null) && !(Symbol.toStringTag in r) && !(Symbol.iterator in r);
  }, x = a("Date"), X = a("File"), z = a("Blob"), H = a("FileList"), U = (r) => E(r) && v(r.pipe), J = (r) => {
    let i;
    return r && (typeof FormData == "function" && r instanceof FormData || v(r.append) && ((i = s(r)) === "formdata" || // detect form-data instance
    i === "object" && v(r.toString) && r.toString() === "[object FormData]"));
  }, ke = a("URLSearchParams"), [N, pe, M, ce] = ["ReadableStream", "Request", "Response", "Headers"].map(a), be = (r) => r.trim ? r.trim() : r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
  function G(r, i, { allOwnKeys: u = !1 } = {}) {
    if (r === null || typeof r > "u")
      return;
    let f, y;
    if (typeof r != "object" && (r = [r]), o(r))
      for (f = 0, y = r.length; f < y; f++)
        i.call(null, r[f], f, r);
    else {
      const g = u ? Object.getOwnPropertyNames(r) : Object.keys(r), b = g.length;
      let S;
      for (f = 0; f < b; f++)
        S = g[f], i.call(null, r[S], S, r);
    }
  }
  function ue(r, i) {
    i = i.toLowerCase();
    const u = Object.keys(r);
    let f = u.length, y;
    for (; f-- > 0; )
      if (y = u[f], i === y.toLowerCase())
        return y;
    return null;
  }
  const le = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ti, Ne = (r) => !d(r) && r !== le;
  function Y() {
    const { caseless: r } = Ne(this) && this || {}, i = {}, u = (f, y) => {
      const g = r && ue(i, y) || y;
      q(i[g]) && q(f) ? i[g] = Y(i[g], f) : q(f) ? i[g] = Y({}, f) : o(f) ? i[g] = f.slice() : i[g] = f;
    };
    for (let f = 0, y = arguments.length; f < y; f++)
      arguments[f] && G(arguments[f], u);
    return i;
  }
  const ge = (r, i, u, { allOwnKeys: f } = {}) => (G(i, (y, g) => {
    u && v(y) ? r[g] = t(y, u) : r[g] = y;
  }, { allOwnKeys: f }), r), Ve = (r) => (r.charCodeAt(0) === 65279 && (r = r.slice(1)), r), lt = (r, i, u, f) => {
    r.prototype = Object.create(i.prototype, f), r.prototype.constructor = r, Object.defineProperty(r, "super", {
      value: i.prototype
    }), u && Object.assign(r.prototype, u);
  }, Fe = (r, i, u, f) => {
    let y, g, b;
    const S = {};
    if (i = i || {}, r == null) return i;
    do {
      for (y = Object.getOwnPropertyNames(r), g = y.length; g-- > 0; )
        b = y[g], (!f || f(b, r, i)) && !S[b] && (i[b] = r[b], S[b] = !0);
      r = u !== !1 && n(r);
    } while (r && (!u || u(r, i)) && r !== Object.prototype);
    return i;
  }, se = (r, i, u) => {
    r = String(r), (u === void 0 || u > r.length) && (u = r.length), u -= i.length;
    const f = r.indexOf(i, u);
    return f !== -1 && f === u;
  }, Me = (r) => {
    if (!r) return null;
    if (o(r)) return r;
    let i = r.length;
    if (!m(i)) return null;
    const u = new Array(i);
    for (; i-- > 0; )
      u[i] = r[i];
    return u;
  }, $e = /* @__PURE__ */ ((r) => (i) => r && i instanceof r)(typeof Uint8Array < "u" && n(Uint8Array)), Ge = (r, i) => {
    const f = (r && r[Symbol.iterator]).call(r);
    let y;
    for (; (y = f.next()) && !y.done; ) {
      const g = y.value;
      i.call(r, g[0], g[1]);
    }
  }, tt = (r, i) => {
    let u;
    const f = [];
    for (; (u = r.exec(i)) !== null; )
      f.push(u);
    return f;
  }, Et = a("HTMLFormElement"), en = (r) => r.toLowerCase().replace(
    /[-_\s]([a-z\d])(\w*)/g,
    function(u, f, y) {
      return f.toUpperCase() + y;
    }
  ), St = (({ hasOwnProperty: r }) => (i, u) => r.call(i, u))(Object.prototype), Xe = a("RegExp"), ft = (r, i) => {
    const u = Object.getOwnPropertyDescriptors(r), f = {};
    G(u, (y, g) => {
      let b;
      (b = i(y, g, r)) !== !1 && (f[g] = b || y);
    }), Object.defineProperties(r, f);
  }, Xn = (r) => {
    ft(r, (i, u) => {
      if (v(r) && ["arguments", "caller", "callee"].indexOf(u) !== -1)
        return !1;
      const f = r[u];
      if (v(f)) {
        if (i.enumerable = !1, "writable" in i) {
          i.writable = !1;
          return;
        }
        i.set || (i.set = () => {
          throw Error("Can not rewrite read-only method '" + u + "'");
        });
      }
    });
  }, $ = (r, i) => {
    const u = {}, f = (y) => {
      y.forEach((g) => {
        u[g] = !0;
      });
    };
    return o(r) ? f(r) : f(String(r).split(i)), u;
  }, j = () => {
  }, fe = (r, i) => r != null && Number.isFinite(r = +r) ? r : i;
  function K(r) {
    return !!(r && v(r.append) && r[Symbol.toStringTag] === "FormData" && r[Symbol.iterator]);
  }
  const _e = (r) => {
    const i = new Array(10), u = (f, y) => {
      if (E(f)) {
        if (i.indexOf(f) >= 0)
          return;
        if (!("toJSON" in f)) {
          i[y] = f;
          const g = o(f) ? [] : {};
          return G(f, (b, S) => {
            const A = u(b, y + 1);
            !d(A) && (g[S] = A);
          }), i[y] = void 0, g;
        }
      }
      return f;
    };
    return u(r, 0);
  }, He = a("AsyncFunction"), re = (r) => r && (E(r) || v(r)) && v(r.then) && v(r.catch), he = ((r, i) => r ? setImmediate : i ? ((u, f) => (le.addEventListener("message", ({ source: y, data: g }) => {
    y === le && g === u && f.length && f.shift()();
  }, !1), (y) => {
    f.push(y), le.postMessage(u, "*");
  }))(`axios@${Math.random()}`, []) : (u) => setTimeout(u))(
    typeof setImmediate == "function",
    v(le.postMessage)
  ), Se = typeof queueMicrotask < "u" ? queueMicrotask.bind(le) : typeof process < "u" && process.nextTick || he;
  var _ = {
    isArray: o,
    isArrayBuffer: l,
    isBuffer: h,
    isFormData: J,
    isArrayBufferView: p,
    isString: w,
    isNumber: m,
    isBoolean: R,
    isObject: E,
    isPlainObject: q,
    isReadableStream: N,
    isRequest: pe,
    isResponse: M,
    isHeaders: ce,
    isUndefined: d,
    isDate: x,
    isFile: X,
    isBlob: z,
    isRegExp: Xe,
    isFunction: v,
    isStream: U,
    isURLSearchParams: ke,
    isTypedArray: $e,
    isFileList: H,
    forEach: G,
    merge: Y,
    extend: ge,
    trim: be,
    stripBOM: Ve,
    inherits: lt,
    toFlatObject: Fe,
    kindOf: s,
    kindOfTest: a,
    endsWith: se,
    toArray: Me,
    forEachEntry: Ge,
    matchAll: tt,
    isHTMLForm: Et,
    hasOwnProperty: St,
    hasOwnProp: St,
    // an alias to avoid ESLint no-prototype-builtins detection
    reduceDescriptors: ft,
    freezeMethods: Xn,
    toObjectSet: $,
    toCamelCase: en,
    noop: j,
    toFiniteNumber: fe,
    findKey: ue,
    global: le,
    isContextDefined: Ne,
    isSpecCompliantForm: K,
    toJSONObject: _e,
    isAsyncFn: He,
    isThenable: re,
    setImmediate: he,
    asap: Se
  };
  function k(r, i, u, f, y) {
    Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = r, this.name = "AxiosError", i && (this.code = i), u && (this.config = u), f && (this.request = f), y && (this.response = y, this.status = y.status ? y.status : null);
  }
  _.inherits(k, 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: _.toJSONObject(this.config),
        code: this.code,
        status: this.status
      };
    }
  });
  const ht = k.prototype, ye = {};
  [
    "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((r) => {
    ye[r] = { value: r };
  }), Object.defineProperties(k, ye), Object.defineProperty(ht, "isAxiosError", { value: !0 }), k.from = (r, i, u, f, y, g) => {
    const b = Object.create(ht);
    return _.toFlatObject(r, b, function(A) {
      return A !== Error.prototype;
    }, (S) => S !== "isAxiosError"), k.call(b, r.message, i, u, f, y), b.cause = r, b.name = r.name, g && Object.assign(b, g), b;
  };
  var Re = null;
  function Ye(r) {
    return _.isPlainObject(r) || _.isArray(r);
  }
  function Rt(r) {
    return _.endsWith(r, "[]") ? r.slice(0, -2) : r;
  }
  function nt(r, i, u) {
    return r ? r.concat(i).map(function(y, g) {
      return y = Rt(y), !u && g ? "[" + y + "]" : y;
    }).join(u ? "." : "") : i;
  }
  function Cr(r) {
    return _.isArray(r) && !r.some(Ye);
  }
  const Lr = _.toFlatObject(_, {}, null, function(i) {
    return /^is[A-Z]/.test(i);
  });
  function Tt(r, i, u) {
    if (!_.isObject(r))
      throw new TypeError("target must be an object");
    i = i || new FormData(), u = _.toFlatObject(u, {
      metaTokens: !0,
      dots: !1,
      indexes: !1
    }, !1, function(F, D) {
      return !_.isUndefined(D[F]);
    });
    const f = u.metaTokens, y = u.visitor || O, g = u.dots, b = u.indexes, A = (u.Blob || typeof Blob < "u" && Blob) && _.isSpecCompliantForm(i);
    if (!_.isFunction(y))
      throw new TypeError("visitor must be a function");
    function T(L) {
      if (L === null) return "";
      if (_.isDate(L))
        return L.toISOString();
      if (!A && _.isBlob(L))
        throw new k("Blob is not supported. Use a Buffer instead.");
      return _.isArrayBuffer(L) || _.isTypedArray(L) ? A && typeof Blob == "function" ? new Blob([L]) : Buffer.from(L) : L;
    }
    function O(L, F, D) {
      let Q = L;
      if (L && !D && typeof L == "object") {
        if (_.endsWith(F, "{}"))
          F = f ? F : F.slice(0, -2), L = JSON.stringify(L);
        else if (_.isArray(L) && Cr(L) || (_.isFileList(L) || _.endsWith(F, "[]")) && (Q = _.toArray(L)))
          return F = Rt(F), Q.forEach(function(de, qe) {
            !(_.isUndefined(de) || de === null) && i.append(
              // eslint-disable-next-line no-nested-ternary
              b === !0 ? nt([F], qe, g) : b === null ? F : F + "[]",
              T(de)
            );
          }), !1;
      }
      return Ye(L) ? !0 : (i.append(nt(D, F, g), T(L)), !1);
    }
    const C = [], W = Object.assign(Lr, {
      defaultVisitor: O,
      convertValue: T,
      isVisitable: Ye
    });
    function ie(L, F) {
      if (!_.isUndefined(L)) {
        if (C.indexOf(L) !== -1)
          throw Error("Circular reference detected in " + F.join("."));
        C.push(L), _.forEach(L, function(Q, oe) {
          (!(_.isUndefined(Q) || Q === null) && y.call(
            i,
            Q,
            _.isString(oe) ? oe.trim() : oe,
            F,
            W
          )) === !0 && ie(Q, F ? F.concat(oe) : [oe]);
        }), C.pop();
      }
    }
    if (!_.isObject(r))
      throw new TypeError("data must be an object");
    return ie(r), i;
  }
  function Yn(r) {
    const i = {
      "!": "%21",
      "'": "%27",
      "(": "%28",
      ")": "%29",
      "~": "%7E",
      "%20": "+",
      "%00": "\0"
    };
    return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g, function(f) {
      return i[f];
    });
  }
  function tn(r, i) {
    this._pairs = [], r && Tt(r, this, i);
  }
  const Qn = tn.prototype;
  Qn.append = function(i, u) {
    this._pairs.push([i, u]);
  }, Qn.toString = function(i) {
    const u = i ? function(f) {
      return i.call(this, f, Yn);
    } : Yn;
    return this._pairs.map(function(y) {
      return u(y[0]) + "=" + u(y[1]);
    }, "").join("&");
  };
  function Dr(r) {
    return encodeURIComponent(r).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
  }
  function Zn(r, i, u) {
    if (!i)
      return r;
    const f = u && u.encode || Dr;
    _.isFunction(u) && (u = {
      serialize: u
    });
    const y = u && u.serialize;
    let g;
    if (y ? g = y(i, u) : g = _.isURLSearchParams(i) ? i.toString() : new tn(i, u).toString(f), g) {
      const b = r.indexOf("#");
      b !== -1 && (r = r.slice(0, b)), r += (r.indexOf("?") === -1 ? "?" : "&") + g;
    }
    return r;
  }
  class kr {
    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(i, u, f) {
      return this.handlers.push({
        fulfilled: i,
        rejected: u,
        synchronous: f ? f.synchronous : !1,
        runWhen: f ? f.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(i) {
      this.handlers[i] && (this.handlers[i] = 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(i) {
      _.forEach(this.handlers, function(f) {
        f !== null && i(f);
      });
    }
  }
  var es = kr, ts = {
    silentJSONParsing: !0,
    forcedJSONParsing: !0,
    clarifyTimeoutError: !1
  }, Nr = typeof URLSearchParams < "u" ? URLSearchParams : tn, Fr = typeof FormData < "u" ? FormData : null, Br = typeof Blob < "u" ? Blob : null, Pr = {
    isBrowser: !0,
    classes: {
      URLSearchParams: Nr,
      FormData: Fr,
      Blob: Br
    },
    protocols: ["http", "https", "file", "blob", "url", "data"]
  };
  const nn = typeof window < "u" && typeof document < "u", sn = typeof navigator == "object" && navigator || void 0, Ur = nn && (!sn || ["ReactNative", "NativeScript", "NS"].indexOf(sn.product) < 0), qr = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
  self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Ir = nn && window.location.href || "http://localhost";
  var jr = /* @__PURE__ */ Object.freeze({
    __proto__: null,
    hasBrowserEnv: nn,
    hasStandardBrowserWebWorkerEnv: qr,
    hasStandardBrowserEnv: Ur,
    navigator: sn,
    origin: Ir
  }), me = {
    ...jr,
    ...Pr
  };
  function Vr(r, i) {
    return Tt(r, new me.classes.URLSearchParams(), Object.assign({
      visitor: function(u, f, y, g) {
        return me.isNode && _.isBuffer(u) ? (this.append(f, u.toString("base64")), !1) : g.defaultVisitor.apply(this, arguments);
      }
    }, i));
  }
  function Mr(r) {
    return _.matchAll(/\w+|\[(\w*)]/g, r).map((i) => i[0] === "[]" ? "" : i[1] || i[0]);
  }
  function $r(r) {
    const i = {}, u = Object.keys(r);
    let f;
    const y = u.length;
    let g;
    for (f = 0; f < y; f++)
      g = u[f], i[g] = r[g];
    return i;
  }
  function ns(r) {
    function i(u, f, y, g) {
      let b = u[g++];
      if (b === "__proto__") return !0;
      const S = Number.isFinite(+b), A = g >= u.length;
      return b = !b && _.isArray(y) ? y.length : b, A ? (_.hasOwnProp(y, b) ? y[b] = [y[b], f] : y[b] = f, !S) : ((!y[b] || !_.isObject(y[b])) && (y[b] = []), i(u, f, y[b], g) && _.isArray(y[b]) && (y[b] = $r(y[b])), !S);
    }
    if (_.isFormData(r) && _.isFunction(r.entries)) {
      const u = {};
      return _.forEachEntry(r, (f, y) => {
        i(Mr(f), y, u, 0);
      }), u;
    }
    return null;
  }
  function Hr(r, i, u) {
    if (_.isString(r))
      try {
        return (i || JSON.parse)(r), _.trim(r);
      } catch (f) {
        if (f.name !== "SyntaxError")
          throw f;
      }
    return (u || JSON.stringify)(r);
  }
  const rn = {
    transitional: ts,
    adapter: ["xhr", "http", "fetch"],
    transformRequest: [function(i, u) {
      const f = u.getContentType() || "", y = f.indexOf("application/json") > -1, g = _.isObject(i);
      if (g && _.isHTMLForm(i) && (i = new FormData(i)), _.isFormData(i))
        return y ? JSON.stringify(ns(i)) : i;
      if (_.isArrayBuffer(i) || _.isBuffer(i) || _.isStream(i) || _.isFile(i) || _.isBlob(i) || _.isReadableStream(i))
        return i;
      if (_.isArrayBufferView(i))
        return i.buffer;
      if (_.isURLSearchParams(i))
        return u.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), i.toString();
      let S;
      if (g) {
        if (f.indexOf("application/x-www-form-urlencoded") > -1)
          return Vr(i, this.formSerializer).toString();
        if ((S = _.isFileList(i)) || f.indexOf("multipart/form-data") > -1) {
          const A = this.env && this.env.FormData;
          return Tt(
            S ? { "files[]": i } : i,
            A && new A(),
            this.formSerializer
          );
        }
      }
      return g || y ? (u.setContentType("application/json", !1), Hr(i)) : i;
    }],
    transformResponse: [function(i) {
      const u = this.transitional || rn.transitional, f = u && u.forcedJSONParsing, y = this.responseType === "json";
      if (_.isResponse(i) || _.isReadableStream(i))
        return i;
      if (i && _.isString(i) && (f && !this.responseType || y)) {
        const b = !(u && u.silentJSONParsing) && y;
        try {
          return JSON.parse(i);
        } catch (S) {
          if (b)
            throw S.name === "SyntaxError" ? k.from(S, k.ERR_BAD_RESPONSE, this, null, this.response) : S;
        }
      }
      return i;
    }],
    /**
     * 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: me.classes.FormData,
      Blob: me.classes.Blob
    },
    validateStatus: function(i) {
      return i >= 200 && i < 300;
    },
    headers: {
      common: {
        Accept: "application/json, text/plain, */*",
        "Content-Type": void 0
      }
    }
  };
  _.forEach(["delete", "get", "head", "post", "put", "patch"], (r) => {
    rn.headers[r] = {};
  });
  var on = rn;
  const Wr = _.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"
  ]);
  var zr = (r) => {
    const i = {};
    let u, f, y;
    return r && r.split(`
`).forEach(function(b) {
      y = b.indexOf(":"), u = b.substring(0, y).trim().toLowerCase(), f = b.substring(y + 1).trim(), !(!u || i[u] && Wr[u]) && (u === "set-cookie" ? i[u] ? i[u].push(f) : i[u] = [f] : i[u] = i[u] ? i[u] + ", " + f : f);
    }), i;
  };
  const ss = Symbol("internals");
  function dt(r) {
    return r && String(r).trim().toLowerCase();
  }
  function Ot(r) {
    return r === !1 || r == null ? r : _.isArray(r) ? r.map(Ot) : String(r);
  }
  function Jr(r) {
    const i = /* @__PURE__ */ Object.create(null), u = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
    let f;
    for (; f = u.exec(r); )
      i[f[1]] = f[2];
    return i;
  }
  const Kr = (r) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());
  function an(r, i, u, f, y) {
    if (_.isFunction(f))
      return f.call(this, i, u);
    if (y && (i = u), !!_.isString(i)) {
      if (_.isString(f))
        return i.indexOf(f) !== -1;
      if (_.isRegExp(f))
        return f.test(i);
    }
  }
  function Gr(r) {
    return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (i, u, f) => u.toUpperCase() + f);
  }
  function Xr(r, i) {
    const u = _.toCamelCase(" " + i);
    ["get", "set", "has"].forEach((f) => {
      Object.defineProperty(r, f + u, {
        value: function(y, g, b) {
          return this[f].call(this, i, y, g, b);
        },
        configurable: !0
      });
    });
  }
  class xt {
    constructor(i) {
      i && this.set(i);
    }
    set(i, u, f) {
      const y = this;
      function g(S, A, T) {
        const O = dt(A);
        if (!O)
          throw new Error("header name must be a non-empty string");
        const C = _.findKey(y, O);
        (!C || y[C] === void 0 || T === !0 || T === void 0 && y[C] !== !1) && (y[C || A] = Ot(S));
      }
      const b = (S, A) => _.forEach(S, (T, O) => g(T, O, A));
      if (_.isPlainObject(i) || i instanceof this.constructor)
        b(i, u);
      else if (_.isString(i) && (i = i.trim()) && !Kr(i))
        b(zr(i), u);
      else if (_.isHeaders(i))
        for (const [S, A] of i.entries())
          g(A, S, f);
      else
        i != null && g(u, i, f);
      return this;
    }
    get(i, u) {
      if (i = dt(i), i) {
        const f = _.findKey(this, i);
        if (f) {
          const y = this[f];
          if (!u)
            return y;
          if (u === !0)
            return Jr(y);
          if (_.isFunction(u))
            return u.call(this, y, f);
          if (_.isRegExp(u))
            return u.exec(y);
          throw new TypeError("parser must be boolean|regexp|function");
        }
      }
    }
    has(i, u) {
      if (i = dt(i), i) {
        const f = _.findKey(this, i);
        return !!(f && this[f] !== void 0 && (!u || an(this, this[f], f, u)));
      }
      return !1;
    }
    delete(i, u) {
      const f = this;
      let y = !1;
      function g(b) {
        if (b = dt(b), b) {
          const S = _.findKey(f, b);
          S && (!u || an(f, f[S], S, u)) && (delete f[S], y = !0);
        }
      }
      return _.isArray(i) ? i.forEach(g) : g(i), y;
    }
    clear(i) {
      const u = Object.keys(this);
      let f = u.length, y = !1;
      for (; f--; ) {
        const g = u[f];
        (!i || an(this, this[g], g, i, !0)) && (delete this[g], y = !0);
      }
      return y;
    }
    normalize(i) {
      const u = this, f = {};
      return _.forEach(this, (y, g) => {
        const b = _.findKey(f, g);
        if (b) {
          u[b] = Ot(y), delete u[g];
          return;
        }
        const S = i ? Gr(g) : String(g).trim();
        S !== g && delete u[g], u[S] = Ot(y), f[S] = !0;
      }), this;
    }
    concat(...i) {
      return this.constructor.concat(this, ...i);
    }
    toJSON(i) {
      const u = /* @__PURE__ */ Object.create(null);
      return _.forEach(this, (f, y) => {
        f != null && f !== !1 && (u[y] = i && _.isArray(f) ? f.join(", ") : f);
      }), u;
    }
    [Symbol.iterator]() {
      return Object.entries(this.toJSON())[Symbol.iterator]();
    }
    toString() {
      return Object.entries(this.toJSON()).map(([i, u]) => i + ": " + u).join(`
`);
    }
    get [Symbol.toStringTag]() {
      return "AxiosHeaders";
    }
    static from(i) {
      return i instanceof this ? i : new this(i);
    }
    static concat(i, ...u) {
      const f = new this(i);
      return u.forEach((y) => f.set(y)), f;
    }
    static accessor(i) {
      const f = (this[ss] = this[ss] = {
        accessors: {}
      }).accessors, y = this.prototype;
      function g(b) {
        const S = dt(b);
        f[S] || (Xr(y, b), f[S] = !0);
      }
      return _.isArray(i) ? i.forEach(g) : g(i), this;
    }
  }
  xt.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]), _.reduceDescriptors(xt.prototype, ({ value: r }, i) => {
    let u = i[0].toUpperCase() + i.slice(1);
    return {
      get: () => r,
      set(f) {
        this[u] = f;
      }
    };
  }), _.freezeMethods(xt);
  var Te = xt;
  function cn(r, i) {
    const u = this || on, f = i || u, y = Te.from(f.headers);
    let g = f.data;
    return _.forEach(r, function(S) {
      g = S.call(u, g, y.normalize(), i ? i.status : void 0);
    }), y.normalize(), g;
  }
  function rs(r) {
    return !!(r && r.__CANCEL__);
  }
  function st(r, i, u) {
    k.call(this, r ?? "canceled", k.ERR_CANCELED, i, u), this.name = "CanceledError";
  }
  _.inherits(st, k, {
    __CANCEL__: !0
  });
  function is(r, i, u) {
    const f = u.config.validateStatus;
    !u.status || !f || f(u.status) ? r(u) : i(new k(
      "Request failed with status code " + u.status,
      [k.ERR_BAD_REQUEST, k.ERR_BAD_RESPONSE][Math.floor(u.status / 100) - 4],
      u.config,
      u.request,
      u
    ));
  }
  function Yr(r) {
    const i = /^([-+\w]{1,25})(:?\/\/|:)/.exec(r);
    return i && i[1] || "";
  }
  function Qr(r, i) {
    r = r || 10;
    const u = new Array(r), f = new Array(r);
    let y = 0, g = 0, b;
    return i = i !== void 0 ? i : 1e3, function(A) {
      const T = Date.now(), O = f[g];
      b || (b = T), u[y] = A, f[y] = T;
      let C = g, W = 0;
      for (; C !== y; )
        W += u[C++], C = C % r;
      if (y = (y + 1) % r, y === g && (g = (g + 1) % r), T - b < i)
        return;
      const ie = O && T - O;
      return ie ? Math.round(W * 1e3 / ie) : void 0;
    };
  }
  function Zr(r, i) {
    let u = 0, f = 1e3 / i, y, g;
    const b = (T, O = Date.now()) => {
      u = O, y = null, g && (clearTimeout(g), g = null), r.apply(null, T);
    };
    return [(...T) => {
      const O = Date.now(), C = O - u;
      C >= f ? b(T, O) : (y = T, g || (g = setTimeout(() => {
        g = null, b(y);
      }, f - C)));
    }, () => y && b(y)];
  }
  const At = (r, i, u = 3) => {
    let f = 0;
    const y = Qr(50, 250);
    return Zr((g) => {
      const b = g.loaded, S = g.lengthComputable ? g.total : void 0, A = b - f, T = y(A), O = b <= S;
      f = b;
      const C = {
        loaded: b,
        total: S,
        progress: S ? b / S : void 0,
        bytes: A,
        rate: T || void 0,
        estimated: T && S && O ? (S - b) / T : void 0,
        event: g,
        lengthComputable: S != null,
        [i ? "download" : "upload"]: !0
      };
      r(C);
    }, u);
  }, os = (r, i) => {
    const u = r != null;
    return [(f) => i[0]({
      lengthComputable: u,
      total: r,
      loaded: f
    }), i[1]];
  }, as = (r) => (...i) => _.asap(() => r(...i));
  var ei = me.hasStandardBrowserEnv ? /* @__PURE__ */ ((r, i) => (u) => (u = new URL(u, me.origin), r.protocol === u.protocol && r.host === u.host && (i || r.port === u.port)))(
    new URL(me.origin),
    me.navigator && /(msie|trident)/i.test(me.navigator.userAgent)
  ) : () => !0, ti = me.hasStandardBrowserEnv ? (
    // Standard browser envs support document.cookie
    {
      write(r, i, u, f, y, g) {
        const b = [r + "=" + encodeURIComponent(i)];
        _.isNumber(u) && b.push("expires=" + new Date(u).toGMTString()), _.isString(f) && b.push("path=" + f), _.isString(y) && b.push("domain=" + y), g === !0 && b.push("secure"), document.cookie = b.join("; ");
      },
      read(r) {
        const i = document.cookie.match(new RegExp("(^|;\\s*)(" + r + ")=([^;]*)"));
        return i ? decodeURIComponent(i[3]) : null;
      },
      remove(r) {
        this.write(r, "", Date.now() - 864e5);
      }
    }
  ) : (
    // Non-standard browser env (web workers, react-native) lack needed support.
    {
      write() {
      },
      read() {
        return null;
      },