import { __require as S } from "./index-utils10.js";
import { __require as B } from "./index-settle.js";
import { __require as F } from "./index-cookies.js";
import { __require as X } from "./index-buildURL.js";
import { __require as M } from "./index-buildFullPath.js";
import { __require as I } from "./index-parseHeaders.js";
import { __require as z } from "./index-isURLSameOrigin.js";
import { __require as K } from "./index-transitional.js";
import { __require as Q } from "./index-AxiosError.js";
import { __require as W } from "./index-CanceledError.js";
import { __require as G } from "./index-parseProtocol.js";
import { __require as J } from "./index-platform.js";
var h, T;
function ie() {
  if (T) return h;
  T = 1;
  var n = S(), w = B(), x = F(), U = X(), b = M(), C = I(), L = z(), P = K(), a = Q(), H = W(), y = G(), k = J();
  return h = function(e) {
    return new Promise(function(A, i) {
      var s = e.data, p = e.headers, m = e.responseType, u = e.withXSRFToken, l;
      function E() {
        e.cancelToken && e.cancelToken.unsubscribe(l), e.signal && e.signal.removeEventListener("abort", l);
      }
      n.isFormData(s) && n.isStandardBrowserEnv() && delete p["Content-Type"];
      var r = new XMLHttpRequest();
      if (e.auth) {
        var D = e.auth.username || "", N = e.auth.password ? unescape(encodeURIComponent(e.auth.password)) : "";
        p.Authorization = "Basic " + btoa(D + ":" + N);
      }
      var v = b(e.baseURL, e.url);
      r.open(e.method.toUpperCase(), U(v, e.params, e.paramsSerializer), !0), r.timeout = e.timeout;
      function R() {
        if (r) {
          var t = "getAllResponseHeaders" in r ? C(r.getAllResponseHeaders()) : null, d = !m || m === "text" || m === "json" ? r.responseText : r.response, o = {
            data: d,
            status: r.status,
            statusText: r.statusText,
            headers: t,
            config: e,
            request: r
          };
          w(function(_) {
            A(_), E();
          }, function(_) {
            i(_), E();
          }, o), r = null;
        }
      }
      if ("onloadend" in r ? r.onloadend = R : r.onreadystatechange = function() {
        !r || r.readyState !== 4 || r.status === 0 && !(r.responseURL && r.responseURL.indexOf("file:") === 0) || setTimeout(R);
      }, r.onabort = function() {
        r && (i(new a("Request aborted", a.ECONNABORTED, e, r)), r = null);
      }, r.onerror = function() {
        i(new a("Network Error", a.ERR_NETWORK, e, r)), r = null;
      }, r.ontimeout = function() {
        var d = e.timeout ? "timeout of " + e.timeout + "ms exceeded" : "timeout exceeded", o = e.transitional || P;
        e.timeoutErrorMessage && (d = e.timeoutErrorMessage), i(new a(
          d,
          o.clarifyTimeoutError ? a.ETIMEDOUT : a.ECONNABORTED,
          e,
          r
        )), r = null;
      }, n.isStandardBrowserEnv() && (u && n.isFunction(u) && (u = u(e)), u || u !== !1 && L(v))) {
        var f = e.xsrfHeaderName && e.xsrfCookieName && x.read(e.xsrfCookieName);
        f && (p[e.xsrfHeaderName] = f);
      }
      "setRequestHeader" in r && n.forEach(p, function(d, o) {
        typeof s > "u" && o.toLowerCase() === "content-type" ? delete p[o] : r.setRequestHeader(o, d);
      }), n.isUndefined(e.withCredentials) || (r.withCredentials = !!e.withCredentials), m && m !== "json" && (r.responseType = e.responseType), typeof e.onDownloadProgress == "function" && r.addEventListener("progress", e.onDownloadProgress), typeof e.onUploadProgress == "function" && r.upload && r.upload.addEventListener("progress", e.onUploadProgress), (e.cancelToken || e.signal) && (l = function(t) {
        r && (i(!t || t.type ? new H(null, e, r) : t), r.abort(), r = null);
      }, e.cancelToken && e.cancelToken.subscribe(l), e.signal && (e.signal.aborted ? l() : e.signal.addEventListener("abort", l))), !s && s !== !1 && s !== 0 && s !== "" && (s = null);
      var q = y(v);
      if (q && k.protocols.indexOf(q) === -1) {
        i(new a("Unsupported protocol " + q + ":", a.ERR_BAD_REQUEST, e));
        return;
      }
      r.send(s);
    });
  }, h;
}
export {
  ie as __require
};
