/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { getKernel, isTreeNode, } from "../core/index.js";
import { treeNodeApi } from "./treeNodeApi.js";
import { createFromCursor } from "./create.js";
/**
 * Extensions to {@link Tree} which are not yet stable.
 * @sealed @beta
 */
export const TreeBeta = {
    on(node, eventName, listener) {
        return treeNodeApi.on(node, eventName, listener);
    },
    clone(node) {
        /** The only non-TreeNode cases are {@link TreeLeafValue} and `undefined` (for an empty optional field) which can be returned as is. */
        if (!isTreeNode(node)) {
            return node;
        }
        const kernel = getKernel(node);
        const cursor = kernel.getOrCreateInnerNode().borrowCursor();
        return createFromCursor(kernel.schema, cursor);
    },
};
//# sourceMappingURL=treeApiBeta.js.map