import type { BeanCollection } from '../context/context';
import type { AgColumn } from '../entities/agColumn';
import { AgProvidedColumnGroup } from '../entities/agProvidedColumnGroup';
import type { ColDef, ColGroupDef } from '../entities/colDef';
import type { ColumnEventType } from '../events';
import type { ColWrapperCache } from './columnGroups/colWrapperCache';
/** Opaque edit session over a build's leaves; splicing is enterprise-only (hierarchy/calc cols).
 *  Community only calls {@link commit} from `finalizeColumnTree`. @internal AG_GRID_INTERNAL */
export interface ColumnTreeEdit {
    commit(build: ColumnTreeBuild): void;
}
/** Result of {@link _buildColumnTree}; the mutable tree spliced across one rebuild, emitted by
 *  `finalizeColumnTree`. At depth 0 `columnTree` === `columns`. @internal AG_GRID_INTERNAL */
export interface ColumnTreeBuild {
    columnTree: (AgColumn | AgProvidedColumnGroup)[];
    treeDepth: number;
    columns: AgColumn[];
    /** Every group built/reused (padding + non-padding); fed back as the next build's sweep input. */
    allGroups: AgProvidedColumnGroup[];
    marryChildren: boolean;
    /** Non-padding groups by `groupId`; fed back as next call's `existingGroupsById`. */
    groupsById: Map<string, AgProvidedColumnGroup>;
    /** Cols keyed by `colId` / `userProvidedColDef` ref / `field`; for O(1) reuse. */
    colsByKey: Map<string | ColDef, AgColumn>;
    source: ColumnEventType;
    /** True = user (re)set the definitions, so reused cols re-apply stateful attrs; see {@link AgColumn.reapplyColDef}. */
    newColDefs: boolean;
    buildToken: number;
    /** Padding-wrapper cache for the editable (hierarchy/calc) path; `null` for pivot result trees
     *  (a one-shot build that never splices). */
    wrapperCache: ColWrapperCache | null;
    /** Open edit session; null until the first splice. */
    edit?: ColumnTreeEdit | null;
}
/** Build a balanced column tree from `defs`, reusing cols/groups by colId / field / userColDef ref /
 *  groupId. Id allocation is deterministic (master/slave grids produce identical ids). Static calc-col
 *  overrides ({@link ICalculatedColumnsService.overrideFor}) drop/replace a leaf mid-build, never its group.
 *  @internal AG_GRID_INTERNAL - Not for public use. Can change / be removed at any time. */
export declare function _buildColumnTree(beans: BeanCollection, defs: (ColDef | ColGroupDef)[] | null | undefined, primaryColumns: boolean, existingGroupsById: Map<string, AgProvidedColumnGroup>, existingColsByKey: Map<string | ColDef, AgColumn>, existingColsById: {
    readonly [id: string]: AgColumn;
}, source: ColumnEventType, newColDefs: boolean, buildToken: number, wrapperCache: ColWrapperCache | null): ColumnTreeBuild;
export declare const finalizeColumnTree: (build: ColumnTreeBuild) => void;
