import { unref as vt, getCurrentScope as Bt, onScopeDispose as jt, ref as ne, watch as ke } from "vue";
import { encryption as qt } from "@das-fed/utils/atob";
import { getConfig as se } from "@das-fed/utils/config";
import { getAccessToken as z, removeAccessToken as Mt, setAccessToken as Ht, getAccessTokenInfo as de } from "@das-fed/utils/token-tools";
import { appendQueryParams as st } from "@das-fed/utils/common-tools";
import { removeProcessEngineToken as $t, setProcessEngineToken as zt } from "@das-fed/utils/process-engine-info";
import { setPersonalInfo as xe } from "@das-fed/utils/common-info/set-personal-info";
function it(e, t) {
  return function() {
    return e.apply(t, arguments);
  };
}
const { toString: Jt } = Object.prototype, { getPrototypeOf: Ce } = Object, { iterator: ie, toStringTag: at } = Symbol, ae = /* @__PURE__ */ ((e) => (t) => {
  const n = Jt.call(t);
  return e[n] || (e[n] = n.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null)), k = (e) => (e = e.toLowerCase(), (t) => ae(t) === e), ce = (e) => (t) => typeof t === e, { isArray: M } = Array, J = ce("undefined");
function V(e) {
  return e !== null && !J(e) && e.constructor !== null && !J(e.constructor) && A(e.constructor.isBuffer) && e.constructor.isBuffer(e);
}
const ct = k("ArrayBuffer");
function Vt(e) {
  let t;
  return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && ct(e.buffer), t;
}
const Wt = ce("string"), A = ce("function"), ut = ce("number"), W = (e) => e !== null && typeof e == "object", Kt = (e) => e === !0 || e === !1, Y = (e) => {
  if (ae(e) !== "object")
    return !1;
  const t = Ce(e);
  return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(at in e) && !(ie in e);
}, Qt = (e) => {
  if (!W(e) || V(e))
    return !1;
  try {
    return Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype;
  } catch {
    return !1;
  }
}, Xt = k("Date"), Gt = k("File"), Zt = k("Blob"), Yt = k("FileList"), en = (e) => W(e) && A(e.pipe), tn = (e) => {
  let t;
  return e && (typeof FormData == "function" && e instanceof FormData || A(e.append) && ((t = ae(e)) === "formdata" || // detect form-data instance
  t === "object" && A(e.toString) && e.toString() === "[object FormData]"));
}, nn = k("URLSearchParams"), [rn, on, sn, an] = ["ReadableStream", "Request", "Response", "Headers"].map(k), cn = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function K(e, t, { allOwnKeys: n = !1 } = {}) {
  if (e === null || typeof e > "u")
    return;
  let r, o;
  if (typeof e != "object" && (e = [e]), M(e))
    for (r = 0, o = e.length; r < o; r++)
      t.call(null, e[r], r, e);
  else {
    if (V(e))
      return;
    const s = n ? Object.getOwnPropertyNames(e) : Object.keys(e), i = s.length;
    let c;
    for (r = 0; r < i; r++)
      c = s[r], t.call(null, e[c], c, e);
  }
}
function lt(e, t) {
  if (V(e))
    return null;
  t = t.toLowerCase();
  const n = Object.keys(e);
  let r = n.length, o;
  for (; r-- > 0; )
    if (o = n[r], t === o.toLowerCase())
      return o;
  return null;
}
const D = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, ft = (e) => !J(e) && e !== D;
function we() {
  const { caseless: e } = ft(this) && this || {}, t = {}, n = (r, o) => {
    const s = e && lt(t, o) || o;
    Y(t[s]) && Y(r) ? t[s] = we(t[s], r) : Y(r) ? t[s] = we({}, r) : M(r) ? t[s] = r.slice() : t[s] = r;
  };
  for (let r = 0, o = arguments.length; r < o; r++)
    arguments[r] && K(arguments[r], n);
  return t;
}
const un = (e, t, n, { allOwnKeys: r } = {}) => (K(t, (o, s) => {
  n && A(o) ? e[s] = it(o, n) : e[s] = o;
}, { allOwnKeys: r }), e), ln = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), fn = (e, t, n, r) => {
  e.prototype = Object.create(t.prototype, r), e.prototype.constructor = e, Object.defineProperty(e, "super", {
    value: t.prototype
  }), n && Object.assign(e.prototype, n);
}, dn = (e, t, n, r) => {
  let o, s, i;
  const c = {};
  if (t = t || {}, e == null) return t;
  do {
    for (o = Object.getOwnPropertyNames(e), s = o.length; s-- > 0; )
      i = o[s], (!r || r(i, e, t)) && !c[i] && (t[i] = e[i], c[i] = !0);
    e = n !== !1 && Ce(e);
  } while (e && (!n || n(e, t)) && e !== Object.prototype);
  return t;
}, pn = (e, t, n) => {
  e = String(e), (n === void 0 || n > e.length) && (n = e.length), n -= t.length;
  const r = e.indexOf(t, n);
  return r !== -1 && r === n;
}, hn = (e) => {
  if (!e) return null;
  if (M(e)) return e;
  let t = e.length;
  if (!ut(t)) return null;
  const n = new Array(t);
  for (; t-- > 0; )
    n[t] = e[t];
  return n;
}, mn = /* @__PURE__ */ ((e) => (t) => e && t instanceof e)(typeof Uint8Array < "u" && Ce(Uint8Array)), yn = (e, t) => {
  const r = (e && e[ie]).call(e);
  let o;
  for (; (o = r.next()) && !o.done; ) {
    const s = o.value;
    t.call(e, s[0], s[1]);
  }
}, wn = (e, t) => {
  let n;
  const r = [];
  for (; (n = e.exec(t)) !== null; )
    r.push(n);
  return r;
}, gn = k("HTMLFormElement"), bn = (e) => e.toLowerCase().replace(
  /[-_\s]([a-z\d])(\w*)/g,
  function(n, r, o) {
    return r.toUpperCase() + o;
  }
), De = (({ hasOwnProperty: e }) => (t, n) => e.call(t, n))(Object.prototype), En = k("RegExp"), dt = (e, t) => {
  const n = Object.getOwnPropertyDescriptors(e), r = {};
  K(n, (o, s) => {
    let i;
    (i = t(o, s, e)) !== !1 && (r[s] = i || o);
  }), Object.defineProperties(e, r);
}, Sn = (e) => {
  dt(e, (t, n) => {
    if (A(e) && ["arguments", "caller", "callee"].indexOf(n) !== -1)
      return !1;
    const r = e[n];
    if (A(r)) {
      if (t.enumerable = !1, "writable" in t) {
        t.writable = !1;
        return;
      }
      t.set || (t.set = () => {
        throw Error("Can not rewrite read-only method '" + n + "'");
      });
    }
  });
}, Rn = (e, t) => {
  const n = {}, r = (o) => {
    o.forEach((s) => {
      n[s] = !0;
    });
  };
  return M(e) ? r(e) : r(String(e).split(t)), n;
}, Tn = () => {
}, On = (e, t) => e != null && Number.isFinite(e = +e) ? e : t;
function An(e) {
  return !!(e && A(e.append) && e[at] === "FormData" && e[ie]);
}
const _n = (e) => {
  const t = new Array(10), n = (r, o) => {
    if (W(r)) {
      if (t.indexOf(r) >= 0)
        return;
      if (V(r))
        return r;
      if (!("toJSON" in r)) {
        t[o] = r;
        const s = M(r) ? [] : {};
        return K(r, (i, c) => {
          const f = n(i, o + 1);
          !J(f) && (s[c] = f);
        }), t[o] = void 0, s;
      }
    }
    return r;
  };
  return n(e, 0);
}, kn = k("AsyncFunction"), xn = (e) => e && (W(e) || A(e)) && A(e.then) && A(e.catch), pt = ((e, t) => e ? setImmediate : t ? ((n, r) => (D.addEventListener("message", ({ source: o, data: s }) => {
  o === D && s === n && r.length && r.shift()();
}, !1), (o) => {
  r.push(o), D.postMessage(n, "*");
}))(`axios@${Math.random()}`, []) : (n) => setTimeout(n))(
  typeof setImmediate == "function",
  A(D.postMessage)
), Cn = typeof queueMicrotask < "u" ? queueMicrotask.bind(D) : typeof process < "u" && process.nextTick || pt, Pn = (e) => e != null && A(e[ie]), a = {
  isArray: M,
  isArrayBuffer: ct,
  isBuffer: V,
  isFormData: tn,
  isArrayBufferView: Vt,
  isString: Wt,
  isNumber: ut,
  isBoolean: Kt,
  isObject: W,
  isPlainObject: Y,
  isEmptyObject: Qt,
  isReadableStream: rn,
  isRequest: on,
  isResponse: sn,
  isHeaders: an,
  isUndefined: J,
  isDate: Xt,
  isFile: Gt,
  isBlob: Zt,
  isRegExp: En,
  isFunction: A,
  isStream: en,
  isURLSearchParams: nn,
  isTypedArray: mn,
  isFileList: Yt,
  forEach: K,
  merge: we,
  extend: un,
  trim: cn,
  stripBOM: ln,
  inherits: fn,
  toFlatObject: dn,
  kindOf: ae,
  kindOfTest: k,
  endsWith: pn,
  toArray: hn,
  forEachEntry: yn,
  matchAll: wn,
  isHTMLForm: gn,
  hasOwnProperty: De,
  hasOwnProp: De,
  // an alias to avoid ESLint no-prototype-builtins detection
  reduceDescriptors: dt,
  freezeMethods: Sn,
  toObjectSet: Rn,
  toCamelCase: bn,
  noop: Tn,
  toFiniteNumber: On,
  findKey: lt,
  global: D,
  isContextDefined: ft,
  isSpecCompliantForm: An,
  toJSONObject: _n,
  isAsyncFn: kn,
  isThenable: xn,
  setImmediate: pt,
  asap: Cn,
  isIterable: Pn
};
function y(e, t, n, r, o) {
  Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack, this.message = e, this.name = "AxiosError", t && (this.code = t), n && (this.config = n), r && (this.request = r), o && (this.response = o, this.status = o.status ? o.status : null);
}
a.inherits(y, 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: a.toJSONObject(this.config),
      code: this.code,
      status: this.status
    };
  }
});
const ht = y.prototype, mt = {};
[
  "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((e) => {
  mt[e] = { value: e };
});
Object.defineProperties(y, mt);
Object.defineProperty(ht, "isAxiosError", { value: !0 });
y.from = (e, t, n, r, o, s) => {
  const i = Object.create(ht);
  return a.toFlatObject(e, i, function(f) {
    return f !== Error.prototype;
  }, (c) => c !== "isAxiosError"), y.call(i, e.message, t, n, r, o), i.cause = e, i.name = e.name, s && Object.assign(i, s), i;
};
const Ln = null;
function ge(e) {
  return a.isPlainObject(e) || a.isArray(e);
}
function yt(e) {
  return a.endsWith(e, "[]") ? e.slice(0, -2) : e;
}
function Fe(e, t, n) {
  return e ? e.concat(t).map(function(o, s) {
    return o = yt(o), !n && s ? "[" + o + "]" : o;
  }).join(n ? "." : "") : t;
}
function Un(e) {
  return a.isArray(e) && !e.some(ge);
}
const Nn = a.toFlatObject(a, {}, null, function(t) {
  return /^is[A-Z]/.test(t);
});
function ue(e, t, n) {
  if (!a.isObject(e))
    throw new TypeError("target must be an object");
  t = t || new FormData(), n = a.toFlatObject(n, {
    metaTokens: !0,
    dots: !1,
    indexes: !1
  }, !1, function(m, h) {
    return !a.isUndefined(h[m]);
  });
  const r = n.metaTokens, o = n.visitor || l, s = n.dots, i = n.indexes, f = (n.Blob || typeof Blob < "u" && Blob) && a.isSpecCompliantForm(t);
  if (!a.isFunction(o))
    throw new TypeError("visitor must be a function");
  function u(p) {
    if (p === null) return "";
    if (a.isDate(p))
      return p.toISOString();
    if (a.isBoolean(p))
      return p.toString();
    if (!f && a.isBlob(p))
      throw new y("Blob is not supported. Use a Buffer instead.");
    return a.isArrayBuffer(p) || a.isTypedArray(p) ? f && typeof Blob == "function" ? new Blob([p]) : Buffer.from(p) : p;
  }
  function l(p, m, h) {
    let E = p;
    if (p && !h && typeof p == "object") {
      if (a.endsWith(m, "{}"))
        m = r ? m : m.slice(0, -2), p = JSON.stringify(p);
      else if (a.isArray(p) && Un(p) || (a.isFileList(p) || a.endsWith(m, "[]")) && (E = a.toArray(p)))
        return m = yt(m), E.forEach(function(R, C) {
          !(a.isUndefined(R) || R === null) && t.append(
            // eslint-disable-next-line no-nested-ternary
            i === !0 ? Fe([m], C, s) : i === null ? m : m + "[]",
            u(R)
          );
        }), !1;
    }
    return ge(p) ? !0 : (t.append(Fe(h, m, s), u(p)), !1);
  }
  const d = [], w = Object.assign(Nn, {
    defaultVisitor: l,
    convertValue: u,
    isVisitable: ge
  });
  function g(p, m) {
    if (!a.isUndefined(p)) {
      if (d.indexOf(p) !== -1)
        throw Error("Circular reference detected in " + m.join("."));
      d.push(p), a.forEach(p, function(E, S) {
        (!(a.isUndefined(E) || E === null) && o.call(
          t,
          E,
          a.isString(S) ? S.trim() : S,
          m,
          w
        )) === !0 && g(E, m ? m.concat(S) : [S]);
      }), d.pop();
    }
  }
  if (!a.isObject(e))
    throw new TypeError("data must be an object");
  return g(e), t;
}
function Ie(e) {
  const t = {
    "!": "%21",
    "'": "%27",
    "(": "%28",
    ")": "%29",
    "~": "%7E",
    "%20": "+",
    "%00": "\0"
  };
  return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, function(r) {
    return t[r];
  });
}
function Pe(e, t) {
  this._pairs = [], e && ue(e, this, t);
}
const wt = Pe.prototype;
wt.append = function(t, n) {
  this._pairs.push([t, n]);
};
wt.toString = function(t) {
  const n = t ? function(r) {
    return t.call(this, r, Ie);
  } : Ie;
  return this._pairs.map(function(o) {
    return n(o[0]) + "=" + n(o[1]);
  }, "").join("&");
};
function Dn(e) {
  return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function gt(e, t, n) {
  if (!t)
    return e;
  const r = n && n.encode || Dn;
  a.isFunction(n) && (n = {
    serialize: n
  });
  const o = n && n.serialize;
  let s;
  if (o ? s = o(t, n) : s = a.isURLSearchParams(t) ? t.toString() : new Pe(t, n).toString(r), s) {
    const i = e.indexOf("#");
    i !== -1 && (e = e.slice(0, i)), e += (e.indexOf("?") === -1 ? "?" : "&") + s;
  }
  return e;
}
class ve {
  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(t, n, r) {
    return this.handlers.push({
      fulfilled: t,
      rejected: n,
      synchronous: r ? r.synchronous : !1,
      runWhen: r ? r.runWhen : null
    }), this.handlers.length - 1;
  }
  /**
   * Remove an interceptor from the stack
   *
   * @param {Number} id The ID that was returned by `use`
   *
   * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
   */
  eject(t) {
    this.handlers[t] && (this.handlers[t] = 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(t) {
    a.forEach(this.handlers, function(r) {
      r !== null && t(r);
    });
  }
}
const bt = {
  silentJSONParsing: !0,
  forcedJSONParsing: !0,
  clarifyTimeoutError: !1
}, Fn = typeof URLSearchParams < "u" ? URLSearchParams : Pe, In = typeof FormData < "u" ? FormData : null, vn = typeof Blob < "u" ? Blob : null, Bn = {
  isBrowser: !0,
  classes: {
    URLSearchParams: Fn,
    FormData: In,
    Blob: vn
  },
  protocols: ["http", "https", "file", "blob", "url", "data"]
}, Le = typeof window < "u" && typeof document < "u", be = typeof navigator == "object" && navigator || void 0, jn = Le && (!be || ["ReactNative", "NativeScript", "NS"].indexOf(be.product) < 0), qn = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", Mn = Le && window.location.href || "http://localhost", Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  hasBrowserEnv: Le,
  hasStandardBrowserEnv: jn,
  hasStandardBrowserWebWorkerEnv: qn,
  navigator: be,
  origin: Mn
}, Symbol.toStringTag, { value: "Module" })), T = {
  ...Hn,
  ...Bn
};
function $n(e, t) {
  return ue(e, new T.classes.URLSearchParams(), {
    visitor: function(n, r, o, s) {
      return T.isNode && a.isBuffer(n) ? (this.append(r, n.toString("base64")), !1) : s.defaultVisitor.apply(this, arguments);
    },
    ...t
  });
}
function zn(e) {
  return a.matchAll(/\w+|\[(\w*)]/g, e).map((t) => t[0] === "[]" ? "" : t[1] || t[0]);
}
function Jn(e) {
  const t = {}, n = Object.keys(e);
  let r;
  const o = n.length;
  let s;
  for (r = 0; r < o; r++)
    s = n[r], t[s] = e[s];
  return t;
}
function Et(e) {
  function t(n, r, o, s) {
    let i = n[s++];
    if (i === "__proto__") return !0;
    const c = Number.isFinite(+i), f = s >= n.length;
    return i = !i && a.isArray(o) ? o.length : i, f ? (a.hasOwnProp(o, i) ? o[i] = [o[i], r] : o[i] = r, !c) : ((!o[i] || !a.isObject(o[i])) && (o[i] = []), t(n, r, o[i], s) && a.isArray(o[i]) && (o[i] = Jn(o[i])), !c);
  }
  if (a.isFormData(e) && a.isFunction(e.entries)) {
    const n = {};
    return a.forEachEntry(e, (r, o) => {
      t(zn(r), o, n, 0);
    }), n;
  }
  return null;
}
function Vn(e, t, n) {
  if (a.isString(e))
    try {
      return (t || JSON.parse)(e), a.trim(e);
    } catch (r) {
      if (r.name !== "SyntaxError")
        throw r;
    }
  return (n || JSON.stringify)(e);
}
const Q = {
  transitional: bt,
  adapter: ["xhr", "http", "fetch"],
  transformRequest: [function(t, n) {
    const r = n.getContentType() || "", o = r.indexOf("application/json") > -1, s = a.isObject(t);
    if (s && a.isHTMLForm(t) && (t = new FormData(t)), a.isFormData(t))
      return o ? JSON.stringify(Et(t)) : t;
    if (a.isArrayBuffer(t) || a.isBuffer(t) || a.isStream(t) || a.isFile(t) || a.isBlob(t) || a.isReadableStream(t))
      return t;
    if (a.isArrayBufferView(t))
      return t.buffer;
    if (a.isURLSearchParams(t))
      return n.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString();
    let c;
    if (s) {
      if (r.indexOf("application/x-www-form-urlencoded") > -1)
        return $n(t, this.formSerializer).toString();
      if ((c = a.isFileList(t)) || r.indexOf("multipart/form-data") > -1) {
        const f = this.env && this.env.FormData;
        return ue(
          c ? { "files[]": t } : t,
          f && new f(),
          this.formSerializer
        );
      }
    }
    return s || o ? (n.setContentType("application/json", !1), Vn(t)) : t;
  }],
  transformResponse: [function(t) {
    const n = this.transitional || Q.transitional, r = n && n.forcedJSONParsing, o = this.responseType === "json";
    if (a.isResponse(t) || a.isReadableStream(t))
      return t;
    if (t && a.isString(t) && (r && !this.responseType || o)) {
      const i = !(n && n.silentJSONParsing) && o;
      try {
        return JSON.parse(t);
      } catch (c) {
        if (i)
          throw c.name === "SyntaxError" ? y.from(c, y.ERR_BAD_RESPONSE, this, null, this.response) : c;
      }
    }
    return t;
  }],
  /**
   * A timeout in milliseconds to abort a request. If set to 0 (default) a
   * timeout is not created.
   */
  timeout: 0,
  xsrfCookieName: "XSRF-TOKEN",
  xsrfHeaderName: "X-XSRF-TOKEN",
  maxContentLength: -1,
  maxBodyLength: -1,
  env: {
    FormData: T.classes.FormData,
    Blob: T.classes.Blob
  },
  validateStatus: function(t) {
    return t >= 200 && t < 300;
  },
  headers: {
    common: {
      Accept: "application/json, text/plain, */*",
      "Content-Type": void 0
    }
  }
};
a.forEach(["delete", "get", "head", "post", "put", "patch"], (e) => {
  Q.headers[e] = {};
});
const Wn = a.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"
]), Kn = (e) => {
  const t = {};
  let n, r, o;
  return e && e.split(`
`).forEach(function(i) {
    o = i.indexOf(":"), n = i.substring(0, o).trim().toLowerCase(), r = i.substring(o + 1).trim(), !(!n || t[n] && Wn[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r);
  }), t;
}, Be = Symbol("internals");
function $(e) {
  return e && String(e).trim().toLowerCase();
}
function ee(e) {
  return e === !1 || e == null ? e : a.isArray(e) ? e.map(ee) : String(e);
}
function Qn(e) {
  const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  let r;
  for (; r = n.exec(e); )
    t[r[1]] = r[2];
  return t;
}
const Xn = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());
function pe(e, t, n, r, o) {
  if (a.isFunction(r))
    return r.call(this, t, n);
  if (o && (t = n), !!a.isString(t)) {
    if (a.isString(r))
      return t.indexOf(r) !== -1;
    if (a.isRegExp(r))
      return r.test(t);
  }
}
function Gn(e) {
  return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (t, n, r) => n.toUpperCase() + r);
}
function Zn(e, t) {
  const n = a.toCamelCase(" " + t);
  ["get", "set", "has"].forEach((r) => {
    Object.defineProperty(e, r + n, {
      value: function(o, s, i) {
        return this[r].call(this, t, o, s, i);
      },
      configurable: !0
    });
  });
}
let _ = class {
  constructor(t) {
    t && this.set(t);
  }
  set(t, n, r) {
    const o = this;
    function s(c, f, u) {
      const l = $(f);
      if (!l)
        throw new Error("header name must be a non-empty string");
      const d = a.findKey(o, l);
      (!d || o[d] === void 0 || u === !0 || u === void 0 && o[d] !== !1) && (o[d || f] = ee(c));
    }
    const i = (c, f) => a.forEach(c, (u, l) => s(u, l, f));
    if (a.isPlainObject(t) || t instanceof this.constructor)
      i(t, n);
    else if (a.isString(t) && (t = t.trim()) && !Xn(t))
      i(Kn(t), n);
    else if (a.isObject(t) && a.isIterable(t)) {
      let c = {}, f, u;
      for (const l of t) {
        if (!a.isArray(l))
          throw TypeError("Object iterator must return a key-value pair");
        c[u = l[0]] = (f = c[u]) ? a.isArray(f) ? [...f, l[1]] : [f, l[1]] : l[1];
      }
      i(c, n);
    } else
      t != null && s(n, t, r);
    return this;
  }
  get(t, n) {
    if (t = $(t), t) {
      const r = a.findKey(this, t);
      if (r) {
        const o = this[r];
        if (!n)
          return o;
        if (n === !0)
          return Qn(o);
        if (a.isFunction(n))
          return n.call(this, o, r);
        if (a.isRegExp(n))
          return n.exec(o);
        throw new TypeError("parser must be boolean|regexp|function");
      }
    }
  }
  has(t, n) {
    if (t = $(t), t) {
      const r = a.findKey(this, t);
      return !!(r && this[r] !== void 0 && (!n || pe(this, this[r], r, n)));
    }
    return !1;
  }
  delete(t, n) {
    const r = this;
    let o = !1;
    function s(i) {
      if (i = $(i), i) {
        const c = a.findKey(r, i);
        c && (!n || pe(r, r[c], c, n)) && (delete r[c], o = !0);
      }
    }
    return a.isArray(t) ? t.forEach(s) : s(t), o;
  }
  clear(t) {
    const n = Object.keys(this);
    let r = n.length, o = !1;
    for (; r--; ) {
      const s = n[r];
      (!t || pe(this, this[s], s, t, !0)) && (delete this[s], o = !0);
    }
    return o;
  }
  normalize(t) {
    const n = this, r = {};
    return a.forEach(this, (o, s) => {
      const i = a.findKey(r, s);
      if (i) {
        n[i] = ee(o), delete n[s];
        return;
      }
      const c = t ? Gn(s) : String(s).trim();
      c !== s && delete n[s], n[c] = ee(o), r[c] = !0;
    }), this;
  }
  concat(...t) {
    return this.constructor.concat(this, ...t);
  }
  toJSON(t) {
    const n = /* @__PURE__ */ Object.create(null);
    return a.forEach(this, (r, o) => {
      r != null && r !== !1 && (n[o] = t && a.isArray(r) ? r.join(", ") : r);
    }), n;
  }
  [Symbol.iterator]() {
    return Object.entries(this.toJSON())[Symbol.iterator]();
  }
  toString() {
    return Object.entries(this.toJSON()).map(([t, n]) => t + ": " + n).join(`
`);
  }
  getSetCookie() {
    return this.get("set-cookie") || [];
  }
  get [Symbol.toStringTag]() {
    return "AxiosHeaders";
  }
  static from(t) {
    return t instanceof this ? t : new this(t);
  }
  static concat(t, ...n) {
    const r = new this(t);
    return n.forEach((o) => r.set(o)), r;
  }
  static accessor(t) {
    const r = (this[Be] = this[Be] = {
      accessors: {}
    }).accessors, o = this.prototype;
    function s(i) {
      const c = $(i);
      r[c] || (Zn(o, i), r[c] = !0);
    }
    return a.isArray(t) ? t.forEach(s) : s(t), this;
  }
};
_.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
a.reduceDescriptors(_.prototype, ({ value: e }, t) => {
  let n = t[0].toUpperCase() + t.slice(1);
  return {
    get: () => e,
    set(r) {
      this[n] = r;
    }
  };
});
a.freezeMethods(_);
function he(e, t) {
  const n = this || Q, r = t || n, o = _.from(r.headers);
  let s = r.data;
  return a.forEach(e, function(c) {
    s = c.call(n, s, o.normalize(), t ? t.status : void 0);
  }), o.normalize(), s;
}
function St(e) {
  return !!(e && e.__CANCEL__);
}
function H(e, t, n) {
  y.call(this, e ?? "canceled", y.ERR_CANCELED, t, n), this.name = "CanceledError";
}
a.inherits(H, y, {
  __CANCEL__: !0
});
function Rt(e, t, n) {
  const r = n.config.validateStatus;
  !n.status || !r || r(n.status) ? e(n) : t(new y(
    "Request failed with status code " + n.status,
    [y.ERR_BAD_REQUEST, y.ERR_BAD_RESPONSE][Math.floor(n.status / 100) - 4],
    n.config,
    n.request,
    n
  ));
}
function Yn(e) {
  const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
  return t && t[1] || "";
}
function er(e, t) {
  e = e || 10;
  const n = new Array(e), r = new Array(e);
  let o = 0, s = 0, i;
  return t = t !== void 0 ? t : 1e3, function(f) {
    const u = Date.now(), l = r[s];
    i || (i = u), n[o] = f, r[o] = u;
    let d = s, w = 0;
    for (; d !== o; )
      w += n[d++], d = d % e;
    if (o = (o + 1) % e, o === s && (s = (s + 1) % e), u - i < t)
      return;
    const g = l && u - l;
    return g ? Math.round(w * 1e3 / g) : void 0;
  };
}
function tr(e, t) {
  let n = 0, r = 1e3 / t, o, s;
  const i = (u, l = Date.now()) => {
    n = l, o = null, s && (clearTimeout(s), s = null), e(...u);
  };
  return [(...u) => {
    const l = Date.now(), d = l - n;
    d >= r ? i(u, l) : (o = u, s || (s = setTimeout(() => {
      s = null, i(o);
    }, r - d)));
  }, () => o && i(o)];
}
const re = (e, t, n = 3) => {
  let r = 0;
  const o = er(50, 250);
  return tr((s) => {
    const i = s.loaded, c = s.lengthComputable ? s.total : void 0, f = i - r, u = o(f), l = i <= c;
    r = i;
    const d = {
      loaded: i,
      total: c,
      progress: c ? i / c : void 0,
      bytes: f,
      rate: u || void 0,
      estimated: u && c && l ? (c - i) / u : void 0,
      event: s,
      lengthComputable: c != null,
      [t ? "download" : "upload"]: !0
    };
    e(d);
  }, n);
}, je = (e, t) => {
  const n = e != null;
  return [(r) => t[0]({
    lengthComputable: n,
    total: e,
    loaded: r
  }), t[1]];
}, qe = (e) => (...t) => a.asap(() => e(...t)), nr = T.hasStandardBrowserEnv ? /* @__PURE__ */ ((e, t) => (n) => (n = new URL(n, T.origin), e.protocol === n.protocol && e.host === n.host && (t || e.port === n.port)))(
  new URL(T.origin),
  T.navigator && /(msie|trident)/i.test(T.navigator.userAgent)
) : () => !0, rr = T.hasStandardBrowserEnv ? (
  // Standard browser envs support document.cookie
  {
    write(e, t, n, r, o, s) {
      const i = [e + "=" + encodeURIComponent(t)];
      a.isNumber(n) && i.push("expires=" + new Date(n).toGMTString()), a.isString(r) && i.push("path=" + r), a.isString(o) && i.push("domain=" + o), s === !0 && i.push("secure"), document.cookie = i.join("; ");
    },
    read(e) {
      const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
      return t ? decodeURIComponent(t[3]) : null;
    },
    remove(e) {
      this.write(e, "", Date.now() - 864e5);
    }
  }
) : (
  // Non-standard browser env (web workers, react-native) lack needed support.
  {
    write() {
    },
    read() {
      return null;
    },
    remove() {
    }
  }
);
function or(e) {
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);
}
function sr(e, t) {
  return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
}
function Tt(e, t, n) {
  let r = !or(t);
  return e && (r || n == !1) ? sr(e, t) : t;
}
const Me = (e) => e instanceof _ ? { ...e } : e;
function B(e, t) {
  t = t || {};
  const n = {};
  function r(u, l, d, w) {
    return a.isPlainObject(u) && a.isPlainObject(l) ? a.merge.call({ caseless: w }, u, l) : a.isPlainObject(l) ? a.merge({}, l) : a.isArray(l) ? l.slice() : l;
  }
  function o(u, l, d, w) {
    if (a.isUndefined(l)) {
      if (!a.isUndefined(u))
        return r(void 0, u, d, w);
    } else return r(u, l, d, w);
  }
  function s(u, l) {
    if (!a.isUndefined(l))
      return r(void 0, l);
  }
  function i(u, l) {
    if (a.isUndefined(l)) {
      if (!a.isUndefined(u))
        return r(void 0, u);
    } else return r(void 0, l);
  }
  function c(u, l, d) {
    if (d in t)
      return r(u, l);
    if (d in e)
      return r(void 0, u);
  }
  const f = {
    url: s,
    method: s,
    data: s,
    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: c,
    headers: (u, l, d) => o(Me(u), Me(l), d, !0)
  };
  return a.forEach(Object.keys({ ...e, ...t }), function(l) {
    const d = f[l] || o, w = d(e[l], t[l], l);
    a.isUndefined(w) && d !== c || (n[l] = w);
  }), n;
}
const Ot = (e) => {
  const t = B({}, e);
  let { data: n, withXSRFToken: r, xsrfHeaderName: o, xsrfCookieName: s, headers: i, auth: c } = t;
  t.headers = i = _.from(i), t.url = gt(Tt(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), c && i.set(
    "Authorization",
    "Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
  );
  let f;
  if (a.isFormData(n)) {
    if (T.hasStandardBrowserEnv || T.hasStandardBrowserWebWorkerEnv)
      i.setContentType(void 0);
    else if ((f = i.getContentType()) !== !1) {
      const [u, ...l] = f ? f.split(";").map((d) => d.trim()).filter(Boolean) : [];
      i.setContentType([u || "multipart/form-data", ...l].join("; "));
    }
  }
  if (T.hasStandardBrowserEnv && (r && a.isFunction(r) && (r = r(t)), r || r !== !1 && nr(t.url))) {
    const u = o && s && rr.read(s);
    u && i.set(o, u);
  }
  return t;
}, ir = typeof XMLHttpRequest < "u", ar = ir && function(e) {
  return new Promise(function(n, r) {
    const o = Ot(e);
    let s = o.data;
    const i = _.from(o.headers).normalize();
    let { responseType: c, onUploadProgress: f, onDownloadProgress: u } = o, l, d, w, g, p;
    function m() {
      g && g(), p && p(), o.cancelToken && o.cancelToken.unsubscribe(l), o.signal && o.signal.removeEventListener("abort", l);
    }
    let h = new XMLHttpRequest();
    h.open(o.method.toUpperCase(), o.url, !0), h.timeout = o.timeout;
    function E() {
      if (!h)
        return;
      const R = _.from(
        "getAllResponseHeaders" in h && h.getAllResponseHeaders()
      ), O = {
        data: !c || c === "text" || c === "json" ? h.responseText : h.response,
        status: h.status,
        statusText: h.statusText,
        headers: R,
        config: e,
        request: h
      };
      Rt(function(N) {
        n(N), m();
      }, function(N) {
        r(N), m();
      }, O), h = null;
    }
    "onloadend" in h ? h.onloadend = E : h.onreadystatechange = function() {
      !h || h.readyState !== 4 || h.status === 0 && !(h.responseURL && h.responseURL.indexOf("file:") === 0) || setTimeout(E);
    }, h.onabort = function() {
      h && (r(new y("Request aborted", y.ECONNABORTED, e, h)), h = null);
    }, h.onerror = function() {
      r(new y("Network Error", y.ERR_NETWORK, e, h)), h = null;
    }, h.ontimeout = function() {
      let C = o.timeout ? "timeout of " + o.timeout + "ms exceeded" : "timeout exceeded";
      const O = o.transitional || bt;
      o.timeoutErrorMessage && (C = o.timeoutErrorMessage), r(new y(
        C,
        O.clarifyTimeoutError ? y.ETIMEDOUT : y.ECONNABORTED,
        e,
        h
      )), h = null;
    }, s === void 0 && i.setContentType(null), "setRequestHeader" in h && a.forEach(i.toJSON(), function(C, O) {
      h.setRequestHeader(O, C);
    }), a.isUndefined(o.withCredentials) || (h.withCredentials = !!o.withCredentials), c && c !== "json" && (h.responseType = o.responseType), u && ([w, p] = re(u, !0), h.addEventListener("progress", w)), f && h.upload && ([d, g] = re(f), h.upload.addEventListener("progress", d), h.upload.addEventListener("loadend", g)), (o.cancelToken || o.signal) && (l = (R) => {
      h && (r(!R || R.type ? new H(null, e, h) : R), h.abort(), h = null);
    }, o.cancelToken && o.cancelToken.subscribe(l), o.signal && (o.signal.aborted ? l() : o.signal.addEventListener("abort", l)));
    const S = Yn(o.url);
    if (S && T.protocols.indexOf(S) === -1) {
      r(new y("Unsupported protocol " + S + ":", y.ERR_BAD_REQUEST, e));
      return;
    }
    h.send(s || null);
  });
}, cr = (e, t) => {
  const { length: n } = e = e ? e.filter(Boolean) : [];
  if (t || n) {
    let r = new AbortController(), o;
    const s = function(u) {
      if (!o) {
        o = !0, c();
        const l = u instanceof Error ? u : this.reason;
        r.abort(l instanceof y ? l : new H(l instanceof Error ? l.message : l));
      }
    };
    let i = t && setTimeout(() => {
      i = null, s(new y(`timeout ${t} of ms exceeded`, y.ETIMEDOUT));
    }, t);
    const c = () => {
      e && (i && clearTimeout(i), i = null, e.forEach((u) => {
        u.unsubscribe ? u.unsubscribe(s) : u.removeEventListener("abort", s);
      }), e = null);
    };
    e.forEach((u) => u.addEventListener("abort", s));
    const { signal: f } = r;
    return f.unsubscribe = () => a.asap(c), f;
  }
}, ur = function* (e, t) {
  let n = e.byteLength;
  if (n < t) {
    yield e;
    return;
  }
  let r = 0, o;
  for (; r < n; )
    o = r + t, yield e.slice(r, o), r = o;
}, lr = async function* (e, t) {
  for await (const n of fr(e))
    yield* ur(n, t);
}, fr = async function* (e) {
  if (e[Symbol.asyncIterator]) {
    yield* e;
    return;
  }
  const t = e.getReader();
  try {
    for (; ; ) {
      const { done: n, value: r } = await t.read();
      if (n)
        break;
      yield r;
    }
  } finally {
    await t.cancel();
  }
}, He = (e, t, n, r) => {
  const o = lr(e, t);
  let s = 0, i, c = (f) => {
    i || (i = !0, r && r(f));
  };
  return new ReadableStream({
    async pull(f) {
      try {
        const { done: u, value: l } = await o.next();
        if (u) {
          c(), f.close();
          return;
        }
        let d = l.byteLength;
        if (n) {
          let w = s += d;
          n(w);
        }
        f.enqueue(new Uint8Array(l));
      } catch (u) {
        throw c(u), u;
      }
    },
    cancel(f) {
      return c(f), o.return();
    }
  }, {
    highWaterMark: 2
  });
}, le = typeof fetch == "function" && typeof Request == "function" && typeof Response == "function", At = le && typeof ReadableStream == "function", dr = le && (typeof TextEncoder == "function" ? /* @__PURE__ */ ((e) => (t) => e.encode(t))(new TextEncoder()) : async (e) => new Uint8Array(await new Response(e).arrayBuffer())), _t = (e, ...t) => {
  try {
    return !!e(...t);
  } catch {
    return !1;
  }
}, pr = At && _t(() => {
  let e = !1;
  const t = new Request(T.origin, {
    body: new ReadableStream(),
    method: "POST",
    get duplex() {
      return e = !0, "half";
    }
  }).headers.has("Content-Type");
  return e && !t;
}), $e = 64 * 1024, Ee = At && _t(() => a.isReadableStream(new Response("").body)), oe = {
  stream: Ee && ((e) => e.body)
};
le && ((e) => {
  ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((t) => {
    !oe[t] && (oe[t] = a.isFunction(e[t]) ? (n) => n[t]() : (n, r) => {
      throw new y(`Response type '${t}' is not supported`, y.ERR_NOT_SUPPORT, r);
    });
  });
})(new Response());
const hr = async (e) => {
  if (e == null)
    return 0;
  if (a.isBlob(e))
    return e.size;
  if (a.isSpecCompliantForm(e))
    return (await new Request(T.origin, {
      method: "POST",
      body: e
    }).arrayBuffer()).byteLength;
  if (a.isArrayBufferView(e) || a.isArrayBuffer(e))
    return e.byteLength;
  if (a.isURLSearchParams(e) && (e = e + ""), a.isString(e))
    return (await dr(e)).byteLength;
}, mr = async (e, t) => {
  const n = a.toFiniteNumber(e.getContentLength());
  return n ?? hr(t);
}, yr = le && (async (e) => {
  let {
    url: t,
    method: n,
    data: r,
    signal: o,
    cancelToken: s,
    timeout: i,
    onDownloadProgress: c,
    onUploadProgress: f,
    responseType: u,
    headers: l,
    withCredentials: d = "same-origin",
    fetchOptions: w
  } = Ot(e);
  u = u ? (u + "").toLowerCase() : "text";
  let g = cr([o, s && s.toAbortSignal()], i), p;
  const m = g && g.unsubscribe && (() => {
    g.unsubscribe();
  });
  let h;
  try {
    if (f && pr && n !== "get" && n !== "head" && (h = await mr(l, r)) !== 0) {
      let O = new Request(t, {
        method: "POST",
        body: r,
        duplex: "half"
      }), P;
      if (a.isFormData(r) && (P = O.headers.get("content-type")) && l.setContentType(P), O.body) {
        const [N, X] = je(
          h,
          re(qe(f))
        );
        r = He(O.body, $e, N, X);
      }
    }
    a.isString(d) || (d = d ? "include" : "omit");
    const E = "credentials" in Request.prototype;
    p = new Request(t, {
      ...w,
      signal: g,
      method: n.toUpperCase(),
      headers: l.normalize().toJSON(),
      body: r,
      duplex: "half",
      credentials: E ? d : void 0
    });
    let S = await fetch(p, w);
    const R = Ee && (u === "stream" || u === "response");
    if (Ee && (c || R && m)) {
      const O = {};
      ["status", "statusText", "headers"].forEach((Ne) => {
        O[Ne] = S[Ne];
      });
      const P = a.toFiniteNumber(S.headers.get("content-length")), [N, X] = c && je(
        P,
        re(qe(c), !0)
      ) || [];
      S = new Response(
        He(S.body, $e, N, () => {
          X && X(), m && m();
        }),
        O
      );
    }
    u = u || "text";
    let C = await oe[a.findKey(oe, u) || "text"](S, e);
    return !R && m && m(), await new Promise((O, P) => {
      Rt(O, P, {
        data: C,
        headers: _.from(S.headers),
        status: S.status,
        statusText: S.statusText,
        config: e,
        request: p
      });
    });
  } catch (E) {
    throw m && m(), E && E.name === "TypeError" && /Load failed|fetch/i.test(E.message) ? Object.assign(
      new y("Network Error", y.ERR_NETWORK, e, p),
      {
        cause: E.cause || E
      }
    ) : y.from(E, E && E.code, e, p);
  }
}), Se = {
  http: Ln,
  xhr: ar,
  fetch: yr
};
a.forEach(Se, (e, t) => {
  if (e) {
    try {
      Object.defineProperty(e, "name", { value: t });
    } catch {
    }
    Object.defineProperty(e, "adapterName", { value: t });
  }
});
const ze = (e) => `- ${e}`, wr = (e) => a.isFunction(e) || e === null || e === !1, kt = {
  getAdapter: (e) => {
    e = a.isArray(e) ? e : [e];
    const { length: t } = e;
    let n, r;
    const o = {};
    for (let s = 0; s < t; s++) {
      n = e[s];
      let i;
      if (r = n, !wr(n) && (r = Se[(i = String(n)).toLowerCase()], r === void 0))
        throw new y(`Unknown adapter '${i}'`);
      if (r)
        break;
      o[i || "#" + s] = r;
    }
    if (!r) {
      const s = Object.entries(o).map(
        ([c, f]) => `adapter ${c} ` + (f === !1 ? "is not supported by the environment" : "is not available in the build")
      );
      let i = t ? s.length > 1 ? `since :
` + s.map(ze).join(`
`) : " " + ze(s[0]) : "as no adapter specified";
      throw new y(
        "There is no suitable adapter to dispatch the request " + i,
        "ERR_NOT_SUPPORT"
      );
    }
    return r;
  },
  adapters: Se
};
function me(e) {
  if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
    throw new H(null, e);
}
function Je(e) {
  return me(e), e.headers = _.from(e.headers), e.data = he.call(
    e,
    e.transformRequest
  ), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), kt.getAdapter(e.adapter || Q.adapter)(e).then(function(r) {
    return me(e), r.data = he.call(
      e,
      e.transformResponse,
      r
    ), r.headers = _.from(r.headers), r;
  }, function(r) {
    return St(r) || (me(e), r && r.response && (r.response.data = he.call(
      e,
      e.transformResponse,
      r.response
    ), r.response.headers = _.from(r.response.headers))), Promise.reject(r);
  });
}
const xt = "1.11.0", fe = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => {
  fe[e] = function(r) {
    return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
  };
});
const Ve = {};
fe.transitional = function(t, n, r) {
  function o(s, i) {
    return "[Axios v" + xt + "] Transitional option '" + s + "'" + i + (r ? ". " + r : "");
  }
  return (s, i, c) => {
    if (t === !1)
      throw new y(
        o(i, " has been removed" + (n ? " in " + n : "")),
        y.ERR_DEPRECATED
      );
    return n && !Ve[i] && (Ve[i] = !0), t ? t(s, i, c) : !0;
  };
};
fe.spelling = function(t) {
  return (n, r) => !0;
};
function gr(e, t, n) {
  if (typeof e != "object")
    throw new y("options must be an object", y.ERR_BAD_OPTION_VALUE);
  const r = Object.keys(e);
  let o = r.length;
  for (; o-- > 0; ) {
    const s = r[o], i = t[s];
    if (i) {
      const c = e[s], f = c === void 0 || i(c, s, e);
      if (f !== !0)
        throw new y("option " + s + " must be " + f, y.ERR_BAD_OPTION_VALUE);
      continue;
    }
    if (n !== !0)
      throw new y("Unknown option " + s, y.ERR_BAD_OPTION);
  }
}
const te = {
  assertOptions: gr,
  validators: fe
}, x = te.validators;
let I = class {
  constructor(t) {
    this.defaults = t || {}, this.interceptors = {
      request: new ve(),
      response: new ve()
    };
  }
  /**
   * 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(t, n) {
    try {
      return await this._request(t, n);
    } catch (r) {
      if (r instanceof Error) {
        let o = {};
        Error.captureStackTrace ? Error.captureStackTrace(o) : o = new Error();
        const s = o.stack ? o.stack.replace(/^.+\n/, "") : "";
        try {
          r.stack ? s && !String(r.stack).endsWith(s.replace(/^.+\n.+\n/, "")) && (r.stack += `
` + s) : r.stack = s;
        } catch {
        }
      }
      throw r;
    }
  }
  _request(t, n) {
    typeof t == "string" ? (n = n || {}, n.url = t) : n = t || {}, n = B(this.defaults, n);
    const { transitional: r, paramsSerializer: o, headers: s } = n;
    r !== void 0 && te.assertOptions(r, {
      silentJSONParsing: x.transitional(x.boolean),
      forcedJSONParsing: x.transitional(x.boolean),
      clarifyTimeoutError: x.transitional(x.boolean)
    }, !1), o != null && (a.isFunction(o) ? n.paramsSerializer = {
      serialize: o
    } : te.assertOptions(o, {
      encode: x.function,
      serialize: x.function
    }, !0)), n.allowAbsoluteUrls !== void 0 || (this.defaults.allowAbsoluteUrls !== void 0 ? n.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : n.allowAbsoluteUrls = !0), te.assertOptions(n, {
      baseUrl: x.spelling("baseURL"),
      withXsrfToken: x.spelling("withXSRFToken")
    }, !0), n.method = (n.method || this.defaults.method || "get").toLowerCase();
    let i = s && a.merge(
      s.common,
      s[n.method]
    );
    s && a.forEach(
      ["delete", "get", "head", "post", "put", "patch", "common"],
      (p) => {
        delete s[p];
      }
    ), n.headers = _.concat(i, s);
    const c = [];
    let f = !0;
    this.interceptors.request.forEach(function(m) {
      typeof m.runWhen == "function" && m.runWhen(n) === !1 || (f = f && m.synchronous, c.unshift(m.fulfilled, m.rejected));
    });
    const u = [];
    this.interceptors.response.forEach(function(m) {
      u.push(m.fulfilled, m.rejected);
    });
    let l, d = 0, w;
    if (!f) {
      const p = [Je.bind(this), void 0];
      for (p.unshift(...c), p.push(...u), w = p.length, l = Promise.resolve(n); d < w; )
        l = l.then(p[d++], p[d++]);
      return l;
    }
    w = c.length;
    let g = n;
    for (d = 0; d < w; ) {
      const p = c[d++], m = c[d++];
      try {
        g = p(g);
      } catch (h) {
        m.call(this, h);
        break;
      }
    }
    try {
      l = Je.call(this, g);
    } catch (p) {
      return Promise.reject(p);
    }
    for (d = 0, w = u.length; d < w; )
      l = l.then(u[d++], u[d++]);
    return l;
  }
  getUri(t) {
    t = B(this.defaults, t);
    const n = Tt(t.baseURL, t.url, t.allowAbsoluteUrls);
    return gt(n, t.params, t.paramsSerializer);
  }
};
a.forEach(["delete", "get", "head", "options"], function(t) {
  I.prototype[t] = function(n, r) {
    return this.request(B(r || {}, {
      method: t,
      url: n,
      data: (r || {}).data
    }));
  };
});
a.forEach(["post", "put", "patch"], function(t) {
  function n(r) {
    return function(s, i, c) {
      return this.request(B(c || {}, {
        method: t,
        headers: r ? {
          "Content-Type": "multipart/form-data"
        } : {},
        url: s,
        data: i
      }));
    };
  }
  I.prototype[t] = n(), I.prototype[t + "Form"] = n(!0);
});
let br = class Ct {
  constructor(t) {
    if (typeof t != "function")
      throw new TypeError("executor must be a function.");
    let n;
    this.promise = new Promise(function(s) {
      n = s;
    });
    const r = this;
    this.promise.then((o) => {
      if (!r._listeners) return;
      let s = r._listeners.length;
      for (; s-- > 0; )
        r._listeners[s](o);
      r._listeners = null;
    }), this.promise.then = (o) => {
      let s;
      const i = new Promise((c) => {
        r.subscribe(c), s = c;
      }).then(o);
      return i.cancel = function() {
        r.unsubscribe(s);
      }, i;
    }, t(function(s, i, c) {
      r.reason || (r.reason = new H(s, i, c), n(r.reason));
    });
  }
  /**
   * Throws a `CanceledError` if cancellation has been requested.
   */
  throwIfRequested() {
    if (this.reason)
      throw this.reason;
  }
  /**
   * Subscribe to the cancel signal
   */
  subscribe(t) {
    if (this.reason) {
      t(this.reason);
      return;
    }
    this._listeners ? this._listeners.push(t) : this._listeners = [t];
  }
  /**
   * Unsubscribe from the cancel signal
   */
  unsubscribe(t) {
    if (!this._listeners)
      return;
    const n = this._listeners.indexOf(t);
    n !== -1 && this._listeners.splice(n, 1);
  }
  toAbortSignal() {
    const t = new AbortController(), n = (r) => {
      t.abort(r);
    };
    return this.subscribe(n), t.signal.unsubscribe = () => this.unsubscribe(n), t.signal;
  }
  /**
   * Returns an object that contains a new `CancelToken` and a function that, when called,
   * cancels the `CancelToken`.
   */
  static source() {
    let t;
    return {
      token: new Ct(function(o) {
        t = o;
      }),
      cancel: t
    };
  }
};
function Er(e) {
  return function(n) {
    return e.apply(null, n);
  };
}
function Sr(e) {
  return a.isObject(e) && e.isAxiosError === !0;
}
const Re = {
  Continue: 100,
  SwitchingProtocols: 101,
  Processing: 102,
  EarlyHints: 103,
  Ok: 200,
  Created: 201,
  Accepted: 202,
  NonAuthoritativeInformation: 203,
  NoContent: 204,
  ResetContent: 205,
  PartialContent: 206,
  MultiStatus: 207,
  AlreadyReported: 208,
  ImUsed: 226,
  MultipleChoices: 300,
  MovedPermanently: 301,
  Found: 302,
  SeeOther: 303,
  NotModified: 304,
  UseProxy: 305,
  Unused: 306,
  TemporaryRedirect: 307,
  PermanentRedirect: 308,
  BadRequest: 400,
  Unauthorized: 401,
  PaymentRequired: 402,
  Forbidden: 403,
  NotFound: 404,
  MethodNotAllowed: 405,
  NotAcceptable: 406,
  ProxyAuthenticationRequired: 407,
  RequestTimeout: 408,
  Conflict: 409,
  Gone: 410,
  LengthRequired: 411,
  PreconditionFailed: 412,
  PayloadTooLarge: 413,
  UriTooLong: 414,
  UnsupportedMediaType: 415,
  RangeNotSatisfiable: 416,
  ExpectationFailed: 417,
  ImATeapot: 418,
  MisdirectedRequest: 421,
  UnprocessableEntity: 422,
  Locked: 423,
  FailedDependency: 424,
  TooEarly: 425,
  UpgradeRequired: 426,
  PreconditionRequired: 428,
  TooManyRequests: 429,
  RequestHeaderFieldsTooLarge: 431,
  UnavailableForLegalReasons: 451,
  InternalServerError: 500,
  NotImplemented: 501,
  BadGateway: 502,
  ServiceUnavailable: 503,
  GatewayTimeout: 504,
  HttpVersionNotSupported: 505,
  VariantAlsoNegotiates: 506,
  InsufficientStorage: 507,
  LoopDetected: 508,
  NotExtended: 510,
  NetworkAuthenticationRequired: 511
};
Object.entries(Re).forEach(([e, t]) => {
  Re[t] = e;
});
function Pt(e) {
  const t = new I(e), n = it(I.prototype.request, t);
  return a.extend(n, I.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(o) {
    return Pt(B(e, o));
  }, n;
}
const b = Pt(Q);
b.Axios = I;
b.CanceledError = H;
b.CancelToken = br;
b.isCancel = St;
b.VERSION = xt;
b.toFormData = ue;
b.AxiosError = y;
b.Cancel = b.CanceledError;
b.all = function(t) {
  return Promise.all(t);
};
b.spread = Er;
b.isAxiosError = Sr;
b.mergeConfig = B;
b.AxiosHeaders = _;
b.formToJSON = (e) => Et(a.isHTMLForm(e) ? new FormData(e) : e);
b.getAdapter = kt.getAdapter;
b.HttpStatusCode = Re;
b.default = b;
const {
  Axios: to,
  AxiosError: no,
  CanceledError: ro,
  isCancel: oo,
  CancelToken: so,
  VERSION: io,
  all: ao,
  Cancel: co,
  isAxiosError: uo,
  spread: lo,
  toFormData: fo,
  AxiosHeaders: po,
  HttpStatusCode: ho,
  formToJSON: mo,
  getAdapter: yo,
  mergeConfig: wo
} = b;
/*! js-cookie v3.0.5 | MIT */
function G(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t];
    for (var r in n)
      e[r] = n[r];
  }
  return e;
}
var Rr = {
  read: function(e) {
    return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
  },
  write: function(e) {
    return encodeURIComponent(e).replace(
      /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
      decodeURIComponent
    );
  }
};
function Te(e, t) {
  function n(o, s, i) {
    if (!(typeof document > "u")) {
      i = G({}, t, i), typeof i.expires == "number" && (i.expires = new Date(Date.now() + i.expires * 864e5)), i.expires && (i.expires = i.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
      var c = "";
      for (var f in i)
        i[f] && (c += "; " + f, i[f] !== !0 && (c += "=" + i[f].split(";")[0]));
      return document.cookie = o + "=" + e.write(s, o) + c;
    }
  }
  function r(o) {
    if (!(typeof document > "u" || arguments.length && !o)) {
      for (var s = document.cookie ? document.cookie.split("; ") : [], i = {}, c = 0; c < s.length; c++) {
        var f = s[c].split("="), u = f.slice(1).join("=");
        try {
          var l = decodeURIComponent(f[0]);
          if (i[l] = e.read(u, l), o === l)
            break;
        } catch {
        }
      }
      return o ? i[o] : i;
    }
  }
  return Object.create(
    {
      set: n,
      get: r,
      remove: function(o, s) {
        n(
          o,
          "",
          G({}, s, {
            expires: -1
          })
        );
      },
      withAttributes: function(o) {
        return Te(this.converter, G({}, this.attributes, o));
      },
      withConverter: function(o) {
        return Te(G({}, this.converter, o), this.attributes);
      }
    },
    {
      attributes: { value: Object.freeze(t) },
      converter: { value: Object.freeze(e) }
    }
  );
}
var Tr = Te(Rr, { path: "/" }), We;
const Lt = typeof window < "u", Or = (e) => typeof e == "string", Ke = () => +Date.now(), Oe = () => {
};
Lt && ((We = window == null ? void 0 : window.navigator) != null && We.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function Ue(e) {
  return typeof e == "function" ? e() : vt(e);
}
function Ar(e, t) {
  function n(...r) {
    return new Promise((o, s) => {
      Promise.resolve(e(() => t.apply(this, r), { fn: t, thisArg: this, args: r })).then(o).catch(s);
    });
  }
  return n;
}
function _r(e, t = !0, n = !0, r = !1) {
  let o = 0, s, i = !0, c = Oe, f;
  const u = () => {
    s && (clearTimeout(s), s = void 0, c(), c = Oe);
  };
  return (d) => {
    const w = Ue(e), g = Date.now() - o, p = () => f = d();
    return u(), w <= 0 ? (o = Date.now(), p()) : (g > w && (n || !i) ? (o = Date.now(), p()) : t && (f = new Promise((m, h) => {
      c = r ? h : m, s = setTimeout(() => {
        o = Date.now(), i = !0, m(p()), u();
      }, Math.max(0, w - g));
    })), !n && !s && (s = setTimeout(() => i = !0, w)), i = !1, f);
  };
}
function kr(e) {
  return e;
}
function xr(e) {
  return Bt() ? (jt(e), !0) : !1;
}
function Cr(e) {
  var t;
  const n = Ue(e);
  return (t = n == null ? void 0 : n.$el) != null ? t : n;
}
const Ut = Lt ? window : void 0;
function Qe(...e) {
  let t, n, r, o;
  if (Or(e[0]) || Array.isArray(e[0]) ? ([n, r, o] = e, t = Ut) : [t, n, r, o] = e, !t)
    return Oe;
  Array.isArray(n) || (n = [n]), Array.isArray(r) || (r = [r]);
  const s = [], i = () => {
    s.forEach((l) => l()), s.length = 0;
  }, c = (l, d, w, g) => (l.addEventListener(d, w, g), () => l.removeEventListener(d, w, g)), f = ke(() => [Cr(t), Ue(o)], ([l, d]) => {
    i(), l && s.push(...n.flatMap((w) => r.map((g) => c(l, w, g, d))));
  }, { immediate: !0, flush: "post" }), u = () => {
    f(), i();
  };
  return xr(u), u;
}
const Xe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ge = "__vueuse_ssr_handlers__";
Xe[Ge] = Xe[Ge] || {};
const Pr = ["mousemove", "mousedown", "resize", "keydown", "touchstart", "wheel"], Lr = 6e4;
function Ur(e = Lr, t = {}) {
  const {
    initialState: n = !1,
    listenForVisibilityChange: r = !0,
    events: o = Pr,
    window: s = Ut,
    eventFilter: i = _r(50)
  } = t, c = ne(n), f = ne(Ke());
  let u;
  const l = Ar(i, () => {
    c.value = !1, f.value = Ke(), clearTimeout(u), u = setTimeout(() => c.value = !0, e);
  });
  if (s) {
    const d = s.document;
    for (const w of o)
      Qe(s, w, l, { passive: !0 });
    r && Qe(d, "visibilitychange", () => {
      d.hidden || l();
    });
  }
  return u = setTimeout(() => c.value = !0, e), { idle: c, lastActive: f };
}
var Ze;
(function(e) {
  e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
})(Ze || (Ze = {}));
var Nr = Object.defineProperty, Ye = Object.getOwnPropertySymbols, Dr = Object.prototype.hasOwnProperty, Fr = Object.prototype.propertyIsEnumerable, et = (e, t, n) => t in e ? Nr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Ir = (e, t) => {
  for (var n in t || (t = {}))
    Dr.call(t, n) && et(e, n, t[n]);
  if (Ye)
    for (var n of Ye(t))
      Fr.call(t, n) && et(e, n, t[n]);
  return e;
};
const vr = {
  easeInSine: [0.12, 0, 0.39, 0],
  easeOutSine: [0.61, 1, 0.88, 1],
  easeInOutSine: [0.37, 0, 0.63, 1],
  easeInQuad: [0.11, 0, 0.5, 0],
  easeOutQuad: [0.5, 1, 0.89, 1],
  easeInOutQuad: [0.45, 0, 0.55, 1],
  easeInCubic: [0.32, 0, 0.67, 0],
  easeOutCubic: [0.33, 1, 0.68, 1],
  easeInOutCubic: [0.65, 0, 0.35, 1],
  easeInQuart: [0.5, 0, 0.75, 0],
  easeOutQuart: [0.25, 1, 0.5, 1],
  easeInOutQuart: [0.76, 0, 0.24, 1],
  easeInQuint: [0.64, 0, 0.78, 0],
  easeOutQuint: [0.22, 1, 0.36, 1],
  easeInOutQuint: [0.83, 0, 0.17, 1],
  easeInExpo: [0.7, 0, 0.84, 0],
  easeOutExpo: [0.16, 1, 0.3, 1],
  easeInOutExpo: [0.87, 0, 0.13, 1],
  easeInCirc: [0.55, 0, 1, 0.45],
  easeOutCirc: [0, 0.55, 0.45, 1],
  easeInOutCirc: [0.85, 0, 0.15, 1],
  easeInBack: [0.36, 0, 0.66, -0.56],
  easeOutBack: [0.34, 1.56, 0.64, 1],
  easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
Ir({
  linear: kr
}, vr);
let Ae;
const Nt = { triggerProxySso: "triggerProxySso" }, Br = () => {
  Ae = (e) => {
    var n;
    const { origin: t } = new URL(location.href);
    (n = window.top) == null || n.postMessage(
      { type: Nt.triggerProxySso, data: { ...e || {}, redirect_uri: `${t}/` } },
      t
    );
  };
}, jr = (e) => {
  window.top === window.self && window.addEventListener("message", (t) => {
    const { type: n, data: r } = t.data;
    n === Nt.triggerProxySso && (e == null || e(r));
  });
};
window.top !== window.self && Br();
let Dt = (e = 21) => {
  let t = "", n = crypto.getRandomValues(new Uint8Array(e));
  for (; e--; ) {
    let r = n[e] & 63;
    r < 36 ? t += r.toString(36) : r < 62 ? t += (r - 26).toString(36).toUpperCase() : r < 63 ? t += "_" : t += "-";
  }
  return t;
};
const F = (e) => new URL(location.href).searchParams.get(e), _e = (e) => {
  const t = new URL(window.location.href), n = new URLSearchParams(t.search);
  e.forEach((r) => {
    n.delete(r);
  }), t.search = n.toString(), window.history.replaceState({}, "", t);
}, { baseURL: tt } = se(), nt = {
  feishu: {
    login: "/api/justauth/client/v1/visitor/feishu/login",
    ssoParam: "/api/justauth/client/v1/visitor/sso-param"
  }
}, qr = async () => {
  const e = F("authorizer") || "";
  if (_e(["authorizer"]), e === "feishu") {
    if (!window.tt) return "";
    const t = async () => {
      const n = nt.feishu.ssoParam;
      return (await b.create().get(n, {
        baseURL: tt,
        params: {
          source: "feishu",
          fieldKey: "appId"
        }
      })).data || "";
    };
    return new Promise(async (n) => {
      const r = async (i) => {
        try {
          const c = nt.feishu.login, f = await b.create().get(c, { baseURL: tt, params: { code: i } }), { access_token: u = "", expires_in: l = 0, refresh_token: d = "" } = f.data, w = {
            accessToken: u,
            accessTokenExpiredAt: +/* @__PURE__ */ new Date() + Number(l) * 1e3,
            refreshToken: d,
            info: f.data
          };
          q().save(w), await xe(u), n(u);
        } catch {
          v({ ...U, redirect_uri: L }), n("");
        }
      }, o = await t(), s = () => {
        window.tt.requestAuthCode({
          appId: o,
          success: (i) => {
            const { code: c } = i;
            r(c);
          },
          fail: (i) => {
            v({ ...U, redirect_uri: L }), n("");
          }
        });
      };
      window.tt.requestAccess ? window.tt.requestAccess({
        appID: o,
        scopeList: [],
        success: (i) => {
          const { code: c } = i;
          r(c);
        },
        fail: (i) => {
          const { errno: c } = i;
          c === 103 ? s() : (v({ ...U, redirect_uri: L }), n(""));
        }
      }) : s();
    });
  }
  return "";
}, j = {
  oauth: "/api/justauth/oauth-server/v1/visitor/oauth/authorize",
  // 重定向到登录页
  logoutCurpage: "/api/justauth/oauth-server/v1/visitor/logout-curpage",
  // 清除登录信息
  token: "/api/justauth/oauth-server/v1/visitor/oauth/token"
  // 通过code获取token
}, { baseURL: rt, noRedireLogin: Mr = !1 } = se(), L = location.origin + "/home", U = {
  response_type: "code",
  scope: "sever",
  client_id: "sys",
  client_secret: qt("das123"),
  state: +/* @__PURE__ */ new Date()
}, Ft = ne(!1), It = (e) => {
  if (e <= 0) return;
  const { idle: t } = Ur(e);
  ke(
    () => t.value,
    (n) => {
      n === !0 && (Ft.value = !0);
    }
  );
};
localStorage.getItem("idelTime") && It(Number(localStorage.getItem("idelTime")));
let ot = "";
const Hr = async () => {
  const e = F("code") || "", t = F("redirect_url") || "/", n = F("kingdee_token") || "", r = F("loginType") || "";
  if (r && localStorage.setItem("loginType", r), !e) return z();
  if (e === ot)
    return _e(["code", "state", "kingdee_token", "redirect_url"]), window.__isAutoCloseApp = !1, window.location.replace(decodeURIComponent(t)), z();
  ot = e, _e(["code", "state", "kingdee_token", "redirect_url"]);
  let o = {};
  const s = {
    grant_type: "authorization_code",
    code: e,
    client_id: U.client_id,
    client_secret: U.client_secret,
    redirect_uri: r ? st(L, { loginType: r }) : L,
    timestamp: (/* @__PURE__ */ new Date()).getTime(),
    nonce: Dt()
  };
  n && (sessionStorage.setItem("kingdee_token", n), s.redirect_uri = `${s.redirect_uri}?kingdee_token=${n}`);
  try {
    await b.create().get(j.token, { baseURL: rt });
  } catch {
  }
  try {
    o = await b.create().post(
      j.token,
      {},
      {
        baseURL: rt,
        params: s,
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
          "csrf-token": Tr.get("csrf-token")
        }
      }
    );
    const { access_token: i = "", expires_in: c = 0, refresh_token: f = "", refresh_exp: u = 0 } = o.data, l = {
      accessToken: i,
      accessTokenExpiredAt: +/* @__PURE__ */ new Date() + Number(c) * 1e3,
      refreshToken: f,
      info: o.data
    };
    q().save(l), await xe(i);
    const d = Number(u) - (/* @__PURE__ */ new Date()).getTime();
    return d && d > 0 && (It(d), d && localStorage.setItem("idelTime", d.toString())), t && (window.__isAutoCloseApp = !1, window.location.replace(decodeURIComponent(t))), i;
  } catch {
    return v({ ...U, redirect_uri: L });
  }
}, Z = ne(!1), go = async (e) => {
  if (e.public) return "";
  if (Ft.value)
    return v({ ...U, redirect_uri: L });
  if (Z.value)
    return await new Promise(async (r) => {
      ke(
        () => Z.value,
        (o) => {
          if (!o) {
            const s = z();
            r(s);
          }
        }
      );
    });
  let t = z();
  const { accessTokenExpiredAt: n } = q().getData();
  Z.value = !0;
  try {
    const r = F("code") || "", o = F("authorizer") || "";
    r ? t = await Hr() : o === "feishu" ? t = await qr() : typeof n == "number" && n > 0 && +/* @__PURE__ */ new Date() + 6e4 > n && (t = await Jr(U));
  } catch {
  } finally {
    Z.value = !1;
  }
  return t;
}, $r = () => {
  let e = !1;
  return localStorage.getItem("thirdLogouSource") === "zhongshen" && (e = !0), e;
}, zr = (e) => {
  if (localStorage.getItem("thirdLogouSource") === "zhongshen") {
    const r = `https://iam.shenyejituan.com:443/idp/profile/OAUTH2/Redirect/GLO?redirctToUrl=${encodeURIComponent(e)}&entityId=AIoT&redirectToLogin=true`;
    localStorage.removeItem("thirdLogouSource"), location.href = r;
  }
};
let ye = !1;
const v = (e) => {
  if (!Mr && !ye) {
    ye = !0;
    try {
      const t = { ...e }, n = localStorage.getItem("loginType") || "";
      n && (t.redirect_uri = st(t.redirect_uri, { loginType: n }));
      const { baseURL: r, ssoLocale: o } = se();
      if (Ae) return Ae(t);
      t.logout = "true", o && (t.locale = "locale");
      const s = new URLSearchParams();
      Object.entries(t).forEach(([f, u]) => {
        f !== "client_secret" && s.set(f, String(u));
      });
      const i = s.toString(), c = `${r}${j.oauth}?${i}`;
      if (localStorage.removeItem("idelTime"), sessionStorage.clear(), q().remove(), $r())
        zr(c);
      else {
        try {
          b.create().get(j.logoutCurpage, { baseURL: r });
        } catch {
        }
        window.__isAutoCloseApp = !1, location.replace(c);
      }
    } finally {
      ye = !1;
    }
  }
};
jr(v);
const Jr = async (e) => {
  const { baseURL: t } = se(), { refreshToken: n } = q().getData();
  try {
    await b.create().get(j.token, { baseURL: t });
  } catch {
  }
  try {
    const r = await b.create().post(
      j.token,
      {},
      {
        baseURL: t,
        params: {
          refresh_token: n,
          grant_type: "refresh_token",
          client_id: e.client_id,
          client_secret: e.client_secret,
          timestamp: (/* @__PURE__ */ new Date()).getTime(),
          nonce: Dt()
        }
      }
    ), { access_token: o = "", expires_in: s = 0, refresh_token: i = "" } = r.data, c = {
      accessToken: o,
      accessTokenExpiredAt: +/* @__PURE__ */ new Date() + Number(s) * 1e3,
      refreshToken: i,
      info: r.data
    };
    return q().save(c), await xe(o), o;
  } catch {
    return v({ ...e, redirect_uri: L });
  }
}, q = () => ({
  getData: () => ({
    accessToken: z(),
    accessTokenExpiredAt: de("accessTokenExpiredAt") ? Number(de("accessTokenExpiredAt")) : "",
    refreshToken: de("refreshToken")
  }),
  save: (e) => {
    Ht(e.accessToken ?? "", {
      accessTokenExpiredAt: e.accessTokenExpiredAt,
      refreshToken: e.refreshToken
    }), zt(e);
  },
  remove: () => {
    Mt(), $t();
  }
});
export {
  F as getQuery,
  go as getToken,
  Hr as getTokenFromCode,
  U as getTokenParams,
  v as login,
  L as real_uri,
  q as tokenStorage
};
