import { m as a } from "./chunk-K5T4RW27.js";
var t = {}, c = {
  info: /* @__PURE__ */ a(async () => {
    const { createInfoServices: e } = await import("./info-OMHHGYJF.js");
    t.info = e().Info.parser.LangiumParser;
  }, "info"),
  packet: /* @__PURE__ */ a(async () => {
    const { createPacketServices: e } = await import("./packet-4T2RLAQJ.js");
    t.packet = e().Packet.parser.LangiumParser;
  }, "packet"),
  pie: /* @__PURE__ */ a(async () => {
    const { createPieServices: e } = await import("./pie-ZZUOXDRM.js");
    t.pie = e().Pie.parser.LangiumParser;
  }, "pie"),
  treeView: /* @__PURE__ */ a(async () => {
    const { createTreeViewServices: e } = await import("./treeView-SZITEDCU.js");
    t.treeView = e().TreeView.parser.LangiumParser;
  }, "treeView"),
  architecture: /* @__PURE__ */ a(async () => {
    const { createArchitectureServices: e } = await import("./architecture-YZFGNWBL.js");
    t.architecture = e().Architecture.parser.LangiumParser;
  }, "architecture"),
  gitGraph: /* @__PURE__ */ a(async () => {
    const { createGitGraphServices: e } = await import("./gitGraph-7Q5UKJZL.js");
    t.gitGraph = e().GitGraph.parser.LangiumParser;
  }, "gitGraph"),
  radar: /* @__PURE__ */ a(async () => {
    const { createRadarServices: e } = await import("./radar-PYXPWWZC.js");
    t.radar = e().Radar.parser.LangiumParser;
  }, "radar"),
  treemap: /* @__PURE__ */ a(async () => {
    const { createTreemapServices: e } = await import("./treemap-W4RFUUIX.js");
    t.treemap = e().Treemap.parser.LangiumParser;
  }, "treemap"),
  wardley: /* @__PURE__ */ a(async () => {
    const { createWardleyServices: e } = await import("./wardley-RL74JXVD.js");
    t.wardley = e().Wardley.parser.LangiumParser;
  }, "wardley")
};
async function n(e, s) {
  const i = c[e];
  if (!i) throw new Error(`Unknown diagram type: ${e}`);
  t[e] || await i();
  const r = t[e].parse(s);
  if (r.lexerErrors.length > 0 || r.parserErrors.length > 0) throw new o(r);
  return r.value;
}
a(n, "parse");
var o = class extends Error {
  constructor(e) {
    const s = e.lexerErrors.map((r) => `Lexer error on line ${r.line !== void 0 && !isNaN(r.line) ? r.line : "?"}, column ${r.column !== void 0 && !isNaN(r.column) ? r.column : "?"}: ${r.message}`).join(`
`), i = e.parserErrors.map((r) => `Parse error on line ${r.token.startLine !== void 0 && !isNaN(r.token.startLine) ? r.token.startLine : "?"}, column ${r.token.startColumn !== void 0 && !isNaN(r.token.startColumn) ? r.token.startColumn : "?"}: ${r.message}`).join(`
`);
    super(`Parsing failed: ${s} ${i}`), this.result = e;
  }
  static {
    a(this, "MermaidParseError");
  }
};
export {
  n as t
};

//# sourceMappingURL=mermaid-parser.core.js.map