import { __exports as l } from "../../../../../../_virtual/utils2.js";
import { __require as v } from "./crypto.js";
import { __require as D } from "./_assert.js";
var p;
function P() {
  return p ? l : (p = 1, function(n) {
    /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
    Object.defineProperty(n, "__esModule", { value: !0 }), n.Hash = n.nextTick = n.byteSwapIfBE = n.isLE = void 0, n.isBytes = h, n.u8 = m, n.u32 = _, n.createView = B, n.rotr = L, n.rotl = A, n.byteSwap = y, n.byteSwap32 = O, n.bytesToHex = k, n.hexToBytes = E, n.asyncLoop = S, n.utf8ToBytes = w, n.toBytes = a, n.concatBytes = q, n.checkOpts = j, n.wrapConstructor = C, n.wrapConstructorWithOpts = H, n.wrapXOFConstructorWithOpts = F, n.randomBytes = R;
    const f = /* @__PURE__ */ v(), s = /* @__PURE__ */ D();
    function h(t) {
      return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
    }
    function m(t) {
      return new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
    }
    function _(t) {
      return new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
    }
    function B(t) {
      return new DataView(t.buffer, t.byteOffset, t.byteLength);
    }
    function L(t, e) {
      return t << 32 - e | t >>> e;
    }
    function A(t, e) {
      return t << e | t >>> 32 - e >>> 0;
    }
    n.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
    function y(t) {
      return t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
    }
    n.byteSwapIfBE = n.isLE ? (t) => t : (t) => y(t);
    function O(t) {
      for (let e = 0; e < t.length; e++)
        t[e] = y(t[e]);
    }
    const T = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
    function k(t) {
      (0, s.abytes)(t);
      let e = "";
      for (let o = 0; o < t.length; o++)
        e += T[t[o]];
      return e;
    }
    const c = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
    function d(t) {
      if (t >= c._0 && t <= c._9)
        return t - c._0;
      if (t >= c.A && t <= c.F)
        return t - (c.A - 10);
      if (t >= c.a && t <= c.f)
        return t - (c.a - 10);
    }
    function E(t) {
      if (typeof t != "string")
        throw new Error("hex string expected, got " + typeof t);
      const e = t.length, o = e / 2;
      if (e % 2)
        throw new Error("hex string expected, got unpadded hex of length " + e);
      const r = new Uint8Array(o);
      for (let i = 0, u = 0; i < o; i++, u += 2) {
        const g = d(t.charCodeAt(u)), b = d(t.charCodeAt(u + 1));
        if (g === void 0 || b === void 0) {
          const W = t[u] + t[u + 1];
          throw new Error('hex string expected, got non-hex character "' + W + '" at index ' + u);
        }
        r[i] = g * 16 + b;
      }
      return r;
    }
    const U = async () => {
    };
    n.nextTick = U;
    async function S(t, e, o) {
      let r = Date.now();
      for (let i = 0; i < t; i++) {
        o(i);
        const u = Date.now() - r;
        u >= 0 && u < e || (await (0, n.nextTick)(), r += u);
      }
    }
    function w(t) {
      if (typeof t != "string")
        throw new Error("utf8ToBytes expected string, got " + typeof t);
      return new Uint8Array(new TextEncoder().encode(t));
    }
    function a(t) {
      return typeof t == "string" && (t = w(t)), (0, s.abytes)(t), t;
    }
    function q(...t) {
      let e = 0;
      for (let r = 0; r < t.length; r++) {
        const i = t[r];
        (0, s.abytes)(i), e += i.length;
      }
      const o = new Uint8Array(e);
      for (let r = 0, i = 0; r < t.length; r++) {
        const u = t[r];
        o.set(u, i), i += u.length;
      }
      return o;
    }
    class V {
      // Safe version that clones internal state
      clone() {
        return this._cloneInto();
      }
    }
    n.Hash = V;
    function j(t, e) {
      if (e !== void 0 && {}.toString.call(e) !== "[object Object]")
        throw new Error("Options should be object or undefined");
      return Object.assign(t, e);
    }
    function C(t) {
      const e = (r) => t().update(a(r)).digest(), o = t();
      return e.outputLen = o.outputLen, e.blockLen = o.blockLen, e.create = () => t(), e;
    }
    function H(t) {
      const e = (r, i) => t(i).update(a(r)).digest(), o = t({});
      return e.outputLen = o.outputLen, e.blockLen = o.blockLen, e.create = (r) => t(r), e;
    }
    function F(t) {
      const e = (r, i) => t(i).update(a(r)).digest(), o = t({});
      return e.outputLen = o.outputLen, e.blockLen = o.blockLen, e.create = (r) => t(r), e;
    }
    function R(t = 32) {
      if (f.crypto && typeof f.crypto.getRandomValues == "function")
        return f.crypto.getRandomValues(new Uint8Array(t));
      if (f.crypto && typeof f.crypto.randomBytes == "function")
        return f.crypto.randomBytes(t);
      throw new Error("crypto.getRandomValues must be defined");
    }
  }(l), l);
}
export {
  P as __require
};
//# sourceMappingURL=utils.js.map
