import { an as C, aT as M, aa as I, ai as N } from "./index2.js";
var j = "[object Symbol]";
function B(e) {
  return typeof e == "symbol" || C(e) && M(e) == j;
}
var R = /\s/;
function $(e) {
  for (var i = e.length; i-- && R.test(e.charAt(i)); )
    ;
  return i;
}
var F = /^\s+/;
function _(e) {
  return e && e.slice(0, $(e) + 1).replace(F, "");
}
var k = NaN, D = /^[-+]0x[0-9a-f]+$/i, G = /^0b[01]+$/i, H = /^0o[0-7]+$/i, P = parseInt;
function S(e) {
  if (typeof e == "number")
    return e;
  if (B(e))
    return k;
  if (I(e)) {
    var i = typeof e.valueOf == "function" ? e.valueOf() : e;
    e = I(i) ? i + "" : i;
  }
  if (typeof e != "string")
    return e === 0 ? e : +e;
  e = _(e);
  var t = G.test(e);
  return t || H.test(e) ? P(e.slice(2), t ? 2 : 8) : D.test(e) ? k : +e;
}
var y = function() {
  return N.Date.now();
}, U = "Expected a function", X = Math.max, q = Math.min;
function J(e, i, t) {
  var s, o, l, u, r, f, c = 0, h = !1, d = !1, T = !0;
  if (typeof e != "function")
    throw new TypeError(U);
  i = S(i) || 0, I(t) && (h = !!t.leading, d = "maxWait" in t, l = d ? X(S(t.maxWait) || 0, i) : l, T = "trailing" in t ? !!t.trailing : T);
  function b(n) {
    var a = s, m = o;
    return s = o = void 0, c = n, u = e.apply(m, a), u;
  }
  function O(n) {
    return c = n, r = setTimeout(g, i), h ? b(n) : u;
  }
  function W(n) {
    var a = n - f, m = n - c, E = i - a;
    return d ? q(E, l - m) : E;
  }
  function p(n) {
    var a = n - f, m = n - c;
    return f === void 0 || a >= i || a < 0 || d && m >= l;
  }
  function g() {
    var n = y();
    if (p(n))
      return v(n);
    r = setTimeout(g, W(n));
  }
  function v(n) {
    return r = void 0, T && s ? b(n) : (s = o = void 0, u);
  }
  function L() {
    r !== void 0 && clearTimeout(r), c = 0, s = f = o = r = void 0;
  }
  function A() {
    return r === void 0 ? u : v(y());
  }
  function x() {
    var n = y(), a = p(n);
    if (s = arguments, o = this, f = n, a) {
      if (r === void 0)
        return O(f);
      if (d)
        return clearTimeout(r), r = setTimeout(g, i), b(f);
    }
    return r === void 0 && (r = setTimeout(g, i)), u;
  }
  return x.cancel = L, x.flush = A, x;
}
export {
  J as d,
  B as i,
  S as t
};
