/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { getTreeContext, } from "../feature-libraries";
import { disposeSymbol } from "../util";
/**
 * Implementation of FlexTreeView wrapping a ITreeCheckout.
 */
export class CheckoutFlexTreeView {
    constructor(checkout, schema, nodeKeyManager, nodeKeyFieldKey, onDispose) {
        this.checkout = checkout;
        this.schema = schema;
        this.nodeKeyManager = nodeKeyManager;
        this.nodeKeyFieldKey = nodeKeyFieldKey;
        this.onDispose = onDispose;
        this.context = getTreeContext(schema, this.checkout.forest, this.checkout.editor, nodeKeyManager, nodeKeyFieldKey);
        this.editableTree = this.context.root;
    }
    [disposeSymbol]() {
        this.context[disposeSymbol]();
        this.onDispose?.();
    }
    fork() {
        const branch = this.checkout.fork();
        return new CheckoutFlexTreeView(branch, this.schema, this.nodeKeyManager, this.nodeKeyFieldKey);
    }
}
//# sourceMappingURL=treeView.js.map