import { Pin } from '../../Pin';
import { PinOpt } from '../../PinOpt';
import { State } from '../../State';
import { Primitive } from '../../Primitive';
import { System } from '../../system';
import { GraphComponentSpec, GraphPinSpec, GraphPinsSpec, GraphPlugOuterSpec, GraphSubPinSpec, GraphUnitOuterSpec } from '../../types';
import { Action } from '../../types/Action';
import { BundleSpec } from '../../types/BundleSpec';
import { Dict } from '../../types/Dict';
import { GraphMergeSpec } from '../../types/GraphMergeSpec';
import { GraphMergesSpec } from '../../types/GraphMergesSpec';
import { GraphSpec } from '../../types/GraphSpec';
import { GraphState } from '../../types/GraphState';
import { GraphUnitPlugs } from '../../types/GraphUnitPlugs';
import { GraphUnitSpec } from '../../types/GraphUnitSpec';
import { GraphUnitsSpec } from '../../types/GraphUnitsSpec';
import { IO } from '../../types/IO';
import { IOOf } from '../../types/IOOf';
import { UnitBundle } from '../../types/UnitBundle';
import { UnitBundleSpec } from '../../types/UnitBundleSpec';
import { Unlisten } from '../../types/Unlisten';
import { AnimationSpec, C, C_EE, ComponentSetup } from '../../types/interface/C';
import { ComponentEvents, Component_ } from '../../types/interface/Component';
import { G, G_EE, G_MoveSubgraphIntoArgs } from '../../types/interface/G';
import { U } from '../../types/interface/U';
import Merge from '../Merge';
import { Stateful_EE } from '../Stateful';
import { Unit, UnitEvents } from '../Unit';
export type Graph_EE = G_EE & C_EE & Stateful_EE;
export type GraphEvents = UnitEvents<Graph_EE> & Graph_EE;
export declare class Graph<I = any, O = any> extends Primitive<I, O, GraphEvents> implements G, C, U {
    __: string[];
    private _element;
    private _spec;
    private _unit;
    private _merge;
    private _pipedFrom;
    private _pipedTo;
    private _errUnitIds;
    private _pin;
    private _unitPins;
    private _exposedPin;
    private _exposedMerge;
    private _exposedEmptySubPin;
    private _mergeToSelfUnit;
    private _selfUniToMerge;
    private _pinToMerge;
    private _branch;
    private _mergePinCount;
    private _unitToMerge;
    private _unitToMergeCount;
    private _children;
    private _animations;
    private _stopPropagation;
    private _stopImmediatePropagation;
    private _preventDefault;
    private _waitAll;
    private _specs;
    constructor(spec: GraphSpec, branch: Dict<true>, system: System, id?: string);
    private _onPinSetRenamed;
    onInputRenamed(name: string, newName: string, opt: PinOpt, newOpt: PinOpt): void;
    onOutputRenamed(name: string, newName: string, opt: PinOpt, newOpt: PinOpt): void;
    isUnitPinConstant(unitId: string, type: IO, pinId: string): boolean;
    isUnitPinRef(unitId: string, type: IO, pinId: string): boolean;
    getUnitPinData(unitId: string, type: IO, pinId: string): any;
    removeUnitPinData(unitId: string, type: IO, pinId: string): void;
    removeMergeData(mergeId: string): void;
    setMergeData(mergeId: string, data: any): void;
    private _refMergePin;
    private _setMergeData;
    private _removeMergeData;
    private _plugToWaitAll;
    private _unplugFromWaitAll;
    private _getExposedSubPinNodeId;
    private _removeUnitPinData;
    private _setBranch;
    private _memSetBranch;
    private _simSetBranch;
    private _memRemoveBranch;
    private _simRemoveBranch;
    private _removeBranch;
    private _ensureMergePin;
    private _memEnsureMergePin;
    private _removeMergeOutput;
    private _memRemoveMergeOutput;
    private _simRemoveMergeOutput;
    private _plugPinToMerge;
    private _simPlugPinToMerge;
    private _simUnplugPinFromMerge;
    private _simUnplugPinFromUnitPin;
    private _plugPinToUnitPin;
    private _memPlugPinToUnitPin;
    private _memPlugPinToMerge;
    private _simPlugPinToUnitPin;
    private _setExposedSubPin;
    private _memSetExposedSubPin;
    private _simSetExposedSubPin;
    private _simRemoveExposedSubPin;
    private _takeErr;
    private _nextErr;
    private _destroy;
    private _reset;
    private _play;
    private _pause;
    private _removeErrUnit;
    specHasMerge: (mergeId: string) => boolean;
    private _validateMergeId;
    private _validateUnitId;
    isElement(): boolean;
    setElement(): void;
    setNotElement(): void;
    getSpec: () => GraphSpec;
    getComponentSpec: () => GraphComponentSpec;
    getBundleSpec(deep?: boolean): BundleSpec;
    getUnitBundleSpec(deep?: boolean): UnitBundleSpec;
    snapshotSelf(): Dict<any>;
    restoreSelf(state: Dict<any>): void;
    getGraphUnitSpec(id: string): GraphUnitSpec;
    getUnits: () => Dict<Unit>;
    exposeOutputSets: (outputs: GraphPinsSpec) => void;
    private _exposeOutputSets;
    exposeOutputSet: (input: GraphPinSpec, pinId: string, data?: any) => void;
    private _exposeOutputSet;
    exposeOutput: (subPinId: string, pinSpec: GraphSubPinSpec, id: string) => void;
    coverOutputSet: (id: string) => void;
    coverOutput: (subPinId: string, id: string) => void;
    plugOutput: (subPinId: string, subPin: GraphSubPinSpec, id: string) => void;
    unplugOutput: (subPinId: string, id: string) => void;
    _unplugOutput: (subPinId: string, id: string) => void;
    isExposedOutput(pin: GraphSubPinSpec): boolean;
    getExposedOutput(pin: GraphSubPinSpec): string;
    exposeInputSets: (inputs: GraphPinsSpec) => void;
    private _exposeInputSets;
    private _initInputSets;
    private _initOutputSets;
    exposeInputSet: (input: GraphPinSpec, pinId: string, data?: any) => void;
    private _exposeInputSet;
    exposePinSet: (type: IO, pinId: string, pinSpec: GraphPinSpec, data?: any, emit?: boolean, propagate?: boolean) => void;
    setUnitSize(unitId: string, width: number, height: number, emit?: boolean): void;
    setSubComponentSize(unitId: string, width: number, height: number, emit?: boolean): void;
    setComponentSize(unitId: string, width: number, height: number, emit?: boolean): void;
    _exposePinSet: (type: IO, pinId: string, pinSpec: GraphPinSpec, data?: any, propagate?: boolean) => void;
    _initPinSet: (type: IO, pinId: string, pinSpec: GraphPinSpec, propagate?: boolean) => void;
    _specExposePinSet: (type: IO, pinId: string, pinSpec: GraphPinSpec) => void;
    private _memExposePinSet;
    private _simExposePinSet;
    isPinSetFunctional: (type: IO, pinId: string) => boolean;
    setPinSetFunctional(type: IO, pinId: string, functional: boolean, emit?: boolean): void;
    private _setPinSetFunctional;
    private _specSetPinSetFunctional;
    private _memSetPinSetFunctional;
    private _simSetPinSetFunctional;
    setPinSetId(type: IO, pinId: string, nextPinId: string, emit?: boolean): void;
    _setPinSetId(type: IO, pinId: string, nextPinId: string): void;
    exposePin: (type: IO, pinId: string, subPinId: string, subPinSpec: GraphSubPinSpec, emit?: boolean, propagate?: boolean) => void;
    private _exposePin;
    private _specExposePin;
    private _memExposePin;
    private _simExposePin;
    exposeInput: (subPinId: string, pinSpec: GraphSubPinSpec, pinId: string, emit?: boolean) => void;
    coverInputSet: (id: string) => void;
    coverInput: (subPinId: string, id: string) => void;
    coverPinSet: (type: IO, id: string, emit?: boolean) => void;
    _coverPinSet: (type: IO, pinId: string) => void;
    private _memCoverPinSet;
    private _specCoverPinSet;
    private _simCoverPinSet;
    private _specSetPinRef;
    private _memPlugPin;
    private _specPlugPin;
    plugPin: (type: IO, pinId: string, subPinId: string, subPinSpec: GraphSubPinSpec, emit?: boolean, propagate?: boolean) => void;
    private _memRemoveEmptyPin;
    private _simUnplugPinFromEmpty;
    private _plugPin;
    isRefMerge: (mergeId: string) => boolean;
    private _simPlugPin;
    plugInput: (subPinId: string, subPin: GraphSubPinSpec, id: string) => void;
    unplugInput: (subPinId: string, id: string) => void;
    _unplugInput: (subPinId: string, id: string) => void;
    coverPin: (type: IO, pinId: string, subPinId: string, emit?: boolean) => void;
    private _coverPin;
    private _specCoverPin;
    private _memCoverPin;
    private _simCoverPin;
    getSubPinSpec: (type: IO, pinId: string, subPinId: string) => GraphSubPinSpec;
    unplugPin: (type: IO, pinId: string, subPinId: string, emit?: boolean, propagate?: boolean) => void;
    private _unplugPin;
    private _specUnplugPin;
    private _memUnplugPin;
    private _ensureEmptySubPin;
    private _memPlugEmptyPin;
    private _simUnplugPin;
    private __simUnplugPin;
    private _simPlugEmptyPin;
    private _memUnplugInput;
    private _memUnplugOutput;
    private _simUnplugInput;
    private _simUnplugOutput;
    isExposedInput(pin: GraphSubPinSpec): boolean;
    getExposedPin: (type: IO, id: string) => Pin;
    getExposedInputPin: (id: string) => Pin<I[keyof I]>;
    getExposedOutputPin: (id: string) => Pin<O[keyof O]>;
    getExposedPinSpecs(): IOOf<GraphPinsSpec>;
    getExposedPinSpec(type: IO, pinId: string): GraphPinSpec;
    isExposedInputPinId(pinId: string): boolean;
    isExposedOutputPinId(pinId: string): boolean;
    getExposedInputSpec(pinId: string): GraphPinSpec;
    getPlugSpec(type: IO, pinId: string, subPinId: string): GraphPinSpec;
    getExposedInputSpecs(): GraphPinsSpec;
    getExposedOutputSpec(pinId: string): GraphPinSpec;
    getExposedOutputSpecs(): GraphPinsSpec;
    hasUnit(unitId: string): boolean;
    hasMerge(mergeId: string): boolean;
    hasMergePin(mergeId: string, unitId: string, type: IO, pin_id: string): boolean;
    hasPlug(type: IO, pinId: string, subPinId: string): boolean;
    getUnit(unitId: string): Unit<any, any>;
    getGraph(unitId: string): Graph;
    removeUnitGhost(unitId: string, nextUnitId: string, spec: GraphSpec, emit?: boolean): {
        specId: string;
        bundle: UnitBundleSpec;
    };
    addUnitGhost(unitId: string, nextUnitId: string, nextUnitBundle: UnitBundleSpec, nextUnitPinMap: IOOf<Dict<string>>, emit?: boolean): void;
    getUnitOuterSpec: (unitId: string) => GraphUnitOuterSpec;
    private _addUnitGhost;
    private _removeUnitGhost;
    swapUnitGhost(unitId: string, nextUnitId: string, nextUnitBundle: UnitBundleSpec): {
        spec_id: string;
        state: {
            input: Dict<any>;
            output: Dict<any>;
            memory: Dict<any>;
        };
    };
    getUnitByPath(path: string[]): Unit<any, any>;
    read(): State;
    write(state: State): void;
    setGraphState(state: State): Promise<void>;
    getUnitState(unitId: string): State;
    getGraphState(): GraphState;
    getGraphChildren(): Dict<any>;
    getUnitPin(unitId: string, type: IO, pinId: string): Pin;
    getUnitData(unitId: string, type: IO, pinId: string): {
        input: Dict<any>;
        output: Dict<any>;
    };
    getMergeData(mergeId: string): any;
    getUnitInput(unitId: string, pinId: string): Pin;
    getUnitOutput(unitId: string, pinId: string): Pin;
    setUnitErr(unitId: string, err: string): void;
    takeUnitErr(unitId: string): string | null;
    private _takeUnitErr;
    getGraphPinData: () => object;
    getGraphMergeInputData: () => Dict<any>;
    getGraphErr: () => Dict<string | null>;
    getUnitInputData: (unitId: string) => Dict<any>;
    getMerges(): Dict<Merge>;
    refPins(): IOOf<Dict<Pin>>;
    getPlugs(): IOOf<Dict<Dict<Pin>>>;
    getPlugSpecs(): IOOf<Dict<Dict<GraphSubPinSpec>>>;
    getPlug(type: IO, pinId: string, subPinId: string): Pin;
    getMerge(mergeId: string): Merge;
    refExposedMerges(): IOOf<Dict<IOOf<Merge>>>;
    getUnitCount(): number;
    getMergeCount(): number;
    findMergeExposedSubPin(type: IO, mergeId: string): GraphPlugOuterSpec | null;
    getUnitsSpec(): GraphUnitsSpec;
    getMergesSpec(): GraphMergesSpec;
    getMergeSpec(mergeId: string): GraphMergeSpec;
    getMergeUnitCount(mergeId: string): number;
    getMergePinCount(mergeId: string): number;
    getPinPlugCount(type: IO, pinId: string): number;
    addUnit: (unitId: string, unit: Unit, bundle?: UnitBundleSpec, emit?: boolean) => void;
    fork(specId?: string, emit?: boolean): void;
    private _fork;
    private _initAddUnit;
    private _initAddUnits;
    private _addUnit;
    addUnitSpecs: (units: GraphUnitsSpec) => void;
    private _addUnitSpecs;
    private injectSubComponent;
    private _simInjectSubComponent;
    private _injectSubComponent;
    private _specInjectSubComponent;
    private componentAppend;
    private _specAppendRoot;
    private componentRemove;
    private _specComponentRemoveChild;
    removeSubComponent: (unitId: string) => void;
    private _specRemoveSubComponent;
    private _getSubComponentParentId;
    private _getSubComponentSlotName;
    private _appendSubComponentChild;
    private _insertSubComponentChild;
    private _simRemoveSubComponentFromParent;
    private _specRemoveSubComponentChild;
    private _specRemoveSubComponentFromParent;
    private _simSubComponentRemoveChild;
    private _specSubComponentAppendChild;
    private _specSubComponentInsertChild;
    private _simSubComponentAppendChild;
    private _simSubComponentInsertChild;
    private _unitUnlisten;
    addUnitSpec(unitId: string, bundle: UnitBundleSpec, emit?: boolean): Unit;
    private _addUnitSpec;
    addUnitBundle: (unitId: string, unitBundle: UnitBundle) => void;
    _addUnitBundle: (unitId: string, unitBundle: UnitBundle) => void;
    _addUnitBundleSpec(unitId: string, unitBundle: UnitBundleSpec): Unit;
    private _onUnitErr;
    private _specAddUnit;
    private setUnitPin;
    private setUnitInput;
    private setUnitOutput;
    private _memAddUnit;
    private _simAddUnit;
    private _on_unit_element;
    private _on_unit_not_element;
    removeUnit(unitId: string, emit?: boolean, take?: boolean, destroy?: boolean): U;
    cloneUnit(unitId: string, newUnitId: string): Unit;
    private _cloneUnit;
    private _moveUnit;
    moveUnit(id: string, unitId: string, inputId: string): void;
    private _memRemoveUnitFromMerges;
    private _simRemoveUnitFromMerges;
    private _removeUnitFromMerge;
    private _memRemoveUnitFromMerge;
    private _simRemoveUnitFromMerge;
    private _specRemoveUnitFromMerge;
    private _forEachUnitPinOnMerge;
    private _removeUnit;
    private _specRemoveUnit;
    private _memRemoveUnit;
    private _simRemoveUnit;
    private _subComponentRemoveChild;
    private _specUnplugUnit;
    private _unplugUnit;
    private _simUnplugUnit;
    addMerges: (merges: GraphMergesSpec) => void;
    private _addUnitMerges;
    private _addMerges;
    private _initMerges;
    private _initMerge;
    addMerge: (mergeSpec: GraphMergeSpec, mergeId: string, emit?: boolean, propagate?: boolean, merge?: Merge) => void;
    private _memUnplugUnit;
    private _createMerge;
    private _pinToPlug;
    private _addMerge;
    private _specAddMerge;
    private _memAddMerge;
    private _simAddMerge;
    private _simAddPinToMerge;
    private _specAddPinToMerge;
    private _memAddPinToMerge;
    private _memRemoveMerge;
    private _specRemoveMerge;
    private _memRemoveAllMergePlug;
    private _specRemoveAllMergePlug;
    private _memRemoveAllMergeRef;
    private _specRemoveAllMergeRef;
    private _memRemoveAllMergePin;
    private _specRemoveAllMergePin;
    private _memPostRemoveMerge;
    memIsUnitRefPin(unitId: string, type: IO, pinId: string): boolean;
    private _getUnitSpec;
    private getUnitSpecId;
    private getUnitSpec;
    isUnitRefPin(unitId: string, type: IO, pinId: string): boolean;
    isUnitRefInput(unitId: string, pinId: string): boolean;
    addPinToMerge: (mergeId: string, unitId: string, type: IO, pinId: string, emit?: boolean, propagate?: boolean) => void;
    private _addPinToMerge;
    removeMerge(mergeId: string, emit?: boolean, take?: boolean): void;
    _removeMerge(mergeId: string, propagate: boolean): Merge;
    private _simRemoveMerge;
    private _simRemoveAllPlugsFromMerge;
    private __simRemoveAllPlugsFromMerge;
    private _forEachSpecPinPlug;
    private _forEachSpecPinOfType;
    private _simRemoveAllPinsFromMerge;
    private _simPostRemoveMerge;
    removePinFromMerge(mergeId: string, unitId: string, type: IO, pinId: string, emit?: boolean, propagate?: boolean): void;
    private _removePinFromMerge;
    removePinOrMerge(mergeId: string, unitId: string, type: IO, pinId: string, emit?: boolean, propagate?: boolean): void;
    private _removePinOrMerge;
    private _memRemovePinFromMerge;
    private _specRemovePinFromMerge;
    private _simRemovePinFromMerge;
    isPinMergedTo(mergeId: string, unitId: string, type: IO, pinId: string): boolean;
    setUnitPinSetId(unitId: string, type: IO, pinId: string, newPinId: string, emit?: boolean): void;
    setUnitPinConstant(unitId: string, type: IO, pinId: string, constant: boolean, emit?: boolean): void;
    private _setUnitPinConstant;
    private _specSetUnitPinConstant;
    setUnitInputConstant(unitId: string, pinId: string, constant: boolean): void;
    setUnitOutputConstant(unitId: string, pinId: string, constant: boolean): void;
    setUnitInputIgnored(unitId: string, pinId: string, ignored: boolean): void;
    setUnitOutputIgnored(unitId: string, pinId: string, ignored: boolean): void;
    setUnitPinIgnored(unitId: string, type: IO, pinId: string, ignored: boolean): void;
    private _setUnitPinIgnored;
    private _specSetUnitPinIgnored;
    private _simSetUnitPinIgnored;
    setUnitId(unitId: string, newUnitId: string, name: string, specId: string): void;
    _setUnitId(unitId: string, newUnitId: string, name: string, specId: string): void;
    private _addUnitPlugs;
    setPlugData(type: IO, pinId: string, subPinId: string, data: any, propagate?: boolean): void;
    private _settingUnitData;
    setUnitPinData(unitId: string, type: IO, pinId: string, data: any): void;
    private _setUnitPinData;
    private _specSetUnitPinData;
    private _simSetUnitPinData;
    setUnitInputData(unitId: string, pinId: string, data: any): void;
    setUnitOutputData(unitId: string, pinId: string, data: any): void;
    private _getUnitPinPlug;
    setMetadata(path: string[], data: any): void;
    getSubComponentsParentMap(sub_component_ids: string[]): Dict<string | null>;
    getSubComponentsSlotMap(sub_component_ids: string[]): Dict<string | null>;
    moveSubComponentRoot(subComponentId: string | null, children: string[], slotMap: Dict<string>, emit?: boolean): void;
    private _appendRoot;
    removeRoot(subComponentId: string): void;
    private _removeRoot;
    private _specRemoveRoot;
    private _simRemoveRoot;
    moveSubgraphInto(...[graphId, graphBundle, specId, nodeIds, nextIdMap, nextPinIdMap, nextMergePinId, nextPlugSpec, nextSubComponentParentMap, nextSubComponentChildrenMap,]: G_MoveSubgraphIntoArgs): void;
    private _moveSubgraphInto;
    private _newMergeId;
    private _movePlugInto__inject;
    private _movePlugInto__reconnect;
    getUnitMergesSpec(unitId: string): GraphMergesSpec;
    getPinMergeId(unitId: string, type: IO, pinId: string): string | null;
    getUnitPlugsSpec(unitId: string): GraphUnitPlugs;
    private _transacting;
    private _transaction;
    startTransaction(): void;
    endTransaction: () => void;
    private _isUnitComponent;
    explodeUnit(graphId: string, mapUnitId: Dict<string>, mapMergeId: Dict<string>, plugIdMap: IOOf<Dict<Dict<string>>>): void;
    moveSubgraphOutOf(...[graphId, graphBundle, specId, nodeIds, nextIdMap, nextPinIdMap, nextMergePinId, nextPlugSpec, nextSubComponentParentMap, nextSubComponentChildrenMap,]: G_MoveSubgraphIntoArgs): void;
    private _moveSubgraphOutOf;
    getGraphUnitBundleSpec(graphId: string): BundleSpec;
    _explodeUnit(graphId: string, unitIdMap: Dict<string>, mergeIdMap: Dict<string>, plugIdMap: IOOf<Dict<Dict<string>>>): void;
    private _removeSubComponentFromParent;
    reorderSubComponent(parentId: string | null, childId: string, to: number, emit?: boolean): void;
    private _reorderSubComponent;
    private _simReorderSubComponent;
    private _specReorderSubComponent;
    moveRoot(parentId: string | null, childId: string, to: number, slotName: string): void;
    private _moveSubComponentRoot;
    private _initSetComponent;
    private _specSetComponent;
    private _initAddSubComponent;
    private _specAddSubComponent;
    private _root;
    private _parent_root;
    private _parent_children;
    private _slot;
    appendParentChild(component: Component_, slotName: string): void;
    removeParentChild(component: Component_): void;
    registerRoot(component: Component_): void;
    unregisterRoot(component: Component_): void;
    registerParentRoot(component: Component_, slotName: string, at?: number): void;
    unregisterParentRoot(component: Component_): void;
    reorderRoot(component: Component_<ComponentEvents>, to: number): void;
    reorderParentRoot(component: Component_<ComponentEvents>, to: number): void;
    insertChild(Bundle: UnitBundle<Component_>, at: number): void;
    appendChild(Bundle: UnitBundle): number;
    pushChild(Bundle: UnitBundle): number;
    pullChild(at: number): Component_;
    hasChild(at: number): boolean;
    removeChild(at: number): Component_;
    refChild(at: number): Component_;
    refChildren(): Component_[];
    refSlot(slotName: string): Component_;
    getAnimations(): AnimationSpec[];
    animate(keyframes: Keyframe[], opt: KeyframeAnimationOptions): void;
    cancelAnimation(id: string): void;
    stopPropagation(name: string): Unlisten;
    getSetup(): ComponentSetup;
    bulkEdit(actions: Action[]): void;
    private _bulkEdit;
    private _setUnitSize;
    private _specSetUnitSize;
    private _setSubComponentSize;
    private _specSetSubComponentSize;
    private _setComponentSize;
    private _specSetComponentSize;
    detach(): void;
}
