import { BoundsCache, BoundingRect } from "./bounds-cache";
import { Logger } from "../core/logger";
/**
 * Result of spreading calculation.
 */
export interface SpreadingResult {
    /** Map of element ID to its horizontal shift amount */
    horizontalShifts: Map<string, number>;
    /** Map of element ID to its vertical shift amount */
    verticalShifts: Map<string, number>;
    /** Whether any spreading was needed */
    hasShifts: boolean;
}
/**
 * Metadata about spreading applied to an element for a specific version.
 */
export interface SpreadingMetadata {
    /** Version index that caused this spreading */
    versionIndex: number;
    /** Horizontal shift applied (in pixels) */
    horizontalShift: number;
    /** Vertical shift applied (in pixels) */
    verticalShift: number;
}
/**
 * Engine for calculating spreading (making room for new elements).
 * Implements the "stone in pond" ripple effect to preserve layout.
 */
export declare class SpreadingEngine {
    private _boundsCache;
    private _logger;
    /**
     * Map of element ID to array of spreading metadata (one per version).
     * Each element can be shifted multiple times by different versions.
     */
    private _spreadingHistory;
    constructor(boundsCache: BoundsCache, logger: Logger);
    /**
     * Track spreading metadata for elements affected by a version.
     * Called after spreading is applied to record what happened.
     *
     * @param versionIndex - Version index that caused the spreading
     * @param horizontalShifts - Map of element IDs to horizontal shifts
     * @param verticalShifts - Map of element IDs to vertical shifts
     */
    trackSpreading(versionIndex: number, horizontalShifts: Map<string, number>, verticalShifts: Map<string, number>): void;
    /**
     * Get spreading metadata for elements affected by a specific version.
     * Used when reversing spreading during backward navigation.
     *
     * @param versionIndex - Version index to get spreading for
     * @returns Map of element ID to spreading metadata
     */
    getSpreadingForVersion(versionIndex: number): Map<string, SpreadingMetadata>;
    /**
     * Remove spreading history for a specific version.
     * Called after spreading is reversed during backward navigation.
     *
     * @param versionIndex - Version index to remove history for
     */
    clearSpreadingForVersion(versionIndex: number): void;
    /**
     * Calculate spreading required to make room for a new element.
     *
     * @param newElementBounds - Bounds of the element to be added
     * @param excludeIds - Element IDs to exclude from shifting (e.g., the new element itself)
     * @returns Spreading result with shift amounts for each affected element
     */
    calculateSpreading(newElementBounds: BoundingRect, excludeIds?: string[]): SpreadingResult;
    /**
     * Calculate horizontal spreading.
     * Elements overlapping on the left are shifted left, those on the right are shifted right.
     */
    private calculateHorizontalSpreading;
    /**
     * Calculate vertical spreading.
     * Elements overlapping from above are shifted up, those from below are shifted down.
     */
    private calculateVerticalSpreading;
    /**
     * Calculate the horizontal overlap between two bounding rectangles.
     * Returns 0 if there is no overlap.
     */
    private calculateHorizontalOverlap;
    /**
     * Calculate the vertical overlap between two bounding rectangles.
     * Returns 0 if there is no overlap.
     */
    private calculateVerticalOverlap;
    /**
     * Check if two bounding rectangles overlap.
     */
    checkOverlap(rect1: BoundingRect, rect2: BoundingRect): boolean;
    /**
     * Find all elements that overlap with given bounds.
     */
    findOverlappingElements(bounds: BoundingRect, excludeIds?: string[]): string[];
}
