import { Comment, CommentFilter, CommentSort, CommentThread, User } from '../../types/comment.types'; /** A user's display label / mention handle: nickname when set, else full name. */ export declare function displayName(user: User): string; /** Whether a mention entry is a group (e.g. a team): one with members. */ export declare function isMentionGroup(user: User): boolean; /** The roster without groups: only real users can be mentioned. */ export declare function mentionableUsers(users: readonly User[]): User[]; /** * Mention-menu order: groups first, then users, each keeping the host's order. * The menu shows its "Teams" / "Users" sections in this order, and keyboard * navigation walks the same flat list. */ export declare function orderMentionCandidates(users: readonly User[]): User[]; /** * The text a mention-menu pick inserts: `@handle` for a user, or for a group * one `@handle` per member (deduped by id), comma-separated. */ export declare function mentionInsertText(user: User): string; /** * The `@mention` query being typed at the end of `before` (the text up to the * caret), with the index of its `@`; `null` when the caret is not in a mention. * * A mention starts at an `@` at the start of the text or after whitespace, * followed by word characters only. Once one is open (`activeStart` is the * index of its `@`), its query may also span spaces so multi-word names * (`@Sara Lin`, `@Design Team`) can be searched; it stops at a line break or a * new `@`. The caller ends the open mention when the query matches nobody, so * text typed after a finished mention never keeps it open. */ export declare function mentionQueryAt(before: string, activeStart?: number): { start: number; query: string; } | null; /** * Group a flat comment list into threads (root + replies), then apply the * panel filter and sort. Pure — used by the panel and exercised by tests. */ export declare function buildThreads(comments: Comment[], filter?: CommentFilter, sort?: CommentSort): CommentThread[]; /** Count of open (unresolved) root comments. */ export declare function openCount(comments: Comment[]): number; /** Count of root comments matching the given filter. */ export declare function countForFilter(comments: Comment[], filter: CommentFilter): number; /** Escape a string for safe use inside a RegExp (mention handles are literals). */ export declare function escapeRegExp(s: string): string; /** * The strings that can match a user in an `@mention`, in priority order: name, * nickname, then id — so a body can reference a user by id (`@u2`) and still * resolve to them (rendered as their nickname/name). Single source of truth for * both {@link userHandles} (storage) and the thread renderer (highlighting). */ export declare function handleKeys(user: User): string[]; /** Every mention handle (name, nickname, id) a user roster advertises. */ export declare function userHandles(users: readonly User[]): string[]; /** * RegExp source matching a single `@mention` token. Known handles are tried * first, longest-first, so multi-word names (e.g. `@Sara Lin`) match whole * instead of being truncated at the first space by the generic word branch; * the trailing negative lookahead forces a full-token match so a handle that is * a prefix of a longer token still falls through to the generic branch. With no * known handles it degrades to the plain single-word token. Shared by * {@link parseMentions} (storage) and the thread renderer (highlighting) so the * two never disagree on where a mention starts and ends. */ export declare function mentionTokenSource(handles?: readonly string[]): string; /** * Parse `@mentions` from body text → deduped list of mentioned handles (without * the `@`). Pass the known user roster so multi-word handles are captured whole; * without it, handles are limited to single word-tokens (back-compat default). * Groups (entries with `members`) are ignored: they are never mentioned. */ export declare function parseMentions(body: string, users?: readonly User[]): string[]; /** * Resolve the `@mentions` in body text to the {@link User} objects they name, * using the known roster. Each parsed handle is matched against every user's * name, nickname, and id (so `@u2` resolves the user with id `u2`); tokens that * don't resolve to a known user are dropped (they aren't real users). Returns * the mentioned users, deduped by id and in first-seen order — this is what's * stored on `Comment.mentions`, so a comment carries its mentioned users even * if the roster later changes. Groups (entries with `members`) never resolve, * so a group named like a user can't capture that user's mentions. */ export declare function parseMentionedUsers(body: string, roster?: readonly User[]): User[]; //# sourceMappingURL=comment-utils.d.ts.map