"use strict";
var _a;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const chunkBN7GFLIU = require("./dist-chunks-mermaid-parser.core-chunk-BN7GFLIU.cjs");
const chunkT44TD3VJ = require("./dist-chunks-mermaid-parser.core-chunk-T44TD3VJ.cjs");
const chunkKMC2YHZD = require("./dist-chunks-mermaid-parser.core-chunk-KMC2YHZD.cjs");
const chunkWFWHJNB7 = require("./dist-chunks-mermaid-parser.core-chunk-WFWHJNB7.cjs");
const chunkJEIROHC2 = require("./dist-chunks-mermaid-parser.core-chunk-JEIROHC2.cjs");
const chunkWFRQ32O7 = require("./dist-chunks-mermaid-parser.core-chunk-WFRQ32O7.cjs");
const chunkXRWGC2XP = require("./dist-chunks-mermaid-parser.core-chunk-XRWGC2XP.cjs");
const chunk4KMFLZZN = require("./dist-chunks-mermaid-parser.core-chunk-4KMFLZZN.cjs");
var parsers = {};
var initializers = {
  info: /* @__PURE__ */ chunk4KMFLZZN.__name(async () => {
    const { createInfoServices: createInfoServices2 } = await Promise.resolve().then(() => require("./dist-chunks-mermaid-parser.core-info-63CPKGFF.cjs"));
    const parser = createInfoServices2().Info.parser.LangiumParser;
    parsers.info = parser;
  }, "info"),
  packet: /* @__PURE__ */ chunk4KMFLZZN.__name(async () => {
    const { createPacketServices: createPacketServices2 } = await Promise.resolve().then(() => require("./dist-chunks-mermaid-parser.core-packet-HUATNLJX.cjs"));
    const parser = createPacketServices2().Packet.parser.LangiumParser;
    parsers.packet = parser;
  }, "packet"),
  pie: /* @__PURE__ */ chunk4KMFLZZN.__name(async () => {
    const { createPieServices: createPieServices2 } = await Promise.resolve().then(() => require("./dist-chunks-mermaid-parser.core-pie-WTHONI2E.cjs"));
    const parser = createPieServices2().Pie.parser.LangiumParser;
    parsers.pie = parser;
  }, "pie"),
  architecture: /* @__PURE__ */ chunk4KMFLZZN.__name(async () => {
    const { createArchitectureServices: createArchitectureServices2 } = await Promise.resolve().then(() => require("./dist-chunks-mermaid-parser.core-architecture-O4VJ6CD3.cjs"));
    const parser = createArchitectureServices2().Architecture.parser.LangiumParser;
    parsers.architecture = parser;
  }, "architecture"),
  gitGraph: /* @__PURE__ */ chunk4KMFLZZN.__name(async () => {
    const { createGitGraphServices: createGitGraphServices2 } = await Promise.resolve().then(() => require("./dist-chunks-mermaid-parser.core-gitGraph-ZV4HHKMB.cjs"));
    const parser = createGitGraphServices2().GitGraph.parser.LangiumParser;
    parsers.gitGraph = parser;
  }, "gitGraph"),
  radar: /* @__PURE__ */ chunk4KMFLZZN.__name(async () => {
    const { createRadarServices: createRadarServices2 } = await Promise.resolve().then(() => require("./dist-chunks-mermaid-parser.core-radar-NJJJXTRR.cjs"));
    const parser = createRadarServices2().Radar.parser.LangiumParser;
    parsers.radar = parser;
  }, "radar"),
  treemap: /* @__PURE__ */ chunk4KMFLZZN.__name(async () => {
    const { createTreemapServices: createTreemapServices2 } = await Promise.resolve().then(() => require("./dist-chunks-mermaid-parser.core-treemap-75Q7IDZK.cjs"));
    const parser = createTreemapServices2().Treemap.parser.LangiumParser;
    parsers.treemap = parser;
  }, "treemap")
};
async function parse(diagramType, text) {
  const initializer = initializers[diagramType];
  if (!initializer) {
    throw new Error(`Unknown diagram type: ${diagramType}`);
  }
  if (!parsers[diagramType]) {
    await initializer();
  }
  const parser = parsers[diagramType];
  const result = parser.parse(text);
  if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) {
    throw new MermaidParseError(result);
  }
  return result.value;
}
chunk4KMFLZZN.__name(parse, "parse");
var MermaidParseError = (_a = class extends Error {
  constructor(result) {
    const lexerErrors = result.lexerErrors.map((err) => err.message).join("\n");
    const parserErrors = result.parserErrors.map((err) => err.message).join("\n");
    super(`Parsing failed: ${lexerErrors} ${parserErrors}`);
    this.result = result;
  }
}, chunk4KMFLZZN.__name(_a, "MermaidParseError"), _a);
exports.GitGraphModule = chunkBN7GFLIU.GitGraphModule;
exports.createGitGraphServices = chunkBN7GFLIU.createGitGraphServices;
exports.InfoModule = chunkT44TD3VJ.InfoModule;
exports.createInfoServices = chunkT44TD3VJ.createInfoServices;
exports.PacketModule = chunkKMC2YHZD.PacketModule;
exports.createPacketServices = chunkKMC2YHZD.createPacketServices;
exports.PieModule = chunkWFWHJNB7.PieModule;
exports.createPieServices = chunkWFWHJNB7.createPieServices;
exports.ArchitectureModule = chunkJEIROHC2.ArchitectureModule;
exports.createArchitectureServices = chunkJEIROHC2.createArchitectureServices;
exports.RadarModule = chunkWFRQ32O7.RadarModule;
exports.createRadarServices = chunkWFRQ32O7.createRadarServices;
exports.TreemapModule = chunkXRWGC2XP.TreemapModule;
exports.createTreemapServices = chunkXRWGC2XP.createTreemapServices;
exports.AbstractMermaidTokenBuilder = chunk4KMFLZZN.AbstractMermaidTokenBuilder;
exports.AbstractMermaidValueConverter = chunk4KMFLZZN.AbstractMermaidValueConverter;
exports.Architecture = chunk4KMFLZZN.Architecture;
exports.ArchitectureGeneratedModule = chunk4KMFLZZN.ArchitectureGeneratedModule;
exports.Branch = chunk4KMFLZZN.Branch;
exports.Commit = chunk4KMFLZZN.Commit;
exports.CommonValueConverter = chunk4KMFLZZN.CommonValueConverter;
exports.GitGraph = chunk4KMFLZZN.GitGraph;
exports.GitGraphGeneratedModule = chunk4KMFLZZN.GitGraphGeneratedModule;
exports.Info = chunk4KMFLZZN.Info;
exports.InfoGeneratedModule = chunk4KMFLZZN.InfoGeneratedModule;
exports.Merge = chunk4KMFLZZN.Merge;
exports.MermaidGeneratedSharedModule = chunk4KMFLZZN.MermaidGeneratedSharedModule;
exports.Packet = chunk4KMFLZZN.Packet;
exports.PacketBlock = chunk4KMFLZZN.PacketBlock;
exports.PacketGeneratedModule = chunk4KMFLZZN.PacketGeneratedModule;
exports.Pie = chunk4KMFLZZN.Pie;
exports.PieGeneratedModule = chunk4KMFLZZN.PieGeneratedModule;
exports.PieSection = chunk4KMFLZZN.PieSection;
exports.Radar = chunk4KMFLZZN.Radar;
exports.RadarGeneratedModule = chunk4KMFLZZN.RadarGeneratedModule;
exports.Statement = chunk4KMFLZZN.Statement;
exports.Treemap = chunk4KMFLZZN.Treemap;
exports.TreemapGeneratedModule = chunk4KMFLZZN.TreemapGeneratedModule;
exports.isArchitecture = chunk4KMFLZZN.isArchitecture;
exports.isBranch = chunk4KMFLZZN.isBranch;
exports.isCommit = chunk4KMFLZZN.isCommit;
exports.isGitGraph = chunk4KMFLZZN.isGitGraph;
exports.isInfo = chunk4KMFLZZN.isInfo;
exports.isMerge = chunk4KMFLZZN.isMerge;
exports.isPacket = chunk4KMFLZZN.isPacket;
exports.isPacketBlock = chunk4KMFLZZN.isPacketBlock;
exports.isPie = chunk4KMFLZZN.isPie;
exports.isPieSection = chunk4KMFLZZN.isPieSection;
exports.isTreemap = chunk4KMFLZZN.isTreemap;
exports.MermaidParseError = MermaidParseError;
exports.parse = parse;
//# sourceMappingURL=dist-mermaid-parser.core.cjs.map
