import { __spreadArray } from "tslib";
export function isPathEqual(x, y) {
    if (x.length !== y.length) {
        return false;
    }
    for (var i = 0; i < x.length; i++) {
        if (x[i].value !== y[i].value) {
            return false;
        }
    }
    return true;
}
export function union(x, y) {
    return y.reduce(function (acc, path) {
        var match = acc.some(function (i) { return isPathEqual(i, path); });
        if (!match) {
            acc.push(path);
        }
        return acc;
    }, __spreadArray([], x));
}
export function difference(x, y) {
    return x.filter(function (i) { return y.every(function (j) { return !isPathEqual(i, j); }); });
}
export function getPathToNode(node) {
    var parent = node;
    var path = [];
    while (parent) {
        path.unshift(parent);
        parent = parent.parent;
    }
    return path;
}
export var getPathLabel = function (path) {
    return path.map(function (it) { return it.label; }).join(' / ');
};
export var getPathValue = function (path) {
    return path.map(function (it) { return it.value; }).join('-');
};
