import { timer as a } from "../../../../../../../../@chevrotain_utils@11.0.3/node_modules/@chevrotain/utils/lib/src/timer.js";
import { DEFAULT_PARSER_CONFIG as c } from "../parser.js";
import s from "../../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/has.js";
class d {
  initPerformanceTracer(e) {
    if (s(e, "traceInitPerf")) {
      const t = e.traceInitPerf, n = typeof t == "number";
      this.traceInitMaxIdent = n ? t : 1 / 0, this.traceInitPerf = n ? t > 0 : t;
    } else
      this.traceInitMaxIdent = 0, this.traceInitPerf = c.traceInitPerf;
    this.traceInitIndent = -1;
  }
  TRACE_INIT(e, t) {
    if (this.traceInitPerf === !0) {
      this.traceInitIndent++;
      const n = new Array(this.traceInitIndent + 1).join("	");
      this.traceInitIndent < this.traceInitMaxIdent && console.log(`${n}--> <${e}>`);
      const { time: r, value: i } = a(t), I = r > 10 ? console.warn : console.log;
      return this.traceInitIndent < this.traceInitMaxIdent && I(`${n}<-- <${e}> time: ${r}ms`), this.traceInitIndent--, i;
    } else
      return t();
  }
}
export {
  d as PerformanceTracer
};
