/**
 * Open Zarr arrays and groups from a {@link Readable} store.
 *
 * The main entry point is {@linkcode open}, which auto-detects whether the
 * target node is a Zarr v2 or v3 array/group. Use {@linkcode open.v2} or
 * {@linkcode open.v3} to pin a specific format.
 *
 * ```ts
 * import * as zarr from "zarrita";
 *
 * const store = new zarr.FetchStore("https://example.com/data.zarr");
 *
 * // Auto-detect version and node kind.
 * const node = await zarr.open(store);
 *
 * // Or narrow to an array (throws NotFoundError if it's a group).
 * const arr = await zarr.open(store, { kind: "array" });
 * ```
 *
 * @module
 */
import type { Readable } from "@zarrita/storage";
import { Array, Group, Location } from "./hierarchy.js";
import type { DataType } from "./metadata.js";
export declare let VERSION_COUNTER: {
    increment(store: Readable, version: "v2" | "v3"): void;
    versionMax(store: Readable): "v2" | "v3";
};
type OpenV2Options = {
    kind?: "array" | "group";
    attrs?: boolean;
    signal?: AbortSignal;
};
declare function openV2<Store extends Readable>(location: Location<Store> | Store, options: OpenV2Options & {
    kind: "group";
}): Promise<Group<Store>>;
declare function openV2<Store extends Readable>(location: Location<Store> | Store, options: OpenV2Options & {
    kind: "array";
}): Promise<Array<DataType, Store>>;
declare function openV2<Store extends Readable>(location: Location<Store> | Store, options?: OpenV2Options): Promise<Array<DataType, Store> | Group<Store>>;
type OpenV3Options = {
    kind?: "array" | "group";
    signal?: AbortSignal;
};
declare function openV3<Store extends Readable>(location: Location<Store> | Store, options: OpenV3Options & {
    kind: "group";
}): Promise<Group<Store>>;
declare function openV3<Store extends Readable>(location: Location<Store> | Store, options: OpenV3Options & {
    kind: "array";
}): Promise<Array<DataType, Store>>;
declare function openV3<Store extends Readable>(location: Location<Store> | Store, options?: OpenV3Options): Promise<Array<DataType, Store> | Group<Store>>;
type OpenOptions = {
    kind?: "array" | "group";
    attrs?: boolean;
    signal?: AbortSignal;
};
/**
 * Open a Zarr array or group, auto-detecting the on-disk format version.
 *
 * Tries Zarr v3 and v2 in the order most likely to succeed for the given
 * store (based on previous opens), falling back to the other version on
 * {@linkcode NotFoundError} or {@linkcode InvalidMetadataError}. Pass `kind`
 * to require a specific node type, or use {@linkcode open.v2} /
 * {@linkcode open.v3} to pin the format.
 *
 * @example Usage
 * ```ts
 * import * as zarr from "zarrita";
 *
 * const store = new zarr.FetchStore("https://example.com/data.zarr");
 * const arr = await zarr.open(store, { kind: "array" });
 * console.log(arr.shape, arr.dtype);
 * ```
 *
 * @example Child node of a group
 * ```ts
 * import * as zarr from "zarrita";
 *
 * const store = new zarr.FetchStore("https://example.com/data.zarr");
 * const group = await zarr.open(store, { kind: "group" });
 * const child = await zarr.open(group.resolve("temperature"), { kind: "array" });
 * ```
 *
 * @param location A {@linkcode Readable} store, or a {@linkcode Location}
 *   pointing at a node within a store.
 * @param options Open options. Set `kind` to `"array"` or `"group"` to
 *   require that node type, or pass an `AbortSignal` to cancel the request.
 * @returns The opened {@linkcode Array} or {@linkcode Group}.
 * @throws {NotFoundError} If no array or group exists at the location, or if
 *   the node kind does not match `options.kind`.
 * @throws {InvalidMetadataError} If metadata is present but malformed.
 * @category Read
 */
export declare function open<Store extends Readable>(location: Location<Store> | Store, options: OpenOptions & {
    kind: "group";
}): Promise<Group<Store>>;
/**
 * Open a Zarr array or group, auto-detecting the on-disk format version.
 * @category Read
 */
export declare function open<Store extends Readable>(location: Location<Store> | Store, options: OpenOptions & {
    kind: "array";
}): Promise<Array<DataType, Store>>;
/**
 * Open a Zarr array or group, auto-detecting the on-disk format version.
 * @category Read
 */
export declare function open<Store extends Readable>(location: Location<Store> | Store, options?: OpenOptions): Promise<Array<DataType, Store> | Group<Store>>;
export declare namespace open {
    var v2: typeof openV2;
}
export declare namespace open {
    var v3: typeof openV3;
}
//# sourceMappingURL=open.d.ts.map