export { D as Debounced, d as debounce } from '../index-CUoyCM46.js'; import { b as Cmd } from '../core-sEWVgnpI.js'; import { T as TtlCache, a as DeadlineSub } from '../index-CCs-QGGu.js'; export { D as ThrottledInputSettled, s as subscribeThrottledInput, d as throttledInputSettled } from '../index-CCs-QGGu.js'; import '@standard-schema/spec'; import '../types-CtM4tWPp.js'; /** * internal/timing/throttle — a timer-based call transformer that caps invocation * to at most once per `ms` window. * * Sibling of `../debounce` — the two share a SYMMETRIC surface * (`Throttled` / `Debounced`, both callable + `.cancel()` + `.flush()`, * both `{ leading?, trailing? }`) so they read as a pair. They are kept in * separate files with NO cross-import: each is a self-contained timer, and the * coalesce-vs-drop policies differ enough that sharing code would hide the * distinction. The contrast IS the lesson: * * - **debounce** waits for quiet — fires once AFTER a burst settles. * - **throttle** enforces a rate — fires AT MOST once per `ms` while the * burst is ongoing, dropping the calls in between. * * Layering with `../throttled-input`: `throttle` and `debounce` are * the two host-boundary PRIMITIVES — two distinct algorithms * (at-most-once-per-window vs collapse-a-burst) behind one signature shape. * `throttled-input` is NOT a third primitive: it is a TEA machine composed * OVER them (the same semantics, reimplemented as pure, durable Model state) * that re-exports both. Wrapping a raw host event → these primitives; durable, replayable * gating inside a machine → `throttled-input` (see its module doc for the full * layering map). * * WHAT THIS IS NOT — and why it lives outside `update`: * * - NOT a reducer / Transitions cell. Reducers are PURE (invariant 2 — same * inputs → same outputs, no `Date.now`, no timers). A throttle holds a live * `setTimeout` handle and a window cursor; folding it into `update` would * smuggle a timer into the pure core. * - NOT a Sub. A Sub is a continuous SOURCE of Msgs the substrate reconciles * by id every transition (invariant 4). A throttle is a SINK transformer: * it wraps a `void`-returning handler (the canonical one is * `Runtime.dispatch`) so a high-frequency HOST event is rate-limited BEFORE * it ever becomes a Msg. * * It is a higher-order function at the host boundary (pattern 14 — TEA owns * state, JS owns timing). The host attaches the wrapped function to a * high-frequency event source (`mousemove`, `scroll`, `pointermove`, a game * loop) and the substrate downstream only ever sees the rate-limited Msg: * * const onMoved = throttle( * (e: PointerEvent) => * runtime.dispatch({ _tag: "UserMovedCursor", x: e.clientX, y: e.clientY }), * 16, // ~60fps cap * ); * window.addEventListener("pointermove", onMoved); * // cleanup: onMoved.cancel(); window.removeEventListener("pointermove", onMoved); * * Internal since #47 — not published on any subpath; reached from inside the * package as `internal/timing/throttle`. Same one-shape-per-package rule as * `rate-limit`, `deadline`, and `work-queue`. * * Uses the universal `setTimeout` / `clearTimeout` timer idiom (same discipline * as `subs/from-timeout.ts`): exactly one live handle at a time, the window * timer clears itself on expiry, `cancel` / `flush` clear and null it so a * stale callback can never run. */ /** * A throttled wrapper around `fn`. Callable with the SAME argument tuple as * `fn` — `(...args: A) => void` — plus two control methods that share names and * shapes with `Debounced` so the two modules read as a symmetric pair. */ interface Throttled { /** Invoke `fn` if the window is open, else record args for the trailing fire. */ (...args: A): void; /** * Drop any pending trailing fire WITHOUT invoking `fn`, and close the active * window. Clears the timer, forgets the captured trailing args, and resets * the cursor so the next call fires immediately on the leading edge (if * `leading` is enabled). Idempotent. * * The host-cleanup partner of `removeEventListener`: cancel the pending fire * when the component unmounts / the listener detaches, so a queued * `dispatch` can't land after teardown. */ cancel(): void; /** * Fire any pending trailing call IMMEDIATELY with its latest captured args, * then close the window. No-op when nothing is pending. Use to force the last * dropped call out early — e.g. flush the final cursor position when a drag * ends, so the rest state isn't a stale mid-drag sample. */ flush(): void; } /** * Wrap `fn` so it runs AT MOST once per `ms` window, no matter how often it is * called. * * Leading + trailing (the default): the first call fires `fn` IMMEDIATELY (the * leading edge) and opens a `ms` window. Calls during the window are dropped * from immediate firing but their args are remembered; when the window closes, * `fn` fires ONCE more with the LATEST dropped args (the trailing edge) and a * new window opens. A call after the window has already closed leads a fresh * window immediately. Spacing every call at least `ms` apart therefore fires * each one on its own leading edge. * * @param fn The handler to rate-limit. Typically `(...) => runtime.dispatch(...)`, * but any `(...args: A) => void` works. The return value is * ignored — throttle is a fire transformer, not a value pipe. * @param ms Window length in milliseconds. `fn` fires at most once per `ms`. * @param opts.leading Fire on the FIRST call of a window (the leading edge), * immediately. Default `true`. * @param opts.trailing Fire once at window END with the latest args dropped * during the window. Default `true`. * * Edge combinations (matching lodash's settled semantics, the de-facto * standard the ecosystem rediscovered): * * - `{ leading: true, trailing: true }` (default): immediate fire + a * trailing fire per window while calls keep arriving. The trailing fire is * SUPPRESSED when no extra call arrived during the window (a lone call * already fired on the leading edge — no stale trailing double-fire). * - `{ leading: true, trailing: false }`: only the immediate fire; everything * in the window is dropped with no catch-up at the end. * - `{ leading: false, trailing: true }`: no immediate fire; the FIRST call * opens a window and `fn` fires at the window's end with the latest args. * Steady "sample every `ms`" behavior with no instant response. * - `{ leading: false, trailing: false }`: never fires. Degenerate but legal; * we don't throw — the caller asked for a no-op transformer. * * WHY a default of leading + trailing both `true`: a throttle's job is "respond * now, then keep responding at a steady rate." Leading gives the instant * response (the first `mousemove` updates immediately); trailing guarantees the * FINAL sample of a window isn't lost (the cursor ends where the user actually * left it, not one window-width behind). Dropping either loses one of those two * guarantees, so both default on. */ declare function throttle(fn: (...args: A) => void, ms: number, opts?: { leading?: boolean; trailing?: boolean; }): Throttled; /** * internal/timing/throttled-input — gate a high-frequency input stream into a * SETTLED, RATE-CAPPED, optionally DEDUPED sequence of emits, as a TEA knob: one * config object + a few pre-wired hooks you spread into your machine. * * Layering (the throttle-family map): `../throttle` and `../debounce` are the * two host-boundary PRIMITIVES — two distinct algorithms * (at-most-once-per-window vs collapse-a-burst) behind one signature shape. * THIS module is the third name but NOT a third primitive: a TEA machine * composed OVER them that re-exports both. Three exports, one layering — not * duplication. The reuse list below spells out composition vs reimplemented * semantic per sibling. * * What it reuses, and HOW (composition vs. reimplemented semantic — the two are * not the same, so this list keeps them apart): * * - `../cache` — COMPOSED directly. The DEDUPE / memoize layer is `../cache`'s * `TtlCache` plus its `get` / `set` / `initCache` ops, called at runtime — * not reinvented. While `cacheTtlMs` is set, an input whose `cacheKey` is * already cached and unexpired is served from the cache and emits NOTHING * (the downstream effect ran once for that key within its TTL); a fresh emit * writes the value into the cache so the next identical input within * `cacheTtlMs` is suppressed. The optional eviction Sub is the consumer's to * wire if they want memory reclaim (this knob's correctness needs only TTL * reads). * - `../deadline` — COMPOSED directly. The settle timer IS a `../deadline` * deadline: `subsFor` builds it via `deadlineSub`, and the runner + * Msg constructor are RE-EXPORTS of `../deadline`'s own (`subscribeDeadline` * → `subscribeThrottledInput`, `deadlineExceeded` → `throttledInputSettled`). * The timer lifecycle stays owned by `../deadline`; this knob redraws none * of it. * - `../throttle` / `../debounce` — TYPE + SEMANTIC reuse only, NOT composed. * Those siblings are host-boundary SINK transformers that hold a live * `setTimeout`; a `setTimeout` in a closure is exactly what a durable, * replayable knob must NOT hold. So their CODE is never called here. Instead * the RATE-cap semantic ("at most once per `ms`", leading-edge) and the * SETTLE semantic ("wait until quiet", trailing-edge) are REIMPLEMENTED as * pure Model state: `lastAt` is the durable rate cursor (half-open cutoff * `at - lastAt >= throttleMs`), and `pending` + the `../deadline` timer realize * the debounce window inside `update`. The `throttle` / `debounce` * transformers themselves are RE-EXPORTED (the only reuse of their actual * code) so a consumer can pre-throttle / pre-coalesce a genuinely bursty * HOST event at the boundary BEFORE it ever becomes an `input` Msg — a * separate, optional escape hatch, not part of this knob's gates. * * "Omit a brick, omit its gate" (the resilient-call config rule): every gate * field is optional. Omit `throttleMs` → no rate cap (every input passes the * rate gate). Omit `debounceMs` → no settle wait (an input that clears the rate * gate emits IMMEDIATELY rather than being held). Omit `cacheTtlMs` → no cache * slice at all (the `cache` field is absent; no dedupe). A config with all three * omitted is a pass-through: `input` always emits. * * Why this is a knob and not hand-wired logic: the managed state (`lastAt`, * `pending`, `cache`) lives in the Model, so it survives DO eviction / reload * (durable) and every transition is still a Msg through `update` (replayable). A * closure holding a `setTimeout` and a mutable "last value" would break both — * banned. `input` / `onFlush` are PURE: time arrives as an `at` parameter, never * `Date.now()`; they return NEW slice values, never mutate. * * Typical wiring (combinator form): * * const search = createThrottledInput({ * debounceMs: 200, // wait for the user to stop typing * throttleMs: 1_000, // but never fire more than 1/s during a long burst * cacheTtlMs: 30_000, // skip a query repeated within 30s * cacheKey: (q) => q, * emit: (q) => ({ _tag: "RunSearch", query: q }), * }); * * // Model: { search: ThrottledInput, ... } * // init: (loaded) => [loaded ?? { search: search.init(), ... }, []] * // update cells: * // QueryTyped: (s, m) => mapInput(s, search.input(s.search, m.value, m.at)) * // SettleFired: (s, m) => mapInput(s, search.onFlush(s.search, m.atMs)) * // types.sub: {} as DeadlinesSub * // subs: [deadlinesSub((s: Model) => search.subs(s.search))] * // at run: run(machine, { interpret, subscribe: { deadline: subscribeThrottledInput } }) * * where `mapInput(s, [slice, cmds]) => [{ ...s, search: slice }, cmds]` lifts the * slice transition into the consumer's Model. The `RunSearch` Cmd's interpret * handler is the consumer's — it is where the settled input meets I/O. * * NOT a substrate primitive: it depends only on sibling subpaths (`../throttle`, * `../debounce`, `../cache`, `../deadline`) and the core `Cmd` type. * Internal since #47 — reached from inside the package as * `internal/timing/throttled-input`; the L1 escape hatch is those siblings * threaded by hand. Same one-shape-per-package rule as `batch-window` and `poller`. */ /** * The gate fields every throttled-input config shares, regardless of whether * dedupe is on. The two dedupe variants below extend this with mutually * exclusive cache fields. * * `emit` is a pure Cmd CONSTRUCTOR, not a closure-with-state: it maps a settled * value to the single Cmd the runtime performs when the gates let a value * through. Keeping it `(value) => Cmd` (not `(value) => void`) is what keeps the * trigger replayable — the emit is a Cmd in the transition's output, never a * side effect inside the verb (mirrors `batch-window`'s `flush`). */ interface ThrottledInputGates { /** * Rate cap, in milliseconds. An input that lands within `throttleMs` of the * last EMIT (`at - lastAt < throttleMs`) is dropped from immediate firing — * the leading-edge "at most once per `throttleMs`" rate-cap rule, applied to * emits. The half-open cutoff (`>=` passes) matches `../throttle` and * `../cache`'s window-edge convention. Omit for no rate cap. * * Interacts with `debounceMs`: when both are set, a rate-blocked input is * still HELD as `pending` (so the settle timer eventually trails it out at a * legal moment) rather than silently dropped — the trailing-edge guarantee * that the FINAL sample of a window is never lost. */ readonly throttleMs?: number; /** * Settle wait, in milliseconds. An input that clears the rate gate is not * emitted immediately; it is held as `pending` and a debounce deadline is * armed at `pendingAt + debounceMs`. A fresh input re-arms (slides) the * window. `onFlush` emits the pending value when the window finally expires. * Omit for no settle wait — a passing input emits on arrival. */ readonly debounceMs?: number; /** * Map a settled value to the single Cmd the runtime performs. Called with the * value the gates let through; the returned Cmd is what `input` / `onFlush` * emit. PURE constructor — no I/O, no clock; the I/O happens later in the * consumer's interpret handler for the returned Cmd. */ readonly emit: (value: V) => C; } /** * Configuration for a throttled input — the knob. Pure config, no mutable state * (the `ThrottledInput` slice carries that). One config object is shared * across every input of one logical stream (often a module-scope const). * * A DISCRIMINATED UNION on the presence of dedupe, so the type system makes a * cache-key collision UNREPRESENTABLE ("omit a brick, omit its gate"): * * - **No dedupe** (`ThrottledInputNoCache`): `cacheTtlMs` absent ⇒ no cache * slice, no dedupe. `cacheKey` is statically forbidden here (`never`) — a * key with no cache to feed is dead config, so the type rejects it rather * than silently ignoring it. * - **Dedupe** (`ThrottledInputWithCache`): `cacheTtlMs` set ⇒ `cacheKey` is * REQUIRED. There is no `String(value)` default to fall back to, so a * structured value can NEVER collapse two distinct values to one slot (the * `"[object Object]"` collision). The consumer must state the identity that * keys the cache; a primitive stream still trivially passes `(v) => v` / * `String`, but it does so EXPLICITLY. */ type ThrottledInputConfig = ThrottledInputNoCache | ThrottledInputWithCache; /** * The no-dedupe config variant: gates only, no cache. `cacheTtlMs` is absent * and `cacheKey` is statically `never` so a stray key (which would feed no * cache) is a type error, not a silently-ignored field. */ interface ThrottledInputNoCache extends ThrottledInputGates { readonly cacheTtlMs?: undefined; readonly cacheKey?: never; } /** * The dedupe config variant: a per-entry TTL plus a REQUIRED `cacheKey`. An * input whose `cacheKey` is already cached and unexpired emits NOTHING (the * downstream effect ran once for that key within its TTL); a fresh emit writes * the value into the cache. * * `cacheKey` is required (no `String(value)` default) precisely so a structured * value cannot silently collide — the consumer names the identity, the cache * keys on exactly that. */ interface ThrottledInputWithCache extends ThrottledInputGates { /** * Dedupe / memoize TTL, in milliseconds. An input whose `cacheKey` is already * cached and unexpired emits NOTHING; a fresh emit writes the value into the * cache so the next identical input within `cacheTtlMs` is suppressed. */ readonly cacheTtlMs: number; /** * Key a value for the dedupe cache. REQUIRED whenever `cacheTtlMs` is set: * there is no `String(value)` fallback, so a structured value's identity is * always the consumer's explicit choice and two distinct values can never * collapse to one slot. A primitive stream passes `(v) => v` / `String`. */ readonly cacheKey: (value: V) => string; } /** * The Model slice a throttled input owns — its visible slice (the knob * principle: managed state lives in the Model, never a closure, so it is durable * and replayable). * * - `lastAt` — the `at` of the most recent EMIT, or `null` before the first * emit. The `../throttle` rate cap measures against it: an input * within `throttleMs` of `lastAt` is rate-blocked. Persisted so a * resumed gate keeps its rate cursor. * - `pending` — the value HELD for the settle (debounce) window, paired with the * `at` it was held (the anchor the deadline targets), or `null` * when nothing is waiting. The single source of truth for "is a * settle window open?" — the debounce timer Sub arms iff this is * non-null. * - `cache` — the `../cache` TTL store backing dedupe, present IFF * `cacheTtlMs` is configured. Absent (the field omitted) for a * gate with no dedupe — no per-op cost, nothing to serialize. */ interface ThrottledInput { readonly lastAt: number | null; readonly pending: PendingInput | null; readonly cache?: TtlCache; } /** * A value held for the settle window: the `value` itself and the `at` it was * held (the anchor the debounce deadline targets, `at + debounceMs`). A distinct * type (not a bare `V`) because `V` may itself be `null` — a present-but-null * value is still a real pending input, distinct from "nothing pending", exactly * the `null`-sentinel discipline `../throttle` / `../debounce` use for their * `pendingArgs`. */ interface PendingInput { readonly value: V; readonly at: number; } /** * The deadline a throttled input's settle timer lists — a `../deadline` entry * (so the window fires at the correct ABSOLUTE moment even after a late * subscribe / rehydrate, and so a consumer running several gates routes each by * `id`). `atMs` is the absolute settle-by instant (`pendingAt + debounceMs`). */ type ThrottledInputSub = DeadlineSub; /** * The starting slice: no prior emit, nothing pending. The `cache` field is * seeded only when `cacheTtlMs` is configured (see `createThrottledInput`); the * free `initThrottledInput` leaves it absent (the no-dedupe shape). */ declare function initThrottledInput(): ThrottledInput; /** * Feed a new input `value` arriving at clock `at` through the gates. PURE. * * The gate order is DEDUPE → RATE → SETTLE (each skipped when its config field * is omitted), the same cache-first-then-gate order `resilient-call` uses (a hit * short-circuits before the expensive path): * * 1. **Dedupe** (`cacheTtlMs` set): if `value`'s key is cached and unexpired, * suppress — return the slice UNCHANGED (no emit, no pending, no re-arm). * The downstream effect already ran for this key within its TTL. * 2. **Rate** (`throttleMs` set): if `at` is within `throttleMs` of the last * emit (`at - lastAt < throttleMs`), this input is rate-blocked. * - With `debounceMs` set → HOLD it as `pending` (the trailing edge: the * settle timer will emit it at a legal moment, so the final sample is * never lost). The deadline `subs` arms targets `at + debounceMs`. * - Without `debounceMs` → DROP it (pure rate cap, no catch-up). * 3. **Settle** (`debounceMs` set): the input cleared the rate gate. HOLD it * as `pending` and let the debounce window slide; `onFlush` emits it once * the window expires. A fresh input before expiry overwrites `pending` (the * trailing edge fires with the LAST value, the `../debounce` default). * 4. **Pass-through**: no `debounceMs`, cleared the rate gate → EMIT now. * * @param config the knob (the three optional gates + `emit`) * @param state the current slice * @param value the input value * @param at the arrival instant (epoch ms) — the caller stamps it; the verb * never reads the clock */ declare function input(config: ThrottledInputConfig, state: ThrottledInput, value: V, at: number): readonly [ThrottledInput, readonly C[]]; /** * Emit the pending value because the settle (debounce) window closed. PURE. * * - Pending present, rate gate CLEAR → emit `config.emit(pending.value)`, * advance the rate cursor (`lastAt = at`), refresh the dedupe cache, and clear * `pending`. The trailing edge of `../debounce` realized as a Model transition. * - Pending present, rate gate STILL BLOCKED → re-HOLD: return the slice with * `pending` intact and NO Cmds. A settle Msg can fire at `pending.at + * debounceMs`, which may still be inside the rate window (`lastAt + * throttleMs`) — emitting then would breach the headline "at most once per * `throttleMs`" cap. Re-holding keeps the value waiting; `subs` re-arms the * deadline at `max(pending.at + debounceMs, lastAt + throttleMs)` so the next * timer fires at a LEGAL moment and the trailing edge is deferred, never lost. * - Pending absent → no-op: return the same slice and no Cmds. Guards the race * where an `input` already emitted (or a dedupe hit cleared interest) before * the settle timer's Msg lands — a stale `onFlush` must NOT emit. Symmetric * with `batch-window`'s closed-window guard. * * `at` is the firing instant the settle Msg carried (the caller stamps it; the * verb never reads the clock). It becomes the new rate cursor and the cache * write's `nowMs`, so a settled emit rate-blocks subsequent inputs from its * actual fire moment, not the moment the value was first held. * * @param config the knob (`throttleMs`, `emit`, cache config) * @param state the current slice * @param at the settle-timer firing instant (epoch ms) */ declare function onFlush(config: ThrottledInputConfig, state: ThrottledInput, at: number): readonly [ThrottledInput, readonly C[]]; /** * The settle timer deadline, derived from the slice. PURE. * * Returns the single `../deadline` entry while a value is held AND a settle window * is configured, or `[]` otherwise. The deadline target is the LATER of two * constraints (so the timer never fires before BOTH are satisfied): * * - `pending.at + debounceMs` — the settle (debounce) deadline: the value has * stopped sliding, the burst has gone quiet. * - `lastAt + throttleMs` — the rate cap: emitting earlier would breach "at * most once per `throttleMs`". Only applies once a prior emit exists * (`lastAt !== null`) and a rate cap is configured (`throttleMs` set). * * `max(settleAt, rateAt)` is the earliest LEGAL trailing-edge moment. Anchoring * the timer here — rather than the naive `pending.at + debounceMs` — is what * keeps the rate cap intact across the trailing edge: a value held while still * inside the rate window arms its timer at `lastAt + throttleMs`, so `onFlush` * fires at a moment the rate gate already permits. (`onFlush` re-checks the gate * anyway and re-holds if an early/stale timer slips through, so the cap holds * even if a timer fires ahead of this target.) * * Fed through `deadlinesSub`, the engine arms the timer when the list gains the * deadline and disarms it (clearing the pending `setTimeout`) when the list * loses it — so an * `onFlush` (or a dedupe hit) that clears `pending` auto-cancels the now-stale * settle timer on the next transition, and a sliding input that re-stamps * `pending.at` re-arms a fresh absolute target. * * `debounceMs` undefined ⇒ no settle window ⇒ `[]` even with a `pending` value * (an unconfigured settle never holds, but the guard keeps `subs` total). * * @param config the knob (`debounceMs`, `throttleMs`) * @param state the current slice * @param id stable identity for this gate's settle timer (default * `"throttled-input:settle"`); pass a distinct id per gate when a * machine runs several so the dispatched Msg routes distinctly. */ declare function subsFor(config: ThrottledInputConfig, state: ThrottledInput, id?: string): readonly ThrottledInputSub[]; /** * The bound knob returned by `createThrottledInput`. `init` + the two pure verbs * + `subs`, all closing over one `ThrottledInputConfig`. The verbs return * `readonly [ThrottledInput, readonly C[]]`: the next slice and the Cmds to * emit (one `emit` Cmd when a value passes, none while held / dropped / deduped). * * Pure-ops + subs module: there is no `handlers(ports)` cell. The settle timer's * runner IS `../deadline`'s `subscribeDeadline` (re-exported below) — the * consumer passes it to `run` as `subscribe.deadline`; the knob redraws no timer * lifecycle of its own. (Compare `poller`, identical: it too reuses * `../deadline`'s runner and ships no `handlers`.) */ interface ThrottledInputKnob { /** Seed the Model slice (with a cache iff `cacheTtlMs` is configured). */ init(): ThrottledInput; /** * Feed a new input through the dedupe → rate → settle gates. See `input`. */ input(state: ThrottledInput, value: V, at: number): readonly [ThrottledInput, readonly C[]]; /** * Emit the held value because the settle window closed. See `onFlush`. */ onFlush(state: ThrottledInput, at: number): readonly [ThrottledInput, readonly C[]]; /** * The settle timer deadline, listed only while a value is held. See * `subsFor`. `id` keys the deadline so several gates on one machine route * distinctly. */ subs(state: ThrottledInput, id?: string): readonly ThrottledInputSub[]; } /** * Build a throttled-input knob from `config`. Combinator form (the default L2 * ergonomic): hand it the config, splice the returned hooks into your machine. * The pure verbs (`input` / `onFlush`) close over the config so the consumer's * reducer cells stay a uniform `(state, ...args)` shape; `subs` pre-wires the * settle timer. * * `init()` seeds a `cache` slice IFF `cacheTtlMs` is configured — an unconfigured * gate carries no cache field (nothing to serialize, no dedupe). Pure factory — * no clock read, no timer; everything happens when the consumer calls the * returned verbs / `subs` with an injected `at`. * * @typeParam V the input value type * @typeParam C the Cmd type `config.emit` returns */ declare function createThrottledInput(config: ThrottledInputConfig): ThrottledInputKnob; export { type PendingInput, type Throttled, type ThrottledInput, type ThrottledInputConfig, type ThrottledInputKnob, type ThrottledInputNoCache, type ThrottledInputSub, type ThrottledInputWithCache, createThrottledInput, initThrottledInput, input, onFlush, subsFor, throttle };