import{a,b as m,c as p}from"./chunk-75QXCHJN.js";import"./chunk-T4KNOXOM.js";import{a as s}from"./chunk-CDENLQJG.js";import{b as l}from"./chunk-23OFDAHQ.js";import"./chunk-64RAZIDH.js";import"./chunk-BKUW36BS.js";import"./chunk-4R6AKNXZ.js";import{b as i}from"./chunk-7BXJKEEM.js";import"./chunk-KKCTMRNV.js";import"./chunk-3JAGLS23.js";import"./chunk-PVZRSI6V.js";import"./chunk-JDVLQXMK.js";import"./chunk-WQ47ED54.js";import"./chunk-AP7GPLJ7.js";import"./chunk-W7QF4GTN.js";import"./chunk-42NANJO2.js";import"./chunk-GYOZBIN2.js";import"./chunk-RLKBNOCG.js";import"./chunk-CR6SF2HR.js";import"./chunk-7AJGXJKH.js";import"./chunk-E5GXGYZM.js";import{b as n}from"./chunk-ZZZJFKF2.js";import{a as t}from"./chunk-YUSHYV7C.js";import"./chunk-C6Q5SG76.js";var f=i().RailroadPeg.parser.LangiumParser,c=t(e=>{let r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{let r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{let r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${u(r)}`:`!${u(r)}`}:r},"transformPrefix"),u=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{let r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return c(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:c(e.definition)}),"transformRule"),h=t(e=>{s(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),n.debug("[PEG Parser] Starting Langium parse");let r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new l(r);let o=r.value;n.debug("[PEG Parser] Parsed rules:",o.rules.length),h(o),n.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},R={parser:b,db:a,renderer:p,styles:m};export{R as diagram};
