import { e as ce, i as x, g as I, r as m, c as ue, b as F, d as E, f as fe, t as y, M as k, a as pe } from "./_Map-DW8mXZqr.js";
import { useCallback as b, useLayoutEffect as de, useState as ge, useRef as be, useEffect as R } from "react";
var me = /\s/;
function ye(e) {
  for (var r = e.length; r-- && me.test(e.charAt(r)); )
    ;
  return r;
}
var Te = /^\s+/;
function le(e) {
  return e && e.slice(0, ye(e) + 1).replace(Te, "");
}
var L = NaN, je = /^[-+]0x[0-9a-f]+$/i, ve = /^0b[01]+$/i, Ae = /^0o[0-7]+$/i, xe = parseInt;
function N(e) {
  if (typeof e == "number")
    return e;
  if (ce(e))
    return L;
  if (x(e)) {
    var r = typeof e.valueOf == "function" ? e.valueOf() : e;
    e = x(r) ? r + "" : r;
  }
  if (typeof e != "string")
    return e === 0 ? e : +e;
  e = le(e);
  var t = ve.test(e);
  return t || Ae.test(e) ? xe(e.slice(2), t ? 2 : 8) : je.test(e) ? L : +e;
}
var P = I(m, "WeakMap"), Ie = 9007199254740991;
function Z(e) {
  return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Ie;
}
function Ee(e) {
  return e != null && Z(e.length) && !ue(e);
}
var Oe = Object.prototype;
function V(e) {
  var r = e && e.constructor, t = typeof r == "function" && r.prototype || Oe;
  return e === t;
}
var Se = "[object Arguments]";
function U(e) {
  return F(e) && E(e) == Se;
}
var ee = Object.prototype, we = ee.hasOwnProperty, $e = ee.propertyIsEnumerable, Me = U(/* @__PURE__ */ function() {
  return arguments;
}()) ? U : function(e) {
  return F(e) && we.call(e, "callee") && !$e.call(e, "callee");
};
function ke() {
  return !1;
}
var re = typeof exports == "object" && exports && !exports.nodeType && exports, z = re && typeof module == "object" && module && !module.nodeType && module, Pe = z && z.exports === re, q = Pe ? m.Buffer : void 0, he = q ? q.isBuffer : void 0, Be = he || ke, De = "[object Arguments]", Fe = "[object Array]", We = "[object Boolean]", Ce = "[object Date]", _e = "[object Error]", Re = "[object Function]", Le = "[object Map]", Ne = "[object Number]", Ue = "[object Object]", ze = "[object RegExp]", qe = "[object Set]", Ge = "[object String]", Xe = "[object WeakMap]", Ke = "[object ArrayBuffer]", He = "[object DataView]", Je = "[object Float32Array]", Qe = "[object Float64Array]", Ye = "[object Int8Array]", Ze = "[object Int16Array]", Ve = "[object Int32Array]", er = "[object Uint8Array]", rr = "[object Uint8ClampedArray]", tr = "[object Uint16Array]", nr = "[object Uint32Array]", n = {};
n[Je] = n[Qe] = n[Ye] = n[Ze] = n[Ve] = n[er] = n[rr] = n[tr] = n[nr] = !0;
n[De] = n[Fe] = n[Ke] = n[We] = n[He] = n[Ce] = n[_e] = n[Re] = n[Le] = n[Ne] = n[Ue] = n[ze] = n[qe] = n[Ge] = n[Xe] = !1;
function ar(e) {
  return F(e) && Z(e.length) && !!n[E(e)];
}
function or(e) {
  return function(r) {
    return e(r);
  };
}
var te = typeof exports == "object" && exports && !exports.nodeType && exports, j = te && typeof module == "object" && module && !module.nodeType && module, ir = j && j.exports === te, $ = ir && fe.process, G = function() {
  try {
    var e = j && j.require && j.require("util").types;
    return e || $ && $.binding && $.binding("util");
  } catch {
  }
}(), X = G && G.isTypedArray, sr = X ? or(X) : ar;
function cr(e, r) {
  return function(t) {
    return e(r(t));
  };
}
var ur = cr(Object.keys, Object), fr = Object.prototype, pr = fr.hasOwnProperty;
function dr(e) {
  if (!V(e))
    return ur(e);
  var r = [];
  for (var t in Object(e))
    pr.call(e, t) && t != "constructor" && r.push(t);
  return r;
}
var h = I(m, "DataView"), B = I(m, "Promise"), D = I(m, "Set"), K = "[object Map]", gr = "[object Object]", H = "[object Promise]", J = "[object Set]", Q = "[object WeakMap]", Y = "[object DataView]", br = y(h), mr = y(k), yr = y(B), Tr = y(D), lr = y(P), g = E;
(h && g(new h(new ArrayBuffer(1))) != Y || k && g(new k()) != K || B && g(B.resolve()) != H || D && g(new D()) != J || P && g(new P()) != Q) && (g = function(e) {
  var r = E(e), t = r == gr ? e.constructor : void 0, a = t ? y(t) : "";
  if (a)
    switch (a) {
      case br:
        return Y;
      case mr:
        return K;
      case yr:
        return H;
      case Tr:
        return J;
      case lr:
        return Q;
    }
  return r;
});
var M = function() {
  return m.Date.now();
}, jr = "Expected a function", vr = Math.max, Ar = Math.min;
function ne(e, r, t) {
  var a, o, f, c, u, s, p = 0, v = !1, T = !1, O = !0;
  if (typeof e != "function")
    throw new TypeError(jr);
  r = N(r) || 0, x(t) && (v = !!t.leading, T = "maxWait" in t, f = T ? vr(N(t.maxWait) || 0, r) : f, O = "trailing" in t ? !!t.trailing : O);
  function S(i) {
    var d = a, l = o;
    return a = o = void 0, p = i, c = e.apply(l, d), c;
  }
  function ae(i) {
    return p = i, u = setTimeout(A, r), v ? S(i) : c;
  }
  function oe(i) {
    var d = i - s, l = i - p, _ = r - d;
    return T ? Ar(_, f - l) : _;
  }
  function W(i) {
    var d = i - s, l = i - p;
    return s === void 0 || d >= r || d < 0 || T && l >= f;
  }
  function A() {
    var i = M();
    if (W(i))
      return C(i);
    u = setTimeout(A, oe(i));
  }
  function C(i) {
    return u = void 0, O && a ? S(i) : (a = o = void 0, c);
  }
  function ie() {
    u !== void 0 && clearTimeout(u), p = 0, a = s = o = u = void 0;
  }
  function se() {
    return u === void 0 ? c : C(M());
  }
  function w() {
    var i = M(), d = W(i);
    if (a = arguments, o = this, s = i, d) {
      if (u === void 0)
        return ae(s);
      if (T)
        return clearTimeout(u), u = setTimeout(A, r), S(s);
    }
    return u === void 0 && (u = setTimeout(A, r)), c;
  }
  return w.cancel = ie, w.flush = se, w;
}
var xr = "[object Map]", Ir = "[object Set]", Er = Object.prototype, Or = Er.hasOwnProperty;
function Pr(e) {
  if (e == null)
    return !0;
  if (Ee(e) && (pe(e) || typeof e == "string" || typeof e.splice == "function" || Be(e) || sr(e) || Me(e)))
    return !e.length;
  var r = g(e);
  if (r == xr || r == Ir)
    return !e.size;
  if (V(e))
    return !dr(e).length;
  for (var t in e)
    if (Or.call(e, t))
      return !1;
  return !0;
}
var Sr = "Expected a function";
function wr(e, r, t) {
  var a = !0, o = !0;
  if (typeof e != "function")
    throw new TypeError(Sr);
  return x(t) && (a = "leading" in t ? !!t.leading : a, o = "trailing" in t ? !!t.trailing : o), ne(e, r, {
    leading: a,
    maxWait: r,
    trailing: o
  });
}
function hr(e, r, t = 100) {
  const a = b(
    wr((o) => {
      document.hidden || r(o);
    }, t),
    [r, t]
  );
  de(() => {
    let o = 0;
    const f = e.current;
    if (!f) return;
    const c = new ResizeObserver(() => {
      cancelAnimationFrame(o), o = requestAnimationFrame(() => a(f));
    });
    return c.observe(f), () => {
      cancelAnimationFrame(o), c.disconnect(), a.cancel();
    };
  }, [e, a]);
}
const $r = ({ items: e, onReorder: r }) => {
  const t = b(
    (o) => {
      const { active: f, over: c } = o;
      if (!c || f.id === c.id) return;
      const u = parseInt(f.id.toString().split("-")[1]), s = parseInt(c.id.toString().split("-")[1]), p = [...e], [v] = p.splice(u, 1);
      p.splice(s, 0, v), r == null || r(p);
    },
    [e, r]
  ), a = b((o) => `sort-${o}`, []);
  return {
    handleDragEnd: t,
    getItemId: a
  };
}, Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: $r
}, Symbol.toStringTag, { value: "Module" })), Dr = ({ handleChangeSearchValue: e, searchValue: r }) => {
  const [t, a] = ge(""), o = be(ne((s) => e == null ? void 0 : e(s), 300));
  R(() => a(r ?? ""), [r]), R(() => {
    const s = o.current;
    return () => {
      s.cancel();
    };
  }, []);
  const f = b((s) => {
    const p = s.target.value;
    a(p), o.current(p);
  }, []), c = b((s) => {
    a(s), o.current(s);
  }, []);
  return {
    handleResetSearch: b(() => {
      a(""), e == null || e("");
    }, [e]),
    handleSearchChange: f,
    handleStringSearchChange: c,
    search: t
  };
};
export {
  D as S,
  hr as a,
  V as b,
  Be as c,
  ne as d,
  sr as e,
  Z as f,
  g,
  Me as h,
  Ee as i,
  or as j,
  Pr as k,
  Dr as l,
  dr as m,
  G as n,
  cr as o,
  Br as p,
  N as t,
  $r as u
};
//# sourceMappingURL=use-debounce-search-DTQpLIZM.js.map
