//#region extensions/feishu/src/transport/reliability/dedupe.ts
function createFeishuDedupe(options) {
	const max = options?.max ?? 1e4;
	const ttlMs = options?.ttlMs ?? 10 * 6e4;
	const seen = /* @__PURE__ */ new Map();
	function prune(now) {
		for (const [k, t] of seen) if (now - t > ttlMs) seen.delete(k);
		if (seen.size <= max) return;
		const extra = seen.size - max;
		let i = 0;
		for (const k of seen.keys()) {
			seen.delete(k);
			i++;
			if (i >= extra) break;
		}
	}
	return { claim(id) {
		const key = id.trim();
		if (!key) return false;
		const now = Date.now();
		prune(now);
		if (seen.has(key)) return false;
		seen.set(key, now);
		return true;
	} };
}
//#endregion
export { createFeishuDedupe };

//# sourceMappingURL=dedupe.js.map