import { SugarElement } from '@ephox/sugar';
import * as Boxes from '../../alien/Boxes';
import { Bubble } from '../layout/Bubble';
import { AnchorBox, AnchorElement, AnchorLayout } from '../layout/LayoutTypes';
import { RepositionDecision } from './Reposition';
export interface BounderAttemptAdt {
    fold: <T>(fit: (reposition: RepositionDecision) => T, nofit: (reposition: RepositionDecision, visibleW: number, visibleH: number, isVisible: boolean) => T) => T;
    match: <T>(branches: {
        fit: (reposition: RepositionDecision) => T;
        nofit: (reposition: RepositionDecision, visibleW: number, visibleH: number, isVisible: boolean) => T;
    }) => T;
    log: (label: string) => void;
}
interface PositionResult {
    readonly originInBounds: boolean;
    readonly sizeInBounds: boolean;
    readonly visibleW: number;
    readonly visibleH: number;
}
/**
 * This will attempt to determine if the box will fit within the specified bounds or if it needs to be repositioned.
 * It will return the following details:
 *  - if the original rect was in bounds (originInBounds & sizeInBounds). This is used to determine if we fitted
 *    without having to make adjustments.
 *  - the height and width that would be visible in the original location. (ie the overlap between the rect and
 *    the bounds or the distance between the boxes if there is no overlap)
 */
declare const determinePosition: (box: Boxes.Bounds, bounds: Boxes.Bounds) => PositionResult;
/**
 * This will attempt to calculate and adjust the position of the box so that is stays within the specified bounds.
 * The end result will be a new restricted box of where it can safely be placed within the bounds.
 */
declare const calcReposition: (box: Boxes.Bounds, bounds: Boxes.Bounds) => Boxes.Bounds;
/**
 * Attempts to fit a box (generally a menu).
 *
 * candidates: an array of layout generators, generally obtained via api.Layout or api.LinkedLayout
 * anchorBox: the box on screen that triggered the menu, we must touch one of the edges as defined by the candidate layouts
 * elementBox: the popup (only width and height matter)
 * bubbles: the bubbles for the popup (see api.Bubble)
 * bounds: the screen
 */
declare const attempts: (element: SugarElement<HTMLElement>, candidates: AnchorLayout[], anchorBox: AnchorBox, elementBox: AnchorElement, bubbles: Bubble, bounds: Boxes.Bounds) => RepositionDecision;
export { attempts, determinePosition, calcReposition };
//# sourceMappingURL=Bounder.d.ts.map