export type FmtStr = keyof typeof MemoryView.ARRAYS; type MemoryViewOptions = { byteOffset?: number; byteLength?: number; fmt?: F; shape?: number[]; }; type Arr = InstanceType; type Const = T extends 'q' | 'Q' ? bigint : T extends '?' ? boolean : number; export declare class MemoryView { buffer: ArrayBuffer; byteOffset: number; byteLength: number; format: F; _is_scalar: boolean; shape: number[]; toString: () => string; constructor(input: MemoryView); constructor(input: number); constructor(input: Uint8Array); constructor(input: ArrayBuffer, opts?: MemoryViewOptions); static fromArray: (arr: Const[], fmt: F_1) => MemoryView<"B">; private setShape; get strides(): number[]; /** * Reinterpret the underlying type. * * ```ts * new MemoryView(new Uint8Array([1, 0, 0, 0])).cast("i").typedArray // new Int32Array([1]) * ``` */ cast: (fmt: NewF, shape?: number[]) => MemoryView; /** * Converts to a new format * ```ts * new MemoryView(new Uint8Array([1, 0, 0, 0])).convert("i").typedArray // new Int32Array([1, 0, 0, 0]) * ``` */ convert: (fmt: NewF, shape?: number[]) => MemoryView; /** The number of typed elements (1D) in this MemoryView. */ get length(): number; /** Returns the size of one element in bytes. */ get BYTES_PER_ELEMENT(): any; /** A typed-array “view” into the memory (creates on-the-fly). */ get typedArray(): Arr; /** Return the underlying bytes as a Uint8Array. */ get bytes(): Uint8Array; /** Access multi-dimensional elements by index. */ getValue(...indices: number[]): Const; /** Set multi-dimensional element. */ setValue(value: Const, ...indices: number[]): void; /** Flatten back to a single dimension. */ flat(): this; /** Reshape to a new multi-dimensional shape (must have same total # of elements). */ reshape(newShape: number[]): this; slice: (begin: number, end?: number) => MemoryView; /** * Sets typed values from another array/MemoryView into our memory, * beginning at element offset = `offset`. */ set: (array: Arr | MemoryView, offsetInBytes?: number) => this; /** If 'q' or 'Q', we treat them as 64-bit bigints in JS. */ get isBigInt(): boolean; /** If '?' we store booleans (0/1) in a Uint8Array. */ get isBoolean(): boolean; /** * Convert to a list of JS numbers (1D). Throws if the format is one of the bigint types. */ to1DList: () => Const[]; toList: () => Const[]; static ARRAYS: { b: Int8ArrayConstructor; B: Uint8ArrayConstructor; h: Int16ArrayConstructor; H: Uint16ArrayConstructor; i: Int32ArrayConstructor; I: Uint32ArrayConstructor; q: BigInt64ArrayConstructor; Q: BigUint64ArrayConstructor; e: any; f: Float32ArrayConstructor; d: Float64ArrayConstructor; '?': Uint8ArrayConstructor; }; } export {};