//#region src/util/use-slow-loading.d.ts
/**
* How long something must be loading before an indicator appears. Loads that finish inside this
* window never render one at all.
*/
declare const LOADING_DELAY_MS = 300;
/**
* Once an indicator is on screen, how long it stays there even if the wait has already ended.
* Applies only to waits that already crossed {@link LOADING_DELAY_MS} — its whole job is to stop a
* just-shown indicator vanishing a frame later.
*/
declare const LOADING_MIN_DURATION_MS = 300;
interface SlowLoadingOptions {
/** Don't surface before the wait has lasted this long. Defaults to {@link LOADING_DELAY_MS}. */
after?: number;
/**
* Once surfaced, stay up at least this long. Defaults to {@link LOADING_MIN_DURATION_MS}.
*/
minDuration?: number;
}
/**
* Whether a wait has gone on long enough to be worth telling the user about.
*
* Loading UI flashes on fast responses: a request that resolves in 60 ms produces a 60 ms skeleton —
* long enough to see, too short to read, and it happens on every navigation. This is the standard
* two-part fix, in one place:
*
* - **A threshold.** A wait shorter than `after` never surfaces at all.
* - **A floor.** Once it has surfaced, it stays for `minDuration`.
*
* Both halves are needed. A threshold alone turns a 320 ms wait into a 20 ms flash, which is worse
* than either extreme.
*
* **This returns a third state, and a caller that renders two will be wrong.** The point of the
* threshold is that there is a window where the wait is real but not yet worth mentioning — so
* "not slow" does not mean "ready", and the data may still be missing:
*
* ```tsx
* const slow = useSlowLoading(!list.loaded);
*
* if (slow) return