//#region libs/shared/common/src/functions/utils/process.utils.ts
var e = (e) => new Promise((t) => {
	setTimeout(t, e);
}), t = async (t, n = {}) => {
	let r = n.intervalMs ?? 5e3, i = n.timeoutMs ?? 6e4, a = Math.floor(i / r) + 1;
	for (let n = 0; n < a; n += 1) {
		try {
			let e = await t();
			if (e != null) return e;
		} catch {}
		n < a - 1 && await e(r);
	}
};
function n(e, t) {
	let n;
	return function(...r) {
		clearTimeout(n), n = setTimeout(() => {
			clearTimeout(n), e(...r);
		}, t);
	};
}
//#endregion
export { n as debounce, t as pollForValue, e as wait };
