import u from "./index-useLazyRef.js";
import c from "./index-useOnMount.js";
class t {
  constructor() {
    this.currentId = null, this.clear = () => {
      this.currentId !== null && (clearTimeout(this.currentId), this.currentId = null);
    }, this.disposeEffect = () => this.clear;
  }
  static create() {
    return new t();
  }
  /**
   * Executes `fn` after `delay`, clearing any previously scheduled call.
   */
  start(r, s) {
    this.clear(), this.currentId = setTimeout(() => {
      this.currentId = null, s();
    }, r);
  }
}
function o() {
  const e = u(t.create).current;
  return c(e.disposeEffect), e;
}
export {
  t as Timeout,
  o as default
};
