/**
 * Support code for the edit tool. Four concerns live here: sniffing whether a
 * file uses LF or CRLF endings, stripping a leading byte-order mark, matching a
 * target span tolerantly (exact first, then a normalized fallback), and emitting
 * a line-oriented diff. The diff is computed with an LCS routine written in this
 * file, so the module pulls in no third-party diffing dependency.
 */
export declare function detectLineEnding(content: string): "\r\n" | "\n";
export declare function normalizeToLF(text: string): string;
export declare function restoreLineEndings(text: string, ending: "\r\n" | "\n"): string;
/**
 * Reduce text to a single canonical shape so inputs that differ only cosmetically
 * compare as identical. Transformations run one after another: drop trailing
 * blanks on every line, fold curly quotes to ASCII quotes, fold the dash family to
 * "-", and fold any non-ASCII blank to an ordinary space.
 */
export declare function normalizeForFuzzyMatch(text: string): string;
export interface FuzzyMatchResult {
    /** Whether the lookup turned up the requested text at all. */
    found: boolean;
    /** Position at which the match starts, relative to contentForReplacement. */
    index: number;
    /** Length, in characters, of the matched region. */
    matchLength: number;
    /** Set when the hit only landed after normalization rather than as a literal match. */
    usedFuzzyMatch: boolean;
    /**
     * The precise string the caller is meant to edit into. For a literal hit this
     * equals the original input; for a normalized hit it is the canonicalized
     * form, because that is what index and matchLength are measured against.
     */
    contentForReplacement: string;
}
/**
 * Find oldText within content, trying a literal match first and only resorting
 * to a normalized comparison when that misses. For a normalized hit,
 * contentForReplacement carries the canonicalized text (trailing spaces gone,
 * quotes/dashes/spaces mapped), and that is what index and matchLength index into.
 */
export declare function fuzzyFindText(content: string, oldText: string): FuzzyMatchResult;
/** Spot a leading UTF-8 byte-order mark and split it off from the rest of the text. */
export declare function stripBom(content: string): {
    bom: string;
    text: string;
};
/**
 * Build a line-by-line diff backed solely by the in-house LCS routine (no diff
 * library). Returns the formatted diff alongside the 1-based line number of the
 * earliest change in the updated text.
 */
export declare function generateDiffString(oldContent: string, newContent: string, contextLines?: number): {
    diff: string;
    firstChangedLine: number | undefined;
};
export interface EditDiffResult {
    diff: string;
    firstChangedLine: number | undefined;
}
export interface EditDiffError {
    error: string;
}
/**
 * Determine what an edit would alter without writing anything to disk.
 * Backs the preview the UI renders before the edit tool actually runs.
 */
export declare function computeEditDiff(path: string, oldText: string, newText: string, cwd: string): Promise<EditDiffResult | EditDiffError>;
