import { RestWalker as c } from "./rest.js";
import { first as f } from "./first.js";
import { IN as a } from "../constants.js";
import { Alternative as m } from "../../../../../../../@chevrotain_gast@11.0.3/node_modules/@chevrotain/gast/lib/src/model.js";
import w from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/forEach.js";
import p from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/assign.js";
class u extends c {
  constructor(o) {
    super(), this.topProd = o, this.follows = {};
  }
  startWalking() {
    return this.walk(this.topProd), this.follows;
  }
  walkTerminal(o, r, s) {
  }
  walkProdRef(o, r, s) {
    const e = d(o.referencedRule, o.idx) + this.topProd.name, l = r.concat(s), n = new m({ definition: l }), i = f(n);
    this.follows[e] = i;
  }
}
function W(t) {
  const o = {};
  return w(t, (r) => {
    const s = new u(r).startWalking();
    p(o, s);
  }), o;
}
function d(t, o) {
  return t.name + o + a;
}
export {
  u as ResyncFollowsWalker,
  d as buildBetweenProdsFollowPrefix,
  W as computeAllProdsFollows
};
