/**
 * Copyright (c) 2023-2025 mol* contributors, licensed under MIT, See LICENSE file for more info.
 *
 * @author Adam Midlik <midlik@gmail.com>
 * @author David Sehnal <david.sehnal@gmail.com>
 */
import { StateObject } from '../../../mol-state/index.js';
import { Color } from '../../../mol-util/color/index.js';
/** Represents either the result or the reason of failure of an operation that might have failed */
export type Maybe<T> = {
    ok: true;
    value: T;
} | {
    ok: false;
    error: any;
};
/** Try to await a promise and return an object with its result (if resolved) or with the error (if rejected) */
export declare function safePromise<T>(promise: T): Promise<Maybe<Awaited<T>>>;
/** A map where values are arrays. Handles missing keys when adding values. */
export declare class MultiMap<K, V> implements Mapping<K, V[]> {
    private _map;
    /** Return the array of values assidned to a key (or `undefined` if no such values) */
    get(key: K): V[] | undefined;
    /** Append value to a key (handles missing keys) */
    add(key: K, value: V): void;
}
/** Basic subset of `Map<K, V>`, only needs to have `get` method */
export type Mapping<K, V> = Pick<Map<K, V>, 'get'>;
/** Implementation of `Map` where keys are integers
 * and most keys are expected to be from interval `[0, limit)`.
 * For the keys within this interval, performance is better than `Map` (implemented by array).
 * For the keys out of this interval, performance is slightly worse than `Map`. */
export declare class NumberMap<K extends number, V> implements Mapping<K, V> {
    readonly limit: K;
    private array;
    private map;
    constructor(limit: K);
    get(key: K): V | undefined;
    set(key: K, value: V): void;
}
/** Return `true` if `value` is not `undefined` or `null`.
 * Prefer this over `value !== undefined`
 * (for maybe if we want to allow `null` in `AnnotationRow` in the future) */
export declare function isDefined<T>(value: T | undefined | null): value is T;
/** Return `true` if at least one of `values` is not `undefined` or `null`. */
export declare function isAnyDefined(...values: any[]): boolean;
/** Return filtered array containing all original elements except `undefined` or `null`. */
export declare function filterDefined<T>(elements: (T | undefined | null)[]): T[];
/** Create an 16-hex-character hash for a given input string, e.g. 'spanish inquisition' -> '7f9ac4be544330be'*/
export declare function stringHash(input: string): string;
/** Return type of elements in a set */
export type ElementOfSet<S> = S extends Set<infer T> ? T : never;
/** Convert `colorString` (either X11 color name like 'magenta' or hex code like '#ff00ff') to Color.
 * Return `undefined` if `colorString` cannot be converted. */
export declare function decodeColor(colorString: string | number | undefined | null): Color | undefined;
export declare function collectMVSReferences<T extends StateObject.Ctor>(type: T[], dependencies: Record<string, StateObject>): Record<string, StateObject.From<T>['data']>;
export declare function getMVSReferenceObject<T extends StateObject.Ctor>(type: T[], dependencies: Record<string, StateObject> | undefined, ref: string): StateObject | undefined;
