var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _EdenStructureTree_renderStructureTree;
import EdenStructureTreeNode from "./eden-structure-tree-node.js";
class EdenStructureTree extends HTMLElement {
    constructor({ tree, depth, linking, templateToMatch } = {}) {
        super();
        _EdenStructureTree_renderStructureTree.set(this, () => {
            if (!this.tree)
                return;
            this.tree.forEach((node) => {
                const nodeToAppend = new EdenStructureTreeNode({
                    node: node,
                    linking: this.linking,
                    templateToMatch: this.templateToMatch,
                    depth: this.depth,
                });
                this.append(nodeToAppend);
            });
        });
        this.tree = tree;
        this.linking = linking;
        this.templateToMatch = templateToMatch;
        this.depth = depth || 0;
    }
    connectedCallback() {
        __classPrivateFieldGet(this, _EdenStructureTree_renderStructureTree, "f").call(this);
        this.tree = null;
    }
}
_EdenStructureTree_renderStructureTree = new WeakMap();
export default EdenStructureTree;
if (!customElements.get("eden-structure-tree")) {
    customElements.define("eden-structure-tree", EdenStructureTree);
}
