import React from "react";
import { AtomChange } from "../change/index.ts";
import { DetachedValue } from "../detached/index.ts";
import { EnsoUtils as Utils } from "../utils.ts";
import type { Atom } from "./definition.ts";
import { externalSymbol } from "./internal/base/index.ts";
import { AtomInternal, AtomInternalCollection } from "./internal/index.ts";
export declare class AtomImpl<Value> {
    #private;
    static prop: string;
    /**
     * Creates and memoizes a new instance from the provided initial value.
     * Just like `useState`, it will not recreate the instance on the value
     * change.
     *
     * @param initialValue - Initial value.
     * @param deps - Hook dependencies.
     *
     * @returns Memoized instance.
     */
    static use<Value>(initialValue: Value, deps: React.DependencyList): import("../hooks/index.ts").TypedHook.Memoized<AtomImpl<Value>>;
    static create<Value>(value: Value, parent?: Atom.Parent.Bare.Ref<any, any, any>): AtomImpl<Value>;
    /**
     * Ensures that the atom is not undefined. It returns a tuple with ensured
     * atom and dummy atom. If the atom is undefined, the dummy atom will
     * return as the ensured, otherwise the passed atom.
     *
     * It allows to workaround the React Hooks limitation of not being able to
     * call hooks conditionally.
     *
     * The dummy atom is frozen and won't change or trigger any events.
     *
     * @param atom - The atom to ensure. Can be undefined.
     * @returns Atoms tuple, first element - ensured atom, second - dummy atom
     */
    static useEnsure<Value, Result = undefined>(atom: AtomImpl<Value> | Utils.Falsy, mapper?: Atom.Static.Ensure.Bare.Mapper<AtomImpl<Value>, Result>): AtomImpl<unknown>;
    constructor(value: Value, parent?: Atom.Parent.Bare.Ref<Atom.Flavor.Kind, any, any>);
    deconstruct(): void;
    readonly id: string;
    get value(): Value;
    useValue(props: any): unknown;
    set(value: Value | DetachedValue, notifyParents?: boolean): this;
    /**
     * Paves the atom with the provided fallback value if the atom is undefined
     * or null. It ensures that the atom has a value, which is useful when
     * working with deeply nested optional objects, i.e., settings. It allows
     * creating the necessary atoms to assign validation errors to them, even if
     * the parents and the atom itself are not set.
     *
     * @param fallback - Fallback value to set if the atom is undefined or null.
     *
     * @returns Atom without null or undefined value in the type.
     */
    pave(fallback: Utils.NonNullish<Value>): AtomImpl<Utils.NonNullish<Value>>;
    compute<Computed>(callback: Atom.Compute.Callback<Value, Computed>): Computed;
    useCompute<Computed>(callback: Atom.Compute.Callback<Value, Computed>, deps: React.DependencyList): Computed;
    useMeta(): {};
    internal: AtomInternal;
    get size(): number;
    remove(key: keyof Value): any;
    forEach(callback: AtomInternalCollection.Callback<Value>): void;
    map<Result>(callback: AtomInternalCollection.Callback<Value, Result>): Result[];
    find(predicate: AtomInternalCollection.Predicate<Value>): AtomImpl<unknown> | undefined;
    filter(predicate: AtomInternalCollection.Predicate<Value>): AtomImpl<unknown>[];
    self: any;
    push<ItemValue extends Value[keyof Value]>(item: ItemValue): AtomImpl<ItemValue>;
    insert<ItemValue extends Value[keyof Value]>(index: number, item: ItemValue): AtomImpl<ItemValue>;
    useCollection(): AtomImpl<Value>;
    __parent: Atom.Parent.Bare.Ref<Atom.Flavor.Kind, any, any> | undefined;
    get root(): any;
    get parent(): any;
    get key(): any;
    get $(): {} | undefined;
    at(key: keyof Value): any;
    get try(): Atom.BareTry<AtomImpl<Value[keyof Value]>, keyof Value> | undefined | null;
    get path(): any;
    get name(): any;
    static name(path: any): any;
    lookup(path: Atom.Path): AtomImpl<unknown> | undefined;
    optional(): any;
    static lastChanges: WeakMap<WeakKey, any>;
    get lastChanges(): any;
    get events(): any;
    trigger(changes: AtomChange, notifyParents?: boolean): void;
    watch(callback: Atom.Watch.Bare.Callback<Value>, sync?: boolean): Atom.Unwatch;
    useWatch(callback: Atom.Watch.Bare.Callback<Value>): void;
    unwatch(): void;
    /**
     * Withholds the atom changes until `unleash` is called. It allows to batch
     * changes when submitting a form and send the submitting even to the atom
     * along with the submitting value.
     *
     * TODO: I added automatic batching of changes, so all the changes are send
     * after the current stack is cleared. Check if this functionality is still
     * needed.
     */
    withhold(): void;
    unleash(): void;
    into(intoMapper: any): {
        from: (fromMapper: any) => any;
    };
    useInto(intoMapper: any, intoDeps: React.DependencyList): import("../hooks/index.ts").TypedHook.Memoized<{
        from: import("../hooks/index.ts").TypedHook.Memoized<(fromMapper: any, fromDeps: React.DependencyList) => any>;
    }>;
    decompose(): any;
    useDecompose(callback: any, deps: React.DependencyList): any;
    decomposeNullish(): any;
    useDecomposeNullish(callback: any, deps: React.DependencyList): any;
    discriminate<Discriminator extends keyof Utils.NonNullish<Value>>(discriminator: Discriminator): any;
    useDiscriminate<Discriminator extends keyof Utils.NonNullish<Value>>(discriminator: Discriminator): any;
    useDefined(type: Atom.DefinedType): any;
    shared(): this;
    get [externalSymbol](): {
        move: (newKey: any) => void;
        create: (value: any) => bigint;
        clear: () => void;
    };
    clearCache(): void;
}
export declare class AtomProxyInternal<Kind extends Atom.Flavor.Kind, Value> {
    #private;
    constructor(external: AtomImpl<unknown>, source: AtomImpl<unknown>, into: any, from: any);
    deconstruct(): void;
    connect(source: AtomImpl<unknown>): void;
}
export declare class AtomOptionalInternal<Kind extends Atom.Flavor.Kind, Value> {
    #private;
    static instances: WeakMap<AtomImpl<unknown>, AtomOptionalInternal<any, unknown>>;
    static instance(atom: AtomImpl<unknown>): AtomOptionalInternal<any, unknown>;
    constructor(external: AtomImpl<Value>, target: Atom.BareOptionalTarget<Kind, AtomImpl<unknown>>);
    get value(): Value;
    static value<Kind extends Atom.Flavor.Kind>(prop: Atom.Prop<Kind>, target: Atom.BareOptionalTarget<Kind, AtomImpl<unknown>>): unknown;
    at<Key extends keyof Utils.NonNullish<Value>>(key: Key): any;
    get try(): Atom.BareTry<AtomImpl<Value[keyof Value]>, keyof Value> | undefined | null;
    get path(): Atom.Path;
    get root(): AtomImpl<unknown>;
}
//# sourceMappingURL=implementation.d.ts.map