import { MaybeBigInt64Array, MaybeBigUint64Array, TypedArray, NdArray } from 'ndarray'; import { StoreApi } from 'zustand'; import * as react_jsx_runtime from 'react/jsx-runtime'; import { PropsWithChildren, ReactNode } from 'react'; import { AxiosInstance } from 'axios'; import { DimensionMapping } from '@h5web/lib'; declare enum H5T_ORDER { LE = 0, BE = 1, VAX = 2, MIXED = 3, NONE = 4 } declare enum H5T_CSET { ASCII = 0, UTF8 = 1 } declare enum H5T_STR { NULLTERM = 0, NULLPAD = 1, SPACEPAD = 2 } declare const H5T_TO_ENDIANNESS: { readonly 0: "little-endian"; readonly 1: "big-endian"; readonly 2: "VAX"; readonly 3: "mixed"; readonly 4: "none"; }; declare const H5T_TO_CHAR_SET: { readonly 0: "ASCII"; readonly 1: "UTF-8"; }; declare const H5T_TO_STR_PAD: { readonly 0: "null-terminated"; readonly 1: "null-padded"; readonly 2: "space-padded"; }; type NumArray = TypedArray | number[]; type BigIntTypedArray = MaybeBigInt64Array | MaybeBigUint64Array; type ExportFormat = 'json' | 'csv' | 'npy' | 'tiff'; type ExportURL = URL | (() => Promise); type BuiltInExporter = () => string; declare enum EntityKind { Group = "group", Dataset = "dataset", Datatype = "datatype", Unresolved = "unresolved" } interface Entity { name: string; path: string; kind: EntityKind; attributes: Attribute[]; link?: Link; } type ProvidedEntity = GroupWithChildren | Dataset | Datatype | UnresolvedEntity; type ChildEntity = Group | Dataset | Datatype | UnresolvedEntity; interface Group extends Entity { kind: EntityKind.Group; } interface GroupWithChildren extends Group { children: ChildEntity[]; } interface Dataset extends Entity { kind: EntityKind.Dataset; shape: S; type: T; rawType?: unknown; chunks?: number[]; filters?: Filter[]; virtualSources?: VirtualSource[]; } interface Datatype extends Entity { kind: EntityKind.Datatype; type?: T; rawType?: unknown; } interface UnresolvedEntity extends Entity { kind: EntityKind.Unresolved; } type LinkClass = 'Hard' | 'Soft' | 'External'; interface Link { class: LinkClass; file?: string; path?: string; } interface Attribute { name: string; shape: S; type: T; } interface Filter { id: number; name: string; } interface VirtualSource { file: string; path: string; } interface DatasetDef { path: string; shape?: SC; type?: DTC; } type DatasetFromDef = Dataset extends ShapeClass ? ShapeClassMap[NonNullable] : Shape, NonNullable extends DTypeClass ? DTypeClassMap[NonNullable] : DType>; declare enum ShapeClass { Array = "Array", Scalar = "Scalar", Null = "Null" } interface ShapeClassMap { [ShapeClass.Array]: ArrayShape; [ShapeClass.Scalar]: ScalarShape; [ShapeClass.Null]: NullShape; } type Shape = ArrayShape | ScalarShape | NullShape; interface ArrayShape { class: ShapeClass.Array; dims: number[]; } interface ScalarShape { class: ShapeClass.Scalar; dims: []; } interface NullShape { class: ShapeClass.Null; } interface HasShape { shape: S; } declare enum DTypeClass { Bool = "Boolean", Integer = "Integer", Float = "Float", Complex = "Complex", String = "String", Compound = "Compound", Array = "Array", VLen = "Array (variable length)", Enum = "Enumeration", Time = "Time", Bitfield = "Bitfield", Opaque = "Opaque", Reference = "Reference", Unknown = "Unknown" } interface DTypeClassMap { [DTypeClass.Bool]: BooleanType; [DTypeClass.Integer]: IntegerType; [DTypeClass.Float]: FloatType; [DTypeClass.Complex]: ComplexType; [DTypeClass.String]: StringType; [DTypeClass.Compound]: CompoundType; [DTypeClass.Array]: ArrayType; [DTypeClass.VLen]: VLenType; [DTypeClass.Enum]: EnumType; [DTypeClass.Time]: TimeType; [DTypeClass.Bitfield]: BitfieldType; [DTypeClass.Opaque]: OpaqueType; [DTypeClass.Reference]: ReferenceType; [DTypeClass.Unknown]: UnknownType; } type Endianness = (typeof H5T_TO_ENDIANNESS)[H5T_ORDER]; type CharSet = (typeof H5T_TO_CHAR_SET)[H5T_CSET]; type StrPad = (typeof H5T_TO_STR_PAD)[H5T_STR]; type NumericType = IntegerType | FloatType; type NumericLikeType = NumericType | BooleanType | EnumType; type PrintableType = StringType | NumericLikeType | ComplexType; type DType = PrintableType | CompoundType | ArrayType | VLenType | TimeType | BitfieldType | OpaqueType | ReferenceType | UnknownType; interface IntegerType { class: DTypeClass.Integer; signed: boolean; size: number; endianness: Endianness | undefined; } interface FloatType { class: DTypeClass.Float; size: number; endianness: Endianness | undefined; } interface ComplexType { class: DTypeClass.Complex; realType: NumericType; imagType: NumericType; } interface StringType { class: DTypeClass.String; charSet: CharSet | undefined; strPad: StrPad | undefined; length?: number; } interface CompoundType { class: DTypeClass.Compound; fields: Map; } interface ArrayType { class: DTypeClass.Array; base: T; dims: number[]; } interface VLenType { class: DTypeClass.VLen; base: T; } interface BooleanType { class: DTypeClass.Bool; base: NumericType; } interface EnumType { class: DTypeClass.Enum; base: NumericType; mapping: Record; } interface TimeType { class: DTypeClass.Time; } interface BitfieldType { class: DTypeClass.Bitfield; endianness: Endianness | undefined; } interface ReferenceType { class: DTypeClass.Reference; } interface OpaqueType { class: DTypeClass.Opaque; tag: string; } interface UnknownType { class: DTypeClass.Unknown; } interface HasType { type: T; } type ScalarValue = T extends NumericLikeType ? number | (T extends IntegerType ? bigint : never) | (T extends BooleanType ? boolean : never) : T extends StringType ? string : T extends ComplexType ? H5WebComplex : T extends CompoundType ? ScalarValue[] : unknown; type ArrayValue = T extends NumericLikeType ? TypedArray | number[] | (T extends IntegerType ? BigIntTypedArray | bigint[] : never) | (T extends BooleanType ? boolean[] : never) : ScalarValue[]; type Value = D extends HasShape & HasType ? S extends ScalarShape ? ScalarValue : S extends ArrayShape ? ArrayValue : never : never; type AttributeValues = Record; type H5WebComplex = [real: number, imag: number]; type OnProgress = (value: number) => void; interface FetchStore { has: (input: Input) => boolean; prefetch: (input: Input) => void; get: (input: Input) => Result; preset: (input: Input, result: Result) => void; evict: (input: Input) => void; evictErrors: () => void; abort: (input: Input, reason?: string, evict?: boolean) => void; abortAll: (reason?: string, evict?: boolean) => void; get progressStore(): StoreApi>; } interface ProgressState { ongoing: Map; setProgress: (input: Input, value?: number) => void; clearProgress: (input: Input) => void; } declare class AbortError extends Error { constructor(reason?: string); } type EntitiesStore = FetchStore; type ValuesStore = FetchStore; type AttrValuesStore = FetchStore; interface ValuesStoreParams { dataset: Dataset; selection?: string | undefined; } type Fetcher = (url: string, params: Record, opts?: FetcherOptions) => Promise; interface FetcherOptions { abortSignal?: AbortSignal; onProgress?: OnProgress; } declare abstract class DataProviderApi { readonly filepath: string; constructor(filepath: string); abstract getEntity(path: string): Promise; abstract getValue(params: ValuesStoreParams, abortSignal?: AbortSignal, onProgress?: OnProgress): Promise; abstract getAttrValues(entity: Entity): Promise; getExportURL?(format: ExportFormat, dataset: Dataset, selection?: string, builtInExporter?: BuiltInExporter): ExportURL | undefined; getSearchablePaths?(path: string): Promise; } interface FeedbackContext { filePath: string; entityPath: string; } interface Props$5 { sidebarOpen?: boolean; initialPath?: string; getFeedbackURL?: (context: FeedbackContext) => string; disableDarkMode?: boolean; propagateErrors?: boolean; } declare function App(props: Props$5): react_jsx_runtime.JSX.Element; interface Props$4 { getExportURL?: DataProviderApi['getExportURL']; } declare function MockProvider(props: PropsWithChildren): react_jsx_runtime.JSX.Element; interface Props$3 { url: string; filepath: string; resetKeys?: unknown[]; fetcher: Fetcher; getExportURL?: DataProviderApi['getExportURL']; } declare function HsdsProvider(props: PropsWithChildren): react_jsx_runtime.JSX.Element; interface Props$2 { url: string; filepath: string; resetKeys?: unknown[]; fetcher?: Fetcher; getExportURL?: DataProviderApi['getExportURL']; } declare function H5GroveProvider(props: PropsWithChildren): react_jsx_runtime.JSX.Element; declare function getValueOrError(api: DataProviderApi, dataset: Dataset): Promise; declare function createBasicFetcher(fetchOpts?: Omit): Fetcher; declare function createAxiosFetcher(axiosInstance: AxiosInstance): Fetcher; declare function buildBasicAuthHeader(username: string, password: string): Record; declare function hasAttribute(entity: Entity, attributeName: string): boolean; declare function findAttribute(entity: Entity, attributeName: string): Attribute | undefined; declare function findScalarNumAttr(entity: Entity, attributeName: string): Attribute | undefined; declare function findScalarStrAttr(entity: Entity, attributeName: string): Attribute | undefined; declare function getAttributeValue>(entity: Entity, attribute: A, attrValuesStore: AttrValuesStore): Value; declare function getAttributeValue>(entity: Entity, attribute: A | undefined, attrValuesStore: AttrValuesStore): Value | undefined; declare function enableBigIntSerialization(): void; declare function getFeedbackMailto(context: FeedbackContext, email: string, subject?: string): string; interface DataContextValue { filepath: string; filename: string; entitiesStore: EntitiesStore; valuesStore: ValuesStore; attrValuesStore: AttrValuesStore; getExportURL?: DataProviderApi['getExportURL']; getSearchablePaths?: DataProviderApi['getSearchablePaths']; } declare function useDataContext(): DataContextValue; interface Props$1 { api: DataProviderApi; } declare function DataProvider(props: PropsWithChildren): react_jsx_runtime.JSX.Element; declare function useEntity(path: string): ProvidedEntity; declare function useDatasets>(defs: R): { [K in keyof R]: DatasetFromDef; }; declare function useValue>(dataset: D, selection?: string): Value; declare function useValue>(dataset: D | undefined, selection?: string): Value | undefined; type ValueFromParams = Value; declare function useValues>(datasets: R): { [K in keyof R]: ValueFromParams; }; declare function useValuesInCache(...datasets: (Dataset | undefined)[]): (dimMapping: DimensionMapping) => boolean; declare function getBaseArray(value: T, rawDims: number[]): T extends ArrayValue ? NdArray : undefined; declare function applyMapping | undefined>(baseArray: T, mapping: DimensionMapping): T extends NdArray ? T : undefined; declare function toNumArray | undefined>(arr: T): T extends ArrayValue ? NumArray : undefined; declare const useToNumArray: typeof toNumArray; declare function useToNumArrays(arrays: ArrayValue[]): NumArray[]; declare function useToNumArrays(arrays: (ArrayValue | undefined)[]): (NumArray | undefined)[]; declare function useBaseArray(value: T, rawDims: number[]): T extends ArrayValue ? NdArray : undefined; declare function useMappedArray(value: T, dims: number[], mapping: DimensionMapping): T extends ArrayValue ? NdArray : undefined; declare function useMappedArrays(values: T[], dims: number[], mapping: DimensionMapping): NdArray[]; declare function useMappedArrays(values: (T | undefined)[], dims: number[], mapping: DimensionMapping): (NdArray | undefined)[]; declare function isDefined(val: T): val is T extends undefined ? never : T; declare function isNonNull(val: T): val is T extends null ? never : T; declare function assertDefined(val: T, message?: string): asserts val is T extends undefined ? never : T; declare function assertNonNull(val: T, message?: string): asserts val is T extends null ? never : T; declare function assertNum(val: unknown, message?: string): asserts val is number; declare function assertStr(val: unknown, message?: string): asserts val is string; declare function assertEnvVar(val: unknown, name: string): asserts val is string; declare function assertComplex(val: unknown, message?: string): asserts val is H5WebComplex; declare function assertArray(val: unknown, message?: string): asserts val is unknown[]; declare function isTypedArray(val: unknown): val is TypedArray; declare function isBigIntTypedArray(val: unknown): val is BigIntTypedArray; declare function assertTypedArray(val: unknown, message?: string): asserts val is TypedArray; declare function assertBigIntTypedArray(val: unknown, message?: string): asserts val is BigIntTypedArray; declare function assertArrayOrTypedArray(val: unknown, message?: string): asserts val is unknown[] | TypedArray; declare function assertAnyTypedArray(val: unknown, message?: string): asserts val is TypedArray | BigIntTypedArray; declare function assertArrayOrAnyTypedArray(val: unknown, message?: string): asserts val is unknown[] | TypedArray | BigIntTypedArray; declare function isGroup(entity: Entity): entity is Group; declare function assertGroup(entity: Entity, message?: string): asserts entity is Group; declare function hasChildren(group: Group): group is GroupWithChildren; declare function assertGroupWithChildren(group: Group, message?: string): asserts group is GroupWithChildren; declare function isDataset(entity: Entity): entity is Dataset; declare function assertDataset(entity: Entity, message?: string): asserts entity is Dataset; declare function isDatatype(entity: Entity): entity is Datatype; declare function assertDatatype(entity: Entity, message?: string): asserts entity is Datatype; declare function isShape(shape: Shape, shapeClass: C): shape is ShapeClassMap[C]; declare function hasShape(obj: O, shapeClass: C): obj is O & HasShape; declare function assertShape(obj: O, shapeClass: C, message?: string): asserts obj is O & ShapeClassMap[C]; declare function isScalarShape(shape: Shape): shape is ScalarShape; declare function hasScalarShape(obj: O): obj is O & HasShape; declare function assertScalarShape(obj: O, message?: string): asserts obj is O & HasShape; declare function isArrayShape(shape: Shape): shape is ArrayShape; declare function hasArrayShape(obj: O): obj is O & HasShape; declare function assertArrayShape(obj: O, message?: string): asserts obj is O & HasShape; declare function isNonNullShape(shape: Shape): shape is ScalarShape | ArrayShape; declare function hasNonNullShape(obj: O): obj is O & HasShape; declare function assertNonNullShape(obj: O, message?: string): asserts obj is O & HasShape; declare function hasMinDims(obj: HasShape, min: number): boolean; declare function assertMinDims(obj: HasShape, min: number, message?: string): void; declare function hasNumDims(obj: HasShape, num: number): boolean; declare function assertNumDims(obj: HasShape, num: number, message?: string): void; declare function isType(type: DType, dtypeClass: C): type is DTypeClassMap[C]; declare function hasType(obj: O, dtypeClass: C): obj is O & HasType; declare function assertType(obj: O, dtypeClass: C, message?: string): asserts obj is O & DTypeClassMap[C]; declare function isStringType(type: DType): type is StringType; declare function hasStringType(obj: O): obj is O & HasType; declare function assertStringType(obj: O, message?: string): asserts obj is O & HasType; declare function isIntegerType(type: DType): type is IntegerType; declare function isFloatType(type: DType): type is FloatType; declare function isNumericType(type: DType): type is NumericType; declare function hasIntegerType(obj: O): obj is O & HasType; declare function hasFloatType(obj: O): obj is O & HasType; declare function hasNumericType(obj: O): obj is O & HasType; declare function assertIntegerType(obj: O, message?: string): asserts obj is O & HasType; declare function assertFloatType(obj: O, message?: string): asserts obj is O & HasType; declare function assertNumericType(obj: O, message?: string): asserts obj is O & HasType; declare function isBoolType(type: DType): type is BooleanType; declare function isEnumType(type: DType): type is EnumType; declare function isNumericLikeType(type: DType): type is NumericLikeType; declare function hasBoolType(obj: O): obj is O & HasType; declare function hasEnumType(obj: O): obj is O & HasType; declare function hasNumericLikeType(obj: O): obj is O & HasType; declare function assertBoolType(obj: O, message?: string): asserts obj is O & HasType; declare function assertEnumType(obj: O, message?: string): asserts obj is O & HasType; declare function assertNumericLikeType(obj: O, message?: string): asserts obj is O & HasType; declare function isComplexType(type: DType): type is ComplexType; declare function hasComplexType(obj: O): obj is O & HasType; declare function assertComplexType(obj: O, message?: string): asserts obj is O & HasType; declare function assertNumericLikeOrComplexType(obj: O, message?: string): asserts obj is O & HasType; declare function isPrintableType(type: DType): type is PrintableType; declare function hasPrintableType(obj: O): obj is O & HasType; declare function assertPrintableType(obj: O, message?: string): asserts obj is O & HasType; declare function isCompoundType(type: DType): type is CompoundType; declare function hasCompoundType(obj: O): obj is O & HasType; declare function assertCompoundType(obj: O, message?: string): asserts obj is O & HasType; declare function isArrayOrVlenType(type: DType): type is ArrayType | VLenType; declare function assertScalarValue(value: unknown, type: T): asserts value is ScalarValue; declare function assertValue & HasType>(value: unknown, obj: O): asserts value is Value; declare function arrayDef(path: string, type: T): DatasetDef; declare function scalarDef(path: string, type: T): DatasetDef; declare function parseShape(dims: number[] | null | undefined): Shape; interface Props { dataset: D; selection?: string; render: (val: Value) => ReactNode; } declare function ValueFetcher>(props: Props): ReactNode; type GetExportURL = NonNullable; export { AbortError, App, DTypeClass, DataProvider, DataProviderApi, EntityKind, H5GroveProvider, HsdsProvider, MockProvider, ShapeClass, ValueFetcher, applyMapping, arrayDef, assertAnyTypedArray, assertArray, assertArrayOrAnyTypedArray, assertArrayOrTypedArray, assertArrayShape, assertBigIntTypedArray, assertBoolType, assertComplex, assertComplexType, assertCompoundType, assertDataset, assertDatatype, assertDefined, assertEnumType, assertEnvVar, assertFloatType, assertGroup, assertGroupWithChildren, assertIntegerType, assertMinDims, assertNonNull, assertNonNullShape, assertNum, assertNumDims, assertNumericLikeOrComplexType, assertNumericLikeType, assertNumericType, assertPrintableType, assertScalarShape, assertScalarValue, assertShape, assertStr, assertStringType, assertType, assertTypedArray, assertValue, buildBasicAuthHeader, createAxiosFetcher, createBasicFetcher, enableBigIntSerialization, findAttribute, findScalarNumAttr, findScalarStrAttr, getAttributeValue, getBaseArray, getFeedbackMailto, getValueOrError, hasArrayShape, hasAttribute, hasBoolType, hasChildren, hasComplexType, hasCompoundType, hasEnumType, hasFloatType, hasIntegerType, hasMinDims, hasNonNullShape, hasNumDims, hasNumericLikeType, hasNumericType, hasPrintableType, hasScalarShape, hasShape, hasStringType, hasType, isArrayOrVlenType, isArrayShape, isBigIntTypedArray, isBoolType, isComplexType, isCompoundType, isDataset, isDatatype, isDefined, isEnumType, isFloatType, isGroup, isIntegerType, isNonNull, isNonNullShape, isNumericLikeType, isNumericType, isPrintableType, isScalarShape, isShape, isStringType, isType, isTypedArray, parseShape, scalarDef, toNumArray, useBaseArray, useDataContext, useDatasets, useEntity, useMappedArray, useMappedArrays, useBaseArray as useNdArray, useToNumArray, useToNumArrays, useValue, useValues, useValuesInCache }; export type { ArrayShape, ArrayType, ArrayValue, AttrValuesStore, Attribute, AttributeValues, BitfieldType, BooleanType, BuiltInExporter, ChildEntity, ComplexType, CompoundType, DType, DataContextValue, Dataset, DatasetDef, Datatype, EntitiesStore, Entity, EnumType, ExportFormat, ExportURL, FeedbackContext, Fetcher, FetcherOptions, Filter, FloatType, GetExportURL, Group, GroupWithChildren, H5WebComplex, IntegerType, LinkClass, NumArray, NumericLikeType, NumericType, OpaqueType, PrintableType, ProvidedEntity, ReferenceType, ScalarShape, ScalarValue, Shape, StringType, TimeType, UnknownType, UnresolvedEntity, VLenType, Value, ValuesStore, ValuesStoreParams, VirtualSource };