//#region src/utils/reconnect.ts
/** Base delay (ms) for exponential reconnect backoff (`base * 2^(attempt-1)`). */
const DEFAULT_RECONNECT_BASE_DELAY_MS = 1e3;
/** Cap (ms) for exponential reconnect backoff before jitter. */
const DEFAULT_RECONNECT_MAX_DELAY_MS = 5e3;
/** Max random jitter (ms) added on top of the capped base delay. */
const DEFAULT_RECONNECT_JITTER_MS = 1e3;
/**
* Exponential backoff with jitter for stream reconnect.
* `min(base * 2^(attempt-1), max) + random(0, jitter)`.
*/
function reconnectDelayMs(attempt) {
	return Math.min(DEFAULT_RECONNECT_BASE_DELAY_MS * 2 ** (attempt - 1), DEFAULT_RECONNECT_MAX_DELAY_MS) + Math.random() * DEFAULT_RECONNECT_JITTER_MS;
}
//#endregion
exports.reconnectDelayMs = reconnectDelayMs;

//# sourceMappingURL=reconnect.cjs.map