function u(n = "POST", o, s, t = {}) {
  return new Promise((a, p) => {
    const e = new XMLHttpRequest();
    e.open(n, o);
    for (const r in t)
      Object.prototype.hasOwnProperty.call(t, r) && e.setRequestHeader(r, t[r]);
    e.responseType = "json", e.send(JSON.stringify(s)), e.onreadystatechange = () => {
      e.readyState === XMLHttpRequest.DONE && e.status === 200 && a(e.response);
    }, e.onerror = () => {
      p(new Error("** An error occurred during the transaction"));
    };
  });
}
export {
  u as default
};
