import type { Comparator } from '../../common'; export interface TreeMapOptions { comparator?: Comparator; /** * Pass-through to the underlying RedBlackTree/BST `isMapMode` option. * * - `true` (default in core): store values in an internal key→value store. * - `false`: store values on tree nodes (Node Mode). */ isMapMode?: boolean; /** * Enable order-statistic operations (select, rank, rangeByRank). * When true, subtree counts are maintained on every node. */ enableOrderStatistic?: boolean; /** * Transform raw elements into `[key, value]` entries. * When provided, the constructor accepts `Iterable` instead of `Iterable<[K, V]>`. */ toEntryFn?: (rawElement: R) => [K, V]; } export type TreeMapRangeOptions = { lowInclusive?: boolean; highInclusive?: boolean; }; /** * Callback used by TreeMap entry-wise utilities. * * `SELF` is intentionally generic to avoid type-layer circular imports. * Implementations (e.g. `TreeMap`) should bind `SELF` at use sites. */ export type TreeMapEntryCallback = (value: V | undefined, key: K, index: number, map: SELF) => R; /** * Reducer callback used by TreeMap. * * `SELF` is intentionally generic to avoid type-layer circular imports. */ export type TreeMapReduceCallback = ( acc: A, value: V | undefined, key: K, index: number, map: SELF ) => A;