import { timeoutManager as i } from "./timeoutManager.js";
import { environmentManager as t } from "./environmentManager.js";
import { isValidTimeout as m } from "./utils.js";
var a = class {
  #i;
  destroy() {
    this.clearGcTimeout();
  }
  scheduleGc() {
    this.clearGcTimeout(), m(this.gcTime) && (this.#i = i.setTimeout(() => {
      this.optionalRemove();
    }, this.gcTime));
  }
  updateGcTime(e) {
    this.gcTime = Math.max(
      this.gcTime || 0,
      e ?? (t.isServer() ? 1 / 0 : 300 * 1e3)
    );
  }
  clearGcTimeout() {
    this.#i && (i.clearTimeout(this.#i), this.#i = void 0);
  }
};
export {
  a as Removable
};
