import { defineNameProp as f } from "../../lang/lang_extensions.js";
import h from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/forEach.js";
import d from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/isEmpty.js";
import u from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/map.js";
import l from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/isArray.js";
import E from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/isUndefined.js";
import g from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/keys.js";
import M from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/filter.js";
import y from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/isFunction.js";
import D from "../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/compact.js";
function S(r, i) {
  const o = g(r), n = o.length;
  for (let t = 0; t < n; t++) {
    const e = o[t], s = r[e], p = s.length;
    for (let c = 0; c < p; c++) {
      const m = s[c];
      m.tokenTypeIdx === void 0 && this[m.name](m.children, i);
    }
  }
}
function $(r, i) {
  const o = function() {
  };
  f(o, r + "BaseSemantics");
  const n = {
    visit: function(t, e) {
      if (l(t) && (t = t[0]), !E(t))
        return this[t.name](t.children, e);
    },
    validateVisitor: function() {
      const t = T(this, i);
      if (!d(t)) {
        const e = u(t, (s) => s.msg);
        throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
	${e.join(`

`).replace(/\n/g, `
	`)}`);
      }
    }
  };
  return o.prototype = n, o.prototype.constructor = o, o._RULE_NAMES = i, o;
}
function j(r, i, o) {
  const n = function() {
  };
  f(n, r + "BaseSemanticsWithDefaults");
  const t = Object.create(o.prototype);
  return h(i, (e) => {
    t[e] = S;
  }), n.prototype = t, n.prototype.constructor = n, n;
}
var a;
(function(r) {
  r[r.REDUNDANT_METHOD = 0] = "REDUNDANT_METHOD", r[r.MISSING_METHOD = 1] = "MISSING_METHOD";
})(a || (a = {}));
function T(r, i) {
  return C(r, i);
}
function C(r, i) {
  const o = M(i, (t) => y(r[t]) === !1), n = u(o, (t) => ({
    msg: `Missing visitor method: <${t}> on ${r.constructor.name} CST Visitor.`,
    type: a.MISSING_METHOD,
    methodName: t
  }));
  return D(n);
}
export {
  a as CstVisitorDefinitionError,
  $ as createBaseSemanticVisitorConstructor,
  j as createBaseVisitorConstructorWithDefaults,
  S as defaultVisit,
  C as validateMissingCstMethods,
  T as validateVisitor
};
