"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunk_mdts_frontend"] = self["webpackChunk_mdts_frontend"] || []).push([["node_modules_mermaid_dist_chunks_mermaid_core_ebnfDiagram-CCIWWBDH_mjs"],{

/***/ "./node_modules/mermaid/dist/chunks/mermaid.core/ebnfDiagram-CCIWWBDH.mjs"
/*!********************************************************************************!*\
  !*** ./node_modules/mermaid/dist/chunks/mermaid.core/ebnfDiagram-CCIWWBDH.mjs ***!
  \********************************************************************************/
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   diagram: () => (/* binding */ diagram)\n/* harmony export */ });\n/* harmony import */ var _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./chunk-MOJQB5TN.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-MOJQB5TN.mjs\");\n/* harmony import */ var _chunk_JWPE2WC7_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./chunk-JWPE2WC7.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-JWPE2WC7.mjs\");\n/* harmony import */ var _chunk_VAUOI2AC_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./chunk-VAUOI2AC.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-VAUOI2AC.mjs\");\n/* harmony import */ var _chunk_WYO6CB5R_mjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./chunk-WYO6CB5R.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-WYO6CB5R.mjs\");\n/* harmony import */ var _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./chunk-X3CZISLH.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-X3CZISLH.mjs\");\n/* harmony import */ var _chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./chunk-Y2CYZVJY.mjs */ \"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-Y2CYZVJY.mjs\");\n/* harmony import */ var _mermaid_js_parser__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @mermaid-js/parser */ \"./node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs\");\n\n\n\n\n\n\n\n// src/diagrams/railroad/parser/ebnfParser.ts\n\nvar langiumParser = (0,_mermaid_js_parser__WEBPACK_IMPORTED_MODULE_6__.createRailroadEbnfServices)().RailroadEbnf.parser.LangiumParser;\nvar transformChoice = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((choice) => {\n  const alternatives = choice.alternatives.map(transformSequence);\n  if (alternatives.length === 1) {\n    return alternatives[0];\n  }\n  return {\n    type: \"choice\",\n    alternatives\n  };\n}, \"transformChoice\");\nvar transformSequence = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((sequence) => {\n  const elements = sequence.elements.map(transformTerm);\n  if (elements.length === 1) {\n    return elements[0];\n  }\n  return {\n    type: \"sequence\",\n    elements\n  };\n}, \"transformSequence\");\nvar transformPrimary = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((primary) => {\n  switch (primary.$type) {\n    case \"EbnfTerminal\":\n      return {\n        type: \"terminal\",\n        value: primary.value\n      };\n    case \"EbnfNonTerminal\":\n      return {\n        type: \"nonterminal\",\n        name: primary.name\n      };\n    case \"EbnfSpecial\":\n      return {\n        type: \"special\",\n        text: primary.text\n      };\n    case \"EbnfGroup\":\n      return transformChoice(primary.element);\n    case \"EbnfOptional\":\n      return {\n        type: \"optional\",\n        element: transformChoice(primary.element)\n      };\n    case \"EbnfRepetition\":\n      return {\n        type: \"repetition\",\n        element: transformChoice(primary.element),\n        min: 0,\n        max: Infinity\n      };\n    default:\n      throw new Error(`Unsupported EBNF primary node: ${primary.$type}`);\n  }\n}, \"transformPrimary\");\nvar transformPostfix = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((node, postfix) => {\n  switch (postfix.$type) {\n    case \"EbnfOptionalPostfix\":\n      return {\n        type: \"optional\",\n        element: node\n      };\n    case \"EbnfZeroOrMorePostfix\":\n      return {\n        type: \"repetition\",\n        element: node,\n        min: 0,\n        max: Infinity\n      };\n    case \"EbnfOneOrMorePostfix\":\n      return {\n        type: \"repetition\",\n        element: node,\n        min: 1,\n        max: Infinity\n      };\n    case \"EbnfExceptionPostfix\":\n      return {\n        type: \"sequence\",\n        elements: [\n          node,\n          { type: \"terminal\", value: \"-\" },\n          transformPrimary(postfix.except)\n        ]\n      };\n    default:\n      throw new Error(`Unsupported EBNF postfix node: ${postfix.$type}`);\n  }\n}, \"transformPostfix\");\nvar transformTerm = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((term) => {\n  return term.postfixes.reduce((currentNode, postfix) => {\n    return transformPostfix(currentNode, postfix);\n  }, transformPrimary(term.base));\n}, \"transformTerm\");\nvar transformRule = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((rule) => {\n  return {\n    name: rule.name,\n    definition: transformChoice(rule.definition)\n  };\n}, \"transformRule\");\nvar populateDb = /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((ast) => {\n  (0,_chunk_JWPE2WC7_mjs__WEBPACK_IMPORTED_MODULE_1__.populateCommonDb)(ast, _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db);\n  if (ast.title) {\n    _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db.setTitle(ast.title);\n  }\n  ast.rules.map((rule) => _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db.addRule(transformRule(rule)));\n}, \"populateDb\");\nvar parser = {\n  parse: /* @__PURE__ */ (0,_chunk_Y2CYZVJY_mjs__WEBPACK_IMPORTED_MODULE_5__.__name)((input) => {\n    _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db.clear();\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"[EBNF Parser] Starting Langium parse\");\n    const result = langiumParser.parse(input);\n    if (result.lexerErrors.length > 0 || result.parserErrors.length > 0) {\n      throw new _mermaid_js_parser__WEBPACK_IMPORTED_MODULE_6__.MermaidParseError(result);\n    }\n    const ast = result.value;\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"[EBNF Parser] Parsed rules:\", ast.rules.length);\n    populateDb(ast);\n    _chunk_X3CZISLH_mjs__WEBPACK_IMPORTED_MODULE_4__.log.debug(\"[EBNF Parser] Parse complete\");\n  }, \"parse\"),\n  parser: {\n    yy: _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db\n  }\n};\n\n// src/diagrams/railroad/ebnfDiagram.ts\nvar diagram = {\n  parser,\n  db: _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.db,\n  renderer: _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.renderer,\n  styles: _chunk_MOJQB5TN_mjs__WEBPACK_IMPORTED_MODULE_0__.getStyles\n};\n\n\n\n//# sourceURL=webpack://@mdts/frontend/./node_modules/mermaid/dist/chunks/mermaid.core/ebnfDiagram-CCIWWBDH.mjs?\n}");

/***/ }

}]);