/**
 * Yjs-native anchor serialization for span-anchored comments.
 *
 * Anchors are pairs of `Y.RelativePosition` objects pointing at the start
 * and end of the comment’s target span. RelativePosition is symbolic
 * (“between these two Yjs items”) rather than offset-based, so it survives
 * concurrent edits automatically — that’s the whole reason we built on Yjs
 * for the editor. Comments survive other users typing in front of the
 * highlighted span, surrounding deletes, or remote rewrites, with no
 * server-side migration logic.
 *
 * Wire format:
 *   2 bytes (big-endian)  — length of start blob
 *   start blob            — Y.encodeRelativePosition output
 *   end blob              — Y.encodeRelativePosition output
 *   ↓ base64-encoded for SQLite blob storage / JSON transport
 *
 * Resolution falls back to fuzzy-quote matching when the primary anchor
 * resolves to null AND the original highlighted text still exists exactly
 * once in the document — Google Docs / Hypothesis pattern. If both fail,
 * the comment renders as orphaned with the preserved quote as context.
 */
import * as Y from 'yjs';
export interface SerializedAnchor {
    /** Base64-encoded blob for the API. */
    relpos: string;
    /** Original highlighted text, ≤256 chars. Falls back to “” for empty selections. */
    quote: string;
}
export interface ResolvedAnchor {
    /** Inclusive absolute offset within the live Y.Text. */
    from: number;
    /** Exclusive absolute offset within the live Y.Text. */
    to: number;
    /** True iff the Yjs RelativePosition could not resolve AND quote-fallback also failed. */
    orphaned: boolean;
    /** True iff the primary RelativePosition failed but the quote was found exactly once. */
    recovered: boolean;
}
export declare function serializeAnchor(ytext: Y.Text, from: number, to: number): SerializedAnchor;
export declare function resolveAnchor(ydoc: Y.Doc, ytext: Y.Text, relposBase64: string, quote: string): ResolvedAnchor;
