import type { Mark as ProseMirrorMark, Node as ProseMirrorNode, Schema } from '@tiptap/pm/model'; import type { WorkDocumentChangeIdentity, WorkDocumentChangeKind } from './work-document-changes'; import type { WorkDocumentMoveRole } from './work-types'; export interface InlineUnit { text: string; marks: readonly ProseMirrorMark[]; leadingWhitespaceAttached?: boolean; } export type InlineDiffStep = { kind: 'equal'; left: InlineUnit[]; right: InlineUnit[]; } | { kind: 'delete'; left: InlineUnit[]; right: []; } | { kind: 'insert'; left: []; right: InlineUnit[]; }; export interface InlineMoveCandidate { /** Stable comparison scope (for example, the containing paragraph). */ scope?: string; stepIndex: number; kind: 'delete' | 'insert'; units: InlineUnit[]; start: number; end: number; startOffset: number; endOffset: number; text: string; } export interface InlineMovePair { deletion: InlineMoveCandidate; insertion: InlineMoveCandidate; } export interface InlineMoveComparison { scope: string; changes: readonly InlineDiffStep[]; } export interface InlineMoveRangeCompanion { /** Decimal bookmark id shared by both move*Range* sides. */ rangeId: string; /** Word-style range name shared by both move*Range* sides. */ rangeName: string; } export interface InlineMoveAssignment { role: WorkDocumentMoveRole; candidate: InlineMoveCandidate; identity: WorkDocumentChangeIdentity; /** Companion range bookmark when Compare generates same-document markers. */ range?: InlineMoveRangeCompanion; } export interface ComparisonMoveIdentityFactory { create(kind: WorkDocumentChangeKind): WorkDocumentChangeIdentity; } type MarksEqual = (left: readonly ProseMirrorMark[], right: readonly ProseMirrorMark[]) => boolean; type StripReviewMarks = (marks: readonly ProseMirrorMark[]) => ProseMirrorMark[]; type AppendRevisionUnits = (target: ProseMirrorNode[], units: readonly InlineUnit[], kind: 'insertion' | 'deletion', identity: WorkDocumentChangeIdentity, schema: Schema, stripReviewMarks: StripReviewMarks) => void; export declare const MAX_INFERRED_MOVE_TEXT = 65536; export declare function appendRevisionUnits(target: ProseMirrorNode[], units: readonly InlineUnit[], kind: 'insertion' | 'deletion', identity: WorkDocumentChangeIdentity, schema: Schema, stripReviewMarks: StripReviewMarks): void; /** * Pairs deterministic same-text ranges. A comparison may contain several * simple blocks, which lets Compare represent a bounded move between * paragraphs while still rejecting duplicate or mark-mismatched candidates. */ export declare function inferInlineMovePairs(changes: readonly InlineDiffStep[], marksEqual: MarksEqual): InlineMovePair[]; /** * Infers moves across a bounded set of simple-block diffs. Candidate scopes * are retained on each side so callers can put the resulting marks back into * the right paragraph without flattening the document tree. */ export declare function inferInlineMovePairsAcrossScopes(comparisons: readonly InlineMoveComparison[], marksEqual: MarksEqual): InlineMovePair[]; /** * Splits an ordinary diff step around paired move ranges while retaining the * exact whitespace and mark boundaries needed to reconstruct either version. */ export declare function appendComparisonRevisionUnits(target: ProseMirrorNode[], units: InlineUnit[], kind: 'insertion' | 'deletion', schema: Schema, factory: ComparisonMoveIdentityFactory, stripReviewMarks: StripReviewMarks, appendRevisionUnits: AppendRevisionUnits, moves?: readonly InlineMoveAssignment[]): void; export {};