/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { AnchorSet, UpPath } from "../core/index.js";
import { FlexTreeNodeSchema, FlexMapNodeSchema, FlexObjectNodeSchema, FlexTreeMapNode, FlexTreeNode, FlexTreeObjectNode } from "../feature-libraries/index.js";
import { WithType } from "./schemaTypes.js";
import { TreeArrayNode } from "./arrayNode.js";
import { TreeNode } from "./types.js";
import { TreeMapNode } from "./mapNode.js";
/**
 * Creates an anchor node and associates it with the given proxy.
 * @privateRemarks Use `forgetters` to cleanup the anchor allocated by this function once the anchor is no longer needed.
 * In practice, this happens when either the anchor node is destroyed, or another anchor to the same node is created by a new flex node.
 */
export declare function anchorProxy(anchors: AnchorSet, path: UpPath, proxy: TreeNode): void;
/**
 * Retrieves the flex node associated with the given target via {@link setFlexNode}.
 * @remarks Fails if the flex node has not been set.
 */
export declare function getFlexNode(proxy: TypedNode<FlexObjectNodeSchema>, allowFreed?: true): FlexTreeObjectNode;
export declare function getFlexNode(proxy: TreeArrayNode, allowFreed?: true): FlexTreeNode;
export declare function getFlexNode(proxy: TreeMapNode, allowFreed?: true): FlexTreeMapNode<FlexMapNodeSchema>;
export declare function getFlexNode(proxy: TreeNode, allowFreed?: true): FlexTreeNode;
/**
 * Retrieves the flex node associated with the given target via {@link setFlexNode}, if any.
 */
export declare function tryGetFlexNode(target: unknown): FlexTreeNode | undefined;
/**
 * Retrieves the proxy associated with the given flex node via {@link setFlexNode}, if any.
 */
export declare function tryGetProxy(flexNode: FlexTreeNode): TreeNode | undefined;
/**
 * Associate the given proxy and the given flex node.
 * @returns The proxy
 * @remarks
 * This creates a 1:1 mapping between the proxy and tree node.
 * Either can be retrieved from the other via {@link getFlexNode}/{@link tryGetFlexNode} or {@link tryGetProxy}.
 * If the given proxy is already mapped to an flex node, the existing mapping will be overwritten.
 * If the given flex node is already mapped to a different proxy, this function will fail.
 */
export declare function setFlexNode<TProxy extends TreeNode>(proxy: TProxy, flexNode: FlexTreeNode): TProxy;
/**
 * Given a node's schema, return the corresponding object in the proxy-based API.
 */
type TypedNode<TSchema extends FlexTreeNodeSchema> = TreeNode & WithType<TSchema["name"]>;
export {};
//# sourceMappingURL=proxyBinding.d.ts.map