declare const URL_STATE_MODES: readonly ["relationship", "campaign", "petition"]; type UrlStateMode = (typeof URL_STATE_MODES)[number]; /** The five base parameters, in the order the spec fixes. */ declare const URL_STATE_KEYS: readonly ["mode", "page", "tab", "section", "org_id"]; type UrlStateKey = (typeof URL_STATE_KEYS)[number]; type UrlState = { mode: UrlStateMode | null; page: string | null; tab: string | null; section: string | null; /** The short org id (last 7 characters, lowercase) as it appears in the URL. */ org_id: string | null; /** Every other parameter (pagination, filters, record ids), in their own order. */ feature: URLSearchParams; }; /** Lowercase kebab-case of a label, the spec's default slug ("Tech Check" → tech-check, "This week's stats" → this-weeks-stats). */ declare function slugify(label: string): string; declare function isUrlStateMode(v: unknown): v is UrlStateMode; /** Reads the five parameters out of a search string, URL or URLSearchParams; the rest stays in `feature`. */ declare function readUrlState(input: string | URLSearchParams | null | undefined): UrlState; /** Serializes a state back to a search string: the five parameters first, in order, then the feature parameters. */ declare function buildSearch(state: UrlState): string; type UrlStatePatch = Partial> & { /** A full org uuid or a short id; written as the 7-character tail. */ org_id?: string | null; /** Feature parameters to set (null removes one). */ feature?: Record; }; /** Applies a change to the state carried in `current` and returns the new search string. */ declare function writeUrlState(current: string | URLSearchParams | null | undefined, patch: UrlStatePatch): string; type UrlStateDefaults = { /** The page's registry slug; always present (UI-Platform: "Decides the active left-bar row"). */ page: string; mode?: UrlStateMode | null; /** The page's tabs in order; the first is the default. Omit for a page with no tab strip. */ tabs?: readonly string[]; /** Each tab's (or the untabbed page's, under the key "") sections in order; the first is the default. */ sections?: Readonly>; /** Full org uuid or short id of the current organization. */ org_id?: string | null; }; type Normalized = { state: UrlState; search: string; changed: boolean; }; /** * Fills a missing parameter from the defaults and corrects an unknown `tab` or * `section` to the default ("filled or corrected by the shell with a replace, * never an error page"). `changed` says whether the URL needs rewriting. */ declare function normalizeUrlState(current: string | URLSearchParams | null | undefined, defaults: UrlStateDefaults): Normalized; /** * Which history action a change needs: `mode`, `org_id`, `page` and `tab` * changes add an entry (Back and Forward work); a `section`-only change, or a * normalization, replaces the current one. */ declare function historyMode(prev: UrlState, next: UrlState): 'push' | 'replace'; export { type Normalized, URL_STATE_KEYS, URL_STATE_MODES, type UrlState, type UrlStateDefaults, type UrlStateKey, type UrlStateMode, type UrlStatePatch, buildSearch, historyMode, isUrlStateMode, normalizeUrlState, readUrlState, slugify, writeUrlState };