/**
 * Coalesce many calls to `fn` into one per animation frame.
 *
 * Use for high-frequency layout-reading event handlers (scroll, resize,
 * visualViewport, ResizeObserver) where the work must happen in a frame but
 * doing it on every event call (60+/s for resize, hundreds/s for capture
 * scrolls) wastes layout/paint cycles. The returned function exposes
 * `.cancel()` so effect cleanup can drop a pending frame.
 *
 * Pattern:
 *   const apply = () => { ...layout reads + setState... }
 *   const scheduled = rafThrottle(apply)
 *   window.addEventListener("scroll", scheduled, { passive: true, capture: true })
 *   return () => {
 *     scheduled.cancel()
 *     window.removeEventListener("scroll", scheduled, { capture: true })
 *   }
 */
declare function rafThrottle<TArgs extends unknown[]>(fn: (...args: TArgs) => void): ((...args: TArgs) => void) & {
    cancel: () => void;
};

export { rafThrottle };
