Stream<T> debounce(Stream<void> Function(T event) window) => switchMap((event) => window(event).take(1).map((_) => event));