/**
 * Pure helper functions and types for reading a logical bitmap index.
 *
 * Extracted from LogicalIndexReader to keep each file under 500 LOC
 * and to separate pure query/build logic from the stateful reader class.
 *
 * @module domain/services/index/logicalIndexHelpers
 */
import type { RoaringBitmapSubset } from '../../utils/roaring.ts';
import type { NeighborEdge } from '../../../ports/NeighborProviderPort.ts';
/**
 * Runtime interface for a fully-hydrated logical bitmap index.
 *
 * Produced by LogicalIndexReader.toLogicalIndex() and consumed by
 * BitmapNeighborProvider and MaterializedViewService.
 */
export interface LogicalIndex {
    getGlobalId(nodeId: string): number | undefined;
    getNodeId(globalId: number): string | undefined;
    getLabelRegistry(): Map<string, number>;
    isAlive(nodeId: string): boolean;
    getEdges(nodeId: string, direction: string, filterLabelIds?: number[]): NeighborEdge[];
}
/** A shard file's path + raw bytes (codec path). */
export interface ShardItem {
    path: string;
    buf: Uint8Array;
}
/** A shard file's path + decoded data (port path). */
export interface DecodedItem {
    path: string;
    data: unknown;
}
/**
 * Decoded shard maps used internally to build a LogicalIndex.
 */
export interface IndexMaps {
    n2g: Map<string, number>;
    g2n: Map<number, string>;
    alive: Map<string, RoaringBitmapSubset>;
    lr: Map<string, number>;
    i2l: Map<number, string>;
    fwd: Map<string, RoaringBitmapSubset>;
    rev: Map<string, RoaringBitmapSubset>;
    byOwnerFwd: Map<number, Array<{
        labelId: number;
        bitmap: RoaringBitmapSubset;
    }>>;
    byOwnerRev: Map<number, Array<{
        labelId: number;
        bitmap: RoaringBitmapSubset;
    }>>;
}
/** Classified decoded shards ready for loading. */
export interface ClassifiedDecoded {
    meta: DecodedItem[];
    labels: unknown;
    edges: DecodedItem[];
}
/**
 * Returns true if the shard path represents a meta file (meta_XX.cbor).
 */
export declare function isMetaShard(path: string): boolean;
/**
 * Returns true if the shard path represents an edge file (fwd_XX.cbor or rev_XX.cbor).
 */
export declare function isEdgeShard(path: string): boolean;
/**
 * Classifies loaded path/buf pairs into meta, labels, and edge buckets.
 */
export declare function classifyShards(items: ShardItem[]): {
    meta: ShardItem[];
    labels: Uint8Array | null;
    edges: ShardItem[];
};
/**
 * Classifies pre-decoded path/data pairs into meta, labels, and edge buckets.
 */
export declare function classifyDecoded(items: DecodedItem[]): ClassifiedDecoded;
/**
 * Resolves edges for a specific node and direction from index maps.
 */
export declare function resolveEdgesForNode(maps: IndexMaps, query: {
    nodeId: string;
    direction: 'in' | 'out';
    filterLabelIds?: number[];
}): NeighborEdge[];
/**
 * Checks whether a node is alive in the bitmap index.
 */
export declare function checkAlive(n2g: Map<string, number>, alive: Map<string, RoaringBitmapSubset>, nodeId: string): boolean;
/**
 * Builds a LogicalIndex object from decoded shard maps.
 */
export declare function buildLogicalIndex(maps: IndexMaps): LogicalIndex;
