"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.roundSize = void 0;
exports.collectNodes = collectNodes;
exports.cloneTemplate = cloneTemplate;
const entity_utils_1 = require("../../entity-utils");
const roundSize = (value) => Math.max(1, Math.round(value));
exports.roundSize = roundSize;
function collectNodes(root, mutate) {
    const nodes = new Map();
    (function traverse(node) {
        mutate?.(node);
        nodes.set(node.id, node);
        node.children.forEach((child) => traverse(child));
    })(root);
    return nodes;
}
function cloneTemplate(template, outputId) {
    const templateClone = (0, entity_utils_1.cloneEntity)(template);
    templateClone.id = outputId;
    templateClone.geometry.id = `${outputId}_geometry`;
    return templateClone;
}
//# sourceMappingURL=common.js.map