import forEach_default from "../../../lodash-es/forEach.js";
import { addDummyNode } from "./util.js";
function addBorderSegments(t) {
	function n(i) {
		var a = t.children(i), o = t.node(i);
		if (a.length && forEach_default(a, n), Object.prototype.hasOwnProperty.call(o, "minRank")) {
			o.borderLeft = [], o.borderRight = [];
			for (var s = o.minRank, c = o.maxRank + 1; s < c; ++s) addBorderNode(t, "borderLeft", "_bl", i, o, s), addBorderNode(t, "borderRight", "_br", i, o, s);
		}
	}
	forEach_default(t.children(), n);
}
function addBorderNode(e, n, r, i, a, o) {
	var s = {
		width: 0,
		height: 0,
		rank: o,
		borderType: n
	}, c = a[n][o - 1], l = addDummyNode(e, "border", s, r);
	a[n][o] = l, e.setParent(l, i), c && e.setEdge(c, l, { weight: 1 });
}
export { addBorderSegments };
