"use strict";(self.webpackChunkpowerwiki=self.webpackChunkpowerwiki||[]).push([[6402],{16402(e,r,a){a.d(r,{diagram:()=>m});var t=a(67977),n=a(77454),l=(a(22422),a(32178),a(31293)),i=a(86827),s=a(78731),p=(0,s.lz)().Railroad.parser.LangiumParser,o=(0,i.K)(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(o);return 1===r.length?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(o);return 1===r.length?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:o(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:o(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:o(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),d=(0,i.K)(e=>({name:e.name,definition:o(e.definition)}),"transformRule"),u=(0,i.K)(e=>{(0,n.S)(e,t.db),e.title&&t.db.setTitle(e.title),e.rules.map(e=>t.db.addRule(d(e)))},"populateDb"),m={parser:{parse:(0,i.K)(e=>{t.db.clear(),l.R.debug("[Railroad Parser] Starting Langium parse");const r=p.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new s.zg(r);const a=r.value;l.R.debug("[Railroad Parser] Parsed rules:",a.rules.length),u(a),l.R.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t.db}},db:t.db,renderer:t.U,styles:t.$}}}]);