import { Fragment } from '@atlaskit/editor-prosemirror/model';
/**
 * Walk two Fragments (old and new) and return a Fragment that reuses old node
 * references wherever structurally equal (`node.eq()` returns true).
 *
 * This preserves referential identity (`===`) for unchanged subtrees, which is
 * critical for ProseMirror's view reconciliation performance. The `preMatch`
 * optimisation in `prosemirror-view/src/viewdesc.ts` uses `===` to fast-match
 * nodes against existing view descriptors. When all nodes are fresh objects
 * (e.g. after `Node.fromJSON` in `replaceDocument`), `preMatch` fails for
 * everything, and the fallback scan in `syncToMarks` is limited to 3
 * positions — causing mark wrappers to be destroyed and recreated when widget
 * decorations (gap cursor, telepointers, block controls) shift indices beyond
 * that window. The destroyed mark wrappers take their React nodeviews with
 * them, causing visible flicker.
 *
 * By preserving identity here, we ensure `preMatch` succeeds for unchanged
 * subtrees, preventing unnecessary mark wrapper destruction and React nodeview
 * re-mounting.
 *
 * @param oldFragment - Fragment from the current editor state (holds existing node references)
 * @param newFragment - Fragment parsed from incoming document (fresh node objects)
 * @returns A Fragment that reuses old node references where possible
 *
 * @see https://hello.jira.atlassian.cloud/browse/EDITOR-5277
 * @see https://hello.jira.atlassian.cloud/browse/EDITOR-4424
 */
export declare function preserveNodeIdentity(oldFragment: Fragment, newFragment: Fragment): Fragment;
