import { PMNode, AdapterOptions } from '../types.js';
import { SectionRange, SectPrElement } from './types.js';
/**
 * Determines if a section break should be ignored during section range analysis.
 *
 * A section break is ignored if:
 * 1. The paragraph contains content (not just a section marker)
 * 2. The paragraph has no sectPr element
 * 3. The sectPr has no type AND it's not the final section (body has sectPr)
 *
 * @param paragraph - The paragraph node to check
 * @param index - Index in the paragraphs array
 * @param total - Total number of paragraphs with sectPr
 * @param hasBodySectPr - Whether the document body has a sectPr
 * @returns true if the section break should be ignored
 */
export declare function shouldIgnoreSectionBreak(paragraph: PMNode, index: number, total: number, hasBodySectPr: boolean): boolean;
/**
 * Find all paragraphs in the document that contain sectPr elements.
 *
 * Records two indices per match:
 *   - `paragraphIndex` counts only paragraph nodes (including those nested
 *     inside SDT wrappers), matching the long-standing contract callers use
 *     for SDT-internal section transitions.
 *   - `nodeIndex` counts every top-level `doc.content` child (paragraph,
 *     table, top-level drawing, SDT, …). This is required to fix SD-2646:
 *     a non-paragraph node between two sectPr markers belongs to the LATER
 *     marker's section per ECMA-376 §17.6.17, so the dispatch loop must
 *     know each section's bounds in top-level-node terms.
 *
 * @param doc - ProseMirror document node
 * @returns Paragraph matches plus both totals
 */
export declare function findParagraphsWithSectPr(doc: PMNode): {
    paragraphs: Array<{
        index: number;
        nodeIndex: number;
        node: PMNode;
    }>;
    totalCount: number;
    totalNodeCount: number;
};
/**
 * Build section ranges from paragraphs with sectPr using Word's "end-tagged" semantics.
 *
 * Creates a margins object when ANY margin property is defined (header, footer, top, right, bottom, or left).
 * This handles documents that specify page margins without header/footer margins.
 *
 * When margins object is created:
 * - header/footer default to DEFAULT_HEADER_FOOTER_MARGIN_PX (0) when not specified
 * - page margins (top/right/bottom/left) remain undefined when not specified
 *
 * When margins object is null:
 * - No margin properties were specified in the sectPr
 *
 * @param paragraphs - Array of paragraphs containing sectPr elements
 * @param hasBodySectPr - Whether the document has a body-level sectPr
 * @returns Array of section ranges
 */
export declare function buildSectionRangesFromParagraphs(paragraphs: Array<{
    index: number;
    nodeIndex: number;
    node: PMNode;
}>, hasBodySectPr: boolean): SectionRange[];
/**
 * Publish section metadata to the adapter options for external consumers.
 *
 * @param sectionRanges - Section ranges to publish
 * @param options - Adapter options containing sectionMetadata array
 */
export declare function publishSectionMetadata(sectionRanges: SectionRange[], options?: AdapterOptions): void;
/**
 * Create final section range using body sectPr.
 *
 * Respects the section type from the body sectPr (nextPage, continuous, etc.)
 * rather than forcing it to continuous. This allows the final section to
 * trigger page breaks when needed (e.g., for orientation or page size changes).
 *
 * @param bodySectPr - Body-level sectPr element
 * @param currentStart - Starting paragraph index for this section
 * @param totalParagraphs - Total number of paragraphs in document
 * @param sectionIndex - Index for this section
 * @returns Section range or null if no data could be extracted
 */
export declare function createFinalSectionFromBodySectPr(bodySectPr: SectPrElement, currentStart: number, totalParagraphs: number, sectionIndex: number, nodeBounds?: {
    startNodeIndex: number;
    totalNodeCount: number;
}): SectionRange | null;
/**
 * Create default final section for backward compatibility.
 * Used when no body sectPr is provided.
 *
 * @param currentStart - Starting paragraph index for this section
 * @param totalParagraphs - Total number of paragraphs in document
 * @param sectionIndex - Index for this section
 * @returns Default section range
 */
export declare function createDefaultFinalSection(currentStart: number, totalParagraphs: number, sectionIndex: number, nodeBounds?: {
    startNodeIndex: number;
    totalNodeCount: number;
}): SectionRange;
/**
 * Analyze section ranges in the document using Word's "end-tagged" semantics.
 * A paragraph's sectPr defines properties for the section ENDING at that paragraph.
 * The final section uses the body-level sectPr (if provided).
 *
 * @param doc - ProseMirror document node
 * @param bodySectPr - Optional body-level sectPr from converter (defines final section)
 * @returns Array of section ranges with backward-looking semantics
 */
export declare function analyzeSectionRanges(doc: PMNode, bodySectPr?: unknown): SectionRange[];
//# sourceMappingURL=analysis.d.ts.map