import type { AppBskyRichtextFacet } from "@atcute/bluesky"; import type { Bot } from "../bot/Bot.js"; export declare const utf16IndexToUtf8Index: (text: string, i: number) => number; export declare const utf8IndexToUtf16Index: (text: string, i: number) => number; /** * Options for the {@link detectFacetsWithoutResolution} and {@link detectFacetsWithResolution} functions. */ export interface DetectFacetsOptions { /** Whether to shorten inline links. */ shortenLinks?: boolean | undefined; } /** * This is a modified version of the {@link import("@atproto/api").RichText#detectFacets} function that doesn't use the UnicodeString class. * This allows us to avoid importing `graphemer`, instead using the `Intl.Segmenter` builtin (see {@link graphemeLength}), which saves ~800kB in bundle size (200kB gzipped). * * JS strings are encoded as UTF-16; `utf16IndexToUtf8Index` is used to get UTF-8 byte indices of facets within text. * @param text Text to detect facets in. * @param options Configuration options. */ export declare function detectFacetsWithoutResolution(text: string, options?: DetectFacetsOptions): { text: string; facets: Array; }; /** * Returns a RichText instance with all facets (mentions, links, tags, etc) resolved. * @param text The text to detect facets in. * @param bot Used to resolve mentions to DIDs. * @param options Configuration options. */ export declare function detectFacetsWithResolution(text: string, bot: Bot, options?: DetectFacetsOptions): Promise<{ text: string; facets: AppBskyRichtextFacet.Main[]; }>;