import type { PageViewport } from 'pdfjs-dist';
import type { RectBox } from './types';
export declare function calculateBoundingBox(boxes: RectBox[]): [number, number, number, number];
export declare function createSVGPathFromQuadPoints(quadPoints: number[], viewport: PageViewport): string;
declare class HighlightOutline {
    #private;
    constructor(outlines: any[], box: Float32Array, lastPoint: any[]);
    get outlines(): any[];
    toSVGPath(): string;
    /**
     * Serialize the outlines into the PDF page coordinate system.
     * @param {Array<number>} _bbox - the bounding box of the annotation.
     * @param {number} _rotation - the rotation of the annotation.
     * @returns {Array<Array<number>>}
     */
    serialize([blX, blY, trX, trY]: [number, number, number, number], _rotation: number): any[][];
    get box(): Float32Array;
}
export declare function getHighlightOutlineCreator(boxes: RectBox[], options?: {
    borderWidth: number;
    innerMargin: number;
    isLTR: boolean;
}): {
    box: Float32Array;
    getOutlines: () => HighlightOutline;
};
export declare function quadPointsToBoxes(quadPoints: number[], rect: number[], pageWidth: number, pageHeight: number, pageX?: number, pageY?: number): {
    x: number;
    y: number;
    width: number;
    height: number;
}[];
export declare function quadPointsToBoxesForRect(quadPoints: number[], rect: number[]): {
    x: number;
    y: number;
    width: number;
    height: number;
}[];
/**
 * Reconstruct PDF-coordinate highlight `outlines` from `quadPoints` + `rect`.
 *
 * PDF.js's print/appearance generator (HighlightAnnotation.createNewAppearanceStream)
 * iterates the `outlines` field; a highlight without it throws "n is not iterable",
 * blanking the whole print preview. Highlights imported from XFDF carry only
 * `quadPoints`, so this rebuilds the missing `outlines` using the same outline
 * machinery as tool-created highlights — but normalized against the rect, so no live
 * viewport/DOM is required (safe to call from the print path).
 *
 * @returns serialized outlines (array of point arrays in PDF coords), or null if input is unusable.
 */
export declare function buildHighlightOutlines(quadPoints: ArrayLike<number> | null | undefined, rect: ArrayLike<number> | null | undefined): number[][] | null;
/**
 * Get selection boxes from text layer with proper rotation handling.
 * Adapted from PDF.js display/editor/tools.js
 * @param {HTMLElement} textLayer - The text layer element
 * @returns {Array<{x: number, y: number, width: number, height: number}>|null} Normalized boxes or null
 */
export declare function getSelectionBoxes(textLayer: HTMLElement): {
    x: number;
    y: number;
    width: number;
    height: number;
}[] | null;
/**
 * Convert selection boxes to PDF quadPoints
 * @param {Array<{x: number, y: number, width: number, height: number}>} boxes - Normalized boxes (0-1 range)
 * @param {PageViewport} viewport - PDF page viewport
 * @returns {number[]} Array of quadPoints in PDF coordinate system
 */
/**
 * Convert selection boxes to PDF quadPoints coordinates
 *
 * In PDF, quadPoints are used to define the coordinates of a quadrilateral.
 * Each quadrilateral requires 8 numbers representing 4 points (x,y pairs).
 * The points MUST be specified in the following order (x,y pairs):
 * - (x1,y1): left x, bottom y  - bottom left
 * - (x2,y2): right x, bottom y - bottom right
 * - (x3,y3): left x, top y    - top left
 * - (x4,y4): right x, top y   - top right
 *
 * This order is based on PDF.js implementation and real-world PDF files,
 * which differs slightly from the PDF specification (which suggests a different order).
 *
 * @param boxes Array of normalized boxes (coordinates in 0-1 range)
 * @param viewport PDF page viewport for coordinate conversion
 * @returns Array of quadPoints in PDF coordinate system
 * @throws Error if boxes array is empty
 */
export declare function boxesToQuadPoints(boxes: Array<{
    x: number;
    y: number;
    width: number;
    height: number;
}>, pageViewport: PageViewport): number[];
/**
 * Convert PDF quadPoints back to viewport boxes
 * @param {number[]} quadPoints - Array of quadPoints in PDF coordinate system
 * @param {PageViewport} viewport - PDF page viewport
 * @returns {Array<{x: number, y: number, width: number, height: number}>} Array of normalized boxes (0-1 range)
 */
export declare function quadPointsToBoxesForAnnotation(quadPoints: Float32Array, viewport: PageViewport): Array<{
    x: number;
    y: number;
    width: number;
    height: number;
}>;
/**
 * Calculate the bounding rectangle from quadPoints
 * @param {number[]} quadPoints - Array of quadPoints coordinates
 * @returns {number[]} Bounding rectangle [x1, y1, x2, y2] in PDF coordinates
 */
export declare function quadPointsToRect(quadPoints: number[]): number[];
export {};
