const l = typeof Buffer == "function";
typeof TextDecoder == "function" && new TextDecoder();
typeof TextEncoder == "function" && new TextEncoder();
const b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", A = Array.prototype.slice.call(b), f = ((t) => {
  let r = {};
  return t.forEach((o, n) => r[o] = n), r;
})(A), d = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/, a = String.fromCharCode.bind(String), i = typeof Uint8Array.from == "function" ? Uint8Array.from.bind(Uint8Array) : (t) => new Uint8Array(Array.prototype.slice.call(t, 0)), y = (t) => t.replace(/[^A-Za-z0-9\+\/]/g, ""), p = (t) => {
  if (t = t.replace(/\s+/g, ""), !d.test(t))
    throw new TypeError("malformed base64.");
  t += "==".slice(2 - (t.length & 3));
  let r, o = "", n, c;
  for (let e = 0; e < t.length; )
    r = f[t.charAt(e++)] << 18 | f[t.charAt(e++)] << 12 | (n = f[t.charAt(e++)]) << 6 | (c = f[t.charAt(e++)]), o += n === 64 ? a(r >> 16 & 255) : c === 64 ? a(r >> 16 & 255, r >> 8 & 255) : a(r >> 16 & 255, r >> 8 & 255, r & 255);
  return o;
}, s = typeof atob == "function" ? (t) => atob(y(t)) : l ? (t) => Buffer.from(t, "base64").toString("binary") : p, u = l ? (t) => i(Buffer.from(t, "base64")) : (t) => i(s(t).split("").map((r) => r.charCodeAt(0))), m = (t) => u(h(t)), h = (t) => y(t.replace(/[-_]/g, (r) => r == "-" ? "+" : "/"));
export {
  s as atob,
  p as atobPolyfill,
  m as toUint8Array
};
//# sourceMappingURL=base64.js.map
