export declare function throwError(msg: string, cancel?: boolean): void;
export declare function isCancelError(e: Error): boolean;
export declare function setAckError(e: Error): void;
export declare function isAckError(e: Error): boolean;
export declare function delay<T>(millis: number, value?: T): Promise<T | undefined>;
export declare function memcpy(trg: Uint8Array, trgOff: number, src: ArrayLike<number>, srcOff?: number, len?: number): void;
export declare function strcmp(a: string, b: string): 0 | 1 | -1;
export declare function bufferEq(a: Uint8Array, b: ArrayLike<number>, offset?: number): boolean;
export declare function hash(buf: Uint8Array, bits: number): number;
export declare function idiv(a: number, b: number): number;
export declare function fnv1(data: Uint8Array): number;
export declare function fnv1a(data: Uint8Array): number;
export declare function crc(p: Uint8Array): number;
export declare function ALIGN(n: number): number;
export declare function stringToUint8Array(input: string): Uint8Array;
export declare function uint8ArrayToString(input: ArrayLike<number>): string;
export declare function fromUTF8(binstr: string): string;
export declare function toUTF8(str: string, cesu8?: boolean): string;
export type SMap<T> = Record<string, T>;
/** @internal */
export declare class PromiseBuffer<T> {
    private waiting;
    private available;
    drain(): void;
    pushError(v: Error): void;
    push(v: T): void;
    shiftAsync(timeout?: number): Promise<T>;
}
/** @internal */
export declare class PromiseQueue {
    private readonly promises;
    enqueue<T>(id: string, f: () => Promise<T>): Promise<T>;
}
export declare function rgbToHtmlColor(rgb: number): string;
export declare function toFullHex(n: number[]): string;
export declare function toHex(bytes: ArrayLike<number>, sep?: string): string;
export declare function fromHex(hex: string): Uint8Array;
export declare function isSet(v: unknown): boolean;
export declare function toArray<T>(a: ArrayLike<T>): T[];
export interface MutableArrayLike<T> {
    readonly length: number;
    [n: number]: T;
}
export declare function hexNum(n: number): string;
export declare function write32(buf: MutableArrayLike<number>, pos: number, v: number): void;
export declare function write24(buf: MutableArrayLike<number>, pos: number, v: number): void;
export declare function write16(buf: MutableArrayLike<number>, pos: number, v: number): void;
export declare function read32(buf: ArrayLike<number>, pos: number): number;
export declare function read16(buf: ArrayLike<number>, pos: number): number;
export declare function encodeU32LE(words: number[]): Uint8Array;
export declare function encodeU16LE(words: number[]): Uint8Array;
export declare function decodeU32LE(buf: Uint8Array): number[];
export declare function isBufferEmpty(data: Uint8Array): boolean;
export declare function bufferToString(buf: Uint8Array): string;
export declare function stringToBuffer(str: string): Uint8Array;
export declare function bufferConcat(a: Uint8Array, b: Uint8Array): Uint8Array;
export declare function bufferConcatMany(bufs: Uint8Array[]): Uint8Array;
export declare function arrayConcatMany<T>(arrs: T[][]): T[];
export declare function jsonCopyFrom<T>(trg: T, src: T): void;
export declare function assert(cond: boolean, msg?: string, debugData?: any): void;
export declare function flatClone<T extends unknown>(obj: T | null): T;
export declare function clone<T>(v: T): T;
export declare function throttle(handler: () => void, delay: number): () => void;
export interface Signal {
    signalled: Promise<boolean>;
    signal: () => void;
}
export declare function signal(): Signal;
export declare function readBlobToUint8Array(blob: Blob): Promise<Uint8Array>;
export declare function readBlobToText(blob: Blob): Promise<string>;
export declare function debounce(handler: () => void, delay: number): () => void;
export declare function debounceAsync(handler: () => Promise<void>, delay: number): () => void;
export declare function roundWithPrecision(x: number, digits: number, round?: (x: number) => number): number;
export declare function renderWithPrecision(x: number, digits: number, round?: (x: number) => number): string;
export declare function prettySize(b: number): string;
export declare function randomRange(min: number, max: number): number;
export declare function unique(values: string[]): string[];
export declare function uniqueMap<T, U>(values: T[], id: (value: T) => string, converter: (value: T) => U): U[];
export declare function toMap<T, V>(a: T[], keyConverter: (value: T, index: number) => string, valueConverter: (value: T, index: number) => V, ignoreMissingValues?: boolean): SMap<V>;
export declare function ellipse(text: string, maxChars: number, suffix?: string): string;
export declare function ellipseFirstSentence(text: string): string;
export declare function ellipseJoin(values: string[], maxChars: number, ellipse?: string): string;
export declare function arrayShuffle<T>(a: T[]): T[];
export declare function uniqueName(names: string[], name: string, separator?: string): string;
export declare function groupBy<T>(list: T[], key: (value: T) => string): SMap<T[]>;
export declare function pick(...values: number[]): number;
/**
 * Applies filters and returns array of [yays, nays]
 * @param values
 * @param condition
 */
export declare function splitFilter<T>(values: ArrayLike<T>, condition: (t: T) => boolean): [T[], T[]];
export declare function range(end: number): number[];
export declare function toggleBit(data: Uint8Array, bitindex: number): void;
export declare function getBit(data: Uint8Array, bitindex: number): boolean;
export declare function setBit(data: Uint8Array, bitindex: number, on: boolean): void;
export declare function parseIdentifier(value: number | string): number;
//# sourceMappingURL=jdutil.d.ts.map