import { useCallback as u, useMemo as h } from "react";
import { useSearchParams as m } from "react-router-dom";
function v(r, c, s = "tab") {
  const [o, i] = m(), t = u(
    (e) => e !== null && c.includes(e),
    [c]
  ), a = h(() => {
    const e = o.get(s);
    return t(e) ? e : r;
  }, [o, s, t, r]), P = u(
    (e) => {
      i(
        (l) => {
          const n = new URLSearchParams(l);
          return e === r ? n.delete(s) : n.set(s, e), n;
        },
        { replace: !0 }
      );
    },
    [i, r, s]
  );
  return { activeTab: a, setActiveTab: P, isValidTab: t };
}
export {
  v as u
};
//# sourceMappingURL=useTabNavigation-Bsbskz0i.js.map
