"use client";
import { Timeout } from "../../utils/hooks/useTimeout.js";
// https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/debounce.js
function debounce(func, wait = 166, leading = false) {
    const timeout = new Timeout();
    function debounced(...args) {
        const later = () => {
            func.apply(this, args);
        };
        if (!timeout.isStarted() && leading) {
            later();
        }
        timeout.start(wait, later);
    }
    debounced.clear = timeout.clear;
    return debounced;
}
export { debounce };
//# sourceMappingURL=debounce.js.map