function a(n, c, r = !0) {
  return n.filter((e) => {
    var t;
    return e.parentId === c && (!r || ((t = e.context) == null ? void 0 : t.open));
  }).flatMap((e) => [e, ...a(n, e.id, r)]);
}
function f(n, c) {
  var e;
  let r = [], i = (e = n.find((t) => t.id === c)) == null ? void 0 : e.parentId;
  for (; i; ) {
    const t = n.find((d) => d.id === i);
    i = t == null ? void 0 : t.parentId, t && (r = r.concat(t));
  }
  return r;
}
export {
  f as getNodeAncestors,
  a as getNodeChildren
};
