import type { LinkResolver } from 'alinea/core/db/LinkResolver';
import * as Y from 'yjs';
import type { Label } from '../Label.js';
import type { Shape } from '../Shape.js';
import type { PostProcess } from '../pages/PostProcess.js';
import { RecordShape } from './RecordShape.js';
export interface UnionRow {
    _id: string;
    _type: string;
}
export declare namespace UnionRow {
    const id = "_id";
    const type = "_type";
}
export interface UnionMutator<T extends UnionRow> {
    replace: (v: T | undefined) => void;
}
export declare class UnionShape<T extends UnionRow> implements Shape<T, UnionMutator<T>> {
    label: Label;
    initialValue?: T | undefined;
    protected postProcess?: PostProcess<T> | undefined;
    shapes: Record<string, RecordShape>;
    constructor(label: Label, shapes: Record<string, RecordShape>, initialValue?: T | undefined, postProcess?: PostProcess<T> | undefined);
    create(): T;
    toY(value: T): Y.Map<unknown>;
    fromY(map: Y.Map<any>): T;
    applyY(value: T, parent: Y.Map<any>, key: string): void;
    init(parent: Y.Map<any>, key: string): void;
    watch(parent: Y.Map<any>, key: string): (fun: () => void) => () => void;
    mutator(parent: Y.Map<any>, key: string): UnionMutator<T>;
    applyLinks(value: T, loader: LinkResolver): Promise<void>;
    toV1(value: any): T;
    searchableText(value: T): string;
}
