import { ParsingWarningOrError, PdJson } from '@webpd/pd-parser';
import { NodeBuilders } from './types';
interface AbstractionLoaderSuccess {
    status: 0;
    pd: PdJson.Pd;
    parsingWarnings?: Array<ParsingWarningOrError>;
}
interface AbstractionLoaderFailure {
    status: 1;
    parsingWarnings?: Array<ParsingWarningOrError>;
    unknownNodeType?: PdJson.NodeType;
    parsingErrors?: Array<ParsingWarningOrError>;
}
type AbstractionLoaderResult = AbstractionLoaderSuccess | AbstractionLoaderFailure;
/**
 * An aync function that is passed to the parser and has for role
 * to fetch/load/... any node type that is not yet known to the parser.
 * If fetching that new node type fails (because of a parsing error,
 * or because the node is not known), the function can return `{status: 1}`
 * with the appropriate error fields.
 */
export type AbstractionLoader = (nodeType: PdJson.NodeType) => Promise<AbstractionLoaderResult>;
type Abstractions = {
    [nodeType: string]: PdJson.Pd;
};
export type AbstractionsLoadingErrors = {
    [nodeType: string]: {
        unknownNodeType?: PdJson.NodeType;
        parsingErrors?: Array<ParsingWarningOrError>;
    };
};
export type AbstractionsLoadingWarnings = {
    [nodeType: string]: Array<ParsingWarningOrError>;
};
export type NodeTypes = Set<PdJson.NodeType>;
interface CompilationSuccess {
    readonly status: 0;
    readonly pd: PdJson.Pd;
    readonly abstractions: Abstractions;
    readonly warnings: AbstractionsLoadingWarnings;
}
interface CompilationFailure {
    readonly status: 1;
    readonly pd: PdJson.Pd;
    readonly errors: AbstractionsLoadingErrors;
    readonly warnings: AbstractionsLoadingWarnings;
}
type CompilationResult = CompilationSuccess | CompilationFailure;
/**
 * Goes through a pd object, resolves and instantiates abstractions, turning
 * them into standard subpatches.
 * @returns A new PdJson.Pd object, which contains all patches and arrays
 * from the resolved abstraction as well as those from the pd object passed as argument.
 * The second value returned is the main root patch to be used for further processing.
 */
declare const _default: (pd: PdJson.Pd, nodeBuilders: NodeBuilders, abstractionLoader: AbstractionLoader) => Promise<CompilationResult>;
export default _default;
