import { c } from "react/compiler-runtime";
import { useEffect, useState } from "react";
function useDebounce(r, i) {
	let a = c(4), o = i === void 0 ? 500 : i, [s, l] = useState(r), u, d;
	return a[0] !== o || a[1] !== r ? (u = () => {
		if (typeof r == "string") {
			let e = r;
			if (r === void 0 || e === "" || e.length >= 3) {
				let e = setTimeout(() => {
					l(r);
				}, o);
				return () => {
					clearTimeout(e);
				};
			}
			return;
		} else {
			let e = setTimeout(() => {
				l(r);
			}, o);
			return () => {
				clearTimeout(e);
			};
		}
	}, d = [r, o], a[0] = o, a[1] = r, a[2] = u, a[3] = d) : (u = a[2], d = a[3]), useEffect(u, d), s;
}
export { useDebounce };
